query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c0271bd62806059e61123020f4e0df98", "score": "0.0", "text": "def update!(**args)\n @folders = args[:folders] if args.key?(:folders)\n @name = args[:name] if args.key?(:name)\n @parent = args[:parent] if args.key?(:parent)\n @parent_display_name = args[:parent_display_name] if args.key?(:parent_display_name)\n @project = args[:project] if args.key?(:project)\n @project_display_name = args[:project_display_name] if args.key?(:project_display_name)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update(properties)\n @__hash__.update(properties)\n end", "title": "" }, { "docid": "60506d5995c168a570c84bcbafd6d01b", "score": "0.7164913", "text": "def update props\n # not an alias because doc\n put props\n end", "title": "" }, { "docid": "ec25850e7b3d73876b69868b5e566a7a", "score": "0.71243227", "text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "title": "" }, { "docid": "b46342a57789464175130c5171865a4f", "score": "0.69842774", "text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "4aa62f56c7ec71b9c7d914558501001b", "score": "0.67206186", "text": "def update\n update_obj\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "b0508d605628b9b1ec78fe5f0697a746", "score": "0.67057854", "text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "d9b090f93fdffad34c5489c4c437c6f3", "score": "0.6662612", "text": "def update_properties(properties_element)\n end", "title": "" }, { "docid": "b7ed68c679d7eaccf546a282fab6e985", "score": "0.66259164", "text": "def apply\n update_keys\n update_columns\n update_properties\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "862f7aa179e3e1751693f78772c09a99", "score": "0.65159345", "text": "def assign_properties(properties); end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "d8b3bf9ec121e23dad3af2edca6e6094", "score": "0.6421526", "text": "def update(attributes); end", "title": "" }, { "docid": "63cce5e99d8dc677403b00708afc27c9", "score": "0.641709", "text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end", "title": "" }, { "docid": "3dc790e8b6e9e65eb288c97798a4c7f2", "score": "0.64154994", "text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end", "title": "" }, { "docid": "9373755ebb61f1f274f6c8504a5acace", "score": "0.64146614", "text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "71d6a0160cffce28db4d0a25d6dbda13", "score": "0.6385747", "text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf", "score": "0.6364864", "text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end", "title": "" }, { "docid": "575f3d0c94f466263e302883e13868a6", "score": "0.6330631", "text": "def _update\n update!\n end", "title": "" }, { "docid": "7c6d5966289f9347f75aa7b24903a328", "score": "0.6327251", "text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "title": "" }, { "docid": "210886bcfd68fae88847f8b3464d4058", "score": "0.6325362", "text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.6319025", "text": "def update\n \n end", "title": "" }, { "docid": "749afa4ff068e21c7d78bbad94c19d6c", "score": "0.6313444", "text": "def update!(attributes); end", "title": "" }, { "docid": "e8639be61ed6393bc612a8aef27789d3", "score": "0.6312355", "text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "5a8e82caac01cee661bc875a5b0cf723", "score": "0.6283673", "text": "def refresh\n set_attributes\n end", "title": "" }, { "docid": "9e076ce17f1607b2a6248469b63b9c05", "score": "0.62797445", "text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "7a41bc9d5a07220fb8626d1fa90d2d79", "score": "0.62639254", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "afd53a32bf51a2ff3c438cbf011b1ee6", "score": "0.6261246", "text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end", "title": "" }, { "docid": "118090da310d688caa13dea348732f3c", "score": "0.62579167", "text": "def update(attributes={})\n self.class.update(self, attributes)\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.62152076", "text": "def update\n \n end", "title": "" }, { "docid": "1c12f310aca206a2cefff8c291007668", "score": "0.6210263", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "3dfb66c3e13f181393bb4510e9fcd51f", "score": "0.62083745", "text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "5d229ea224b1dfa7ac9ce6808ca63fc4", "score": "0.62017816", "text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "title": "" }, { "docid": "6992c0833b982296b329ec1d8c7289de", "score": "0.6201711", "text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end", "title": "" }, { "docid": "2beb42793217599eea1dac4b91640e41", "score": "0.6196084", "text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "title": "" }, { "docid": "67f76e6622d1021031437ad609613c63", "score": "0.6192824", "text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end", "title": "" }, { "docid": "30aa07725af2114280d6e8f916ab079f", "score": "0.6183338", "text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend", "title": "" }, { "docid": "f1f71f298690a3bd1f5832b15038d8bb", "score": "0.6174291", "text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "7f11aed7030229ef429116ccba78c00f", "score": "0.61400205", "text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end", "title": "" }, { "docid": "22a21a1959eeb926dfe475d8878239d7", "score": "0.6127356", "text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" } ]
ca48155eccc337677dc13fcef2cc1b73
build instance from Faraday::Response
[ { "docid": "283c018846e958c3e1fba191c3663787", "score": "0.635369", "text": "def initialize(response)\n Paperdrive::Error.raise_from(response)\n @header = response.headers.to_h\n @ratelimit = build_ratelimit(@header)\n @body = JSON.parse(response.body)\n @status_code = response.status\n @status_phrase = response.reason_phrase\n end", "title": "" } ]
[ { "docid": "731c7985bc4a105597804ffd2103154a", "score": "0.70656693", "text": "def initialize(faraday_response, client)\n @client = client\n @response = faraday_response\n @response.on_complete do\n @request_id = headers['X-Orchestrate-Req-Id'] if headers['X-Orchestrate-Req-Id']\n @request_time = Time.parse(headers['Date']) if headers['Date']\n if headers['Content-Type'] =~ /json/ && !@response.body.strip.empty?\n @body = JSON.parse(@response.body)\n else\n @body = @response.body\n end\n handle_error_response unless success?\n end\n end", "title": "" }, { "docid": "036a6769e425e7c85e15921724789f2f", "score": "0.6977783", "text": "def initialize(faraday_response, options = {})\n @faraday_response = faraday_response\n\n case options[:type] || nil\n when :array\n @faraday_response.env[:body] = [@faraday_response.body] unless @faraday_response.body.is_a?(Array)\n end\n end", "title": "" }, { "docid": "42fa295f745951dab52ad5afc27db10c", "score": "0.6942609", "text": "def from_response(response)\n\n payload = response.body\n @error = payload['error']\n @error_code = payload['error_code']\n @details = payload['details']\n @response = response\n\n logger.error(\"Request failed with status #{response.code.to_s}: '#{@error_code} #{@error}': #{response.body}\")\n\n self\n end", "title": "" }, { "docid": "c64814727559db8adaedccc5eb5ff21c", "score": "0.6857095", "text": "def response_builder response\n JSON.parse response.body\n end", "title": "" }, { "docid": "6c888eaa3322c0f28301b916bba083ae", "score": "0.6763999", "text": "def dup_from_response(resp)\n return self if resp.nil?\n\n # Faraday's API is a little unusual. Normally it'll produce a response\n # object with a `headers` method, but on error what it puts into\n # `e.response` is an untyped `Hash`.\n headers = if resp.is_a?(Faraday::Response)\n resp.headers\n else\n resp[:headers]\n end\n\n context = dup\n context\n end", "title": "" }, { "docid": "2ae8ab275a320a9c5b4a70929ccb2556", "score": "0.6711066", "text": "def initialize(response)\n @status, @headers = *response\n @body = process_body(response[2])\n end", "title": "" }, { "docid": "86407da3140ed5409ee2c29008a573d3", "score": "0.67081386", "text": "def from_response(response)\n args = {\n bank_code: response['bank_code'],\n bank_name: response['bank_name'],\n features: response['features'],\n forgotten_password: response['forgotten_password'],\n is_active: response['is_active'],\n logo: response['logo'],\n tx_history_months: response['tx_history_months']\n }\n self.new(args)\n end", "title": "" }, { "docid": "51a510993ee437e2f11936c130d5785b", "score": "0.6697337", "text": "def from_response(response)\n args = {\n id: response['_id'],\n is_active: response['is_active'],\n scope: response['scope'],\n url: response['url']\n }\n self.new(args)\n end", "title": "" }, { "docid": "271fa4977329d13de0e6d867c395d658", "score": "0.66857904", "text": "def initialize(response)\n super\n @response = response\n end", "title": "" }, { "docid": "c4e49b7f32b322a9cfc83241905a5736", "score": "0.6683686", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "1dcfdd0696cb995ba3d06f4652b934c6", "score": "0.66488415", "text": "def initialize resp\n @response = resp\n end", "title": "" }, { "docid": "8a3b6dfe2a990e89689760aa0197a81f", "score": "0.6635432", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "8a3b6dfe2a990e89689760aa0197a81f", "score": "0.6635432", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "8a3b6dfe2a990e89689760aa0197a81f", "score": "0.6635432", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "8eada65973594a467eb15c0f0c5b8a7a", "score": "0.6591003", "text": "def initialize(response)\n @real_response = response\n end", "title": "" }, { "docid": "e014f489f8df32027c9289b8bc5658fe", "score": "0.65782344", "text": "def initialize(response)\n super response\n\n # Parse response\n stats = @body.delete('stats')\n contacts = @body.delete('contacts')\n\n # Set statistics\n if stats\n @success_count = stats.delete('success')\n @exists_count = stats.delete('exists')\n @failed_count = stats.delete('failed')\n end\n\n # Set contacts\n if contacts\n @exists = contacts.delete('exists')\n @failed = contacts.delete('failed')\n end\n end", "title": "" }, { "docid": "0200524c0a2b556069ac9258ff2917d5", "score": "0.65770775", "text": "def initialize(response)\n @status = response.code\n @body = response.to_str\n @headers = response.headers\n @cookies = response.cookies\n\n # mark status\n if @status == 200\n if self.json?\n content = self.to_json\n @code = content['Code']\n @dataset = content['Request']\n elsif self.xml?\n content = self.to_xml\n @code = content['ApiResult']['Code']\n @dataset = content['ApiResult']['Result']\n end\n\n @code, @error = @code.split('|') if @code and @code.include?'|'\n @code = @code\n end\n end", "title": "" }, { "docid": "b1722867c00c59435307940587dd50c6", "score": "0.65748215", "text": "def initialize(response)\n response.error = self\n @response = response\n\n message = []\n\n if response.parsed.is_a?(Hash)\n @code = response.parsed['error']\n @description = response.parsed['error_description']\n message << \"#{@code}: #{@description}\"\n end\n\n message << response.body\n\n super(message.join(\"\\n\"))\n end", "title": "" }, { "docid": "941d3eb18ec3d1c0ad1725a3e86a12aa", "score": "0.65658754", "text": "def convert_response(response)\r\n return HttpResponse.new(response.code, response.headers.dup, response.raw_body.dup)\r\n end", "title": "" }, { "docid": "37d6d574cdae396d37a4081f50e04ad0", "score": "0.6552857", "text": "def faraday\n ::Faraday.new do |builder|\n builder.response :json, content_type: /\\bjson$/\n builder.adapter :test, faraday_stubs\n end\n end", "title": "" }, { "docid": "8c680dc28fa829bcf8c19290620f6a7c", "score": "0.6546943", "text": "def initialize(response)\n\t\t\tsuper\n\t\t\t@response = response\n\t\tend", "title": "" }, { "docid": "507b6bc2778e67e4136ffa84956d577d", "score": "0.65452343", "text": "def initialize(response)\n @body, @status = response.body, response.status\n end", "title": "" }, { "docid": "0772197224712444849ffa325ac54c5c", "score": "0.65423346", "text": "def initialize response\n @original_response, @parsed_response = response, Nokogiri::XML(response.body)\n end", "title": "" }, { "docid": "3a25f80361a52641f0fc298a7ea9b07e", "score": "0.6532361", "text": "def initialize(response)\n @response = response\n @status = response.code.to_i\n @body = Nokogiri::XML(response.body)\n end", "title": "" }, { "docid": "1e95e738196d9a7b8f9ac2ea5f34c3fd", "score": "0.6528102", "text": "def initialize(response)\n super response\n\n # Parse response\n stats = @body.delete('stats')\n contacts = @body.delete('contacts')\n\n # Set statistics\n if stats\n @success_count = stats.delete('success')\n @failed_count = stats.delete('failed')\n end\n\n # Set contacts\n @failed = contacts.delete('failed') if contacts\n end", "title": "" }, { "docid": "342522146c0203de7664eea3a531cdd5", "score": "0.652071", "text": "def initialize(response)\n @response_object = response\n @parsed_response = Nokogiri::XML(response.body)\n end", "title": "" }, { "docid": "994bf2b7ff07e871c1eb709acd7b381f", "score": "0.6520618", "text": "def dup_from_response(resp)\n return self if resp.nil?\n\n # Faraday's API is a little unusual. Normally it'll produce a response\n # object with a `headers` method, but on error what it puts into\n # `e.response` is an untyped `Hash`.\n headers = if resp.is_a?(Faraday::Response)\n resp.headers\n else\n resp[:headers]\n end\n\n context = dup\n context.account = headers[\"Stripe-Account\"]\n context.api_version = headers[\"Stripe-Version\"]\n context.idempotency_key = headers[\"Idempotency-Key\"]\n context.request_id = headers[\"Request-Id\"]\n context\n end", "title": "" }, { "docid": "2bcb472b7eb350b920a4f8096e34c33a", "score": "0.6519081", "text": "def faraday_to_pacto_response(faraday_response)\n data = {\n status: faraday_response.status,\n headers: faraday_response.headers,\n body: faraday_response.body\n }\n Pacto::PactoResponse.new(data)\n end", "title": "" }, { "docid": "2bcb472b7eb350b920a4f8096e34c33a", "score": "0.6519081", "text": "def faraday_to_pacto_response(faraday_response)\n data = {\n status: faraday_response.status,\n headers: faraday_response.headers,\n body: faraday_response.body\n }\n Pacto::PactoResponse.new(data)\n end", "title": "" }, { "docid": "485b6cb0b8614f92d0e145a65ac39ffa", "score": "0.6509335", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "485b6cb0b8614f92d0e145a65ac39ffa", "score": "0.6509335", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "485b6cb0b8614f92d0e145a65ac39ffa", "score": "0.6509335", "text": "def initialize(response)\n @response = response\n end", "title": "" }, { "docid": "6746bb3090e0791d98ea742ddedddf2a", "score": "0.65076435", "text": "def process_http_response(response)\n Result.new(self, response)\n end", "title": "" }, { "docid": "46624e44f501eea9d4e3d8315fcfa74f", "score": "0.6494468", "text": "def faraday\n @_faraday ||= Faraday.new(url) do |conn|\n conn.request :json\n conn.response :json\n case @authenticator\n when :basic_auth\n conn.basic_auth *@credentials\n when :oauth\n conn.authorization :Bearer, @auth_token\n end\n conn.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "c1d0ae5c8ee65c3ccbf3d1f11f266dea", "score": "0.6492054", "text": "def convert_response(response)\n return HttpResponse.new(response.code, response.headers.dup, response.raw_body.dup)\n end", "title": "" }, { "docid": "f6f60ee350b3787d1a8385c417edcd23", "score": "0.64783746", "text": "def initialize(response)\n populate_attributes_for response['content']\n\n @raw_data = response['content']\n @project_id = response['content']['project_id']\n @client = response['client']\n @path = infer_path_from response\n end", "title": "" }, { "docid": "a72547ca672dd332d0c2f77df8291030", "score": "0.647097", "text": "def parse_response(response)\n response\n end", "title": "" }, { "docid": "a72547ca672dd332d0c2f77df8291030", "score": "0.647097", "text": "def parse_response(response)\n response\n end", "title": "" }, { "docid": "2e32f6172c00d2137ea7d9017cc4f5f5", "score": "0.6462143", "text": "def parse_response(response)\n unless response.body\n raise ResponseError, 'PaynetEasy response is empty'\n end\n\n # Change hash format from {'key' => ['value']} to {'key' => 'value'} in map block\n response_fields = Hash[CGI.parse(response.body).map {|key, value| [key, value.first]}]\n\n Response.new response_fields\n end", "title": "" }, { "docid": "abed0180edee139469f9eeb9405965db", "score": "0.6432392", "text": "def faraday_builder; end", "title": "" }, { "docid": "265309273a87018e7cdf0c8e6fa22356", "score": "0.64308554", "text": "def initialize(response)\n @response = response\n @status = response.code.to_i\n @body = Nokogiri::XML(response.body)\n\n __setobj__(@body)\n end", "title": "" }, { "docid": "990e94b8f0e84eff2cdad41e8e100881", "score": "0.6429145", "text": "def parse_response(response, **options)\n json = parse_body(response.body)\n json = json[options[:object]] if options.key?(:object)\n json.is_a?(Array) ? json.map { |a| new(a) } : new(json)\n end", "title": "" }, { "docid": "d85150275aa6c2c45adc12740c91e852", "score": "0.6427525", "text": "def response_builder response\n response.body\n end", "title": "" }, { "docid": "f50f58c82d077c07d6bf66569a770e51", "score": "0.6411528", "text": "def from_response(node, response)\n args = {\n node: node,\n error_code: response['error_code'],\n http_code: response['http_code'],\n success: response['success'],\n page_count: response['page_count'],\n trans_count: response['trans_count'],\n trans: response['trans'].map{|tx_response| Transaction.from_response(node, tx_response)},\n }\n self.new(**args)\n end", "title": "" }, { "docid": "4a908557f5390264a3042ee2ad344fc0", "score": "0.6411473", "text": "def setup_response(response)\n # TODO: turn this into an all-purpose Response class\n\n result = response[:fecae_solicitar_response][:fecae_solicitar_result]\n\n errors_result = result[:errors]\n\n response_header = result[:fe_cab_resp]\n response_detail = result[:fe_det_resp][:fecae_det_response]\n\n request_header = body['FeCAEReq']['FeCabReq'].underscore_keys.symbolize_keys\n request_detail = body['FeCAEReq']['FeDetReq']['FECAEDetRequest'].underscore_keys.symbolize_keys\n\n\n request_detail.merge!(request_detail.delete(:iva)['AlicIva'].underscore_keys.symbolize_keys) if !invoice_c?\n\n response_hash = { :header_result => response_header.delete(:resultado),\n :authorized_on => response_header.delete(:fch_proceso),\n :detail_result => response_detail.delete(:resultado),\n :cae_due_date => response_detail.delete(:cae_fch_vto),\n :cae => response_detail.delete(:cae),\n :iva_id => request_detail.delete(:id),\n :iva_importe => request_detail.delete(:importe),\n :moneda => request_detail.delete(:mon_id),\n :cotizacion => request_detail.delete(:mon_cotiz),\n :iva_base_imp => request_detail.delete(:base_imp),\n :doc_num => request_detail.delete(:doc_nro),\n :errors => errors_result\n }.merge!(request_header).merge!(request_detail)\n\n keys, values = response_hash.to_a.transpose\n\n self.response = (defined?(Struct::Response) ? Struct::Response : Struct.new('Response', *keys)).new(*values)\n end", "title": "" }, { "docid": "8f37e7ebc44ebd17a8ea551be9b64e8d", "score": "0.6411459", "text": "def build_response(h)\n OpenStruct.new(h)\n end", "title": "" }, { "docid": "8f37e7ebc44ebd17a8ea551be9b64e8d", "score": "0.6411459", "text": "def build_response(h)\n OpenStruct.new(h)\n end", "title": "" }, { "docid": "6a07a47d230907419f49d9addf62bdf8", "score": "0.6392951", "text": "def from_response(node, response)\n args = {\n node: node,\n id: response['_id'],\n amount: response['amount']['amount'],\n currency: response['amount']['currency'],\n client_id: response['client']['id'],\n client_name: response['client']['name'],\n created_on: response['extra']['created_on'],\n ip: response['extra']['ip'],\n latlon: response['extra']['latlon'],\n note: response['extra']['note'],\n process_on: response['extra']['process_on'],\n same_day: response['extra']['same_day'],\n supp_id: response['extra']['supp_id'],\n webhook: response['extra']['webhook'],\n fees: response['fees'],\n recent_status: response['recent_status'],\n timeline: response['timeline'],\n from: response['from'],\n to: response['to'],\n to_type: response['to']['type'],\n to_id: response['to']['id']\n }\n if response['fees'].any?\n args[:fee_amount] = response['fees'].first['fee']\n args[:fee_note] = response['fees'].first['note']\n args[:fee_to_id] = response['fees'].first['to']['id']\n end\n self.new(**args)\n end", "title": "" }, { "docid": "2ecb55792467f6b79d8e283178ab3fea", "score": "0.63843554", "text": "def build_response\n response = self.clone\n response.body = []\n response.to = self.from\n response.from = self.to\n response.requires_response = false\n response.custom_metadata = self.custom_metadata.clone\n response\n end", "title": "" }, { "docid": "b36b11081eee8ed78a21369150ada796", "score": "0.6373859", "text": "def parse_response!\n response.body = case @response_format\n when :xml then Hash.from_xml response.body\n when :json then JSON response.body\n end if response.body\n end", "title": "" }, { "docid": "d687ea51da9396c9317b3a7f6034a28b", "score": "0.63622606", "text": "def parse_response(response)\n if response.code == 201\n request = Restfulie.at(response.headers['location'])\n request.accepts(@acceptable_mediatypes) if @acceptable_mediatypes\n request.get!\n elsif @raw\n response\n elsif !response.body.empty?\n representation = RequestMarshaller.content_type_for(response.headers['content-type']) || Restfulie::Common::Representation::Generic.new\n representation.unmarshal(response.body).tap do |u|\n u.extend(ResponseHolder)\n u.response = response\n end\n else\n response.tap do |resp|\n resp.extend(ResponseHolder)\n resp.response = response\n end\n end\n end", "title": "" }, { "docid": "dc31dc8c89398d81b0cb4e449a5fb85d", "score": "0.63512933", "text": "def setup_response(response)\n # TODO: turn this into an all-purpose Response class\n result = response[:fecae_solicitar_response][:fecae_solicitar_result]\n\n unless result[:errors].blank?\n raise AfipError, \"#{result[:errors][:err][:code]} - #{result[:errors][:err][:msg]}\"\n end\n\n response_header = result[:fe_cab_resp]\n response_detail = result[:fe_det_resp][:fecae_det_response]\n\n # If there's only one invoice in the batch, put it in an array\n response_detail = response_detail.respond_to?(:to_ary) ? response_detail : [response_detail]\n\n response_hash = { header_result: response_header[:resultado],\n authorized_on: response_header[:fch_proceso],\n header_response: response_header,\n detail_response: response_detail\n }\n\n keys, values = response_hash.to_a.transpose\n\n self.response = Struct.new(*keys).new(*values)\n end", "title": "" }, { "docid": "f4b20c13a5a1394b5482953dc4544a0a", "score": "0.6347724", "text": "def build_response\n valid? ? [status, headers, [response_body]] : @original_response\n end", "title": "" }, { "docid": "0b062125cf8ea7cb564e13a5a55e330e", "score": "0.6340819", "text": "def parse_response(response)\n if response.code == 201\n request = Restfulie.at(response.headers['location'])\n request.accepts(@acceptable_mediatypes) if @acceptable_mediatypes\n request.get!\n elsif @raw\n response\n elsif !response.body.empty?\n representation = RequestMarshaller.content_type_for(response.headers['content-type']) || Restfulie::Common::Representation::Generic.new\n unmarshalled = representation.unmarshal(response.body)\n unmarshalled.extend(ResponseHolder)\n unmarshalled.response = response\n unmarshalled\n else\n response\n end\n end", "title": "" }, { "docid": "a4e74cafcbf5e1f9fe51eb21c2e8b0d0", "score": "0.632613", "text": "def initialize(response)\n response = EMPTY_RESPONSE if response.nil?\n reader = LibXML::XML::Reader.string(response)\n @id = nil\n @expires = nil\n @valid = false\n while reader.read\n next unless reader.node_type == LibXML::XML::Reader::TYPE_ELEMENT\n content = reader.read_inner_xml\n case reader.node.name\n when 'Ack'\n @valid = content == 'Success'\n when 'eBayAuthToken'\n @id = content\n when 'HardExpirationTime'\n @expires = Time.parse(content)\n end\n end\n rescue LibXML::XML::Error\n # Do nothing, defaults are already set\n ensure\n reader.close\n end", "title": "" }, { "docid": "2b461ada5b9725523fe5de37f7e0fc1b", "score": "0.63215494", "text": "def object_from_response(response)\n JSON.parse(text_from_body_and_header(response.body, response.header))\n end", "title": "" }, { "docid": "b92df26c2d5d7effd0b3a0da6340f5fd", "score": "0.6321433", "text": "def parse_response(http_response)\n response = Nordea::Siirto::Response.new\n response.code = http_response.code\n response.body = JSON.parse(http_response.body)\n response.message = http_response.message\n end", "title": "" }, { "docid": "88bafea994de01c8fe24605f00ec8fcf", "score": "0.63202125", "text": "def create_response response\n json = JSON.parse(response.body_str)\n if json.is_a?(Array)\n result = json.map {|result| Fulfil::Base.new(result)}\n else\n result = Fulfil::Base.new(json)\n if result.type == \"UserError\"\n raise Fulfil::UserError, result.message\n end\n end\n result\n end", "title": "" }, { "docid": "d71be1bd7f3785f23aed3e7ca6d8adfa", "score": "0.6319568", "text": "def build(response, url)\n return response if ApiClient.config.hydra\n attributes = ApiClient::Parser.response(response, url)\n hash = remove_root(attributes)\n hash = hash.merge({ 'response' => attributes })\n new(hash)\n end", "title": "" }, { "docid": "3e3579a80d0474c78b6fe88c6e9685c4", "score": "0.6306345", "text": "def initialize(response)\n return error if response.status == 500\n\n @data = JSON.parse(response.body)\n if response.status == 200\n @code = @data.delete('code').to_i\n @status = @data.delete('status')\n end\n error(response.status) unless @status\n end", "title": "" }, { "docid": "519a48d4dea110ea3e4ec6fe1a1d7260", "score": "0.6300899", "text": "def parse_response(response)\n response\n end", "title": "" }, { "docid": "b34da03f56b99fc986c7b92f97f82b17", "score": "0.6295286", "text": "def build_response\n Hotwire::Response.from_request(self)\n end", "title": "" }, { "docid": "3b78dd714b9953baeb2cf1fff552b6bf", "score": "0.6275186", "text": "def deserialize_response(response)\n result = Response.new(response[:count])\n\n result.entries = response[:member].map do |item|\n deserialize_item(item)\n end if response[:member]\n\n result\n end", "title": "" }, { "docid": "53773df2d0138b1afbb969f4e9af9032", "score": "0.627389", "text": "def parse(options = {})\n Response.new({resource_key: @resource_key, body: @response_body}.merge options)\n end", "title": "" }, { "docid": "c3681384c68952d9f4b1e08440bfad06", "score": "0.6260524", "text": "def create_instance(res)\n response = res.parsed_response\n\n if response.is_a?(Array)==true || response.to_s.length == 0\n return response\n end \n \n # if there was an error, throw it\n raise_error(response['error'], res.code) if response.nil? || response.key?('error') && res.code !=200\n # There must be a top level entity\n # This is either one of payment, refund, or collection at present\n begin\n class_name = response['entity'].split('_').collect(&:capitalize).join\n\n klass = Razorpay.const_get class_name\n rescue NameError\n # Use Entity class if we don't find any\n klass = Razorpay::Entity\n end\n klass.new(response)\n end", "title": "" }, { "docid": "230236c525624c0cb56850ef51354488", "score": "0.6259828", "text": "def convert_response(response, http_request)\r\n HttpResponse.new(response.status, response.reason_phrase,\r\n response.headers, response.body, http_request)\r\n end", "title": "" }, { "docid": "6367fcdbfa7e8a9b4c0c629edbebaa6b", "score": "0.62374204", "text": "def faraday_builder=(_arg0); end", "title": "" }, { "docid": "aa9e0bfb0741ba253614c4a3dc56c472", "score": "0.6235425", "text": "def initialize(response = {})\n @response = response\n end", "title": "" }, { "docid": "817a4ec838fbf4d1d4cf146a7b2d2b28", "score": "0.62146765", "text": "def parse_response(response)\n @response_body = response.content_type == \"application/json\" ? (JSON(response.body) rescue nil) : response.body\n @response_code = response.code.to_i\n\n @response_headers = response.to_hash\n @response_headers.each do |k,v|\n @response_headers[k] = v[0] rescue nil\n end\n\n\n if @response_code >= 400\n @errors = [response_body['error']]\n end\n end", "title": "" }, { "docid": "cc2780346e4e64204af8123ecfe0403f", "score": "0.62020296", "text": "def initialize(response, _)\n @response = response\n end", "title": "" }, { "docid": "194735c1fb7a0e53e88f28b74dbe0a48", "score": "0.6196723", "text": "def parse(response)\n super\n end", "title": "" }, { "docid": "48d460627a3093f0618eb9f036354bcc", "score": "0.6192549", "text": "def initialize(parsed_response_hash, result=nil)\n @api_response = parsed_response_hash\n @raw_http_response = result\n self\n end", "title": "" }, { "docid": "aae287611ef39727891c97e03dfeebb3", "score": "0.6192327", "text": "def build_response(**options)\n Response.new(**options)\n end", "title": "" }, { "docid": "dbfb0d568ca783a8c9386f9e48a2da1d", "score": "0.6188628", "text": "def initialize(http_response)\n self.body = parse_body(http_response.body)\n self.code = http_response.code.to_i\n end", "title": "" }, { "docid": "1170efef81e28e435abb0a9ff7b2e000", "score": "0.6187294", "text": "def load_response_api(response)\n @raw = response\n @accepted = response['successful']\n @errors = response['errors']\n end", "title": "" }, { "docid": "4c28b96b6750305b06b3f5ede1f002e7", "score": "0.61845064", "text": "def convert_response(response)\n Response.new(response.approved?, message_from(response), response.fields,\n :test => test?, \n :authorization => response.fields[:transaction_id],\n :fraud_review => response.held?,\n :avs_result => { :code => response.fields[:avs_response] },\n :cvv_result => response.fields[:card_code_response]\n )\n end", "title": "" }, { "docid": "58d47be2bb6ffe96204e65b7f69c1476", "score": "0.6176991", "text": "def initialize(response)\n case response.code\n when '500'; then raise OAuthTestWrapper::OAuthTestWrapperException, \"Internal Server Error\"\n when '400'; then raise OAuthTestWrapper::OAuthTestWrapperException, \"Method Not Implemented Yet\"\n end\n \n @data = JSON.parse(CGI::unescape(response.body))\n end", "title": "" }, { "docid": "663761a73c78c54664254b8eb978e06b", "score": "0.61759084", "text": "def initialize(http_response)\n self.http_response = http_response\n end", "title": "" }, { "docid": "663761a73c78c54664254b8eb978e06b", "score": "0.61759084", "text": "def initialize(http_response)\n self.http_response = http_response\n end", "title": "" }, { "docid": "1f90db9b51148da356cd211263701ea9", "score": "0.6172908", "text": "def initialize(response)\n __setobj__(response)\n end", "title": "" }, { "docid": "74ea53430c85ead0fee427403a8ebfa4", "score": "0.61700046", "text": "def initialize(hurley_response, client)\n @client = client\n @response = hurley_response\n @request_time = Time.parse(header['Date']) if header['Date']\n @body = JSON.parse(@response.body)\n # handle_error_response unless success?\n end", "title": "" }, { "docid": "d80bd04a730024e00054ad81e3e03ec6", "score": "0.61497086", "text": "def initialize(response)\n response_hash = response.to_hash\n\n @severity = response_hash.deep_fetch(:severity)\n @error_code = response_hash.deep_fetch(:code)\n @description =response_hash.deep_fetch(:description)\n end", "title": "" }, { "docid": "6fc08da034774143550af2fc2ba3c790", "score": "0.6149699", "text": "def parse_response(response)\n @code = response.code\n @body = json_parse(response.body)\n @headers = response.headers\n @remaining_requests = @headers[:x_ratelimit_remaining]\n end", "title": "" }, { "docid": "d0d5561fe8019b39cecb1841aa298422", "score": "0.6149259", "text": "def from_transparent_results(response)\n self.load_attributes_from_response(response)\n self\n end", "title": "" }, { "docid": "68c7f7d815065685ecec69bdc94b5f72", "score": "0.614056", "text": "def member(response)\n new(response, :values_from_api => true)\n end", "title": "" }, { "docid": "ba6f2311612e69f07483b022cb57a87f", "score": "0.6139028", "text": "def response\n @response ||= Faraday.get loc\n end", "title": "" }, { "docid": "5e677dc35a5cb6feac442c230e18c8dd", "score": "0.6135994", "text": "def initialize(response)\n response.error = self\n @response = response\n message_opts = {}\n\n if response.parsed.is_a?(Hash)\n @code = response.parsed['error']\n @description = response.parsed['error_description']\n message_opts = parse_error_description(@code, @description)\n end\n\n super(error_message(response.body, message_opts))\n end", "title": "" }, { "docid": "aee4dc3670590339af79a5039bdf40ff", "score": "0.61306494", "text": "def response_from_http\n RedboothRuby::Request::Response.new(headers: raw_response.to_hash,\n body: raw_response.body,\n status: raw_response.code.to_i)\n end", "title": "" }, { "docid": "ccea9081463b37a5b26d929d6b6f8556", "score": "0.6123914", "text": "def initialize_object(response_object)\n self.new(response_object[0])\n end", "title": "" }, { "docid": "fee311189b4b0e535b9fab3a1ce4e1e8", "score": "0.6118722", "text": "def convert_response(response, name)\n if success?(response.code)\n body = response.body.is_a?(String) ? JSON.parse(response.body) : response.body\n\n if body.is_a?(Array)\n body.map {|hash| ClassFactory.build_response_object(hash, name)}\n else\n ClassFactory.build_response_object(body, name)\n end\n else\n return response\n end\n end", "title": "" }, { "docid": "8b8616c344fe4f627329f70c4cb21ce2", "score": "0.6111289", "text": "def parse_response(response)\n @code = response.http_code\n @body = json_parse(response.http_body)\n @message = @body.dig(:error, :message)\n @headers = response.http_headers\n end", "title": "" }, { "docid": "f7d2091185e10c5e63a1963942ac370e", "score": "0.6109991", "text": "def initialize(response)\n @response ||= response\n end", "title": "" }, { "docid": "68c0bb3943faa60cf41d8528cd99b223", "score": "0.6103339", "text": "def initialize(raw_response)\n @http_status_code = raw_response.status\n @parsed_body = JSON.parse(raw_response.body)\n end", "title": "" }, { "docid": "716b34584890a48d9fe84e22b39817b4", "score": "0.60992765", "text": "def initialize(http_response)\n @http_response = http_response\n end", "title": "" }, { "docid": "f411f8aa5db0111a0be5037d624f5f23", "score": "0.6097937", "text": "def initialize(response)\n @status = response.status\n @length = 0\n data = response.body\n\n parse_results(data)\n end", "title": "" }, { "docid": "5e571f29a940b19c550dd5ee7adaf3fb", "score": "0.60915947", "text": "def initialize(response, request={})\n @raw = response\n @request = request\n end", "title": "" }, { "docid": "0d3a70ecf1dec1acb24a78f4a9544479", "score": "0.60904896", "text": "def initialize\n response\n end", "title": "" }, { "docid": "5364da45ca5b68f528bd3e28fef47f81", "score": "0.6090102", "text": "def to_response(env)\n env.update(@payload)\n Faraday::Response.new(env)\n end", "title": "" }, { "docid": "ae568d6848b53ca418d7f3a18508e750", "score": "0.60894924", "text": "def parsed_response\n self.response\n end", "title": "" }, { "docid": "c8f579c4bc042dcc5f6f77b859404e93", "score": "0.60890436", "text": "def initialize\n @response = response \n end", "title": "" } ]
ae28b9911b90beca1f7bea497e4f3667
Empty strings comes from form, but we can't save it due to unique DB index.
[ { "docid": "bf0da79e4788c76ffb6dc519e97b2da3", "score": "0.0", "text": "def nullify_empty_slug\n self.landing_page_slug = nil if landing_page_slug == ''\n end", "title": "" } ]
[ { "docid": "c8573bed1f0a2b3e6db2db5c58ddade5", "score": "0.6930891", "text": "def set_empty_attributes_to_nil\n\t\t# This method makes sure - empty string does not save in the database.\n\t\t# example: SSN - empty string was getting saved in the database- it was giving unique constraint error - while saving nil SSNs\n\t\t# hence this method.\n # \t@attributes.each do |key,value|\n\t\t\t# self[key] = nil if value.blank?\n # end\n \t\t@l_service_object.set_empty_attributes_to_nil(self)\n\tend", "title": "" }, { "docid": "0c478223d364683654c3d4d09d005a1d", "score": "0.67173535", "text": "def before_save(record)\n\t\tclean_strings(record)\n\tend", "title": "" }, { "docid": "182bb5c4051539d1ff1369d904c29881", "score": "0.6701211", "text": "def clear_value_if_empty\n write_attribute(:value, nil) if self.value.is_a?(String) && self.value.empty?\n end", "title": "" }, { "docid": "e81a5bfe1b87517162ddc0ab0a818a80", "score": "0.6615992", "text": "def disallow_empty\n allow_empty(false)\n end", "title": "" }, { "docid": "dff79bd44a6489c095afb84f60a43997", "score": "0.65644", "text": "def allow_blank?\n @existing.update_attribute(@attribute, '')\n super\n end", "title": "" }, { "docid": "2b89e3f6a90904d4ae118957437faf10", "score": "0.65527755", "text": "def sanitise!\n @params.keep_if do |_k, v|\n !v.to_s.strip.empty?\n end\n end", "title": "" }, { "docid": "d54e443a793d873a5c38fd7acfc679ea", "score": "0.6466305", "text": "def allowBlank; end", "title": "" }, { "docid": "12d540b0f34171d5b7a1c39a22585675", "score": "0.64042544", "text": "def ignore_blanks?\n true\n end", "title": "" }, { "docid": "a0c21cd143b0a059e0ff04df994e4b1f", "score": "0.6353073", "text": "def keep_blanks?()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "37c7633e22e811ea5c43e30964765d4e", "score": "0.63292295", "text": "def set_note_empty\n self.note = \"\"\n self.save\n end", "title": "" }, { "docid": "79d45dac66576505a88e393115cc3bb8", "score": "0.63279325", "text": "def convert_blanks_to_nil\n self.attributes.each do |name,value|\n self.send(\"#{name}=\".to_sym, nil) if value.is_a?(String) and value.empty?\n end\n end", "title": "" }, { "docid": "2d5d30d12f2d18142a0336d517119ce4", "score": "0.6278398", "text": "def before_update(record)\n\t\tclean_strings(record)\n\tend", "title": "" }, { "docid": "9fbb7ff953a1bc89f0f55e28c7932b83", "score": "0.6278082", "text": "def clean_data\n self[:data] = self[:data].compact_blank.presence if self[:data]\n end", "title": "" }, { "docid": "a7ee2100c1c9a8c8bb0c67173a3deb46", "score": "0.62778896", "text": "def clean_fields\n self.username.downcase! unless self.username.blank?\n self.username.strip! unless self.username.blank?\n self.email.downcase! unless self.email.blank?\n self.email.strip! unless self.email.blank?\n end", "title": "" }, { "docid": "bcf138c41fa125ed8e18c3e8e4702883", "score": "0.6249375", "text": "def blank?\n self == \"\"\n end", "title": "" }, { "docid": "f0567020c0b3b2af18019c995de6914b", "score": "0.6214375", "text": "def blank_string_value\n if database_type == :oracle\n nil\n else\n ''\n end\n end", "title": "" }, { "docid": "2a81d3cf9fb4d2a0c2ecd2a7708de713", "score": "0.621273", "text": "def before_create(record)\n\t\tclean_strings(record)\n\tend", "title": "" }, { "docid": "7278e78c1a80ee12a3f7dc6cda8713e7", "score": "0.6185111", "text": "def empty_text\n nil\n end", "title": "" }, { "docid": "9bb9bb2d411e5745f44ebba263124641", "score": "0.61794955", "text": "def nillify_blanks!\n params[:post][:url] = nil if post_params[:url] == \"\"\n params[:post][:content] = nil if post_params[:content] == \"\"\n end", "title": "" }, { "docid": "d544b5b55b97c5f61cf867bd7a9866f7", "score": "0.61771107", "text": "def allow_blank?\n return true unless @options.key?(:allow_blank)\n\n begin\n @existing.update_attribute(@attribute, '')\n rescue ::ActiveRecord::StatementInvalid => e\n raise ScriptError, \"You declared that #{@attribute} accepts blank values in validate_uniqueness_of, \" <<\n \"but I cannot save blank values in the database, got: #{e.message}\" if @options[:allow_blank]\n return true\n end\n\n super\n end", "title": "" }, { "docid": "2a544ffaf737a6afac7ae9c059385c49", "score": "0.6155643", "text": "def nils_are_blank_strings\n alter_cells do |value, record|\n value.nil? ? \"\" : value\n end\n end", "title": "" }, { "docid": "5125d1df8d280c4995c1e31a50e79f1a", "score": "0.6129807", "text": "def blank?\n self.strip.empty?\n end", "title": "" }, { "docid": "02e9fb9ba8a16dbb4efde5ecb7365bab", "score": "0.6121263", "text": "def strip_empty_fields\n unset(\"email\") if email.blank?\n unset(\"oim_id\") if oim_id.blank?\n end", "title": "" }, { "docid": "f0640b713e368e9cfb32df9942a4baee", "score": "0.60879534", "text": "def set_default_empty_values\n self.login ||= ''\n self.firstname ||= ''\n self.lastname ||= ''\n self.mail ||= ''\n true\n end", "title": "" }, { "docid": "8904590d73affa5eb88fb55b940a6dba", "score": "0.6078342", "text": "def is_blank?\n false\n end", "title": "" }, { "docid": "9a453358c120cdc928f80cf85887ef19", "score": "0.6058482", "text": "def clean_fields\n params[:username_or_email].downcase! unless params[:username_or_email].blank?\n params[:username_or_email].strip! unless params[:username_or_email].blank?\n end", "title": "" }, { "docid": "39fd0719093bcd6ecab8f230c4059dd2", "score": "0.6047288", "text": "def without_blanks!\n reject! { |o| o.nil? or o.strip.empty? }\n self\n end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "242af5fe1ccb2ed323a9c488bded5fde", "score": "0.602328", "text": "def blank?; end", "title": "" }, { "docid": "8e56eed8682ef440aacb7ff27da119f7", "score": "0.60044324", "text": "def slug_blank\n if self.slug == nil || self.slug.gsub(\" \",\"\") == \"\"\n self.slug = self.title.parameterize.first(50)\n self.save\n end\n end", "title": "" }, { "docid": "d00964b3b3ef7f3d1d483c0e36ada161", "score": "0.598867", "text": "def blank?\n true\n end", "title": "" }, { "docid": "d00964b3b3ef7f3d1d483c0e36ada161", "score": "0.598867", "text": "def blank?\n true\n end", "title": "" }, { "docid": "45f44cfa1d647c27d3a085464ef1aacf", "score": "0.5982416", "text": "def null_string()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "efd2da99a1dcb252cc16c151ce8bb5dd", "score": "0.5969165", "text": "def generate_empty_fields\n all_fields = get_required_field_symbols + get_optional_field_symbols\n all_fields.each do |r|\n fields.create(name: r, content: '') unless fields.exists?(name: r)\n end\n end", "title": "" }, { "docid": "1f758f1dc62a91398aeac6880a3786ee", "score": "0.59594995", "text": "def filter_big_strings\n self.name = self.name.truncate(20) if self.name.present?\n self.password = self.password.truncate(40) if self.password.present?\n self.password_confirmation = self.password_confirmation.truncate(40) if self.password_confirmation.present?\n end", "title": "" }, { "docid": "974b4ad3bdd89655f2f539dfe10cca77", "score": "0.5956735", "text": "def empty?\n to_s == ''\n end", "title": "" }, { "docid": "f03fc833dff766fa3c487b273554e84e", "score": "0.5950094", "text": "def blank?\n false\n end", "title": "" }, { "docid": "f03fc833dff766fa3c487b273554e84e", "score": "0.5950094", "text": "def blank?\n false\n end", "title": "" }, { "docid": "653a2bd24d8078c1dab71113cbd77595", "score": "0.59442693", "text": "def blank; end", "title": "" }, { "docid": "653a2bd24d8078c1dab71113cbd77595", "score": "0.59442693", "text": "def blank; end", "title": "" }, { "docid": "653a2bd24d8078c1dab71113cbd77595", "score": "0.59442693", "text": "def blank; end", "title": "" }, { "docid": "653a2bd24d8078c1dab71113cbd77595", "score": "0.59442693", "text": "def blank; end", "title": "" }, { "docid": "0629b524477dc292bda2c145a017826c", "score": "0.59225905", "text": "def strip_blanks\n self.common_name = self.common_name.strip\n self.latin_name = self.latin_name.strip\n end", "title": "" }, { "docid": "648c29873dfde147ee998c62a5ff46c0", "score": "0.59219015", "text": "def remove_whitespace_null\n \n if self.is_active == nil\n self.is_active = true\n end\n \n self.first_name.to_s.strip!\n self.last_name.to_s.strip!\n self.email_address.to_s.strip!\n self.password.to_s.strip!\n end", "title": "" }, { "docid": "e3a54d305156f70be905f7307752f443", "score": "0.5903951", "text": "def blank?\n self.text.blank?\n end", "title": "" }, { "docid": "e3a54d305156f70be905f7307752f443", "score": "0.5903951", "text": "def blank?\n self.text.blank?\n end", "title": "" }, { "docid": "517787b3145c417f025421ba525de180", "score": "0.5899192", "text": "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n self.complement_title = self.complement_title.strip\n end", "title": "" }, { "docid": "4fa5e224eaef3fcb180b15103e2bcfcc", "score": "0.5898118", "text": "def without_blanks\n reject { |o| o.nil? or o.strip.empty? }\n end", "title": "" }, { "docid": "4ec17e054d20eb1d5004658a79d66d12", "score": "0.588598", "text": "def blank\n\n end", "title": "" }, { "docid": "d98a10825a2dffa4a99703b8f696143c", "score": "0.58760947", "text": "def empty?\n to_s == ''\n end", "title": "" }, { "docid": "16ec6a1449d72a1fa1df50101cf0403c", "score": "0.58629894", "text": "def remove_blank\n compact.delete_if{|string|string.blank?}\n end", "title": "" }, { "docid": "5629292bdea71bb81b3e46d448022f0f", "score": "0.586065", "text": "def allow_blank?\n true unless allow_blank == false\n end", "title": "" }, { "docid": "142e7ed503acd3f0e1168b4f8fe369f3", "score": "0.58480096", "text": "def strip_input_fields\n\t\tself.attributes.each do |key, value|\n \t\t\tself[key] = value.strip if value.respond_to?(\"strip\")\n \t\tend\n\tend", "title": "" }, { "docid": "7b8b8b61886dd89f7a67b828b8a4c79d", "score": "0.5827637", "text": "def strip_strings\n self.first_name = first_name.strip\n self.last_name = last_name.strip\n self.gender = gender.strip\n self.category = category.strip\n self.fathers_name = fathers_name.strip\n self.mothers_name = mothers_name.strip\n end", "title": "" }, { "docid": "88457077cf8dc589ed8cbec39655f9c8", "score": "0.5823626", "text": "def remove_blanks\n FIELDS.each { |f| send(f).delete_if(&:blank?) }\n end", "title": "" }, { "docid": "089652f5b94d2a22c17579c3ffba1b2d", "score": "0.581982", "text": "def set_default_empty_values\n self.login ||= ''\n self.hashed_password ||= ''\n self.firstname ||= ''\n self.lastname ||= ''\n self.mail ||= ''\n true\n end", "title": "" }, { "docid": "a5330f5d0171ba6f30b3591c20d8fa9a", "score": "0.5816994", "text": "def allow_blank!\n @allow_blank = true\n self\n end", "title": "" }, { "docid": "1daf4bfd1b82ef4d1bcbe7de9f0700c6", "score": "0.5812185", "text": "def blank=(use_blank); end", "title": "" }, { "docid": "0a9905ce9097c0571cafb91790c0450b", "score": "0.5809745", "text": "def empty?\n return self.strip == ''\n end", "title": "" }, { "docid": "dfd3f7612806a6e4523b9577c46c0c30", "score": "0.58040935", "text": "def handle_blanks\n @input = @input.map do |key, value|\n return [key, value] unless value.respond_to?(:match?)\n\n updated_value = value.match(/^blank/i) ? nil : value\n\n [key, updated_value]\n end.to_h\n end", "title": "" }, { "docid": "f6d8ed39ec70b8b075d489ed42285b99", "score": "0.5793653", "text": "def sanitize_fields; end", "title": "" }, { "docid": "635900adaef7e0ee88d045b3b9965cfa", "score": "0.5784139", "text": "def clean t\n return '' unless t\n t\n end", "title": "" }, { "docid": "4684e325937657cec261ba49cdc8acb2", "score": "0.5777312", "text": "def blank?\n return false\n end", "title": "" }, { "docid": "4684e325937657cec261ba49cdc8acb2", "score": "0.5777312", "text": "def blank?\n return false\n end", "title": "" }, { "docid": "8094787292c933b426c44c5a9a2fff99", "score": "0.5761688", "text": "def strip_input\n self.name = self.name.strip\n self.address = self.address.strip\n end", "title": "" }, { "docid": "28acdc4ebf93950f8d0522db901f5679", "score": "0.57584435", "text": "def before_validate\n [self.email, self.login, self.first_name, self.last_name].strip!\n end", "title": "" }, { "docid": "fb4f6155e6b15b515d2a8f21f772488e", "score": "0.5757643", "text": "def save_values\n self.first_name = @first_name_field.text.strip.chomp\n self.last_name = @last_name_field.text.strip.chomp\n self.email = @email_field.text.strip.chomp\n self.github = @github_field.text.strip.chomp\n self.twitter = @twitter_field.text.strip.chomp\n self.fun_fact = @fun_fact_field.text.strip.chomp\n\n # # TODO: 2. Finish the implementation to set the other fields.\n end", "title": "" }, { "docid": "817328aa9fd828f454b88c3efa2951ed", "score": "0.5752602", "text": "def reject_blank!\n @allow_blank = false\n self\n end", "title": "" }, { "docid": "9ba59b7f3d67d82afaac037950b4a65b", "score": "0.57412946", "text": "def nonblank_name; end", "title": "" }, { "docid": "9ba59b7f3d67d82afaac037950b4a65b", "score": "0.57412946", "text": "def nonblank_name; end", "title": "" }, { "docid": "83918146fd2eafc88c4e80421fdb5792", "score": "0.57402366", "text": "def fix(dirty)\n if dirty.nil?\n INVALID_DATA\n else\n dirty.capitalize\n end\n end", "title": "" }, { "docid": "4137e375b1e18cfc119888c26d2613f7", "score": "0.57306206", "text": "def cleaned\n end", "title": "" }, { "docid": "90fd06ac35211d021aee97b29f1dc9a5", "score": "0.5716456", "text": "def empty_str?(value)\n EMPTY_STRING.eql?(value)\n end", "title": "" }, { "docid": "be50a23d7e3ae442097b17337ec976e2", "score": "0.5710922", "text": "def remove_empty_fields!\n lines.delete_if do |x|\n x.raw_value.strip.empty? or (x.respond_to? :values and x.values.join.empty?)\n end\n self\n end", "title": "" } ]
be9db1fd9b759a8dc1ddf1b64eb2acc5
Reads/sets rec data from record_metadata by recnum lookup
[ { "docid": "b9f305c98608560508372ddc0ae22841", "score": "0.66238993", "text": "def read_record_metadata\n return {} unless recnum\n query = <<-SQL\n select *\n from sierra_view.record_metadata rm\n where record_type_code = \\'#{rtype}\\'\n and record_num = \\'#{recnum}\\'\n SQL\n conn.make_query(query)\n return {} if conn.results.entries.empty?\n conn.results.entries.first.collect { |k,v| [k.to_sym, v] }.to_h\n end", "title": "" } ]
[ { "docid": "1c8b39fc6c576d626518f412681f66dc", "score": "0.6716347", "text": "def rec_metadata\n @rec_metadata ||= read_record_metadata\n end", "title": "" }, { "docid": "1f9d2c446cdf4df76d8de292318c8755", "score": "0.63513273", "text": "def load(file_rec)\n md_rec = MetadataDeserializer.deserialize(file_path: file_rec.metadata_path,\n digest_algs: file_rec.storage_location.metadata_location.digests)\n file_rec.metadata_record = md_rec\n md_rec\n end", "title": "" }, { "docid": "689f52c84e3f1bfa53b044f4d3bad35a", "score": "0.6239956", "text": "def rec_data\n @rec_data ||= read_record(sql_name: sql_name)\n end", "title": "" }, { "docid": "d8b34bd3d6da09b8b9a982a336a0d4d5", "score": "0.61970496", "text": "def get_record_metadata(dbf, record_number)\n dbf.nil? ? {} : dbf.find(record_number - 1).attributes\n end", "title": "" }, { "docid": "f2bfc46721d472e07a120fbbc7d47975", "score": "0.6082063", "text": "def read_record_at(offset)\n seek offset\n read_record\n end", "title": "" }, { "docid": "80141caede047665c3fe0312b499560a", "score": "0.579504", "text": "def read_record()\n\t\t\t\t\t# gets can handle a lot of different splits, but more complicated\n\t\t\t\t\t# cases will have to by overriding this\n\t\t\t\t\tif (rec = hndl.gets(@delimiter))\n\t\t\t\t\t\trec = decode_record(rec)\n\t\t\t\t\tend\n\t\t\t\t\treturn rec\n\t\t\t\tend", "title": "" }, { "docid": "46f64685a6146c54244ad4062ed4cef1", "score": "0.57141143", "text": "def read_record\n record_offset = @offset\n record_size, record_tag = read_record_header\n\n # Easy case 1: unused areas.\n unless record_tag\n @file.seek record_size + 1, IO::SEEK_CUR\n return nil\n end\n\n if record_tag & 2 == 0\n # Easy case 2: binary records.\n DbRecord.new record_offset, record_tag, record_size, true,\n @file.read(record_size)\n else\n # The real deal: the text records.\n text = utf8_bytes(record_size, record_tag).to_a.pack('C*')\n DbRecord.new record_offset, record_tag, record_size, false,\n text.force_encoding(Encoding::UTF_8)\n end\n end", "title": "" }, { "docid": "50c409f2e7dec08902cc97c882e3a7e4", "score": "0.57052493", "text": "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(cursor, length(record)) }\n end", "title": "" }, { "docid": "8d9a6aa05457b0e056a56249f41abbad", "score": "0.5621118", "text": "def record_id\n rec_metadata[:id]\n end", "title": "" }, { "docid": "1f55947477a8f6d646d6453594791922", "score": "0.5608852", "text": "def read_data(record, bytes, attribute_set)\n attribute, length = attribute_set\n content = bytes.slice!(0, length).pack('C*')\n\n if attribute == :data && record.type_format == BINARY\n content = StringIO.new(content)\n end\n\n record.send \"#{attribute.to_s}=\", content\n bytes.slice!(0, 4 - (length & 3)) if (length & 3) != 0\n end", "title": "" }, { "docid": "62c21a3774a3a73a407bd19e66f5dae4", "score": "0.5584566", "text": "def register_to(file_rec)\n file_rec.metadata_record = get_metadata_record\n self\n end", "title": "" }, { "docid": "762e8a39ed84ec08db359dfc74944fcf", "score": "0.5582888", "text": "def get_id_data(rec)\n id_data = { '001' => '',\n '003' => '',\n '019' => [],\n '035' => [],\n '035z' => [],\n '035q' => []}\n \n Traject::MarcExtractor.cached('001:003:019:035a', alternate_script: false).each_matching_line(rec) do |field, spec, extractor|\n case field.tag\n when '001'\n id_data['001'] = field.value\n when '003'\n id_data['003'] = field.value\n when '019'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['019'] << sf.value\n end\n when '035'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['035'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'z' }.each do |sf|\n id_data['035z'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'q' }.each do |sf|\n id_data['035q'] << sf.value\n end\n end\n end\n \n return id_data\n end", "title": "" }, { "docid": "977f7860b8fd267baca36849d8a78c46", "score": "0.5581786", "text": "def get_record(set_number, entry_num)\n begin\n logger.debug \"getting record entry_num #{entry_num} set_number #{set_number}\"\n @http_service.do_post(@aleph_url, params = {\n :op => \"present\",\n :set_no => set_number,\n :set_entry => entry_num,\n :format => \"marc\"}\n )\n rescue => e\n logger.error \"get_record failed for entry_num #{entry_num} set_number #{set_number}\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "ead2b54ae4c5836b5b4d2347683ac375", "score": "0.55596584", "text": "def collect_record_attributes(client, request) \n require 'marc' \n client.results.each do | record |\n MARC::XMLReader.new(StringIO.new(record.to_s)).each do | rec |\n id = nil\n \n # Assumes your local control number to be defined in 001\n rec.find_all { | f| '001' === f.tag}.each do | bibnum |\n id = bibnum.value\n @record_attributes[id] = {}\n end \n \n # Conferences have their own crazy logic\n if self.is_conference?(rec)\n @record_attributes[id][:conference] = true\n else\n @record_attributes[id][:conference] = false\n end\n self.parse_for_fulltext_links(rec, request) \n self.enhance_referent(rec, request, client.accuracy)\n end \n end\n end", "title": "" }, { "docid": "30e2eb7afc3983701b32ef457b3f839f", "score": "0.551008", "text": "def get_record( num )\n current=@fh.lineno\n if num < current\n @fh.rewind \n current=0\n end\n (num - current).times do\n @fh.gets\n end\n JSON.parse @fh.readline\n end", "title": "" }, { "docid": "12b3723aaede8b8c726e3eb6d620bd01", "score": "0.55002004", "text": "def read!\n @reader.read do |record|\n @table[record.key] = parse record.data\n end\n end", "title": "" }, { "docid": "7e184acce9ece37f1ffa83b3f167fde8", "score": "0.5484441", "text": "def parse_record(line); end", "title": "" }, { "docid": "f853090282ed6bddd8cb811fddcb0e1f", "score": "0.5474714", "text": "def manipulate_record_data(records, options={})\n # set up a data structure for the data transformations required\n trans = {\n \"http://purl.org/dc/dcmitype/Sound\" => {\n :base_url => \"https://dlib.york.ac.uk/yodl/app/audio/detail?id=\",\n :new_type => \"Sound\"\n },\n \"http://purl.org/dc/dcmitype/Image\" => {\n :base_url => \"https://dlib.york.ac.uk/yodl/app/image/detail?id=\",\n :new_type => \"Image\"\n },\n \"http://purl.org/dc/dcmitype/Collection\" => {\n :base_url => \"https://dlib.york.ac.uk/yodl/app/collection/detail?id=\",\n :new_type => \"Collection\"\n },\n \"http://dlib.york.ac.uk/type/ExamPaper\" => {\n :new_type => \"Exam Paper\"\n },\n \"http://purl.org/dc/dcmitype/Dataset\" => {\n :new_type => \"Dataset\"\n },\n \"http://purl.org/dc/dcmitype/Software\" => {\n :new_type => \"Software\"\n },\n \"http://purl.org/dc/dcmitype/Text\" => {\n :new_type => \"\"\n },\n \"http://purl.org/eprint/type/Thesis\" => {\n :new_type => \"Thesis\"\n },\n \"http://purl.org/dc/dcmitype/StillImage\" => {\n :new_type => \"\"\n }\n }\n # also set up a default base url\n default_baseurl = \"https://dlib.york.ac.uk/yodl/app/home/detail?id=\"\n # for each record\n records.each do |record|\n # manipulate records for the \"york:digilib01\" set\n # do this according to which set has been requested (via url param/resumption-token)\n # if we ever need to do this regardless of which set has been requested, replace the following line with: if is_set_member?(record, \"york:digilib01\")\n if (requested_set(options) == \"york:digilib01\")\n # if dc.type = http://dlib.york.ac.uk/type/ExamPaper and acl.allowed.roles includes \"york\" but not \"public\", add value \"york-only\" to dc.source\n if record.key?(\"dc.type\") && record[\"dc.type\"].include?(\"http://dlib.york.ac.uk/type/ExamPaper\") && record[\"acl.allowed.roles\"].include?(\"york\") && !record[\"acl.allowed.roles\"].include?(\"public\")\n (record[\"dc.source\"] ||= []) << \"york-only\"\n end\n # for each transformation in the \"trans\" hash\n trans.each do |k,v|\n # if this record has a dc:type that matches this transformation \n if (record[\"dc.type\"].include?(k))\n # if dc.identifier doesn't already have a resource URL as one of its elements\n if (record[\"dc.identifier\"] ||= []).grep(/^https:\\/\\/dlib\\.york\\.ac\\.uk\\/yodl\\/app/).none?\n # append a URL (base_url + PID) to the dc.identifier array \n # if a base url is specified for this type, use that, otherwise use the default base url\n base_url = default_baseurl\n if (v.key? :base_url)\n base_url = v[:base_url]\n end\n record[\"dc.identifier\"] << base_url + record[\"PID\"]\n # and remove any \"york:1234\" values from dc.identifier\n record[\"dc.identifier\"].reject!{ |x| x =~ /^york:[0-9]+$/ }\n end\n end\n # change dc.type to something more readable/simple\n # if record has this dc.type, delete it from dc.type array and prepend the new replacement type \n record[\"dc.type\"].unshift(v[:new_type]) if record.key?(\"dc.type\") && record[\"dc.type\"].delete(k) && v[:new_type] != \"\"\n end\n # if this record has type \"Sound\" AND type \"Collection\", remove the \"Collection\" type\n if record[\"dc.type\"].include?(\"Sound\") && record[\"dc.type\"].include?(\"Collection\")\n record[\"dc.type\"].delete(\"Collection\")\n end\n # special rules if dc.type contains http://purl.org/eprint/type/ScholarlyText\n if record[\"dc.type\"].include?(\"http://purl.org/eprint/type/ScholarlyText\")\n # remove http://purl.org/eprint/type/ScholarlyText from dc.type\n record[\"dc.type\"].delete(\"http://purl.org/eprint/type/ScholarlyText\")\n # if dc.type contains any of the following patterns\n patterns = [\"^Book$\", \"^Conference\", \"^Article$\", \"^Journal Article$\", \"^Chapter$\", \"^Book Chapter$\", \"^Journal$\"]\n match = false\n patterns.each do |pat|\n record[\"dc.type\"].each do |type|\n if type =~ /#{pat}/\n # remove this element from dc.type and re-add it to the beginning of the array\n record[\"dc.type\"].delete(type)\n record[\"dc.type\"].unshift(type)\n match = true\n break\n end\n end\n end\n # if none of the patterns matched, then add \"Text Resource\" to the start of the dc.type array\n if !match\n record[\"dc.type\"].unshift(\"Text Resource\")\n end\n end\n end\n end\n end", "title": "" }, { "docid": "3352f5ad1a4d6e77e574e4452a9ac44e", "score": "0.54455286", "text": "def negotiate_record(record)\n if record.instance_of? MARC::Record\n record\n elsif record.is_a? String and File.exists? record\n # could also catch Errno::ENAMETOOLONG: File name too long\n reader = MARC::XMLReader.new(record)\n # take the first if a collection\n reader.select { |r| r.leader[6].in? @@bib_leader06_types }[0]\n else\n reader = MARC::XMLReader.new(StringIO.new(record))\n # take the first if a collection\n reader.select { |r| r.leader[6].in? @@bib_leader06_types }[0]\n end\n end", "title": "" }, { "docid": "ca27650bd5594af728874c672a67beef", "score": "0.5431341", "text": "def parse_record(record)\n record.correlation_id = @test_id\n record.medical_record_number = rand(1_000_000_000_000_000)\n record\n rescue StandardError\n nil\n end", "title": "" }, { "docid": "9d889c33c1fad158870c7383f01bbc73", "score": "0.5407955", "text": "def process_record\n @count = response.at(\"//search:DOCSET\", SEARCH_NS)[\"TOTALHITS\"] unless response.nil? or @count\n response.at(\"//pnx:addata\", PNX_NS).children.each do |addata_child|\n name = addata_child.name and value = addata_child.inner_text if addata_child.elem?\n next if value.nil?\n self.class.add_attr_reader name.to_sym unless name.nil?\n instance_variable_set(\"@#{name}\".to_sym, \"#{value}\") unless name.nil?\n end\n @cover_image = response.at(\"//pnx:addata/pnx:lad02\", PNX_NS).inner_text unless response.at(\"//pnx:addata/pnx:lad02\", PNX_NS).nil?\n @titles = []\n response.search(\"//pnx:display/pnx:title\", PNX_NS).each do |title|\n @titles.push(title.inner_text)\n end\n @authors = []\n response.search(\"//pnx:display/pnx:creator\", PNX_NS).each do |creator|\n @authors.push(creator.inner_text)\n end\n end", "title": "" }, { "docid": "d8539c849494b9c4777f3b08d7cc3da3", "score": "0.5387311", "text": "def offset_to_record_data(offset)\n record_start, size = offset_to_record_start(offset)\n get_data(record_start, size)\n end", "title": "" }, { "docid": "8b73fe125c9feb74dadf5740d6711de1", "score": "0.53825414", "text": "def record\n @record ||= begin\n if header[:first_rec_group] != 0\n c = cursor(header[:first_rec_group])\n type_and_flag = c.get_uint8\n type = type_and_flag & RECORD_TYPE_MASK\n type = RECORD_TYPES[type] || type\n single_record = (type_and_flag & SINGLE_RECORD_MASK) > 0\n {\n :type => type,\n :single_record => single_record,\n :content => record_content(type, c.position),\n :space => c.get_ic_uint32,\n :page_number => c.get_ic_uint32,\n }\n end\n end\n end", "title": "" }, { "docid": "70ddb6349214aa6590c021ee380fe411", "score": "0.53396237", "text": "def read_record(f, throw_exception = true)\n rec = f.read(::RECSIZE)\n unless rec && rec.size == ::RECSIZE\n raise \"no record found\" if throw_exception\n return nil\n end\n out = rec.unpack(\"ld*\")\n out[0] = Time.at(out.first)\n out\nend", "title": "" }, { "docid": "4039358d828813aef4ab4d1bcd68e550", "score": "0.5338189", "text": "def set_record\n @record = _RC.includes(belongs_tos).find(params[:id])\n end", "title": "" }, { "docid": "8900685879e124942024d465d0738f71", "score": "0.52822244", "text": "def set_rec_num\n @rec_num = RecNum.find(params[:id])\n end", "title": "" }, { "docid": "71c8ecfaf820a1a622bf4a9a755d43af", "score": "0.5255399", "text": "def process_records\n records.each do |record|\n record_to_hints(record)\n end\n end", "title": "" }, { "docid": "ab08c7e6c15dcd08343f191843ad79c4", "score": "0.5253415", "text": "def set_data(record_set)\n @data.clear\n if record_set.is_a? WIN32OLE\n record_set.movefirst unless record_set.bof\n until record_set.eof\n row = Array.new\n record_set.fields.each do |f|\n row << f.value\n end\n @data << row\n record_set.movenext\n end\n else\n @data = record_set\n end\n @data\n end", "title": "" }, { "docid": "dc30f2093ef1ff9aa7c2c46689a80acd", "score": "0.52345353", "text": "def marc_record_from_marc21\n return if marc_source.blank?\n MARC::Record.new_from_marc marc_source\n end", "title": "" }, { "docid": "22b0e1432911a78df1a13066c17b09a4", "score": "0.5227106", "text": "def configure_record(record, bytes)\n byte = bytes.shift\n\n record.version = (byte >> 3) & 31 # 5 bits DIME format version (always 1)\n record.first = (byte >> 2) & 1 # 1 bit Set if this is the first part in the message\n record.last = (byte >> 1) & 1 # 1 bit Set if this is the last part in the message\n record.chunked = byte & 1 # 1 bit This file is broken into chunked parts\n record.type_format = (bytes.shift >> 4) & 15 # 4 bits Type of file in the part (1 for binary data, 2 for XML)\n # 4 bits Reserved (skipped in the above command)\n end", "title": "" }, { "docid": "047ca0d85acb08026b64e25216b0714e", "score": "0.52185595", "text": "def read_cmf\n return {} unless record_id\n query = <<-SQL\n select *\n from sierra_view.order_record_cmf cmf\n where cmf.order_record_id = #{record_id}\n SQL\n conn.make_query(query)\n @cmf_data = conn.results.entries.map do |entry|\n entry.collect { |k, v| [k.to_sym, v] }.to_h\n end\n end", "title": "" }, { "docid": "629e12b8d71ea8ad86de54596f4473b1", "score": "0.51916575", "text": "def load_record(data)\n record_class, record_id = data[\"record\"]\n record_class = Object.const_get(record_class)\n\n if respond_to?(:find_record)\n record = find_record(record_class, record_id)\n record ||= record_class.new.tap do |instance|\n # so that the id is always included in file deletion logs\n instance.singleton_class.send(:define_method, :id) { record_id }\n end\n else\n record = record_class.new\n record.send(:\"#{data[\"name\"]}_data=\", data[\"attachment\"])\n end\n\n record\n end", "title": "" }, { "docid": "629e12b8d71ea8ad86de54596f4473b1", "score": "0.51916575", "text": "def load_record(data)\n record_class, record_id = data[\"record\"]\n record_class = Object.const_get(record_class)\n\n if respond_to?(:find_record)\n record = find_record(record_class, record_id)\n record ||= record_class.new.tap do |instance|\n # so that the id is always included in file deletion logs\n instance.singleton_class.send(:define_method, :id) { record_id }\n end\n else\n record = record_class.new\n record.send(:\"#{data[\"name\"]}_data=\", data[\"attachment\"])\n end\n\n record\n end", "title": "" }, { "docid": "94bc40eab5a85edffd045d1e3206b52b", "score": "0.51829916", "text": "def copy_record(rec)\n rec.dup.tap do |result|\n set_item_number(result, :bib_seriesPosition)\n copy_identifier(result, :dc_identifier)\n copy_identifier(result, :dc_relation)\n end\n end", "title": "" }, { "docid": "a08cebdf68e5f681c9c1370269219ea4", "score": "0.518161", "text": "def load_records\n csv = CSV.new(open(native_instance),{:headers=>:first_row}).read\n @attributes = csv.headers\n if limit.present?\n csv.entries[0,limit]\n else\n csv.entries\n end\n end", "title": "" }, { "docid": "68ee556079182ed3cdfc6d6b23a4caf4", "score": "0.5160748", "text": "def extract(rec)\n @uid = rec.uid\n @database = rec.database\n end", "title": "" }, { "docid": "6a5cf90d20bec1d17e0603d9f04ff231", "score": "0.5127929", "text": "def read_extern(record, cursor)\n return nil if not extern?(record)\n cursor.name(type.name) { type.reader.read_extern(cursor) }\n end", "title": "" }, { "docid": "77ab102bfffbd151ddd9c9e7d109a26c", "score": "0.5126544", "text": "def record_identifier\n descMetadata.record_identifier\n end", "title": "" }, { "docid": "75e24dee5ba5a2e7dc8d243d08a415b2", "score": "0.51263434", "text": "def set_rec\n @rec = Rec.find(params[:id])\n end", "title": "" }, { "docid": "16bb04a639963588e39601d65eedae7b", "score": "0.5114306", "text": "def read_record(writers_schema, readers_schema, decoder, initial_record = {})\n readers_fields_hash = readers_schema.fields_hash\n read_record = Avromatic.use_custom_datum_reader ? initial_record : {}\n writers_schema.fields.each do |field|\n readers_field = readers_fields_hash[field.name]\n if readers_field\n field_val = read_data(field.type, readers_field.type, decoder)\n read_record[field.name] = field_val\n else\n skip_data(field.type, decoder)\n end\n end\n\n read_record\n end", "title": "" }, { "docid": "68ef20b43f32731e877d5a51fd0e0515", "score": "0.50913197", "text": "def build_record\n record = MARC::Record.new\n data_field = nil\n control_field = nil\n subfield = nil\n text = '' \n attrs = nil\n if Module.constants.index('Nokogiri') and @parser.is_a?(Nokogiri::XML::Reader)\n datafield = nil\n cursor = nil\n open_elements = []\n @parser.each do | node |\n if node.value? && cursor\n if cursor.is_a?(Symbol) and cursor == :leader\n record.leader = node.value\n else\n cursor.value = node.value\n end\n cursor = nil\n end\n next unless node.namespace_uri == @ns\n if open_elements.index(node.local_name.downcase)\n open_elements.delete(node.local_name.downcase)\n next\n else\n open_elements << node.local_name.downcase\n end\n case node.local_name.downcase\n when \"leader\"\n cursor = :leader\n when \"controlfield\"\n record << datafield if datafield\n datafield = nil\n control_field = MARC::ControlField.new(node.attribute('tag'))\n record << control_field\n cursor = control_field\n when \"datafield\" \n record << datafield if datafield\n datafield = nil\n data_field = MARC::DataField.new(node.attribute('tag'), node.attribute('ind1'), node.attribute('ind2'))\n datafield = data_field\n when \"subfield\"\n raise \"No datafield to add to\" unless datafield\n subfield = MARC::Subfield.new(node.attribute('code'))\n datafield.append(subfield)\n cursor = subfield\n when \"record\"\n record << datafield if datafield\n return record\n end \n #puts node.name\n end\n \n else\n while @parser.has_next?\n event = @parser.pull\n\n if event.text?\n text += REXML::Text::unnormalize(event[0])\n next\n end\n\n if event.start_element?\n text = ''\n attrs = event[1]\n case strip_ns(event[0])\n when 'controlfield'\n text = ''\n control_field = MARC::ControlField.new(attrs['tag'])\n when 'datafield'\n text = ''\n data_field = MARC::DataField.new(attrs['tag'], attrs['ind1'], \n attrs['ind2'])\n when 'subfield'\n text = ''\n subfield = MARC::Subfield.new(attrs['code'])\n end\n end\n\n if event.end_element?\n case strip_ns(event[0])\n when 'leader'\n record.leader = text\n when 'record'\n return record\n when 'controlfield'\n control_field.value = text\n record.append(control_field)\n when 'datafield'\n record.append(data_field)\n when 'subfield'\n subfield.value = text\n data_field.append(subfield)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "13c0a8a39571c6dba398c4f4ff608fff", "score": "0.50646824", "text": "def set_record\n @record = Record.find(record_params[:id])\n end", "title": "" }, { "docid": "ab3bd00e93d0afd1484d09e10765e882", "score": "0.5063741", "text": "def marc_record_from_marcxml\n id = fetch(_marc_source_field)\n\n response = Faraday.get(\"#{Requests.config['bibdata_base']}/bibliographic/#{id}\")\n response_stream = StringIO.new(response.body)\n marc_reader = MARC::XMLReader.new(response_stream)\n marc_records = marc_reader.to_a\n marc_records.first\n end", "title": "" }, { "docid": "4d5c0e0db5e84135408f492d8d4fa44c", "score": "0.505843", "text": "def record_id=(value)\n doc['record_id'] = value\n end", "title": "" }, { "docid": "6b8dc148d11cc0f9b0f65175b35fd6c0", "score": "0.50432026", "text": "def receiveSensorRecord(file, recnum)\n rec = file.read(SENSOR_PACKET_LENGTH)\n (magic,flexlo,xlo,ylo,zlo,xflexhi,yzhi) = rec.unpack(\"AC6\")\n event = 0\n case magic\n when MAGIC_NUMBER_SENSOR_PACKET_WITH_EVENT\n event = 1\n when MAGIC_NUMBER_SENSOR_PACKET_NO_EVENT\n when MAGIC_NUMBER_EMPTY_SENSOR_PACKET\n return nil\n else\n raise \"Bad magic #{magic.inspect}\"\n end\n flex = flexlo + ((xflexhi & 0x0F) << 8)\n x = xlo + ((xflexhi & 0xF0) << 4)\n y = ylo + ((yzhi & 0x0F) << 8)\n z = (zlo + ((yzhi & 0x70) << 4)) << 1\n [ rec, { :flex => flex, :x => x, :y => y, :z => z, :event => event } ]\nend", "title": "" }, { "docid": "b6961c5cf05515677f517d708075e6be", "score": "0.50361013", "text": "def set_record\n @record = Record.find(params[:id_record])\n end", "title": "" }, { "docid": "6a065a80dd76e7f43b71c5e36b9689a5", "score": "0.5031681", "text": "def get_record(record_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Slicehost::GetRecord.new,\n :path => \"records/#{record_id}.xml\"\n )\n end", "title": "" }, { "docid": "6a4d7b4e99401f732c5d343acdd9e882", "score": "0.50285894", "text": "def metadata_node_for_record(record)\n return record if record.respond_to?(:type) && record.respond_to?(:set_value)\n return record.metadata_node if record.respond_to?(:metadata_node)\n raise ArgumentError, \"record must either have a metadata node or must respond to .type\"\n end", "title": "" }, { "docid": "6a6d238c3c5c36fa89f6fe1243678624", "score": "0.50109226", "text": "def record_data\n return @record unless @record_class == DNSSD::Record::IN\n\n case @record_type\n when DNSSD::Record::A,\n DNSSD::Record::AAAA then\n IPAddr.new_ntoh @record\n when DNSSD::Record::CNAME,\n DNSSD::Record::NS,\n DNSSD::Record::PTR then\n domain_name_to_string @record\n when DNSSD::Record::MX then\n mx = @record.unpack 'nZ*'\n mx[-1] = domain_name_to_string mx.last\n mx\n when DNSSD::Record::SOA then\n soa = @record.unpack 'Z*Z*NNNNN'\n soa[0] = domain_name_to_string soa[0]\n soa[1] = domain_name_to_string soa[1]\n soa\n when DNSSD::Record::SRV then\n srv = @record.unpack 'nnnZ*'\n srv[-1] = domain_name_to_string srv.last\n srv\n when DNSSD::Record::TXT then\n record = @record.dup\n txt = []\n\n until record.empty? do\n txt << character_string_to_string(record)\n record.slice! 0, txt.last.length + 1\n end\n\n txt\n else\n @record\n end\n end", "title": "" }, { "docid": "1f902a60aa600224cf4abf4fe1d2dda7", "score": "0.5003664", "text": "def process_db_record!(record)\n # TODO(lsmola) rethink this. If references will be the full Hash references, we can construct this automatically\n index_value = if custom_manager_uuid.nil?\n build_stringified_reference_for_record(record, attribute_names)\n else\n # TODO(lsmola) hm this will not really work for the secondary indexes anyway\n custom_manager_uuid.call(record).join(\"__\")\n end\n\n attributes = record.attributes.symbolize_keys\n attribute_references.each do |ref|\n # We need to fill all references that are relations, we will use a ManagerRefresh::ApplicationRecordReference which\n # can be used for filling a relation and we don't need to do any query here.\n # TODO(lsmola) maybe loading all, not just referenced here? Otherwise this will have issue for db_cache_all\n # and find used in parser\n # TODO(lsmola) the last usage of this should be lazy_find_by with :key specified, maybe we can get rid of this?\n next unless (foreign_key = association_to_foreign_key_mapping[ref])\n base_class_name = attributes[association_to_foreign_type_mapping[ref].try(:to_sym)] || association_to_base_class_mapping[ref]\n id = attributes[foreign_key.to_sym]\n attributes[ref] = ManagerRefresh::ApplicationRecordReference.new(base_class_name, id)\n end\n\n index[index_value] = new_inventory_object(attributes)\n index[index_value].id = record.id\n end", "title": "" }, { "docid": "2e58e81bc5328a74f6bf3c17de7931eb", "score": "0.49923313", "text": "def update_table_readers(record)\n ids, record_meta = symbolic_names_to_id, record.record_meta # scoping assignments\n \n ids[record_meta.table_name][record.symbolic_name] = record.id\n table_readers.send :define_method, record_meta.id_reader do |*symbolic_names|\n record_ids = symbolic_names.flatten.collect do |symbolic_name|\n if symbolic_name.kind_of?(ActiveRecord::Base)\n symbolic_name.id\n else\n record_id = ids[record_meta.table_name][symbolic_name.to_sym]\n raise ActiveRecord::RecordNotFound, \"No object is associated with #{record_meta.table_name}(:#{symbolic_name})\" unless record_id\n record_id\n end\n end\n record_ids.size > 1 ? record_ids : record_ids.first\n end\n \n table_readers.send :define_method, record_meta.record_reader do |*symbolic_names|\n results = symbolic_names.flatten.collect do |symbolic_name|\n symbolic_name.kind_of?(ActiveRecord::Base) ?\n symbolic_name :\n record_meta.record_class.find(send(record_meta.id_reader, symbolic_name))\n end\n results.size > 1 ? results : results.first\n end\n end", "title": "" }, { "docid": "7dcaa51621f2f6b4d58cf5521f60e78c", "score": "0.49911872", "text": "def read_record(sql_name:)\n return {} unless record_id\n query = <<-SQL\n select *\n from sierra_view.#{sql_name}_record r\n where r.id = #{record_id}\n SQL\n conn.make_query(query)\n return {} if conn.results.entries.empty?\n conn.results.entries[0].collect { |k,v| [k.to_sym, v] }.to_h\n end", "title": "" }, { "docid": "18d7ff4ae27dc9299b2f5c2e4269a232", "score": "0.49877638", "text": "def decode_record(rec)\n\t\t\t\t\treturn rec.chomp!()\n\t\t\t\tend", "title": "" }, { "docid": "a0b1c058db1bc6f9b1293761ac17a5e3", "score": "0.49831238", "text": "def read(entry); end", "title": "" }, { "docid": "e3c3a682b2e930d9299eef57264f2226", "score": "0.49628454", "text": "def read(&blk)\n reopen!\n while !@fd.eof?\n blk.call(Record.read(@fd))\n end\n end", "title": "" }, { "docid": "5ef2809155766a9392793cb636970cb9", "score": "0.49594194", "text": "def each_record(&block)\n super do |record|\n record.metadata = Hash[Nokogiri::XML(record.metadata[:description]).css('td').collect(&:text).each_slice(2).to_a]\n yield record\n end\n end", "title": "" }, { "docid": "c47a3b45518b7c4e877d8fe196f31e26", "score": "0.49450257", "text": "def extract_record( record )\n @writer.write(record)\n @record_count = @record_count + 1\n end", "title": "" }, { "docid": "2c899358408fec7e95f5733b4c1852d8", "score": "0.4944598", "text": "def prep_record(record)\n family_members = record[\"family\"][\"family_members\"]\n applicants = record[\"family\"][\"magi_medicaid_applications\"][\"applicants\"]\n applicant_ids = applicants.map { |h| h[\"person_hbx_id\"] }\n broker_account = record[\"family\"][\"broker_accounts\"]&.first\n\n record[\"family\"].merge!(\"family_members\" => family_members.select { |h| applicant_ids.include? h[\"person\"][\"hbx_id\"] }.group_by do |h|\n h[\"person\"][\"hbx_id\"]\n end.transform_keys(&:to_s).transform_values(&:first))\n record[\"family\"][\"magi_medicaid_applications\"].merge!(\"applicants\" => applicants.group_by do |h|\n h[\"person_hbx_id\"]\n end.transform_keys(&:to_s).transform_values(&:first))\n magi_medicaid_application = record[\"family\"][\"magi_medicaid_applications\"]\n record[\"family\"].merge!(\"magi_medicaid_applications\" => magi_medicaid_application)\n family_members = record[\"family\"].delete(\"family_members\")\n\n if record[\"family\"][\"magi_medicaid_applications\"].present?\n tax_households = record[\"family\"][\"magi_medicaid_applications\"][\"tax_households\"]\n tax_households.each do |th|\n next unless th[\"annual_tax_household_income\"].instance_of?(String)\n th[\"annual_tax_household_income\"] = { \"cents\" => th[\"annual_tax_household_income\"].to_f, \"currency_iso\" => \"USD\" }\n end\n record[\"family\"][\"magi_medicaid_applications\"].merge!(\"tax_households\" => tax_households.group_by do |th|\n th[\"hbx_id\"]\n end.transform_keys(&:to_s).transform_values(&:first))\n end\n\n family_members.each do |family_member|\n person_relationships = family_member[1][\"person\"].delete(\"person_relationships\")\n family_member[1][\"person\"].merge!(\"person_relationship\" => person_relationships.first)\n\n person = family_member[1].delete(\"person\")\n family_member[1].merge!(\"person\" => person)\n end\n record[\"family\"].merge!(\"family_members\" => family_members)\n record[\"family\"].merge!(\"broker_accounts\" => broker_account)\n\n record\n end", "title": "" }, { "docid": "2800730433c465b1e1f630ec617dd55d", "score": "0.49410665", "text": "def read_data(dname, *ky)\n x = @data_store.read_data(dname, *ky)\n save\n x\n end", "title": "" }, { "docid": "a0512e17737c2cc12ede13da51eff62e", "score": "0.49401414", "text": "def preloaded_records=(_arg0); end", "title": "" }, { "docid": "1d3dcf943e7387a0849ffebc728fcdb1", "score": "0.4939871", "text": "def from_marc_file(marc_file, shared_field_data={}, &blk)\n \n shared_field_data.each_pair do |k,v|\n # map each item in the hash to a solr field\n map k.to_sym, v\n end\n \n map :id do |rec,index|\n rec['001'].value.gsub(\" \",\"\").gsub(\"/\",\"\")\n end\n \n map :title_t do |rec,index|\n rec.values_for '245', 'a'\n end\n \n map :title_sort do |rec,index|\n rec.extract '245:a'\n end\n \n map :sub_title_t do |rec,index|\n rec.values_for '245', 'b'\n end\n \n map :alt_titles_t do |rec,index|\n rec.extract '240:b 700:t 710:t 711:t 440:a 490:a 505:a 830:a'\n end\n \n map :title_added_entry_t do |rec,index|\n rec.values_for '700', 't'\n end\n \n map :author_t do |rec,index|\n rec.extract '100:a 110:a 111:a 130:a 700:a 710:a 711:a'\n end\n \n map :published_t do |rec,index|\n rec.extract '260:a'\n end\n \n map :isbn_t do |rec,index|\n rec.isbn # in MARCRecordExt module\n end\n \n map :material_type_t do |rec,index|\n rec.values_for '300', 'a'\n end\n\n map :subject_t do |rec,index|\n rec.extract '600:a 610:a 611:a 630:a 650:a 651:a 655:a 690:a'\n end\n\n map :subject_era_facet do |rec,index|\n rec.extract '650:d 650:y 651:y 655:y'\n end\n\n map :geographic_subject_facet do |rec,index|\n rec.extract '650:c 650:z 651:a 651:x 651:z 655:z'\n end\n\n map :language_facet do |rec,index|\n rec.languages # in MARCRecordExt module\n end\n\n # _display is stored, but not indexed\n # don't store a string, store marc21 so we can read it back out\n # into a MARC::Record object \n map :marc_display do |rec,index|\n rec.to_xml\n end\n \n map :format_facet do |rec,index|\n rec.format # in MARCRecordExt module\n end\n \n # downcased, format, spaces converted to _\n # This can be used for the partial view mapping\n map :format_code_t do |rec,index|\n rec.format.to_s.downcase.gsub(/ _/, ' ').gsub(/ /, '_')\n end\n \n reader = MARC::Reader.new(marc_file)\n self.run(reader, &blk)\n \n end", "title": "" }, { "docid": "dc94e6679cf598b8365b8a8d7bfc9676", "score": "0.49350572", "text": "def custom_reader(key); end", "title": "" }, { "docid": "f4cf9714fa977f964dd5be271bf822f0", "score": "0.49348718", "text": "def data_for(record)\n @builder.metadata do\n @builder.target! << provider.format(requested_format).encode(provider.model, record)\n end\n end", "title": "" }, { "docid": "9d08d4fa3798a0b9092307e2673466ad", "score": "0.49346128", "text": "def dataset_record\n\t\tself.dataset_file\n\tend", "title": "" }, { "docid": "28329164c60bc0b1d0675d29d8cc11cc", "score": "0.49293792", "text": "def pass_records_through_xml_parser(records)\n reader = MARC::XMLReader.new(StringIO.new( records_to_xml_string(records) ))\n record_hashes = []\n reader.each { |r| record_hashes << r.to_hash }\n if record_hashes.length == 1\n record_hashes.first\n else\n record_hashes\n end\n end", "title": "" }, { "docid": "9208f8eb05e55c37c974638ffc285bf5", "score": "0.49291435", "text": "def records\n @records ||= load\n end", "title": "" }, { "docid": "9208f8eb05e55c37c974638ffc285bf5", "score": "0.4928563", "text": "def records\n @records ||= load\n end", "title": "" }, { "docid": "a1dd5edd0ffe3a40e2ec32ca393e5e62", "score": "0.4927952", "text": "def setup_attributes_with_rfm_record(record)\n self.record = record\n record.each do |k, v|\n self.attributes[k.to_s] = v\n end\n end", "title": "" }, { "docid": "e7803517c0ba1bbeda59af6fe48a3f25", "score": "0.49234593", "text": "def get_notes_from_record(record)\n notes = []\n record.fields('500'..'599').each do |field|\n text = ''\n field.subfields.each { |subf| text << subf.value + ' ' }\n text.strip!\n notes << { tag: field.tag, text: text }\n end\n notes\nend", "title": "" }, { "docid": "b45fc5e708133fd01e91ee6f3abe7803", "score": "0.49173808", "text": "def load_representation_metadata(sequel_records, jsonmodels)\n return {} unless sequel_records.length > 0 && REPRESENTATION_TYPES.include?(jsonmodels[0].class.record_type)\n\n metadata_by_ao_id = {}\n\n archival_objects = ArchivalObject.filter(:id => sequel_records.map(&:archival_object_id)).all\n\n series_info_by_ao_id = {}\n\n ArchivalObject\n .join(Resource, Sequel.qualify(:archival_object, :root_record_id) => Sequel.qualify(:resource, :id))\n .filter(Sequel.qualify(:archival_object, :id) => archival_objects.map(&:id))\n .select(Sequel.as(Sequel.qualify(:resource, :id),\n :resource_id),\n Sequel.qualify(:resource, :repo_id),\n Sequel.qualify(:resource, :title),\n Sequel.as(Sequel.qualify(:archival_object, :id),\n :ao_id))\n .each do |row|\n series_info_by_ao_id[row[:ao_id]] = {\n :id => row[:resource_id],\n :repo_id => row[:repo_id],\n :title => row[:title],\n }\n end\n\n archival_objects.zip(ArchivalObject.sequel_to_jsonmodel(archival_objects)).each do |ao, json|\n series = series_info_by_ao_id.fetch(ao.id)\n\n metadata_by_ao_id[ao.id] = {\n :containing_record_title => json['display_string'],\n :containing_series_title => series.fetch(:title),\n :containing_series_id => JSONModel::JSONModel(:resource).uri_for(series.fetch(:id), :repo_id => series.fetch(:repo_id)),\n :responsible_agency_uri => json['responsible_agency'] ? json['responsible_agency']['ref'] : nil,\n :recent_responsible_agency_refs => json['recent_responsible_agencies'] || [],\n :creating_agency_uri => json['creating_agency'] ? json['creating_agency']['ref'] : nil,\n }\n end\n\n result = {}\n\n sequel_records.each do |rec|\n unless metadata_by_ao_id[rec.archival_object_id].nil?\n result[rec.uri] = metadata_by_ao_id[rec.archival_object_id]\n end\n end\n\n result\n end", "title": "" }, { "docid": "9a86253c0fcbb4540bc235501746b52d", "score": "0.4912513", "text": "def next_record\n next_line = @file.gets\n if next_line\n @current_line_number += 1\n BroRecord.new(@fields, next_line)\n else\n nil\n end\n end", "title": "" }, { "docid": "f0a8f085db9677f3a6ef7461839a0335", "score": "0.4908334", "text": "def fetch_record(id)\n return if @results.key?(id)\n\n @results[id] = {}\n @master_list.each_slice(3) do |section, sub_sections, columns|\n fetch_record_section(id, section, sub_sections, columns) if @include[section[:name]][:fetch]\n end\n calculate_record(id)\n end", "title": "" }, { "docid": "740237b8964ded3561dd546711c73505", "score": "0.490503", "text": "def metadata=(raw_metadata)\n if raw_metadata.instance_of? XDS::Metadata\n super\n elsif raw_metadata.kind_of?(String)\n super YAML.load(raw_metadata) \n else\n raw_metadata[:source_patient_info] = patient.source_patient_info\n md = XDS::Metadata.new\n md.from_hash(raw_metadata, AFFINITY_DOMAIN_CONFIG)\n md.repository_unique_id = Setting.xds_repository_unique_id\n md.patient_id = patient.patient_identifier\n super md\n end\n end", "title": "" }, { "docid": "0d8d9d164f5a4192fac477b695659510", "score": "0.4903868", "text": "def record_content(record_type, offset)\n c = cursor(offset)\n case record_type\n when :MLOG_1BYTE\n c.get_uint8\n when :MLOG_2BYTE\n c.get_uint16\n when :MLOG_4BYTE\n c.get_uint32\n when :MLOG_8BYTE\n c.get_uint64\n when :UNDO_INSERT\n when :COMP_REC_INSERT\n end\n end", "title": "" }, { "docid": "8ab55a60699fa34746d9e0645185b345", "score": "0.49018845", "text": "def read_at_offset(num_bytes, offset)\n # convert to offsets in the array\n start_offset = (offset * 2)\n end_offset = start_offset + (num_bytes * 2) - 1\n\n @exif_data[start_offset..end_offset]\n end", "title": "" }, { "docid": "616538cff969148c456281172e6c9b0b", "score": "0.49001008", "text": "def set_record\r\n @record = Record.find(params[:id])\r\n end", "title": "" }, { "docid": "7d9c6bb3eca07fc79540bb991fdb0da5", "score": "0.48992634", "text": "def set_record\n\t @record = Record.find(params[:id])\n\tend", "title": "" }, { "docid": "27da88245ab7e96852cbb9df2fd278ef", "score": "0.48961225", "text": "def set_record\n\t\t\t@record = Record.find(params[:id])\n\t\tend", "title": "" }, { "docid": "27da88245ab7e96852cbb9df2fd278ef", "score": "0.48961225", "text": "def set_record\n\t\t\t@record = Record.find(params[:id])\n\t\tend", "title": "" }, { "docid": "1214b3a966d82428a33d03ad1d32671c", "score": "0.48929405", "text": "def initialize(record)\n return unless record.title\n\n extract_metadata record\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" }, { "docid": "9abbb7daefe6d9072fefe3b3e6759415", "score": "0.4891819", "text": "def set_record\n @record = Record.find(params[:id])\n end", "title": "" } ]
1efa9883981506a93415c9cd3ec4a608
number1 The integer that could be between number2 and number3. number2 The integer that marks the first boundry marker. number3 The integer that marks the last boundry marker. Examples between(1, 3, 5) => true Returns true or false depending on if the number is within or equal the two boundries.
[ { "docid": "ef8494e98b14df482542c98576ac2d40", "score": "0.7926255", "text": "def between(number1, number2, number3)\n output = false\n if number1 > (number2 - 1) && number1 < (number3 + 1)\n output = true\n end\n return output \nend", "title": "" } ]
[ { "docid": "26f6d8ded15f92121e98493f635e2e76", "score": "0.8086989", "text": "def between(number1, number2, number3)\n return number1 >= number2 && number1 <= number3\nend", "title": "" }, { "docid": "8a00f8f543a58cac59905d1bfd5b57ce", "score": "0.7966889", "text": "def between_strict(number1,number2,number3)\n output = false\n if number1 == number3 - 1 && number2 == number1 - 1\n output = true\n end\n return output\nend", "title": "" }, { "docid": "5a98c153da595b50893194ad58fd2a71", "score": "0.79299396", "text": "def between(number1,number2,number3)\n output = false \n if number1 >= number2 && number1 <= number3\n output = true \n end\n return output\nend", "title": "" }, { "docid": "69c8d9d227694c9a477ac979d7fab202", "score": "0.78560257", "text": "def between(num_between, num2, num3)\n if num_between <= num3 && num_between >= num2\n return true \n else \n false\n end \nend", "title": "" }, { "docid": "f147ea73e8eacc89266b6bdb18e56487", "score": "0.77645266", "text": "def between(num1, num2, num3)\n if num2 <= num1 && num3 >= num1\n return true\n else \n return false\n end\nend", "title": "" }, { "docid": "e3788902534a4f17b9a7651180411f82", "score": "0.7755127", "text": "def between(num1,num2,num3)\n if num2 <= num1 && num1 <= num3\n return true\n elsif num3 <= num1 && num1 <= num2\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "fa39d6c71dafbdadcb82fd87053f0b41", "score": "0.773211", "text": "def between(num1,num2,num3)\n if num2 <= num1 && num2 <= num3\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "eacf9ac3784891a3986945fd10297d0b", "score": "0.7729658", "text": "def between(num1, num2, num3)\n if num1 <= num3 and num1 >= num2\n return true\n end\n return false\nend", "title": "" }, { "docid": "747f0a569d88167aebb4c396d919819b", "score": "0.7669333", "text": "def Between_strict(number1,number2,number3)\n output = false\n if number1 > number2 && number1 < number3\n if number1 != number2 && number3 != number2\n output = true \n end\n end\n return output\nend", "title": "" }, { "docid": "5411f806098e7d6f99c6124f42c114cb", "score": "0.76448977", "text": "def between_strict(number1, number2, number3)\n return number1 > number2 && number1 < number3\nend", "title": "" }, { "docid": "2c6e67d855238d7b9d28e00c07339a8f", "score": "0.7618606", "text": "def between(num1, num2, num3)\n return num2 <= num1 && num1 <= num3 if (num2 < num3)\n return num2 >= num1 && num1 >= num3\nend", "title": "" }, { "docid": "f2673c55929955d7761f7a686c18e23d", "score": "0.7599962", "text": "def between(num1, num2, num3)\n output=false\n if num1 > num2 && num1 < num3\n output =true\n end\n return output\nend", "title": "" }, { "docid": "72778133134281bfb66c1b18a0d53be3", "score": "0.75858384", "text": "def between(num1, num2, num3)\n output = false\n if num1 > num2 && num1 < num3\n output = true\n end\n return output\nend", "title": "" }, { "docid": "b559abc02d68c650b8522b51449620bb", "score": "0.7584667", "text": "def between(num1, num2, num3)\n if num1 >= num2\n if num1 <= num3\n return true\n else return false\n end\n else return false\n end\nend", "title": "" }, { "docid": "a1c4aa04518da1591ed8e49c2ad17b2f", "score": "0.7569108", "text": "def between(num1, num2, num3)\n if num2 < num1 && num1 < num3 || num1 < num2 && num3 < num1\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "711555bbf24faa8382cd0461a5d4256c", "score": "0.75307333", "text": "def is_between(num1, num2, num3)\n if num1 >= num2\n if num1 <= num3\n return true\n else\n return false\n end\n else\n return false\n end\nend", "title": "" }, { "docid": "d42df72c3ac1262f76a7bfa946124fed", "score": "0.7528717", "text": "def between(num1, num2, num3)\n if num1 < num2 && num2 < num3\n return true\n end\n return false\nend", "title": "" }, { "docid": "5ae022e3bd90fe2986ff23d9030e4d8d", "score": "0.7504957", "text": "def between(num1,num2,num3)\n if num2 > num3\n if num1>= num3 && num1<= num2\n return true\n end\n return false\n end\n \n if num1 >= num2 && num1 <= num3\n return true\n end \n return false\nend", "title": "" }, { "docid": "471873d463248bae076bef95c71826d0", "score": "0.73822683", "text": "def between_strict(num1, num2, num3)\n output = false\n if num2 == num1 - 1 && num2= num3+1\n output= true\n end\n return output\nend", "title": "" }, { "docid": "d521cd048d46c7e3dae2e8e29be83bd9", "score": "0.7373424", "text": "def between_strict(num1,num2,num3)\n if num2 < num1 && num1 < num3\n return true\n elsif num3 < num1 && num1 < num2\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "a5614d4ec968b89e1190742ada8ab92a", "score": "0.735848", "text": "def between_strict(num1, num2, num3)\n if num1 > num2 && num1 < num3\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "5913842eb41ea7957f984dfdf70d5ec3", "score": "0.7357074", "text": "def between(input1, input2, input3)\n input1.to_i\n input2.to_i\n input3.to_i\n if input2 > input1 && input2 < input3\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "fe61b582198208eb437a5e5a1491e054", "score": "0.73470837", "text": "def between_strict(num1, num2, num3)\n if num2 < num1 && num1 < num3 || num1 < num2 && num3 < num1\n if num1 = num2 - 1 && num1 = num3 + 1 || num1 = num2 + 1 && num1 = num3 - 1\n return true\n end\n else\n return false\n end\nend", "title": "" }, { "docid": "d6f47f272b9acb7b594abb4860a25889", "score": "0.73175454", "text": "def between(num1, num2, num3)\n\ndef between_strict(num1, num2, num3)\n\n if num2 < num1 && num3 > num1\n return true\n else \n return false\n end\nend\nputs between_strict(4, 1, 5)", "title": "" }, { "docid": "caf56657c05c26158706047964803906", "score": "0.73171574", "text": "def between_strict(num1, num2, num3)\n output = false\n if num2 < num1 && num1 < num3 \n output = true\n elsif num3 < num1 && num1 < num2\n output = true\n end\n return output\nend", "title": "" }, { "docid": "990f6853a2515930034049c28760fd2e", "score": "0.7270191", "text": "def between(n1, n2, n3)\n if n1 < n2 \n return false\n end\n if n1 > n3 \n return false\n end\n return true\nend", "title": "" }, { "docid": "17cd18e1caa02c2dd35b61ea4cf2e870", "score": "0.7266169", "text": "def is_between(num1, num2, num3)\n if num1 >= num2\n if num1 <= num3\n return num1\n elsif\n num3 >= num2\n return num3\n else\n return num2\n end\n elsif\n num2 <= num3\n return num2\n elsif\n num3 >= num1\n return num3\n else\n return num1\n end\nend", "title": "" }, { "docid": "43b986c699ae15829d9c5a238b82fe13", "score": "0.7261682", "text": "def between(number, betlow, bethigh)\n return (number <= bethigh && number >= betlow)\nend", "title": "" }, { "docid": "b58691f0bba762bd2c1c9e8bb0e63201", "score": "0.72513855", "text": "def is_between_strict(num1, num2, num3)\n if num1 > num2\n if num1 < num3\n return true\n else\n return false\n end\n else\n return false\n end\nend", "title": "" }, { "docid": "5913ba199f15e51c3c8c2319cbfb4e02", "score": "0.7155805", "text": "def is_between(num,first,second)\n if num >= first && num <= second || num <= first && num >= second\n return true\n end\n return false\nend", "title": "" }, { "docid": "e268d6b0c2ac45c42a35e0f626e0a05f", "score": "0.71478057", "text": "def strictbetween(num1, num2, num3)\n i = \"false\"\n if num1 > num2\n if num1 < num3\n i = \"true\"\n end\n end\n return i\nend", "title": "" }, { "docid": "060a257372463191f9e8f803f236ac15", "score": "0.69621795", "text": "def between_strict(n1, n2, n3)\n if n1 < n2 \n return false\n end\n if n1 > n3 \n return false\n end\n if n2 + 1==n1 || n1 + 1 ==n3\n return true\n end\nend", "title": "" }, { "docid": "bccfb634269161356722490341a26226", "score": "0.69316345", "text": "def between(number, lower, upper)\n if !number.is_a?(Integer) || !lower.is_a?(Integer) || !upper.is_a?(Integer)\n return nil\n else \n if number < upper\n if number > lower\n return true\n end\n end\n return false\n end\nend", "title": "" }, { "docid": "c573efc0a253398bbc9be46711021baf", "score": "0.69315505", "text": "def between_strict(number, betlow, bethigh)\n return (number < bethigh && number > betlow)\nend", "title": "" }, { "docid": "84865b4ac9590cad6cba78197e89b6af", "score": "0.69242895", "text": "def between_strict(number, limit1, limit2)\n return true if ((num1 > limit1) && (num1 < limit2)) || ((num1 < limit1) && (num1 > limit2))\n return false\nend", "title": "" }, { "docid": "b9d9f4b11b98fdac64d41f6dbb583027", "score": "0.68780744", "text": "def between?(arg0, arg1)\n end", "title": "" }, { "docid": "192c4e8fb38377d580b7d4f2f7686985", "score": "0.6877994", "text": "def between_strict(number, limit1, limit2)\n return true if (number > limit1 || number > limit2) && (number < limit2 || number < limit1)\n return false\nend", "title": "" }, { "docid": "0c2b509efb75905a7c85b7072f7f6ef5", "score": "0.68709356", "text": "def number_range(number)\n if number >= 0 && number <= 50\n puts \"Number is between 0 and 50!\"\n elsif number > 50 && number <= 100\n puts \"Number is between 51 and 100!\"\n elsif number > 100\n puts \"Number is greater than 100!\"\n else\n puts \"Please give a number between 0 and 100!\"\n end\nend", "title": "" }, { "docid": "aefcec01613dd358b12900989c9662bb", "score": "0.6867723", "text": "def between(term1, term2, term3)\n if term1 > term2 && term1 < term3\n return true\n end\n return false\nend", "title": "" }, { "docid": "8b586bba5a163c221f6e6f11c96736a9", "score": "0.6864622", "text": "def number_between(number)\n if number < 0\n puts \"number is less than 0\"\n elsif number <= 50\n puts \"number is between 0 and 50\"\n elsif number <= 100\n puts \"number is between 50 and 100\"\n elsif number > 100\n puts \"number is above 100\"\n else\n puts \"Number is less than 0\"\n end\nend", "title": "" }, { "docid": "4211e5cd48bbbe99ac4c9a8a15e9673a", "score": "0.68255424", "text": "def between(checked,number1,number2)\n if checked > number2\n return false\n end\n if checked < number1\n return false\n end\n return true\nend", "title": "" }, { "docid": "3e61af541ee90fab6cf867c8040aef31", "score": "0.68076485", "text": "def strikt_between(num1, num2, num3)\n equal = num2 + num3\n equal = equal / 2.0\n if num1 == equal\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "e85a2991faec5a0d28cc6f1418f656c5", "score": "0.6794886", "text": "def between(term1, term2, term3)\n answer = false\n if term2 <= term1 && term1 <= term3\n answer = true\n end\n return answer\nend", "title": "" }, { "docid": "89a22b22345760df582b58c63cdcc68b", "score": "0.6766571", "text": "def between?(a, b)\n first >= a and last <= b\n end", "title": "" }, { "docid": "ac58a813ecd6784b8263d981de0f7434", "score": "0.67475617", "text": "def between?(min, max); end", "title": "" }, { "docid": "ac58a813ecd6784b8263d981de0f7434", "score": "0.67475617", "text": "def between?(min, max); end", "title": "" }, { "docid": "bf83bbd2e26eeb799166a72bd0918129", "score": "0.6731175", "text": "def between_strict(numb, lower, higher)\n return true if numb > lower && numb < higher\n return false\nend", "title": "" }, { "docid": "646ab466fbe3b7a8076a1b660d238ac9", "score": "0.67007893", "text": "def between?(value, lowest, highest)\n value > lowest && value < highest\nend", "title": "" }, { "docid": "15e5899eaa76557f08b116d90dd84d82", "score": "0.6686465", "text": "def locationif(number)\n if number >= 0 && number <= 50\n puts \"#{number} is between 0 and 50\"\n elsif number >50 && number <=100\n puts \"#{number} is between 50 and 100\"\n elsif number > 100\n puts \"#{number} is greater than 100\"\n else\n puts \"#{number} is not in the preferred range, doofus. Fix it.\"\n end\nend", "title": "" }, { "docid": "effbda95b578d03cc06493c3ea62a2e5", "score": "0.6684343", "text": "def between_strict(num,num1,num2)\n return num1 < num && num < num2\nend", "title": "" }, { "docid": "487850a214a4d157c595d569b7549c61", "score": "0.66647273", "text": "def in_n_rage (number, small, large)\n if (number >= small && number <= large)\n true\n else \n false\n end\nend", "title": "" }, { "docid": "f308ee36b33172b534fc355fc2913314", "score": "0.6645688", "text": "def between_1_and_10 num \n if 1 <= num && num <= 10\n 'Valid'\n else\n 'Invalid'\n end\nend", "title": "" }, { "docid": "322172c682ee426adb8993a38232ed40", "score": "0.659281", "text": "def is_a_3_dot_range?(range)\nend", "title": "" }, { "docid": "be221ccf5e5f7f44462c8aa210fb3078", "score": "0.6575522", "text": "def number_between(num)\n return if num < 0\n return \"#{num} is between 0 and 50\" if (num >= 0) && (num <= 50)\n return \"#{num} is between 51 and 100\" if (num >= 51) && (num <= 100)\n return \"#{num} is above 100\"\nend", "title": "" }, { "docid": "71b1b48b3d6fb68f531047d0064cccce", "score": "0.6562016", "text": "def number_range(number)\n\n if number < 0\n puts \"You cannot enter a negative number!\"\n elsif number <= 50\n puts \"#{number} is between 0 and 50\"\n elsif number <= 100\n puts \"#{number} is between 51 and 100\"\n else\n puts \"#{number} is above 100\"\n end\n\nend", "title": "" }, { "docid": "2615d0cd2d02f00bd0fa3eeef7d04191", "score": "0.6554222", "text": "def numbers(number) \n if number <= 50\n puts \"Your input value is #{number}. That number is between 0 and 50.\"\n elsif number > 50 && number <= 100 \n puts \"Your input value is #{number}. That number is between 51 and 100.\"\n else number > 100 \n puts \"Your input value is #{number}. That number is over 100.\"\n end\nend", "title": "" }, { "docid": "f4f94de2181c6b3b7ac6e12faec52735", "score": "0.65488166", "text": "def range(number)\n case\n when number > 100 \n puts \"Above 100\"\n when number >= 51\n puts \"Between 51 and 100\"\n else\n puts \"Between 0 and 50\"\n end\nend", "title": "" }, { "docid": "d45d6721bb4bab2a81aa7b36f476a41a", "score": "0.6525889", "text": "def isInrange?(a, b, c)\n a.range?(b, c)\nend", "title": "" }, { "docid": "38335abb458467fe9f6363cb431cb690", "score": "0.65251815", "text": "def is_between_1_10?(num)\n (1..10).include?(num)\nend", "title": "" }, { "docid": "6131ee8b83914adf91edc123251ab8e5", "score": "0.6505461", "text": "def number_range(number)\n if number.to_i.to_s == number \n puts \"Here we go.\" \n else \n puts \"This is not a number, good bye!\"\n return\n end\n\n if number.to_i > 100\n puts \"The number is greater than 100\"\n elsif number.to_i >= 51 && number.to_i <= 100\n puts \"The number is between 51 and 100\"\n elsif number.to_i >= 0 && number.to_i <= 50\n puts \"The number is between 0 and 50\"\n else\n puts \"You gave a negative number\"\n end\nend", "title": "" }, { "docid": "48ba855de0987a64427e4715670b34a7", "score": "0.64995486", "text": "def between_100(number)\n if number >= 0 && number <= 50\n puts \"#{number} is between 0 and 50\"\n\n elsif number > 50 && number < 101\n puts \"#{number} is between 51 and 100\"\n\n else\n puts \"#{number} is not from 0 to 100.\"\n end\nend", "title": "" }, { "docid": "76617e34be231e4adfcaa6f6a8aaf4ea", "score": "0.6471897", "text": "def between?(min, max)\n `if(this.m$_ltgt(min)==-1){return false;}`\n `if(this.m$_ltgt(max)==1){return false;}`\n return true\n end", "title": "" }, { "docid": "3a8ec70feebaabebad9474ab7fd14ce9", "score": "0.64702165", "text": "def check_condition_with_parameters(value, range)\n range.include?(value)\n end", "title": "" }, { "docid": "4d391442cac0a43d0a90c8f6b6dcf441", "score": "0.6467455", "text": "def between(tal, min, max)\n if tal > min && tal < max\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "b4ed8ed34eeb4a09630d5a95c023470b", "score": "0.6463447", "text": "def num_range(number)\n if number < 0\n puts \"Invalid argument. Enter a non-negative number.\"\n elsif number <= 50\n puts \"#{number} is between 0 and 50.\"\n elsif number <= 100\n puts \"#{number} is between 51 and 100.\"\n else\n puts \"#{number} is greater than 100.\"\n end\nend", "title": "" }, { "docid": "3c325d21fca5f6dd252f298396f80d0b", "score": "0.64378625", "text": "def bounding_range(in_range, in_range2)\n\tin_range.range2d? ? combine_range2d(in_range, in_range2) : combine_range(in_range, in_range2)\nend", "title": "" }, { "docid": "d5de9a2ab7a474797ec4fad501b61cb3", "score": "0.6434492", "text": "def identify_range(num)\n if num < 0\n puts \"Number is too small.\"\n elsif 0 <= num && num <= 50\n puts \"#{num} is between 0 and 50.\"\n elsif 50 < num && num <= 100\n puts \"#{num} is between 50 and 100.\"\n else\n puts \"#{num} is greater than 100.\"\n end\nend", "title": "" }, { "docid": "5c0a12af581ed5773633fafbccebfe98", "score": "0.6432505", "text": "def input_valid?(input1, input2)\n if(1..3).include?(input1 && input2)\n @from = input1 -1\n @to = input2 -1\n else\n puts \"Please make sure you entered in format 'num1, num2' between ranges 1 & 3\"\n get_input\n end\n #run additional test to see if move is legal\n \n end", "title": "" }, { "docid": "f439b5914eada6e4d40c8224093b4709", "score": "0.6408568", "text": "def is_between?( x, a, b )\n if a >= b\n if b <= x && x <= a\n true\n else\n false\n end\n else\n if a <= x && x <= b\n true\n else\n false\n end\n end\n end", "title": "" }, { "docid": "ad010f5376e1814cf06f5a1bbc4c0232", "score": "0.6394409", "text": "def range(n)\n if n < 0\n puts \"This number is less than zero\"\n elsif n >= 0 && n <= 50\n puts \"This number is between 0 and 50.\"\n elsif n > 51 && n <= 100\n puts \"This number is between 51 and 100.\"\n else\n puts \"This number is greater than 100.\"\n end\nend", "title": "" }, { "docid": "e8bf7b4edd3f19f51479367bfc228a11", "score": "0.6387989", "text": "def num_range(new_num)\n if new_num <= 50\n puts \"Your number is between 0 - 50\"\n elsif new_num <= 100\n puts \"Your number is between 51 and 100\"\n else\n puts \"Your number is above 100\"\n end\nend", "title": "" }, { "docid": "2553fc258c91e3c9dbca657e95714f95", "score": "0.6373367", "text": "def is_a_3_dot_range?(range)\n if (range.eql?(Range.new(range.begin,range.end,exclude_end=true)))\n true\n else (range.eql?(Range.new(range.begin,range.end,exclude_end=false)))\n false\n end\nend", "title": "" }, { "docid": "7fced2338173a55ebc8492ac5890da66", "score": "0.6369557", "text": "def is_between?(z, x, y)\n y > x ? z.between?(x, y) : z.between?(y, x)\nend", "title": "" }, { "docid": "a3d1a79fb161f4ddafd7b3ca89c69851", "score": "0.6336233", "text": "def between_strict(middle, first, last)\n if first == middle - 1 and last == middle + 1\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "3c1a82148eee278c01361ae0044cdb02", "score": "0.6336182", "text": "def valid_range? (range)\n if number?(self.slice(1..-1))\n self.to_i.between?(range[0], range[1])\n else \n self.slice(1..-1).to_i.between?(range[0], range[1])\n end\n end", "title": "" }, { "docid": "d606f94121c08e8328e91025aad9bed5", "score": "0.63351005", "text": "def rule2\n\t\tStart_number <= @num_i and @num_i < Last_number + 1\n\tend", "title": "" }, { "docid": "477e7aba6652fc02ae0c6b5345b0c560", "score": "0.6320986", "text": "def be_between(min, max); end", "title": "" }, { "docid": "1472319cc2a8b10dcb912f0b0aaf889f", "score": "0.6308373", "text": "def method(num)\n if num <= 50\n puts \"#{num} is less than 50.\"\n elsif num >= 51 && num <= 100\n puts \"#{num} is between 51 and 100.\"\n else\n puts \"#{num} is greater than 100.\"\n end\nend", "title": "" }, { "docid": "cfb64d23f286571ea588aca7e23ea551", "score": "0.62815607", "text": "def bounding_range(r1, r2)\n if range1d?(r1) and range1d?(r2)\n bounding1d(r1,r2)\n elsif r1.range2d? and r2.range2d?\n bounding2d(r1,r2)\n else check_pre(false)\n end\nend", "title": "" }, { "docid": "dcebc680747597347a3667fc52f6850d", "score": "0.62721515", "text": "def validNumber?(range, number)\n range = range.sort\n ix2 = range.size - 1\n for ix1 in (0..(range.size-1)).to_a\n for ix2 in (0..(range.size-1)).to_a.reverse\n if ix1 == ix2\n next\n end\n n = range[ix1] + range[ix2]\n if n == number\n return true\n end\n if n < number # speed improvement, if upper pointer + lower pointer return a too low number move the upper pointer forward\n break\n end\n end\n end\n return false\nend", "title": "" }, { "docid": "7bc6c1df9a721de1d8432af0b70fcc3c", "score": "0.6271174", "text": "def number_range(int)\n if int > 0\n if int <= 50\n return \"Number is between 0 and 50\"\n elsif int < 100\n return \"Number is between 50 and 100\"\n else\n return \"Number is above 100\"\n end\n else\n return \"Number is less than zero\"\n end\nend", "title": "" }, { "docid": "7bc6c1df9a721de1d8432af0b70fcc3c", "score": "0.6271174", "text": "def number_range(int)\n if int > 0\n if int <= 50\n return \"Number is between 0 and 50\"\n elsif int < 100\n return \"Number is between 50 and 100\"\n else\n return \"Number is above 100\"\n end\n else\n return \"Number is less than zero\"\n end\nend", "title": "" }, { "docid": "02c278659b61c0af09afbc16d97130d7", "score": "0.62611747", "text": "def if_statement(number)\n if number >= 0 && number < 51\n puts \"#{number} is between 0 and 50.\"\n elsif number >=51 && number < 101\n puts \"#{number} is between 51 and 100\"\n else\n puts \"#{number} is greater than 100\"\n end\nend", "title": "" }, { "docid": "e7b931fa170e6202a0f2c1da39cd0914", "score": "0.6247962", "text": "def isbetween(i)\n result = case\n when (i >= 0) && (i <= 50)\n result = \"between 0 and 50\"\n when (i >= 51) && (i <= 100)\n result = \"between 51 and 100\"\n when (i > 100)\n result = \"greater than 100\"\n else\n result = \"a negative number\"\n end\nend", "title": "" }, { "docid": "2eb336482fe0ad98e33df203bb55d6e6", "score": "0.62445647", "text": "def is_a_3_dot_range?(range)\n return true if range.last != range.max\n return false if range.last == range.max\nend", "title": "" }, { "docid": "b2343917638f7a7800a8a5db06c4577d", "score": "0.62429476", "text": "def evaluate_number2(number)\r\n case number\r\n when 0..50\r\n puts \"#{number} is between 0 and 50.\"\r\n when 51..100\r\n puts \"#{number} is between 51 and 100\"\r\n else\r\n puts \"Sorry, your number is out of range. Please try again.\"\r\n end\r\nend", "title": "" }, { "docid": "488b6a06971bbeccb4db0223780bf895", "score": "0.62387854", "text": "def number(num)\n case\n when num <= 50\n puts \"The number is between 0 and 50\"\n when (num > 50 && num <= 100)\n puts \"The number is between 51 and 100\"\n else\n puts \"The number is above 100\"\n end\nend", "title": "" }, { "docid": "1edd19f50daa548d925208af77cdca59", "score": "0.6238493", "text": "def is_a_3_dot_range?(range)\n range.last == range.max ? false : true\n\nend", "title": "" }, { "docid": "7c22433f5599a4c42901737cc02d61bc", "score": "0.62336236", "text": "def evaluate_number2(number)\n case\n when number < 0\n puts \"#{number} is less than 0\"\n when number <= 50\n puts \"#{number} is between 0 and 50\"\n when number <= 100\n puts \"#{number} is between 50 and 100\"\n else\n puts \"#{number} is bigger than 100\"\n end\nend", "title": "" }, { "docid": "58cb3e11ae2c19eb6079ee9af5982279", "score": "0.6231295", "text": "def small_number(a,b,c)\n if (1..10).include?(a) || (1..10).include?(b) || (1..10).include?(c)\n puts true\n else\n puts false\n end\nend", "title": "" }, { "docid": "3aef7b8cea1afc17772a8ed8e983b51c", "score": "0.6229584", "text": "def condition_check_v02(number)\n case\n when number <= 50 then \"#{number} is between 0 and 50.\"\n when number <= 100 then \"#{number} is between 51 and 100\"\n else \"#{number} is greater than 100\"\n end\nend", "title": "" }, { "docid": "5b03f41b20c5976b5425293b213b9b34", "score": "0.62294006", "text": "def input_valid?(input1, input2)\n if(1..3).include?(input1 && input2)\n @from = input1 -1\n @to = input2 -1\n else\n puts \"Please make sure you entered in format 'num1, num2' between ranges 1 & 3\"\n get_input\n end\n #run additional test to see if move is legal\n move_valid?\n end", "title": "" }, { "docid": "93f5f56d2836e4541e62b1981c5c88c0", "score": "0.6202832", "text": "def num_range(num)\n case num\n when 0..50 then puts \"Your number is between 0 and 50\"\n when 51..100 then puts \"your number is between 51 and 100\"\n else puts \"Your number was over 100\"\n end\nend", "title": "" }, { "docid": "0b65e66d425fb9e6c6a2f02cc35f91cc", "score": "0.6190498", "text": "def test_integer_between_integers\n assert_eval true, [\n [\"lit\", 2],\n [\"lit\", 1],\n [\"lit\", 5],\n [\"compare\", \"BETWEEN\"],\n ]\n\n assert_eval true, [\n [\"lit\", 1],\n [\"lit\", 1],\n [\"lit\", 5],\n [\"compare\", \"BETWEEN\"],\n ]\n\n assert_eval true, [\n [\"lit\", 5],\n [\"lit\", 1],\n [\"lit\", 5],\n [\"compare\", \"BETWEEN\"],\n ]\n end", "title": "" }, { "docid": "cd0a74279e261ba7e9c03fd1ecc5aaba", "score": "0.61892855", "text": "def in110(a, b)\n return (((a >= 1 && a <= 10) && !(b >= 1 && b <= 10)) ||\n\t\t(!(a >= 1 && a <= 10) && (b >= 1 && b <= 10)));\nend", "title": "" }, { "docid": "a7e6207a6452527180106445f1c09239", "score": "0.6180245", "text": "def numbers\n puts \"input first number\"\n a = gets.chomp.to_i\n puts \"input second number\"\n b = gets.chomp.to_i\n puts \"input third number\"\n c = gets.chomp.to_i\n if (1< a && a < 10) or (1< b && b < 10) or (1<c && c < 10)\n puts \"True\"\n else \n puts \"False\"\n end\nend", "title": "" }, { "docid": "c22c5433e1f49758f3d4c5d53e03627c", "score": "0.61795735", "text": "def range_completely_within_range?( s1, e1 = nil, s2 = nil, e2 = nil )\n\t\t\ts1, e1, s2, e2 = range_array_to_individual_variables( s1, e1, s2, e2 )\n\t\t\traise InvertedDateOrderError.new(\"start(1) is not less than or equal to end(1)\") unless range_pair_valid?(s1,e1)\n\t\t\traise InvertedDateOrderError.new(\"start(2) is not less than or equal to end(2)\") unless range_pair_valid?(s2,e2)\n\t\t\tif s1.nil? and e1.nil? and s2.nil? and e2.nil?\t\t# 0000\n\t\t\t\ttrue\n\t\t\telsif s1.nil? and e1.nil? and s2.nil? and e2\t\t\t# 0001\n\t\t\t\tfalse\n\t\t\telsif s1.nil? and e1.nil? and s2 and e2.nil?\t\t\t# 0010\n\t\t\t\tfalse\n\t\t\telsif s1.nil? and e1.nil? and s2 and e2\t\t\t\t\t\t# 0011\n\t\t\t\tfalse\n\t\t\telsif s1.nil? and e1 and s2.nil? and e2.nil?\t\t\t# 0100\n\t\t\t\ttrue\n\t\t\telsif s1.nil? and e1 and s2.nil? and e2\t\t\t\t\t\t# 0101\n\t\t\t\ts1 <= s2\n\t\t\telsif s1.nil? and e1 and s2 and e2.nil?\t\t\t\t\t\t# 0110\n\t\t\t\tfalse # (-inf,x),(y,inf)\n\t\t\telsif s1.nil? and e1 and s2 and e2\t\t\t\t\t\t\t\t# 0111\n\t\t\t\tfalse\n\t\t\telsif s1 and e1.nil? and s2.nil? and e2.nil?\t\t\t# 1000\n\t\t\t\ttrue\n\t\t\telsif s1 and e1.nil? and s2.nil? and e2\t\t\t\t\t\t# 1001\n\t\t\t\tfalse # (x,inf),(-inf,y), will never be completley within\n\t\t\telsif s1 and e1.nil? and s2 and e2.nil?\t\t\t\t\t\t# 1010\n\t\t\t\ts2 <= s1\n\t\t\telsif s1 and e1.nil? and s2 and e2\t\t\t\t\t\t\t\t# 1011\n\t\t\t\tfalse\n\t\t\telsif s1 and e1 and s2.nil? and e2.nil?\t\t\t\t\t\t# 1100\n\t\t\t\ttrue\n\t\t\telsif s1 and e1 and s2.nil? and e2\t\t\t\t\t\t\t\t# 1101\n\t\t\t\te1 <= e2\n\t\t\telsif s1 and e1 and s2 and e2.nil?\t\t\t\t\t\t\t\t# 1110\n\t\t\t\ts2 <= s1\n\t\t\telsif s1 and e1 and s2 and e2\t\t\t\t\t\t\t\t\t\t\t# 1111\n\t\t\t\ts2 <= s1 and e1 <= e2\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "710b58a066f487fe4ef5fec899a36db8", "score": "0.6168144", "text": "def if_with_number(number)\n puts \"If\"\n if number < 0\n puts \"Your cannot pick a negative number\"\n elsif number <= 50\n puts \"#{number} is between 0 and 50\"\n elsif number <= 100\n puts \"#{number} is between 50 and 100\"\n else\n puts \"#{number} is greater than 100\"\n end\nend", "title": "" }, { "docid": "30e9dd8d74198bae2d5d24b160c0d1af", "score": "0.61620533", "text": "def report_between(number)\n case number\n when 0..50\n then puts \"Your number is between 0 and 50!\"\n when 51..100\n then puts \"Your number is between 51 and 100!\"\n else \n if number > 100\n puts \"Your number is above 100!\"\n else\n puts \"Invalid input. Please enter a positive number!\"\n end\n end\nend", "title": "" }, { "docid": "fc7583dfd2313d12367ecb6a633a36df", "score": "0.61605424", "text": "def range(n)\n case\n when n < 0\n puts \"#{n} is less than zero\"\n when n >= 0 && n <= 50\n puts \"#{n} is between 0 and 50.\"\n when n > 51 && n <= 100\n puts \"#{n} is between 51 and 100.\"\n else \n puts \"#{n} is greater than 100.\"\n end\nend", "title": "" } ]
a37971a20a2d962c9bef5b154efb9a94
PATCH/PUT /packages/1 PATCH/PUT /packages/1.json
[ { "docid": "19c87e34dfaa10944b1a937e54ef0b3e", "score": "0.65434575", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "8d589d5fe6fd72de57fe3bf54256cd5e", "score": "0.6976328", "text": "def update\n if @package.update(package_params)\n render json: @package\n else\n render json: @package.errors\n end\n end", "title": "" }, { "docid": "96aabda11bbe96df70bcebcb8d35b784", "score": "0.6952109", "text": "def update\n @package = Package.find(params[:id])\n #TODO: check only correct packages are updated\n if @package.update(package_params)\n head :no_content\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dd050f27b9a157aa4a39060bbb513706", "score": "0.6945946", "text": "def update\n authorize @package\n if @package.update(package_params)\n render json: { status: :ok, package: @package }\n else\n render json: {error: @package.errors, status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "22ae82f31f051701d5efc6be56898880", "score": "0.68815494", "text": "def update\n @package = Package.find(params[:id])\n\n if @package.update(package_params)\n head :no_content\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "22ae82f31f051701d5efc6be56898880", "score": "0.68815494", "text": "def update\n @package = Package.find(params[:id])\n\n if @package.update(package_params)\n head :no_content\n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d5f9d07a401ccb2c2499812c6b4bb123", "score": "0.67346495", "text": "def update\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88ff838bd1b6c191856f021c5c86402a", "score": "0.66992", "text": "def update\n @package = Package.find(params[:id])\n\n if @package.update(package_params)\n #head :no_content\n render json: @package, status: :accepted, location: @package #sera? status accepted? \n else\n render json: @package.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "876ac92a6143a496dfff471287c3a8ab", "score": "0.66751474", "text": "def update\n @package = current_user.packages.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30e8d9586b0dbe7bec04f8032786156b", "score": "0.6641389", "text": "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "700f379ea2bcaffe6028f8f95e1e3463", "score": "0.6637369", "text": "def update\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to admins_packages_path, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ac764b5ef0025e718d5f2d777c41d0a", "score": "0.66369605", "text": "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ac764b5ef0025e718d5f2d777c41d0a", "score": "0.66369605", "text": "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b53efab67e683d3ca3a8ae2c8672d54", "score": "0.6625328", "text": "def update\n @package = Package.find(params[:id])\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to @package, notice: ' Package was successfully updated. ' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f21b2651821e35af215eced1fea6942f", "score": "0.6613128", "text": "def update_or_create(id, package)\n puts \" + PackageApiWrapper POST #{NLP_URL}/packages/#{id}\"\n RestClient::Request.execute(\n url: \"#{NLP_URL}/packages/#{id}?timeout=#{INIT_TIMEOUT}\",\n method: :post,\n read_timeout: (INIT_TIMEOUT.to_i + 100),\n payload: package[:data]\n )\n end", "title": "" }, { "docid": "1f0a83cafb4848c580cbaf53de2fddb8", "score": "0.6604078", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to client_package_path(:id => @package), notice: 'Paquete actualizado.' }\n # format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n # format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5efb7fbf108aeb1855f04a1ff6aa754d", "score": "0.65938073", "text": "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6588573", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "fa16209f5ac39ae638cdf45c17fd5f18", "score": "0.6588573", "text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end", "title": "" }, { "docid": "0ebc006558ac0ce6190158daa8c6d9f9", "score": "0.65718263", "text": "def update\n\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65d88be0a4db4daed6efe0e792476f13", "score": "0.6541721", "text": "def update\n # binding.pry\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c238919e1806baeb1a9be2cdbd16cef", "score": "0.6529841", "text": "def update\n respond_to do |format|\n if @generic_package.update(generic_package_params)\n format.html { redirect_to @generic_package, notice: 'Generic package was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_package }\n else\n format.html { render :edit }\n format.json { render json: @generic_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.63941586", "text": "def patch *args\n make_request :patch, *args\n end", "title": "" }, { "docid": "2f9aa7439a9b98b1baf15794ba5e0137", "score": "0.63735217", "text": "def package_update\n load_content_package(Package.update(params))\n end", "title": "" }, { "docid": "662855d115c719bcffecb04600068cda", "score": "0.633249", "text": "def update\n respond_to do |format|\n if @pkg.update(pkg_params)\n format.html { redirect_to @pkg, notice: 'Pkg was successfully updated.' }\n format.json { render :show, status: :ok, location: @pkg }\n else\n format.html { render :edit }\n format.json { render json: @pkg.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d1909d6f929fd487e4366db74776195d", "score": "0.6318651", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Proceso actualizado!' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db120662e8ea93311dfb905243437a6e", "score": "0.6303854", "text": "def update\n @test_package = TestPackage.find(params[:id])\n\n respond_to do |format|\n if @test_package.update_attributes(params[:test_package])\n format.html { redirect_to @test_package, notice: 'Test package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91a7b290a3100b85547c9b4b850cc079", "score": "0.626841", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to @package, notice: 'Proceso actualizado correctamente' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d4753c7c3fdb67e5bd6a7dad285a789", "score": "0.6224025", "text": "def update\n @current_package = CurrentPackage.find(params[:id])\n\n respond_to do |format|\n if @current_package.update_attributes(params[:current_package])\n format.html { redirect_to @current_package, notice: 'Current package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @current_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42e2b495c27aa00f5c6282914a683f7d", "score": "0.62017155", "text": "def update\n flash[:notice] = 'Package Updated' if @package.update_attributes! params[:package]\n respond_with @owner, @package\n end", "title": "" }, { "docid": "fc06f4cac0fd5f9bf464c86f2b8b0326", "score": "0.6194415", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.html { redirect_to package_description_path(PackageDescription.where(@package.package_description_id).last), notice: 'Package was successfully updated.' }\n format.json { render :show, status: :ok, location: @package }\n else\n format.html { render :edit }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b3d6af3e1ade5f41124866b57a6b326", "score": "0.6173306", "text": "def patch(path, **args); end", "title": "" }, { "docid": "fc6cb23d4e4a3398a7d461b9d455aea2", "score": "0.6154046", "text": "def update\n authorize! :update, @db_package\n respond_to do |format|\n if @db_package.update(db_package_params)\n format.html { redirect_to @db_package, notice: 'Database package was successfully updated.' }\n format.json { render :show, status: :ok, location: @db_package }\n else\n format.html { render :edit }\n format.json { render json: @db_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.6148805", "text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end", "title": "" }, { "docid": "555731db713029dca20b2caecf9d34a7", "score": "0.611744", "text": "def set_api_v1_package\n @api_v1_package = Api::V1::Package.packages_info({id:params[:id]})\n end", "title": "" }, { "docid": "54f0e75aac679c28034ee02dd6034e8a", "score": "0.61112523", "text": "def update\n @pkg = Pkg.find_by_name(params[:id])\n\n respond_to do |format|\n if @pkg.update_attributes(params[:pkg])\n flash[:notice] = 'Pkg was successfully updated.'\n format.html { redirect_to(@pkg) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pkg.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cfb363630580532e28e0141362a3d10", "score": "0.6111004", "text": "def update\n authorize! :update, @package_version\n respond_to do |format|\n if @package_version.update(package_version_params)\n format.html { redirect_to @package_version, notice: 'package_version was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_version }\n else\n format.html { render :edit }\n format.json { render json: @package_version.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "801072b2202b94d2eff22a6b878c6c86", "score": "0.61033505", "text": "def update\n respond_to do |format|\n if @package.update(package_params)\n format.js\n else\n format.js { render :new }\n end\n end\n end", "title": "" }, { "docid": "7417b8943da1ef48ecb577e60c892bee", "score": "0.6098301", "text": "def update\n @package = Package.find(params[:id])\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to page_path(\"admin\"), :notice => 'Package was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.60981023", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "6e0750cd2f8a83a8e1d45888445f8246", "score": "0.6056845", "text": "def update\n @pack = Pack.find(params[:id])\n\n respond_to do |format|\n if @pack.update_attributes(params[:pack])\n format.html { redirect_to packs_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a432032b30a20dfca0cda8fe8a9ecc4", "score": "0.60540766", "text": "def edit(options = {})\n server.perform_request('editpkg', options.merge(:\"api.version\" => 1))\n end", "title": "" }, { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.6037751", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "accfeabe37d8f96aeb59ea8db9ac38aa", "score": "0.5997283", "text": "def update\n respond_to do |format|\n if @packagedetail.update(packagedetail_params)\n format.html { redirect_to @packagedetail, notice: 'Packagedetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @packagedetail }\n else\n format.html { render :edit }\n format.json { render json: @packagedetail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "174aab64fc850a03baad460081512758", "score": "0.59901035", "text": "def update\n @pagetitle = \"Edit user package\"\n \n @users_package = UsersPackage.find(params[:id])\n @packages = Package.find(:all)\n\n respond_to do |format|\n if @users_package.update_attributes(params[:users_package])\n format.html { redirect_to(@users_package, :notice => 'Users package was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @users_package.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91cd2b327c27b322dc5339c4a5a468fe", "score": "0.59838605", "text": "def update\n @photo_package = PhotoPackage.find(params[:id])\n\n respond_to do |format|\n if @photo_package.update_attributes(params[:photo_package])\n format.html { redirect_to @photo_package, notice: 'Photo package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.5982086", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.5982086", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "e82ace4d908730cf6c485f98a1932a24", "score": "0.59246516", "text": "def update\n @package_item = PackageItem.find(params[:id])\n\n respond_to do |format|\n if @package_item.update_attributes(params[:package_item])\n format.html { redirect_to @package_item, notice: 'Package item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @package_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7dbdef17f027681f07548695b4dc1c9", "score": "0.591375", "text": "def update\n respond_to do |format|\n if @travel_package.update(travel_package_params)\n format.html { redirect_to @travel_package, notice: 'Travel package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @travel_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "423d49c72b1b9ce835d040e079665783", "score": "0.59130085", "text": "def change_package(options = {})\n options[:user] = options.delete(:username)\n server.perform_request('changepackage', options.merge(:\"api.version\" => 1))\n end", "title": "" }, { "docid": "3a676bafb18dc18009ad14a2638a2112", "score": "0.59031147", "text": "def update\n @pack = Pack.find(params[:id])\n \n respond_to do |format|\n if @pack.update_attributes(params[:pack])\n format.html { redirect_to @pack, notice: 'Pack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "54f5c7ab5b90c6dc65c088dc8073ec8c", "score": "0.59030205", "text": "def update\n respond_to do |format|\n if @package_file.update(package_file_params)\n format.html { redirect_to [@package_file.version.product, @package_file.version, @package_file], notice: 'Package file was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_file }\n else\n format.html { render :edit }\n format.json { render json: @package_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b8d4d2c1fc0d5f024d1f588a6dab44ea", "score": "0.5874109", "text": "def update\n respond_to do |format|\n if @generic_package_ingredient.update(generic_package_ingredient_params)\n format.html { redirect_to @generic_package_ingredient, notice: 'Generic package ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_package_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @generic_package_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c580e369fad05a016ec1467689024c2", "score": "0.58675545", "text": "def update\n respond_to do |format|\n if @file_to_update_file_package.update(file_to_update_file_package_params)\n format.html { redirect_to @file_to_update_file_package, notice: 'File to update file package was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_to_update_file_package }\n else\n format.html { render :edit }\n format.json { render json: @file_to_update_file_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "91ef0e3a2107dfeccf72cb0b93377492", "score": "0.58672404", "text": "def update\n respond_to do |format|\n if @featuredpackage.update(featuredpackage_params)\n format.html { redirect_to @featuredpackage, notice: 'Featuredpackage was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuredpackage }\n else\n format.html { render :edit }\n format.json { render json: @featuredpackage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c1a09a9d20ee815b5c9f998eda70b44", "score": "0.5862128", "text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end", "title": "" }, { "docid": "93977b1ac1012b4e3aa21b170b060200", "score": "0.5860577", "text": "def update_packages\n Pack.packages.each_value do |package|\n package.update if package.stale?\n end\n end", "title": "" }, { "docid": "3551a93e8829fecafd58bf691a860eeb", "score": "0.5856429", "text": "def update_object(path, id, info)\n json_parse_reply(*json_put(@target, \"#{path}/#{URI.encode(id)}\", info,\n @auth_header, if_match: info[:meta][:version]))\n end", "title": "" }, { "docid": "686c4018bc74e99e8458d2dbe68e7920", "score": "0.58487046", "text": "def patch(path, options={}, authenticate=true, raw=false, version=api_version, force_urlencoded=false)\n request(:patch, path, options, authenticate, raw, version, force_urlencoded)\n end", "title": "" }, { "docid": "2c5497f059ab1d7457ffc834ecb8f6a2", "score": "0.58456177", "text": "def patch(path, params = {})\n request(:patch, path, params)\n end", "title": "" }, { "docid": "5317eb13c55def374f115875de54c4a0", "score": "0.5819986", "text": "def update\n respond_to do |format|\n if @package_type.update(package_type_params)\n format.html { redirect_to @package_type, notice: 'package type was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_type }\n else\n format.html { render :edit }\n format.json { render json: @package_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbb28b78ebd14a35895337cf6eecee2a", "score": "0.58157295", "text": "def patch(path, data = nil)\n request(:patch, path, data)\n end", "title": "" }, { "docid": "6b5dab8a348badce65944b61ba5ea3fa", "score": "0.5799928", "text": "def patch(path, **args)\n process(:patch, path, **args)\n end", "title": "" }, { "docid": "d81cdf1cf6b83aabaca0d8a4d83ae72b", "score": "0.57985866", "text": "def update\n respond_to do |format|\n if @pack.update(pack_params)\n format.html { redirect_to @pack, notice: 'Pack was successfully updated.' }\n format.json { respond_with_bip(@pack) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@pack) }\n end\n end\n end", "title": "" }, { "docid": "063661d4d5189c38701e586089bacae8", "score": "0.57905537", "text": "def update\n authorize! :manage, HoursPackage\n respond_to do |format|\n if @hours_package.update(hours_package_attrs)\n format.html { redirect_to @hours_package, notice: t('action.update.succeed', entity: HoursPackage.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hours_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff5b557acb5b43e5f35cd12653dc85b1", "score": "0.57777464", "text": "def patch(path, data = {}, headers = {})\n exec_request(:patch, path, data, headers)\n end", "title": "" }, { "docid": "5fd5f00640bdb0c785bcac4689a46f3c", "score": "0.5772577", "text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end", "title": "" }, { "docid": "222dc66c93644ecca747371f9a73eeea", "score": "0.57717186", "text": "def update\n @item = @package.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @package, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dcd52aa6addd80f2e19226e92892be82", "score": "0.5746934", "text": "def update\n respond_to do |format|\n if @drop_off_package.update(drop_off_package_params)\n format.html { redirect_to @drop_off_package, notice: 'Drop off package was successfully updated.' }\n format.json { render :show, status: :ok, location: @drop_off_package }\n else\n format.html { render :edit }\n format.json { render json: @drop_off_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff4416de4c4cf69ed9cc5c2949725ae3", "score": "0.5744644", "text": "def update\n pkgget_with_cat \"-f\", :upgrade, @resource[:name]\n end", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.5734383", "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": "a9a7bf63fffdaf43ed4c76593ebe2674", "score": "0.5727674", "text": "def patch(url, data, options={})\n default_client.patch(url, data, options)\n end", "title": "" }, { "docid": "096646622571404ad1b70d5491d75562", "score": "0.57198286", "text": "def update\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @packages_check = @operations_check.packages_checks.find(params[:id])\n\n respond_to do |format|\n if @packages_check.update_attributes(packages_check_params)\n format.html { redirect_to @packages_check, notice: 'Packages check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @packages_check.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03b14059c43d89ea05d1fc496754ac14", "score": "0.57154", "text": "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user)\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "title": "" }, { "docid": "3559623d8c30ea2525c11e9f44ca8392", "score": "0.57075137", "text": "def update\n @package = Package.find(params[:id])\n \n #@package.set(:products => params[:product_ids])\n \n #@package.products.update({'_id' => @package.id}, {'$push' => params[:package][:product_ids]})\n respond_to do |format|\n if @package.update_attributes(params[:package]) \n format.html { redirect_to(edit_admin_package_path(@package), :notice => \"Package was successfully updated: #{@package.products.size}\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a19a1bba286263fdd223dd35e50ce58e", "score": "0.56984097", "text": "def update\n @package = Package.find(params[:id]) \n if @package.update_attributes(params[:package]) \n redirect_to :action => \"index\"\n else\n redirect_to :action => \"edit\"\n end\nend", "title": "" }, { "docid": "e81f70bb75f96a961bc6b50519fd748e", "score": "0.56929606", "text": "def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "d61c0aeb123e4c5cfcb2ba019dd903a0", "score": "0.5687894", "text": "def patch(options = {})\n request :patch, options\n end", "title": "" }, { "docid": "3d52b747fac7e18a9822a46a4e539e86", "score": "0.5682056", "text": "def update\n @allowed_package = AllowedPackage.find(params[:id])\n\n respond_to do |format|\n if @allowed_package.update_attributes(params[:allowed_package])\n format.html { redirect_to @allowed_package, notice: 'Allowed package was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @allowed_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05c1bed948daa058e70016e863c7cd96", "score": "0.56817377", "text": "def update_request(data)\n client.create_request('PATCH', url_path, 'data' => data)\n end", "title": "" }, { "docid": "a6f158e9b74327f9dc862b75ec0baba4", "score": "0.56788296", "text": "def update(packages)\n OCPM.command(\"createrepo #{@path}\")\n true \n end", "title": "" }, { "docid": "7c9fbc804b65ab0771b3759a7a5def5d", "score": "0.5670365", "text": "def update\n respond_to do |format|\n if @workflow_package.user == current_user && @workflow_package.update(workflow_package_params)\n format.html { redirect_to @workflow_package, notice: 'Workflow package was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow_package }\n else\n format.html { render :edit }\n format.json { render json: @workflow_package.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fdb6fd1ad90795d4091f430832940fd5", "score": "0.56694967", "text": "def patch(path, data = nil, headers = nil)\n req = Net::HTTP::Patch.new(path, (headers || {}).merge(@request_headers))\n req.basic_auth(@api_key, 'x')\n req.body = data.to_json unless data.nil?\n res = @http.start { |session| session.request(req) }\n\n handle_response(res)\n end", "title": "" }, { "docid": "42f2f726e2e5e0aa0200f766c48c0b4e", "score": "0.56689566", "text": "def update!(**args)\n @package_name = args[:package_name] if args.key?(:package_name)\n @sha1_fingerprint = args[:sha1_fingerprint] if args.key?(:sha1_fingerprint)\n end", "title": "" }, { "docid": "431858658800c05f6aefddecaf05cc00", "score": "0.5659871", "text": "def dock_upsert_patch_docks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DockApi.dock_upsert_patch_docks ...\"\n end\n # resource path\n local_var_path = \"/Docks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'data'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Dock')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DockApi#dock_upsert_patch_docks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b094d2d9e05d560edfc9226aa941ad22", "score": "0.5657352", "text": "def patch(path, options={})\n send_request(:patch, path, options)\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.56475556", "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": "2993ee4af1337fea08403ad969751b2c", "score": "0.5641422", "text": "def patch(*args)\n\t\tconn.patch(*args)\n\tend", "title": "" }, { "docid": "0e516b45f5e79650cac13cde535ed255", "score": "0.5639193", "text": "def update\n params[:package][:destination_ids] ||= []\n\n respond_to do |format|\n if @package.update_attributes(params[:package])\n format.html { redirect_to(package_path(@package), :notice => t('general.label.item_update', :item => t('activerecord.models.package'))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @package.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab7b511e7fdb14f278ada05c46659bfc", "score": "0.5637752", "text": "def _update_item(http, headers, path, body, name)\n resp = retry_request(http, \"PATCH\", path, body, headers)\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": "1372856b45a7a924dc31b72a27db0324", "score": "0.56343186", "text": "def patch(path, params: {}, body: {})\n request(:patch, path, params: params, body: body)\n end", "title": "" } ]
cc8acf45a436133e896a1155a745c29e
PATCH/PUT /ratings/1 PATCH/PUT /ratings/1.json
[ { "docid": "115f6c3d69bffc7f752bcf298613b428", "score": "0.71170735", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @rating }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "7db339d82d6b2d81316123b99c839c44", "score": "0.76427203", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.json { render json: @rating, status: :ok, location: nil }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "956a89869512741cc65c44b2d7467beb", "score": "0.7542794", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.json { head :no_content }\n else\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3e747b41cb3f6495492859c9a86a4477", "score": "0.7539779", "text": "def update\n @rating = Rating.find(params[:id])\n\n if @rating.update(rating_params(params[:rating]))\n head :no_content\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8dbddbc3ad8c66a593b1785df81f6284", "score": "0.7467543", "text": "def update\n \n if @rating.update(rating_params)\n render JSON: @rating\n else\n render JSON: @rating.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f942a4f0a9d515a2af3458fd949eaba5", "score": "0.7434858", "text": "def update\n @rating = Rating.find(params[:id])\n\n if @rating.update(rating_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Rating update failed.\"]}\n end\n end", "title": "" }, { "docid": "6555c684ae4d0d570e28f82d906267d9", "score": "0.7353855", "text": "def update\n @rating = Rating.find(params[:id])\n \n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ff463c622aecf0033706e227d9d7a38", "score": "0.73533034", "text": "def update\n \t@rating = @recipe.ratings.find(params[:id])\n\n \trespond_to do | format |\n \t\tif @rating.update_attributes(params[:rating])\n \t\t\tformat.html { redirect_to recipe_ratings_url(@recipe), notice: 'Rating was successfully updated.'}\n \t\t\tformat.json { head :ok }\n \t\telse\n \t\t\tformat.html { render action: \"edit\" }\n \t\t\tformat.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a582fff6a8a09a8e5a8d7ed38d4d8cb", "score": "0.7345765", "text": "def rate\n recipe = Recipe.find(params[:id])\n recipe.rating = params['rating']\n recipe.save\n \n respond_to do |format|\n format.html { render :json => recipe.rating }\n format.json { render :json => recipe.rating }\n end\n end", "title": "" }, { "docid": "73db70d8ea994999211723f82677c634", "score": "0.7330786", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "171df2e0d5a5547fc7669a39baa29a6b", "score": "0.7319507", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "171df2e0d5a5547fc7669a39baa29a6b", "score": "0.7319507", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "52c58390fbc25245aec8d0e9ffc598e4", "score": "0.73099685", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e3a19d13d3c0e16eeef5842187bd780f", "score": "0.72506416", "text": "def update\n if @rating.update({rating: rating_params[\"rating\"]})\n response = @rating.response(@rated_item.reload, \"update\", @item_type)\n render json: response, status: 200\n else\n render json: @rating.errors.full_messages, status: 406\n end\n end", "title": "" }, { "docid": "5de659bf0ed4bc3a2e525de0ab25a77f", "score": "0.72172666", "text": "def update\n user_id = decoded_token[0]['user_id'].to_i\n restaurant_id = Restaurant.find_by(yelp_id: rating_params[:yelp_id]).id\n rating = Rating.find_by(restaurant_id: restaurant_id, user_id: user_id)\n rating.value = rating_params[:value]\n if rating.save\n render json: RatingSerializer.new(rating)\n else\n render json: { error: 'Could not update rating' }\n end\n end", "title": "" }, { "docid": "a44877c377af7839fd17f10d3d0be9c7", "score": "0.71925765", "text": "def update\n @rating = current_user.ratings.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to(user_ratings_path(current_user), :notice => 'Rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c8f3cd6e095eec1384b44df96e2e4cf", "score": "0.7186433", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c8f3cd6e095eec1384b44df96e2e4cf", "score": "0.7186433", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba2ed9489ca76951805d198d89e6c566", "score": "0.71405977", "text": "def update\n recipe= Recipe.find(params[:id])\n respond_with recipe.update(rate:params[:rate])\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd2ed7c41a3b8662ef55342b93705bfa", "score": "0.7137787", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0e66745a83acc6ae9397360c8980fcf", "score": "0.7129662", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d97028d9f7cdb7a4a6525a8b98e39540", "score": "0.7123285", "text": "def update\n respond_to do |format|\n if @request_rating.update(request_rating_params)\n format.html { redirect_to @request_rating, notice: 'Request rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_rating }\n else\n format.html { render :edit }\n format.json { render json: @request_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a831a41ce8fd678024adbfcfee9ced65", "score": "0.71070415", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "69715b4c25018b567b2c0b6725326997", "score": "0.7090764", "text": "def update\n if @rating.update(rating_params)\n render :show, status: :ok, location: @rating\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "240884d384e1c3b87db12a52e6fc88c3", "score": "0.70872754", "text": "def update\n @rating.update(rating_params)\n @ratings = Rating.all\n @rating = Rating.new\n end", "title": "" }, { "docid": "4da357983d15bd2ec4a9468a549b6e8f", "score": "0.7079346", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4b0561f796be24149528df62db882e6", "score": "0.7057079", "text": "def update\n if @rating.update(rating_params)\n render head: :ok, json: @rating\n else\n logger.warn \"Trying to update @rating {#{@rating.inspect}} resulted in errors: #{@rating.errors.full_messages}\"\n errors = errors_to_hash(@rating)\n render json: errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "cef059fee4ca97309de3c1afcca6c7b2", "score": "0.7038015", "text": "def update\r\n respond_to do |format|\r\n if @rating.update(rating_params)\r\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @rating }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @rating.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "2c3ae52f9e19a021de18bde9db47168d", "score": "0.7037258", "text": "def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html { redirect_to @rating, notice: 'RatingReview was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating }\n else\n format.html { render :edit }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a54bb9fa9f79df371c64c35cf419c8b5", "score": "0.70014215", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to(@rating, :notice => 'Rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a54bb9fa9f79df371c64c35cf419c8b5", "score": "0.70014215", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to(@rating, :notice => 'Rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2307c65505664a2a8211b02fc204fe0e", "score": "0.698913", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(ratings_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6fb26d69a7ec17e9657cb3244e0cc42", "score": "0.697615", "text": "def update\n authorize! :update, :rating\n @rating = Rating.find(params[:id])\n\n if @rating.update_attributes(params[:rating])\n redirect_to @rating, notice: 'Bewertung wurde erfolgreich aktualisiert.'\n else\n render action: \"edit\"\n end\n end", "title": "" }, { "docid": "9377cc204e2762fa51b7dd33376658ce", "score": "0.6944021", "text": "def update\n @song = Song.find params[:song_id]\n @rating = Rating.find params[:id]\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @song, notice: 'Ratings were successfully updated.' }\n format.json { render json: @rating }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "02487ad6535bb349b5a331ac91cac398", "score": "0.69195694", "text": "def update\n \n if @ratingentertainment.update(rating_params)\n render JSON: @ratingentertainment\n else\n render JSON: @ratingentertainment.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "05083019fd003cdecd662f1ba872d447", "score": "0.6903426", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06bb4df031becc4cbb3e645d1c3cd737", "score": "0.68967694", "text": "def update\n @rating = @advisor.ratings.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to [@advisor, @rating], notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "602be2fe4298932f6083f086cf765d4b", "score": "0.686377", "text": "def update\n @rating = Rating.where(:user_id=>current_user.id).where(:id=>params[:id]).first #todo-protect from id?\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n\t\t\n format.html { redirect_to(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5211ff90969664d32297348d07dd40b", "score": "0.6861569", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to rating_url(@rating) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "2197b10270479e2b2dde26f6c011f636", "score": "0.68403167", "text": "def update\n respond_to do |format|\n if @star_rating.update(star_rating_params)\n format.html { redirect_to @star_rating, notice: 'Star rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @star_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c8644606daa992482570dc572444058", "score": "0.683221", "text": "def update\n \n if @ratingsuite.update(rating_params)\n render JSON: @ratingsuite\n else\n render JSON: @ratingsuite.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3d62ace8340d86a297ac406a31f7362b", "score": "0.681761", "text": "def rate(args = {})\n make_request(\n http_method: :put,\n endpoint: path_for(:rating, ride_id: args.delete(:ride_id)),\n access_token: args.delete(:access_token),\n options: { body: args.to_json }\n )\n end", "title": "" }, { "docid": "9513064db5d224e66ecfab1a8b453fbb", "score": "0.6816052", "text": "def update\n @review = Review.find(params[:id])\n @review.title = params[:title]\n @review.note = params[:note]\n @review.rating = params[:rating]\n respond_to do |format|\n if @review.save\n format.json { head :no_content }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d3236ce526deba72a62f59ca856f876c", "score": "0.67938673", "text": "def update\n respond_to do |format|\n if @owner_rating.update(owner_rating_params)\n format.html { redirect_to @owner_rating, notice: 'Owner rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner_rating }\n else\n format.html { render :edit }\n format.json { render json: @owner_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e732fd1f1ef907b498a73c55df7f9aae", "score": "0.6782492", "text": "def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n flash[:notice] = 'Rating was successfully updated.'\n format.html { redirect_to(@rating) }\n #format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n #format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39a0430f0dc07398d8154613dbda9786", "score": "0.67658556", "text": "def update\n @users_artist_rating = UsersArtistRating.find(params[:id])\n\n respond_to do |format|\n if @users_artist_rating.update_attributes(params[:users_artist_rating])\n format.html { redirect_to @users_artist_rating, notice: 'Users artist rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_artist_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fba31669b9242042a6d58a115e4e01de", "score": "0.672763", "text": "def update\n if current_user\n review = Review.find(params[:id])\n review.rating = params[:rating]\n review.post = params[:post]\n review.save\n avg_rating = Tool.find(review[:tool_id]).avg_rating\n\n render json: {result: review, avg_rating: avg_rating }\n else\n render json: {result: false}\n end\n end", "title": "" }, { "docid": "0b1068072d63450ec9b669472cd1d69b", "score": "0.6711806", "text": "def update\n @rating = @course.ratings.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to([@course,@rating], :notice => 'Rating was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9121ad76d90a78f5172393bbb943f6c4", "score": "0.67000943", "text": "def update\n @rating_value = RatingValue.find(params[:id])\n\n respond_to do |format|\n if @rating_value.update_attributes(params[:rating_value])\n format.html { redirect_to @rating_value, notice: 'Rating value was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating_value.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ae6e992538490747ebed6d0653e6ff5", "score": "0.6692928", "text": "def update\n\t\t@title_rating = TitleRating.find(params[:id])\n\t\t(Title::attributes + Title::genres).each do |name|\n\t\t\tparams['title_rating'][name] = nil if params['title_rating'][name] == '0'\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif @title_rating.update_attributes(params[:title_rating])\n\t\t\t\tflash_notice 'The Title Rating was successfully updated.'\n\t\t\t\tformat.html { redirect_to(@title_rating) }\n\t\t\t\t#format.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\t#format.xml\t{ render :xml => @title_rating.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "2159e33845a7553dd571d3689204527f", "score": "0.66827524", "text": "def update\n @rating = current_recipe.ratings.find(params[:id])\n @obj = @rating\n if(@rating.update_attributes(rating_params) )\n respond_to do |f|\n f.html{redirect_back_or current_recipe}\n f.js {@rating}\n end\n else\n #flash.now.alert = \"Form Error\"\n respond_to do |f|\n f.html{render 'shared/form'}\n f.js {@rating}\n end\n end\n end", "title": "" }, { "docid": "ac67968d87f0d4a092aa2465d805cf1a", "score": "0.6679255", "text": "def update\n respond_to do |format|\n if @make_rating.update(make_rating_params)\n format.html { redirect_to @make_rating, notice: 'Make rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @make_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "455cbeca2c9c63464a2e59c7d084acd4", "score": "0.66532636", "text": "def update\n @review.update!(review_params)\n\n render json: @review\n end", "title": "" }, { "docid": "4806851221678163d44d95394231929b", "score": "0.6640997", "text": "def update\n review = Review.find_by(id: params[:id])\n review.update(review_params)\n if review\n review.save\n render json: review\n else\n render json: {error: \"Review not updated.\"}, status: 451\n end\n end", "title": "" }, { "docid": "5839d45329548c70d61697a89314bc45", "score": "0.6617993", "text": "def update\n @toilet_rating = ToiletRating.find(params[:id])\n\n respond_to do |format|\n if @toilet_rating.update_attributes(params[:toilet_rating])\n format.html { redirect_to @toilet_rating, :notice => 'Toilet rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toilet_rating.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8af3fdae478dfcd1d793e795142b11a2", "score": "0.65990865", "text": "def update\n rating = @post.postratings.find_by(user_id: current_user.id)\n respond_to do |format|\n if rating.update(star: params[:star])\n message = \"You updated #{params[:star]} stars to #{@post.title}.\"\n format.html { redirect_back(fallback_location: post_path(@post), notice: message) }\n format.json { render :show, status: :ok, location: post_path(post) }\n else\n format.html { render :edit }\n format.json { render json: @post.postrating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9eff6f52496ace4d9d3bd34601f2e91", "score": "0.65929", "text": "def update\n respond_to do |format|\n if @player_rating.update(player_rating_params)\n format.html { redirect_to @player_rating, notice: 'Player rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @player_rating }\n else\n format.html { render :edit }\n format.json { render json: @player_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "600df8c48c219086bd7401b45760d1c5", "score": "0.6591799", "text": "def update\n respond_to do |format|\n if @article_rating.update(article_rating_params)\n format.html { redirect_to @article_rating, notice: 'Article rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d447b07148c26bbf63690da23a60c4c", "score": "0.6590293", "text": "def update\n respond_to do |format|\n if @movie_rating.update(movie_rating_params)\n format.html { redirect_to @movie_rating, notice: 'Movie rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_rating }\n else\n format.html { render :edit }\n format.json { render json: @movie_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61acfe77fe9b54fd9dec635c89eebfe4", "score": "0.6589655", "text": "def update!(**args)\n @rating = args[:rating] if args.key?(:rating)\n @rating_system = args[:rating_system] if args.key?(:rating_system)\n end", "title": "" }, { "docid": "f69b6c91051b6f70030fb40b112a2e1c", "score": "0.65885425", "text": "def update_rating_on_movie\n movie.update_rating(user_rating)\n end", "title": "" }, { "docid": "c66f56e0eb9b64709a31a7f97af4abe8", "score": "0.65735835", "text": "def update\n respond_to do |format|\n params['client']['rating'] = params[:score]\n if @client.update(client_params)\n format.html { redirect_to clients_url, 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": "e6c1fe2cf43fc21886aca507c7cbb60a", "score": "0.65534407", "text": "def update\n @review = Review.find(params[:id])\n @reviewable = @review.reviewable\n # update the review average for the firm and the partner\n recalculate_averages\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a42092bb2ae283fd8297f79ed014ff7f", "score": "0.65384895", "text": "def update_recipe\n @ratings = current_recipe.ratings.all\n current_recipe.update_attribute(:rating, \n @ratings.sum(:vote)/@ratings.count)\n end", "title": "" }, { "docid": "2e17b313922b29403e9b7a44086ecb7b", "score": "0.6532417", "text": "def update\n respond_to do |format|\n @hodnoceni = @customer.rating.rating\n if @customer.update(customer_params)\n if params[\"star1\"].present?\n \n @customer.rating.update(:rating=>1) if @hodnoceni != 1\n end\n if params[\"star2\"].present?\n @customer.rating.update(:rating=>2) if @hodnoceni != 2\n end\n if params['star3'].present?\n @customer.rating.update(:rating=>3) if @hodnoceni != 3\n end\n if params[\"star4\"].present?\n @customer.rating.update(:rating=>4) if @hodnoceni != 4\n end\n if params[\"star5\"].present?\n @customer.rating.update(:rating=>5) if @hodnoceni != 5\n end\n \n format.html { redirect_to customers_url, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08345c76947bbf8cac3b7d766bbe4c55", "score": "0.6531653", "text": "def update\n respond_to do |format|\n if @movie_rating.update(movie_rating_params)\n format.html { redirect_to \"/users/#{@movie_rating.profile_id}\", notice: 'Movie rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_rating }\n else\n format.html { render :edit }\n format.json { render json: @movie_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3503ec6a327009d5883497d1abdfdcf", "score": "0.65257597", "text": "def update\n respond_to do |format|\n if @asset_rating.update(asset_rating_params)\n format.html { redirect_to @asset_rating, notice: 'Asset rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_rating }\n else\n format.html { render :edit }\n format.json { render json: @asset_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a929b82b135100c8640ca1f729d5e4be", "score": "0.65157586", "text": "def update_actual_rating\n self.actual_rating = self.get_actual_rating\n self.save\n end", "title": "" }, { "docid": "541a53458fbc87cd49e7e74944826a35", "score": "0.65155035", "text": "def update\n respond_to do |format|\n if @songrating.update(songrating_params)\n format.html { redirect_to @songrating, notice: 'Songrating was successfully updated.' }\n format.json { render :show, status: :ok, location: @songrating }\n else\n format.html { render :edit }\n format.json { render json: @songrating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4baa522eb8e3d8e68741b46717032bc", "score": "0.6514617", "text": "def edit\n if @rating.update(rating: params[:rating].to_i)\n puts \"Actualizado\" \n else\n puts \"Error\"\n end\n redirect_to root_path\n end", "title": "" }, { "docid": "f7a432073dc7e8f13fdd14245bb330dc", "score": "0.65045565", "text": "def update\n respond_to do |format|\n if @rating_type.update(rating_type_params)\n format.html { redirect_to @rating_type, notice: 'Rating type was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_type }\n else\n format.html { render :edit }\n format.json { render json: @rating_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df583fc1522f4350fdc8d640998fbaa1", "score": "0.64955604", "text": "def update\n @rating.update(rating_params) ? (redirect_to \"/users/#{@user.id}\") : (render :edit)\n end", "title": "" }, { "docid": "b93a1826c1e36ec59e7ef2763e81925c", "score": "0.64903784", "text": "def update\n respond_to do |format|\n if @restaurant_rating.update(restaurant_rating_params)\n format.html { redirect_to @restaurant_rating, notice: 'Restaurant rating was successfully updated.' }\n format.json { render json: {status: :success}, status: :ok}\n else\n format.html { render :edit }\n format.json { render json: { errors: @restaurant_rating.errors }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15cabab8d07cf35e245591caf8a671f2", "score": "0.64871746", "text": "def update\n respond_to do |format|\n if @show_rating.update(show_rating_params)\n format.html { redirect_to @show_rating, notice: 'Show rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @show_rating }\n else\n format.html { render :edit }\n format.json { render json: @show_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "43a3ac0b0ecf4c7cb7cb785a4711db4a", "score": "0.6475917", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "a9b78823f76da7f6edc33bb49dc5722f", "score": "0.64690036", "text": "def update\n respond_to do |format|\n if @asana_rating.update(asana_rating_params)\n format.html { redirect_to @asana_rating, notice: 'Asana rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @asana_rating }\n else\n format.html { render :edit }\n format.json { render json: @asana_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67bb341ad4c00f75fa2a1ed2b15d7c03", "score": "0.64607525", "text": "def set_rating\r\n @rating = Rating.find(params[:id])\r\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" }, { "docid": "23570fc4cf16c5b65033932668e7c051", "score": "0.6456727", "text": "def set_rating\n @rating = Rating.find(params[:id])\n end", "title": "" } ]
f228088cf6263a8e9c889f5fd2cae755
A custom shell banner builder must extend from this
[ { "docid": "67748c465ca8e4459df2609a08bd3f91", "score": "0.8537502", "text": "def shell_banner\n Command::ShellBannerBuilder\n end", "title": "" } ]
[ { "docid": "c1aa358383f6ce284913e686ca545184", "score": "0.7448479", "text": "def banner\n raise \"Command.banner should be overriden by subclasses\"\n end", "title": "" }, { "docid": "1aa76603e75c96c98febe0bb4a9de724", "score": "0.6963906", "text": "def banner(command, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end", "title": "" }, { "docid": "4b5d381e5f6304089a1f4bf115e0ff9f", "score": "0.6905084", "text": "def command_banner\n ''\n end", "title": "" }, { "docid": "5db481ee3d40de49589215e3f5e43aed", "score": "0.67911166", "text": "def banner!\n invoked_command_class.banner!\n end", "title": "" }, { "docid": "117047cfe7f02f6848572e283529f2a3", "score": "0.6733242", "text": "def banner\n lines = []\n \n name_line = \"#{ name } role\"\n lines << name_line\n lines << \"=\" * name_line.length\n lines << ''\n if meta['description']\n lines << meta['description']\n lines << ''\n end\n lines << 'usage:'\n # lines << \" qb #{ name } [OPTIONS] DIRECTORY\"\n lines << \" #{ usage }\"\n lines << ''\n lines << 'options:'\n \n lines.join(\"\\n\")\n end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.6689153", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.6689153", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.6689153", "text": "def banner; end", "title": "" }, { "docid": "2db21eaf2516a2cb4391d43ecd95de4c", "score": "0.6689153", "text": "def banner; end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66857797", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66857797", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "098221d3f5530685f19975917d9b956b", "score": "0.66857797", "text": "def banner=(_arg0); end", "title": "" }, { "docid": "b941736cdda960740e0d783f3eb0688f", "score": "0.65335894", "text": "def banner(text)\n # returns Shoes::Banner\n throw NotImplementedError\n end", "title": "" }, { "docid": "0ff6f394ef48118a5424118bc4b821cc", "score": "0.6505115", "text": "def banner\n say %(\n\n ******************************************************************\n\n Your theme has been generated with a gemspec dependency on\n Archangel ~> v#{archangel_version}\n\n You look lovely today by the way.\n\n ******************************************************************\n\n )\n end", "title": "" }, { "docid": "e7757286ecde23e85093bef9a43a1987", "score": "0.65047103", "text": "def horizontal_banner\n\n end", "title": "" }, { "docid": "1f172fe4bc48598a8ddb2f2aef622663", "score": "0.63740146", "text": "def banner()\r\n print \"\"\" \r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n _____ ____ \r\n <----,\\ -- )\r\n <--==\\\\ -/ Auto Snorter v0.0.1 Locked, stocked, and fully auto.... <////~\r\n <--==\\\\/\r\n .-~~~~-.Y|\\\\_ by Rick Flores @nanotechz9l\r\n @_/ / 66\\_ 0xnanoquetz9l[--at--]gmail.com\r\n | \\ \\ _('')\r\n \\ /-| ||'--' Automation station!\r\n \\_\\ \\_\\\\_\\\r\n \r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\"\"\" \r\nend", "title": "" }, { "docid": "276c83401e5e4498f48a1aef365403fd", "score": "0.6315537", "text": "def banner\n print_line BANNER\n print_line\n print_line\n end", "title": "" }, { "docid": "97b4513b1277dc3a71a5aa1c48d65ad1", "score": "0.62881106", "text": "def banner\n <<~'TEXT'\n ___ _ _ _ _\n / __\\ | ___ _ _ __| | |_ __ _ ___| | _____ _ __\n / / | |/ _ \\| | | |/ _` | __/ _` / __| |/ / _ \\ '__|\n / /___| | (_) | |_| | (_| | || (_| \\__ \\ < __/ |\n \\____/|_|\\___/ \\__,_|\\__,_|\\__\\__,_|___/_|\\_\\___|_|\n\n TEXT\n end", "title": "" }, { "docid": "33a367876ecb521cf5280d00a9cbc03b", "score": "0.6253673", "text": "def default_banner\n command_name = File.basename($0).gsub(/\\.[^.]+$/, '')\n bannertext = ''\n bannertext << \"Usage: #{command_name} #{@usage}\\n\" if @usage\n bannertext << \"#{@synopsis}\\n\" if @synopsis\n bannertext << \"\\n\" if @usage || @synopsis\n bannertext << \"#{@version}\\n\" if @version\n unless subcommands.empty?\n bannertext << \"\\n\" if @version \n bannertext << \"Commands:\\n\"\n @subcommand_parsers.each_value do |scmd|\n bannertext << sprintf(\" %-20s %s\\n\", scmd.name, scmd.desc)\n end\n bannertext << \"\\n\" \n end\n bannertext << \"Options:\\n\"\n return bannertext\n end", "title": "" }, { "docid": "a15b68608e9cd8ec8a2c38de01f3c7ec", "score": "0.618729", "text": "def banner\n \"[#{name}] \"\n end", "title": "" }, { "docid": "4b95c8e7353005e1444a0b006bdb07fa", "score": "0.6180596", "text": "def banner(*args)\n Kitchen.logger.logdev && Kitchen.logger.logdev.banner(*args)\n super\n end", "title": "" }, { "docid": "3d97d53b813d6bc42633b4ad6d9ebf5c", "score": "0.6172223", "text": "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.61658794", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.61658794", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "e40ecd5702cc7b2ef0392d9fdc415b20", "score": "0.61658794", "text": "def banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "f29243ad736f54c723c1399bf44ced55", "score": "0.6157266", "text": "def banner(*)\n \"#{executable} #{arguments.map(&:usage).join(' ')} [options]\".squish\n end", "title": "" }, { "docid": "3a96713ff0d51278fb32e55503c1483a", "score": "0.6124809", "text": "def banner\n <<-'BANNER'\n .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. \n | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. | .--------------. |\n | | ______ | | | _________ | | | _____ | | | __ | | | _________ | | | _________ | | | ________ | |\n | | |_ _ \\ | | | |_ ___ | | | | |_ _| | | | / \\ | | | | _ _ | | | | |_ ___ | | | | |_ ___ `. | |\n | | | |_) | | | | | |_ \\_| | | | | | | | | / /\\ \\ | | | |_/ | | \\_| | | | | |_ \\_| | | | | | `. \\ | |\n | | | __'. | | | | _| _ | | | | | _ | | | / ____ \\ | | | | | | | | | _| _ | | | | | | | | |\n | | _| |__) | | | | _| |___/ | | | | _| |__/ | | | | _/ / \\ \\_ | | | _| |_ | | | _| |___/ | | | | _| |___.' / | |\n | | |_______/ | | | |_________| | | | |________| | | ||____| |____|| | | |_____| | | | |_________| | | | |________.' | |\n | | | | | | | | | | | | | | | | | | | | | |\n | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' | '--------------' |\n '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' \n BANNER\n end", "title": "" }, { "docid": "5923769333a10e6dd86e6b2f7811b7ac", "score": "0.6123035", "text": "def banner\n puts \"*\" * 80\n puts \" Your extension has been generated with a gemspec dependency on\"\n puts \" Archangel #{archangel_version}.\"\n puts \"\"\n puts \" You look lovely today by the way.\"\n puts \"*\" * 80\n end", "title": "" }, { "docid": "f42cbbc3374c227319a5895ec5372b7b", "score": "0.6120201", "text": "def banner\n self.class.banner\n end", "title": "" }, { "docid": "ae29567a642b4f5fb29c1fb52d923c0f", "score": "0.61098987", "text": "def banner\n %q{\n _ _\n | | |\n ___ ___ _ ____ _____ _ __ __ _ __| | |__\n / __/ _ \\| '_ \\ \\ / / _ \\ '__/ _` |/ _` | '_ \\\n | (_| (_) | | | \\ V / __/ | | (_| | (_| | |_) |\n \\___\\___/|_| |_|\\_/ \\___|_| \\__, |\\__,_|_.__/\n __/ |\n |___/ }\n end", "title": "" }, { "docid": "d6ab9cc3fa74cee99d3fe53208773598", "score": "0.60846263", "text": "def banner=(banner); end", "title": "" }, { "docid": "d6ab9cc3fa74cee99d3fe53208773598", "score": "0.60846263", "text": "def banner=(banner); end", "title": "" }, { "docid": "bb266e0d135450cdec47c9d05d5f5c11", "score": "0.60383236", "text": "def banner (*args)\n slop.banner(*args)\n end", "title": "" }, { "docid": "a1a12b7181a519e45f853a07228e3bc9", "score": "0.60229415", "text": "def banner\n banner = \"\"\"\n /$$ /$$ /$$ /$$ /$$ /$$ /$$ \n | $$ | $$ | $/ | $$ | $$|__/| $$ \n | $$ /$$$$$$ /$$$$$$|_//$$$$$$$ | $$ | $$ /$$| $$ /$$ /$$$$$$ \n | $$ /$$__ $$|_ $$_/ /$$_____/ | $$$$$$$$| $$| $$ /$$/ /$$__ $$\n | $$ | $$$$$$$$ | $$ | $$$$$$ | $$__ $$| $$| $$$$$$/ | $$$$$$$$\n | $$ | $$_____/ | $$ /$$\\____ $$ | $$ | $$| $$| $$_ $$ | $$_____/\n | $$$$$$$$| $$$$$$$ | $$$$//$$$$$$$/ | $$ | $$| $$| $$ \\ $$| $$$$$$$\n |________/ \\_______/ \\___/ |_______/ |__/ |__/|__/|__/ \\__/ \\_______/\n \"\"\"\n puts banner\n end", "title": "" }, { "docid": "a19a1073781273ea9f2707aa89ebec7a", "score": "0.5994467", "text": "def banner(banner, options)\n if banner\n puts banner\n else\n # Usage needs to know about the defined options.\n usage(options)\n end\n end", "title": "" }, { "docid": "3c3e9cbaf97c70b9d29a6b65f3117eaa", "score": "0.59772485", "text": "def banner\n \"Launches the rel command line tool\"\n end", "title": "" }, { "docid": "16993527e74dd653eb7f1b6475c29492", "score": "0.5962339", "text": "def banner\n return $0\n end", "title": "" }, { "docid": "25533f33b6133479c013905b6b8ff942", "score": "0.5960811", "text": "def banner\n\t\tver=read_ver\n\t\tart=\",--. ,--. ,--. ,--. ,--.\n| | | | ,---. | |-. | `.' | ,--,--. ,---. ,---. ,---. ,--.--.\n| |.'.| || .-. :| .-. ' | |'.'| |' ,-. || .-. || .-. || .-. :| .--'\n| ,'. |\\ --.| `-' | | | | |\\ '-' || '-' '| '-' '\\ --.| |\n'--' '--' `----' `---' `--' `--' `--`--'| |-' | |-' `----'`--'\n `--' `--' \"\n\t\tstring = \"-\"*80 + \"\\n\" + art + \"\\n\" + \"Version: \" + ver[\"version\"] + \"\\tRelease Date: \" + ver[\"date\"] + \"\\nDesigned and developed by: \" + ver[\"author\"] + \"\\nEmail: \" + ver[\"email\"] + \"\\tLinkedIn: \" + ver[\"linkedin\"] + \"\\n\" + \"-\"*80\n\tend", "title": "" }, { "docid": "de974c1e6abeab0fb41e843bad18cc06", "score": "0.5950105", "text": "def create_banner\n\t\t\t\n\t\t\tda = Gtk::DrawingArea.new\n\t\t\tda.set_size_request(600, 60)\n\t\t\tda = Gtk::Image.new(driver.get_icon(\"banner_assistant.xpm\"))\n return da\n end", "title": "" }, { "docid": "7624cd37829dd6e4f4f280d40464ac00", "score": "0.5945108", "text": "def banner\n \"Usage: #{$0} wizardly_app\"\n end", "title": "" }, { "docid": "691a9f6c38fa07de4e87b46f4debe101", "score": "0.59314686", "text": "def cmd_banner(*args)\n\t\tbanner = \"%cya\" + Banner.to_s + \"%clr\\n\\n\"\n\t\tbanner << \" =[ %yelmetasploit v#{Msf::Framework::Version} [core:#{Msf::Framework::VersionCore} api:#{Msf::Framework::VersionAPI}]%clr\\n\"\n\t\tbanner << \"+ -- --=[ \"\n\t\tbanner << \"#{framework.stats.num_exploits} exploits - #{framework.stats.num_auxiliary} auxiliary\\n\"\n\t\tbanner << \"+ -- --=[ \"\n\n\t\toldwarn = nil\n\t\tbanner << \"#{framework.stats.num_payloads} payloads - #{framework.stats.num_encoders} encoders - #{framework.stats.num_nops} nops\\n\"\n\t\tif ( ::Msf::Framework::RepoRevision.to_i > 0 and ::Msf::Framework::RepoUpdatedDate)\n\t\t\ttstamp = ::Msf::Framework::RepoUpdatedDate.strftime(\"%Y.%m.%d\")\n\t\t\tbanner << \" =[ svn r#{::Msf::Framework::RepoRevision} updated #{::Msf::Framework::RepoUpdatedDaysNote} (#{tstamp})\\n\"\n\t\t\tif(::Msf::Framework::RepoUpdatedDays > 7)\n\t\t\t\toldwarn = []\n\t\t\t\toldwarn << \"Warning: This copy of the Metasploit Framework was last updated #{::Msf::Framework::RepoUpdatedDaysNote}.\"\n\t\t\t\toldwarn << \" We recommend that you update the framework at least every other day.\"\n\t\t\t\toldwarn << \" For information on updating your copy of Metasploit, please see:\"\n\t\t\t\toldwarn << \" http://www.metasploit.com/redmine/projects/framework/wiki/Updating\"\n\t\t\t\toldwarn << \"\"\n\t\t\tend\n\t\tend\n\n\t\t# Display the banner\n\t\tprint_line(banner)\n\n\t\tif(oldwarn)\n\t\t\toldwarn.map{|line| print_line(line) }\n\t\tend\n\tend", "title": "" }, { "docid": "11cf417e8b6261ec655b5e1ff74fb98d", "score": "0.5925426", "text": "def common_banner\n <<-EOS\nUsage:\n #{__FILE__} [options]\n\n EOS\n end", "title": "" }, { "docid": "de2b2b1d3e9fa5b6e3eda0ce17110ec8", "score": "0.58772707", "text": "def banner(line)\n add do |arg|\n arg.banner(line)\n end\n end", "title": "" }, { "docid": "1f749636f7eb15b8ada86c321f624554", "score": "0.5864236", "text": "def banner(banner = nil)\n @banner = banner if banner\n @banner\n end", "title": "" }, { "docid": "d4307169323cf8be56bc17dc0588a143", "score": "0.5829324", "text": "def banner #:nodoc:\n \"#{self.namespace} #{self.arguments.map {|o| o.usage }.join(' ')}\"\n end", "title": "" }, { "docid": "15a6fee0734309b28e3039dd3f7c4079", "score": "0.5815531", "text": "def banner\n 3.times { puts }\n puts \" >> Tomato Interactive Console <<\"\n puts\n help\n end", "title": "" }, { "docid": "947e140331b5759a72d2953d0fcd60b1", "score": "0.5791872", "text": "def the_banner_widget(attrs = {}, &block)\n attrs = {qty_truncate: 100, block_right: '', class: ''}.merge(attrs)\n return object.promotable.decorate.the_widget(attrs) if is_event?\n \"<a class='display-blocks #{attrs[:class]} no_hover' href='#{object.website || h.dashboard_user_group_path(id: object.promotable_id)}' target='_blank'>\n <span class='overflow_hidden' style='max-height: 150px; margin-bottom: 10px;'>\n <img style='min-width: 100%; max-width: none;' src='#{object.promotable.image.url}'>\n </span>\n <span class='caption'>\n <span class='bold'>#{object.promotable.name}</span> \n <span class='small text-gray'>#{object.promotable.the_description(attrs[:qty_truncate])}</span> \n </span>\n </a>\".html_safe\n end", "title": "" }, { "docid": "3dc5d15eda8c4c4050dbaec70f807470", "score": "0.5786241", "text": "def help; summarize(banner.to_s.sub(/\\n?\\z/, \"\\n\")) end", "title": "" }, { "docid": "ab4336f43c48c7359bfe96057942311d", "score": "0.57816476", "text": "def banner\n puts \"******************************************************************************\".colorize(color: :white, background: :magenta)\n puts \"* rotor_machine: Simple simulation of the German WWII Enigma Machine *\".colorize(color: :white, background: :magenta)\n puts \"* By Tammy Cravit <tammycravit@me.com> *\".colorize(color: :white, background: :magenta)\n puts \"* http://github.com/tammycravit/rotor_machine *\".colorize(color: :white, background: :magenta)\n puts \"******************************************************************************\".colorize(color: :white, background: :magenta)\n puts \"\"\n puts \"rotor_machine version #{RotorMachine::VERSION}. Type 'help' for help. <Tab> to complete commands.\".colorize(color: :magenta)\n puts \"\"\n end", "title": "" }, { "docid": "edad7109b58c97b37baba47c1901f9e7", "score": "0.5773432", "text": "def banner\n \"Usage: roby gen #{spec.name} NAME [options]\"\n end", "title": "" }, { "docid": "ad43396c6af00f672cc60c4565565b28", "score": "0.5767364", "text": "def help_banner\n output = ''\n if command_parser.main_options.banner?\n output << format(command_parser.main_options.banner, indent: 0) << \"\\n\\n\"\n end\n output << format(usage, indent: 7) << \"\\n\\n\"\n end", "title": "" }, { "docid": "6f818c41a68624f366f27aa214734d1c", "score": "0.5747099", "text": "def title\n \"Override def title in vendor/extensions/banners/app/models/refinery/banners/banner.rb\"\n end", "title": "" }, { "docid": "f9e36d880adcf62812044dd78a00c9ef", "score": "0.57392764", "text": "def banner\n JSON.pretty_generate({ 'banner' => output(varnishadm(\"banner\"))})\n end", "title": "" }, { "docid": "9ac3625b8907f671c2a6e001ae230c3a", "score": "0.57199806", "text": "def banner\n \"Usage: #{$0} toolbawks_component [component_name]\"\n end", "title": "" }, { "docid": "ff23a015560dba065f96ce5ae936e629", "score": "0.56932044", "text": "def draw_banner\n bmp = Cache.picture(@quest.banner) # Get Picture\n # Shift the hue if requested\n bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0\n x = (contents_width - bmp.rect.width) / 2\n if x < 0 # Stretch horizontally if the banner is too wide\n dest_rect = bmp.rect.dup\n dest_rect.width = contents_width\n contents.stretch_blt(dest_rect, bmp, bmp.rect)\n else\n contents.blt(x, @draw_y, bmp, bmp.rect)\n end\n bmp.dispose\n end", "title": "" }, { "docid": "886f3f07436d40558ab90e26803f3d1e", "score": "0.5688871", "text": "def banner(msg = nil, &block)\n super_info(\"-----> #{msg}\", &block)\n end", "title": "" }, { "docid": "886f3f07436d40558ab90e26803f3d1e", "score": "0.5688871", "text": "def banner(msg = nil, &block)\n super_info(\"-----> #{msg}\", &block)\n end", "title": "" }, { "docid": "5cf990f8cae1d011ed5ddb68be48e803", "score": "0.56709325", "text": "def description\n \"#{super} - Hamburger\"\n end", "title": "" }, { "docid": "70d54ca8bdbe2af7f47d2b05d4d81b23", "score": "0.5665636", "text": "def print_banner\n puts BANNER\n puts\n puts\n end", "title": "" }, { "docid": "ce2abb48d3db209daaf55497964b5b89", "score": "0.56577116", "text": "def opt_banner(opt)\n opt.banner = <<BAN\n#{$task_desc[$task]}\n\nUsage: #{$0} #{$task} [options]\nBAN\n opt.separator \"\"\nend", "title": "" }, { "docid": "93cdcc283752a8599efcf81b7256e0a6", "score": "0.56537926", "text": "def banner(command, namespace = nil, subcommand = true)\n addition = command.formatted_usage(\n self,\n false,\n subcommand\n )\n\n [\n basename,\n addition\n ].compact.join(\" \")\n end", "title": "" }, { "docid": "a5627cf1775ad4ef59efe952926e9483", "score": "0.5631397", "text": "def banner\n \"Usage: #{$0} gruff ControllerName\"\n end", "title": "" }, { "docid": "43b0bb1d998ef3a922cc13734adeb911", "score": "0.5631258", "text": "def print_banner\n puts \"\\e[96m\"\n puts banner\n puts \"\\e[0m\"\n end", "title": "" }, { "docid": "560d5f266a58c16581de9871c70bcb0f", "score": "0.56286305", "text": "def banner(text=nil)\n @banner = text if text\n @banner\n end", "title": "" }, { "docid": "560d5f266a58c16581de9871c70bcb0f", "score": "0.56286305", "text": "def banner(text=nil)\n @banner = text if text\n @banner\n end", "title": "" }, { "docid": "560d5f266a58c16581de9871c70bcb0f", "score": "0.56286305", "text": "def banner(text=nil)\n @banner = text if text\n @banner\n end", "title": "" }, { "docid": "560d5f266a58c16581de9871c70bcb0f", "score": "0.56286305", "text": "def banner(text=nil)\n @banner = text if text\n @banner\n end", "title": "" }, { "docid": "6e20a2007c3f7a8970efd9937f53054d", "score": "0.5619355", "text": "def initialize(opts={})\n super\n @shell = Shell.new(opts)\n end", "title": "" }, { "docid": "2c324ae4733e4f610c94a3f39c6b80bb", "score": "0.56042486", "text": "def site_banner\n \"<h1>#{APPLICATION_NAME}</h1>\"\n end", "title": "" }, { "docid": "f66496c02edc20b6043a1a81c201e550", "score": "0.5600787", "text": "def hero_banner(&block)\n styles = \"display:flex;justify-content:center;min-height:500px;padding:1em;flex-direction:column;background-color:#eee;gap:1em;\"\n content_tag(:header, style: styles, &block)\n end", "title": "" }, { "docid": "f22e88fbbdaaa0959efc6fd3ce711193", "score": "0.5579442", "text": "def hbase_shell_option(opts = {})\n @parser.new do |opt|\n opt.banner += \" Extra options passed to the hbase shell.\\n\" \\\n \" e.g. HBASE_SHELL_OPTS=-Xmx2g\\n\\n\"\n end\n end", "title": "" }, { "docid": "3b41fee783f6810e1902450b35b2b63c", "score": "0.5567099", "text": "def banner(banner = nil)\n config[:banner] = banner if banner\n config[:banner]\n end", "title": "" }, { "docid": "34054ffb9e808fde0db7a1aada144f52", "score": "0.5551514", "text": "def entry_banner\n 'One-on-One'\n end", "title": "" }, { "docid": "7c2d87fef8c307f12bb4d5dd29102f04", "score": "0.554894", "text": "def banner(text)\n @banner = text\n end", "title": "" }, { "docid": "5af6aeda4b66c1a8caf5ef17539ff946", "score": "0.55417037", "text": "def banner\n \"Usage: #{$0} feedsucker\"\n end", "title": "" }, { "docid": "1a95a93be799f120361b601cd2a3cb6b", "score": "0.5520007", "text": "def banner\n system \"clear\"\n puts \" ( ( (\n )\\\\))( ' ( )\\\\ ) (\n((_)()\\\\ ) ))\\\\ ((_) ( ( ( ))\\\\\n_(())\\\\_)() /((_) _ )\\\\ )\\\\ )\\\\ ' /((_)\n\\\\ \\\\((_)/ /(_)) | | ((_) ((_) _((_)) (_))\n \\\\ \\\\/\\\\/ / / -_) | | / _| / _ \\\\ | ' \\\\() / -_)\n \\\\_/\\\\_/ \\\\___| |_| \\\\__| \\\\___/ |_|_|_| \\\\___| \"\nend", "title": "" }, { "docid": "7f1bc5ba0ff7896b3d627135c919e709", "score": "0.5517684", "text": "def banner\n \"Usage: #{$0} tool toolname --exe path_to_exe [--version gem_version, --exe path_to_another_exe]\"\n end", "title": "" }, { "docid": "d55f5ba0e70cf62af58c0bb0d737f68d", "score": "0.55156064", "text": "def finalize\n super\n\n case @enabled\n when Cliqr::Config::ENABLE_CONFIG\n @enabled = true\n when Cliqr::Config::DISABLE_CONFIG\n @enabled = false\n when UNSET\n @enabled = true\n end\n @prompt = Config.get_if_unset(@prompt, Cliqr::Command::ShellPromptBuilder.new)\n @banner = Config.get_if_unset(@banner, Cliqr::Command::ShellBannerBuilder.new)\n\n # set default name for the shell action\n @name = 'shell' if @name.is_a?(String) && @name.empty?\n\n self\n end", "title": "" }, { "docid": "17141e826248b8bc3d8f0bf306a2f14a", "score": "0.55115765", "text": "def banner\n \"Usage: #{$0} deployment ApplicationName [recipe-name]\\n\" +\n \" (recipe-name defaults to \\\"deploy\\\")\"\n end", "title": "" }, { "docid": "56b53ebba8d06e97558171d7360c8081", "score": "0.5511193", "text": "def shell_command\n @parser.new do |opt|\n opt.banner += \" shell_command[ shell_command[ ...]]\n One or more shell commands. Each command is separated by a space and\n commands which contain spaces must be quoted\\n\\n\"\n end\n end", "title": "" }, { "docid": "56b53ebba8d06e97558171d7360c8081", "score": "0.5511193", "text": "def shell_command\n @parser.new do |opt|\n opt.banner += \" shell_command[ shell_command[ ...]]\n One or more shell commands. Each command is separated by a space and\n commands which contain spaces must be quoted\\n\\n\"\n end\n end", "title": "" }, { "docid": "444e4605dc714179bf65f31b8c1c1d65", "score": "0.55064744", "text": "def entry_banner\n 'Development Goal'\n end", "title": "" }, { "docid": "a91c71269887b7e17ec72392dda05532", "score": "0.55042815", "text": "def print_banner\n Catpix::print_image \"binder_logo.jpg\",\n :center_x => true,\n :center_y => true,\n :resolution => 'low'\nend", "title": "" }, { "docid": "723bc7ee7bcd9140346df86b612894be", "score": "0.55006975", "text": "def banner\r\n \"Usage: #{$0} #{spec.name} [options]\"\r\n end", "title": "" }, { "docid": "8e8d5f62c7f161489a150bb121f25c7c", "score": "0.5496953", "text": "def banner\n \"Usage: #{$0} extend_taggable ModelName\"\n end", "title": "" }, { "docid": "8a5d397f03edfb2470584d0aa1483f34", "score": "0.5488458", "text": "def bundle(title = nil, options = {}, &block)\n #must be redefined in inerit class\n end", "title": "" }, { "docid": "29201cb0196fcf3ca7adc3258281d97d", "score": "0.54769206", "text": "def banner\n I18n.t 'command.'+self.invoke_name+'.usage', cmd: 'vagrant ' + self.invoke_name\n end", "title": "" }, { "docid": "efab78af7df1fdd514dc86922258f98c", "score": "0.54720026", "text": "def banner\n \"Usage: #{$0} lipsiadmin_page ModelName [--with-images||--with-files]\"\n end", "title": "" }, { "docid": "3166bfe72c59ad47de1d66e7289f77e1", "score": "0.54598695", "text": "def bannerino(desc)\n \"#septober v#{$PROG_VER} #{white desc.to_s} (#{green RemoteTodo.user} @ #{cyan RemoteTodo.site.to_s.split('/')[2] }, timeout=#{RemoteTodo.timeout})\" + \n (RemoteTodo.description.length > 2 ? \" # #{gray RemoteTodo.description}\" : '')\n end", "title": "" }, { "docid": "4a53b4f8d5b4de25364906bef62b598e", "score": "0.54568565", "text": "def banner\n \"Usage: #{$0} freemium\"\n end", "title": "" }, { "docid": "70fceec628dc06ca0cf7afc3ffdacc38", "score": "0.5448722", "text": "def build_shell_step(b, command)\n b.tag! \"hudson.tasks.Shell\" do\n b.command command.to_xs.gsub(\"&amp;\", '&') #.gsub(%r{\"}, '&quot;').gsub(%r{'}, '&apos;')\n end\n end", "title": "" }, { "docid": "232b5da1db065fbffb8681d465890276", "score": "0.5442844", "text": "def bundler_sh(*args,&blk)\n args.options.without_cleaning_bundler = true\n AngryShell::Shell.new(*args,&blk)\n end", "title": "" }, { "docid": "9a5fcd471ffd538988c4a9004eb44571", "score": "0.5436749", "text": "def banner(message)\n printf \"\\n%s\\n\", Postview\n printf \"\\n%s\\n\\n\", message\nend", "title": "" }, { "docid": "98f8ca966baca4d4d68f2531ead598cb", "score": "0.54219776", "text": "def banner\r\n \"Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]\"\r\n end", "title": "" }, { "docid": "2f3805fa7838aa3d32852660ad11c9c7", "score": "0.5416853", "text": "def bundler_sh(*args,&blk)\n args.options.without_cleaning_bundler = true\n CommonMob::Shell.new(*args,&blk)\n end", "title": "" }, { "docid": "36ed7ff7b839b2f98044596a7ea784f2", "score": "0.541162", "text": "def getOptionsBanner\n return ''\n end", "title": "" }, { "docid": "36ed7ff7b839b2f98044596a7ea784f2", "score": "0.541162", "text": "def getOptionsBanner\n return ''\n end", "title": "" }, { "docid": "4120ada60ceb713142db4228f6004ab8", "score": "0.54051095", "text": "def initialize(banner = \"Loading\")\n @banner = banner\n end", "title": "" }, { "docid": "25c0469d22ff8231c7dfb6032a8c9aef", "score": "0.53979754", "text": "def create_banner\n option_separator\n option_separator 'Usage: main.rb <application>-<mode> [options] [tests]'\n option_separator 'If no test names are specified, all tests are executed.'\n end", "title": "" }, { "docid": "f698484b9d1b91800f80fb9b137c8db6", "score": "0.5388375", "text": "def help(shell, options={})\n if options[:short]\n shell.say banner\n else\n shell.say \"Usage:\"\n shell.say \" #{banner}\"\n shell.say\n class_options_help(shell)\n shell.say self.desc if self.desc\n end\n end", "title": "" } ]
7e18804c7f4a5d7c1f5e35fdc8e4f24a
Public: Get info about the loggedin user. Examples get the email of the loggedin user client.user_info.email
[ { "docid": "ba46c33eaa6033eeddbbdddd3ad3411f", "score": "0.79511094", "text": "def user_info\n get(api_get.body.identity).body\n end", "title": "" } ]
[ { "docid": "d193531c5570e0549b872104f17ea46f", "score": "0.80064726", "text": "def user_info(email)\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Email cannot be blank\" if email.nil? || email.empty?\n get(\"#{CloudFoundry::Client::USERS_PATH}/#{email}\")\n end", "title": "" }, { "docid": "481985fce93c345545e01c710a7d2950", "score": "0.7786989", "text": "def get_user_info\n request :get_user_info\n end", "title": "" }, { "docid": "e18a73c2c827c09038692d3b66227a66", "score": "0.7772669", "text": "def get_user_info\n self.class.get(\"#{@url}/rest/user-management/logged-in-user?pretty\", basic_auth: @auth)\n end", "title": "" }, { "docid": "e3bc0d1ff120019769381f9bf80eca71", "score": "0.767329", "text": "def get_user_info\n\t\t\tdo_api :get, 'user/get_info', { :session => @session }\n\t\tend", "title": "" }, { "docid": "47642ed6d71ec5320d5f48bc9a28759f", "score": "0.76592755", "text": "def get_user_information\n if loggedin?\n return get_request('GetUserInformation')\n else\n #raise NotLoggedIn\n end\n end", "title": "" }, { "docid": "a14af600e0d282a871ddb8bf91ad2f2a", "score": "0.76277554", "text": "def user_info\n get('/userinfo')\n end", "title": "" }, { "docid": "a14af600e0d282a871ddb8bf91ad2f2a", "score": "0.76277554", "text": "def user_info\n get('/userinfo')\n end", "title": "" }, { "docid": "35871d8e540cd29bca830bdbde1718c8", "score": "0.7573821", "text": "def get_user_info()\n data, _status_code, _headers = get_user_info_with_http_info()\n return data\n end", "title": "" }, { "docid": "54261ffa53ca56f8de5ecc03eae005c2", "score": "0.75329304", "text": "def get_user_info(user_id)\n @web_client.users_info(user: user_id)\n end", "title": "" }, { "docid": "136ae12f5b37308660245ab3ded20377", "score": "0.74201393", "text": "def get_user_info\n user = User.select(:email, :created_at).find_by(id: current_user.id)\n render json: user\n end", "title": "" }, { "docid": "b57ebb820c72bdd8201c02e2ca045f74", "score": "0.7404877", "text": "def user_info\n @connection.post('/user/info').response\n end", "title": "" }, { "docid": "624d50cd62501a6a3b8f719ff04752f2", "score": "0.73349965", "text": "def current_user\n uri = URI.join(@host, 'api/users/current_user/edit.json')\n uri.query = URI.encode_www_form({ user_email: @email, user_token: @token })\n\n res = Net::HTTP.get_response(uri)\n\n puts res.body\n end", "title": "" }, { "docid": "d6ac498415b09987c979443d12fdfddb", "score": "0.7302303", "text": "def get_user_info username\n get(\"/user/#{username}/about.json\")\n end", "title": "" }, { "docid": "afa360bf0d33de4e0241413f2a8256e8", "score": "0.72768223", "text": "def user_info_by_email( email )\n id = User.cid_from_email( email )\n return user_info_by_cid( id )\n end", "title": "" }, { "docid": "5cc7cb6b90cccd432131e957257c52aa", "score": "0.723188", "text": "def get_user_info\n return User.find_by_id(self.user_id)\n end", "title": "" }, { "docid": "3e25ab96c02ffbc97786b6cd2d23bc1f", "score": "0.71664935", "text": "def user\n Delphix.get(Delphix.user_url).body.result\n end", "title": "" }, { "docid": "eb3ab627f11b91a80b81ea855e4b58d6", "score": "0.7163392", "text": "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "title": "" }, { "docid": "7bbe211222169c242f31c00389b84426", "score": "0.712426", "text": "def current_user_email\n ensure_user_is_logged_in\n session[:user_id][\"email\"]\n end", "title": "" }, { "docid": "e4a5f01ec8bf17e0f44f0ac886ca55fc", "score": "0.7112445", "text": "def get_info( params )\n LastFM.get( \"user.getInfo\", params )\n end", "title": "" }, { "docid": "a78d8df668f0629a413bea9911c0ff26", "score": "0.7105379", "text": "def user\n user = nil\n\n if user.nil? && email = params[:email]\n user = User.find_by(email: email)\n end\n\n if user.nil? && github_id = params[:github_id]\n github_id = github_id.downcase\n # FIXME: discourse for some reason translates - to \"_\" when storing github user info\n github_id = github_id.tr(\"-\",\"_\")\n # try look up by replacing - with \"_\" as well...\n ginfo = GithubUserInfo.where(\"lower(screen_name) = ?\",github_id).first\n if ginfo\n user = ginfo.user\n end\n end\n\n if user.nil?\n json = {\n \"error\" => \"user not found\"\n }\n render(json: json, status:404)\n else\n json = {\n \"discourse_username\" => user.username,\n \"email\" => user.email\n }\n render(json: json)\n end\n end", "title": "" }, { "docid": "636824c0082a2d29de357f805996fc52", "score": "0.7097648", "text": "def show\n @user_name = current_user.email # 获取当前登录用户的Emai\n end", "title": "" }, { "docid": "8a9cb4ebfab1aea794cc70d26a8d0d99", "score": "0.70438665", "text": "def user_email\n session_details[:user_email]\n end", "title": "" }, { "docid": "4aac6d8c5a0b445522def88c2389626e", "score": "0.7034478", "text": "def info\n hash = {:username => @username}\n @api.request(\"users/info/?#{build_query_string(hash)}\")\n end", "title": "" }, { "docid": "3b9753163b10ee1e06a1dfe1a583cb1b", "score": "0.7008862", "text": "def get_user_info(user_id)\n\t\treturn User.find(user_id)\n\tend", "title": "" }, { "docid": "368e0c4803a1415b35ec766a79554928", "score": "0.69802064", "text": "def get\n User.new(\n Client.get(\"/api/users/current_user/edit.json?user_email=#{email}&user_token=#{token}\")\n )\n end", "title": "" }, { "docid": "43fb649412fa8ad96e22561ecc835b99", "score": "0.6973585", "text": "def user_email\n @gapi.user_email\n end", "title": "" }, { "docid": "cc87365850892abccb08dce4d289b716", "score": "0.6945267", "text": "def get_user_information(access_token)\n\t\tfull_url = get_api_url_for('/v1/me')\n\t\tresponse = nil\n\t\tbegin\n\t\t\tresponse = RestClient.get(full_url, {\n\t\t\t\t'Authorization': ('Bearer ' << access_token)\n\t\t\t})\n\t\t\tputs \"======== RECEIVED RESPONSE - GET USER INFORMATION ====\"\n\t\t\tpp response.body\n\t\t\tputs \"======== END ========\"\n\t\t\treturn JSON.parse response.body\n\n\t\trescue RestClient::ExceptionWithResponse => e\n\t\t\tputs \"EXCEPTION\"\n\t\t\tpp e.response.body\n\t\t\treturn { error: true }\n\t\tend\n\tend", "title": "" }, { "docid": "1694375332c4177ccf25e504dad6112f", "score": "0.69356006", "text": "def info(params)\n user_id = (params.split(\"-\"))[0]\n @info = @client.keystone(\"users/#{user_id}\", 'GET')\n @info[\"response\"]\n end", "title": "" }, { "docid": "3dd5cb7adf8ff5ebd5a7b7f1d8823eb6", "score": "0.69320774", "text": "def userinfo\n return @userinfo\n end", "title": "" }, { "docid": "3ad19e9c996b0c9b16569954ab4bfb79", "score": "0.69186217", "text": "def get_user(user_id)\n client.get.user(user_id)\n # =>{ id: \"user_id\", name: \"user_name\"}\n end", "title": "" }, { "docid": "fc33944031f2e1e789ea2d96707a49c7", "score": "0.69069195", "text": "def user_email\n user.email if respond_to?(:user) && user\n end", "title": "" }, { "docid": "e12fe0fa3c21f20e12349f123324db00", "score": "0.69045824", "text": "def current_user_email\n begin\n current_user = @env[config.whoami].user\n current_user ? current_user.email : nil\n rescue NoMethodError\n raise NoMethodError, \"The middleware provided in BrowserID::Config.whoami doesn't have a :user method, or the :user doesn't have the :email method.\"\n end\n end", "title": "" }, { "docid": "5286781dde84f86d144324c5ce62c015", "score": "0.6901612", "text": "def get_user_info\n send_request 'getUserInfo'\n end", "title": "" }, { "docid": "8a64744e0f33a1a24d1f35ec6d2d15e8", "score": "0.68961287", "text": "def user_info \n @user_info ||= raw_info.nil? ? {} : raw_info[\"user\"]\n end", "title": "" }, { "docid": "8f06f3c89b538fb5e1310f086fe6b455", "score": "0.68905276", "text": "def email\n auth[\"info\"][\"email\"]\n end", "title": "" }, { "docid": "8f06f3c89b538fb5e1310f086fe6b455", "score": "0.68905276", "text": "def email\n auth[\"info\"][\"email\"]\n end", "title": "" }, { "docid": "f9abc5677a575faea51504b9b8b940a4", "score": "0.68851954", "text": "def user_information(token)\n path = 'auth/UserInformation'\n return get_data(token, path, nil)\n end", "title": "" }, { "docid": "abb8fbcee252badda504e032ef716705", "score": "0.6879524", "text": "def get_current_user() \n return \"user@email.com\"\n end", "title": "" }, { "docid": "1d17f2a70c0869593005b8893ca95b1d", "score": "0.6877838", "text": "def get_user_info(opts = {})\n data, _status_code, _headers = get_user_info_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "7c7fa8bb21a074076ca3fd30348a1efe", "score": "0.6877359", "text": "def userinfo(opts = {})\n data, _status_code, _headers = userinfo_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "631ea299dc3389c590ebf04bf80ff200", "score": "0.68674684", "text": "def get_user_by_email email\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get USERS, nil, \"query=\"+URI.encode(\"email is #{email}\") )\n\t\t\t\tend", "title": "" }, { "docid": "c8862e800727793f67a1ab6c84fec8ae", "score": "0.68489826", "text": "def get_user\n # sets the current user by params of id, email, current session token, or auth_token\n user = get_current_user\n if !user\n return render json: [\"Could not find user\"], status: 401\n end\n # if the user just created their account the auth_token will be sent back\n if (user.created_at - DateTime.now).abs < 01\n render json: {email: user.email, id: user.id, token: user.show_token}\n else\n render json: {email: user.email, id: user.id}\n end\n end", "title": "" }, { "docid": "588318bc6540b25063518e7cea29492e", "score": "0.68361187", "text": "def user(user)\n request(\"users/#{user}\")[\"user\"]\n end", "title": "" }, { "docid": "b07771fd758d3684be0d112f89b4f09d", "score": "0.68349046", "text": "def get_userinfo(access_token)\n uri = URI.parse(self.userinfo_endpoint)\n uri.path = uri.path.gsub(/\\:access\\_token/, access_token)\n client = http_client\n if self.ignore_invalid_ssl\n client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if userinfo_requires_basic_auth\n client.set_auth(nil, self.client_id, self.client_secret)\n client.force_basic_auth = true\n auth_header = {}\n else\n auth_header = { 'Authorization' => \"Bearer #{access_token}\" }\n end\n\n response = client.request(\n :get,\n uri.to_s,\n header: {\n 'Accept' => 'application/json'\n }.merge(auth_header)\n )\n\n client.set_auth(nil, nil, nil)\n client.force_basic_auth = false\n\n result = {}\n\n if response && response.headers['Content-Type'].to_s.include?('json')\n result[:username] = jsonpath_query(response.body, self.userinfo_username_jsonpath)\n result[:id] = jsonpath_query(response.body, self.userinfo_user_id_jsonpath)\n result[:email] = jsonpath_query(response.body, self.userinfo_email_jsonpath)\n end\n\n result\n rescue => ex\n ex.message.gsub!(access_token, '<access_token>') if access_token\n error ex\n nil\n end", "title": "" }, { "docid": "a777b9c24a72e1e3c5b5f7ffbdd6c826", "score": "0.6831078", "text": "def get_user(user)\n if user =~ /@/\n ulh = usergroup_ws.get_user_login_from_email [user]\n user = ulh[user]\n end\n usergroup_ws.get_user_info user\n end", "title": "" }, { "docid": "6c3bdfb5de925d07d060830574c2b1c4", "score": "0.6814779", "text": "def user_info\n result = request(\n :path => \"/\",\n :params => {\n \"Action\" => \"GetUser\",\n },\n ).get(:body, \"GetUserResponse\", \"GetUserResult\", \"User\")\n Smash.new(\n :user_id => result[\"UserId\"],\n :path => result[\"Path\"],\n :username => result[\"UserName\"],\n :arn => result[\"Arn\"],\n :created => result[\"CreateDate\"],\n :password_last_used => result[\"PasswordLastUsed\"],\n :account_id => result[\"Arn\"].split(\":\")[4],\n )\n end", "title": "" }, { "docid": "206d8f67d8a44f42f2cb8378bc870f3a", "score": "0.6814742", "text": "def user_email\n payload_user(:email)\n end", "title": "" }, { "docid": "98ffba868a7b824438e1aec8a96b99fa", "score": "0.68072355", "text": "def account_info\n ensure_ready!(:authorization)\n response = connection.get('users/me')\n checked_response_body(response)\n end", "title": "" }, { "docid": "e5eb47fdb474386f2465b173898ad219", "score": "0.6806863", "text": "def get_user_info(client, user_id, include_push)\n response = client.call(:get_user_info, message: {\n 'vip:requestId': Utilities.get_request_id('get_user_info'),\n 'vip:userId': user_id,\n 'vip:includePushAttributes': include_push\n })\n\n response_hash = response.body[:get_user_info_response]\n\n credentials = []\n\n if response_hash[:num_bindings] == nil || response_hash[:num_bindings] == '0'\n credentials = nil\n\n else\n if response_hash[:credential_binding_detail].is_a? Array\n response_hash[:credential_binding_detail].each do |credential|\n extract_credentials(credential, credentials, response_hash)\n end\n else\n extract_credentials(response_hash[:credential_binding_detail], credentials, response_hash)\n end\n\n end\n\n ret = get_return_hash(response_hash)\n ret[:credentials] = credentials\n ret\n end", "title": "" }, { "docid": "23ae77a8e0f1e27ca36fb0e8576c5e02", "score": "0.68008876", "text": "def info\n @user = current_user\n end", "title": "" }, { "docid": "55836acde852fb65ab2c501191677a73", "score": "0.6795834", "text": "def user_details\n user_details_for(@qualified_username).first\n end", "title": "" }, { "docid": "be05ad258381e7b6b38b2ef334409f8b", "score": "0.6790173", "text": "def show_user_logged_in\n get('users/me')\n end", "title": "" }, { "docid": "3d8336809e5942803f5e5c1847faa84a", "score": "0.67894703", "text": "def curr_user_email\n e = User.find(current_user)[:email]\n return e\nend", "title": "" }, { "docid": "2101b2920b14f7a182668641fe7d5b34", "score": "0.67773634", "text": "def site_user_info\n site_info[:user_info]\n end", "title": "" }, { "docid": "ac4c5730c8a47273e8f3704931b5c16b", "score": "0.6770697", "text": "def get_user(user_id)\n Echosign::Request.get_user(token, user_id)\n end", "title": "" }, { "docid": "e897939f1e45581032444e48673e3c29", "score": "0.6757293", "text": "def show_user()\n path = sprintf(\"/api/v2/user\")\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::User.new(JSON.load(rc.body)), err\n end", "title": "" }, { "docid": "b04ca69a50f8763b2a9f32e48f743727", "score": "0.6754833", "text": "def get_info(uid, options = {})\n\t\t\tdata = @oauth.post uid, \"user/get_info\", options\n\t\t\tdata['data']['openid'] = uid\n\t\t\tdata\n\t\tend", "title": "" }, { "docid": "673802d2e7a2dcd8eb9cbb2d2c64a28d", "score": "0.6746841", "text": "def find_user\n raise CredentialsMissing if client.nil?\n resp = do_authenticated_request(:get, \"/user/details\")\n raise resp if resp.is_a? String\n resp\n end", "title": "" }, { "docid": "d5690fd6fbb83cce9aef9f17a1b2ef7e", "score": "0.6740188", "text": "def account_info\n get(\"/users/self\")\n end", "title": "" }, { "docid": "e8c81471315492e8dc6dadbbf412a42a", "score": "0.6733153", "text": "def get_user_details(account)\n response = access_token(account).get('/me')\n json = JSON.parse(response)\n return {:username => json['name'], :uid => json['id'], :full_name => json['first_name'] + ' ' + json['last_name'], :url => json['link']}\n end", "title": "" }, { "docid": "79df4400913eb72f84fa511673be2d58", "score": "0.6725616", "text": "def current_user\n user_email = session[:email]\n User.find_by_email(user_email)\n end", "title": "" }, { "docid": "1e9c46ba236e1903eaeabadf4762e292", "score": "0.67242074", "text": "def user_info(user_id)\n return db.execute(\"SELECT * FROM users WHERE id=?\", user_id)\n end", "title": "" }, { "docid": "4754166a831ea48bb703894f620bd299", "score": "0.6719429", "text": "def info(options = {})\n params = options.merge(access_token: @access_token, uid: @uid) { |_, important, _| important }\n make_request resource_path('users/show', params), {}\n end", "title": "" }, { "docid": "2a19d287fd69c08ba1d2f20523d4db4b", "score": "0.67156047", "text": "def getUser (email)\n @users[email]\n end", "title": "" }, { "docid": "6748ec719f79b18acca82f3d884ef549", "score": "0.6702903", "text": "def get_user_info(user_id, include_push)\n @user.get_user_info(@query_client, user_id, include_push)\n end", "title": "" }, { "docid": "d0c4ed5c5340294347696ec06d822544", "score": "0.66929924", "text": "def user\n api['user']\n end", "title": "" }, { "docid": "d0c4ed5c5340294347696ec06d822544", "score": "0.66929924", "text": "def user\n api['user']\n end", "title": "" }, { "docid": "0ad68bc7303a190ec6021e87901c5e99", "score": "0.66893643", "text": "def retrieve_user_by_email(email)\n start.uri('/api/user')\n .url_parameter('email', email)\n .get()\n .go()\n end", "title": "" }, { "docid": "ca1d3ff9d9c4a72fff3c9b65dbf2b040", "score": "0.6685745", "text": "def retrieve_user_by_email(email)\n start.uri('/api/user')\n .url_parameter('email', email)\n .get()\n .go()\n end", "title": "" }, { "docid": "cac0010c872fb94176a80ab50fa5114a", "score": "0.66851604", "text": "def user_email_with_http_info(email, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.user_email ...'\n end\n # verify the required parameter 'email' is set\n if @api_client.config.client_side_validation && email.nil?\n fail ArgumentError, \"Missing the required parameter 'email' when calling UsersApi.user_email\"\n end\n # resource path\n local_var_path = '/users/email'\n\n # query parameters\n query_params = {}\n query_params[:'email'] = email\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 => 'InlineResponse20052')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#user_email\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "27fd784ed53c37a3a61a80d3dd7a023f", "score": "0.6683412", "text": "def get_user\n @user = User.find_by(email: params[:email]) #finds user by email in the params of the request\n end", "title": "" }, { "docid": "31ef3473351b8a0bb87e7a3e8e9fe21e", "score": "0.66752404", "text": "def hubssolib_get_user_address\n user = self.hubssolib_current_user\n user ? user.user_email : nil\n end", "title": "" }, { "docid": "27aaef3aa5b381f582cb47973841aec3", "score": "0.66618836", "text": "def current_user\n if session[:user]\n user = User.find(session[:user])\n return { id: user.id, name: user.full_name, access: user.access,\n email: user.email }\n end\n end", "title": "" }, { "docid": "397ecea48c9cc2bfb353916067f6663b", "score": "0.665829", "text": "def user_info\n @user_info ||= MultiJson.decode(access_token.get('/rest/gadget/1.0/currentUser').body)\n rescue ::Errno::ETIMEDOUT\n raise ::Timeout::Error\n end", "title": "" }, { "docid": "4019b1eeaae856780dbdbc4f95b8a04b", "score": "0.6655868", "text": "def user\n if !defined?(@user) || @user.nil?\n @user = nil\n return @user if @userinfo.nil?\n @user = @userinfo.strip.scan(/^(.*):/).flatten[0].strip\n end\n return @user\n end", "title": "" }, { "docid": "b8efff15236610aad55f5cc2de08cd3a", "score": "0.6651929", "text": "def whoami\n validate_arguments!\n result = email_address_and_api_key[0]\n if result\n puts result\n else\n error 'not logged in'\n end\n end", "title": "" }, { "docid": "035eedec0c53c4e8c544ee073faf7fd1", "score": "0.6651613", "text": "def userinfo\n if !defined?(@userinfo) || @userinfo == nil\n current_user = self.user\n current_password = self.password\n if !current_user && !current_password\n @userinfo = nil\n elsif current_user && current_password\n @userinfo = \"#{current_user}:#{current_password}\"\n elsif current_user && !current_password\n @userinfo = \"#{current_user}\"\n end\n end\n return @userinfo\n end", "title": "" }, { "docid": "174987dff88a56436c671e27ea4bc3c9", "score": "0.66510624", "text": "def get_user_info(openid)\n params = {}\n params.update(openid: openid)\n res = get(\"user/info\",params)\n return MultiJson.load(res.body)\n end", "title": "" }, { "docid": "80bcc35ef919a7d4272eaeba6fbba076", "score": "0.66485876", "text": "def profile\n get_request(\"/1.0/user\")\n end", "title": "" }, { "docid": "3f89ac2f2eab26f54c9b50246e58f367", "score": "0.6642573", "text": "def user(user_id=nil)\n user_id ||= username\n connection.get(\"/users/#{user_id}\").body\n end", "title": "" }, { "docid": "33a827fd56b8e1fe01f7d2b8f7b05377", "score": "0.66314226", "text": "def get_user_info(bearer) \n return get_info(bearer, \"v2/my/info\")\n end", "title": "" }, { "docid": "c2110b7259ceb4689b69738c7a70f503", "score": "0.66298443", "text": "def get_user_info(atoken)\n begin\n response = atoken.get(api_url(\"account/verify_credentials.json\"))\n return JSON.parse(response.body)\n rescue Exception => err\n logger.error(\"Request failed: #{err.message}\")\n return {}\n end\n end", "title": "" }, { "docid": "d75ac4df0305ef9ade99b47deaa35dd2", "score": "0.6628805", "text": "def user_info(object_id = nil)\n user = object_id.nil? ? self.caller : users.select { |u| u.object_id == object_id.to_i }.first\n user_object(user)\n end", "title": "" }, { "docid": "294a247ddf3ba9f71bd95c070223b04e", "score": "0.6627023", "text": "def getLoggedInUser( )\n\n # parameter TypeCheck\n\n # BIMserver request\n request( { } )\n end", "title": "" }, { "docid": "91978302b7eb72362e61ad0bf03e0ad4", "score": "0.66242343", "text": "def user_email\n return @user_email\n end", "title": "" }, { "docid": "91978302b7eb72362e61ad0bf03e0ad4", "score": "0.66242343", "text": "def user_email\n return @user_email\n end", "title": "" }, { "docid": "91978302b7eb72362e61ad0bf03e0ad4", "score": "0.66242343", "text": "def user_email\n return @user_email\n end", "title": "" }, { "docid": "eb349d9cf025fd13c7afd975ffb664e7", "score": "0.6615151", "text": "def get_user_info (handle)\n\t\tbase = 'http://codeforces.com/api/user.info?handles='\n\t\turl = base + handle.to_s\n\t\treturn call_api(url)\n\tend", "title": "" }, { "docid": "d30e74607055b32d333efba1761736e7", "score": "0.6610263", "text": "def users_info\n get_response(base_url, {request_type: :get}, api_params )\n end", "title": "" }, { "docid": "94e0c73b47532e0a955180fb9875bdea", "score": "0.66066015", "text": "def email\n @user ||= User.find(self.user_id)\n @user.email \n end", "title": "" }, { "docid": "7f2df75ee16b566fa383b3ebf60eb240", "score": "0.6599617", "text": "def get_user(user_id)\n request(:get_user, user_id)\n end", "title": "" }, { "docid": "843c12bc23c6dbae22e2edb13bfd4048", "score": "0.6597185", "text": "def show\n {\n id: @current_user.id,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n email: @current_user.email\n }\n end", "title": "" }, { "docid": "6298c11dd0fd0f67eff6ce11d76eca29", "score": "0.6595598", "text": "def api_user(options = {})\n @api_user ||= api_client(options).info_user\n unless @api_user.present?\n raise MissingUserData\n end\n @api_user\n end", "title": "" }, { "docid": "76b55a1bc336d2d1980efc4f0f7727a8", "score": "0.6595007", "text": "def user_info(request)\n hash = call_api_json_service(\"/api/auth/userinfo\", to_hash(request))\n\n Authlete::Model::Response::UserInfoResponse.new(hash)\n end", "title": "" }, { "docid": "4497ee542e6facd90820958785371a76", "score": "0.65943646", "text": "def users_info(options = {})\n raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?\n options = options.merge(user: users_id(options)['user']['id']) if options[:user]\n post('users.info', options)\n end", "title": "" }, { "docid": "546848d1fb4ae17f4d0a0a72bc27fdec", "score": "0.6581078", "text": "def get_email\n if ipi = self.ipi\n if user = ipi.user\n return user.email\n end\n else\n return self.email\n end\n end", "title": "" }, { "docid": "22cd8fb55a0332795ea365c39d49f2c7", "score": "0.6580821", "text": "def user!\n u = user\n u.info!\n u\n end", "title": "" }, { "docid": "1fa340328c780cc7bc2a4bc7079f2724", "score": "0.65801543", "text": "def fetch_user_details\n get('users/list')\n end", "title": "" }, { "docid": "cadca9adb97e5a322e5c22aebc6bff42", "score": "0.6576128", "text": "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['name']\n end", "title": "" }, { "docid": "cadca9adb97e5a322e5c22aebc6bff42", "score": "0.6576128", "text": "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['name']\n end", "title": "" } ]
3efff74eb3bf7d0b1f7f08919a6fa298
GET /pages GET /pages.xml
[ { "docid": "0d9c991642c636d83506683276e4af5e", "score": "0.0", "text": "def index\n @documents = Document.paginate_by_date(params[:year], params[:month], params[:day], params[:page])\n @documents_by_date = @documents.group_by(&:date)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" } ]
[ { "docid": "343ecaae5f333ae724bf4a4693caeab1", "score": "0.73507947", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "8b8502c5082d7c9c685830d8efcc662a", "score": "0.7321559", "text": "def index\n @pages = Page.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "1310f5a1756926cc8e891d7fc01c6220", "score": "0.7300898", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "cad9867d357fea53faf3684a2d969f97", "score": "0.72267026", "text": "def index\n @pages = Page.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @pages.to_xml }\n end\n end", "title": "" }, { "docid": "c08150218d2652631914646e2d10b489", "score": "0.71729004", "text": "def show\n @pages = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "f60aa9c6670e60ce6f08f8444d354403", "score": "0.7102045", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "3a5c9be35fddd3e536378d18f24783a2", "score": "0.70562524", "text": "def index\n @nodes = @nodes.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "title": "" }, { "docid": "cdef741e45c57ab59bf2c8dc74ac9e7e", "score": "0.6967433", "text": "def index\n @sites = Site.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "title": "" }, { "docid": "7dccc1ff2c53a87915097076000027db", "score": "0.69658875", "text": "def pages\n self.list(:pages)\n end", "title": "" }, { "docid": "c92ffa594d4ca6742cb211f75425979e", "score": "0.69279", "text": "def index\n @parsers = Parser.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @parsers }\n end\n end", "title": "" }, { "docid": "102376c1ab79802c0df72fb4a8c08875", "score": "0.6925644", "text": "def index\n @pages = Page.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @pages.to_json }\n format.xml { render :xml => @pages.to_xml }\n end\n end", "title": "" }, { "docid": "4969534c48ddd87b12a9cd1696256d0b", "score": "0.6901571", "text": "def index\n @pages = Page.find(:all, :order => :position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "371d1e7b5bff2d1aa522b38e986ca1f1", "score": "0.6815163", "text": "def index\n @pages = @pad.pages\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "f1d878177d772a03f8299af5d8aab169", "score": "0.67812306", "text": "def show\n @course = Course.find(params[:id])\n @pages = @course.pages\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "33edd7f62695539a9e24733bdfc1f2b3", "score": "0.6748568", "text": "def index\n @page_contents = PageContent.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page_contents }\n end\n end", "title": "" }, { "docid": "b9fbe00b473efedf377922403a37687e", "score": "0.67404574", "text": "def index\n @pages = current_site.pages.without_type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "9dea56d53edaa36d36aca90617025b8c", "score": "0.67392963", "text": "def index\n @information_pages = InformationPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @information_pages }\n end\n end", "title": "" }, { "docid": "62f6aa402daa8d188b829fd082ece33a", "score": "0.6733708", "text": "def index\n @pages = Page.directory_sorted\n @tree = Page.tree\n\n standard_response @pages\n end", "title": "" }, { "docid": "62cf4ccc9c1c5e629b229ff4d9901f23", "score": "0.67050636", "text": "def index\n @pages = Page.paginate(\n :page => params[:page], \n :per_page => APPLICATION_CONFIG[:pages_per_page] || 5\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "7aad1254ae51a4699ba8d9b5e8a1a4cb", "score": "0.66964054", "text": "def pages\n end", "title": "" }, { "docid": "7aad1254ae51a4699ba8d9b5e8a1a4cb", "score": "0.66964054", "text": "def pages\n end", "title": "" }, { "docid": "a444d14ab410c1421270d37034dfe868", "score": "0.6672135", "text": "def index\n\n @pages = Page.find(:all)\n \n respond_to do |format|\n format.html { render :layout => 'stockyard'}\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "03a2dd10f5091fb8cc5b78520a29a09b", "score": "0.66451657", "text": "def index\n @pages = Page.all\n respond_with @pages\n end", "title": "" }, { "docid": "fd4657927d48696db39cd2797e9db4c1", "score": "0.66149086", "text": "def index\n page = params[:page] || 1\n @books = Book.page(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end", "title": "" }, { "docid": "d173002766d9dae0b43090e89627434b", "score": "0.6596041", "text": "def index\n @section = Section.find(params[:section_id])\n @pages = @section.pages.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "cda65aec1a8c829ab75b1d17997f4a03", "score": "0.6591646", "text": "def show\n project_id = params.permit(:id)[:id]\n base_url = \"https://vipul.mingle.thoughtworks.com\"\n pages_url = \"/api/v2/projects/#{project_id}/wiki.xml\"\n response = get_response(base_url + pages_url)\n response_body = Crack::XML.parse(response.body)[\"pages\"]\n @pages = response_body.collect {|a| {:identifier => a[\"identifier\"], :name => a[\"name\"] } }\n render :json => @pages\n end", "title": "" }, { "docid": "adbad6434d1fd5b540523701319ddc85", "score": "0.65827125", "text": "def index\n #@pages = Page.all\n @slogan = t(:slogan_home)\n @title = t(\"Home\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "4a1c69e5b6f8b0b3f0750ff925324237", "score": "0.6579635", "text": "def pages\n respond_to do |format|\n format.html do\n render \"pages/#{params[:page_name]}\"\n end\n end\n end", "title": "" }, { "docid": "9254afc59c73f1fcbd4cf8f27ca70f0b", "score": "0.65758026", "text": "def index\r\n page = 1\r\n if params.has_key?(:page)\r\n page = params[:page]\r\n end\r\n\r\n @content_pages = ContentPage.display_all_by_page(page)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @content_pages }\r\n end\r\n end", "title": "" }, { "docid": "ae4778c64e362d493981efb8ccf3ffb7", "score": "0.6563868", "text": "def index\n @pages = Page.all\n respond_to do |format|\n format.html\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "d6ac6e87b4333fa135d4ad750efaa04b", "score": "0.6560078", "text": "def index\n @page = Page.find(params[:page_id])\n @page_sections = @page.page_sections.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page_sections }\n end\n end", "title": "" }, { "docid": "f96de1a2185d795ddbe27bc109d9e7d9", "score": "0.6558736", "text": "def index\n @pages = Page.all\n respond_with(@pages)\n end", "title": "" }, { "docid": "decc307794b0fe8f876eb18ac9e9a437", "score": "0.6546425", "text": "def index\n @pages = Page.roots.order(\"title\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "a74314229a59d6c6851a86d9c4b698fd", "score": "0.6535655", "text": "def index\n\n @pages = Page.with_permissions_to(:index).find(:all, :order => :menu_order)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "93c5c18f178c2ba7985de96e58760422", "score": "0.65353435", "text": "def show\n @page = Page.find(params[:id])\n @pages = Page.find(params[:id]).pages\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @page }\n end\n end", "title": "" }, { "docid": "75afcf2f27365fc5f8ae89a3a72c8989", "score": "0.65323246", "text": "def index\n @static_pages = StaticPage.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @static_pages }\n end\n end", "title": "" }, { "docid": "54b68b9dbd0a3d9287eabcac1edf3e7a", "score": "0.6531964", "text": "def index\n session[:return_to] = request.request_uri \n @docs = Document.all_recent_by_page(params[:page_id]) \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end", "title": "" }, { "docid": "05011f838cd5a2abc9037afb555a3daa", "score": "0.6526393", "text": "def index\n # Show list of all pages\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "e6f18b57fe7e14cb9bb4beddc9fff8f4", "score": "0.6518679", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end", "title": "" }, { "docid": "e6f18b57fe7e14cb9bb4beddc9fff8f4", "score": "0.6518679", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end", "title": "" }, { "docid": "cd38a48d5b31d1b15d4744fc9c941017", "score": "0.6513241", "text": "def index\n @link_pages = LinkPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @link_pages }\n end\n end", "title": "" }, { "docid": "ea2a07b89af2e274b608f38f6e1b2624", "score": "0.65104175", "text": "def index\n return_pages\n end", "title": "" }, { "docid": "60505a07031effa1caa6d508bbbcaaf6", "score": "0.65072876", "text": "def index\n\t\t@pages = Page.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json\t{ render json: @pages }\n\t\tend\n\tend", "title": "" }, { "docid": "e174697553ec9b6c278d356f4f54e6e8", "score": "0.65044254", "text": "def index\n @jivepages = Jivepage.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jivepages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0698572fe3a463d469c7707c6a3c21ba", "score": "0.6500694", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "8201581191756efcffe3ca47e78f3344", "score": "0.6492188", "text": "def index\n @pages = Page.order(\"updated_at DESC\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end", "title": "" }, { "docid": "c4104f6452e9cd541b4ab8feea7ae8c3", "score": "0.64800316", "text": "def index\n @structures = @structures.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @structures }\n end\n end", "title": "" }, { "docid": "4728b8488a090e1072c925bf0ae2f3b2", "score": "0.64746547", "text": "def published\n @pages = Page.published.order(\"published_on desc\")\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end", "title": "" }, { "docid": "f22917587660ff69f20073d472bb07fe", "score": "0.6462597", "text": "def pages; end", "title": "" }, { "docid": "f22917587660ff69f20073d472bb07fe", "score": "0.6462597", "text": "def pages; end", "title": "" }, { "docid": "a6693ed9dcf15e26f11cec7920365f33", "score": "0.6459567", "text": "def new\n @pages = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "8d8deab4e42a47d99fca10f4b34f14d8", "score": "0.64590484", "text": "def get_pages\n @page ||= get_request('/me/accounts')['data']\n end", "title": "" }, { "docid": "639ed5a848234ea07bee034c2897c739", "score": "0.64325535", "text": "def index\n @pages = Page.all\n render json: @pages, status: 200\n end", "title": "" }, { "docid": "cca00c24794b688279065428c2917174", "score": "0.6431637", "text": "def index\n\n getsUserBasicInfo(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "title": "" }, { "docid": "939b0b4eaf5ca43158c84f04991519ca", "score": "0.6420998", "text": "def index\n @pages = Page.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end", "title": "" }, { "docid": "ce1db4468d818f7ce80ef83d4bdc4523", "score": "0.64206386", "text": "def index\n @pages = ::Cms::Page.all\n end", "title": "" }, { "docid": "8fe21efae4b1e75f2e091b3cdb8fc3a1", "score": "0.6410699", "text": "def show\n @page = current_site.pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "title": "" }, { "docid": "3328941eb858528bd919ef71bc96639c", "score": "0.6409177", "text": "def show\n @pages = Pages.find(params[:id])\n\n render json: @pages\n end", "title": "" }, { "docid": "15b84eb0dee37789b6e47b7a1217585a", "score": "0.63616234", "text": "def show\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @page.to_xml }\n end\n end", "title": "" }, { "docid": "4e3eb0f0790171f50afd57a3fddc60c4", "score": "0.63601536", "text": "def index\n respond_with Page.all\n end", "title": "" }, { "docid": "9cdcc85746095bb1a927f1bc16ff0a75", "score": "0.6349892", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "title": "" }, { "docid": "45cb7bab05115e8b4831304be5150e81", "score": "0.63479215", "text": "def get_pages\n\t\t@pages = Page.find_main\n\tend", "title": "" }, { "docid": "3052d44353954c680baffa72a6747560", "score": "0.63447946", "text": "def index\n @pages = Page.find(:all)\n end", "title": "" }, { "docid": "3052d44353954c680baffa72a6747560", "score": "0.63447946", "text": "def index\n @pages = Page.find(:all)\n end", "title": "" }, { "docid": "db835c2dcfa56930a8a0287a1a643bcb", "score": "0.63430494", "text": "def index\n @pages = current_user.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @pages }\n end\n end", "title": "" }, { "docid": "dcacf4733098e57b0b78cc4918c8b21c", "score": "0.63400894", "text": "def index\n @categories = @categories.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end", "title": "" }, { "docid": "2bdccfb4d19e17d449464825e8b97bba", "score": "0.63379025", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "title": "" }, { "docid": "3480c46f171e47c5585bde50109827ed", "score": "0.6330321", "text": "def show\n if @page = Page.find_by_id(params[:id])\n @page = Page.find(params[:id])\n end\n respond_to do |format|\n format.json {render json: @page}\n format.xml {render xml: @page}\n end\n\n end", "title": "" }, { "docid": "5453c95063b9b5801665b86e14cacb70", "score": "0.63202995", "text": "def pages\n @pages\n end", "title": "" }, { "docid": "50efdf43bf99856cdddfaaa51ae8d81c", "score": "0.6304234", "text": "def index\n @pages = Page.all\n display @pages\n end", "title": "" }, { "docid": "3eed23e4e1536929ce1cde2bec43cd58", "score": "0.62999123", "text": "def get(*args)\n arguments(args, required: [:owner, :repo])\n\n get_request(\"/repos/#{arguments.owner}/#{arguments.repo}/pages\", arguments.params)\n end", "title": "" }, { "docid": "7f27c2448668e01ee254cbf541dd19a8", "score": "0.6298559", "text": "def index\n @page_texts = PageText.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page_texts }\n end\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "cdebd5d838c58e3241818b36c33bb208", "score": "0.6291376", "text": "def index\n @pages = Page.all\n end", "title": "" }, { "docid": "0d5613077b028fac885591800ee4e229", "score": "0.6291336", "text": "def index\n @versions = @page.versions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @versions }\n end\n end", "title": "" } ]
0ae6173328475ec5a8055fff45860718
Returns spec by label and remove unnecessary
[ { "docid": "08428cb7a470e82a3c059b062744d8bf", "score": "0.63532263", "text": "def spec(label)\n nbsp = Nokogiri::HTML('&nbsp;').text\n @specs.row(label)[1].text.gsub(nbsp, ' ')\n end", "title": "" } ]
[ { "docid": "82be1fb2872f3523b00894a3d6aa96ac", "score": "0.5514073", "text": "def by_label\n @by_label ||= notes.group_by(&:label)\n end", "title": "" }, { "docid": "711567140c85ee5a39def4ff94ae18dd", "score": "0.5406687", "text": "def labeled_measurements(label)\n # Need *all* for the tests to pass (to work for both saved and unsaved)\n Rails.env.test? ? self.measurements.all.select { |m| label == m.label } : self.measurements.select { |m| label == m.label }\n end", "title": "" }, { "docid": "36e88e99aa39553809b02a5421e89552", "score": "0.54055786", "text": "def remove_spec(full_name); end", "title": "" }, { "docid": "0f46d4936d973a9ec33c6e8ee87aaed7", "score": "0.5384424", "text": "def by_label(label:)\n @indexed_data_items.fetch(label, nil)\n end", "title": "" }, { "docid": "8e75fcd9d23c0b8d270279965b67ca6a", "score": "0.53683263", "text": "def tag_labels\n metadata\n .reject { |k| RSPEC_IGNORED_METADATA.include?(k) || special_metadata_tag?(k) }\n .filter_map { |k, v| custom_label(k, v) }\n end", "title": "" }, { "docid": "943486ff9afdd120dc46d5d5e55d1d0d", "score": "0.53677994", "text": "def label_without_wildcard_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_with_wildcard_to_list, problems csv has not been read\") end\n if $label_to_num.has_key?(label) then \n return [$label_to_num[label] + [parts]]\n else\n $stderr.print \"warning: name #{label} not found in problems.csv; possibly you need to do a make book, which automatically updates problems.csv if you have a new problem\\n\"\n return []\n end\nend", "title": "" }, { "docid": "b34fb20cc8ba6d3d1d3cd35cd7ebfe96", "score": "0.53225297", "text": "def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end", "title": "" }, { "docid": "f9f7e287f27aca034b284cc24e9b00ec", "score": "0.53087366", "text": "def drop_one!(label)\n i = self.labels.index(label)\n return nil unless i\n self.items.each do |item|\n item.delete_at(i)\n end\n self.labels.delete_at(i)\n self\n end", "title": "" }, { "docid": "b51883a3f21e1f4f910f8dd4bcb0413b", "score": "0.5272051", "text": "def prune_labels!\n pruned_labels = all_labels.reject do |l|\n query = Whistlepig::Query.new \"body\", \"~#{l}\"\n @index.setup_query query\n docids = begin\n @index.run_query query, 1\n ensure\n @index.teardown_query query\n end\n\n docids.empty?\n end\n\n write_set \"labellist\", pruned_labels\n end", "title": "" }, { "docid": "1ed0d360fd36e33a8ca1514b90ad8c0c", "score": "0.5163802", "text": "def delete_label(name)\n @labels.delete(name.to_sym)\n end", "title": "" }, { "docid": "ad0447e1f5cba530454c6faa427ddd7f", "score": "0.5151455", "text": "def remove_text_label\n\t\t$tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.p.className(create_ats_regex_string(\"ats-removetxtlbl\")), format_method(__method__))\n\tend", "title": "" }, { "docid": "236d97c76a3de76e1b9beb4295c7e855", "score": "0.5151158", "text": "def remove_label!( n )\n save if remove_label( n )\n end", "title": "" }, { "docid": "9cd1f22dc0a39ddcd2846007e065c0a2", "score": "0.5131104", "text": "def remove_labels(*labels)\n labels.inject(query_as(:n)) do |query, label|\n query.remove(\"n:`#{label}`\")\n end.exec\n labels.each(&@_persisted_obj.labels.method(:delete))\n end", "title": "" }, { "docid": "4b48ec4f4f5cb6e10acf388977c78d87", "score": "0.5128723", "text": "def remove_label(fq_repo_name, issue_number, label)\n issue(fq_repo_name, issue_number).remove_label(label)\n end", "title": "" }, { "docid": "e411eb873ebc78f9b73fa5a8fac0b9a7", "score": "0.51285934", "text": "def untitled_labels\n Fe::Page.where(\"label like 'Page%'\").map {|s| s.label}\n end", "title": "" }, { "docid": "beb0d4fe2990141d76356cc08b0e54a1", "score": "0.51165044", "text": "def delete_label(name)\n label = get_object name\n\n raise 'The object is not a label' if label.object_type != :label\n\n object_store.remove name\n end", "title": "" }, { "docid": "4e037ad9674d18a712a16026708022b3", "score": "0.5112829", "text": "def remove_label(repo, number, label, options = {})\n delete \"#{Repository.path repo}/issues/#{number}/labels/#{label}\", options\n end", "title": "" }, { "docid": "a7c1774580f716e984b248c167a096fd", "score": "0.507005", "text": "def by_label\n labelled = Hash.new\n @tasks.each { |t|\n t.label.each { |t_label|\n unless labelled.include? t_label\n labelled[t_label] = []\n end\n unless t_label.nil?\n labelled[t_label] << t\n end\n }\n }\n labelled\n end", "title": "" }, { "docid": "0a9f35108f1e29bcc0485be6954b9b08", "score": "0.50604963", "text": "def remove_labels(hash, labels)\n self.torrents[hash].remove_labels(labels)\n @server.call('d.set_custom1', hash, self.torrents[hash].labels_str)\n end", "title": "" }, { "docid": "777b5018d7328e149d92cad6460f796c", "score": "0.5051944", "text": "def remove_label(label, number)\n label 'remove', label, number\n end", "title": "" }, { "docid": "3f4644db6f938b4a765334c7ec84b2bb", "score": "0.5033226", "text": "def remove_label(label)\n @api.do_request(\"DELETE\", label.get_base_api_path() + \"/messages/\" + get('id'))\n if @label_ids_set.has_key?(label.id)\n @label_ids_set.delete(label.id)\n end\n end", "title": "" }, { "docid": "3f4644db6f938b4a765334c7ec84b2bb", "score": "0.5033226", "text": "def remove_label(label)\n @api.do_request(\"DELETE\", label.get_base_api_path() + \"/messages/\" + get('id'))\n if @label_ids_set.has_key?(label.id)\n @label_ids_set.delete(label.id)\n end\n end", "title": "" }, { "docid": "6e14f21099b8fcbad345e0f257cad830", "score": "0.50194955", "text": "def symbol_for_label(name, instruction=nil)\n if (instruction)\n context = @inst_label_context[instruction]\n m = /^(\\/*)(.+)/.match(name)\n breadcrumb = context[0,m[1].length]\n breadcrumb << m[2]\n qual_name = breadcrumb.join('/')\n else\n qual_name = name\n end\n \n if (not @symbols[qual_name])\n @symbols[name] = {:label => AS::LabelObject.new, :linkage => ELF::STB_LOCAL, :name => qual_name}\n end\n @symbols[qual_name]\n end", "title": "" }, { "docid": "3048e5fd8682033b0344771007e10a82", "score": "0.5012027", "text": "def sanitize_label(label); end", "title": "" }, { "docid": "28bf727266807c2b49e94e9186e26c44", "score": "0.50054103", "text": "def get_labels_from_suite_and_case(suite_labels, case_labels)\n [suite_labels, case_labels].flatten.compact.uniq\n end", "title": "" }, { "docid": "f82547a9f8085d72b0e2bd848bcf2b6f", "score": "0.5001124", "text": "def labeled(label)\n wrap(\n @inner.select do |event|\n event['event'] == 'labeled' &&\n event['label'].name.downcase == label.downcase\n end,\n )\n end", "title": "" }, { "docid": "82a86fb1bbfe77787a2c8c89e760afeb", "score": "0.49940383", "text": "def ensure_label(repository, label)\n mappings = label.fetch(\"mappings\") { [] }\n all = github.labels(repository)\n\n if label[\"delete\"]\n puts \" Deleted label: '#{label['name']}'\" if github.delete_label!(repository, label[\"name\"])\n return\n end\n\n current = all.select { |cur| cur[:name] == label[\"name\"] }.first\n if current.nil?\n github.add_label(repository, label[\"name\"], label[\"color\"], description: label[\"description\"])\n puts \" Successfully added label\"\n else\n unless current[:color] == label[\"color\"]\n github.update_label(repository, label[\"name\"], color: label[\"color\"])\n puts \" Updated color for #{label['name']}\"\n end\n\n unless label[\"description\"].nil? || current[:description] == label[\"description\"]\n github.update_label(repository, label[\"name\"], description: label[\"description\"])\n puts \" Updated description for #{label['name']}\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:name] == previous }\n puts \"Working on #{previous} mapping for #{label['name']}\"\n count = 0\n issues_with(repository, \"label\", previous) do |issue|\n puts \" Updating issue #{issue}\"\n puts \" Adding label: '#{label['name']}'\"\n github.add_labels_to_an_issue(repository, issue, [label[\"name\"]])\n puts \" Removing label '#{previous}'\"\n github.remove_label(repository, issue, previous)\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"label\", previous)\n if remaining.empty? || remaining.length == count\n puts \" Deleting label '#{previous}' from #{repository}\"\n github.delete_label!(repository, previous)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' label has no tickets assigned (or rerun this command in a few minutes time)\"\n end\n end\nend", "title": "" }, { "docid": "aba57ed9f8aed1058b653d9e4cd6a7e5", "score": "0.49718985", "text": "def ensure_label(repository, label)\n mappings = label.fetch(\"mappings\") {[]}\n all = github.labels(repository)\n\n if label[\"delete\"]\n puts \"Deleted label: '#{label['name']}'\"\n github.delete_label!(repository, label[\"name\"])\n return\n end\n\n current = all.select { |cur| cur[:name] == label[\"name\"]}.first\n if current.nil?\n github.add_label(repository, label[\"name\"], label[\"color\"])\n puts \"Successfully added label\"\n else\n unless current[:color] == label[\"color\"]\n github.update_label(repository, label[\"name\"], color: label[\"color\"])\n puts \"Updated color for #{label['name']}\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:name] == previous }\n puts \"Working on #{previous} mapping for #{label['name']}\"\n count = 0\n issues_with(repository, \"label\", previous) do |issue|\n puts \"Updating issue #{issue}\"\n puts \"Adding label: '#{label['name']}'\"\n github.add_labels_to_an_issue(repository, issue, [label[\"name\"]])\n puts \"Removing label '#{previous}'\"\n github.remove_label(repository, issue, previous)\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"label\", previous)\n if remaining.empty? || remaining.length == count\n puts \"Deleting label '#{previous}' from #{repository}\"\n github.delete_label!(repository, previous)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' label has no tickets assigned (or rerun this script in a few minutes time)\"\n end\n end\nend", "title": "" }, { "docid": "0d2621ae99d44c5869270295360318d6", "score": "0.49627516", "text": "def label name\n UnknownLabel.new(name)\n end", "title": "" }, { "docid": "df2d788b45b9265b8cd393ba05502b1a", "score": "0.4931093", "text": "def labels(label = nil)\n @labels ||= Hash.new{|h,k| h[k] = PolicyHelper.new }\n label.nil? ? @labels : @labels[label]\n end", "title": "" }, { "docid": "c4def47ff09280b293c44babbac342d5", "score": "0.492444", "text": "def remove_labels(labels)\n @repo ||= pr_json.base.repo.full_name\n @number ||= pr_json.number\n Array(labels).each do |label|\n api.remove_label(@repo, @number, label)\n end\n end", "title": "" }, { "docid": "30c11b61379e3ad884d20b11a01b0d4a", "score": "0.48984885", "text": "def labels_to_remove\n if params[:remove_labels].nil? || !params[:remove_labels].is_a?(Array) || params[:remove_labels].uniq.compact.empty?\n @labels_to_remove ||= []\n end\n\n @labels_to_remove ||= params[:remove_labels].uniq.compact\n end", "title": "" }, { "docid": "9204c779545776b637a996e405dcb39b", "score": "0.48708728", "text": "def get_tag_from_label(tag_label, reload = false)\n tag_label = DomainEnumerated.standardize_tag(tag_label)\n tag_id, tag = get_hash_tags(reload).detect { |id, tag| tag.label == tag_label }\n tag\n end", "title": "" }, { "docid": "958e2adfccff901fc1bf491cbefcdf36", "score": "0.4862381", "text": "def remove_spec(full_name)\n @gems.delete(full_name)\n end", "title": "" }, { "docid": "6b5ac3e9dd20ce8eeb5c05cb3ddedd70", "score": "0.485705", "text": "def get_label_summary(label)\n labels = get_labels_summary\n unless labels.nil?\n labels.results.find { |item| item.name == label }\n end\n end", "title": "" }, { "docid": "6ba8bbbfb1d67b7debc812d4e5a7de9e", "score": "0.48535007", "text": "def by_file_label\n @by_file_label ||= by_file.transform_values { |notes| notes.group_by(&:label) }\n end", "title": "" }, { "docid": "b4afb4f950de832b809b08582174702d", "score": "0.4850644", "text": "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "title": "" }, { "docid": "2712d81a551f670c160a45ab108e6e38", "score": "0.48503977", "text": "def process_removing_labels\n unless labels_to_remove.empty?\n (labels_to_remove & issue_labels).each {|label| unlabel_issue(label)}\n end\n end", "title": "" }, { "docid": "e64bd70f13f2ad0376ad304808abbb15", "score": "0.48393607", "text": "def remove_existing_label\n if existing_labels.include?(ENV['CURRY_SUCCESS_LABEL'])\n begin\n @octokit.remove_label(\n @repository.full_name,\n @pull_request.number,\n ENV['CURRY_SUCCESS_LABEL']\n )\n rescue Octokit::NotFound\n Rails.logger.info 'Octokit not found.'\n end\n end\n end", "title": "" }, { "docid": "129abec94f479083800d8a19eb73f4e6", "score": "0.48298883", "text": "def suite_labels\n SuiteLabels.new(example.example_group).fetch\n end", "title": "" }, { "docid": "100d2e75c31fa4735b772e1fa733290f", "score": "0.48040843", "text": "def label_specification\n { 'LabelFormatType' => 'COMMON2D',\n 'ImageType' => 'PNG',\n 'LabelStockType' => 'PAPER_4X6',\n :order! => ['LabelFormatType', 'ImageType', 'LabelStockType'] }\n end", "title": "" }, { "docid": "181d05e285e263d040262f6fc7865419", "score": "0.47766447", "text": "def by_label_file\n @by_label_file ||= by_label.transform_values { |notes| notes.group_by(&:file) }\n end", "title": "" }, { "docid": "608058d6c0e91c030ef76a650a9a7393", "score": "0.47659063", "text": "def normalize_labels(label_order, results)\n label_order.uniq.map do |k|\n label = \"#{k.tr('.', '').tr(':', '').strip}:\"\n if label != k\n results[label] = results[k]\n results.delete(k)\n end\n label\n end\n end", "title": "" }, { "docid": "bbf1ecdd9d9bb6666d9d5acc38fbfff7", "score": "0.47555622", "text": "def no_tags label\n return label.gsub(/\\<.+\\/?\\>/,'')\n end", "title": "" }, { "docid": "c36e8997894b91adaf6e766da8d23b03", "score": "0.47533277", "text": "def results_for (label)\n @results[label] || []\n end", "title": "" }, { "docid": "308db98952591cb27b8ddce55ceb765d", "score": "0.47480047", "text": "def revert_fixtures_identify\n def Fixtures.identify(label)\n label.to_s.hash.abs\n end\n end", "title": "" }, { "docid": "00abafd8b88a2957087a6a624e9bb5e6", "score": "0.47384408", "text": "def chkout_handling_options_label\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_handling_options_label, section.id(\"handling_options\").find.h3\n return ToolTag.new(section.id(\"handling_options\").find.h3, __method__, self)\n end", "title": "" }, { "docid": "4a7b1a7d807f20c372fcb09c8d0b0ecb", "score": "0.47217196", "text": "def find_label_ids_uncached(label_names)\n return [] if label_names.empty?\n\n group_labels = group_labels_for_root_namespace.where(title: label_names)\n project_labels = project_labels_for_root_namespace.where(title: label_names)\n\n Label\n .from_union([group_labels, project_labels], remove_duplicates: false)\n .reorder(nil)\n .pluck(:title, :id)\n .group_by(&:first)\n .values\n .map { |labels| labels.map(&:last) }\n end", "title": "" }, { "docid": "3b6554e9504a64ae4fd79d3289146f11", "score": "0.4707854", "text": "def found_labels\n found = get(\"title\").scan(/\\[(.*?)\\]/).map { |label_arr|\n label = label_arr[0].downcase\n label.to_sym\n }.select{ |label|\n LABEL_MAP.keys.include? label\n }\n end", "title": "" }, { "docid": "3835f27e1d4b72c822ba4e1be8e43d50", "score": "0.4704753", "text": "def remove(name)\n begin\n github.api.remove_label(repo, number, name)\n rescue Octokit::Error => e\n puts \"Error message: \\\"#{name}\\\" label is not existing.\"\n puts e\n end\n end", "title": "" }, { "docid": "2e136d52815ea4e4851d5821bc1fc442", "score": "0.4703215", "text": "def labels() = @labels ||= labels_hash", "title": "" }, { "docid": "77f275f26cfb3285b371d3b50d6eb537", "score": "0.4703146", "text": "def get_label(label_id)\n query_and_build \"labels/#{label_id}\"\n end", "title": "" }, { "docid": "61b2adcfaef94cf97afb9a34135da0b5", "score": "0.46985292", "text": "def method_missing(m, label = nil)\n name = m.to_s\n if ct = @contexts.last\n @labels[name] = if label\n label = if label.respond_to? :to_label\n label.to_label self\n else\n Label.new label.to_i\n end\n @dummies.delete_if do |n, lbl, *cts|\n if n == name and cts.include? ct.object_id\n lbl.reinitialize label\n true\n else\n false\n end\n end\n if ct.has_key? name\n ct[name].reinitialize label\n label.name = name\n else\n label.name = name\n ct[name] = label\n end\n if @autoexport\n export ct[name]\n else\n ct[name]\n end\n else\n ct[name]||= Label.dummy(name)\n end\n end\n end", "title": "" }, { "docid": "cb1c77c6d3b1264844ac3de44b1e5e5e", "score": "0.46972626", "text": "def unversioned_spec\n hash = to_spec_hash\n return nil if hash.values.compact.length <= 1\n if hash[:classifier]\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type]}:#{hash[:classifier]}:\"\n else\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type]}\"\n end\n end", "title": "" }, { "docid": "d223e5245fdf57e95fa81887f32123dc", "score": "0.46870705", "text": "def resolve_labels(g)\n g.map! { |a|\n # if input was foo|bar...|baz, where ... is wildcard, a looks like [\"foo/B\",\"bar.../AB\",\"baz\"]\n aa = [] # new version of a with labels and wildcards resolved\n a.each { |b|\n parts = ''\n if b=~/(.*)\\/(.*)/ then\n b,parts = [$1,$2]\n end\n aa = aa + label_to_list(b,parts) # label_to_list can return a list with >1 element if there's a wildcard, 0 elts if no match\n }\n if aa.length==0 then\n aa = [[-1,'','']]\n end # later code assumes not empty list\n aa\n }\n return g\nend", "title": "" }, { "docid": "ac3479cf68f70a4198cd9d0c1562e863", "score": "0.46799305", "text": "def remove_labels(*labels)\n Label.build_label_array(labels).each do |built_label|\n GitHub.remove_label(repo_name, number, built_label.name)\n end\n end", "title": "" }, { "docid": "6a3faed205e78b25a1017b1f5899ddc4", "score": "0.46777228", "text": "def name\n spec.name\n end", "title": "" }, { "docid": "acd37bf210e9e76141ad8eb28c89c7c1", "score": "0.46675256", "text": "def label\n elements.select { |e| e.respond_to?(:label) }.first.label\n end", "title": "" }, { "docid": "bdf51d2ef03ef2b3f6b228cd50f369ad", "score": "0.46669132", "text": "def disclaimers_label\n # unit_test_no_generate: disclaimers_label, div.className(create_ats_regex_string(\"ats-disclaimerslbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-disclaimerslbl\")), __method__)\n end", "title": "" }, { "docid": "82fbeca1aa7cb6f4556c7ef1107de827", "score": "0.4666334", "text": "def remove\n @issue.labels!(@issue.labels - grid)\n end", "title": "" }, { "docid": "d53950b7c3ef72d550d340d2c7a3a86f", "score": "0.46648398", "text": "def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end", "title": "" }, { "docid": "525ae26f8dcd4b286847cb81683fba24", "score": "0.46604145", "text": "def labeled\r\n attrs.fetch(:labeled, {})\r\n end", "title": "" }, { "docid": "4f472edb5573f796edf4e4f161733136", "score": "0.4659906", "text": "def remove_node\n cspsearchpath.delete(@label)\n end", "title": "" }, { "docid": "ac467f5b162eac34ba7a3c2566f62e7a", "score": "0.46572077", "text": "def label_with_wildcard_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_with_wildcard_to_list, problems csv has not been read\") end\n list = []\n l = label.clone\n l.gsub!(/\\.\\.\\./,\"__WILD__\")\n l = Regexp::quote(l) # escape - characters\n l.gsub!(/__WILD__/,\".*\")\n re = Regexp::new(\"\\\\A#{l}\\\\Z\")\n $label_to_num.each { |ll,value|\n if ll=~re then list.push(value + [parts]) end\n }\n if list.length==0 then fatal_error(\"pattern #{label}, containing wildcard ..., doesn't match any labels\") end\n return list\nend", "title": "" }, { "docid": "7d54ff78b82b048cb27d540b8daaa54e", "score": "0.4639854", "text": "def label\n @label || \"unknown\"\n end", "title": "" }, { "docid": "e1b007a69127ae008b92cf64b446c9e7", "score": "0.45847943", "text": "def finderlabels\n %w{ Image Title Description }\n end", "title": "" }, { "docid": "be0b0009b448ea32d19a83e6af6cd1c8", "score": "0.45811772", "text": "def remove(tags)\n Array(tags).each { |t| @message.remove_label(t) }\n return @message.labels\n end", "title": "" }, { "docid": "55eecb9fcc98a6b7db37be1134ae6b3a", "score": "0.45778307", "text": "def get_label_from_filters(filters)\n props = filters.properties\n return nil if props.empty?\n\n # filters.properties = [['label','Person'],['name','ilya']]\n idx = props.index{|p| p[0] == 'label'}\n props[idx][1] if idx\n end", "title": "" }, { "docid": "b22c051c69e440283d0843fd7408c383", "score": "0.45773172", "text": "def new_labels\n found_labels.map{ |label| LABEL_MAP[label] }\n end", "title": "" }, { "docid": "37d2aca02b9b5d6763eb87703f6bfae3", "score": "0.45736703", "text": "def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |key, field|\n if field.has_label?(label_name.to_sym)\n to_return[key] = field.human_name\n end\n end\n to_return\n end", "title": "" }, { "docid": "e84a19f36d5db96c272c8dac22a96aed", "score": "0.457157", "text": "def offering_with_short_label(short_label, term)\n course_offerings.where(short_label: short_label, term_id: term.id).first\n end", "title": "" }, { "docid": "a28b2d8fc11125c5e22392311b72379d", "score": "0.45680228", "text": "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "title": "" }, { "docid": "0004e3c59345c2874971c23dad695717", "score": "0.45613834", "text": "def label; end", "title": "" }, { "docid": "0004e3c59345c2874971c23dad695717", "score": "0.45613834", "text": "def label; end", "title": "" }, { "docid": "9b5a6f0b90c892b5ecc7de14d65f38b4", "score": "0.4552778", "text": "def update_label(payload)\n return unless payload[:label]\n label = Hubstats::Label.first_or_create(payload[:label])\n if payload[:github_action] == 'labeled'\n labels << label\n elsif payload[:github_action] == 'unlabeled'\n labels.delete(label)\n end\n labels\n end", "title": "" }, { "docid": "b4252823b7b1daa4ef881a0327484466", "score": "0.45490602", "text": "def drop!(*labels)\n labels.each do |label|\n drop_one!(label)\n end\n self\n end", "title": "" }, { "docid": "36d738c6cc75f17c5bf2f78d5bacdd6c", "score": "0.45381886", "text": "def remove_pet_by_name(pets, pet_to_remove)\n pets[:pets].delete_if { |name| name[:name] == pet_to_remove }\nend", "title": "" }, { "docid": "ce12f77dcdae2b068e2d91344143b4e1", "score": "0.45339972", "text": "def existing_labels\n @octokit.labels_for_issue(\n @repository.full_name,\n @pull_request.number\n ).map(&:name)\n end", "title": "" }, { "docid": "23a925f87799f6eff2765cb88a8f8670", "score": "0.45201817", "text": "def name label\n label(label)\n end", "title": "" }, { "docid": "4ecfb0474840c75e3b7dea480c429e5d", "score": "0.45176947", "text": "def specs_by_name\n specs_grouped_by_name(specs)\n end", "title": "" }, { "docid": "8466963c60691b114f975013f84d4883", "score": "0.45098156", "text": "def specs_with_name(name)\n matching_specs = @specs.select do |spec|\n spec[0].name == name\n end\n\n name_tuples = []\n matching_specs.each do |(name_tuple, _)|\n name_tuples << name_tuple\n end\n\n name_tuples\n end", "title": "" }, { "docid": "88a7fa386817f3fe42572f48a91bc489", "score": "0.4506833", "text": "def delete_label!(repo, label, options = {})\n boolean_from_response :delete, \"#{Repository.path repo}/labels/#{label}\", options\n end", "title": "" }, { "docid": "96f98216209000ce0b96693d9e774aec", "score": "0.45066094", "text": "def labels\n multi_value? ? label_ids.collect{|l_id| Label.find(l_id) } : []\n end", "title": "" }, { "docid": "f500a9ed8e6ee0ccf56f47b404a78f08", "score": "0.4498611", "text": "def extract_from_page(url, spec={})\n finders = spec[:finders] || all_finders\n if label = spec[:label] # Can specify either a single label or a set\n labels = ((label.class == Array) ? label : [label]).collect { |l| l.to_s }\n finders = finders.keep_if { |t| labels.include? t[:label] }\n else\n labels = SiteServices.data_choices\n end\n begin\n pagetags = PageTags.new(url, @site, finders, spec[:all], false)\n rescue\n puts \"Error: couldn't open page '#{url}' for analysis.\"\n return {}\n end\n results = {}\n # We've cracked the page for all tags. Now report them into the result\n labels.each do |label|\n if foundstr = pagetags.result_for(label)\n # Assuming the tag was fulfilled, there may be post-processing to do\n case label\n when \"Title\"\n # A title may produce both a title and a URL, conventionally separated by a tab\n titledata = foundstr.split('\\t')\n results[:URI] = titledata[1] if titledata[1]\n foundstr = trim_title titledata.first\n when \"Image\", \"URI\"\n # Make picture path absolute if it's not already\n foundstr = resolve foundstr\n end\n results[label.to_sym] = foundstr\n end\n end\n results\n end", "title": "" }, { "docid": "83305b0cf85a6bff3d140010599e7276", "score": "0.4495427", "text": "def labels\n inject_block(:name, :label)\n end", "title": "" }, { "docid": "f3a49d5a9eb5bdb2adc18821c469efcb", "score": "0.44923517", "text": "def name\n @spec.name\n end", "title": "" }, { "docid": "a8477b12aab2863e1a35d041d08bd86f", "score": "0.44902512", "text": "def inspec\n nil\n end", "title": "" }, { "docid": "4064f21504b7ed6c20177e0e2f328cba", "score": "0.44870692", "text": "def order_lookup_label\n #unit_test_no_generate: order_lookup_label, span.className(create_ats_regex_string(\"ats-ordrlkuplbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ordrlkuplbl\")), __method__)\n end", "title": "" }, { "docid": "3b9e1e9cf39f4a350a7f188db63c6374", "score": "0.44844323", "text": "def disclaimers_header_label\n # unit_test_no_generate: disclaimers_header_label, h2.className(create_ats_regex_string(\"ats-disclaimershdrlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(h2.className(create_ats_regex_string(\"ats-disclaimershdrlbl\")), __method__)\n end", "title": "" }, { "docid": "3216e9fd991ed8184e9d7932cc82379e", "score": "0.44737846", "text": "def remove_pet_by_name(pets, name)\n return pets[:pets].delete_if {|pets| name == name }\nend", "title": "" }, { "docid": "a336864757996acb474b0631fa6b8e2f", "score": "0.44726", "text": "def removeKitten(name, type)\n @kittencfg_semaphore.synchronize {\n _shortclass, _cfg_name, cfg_plural, _classname = MU::Cloud.getResourceNames(type)\n deletia = nil\n if @kittens[cfg_plural]\n @kittens[cfg_plural].each { |kitten|\n if kitten['name'] == name\n deletia = kitten\n break\n end\n }\n @kittens[type].delete(deletia) if !deletia.nil?\n end\n }\n end", "title": "" }, { "docid": "2da3275186092a30ff9b4973d19a6865", "score": "0.4471215", "text": "def relabel_stripwells stripwells\n show do \n title \"Relabel stripwells for stripwell rack arrangement\"\n note \"Place the stripwells in a green stripwell rack.\"\n note \"To wipe off old labels, use ethanol on a Kimwipe.\"\n warning \"Please follow each step carefully.\"\n stripwells.each_with_index do |s, i|\n note \"Grab stripwell #{s.id} (#{s.num_samples} wells). Wipe off the current ID. Label the first well #{i + 1}\"\n end\n end\n end", "title": "" }, { "docid": "7fb898ba7d9fdbcf76995aba624c8df3", "score": "0.44708377", "text": "def delete_labels\n initialize\n @client.labels(@targetRepo).each do |l|\n @client.delete_label!(@targetRepo, l.name)\n end\n end", "title": "" }, { "docid": "945dca0bd5fb8427d3bc1c9536e02097", "score": "0.446923", "text": "def label_with_id\n text_and_id( :label )\n end", "title": "" }, { "docid": "945dca0bd5fb8427d3bc1c9536e02097", "score": "0.446923", "text": "def label_with_id\n text_and_id( :label )\n end", "title": "" }, { "docid": "945dca0bd5fb8427d3bc1c9536e02097", "score": "0.446923", "text": "def label_with_id\n text_and_id( :label )\n end", "title": "" }, { "docid": "32f67fe3d8d76bd4055c6d94dbee37fd", "score": "0.4462642", "text": "def labels\n [label()]\n end", "title": "" }, { "docid": "34356edd7745d5788999302e7c11d62a", "score": "0.44609106", "text": "def get_patch descr\n @patches.each do |p|\n return p if descr == p.descr\n end\n end", "title": "" }, { "docid": "13364f483f36695e36c7449d2f980137", "score": "0.44507343", "text": "def merge_label(hash, test)\n hash['label'] = test.to_s.strip\n end", "title": "" }, { "docid": "6bad1760a8cc374bc02f1aea6ec55c36", "score": "0.4448338", "text": "def label_to_list(label,parts)\n if !problems_csv_has_been_read then fatal_error(\"in label_to_list, problems csv has not been read\") end\n unless label=~/\\A[a-zA-Z0-9\\-\\._]*\\Z/ then fatal_error(\"label #{label} contains illegal characters; legal ones are a-z, A-Z, 0-9, -, _\") end\n # ... don't allow characters that could be confused with regexp; but do allow -, which is regexp meta char\n # don't want confusion with regexps, because that's how we handle ... wildcard\n # --- for efficiency and clearer error messages, handle the no-wildcard case separately\n if label=~Regexp::new(Regexp::quote(\"...\")) then\n return label_with_wildcard_to_list(label,parts)\n else\n return label_without_wildcard_to_list(label,parts)\n end\nend", "title": "" } ]
a3c4e9a178d53d934c45a67e2db24785
Derive And Sync New Change Addresses Through this endpoint users can derive 100 change addresses, starting from the last index we have data for, which are then added to the xPub, subscribed for syncing, and start recording data. If no data is available, it will start from index 0.
[ { "docid": "2410d55fd4a53b966dc5198b08987940", "score": "0.52376115", "text": "def derive_and_sync_new_change_addresses_with_http_info(blockchain, network, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HDWalletsApi.derive_and_sync_new_change_addresses ...'\n end\n # verify the required parameter 'blockchain' is set\n if @api_client.config.client_side_validation && blockchain.nil?\n fail ArgumentError, \"Missing the required parameter 'blockchain' when calling HDWalletsApi.derive_and_sync_new_change_addresses\"\n end\n # verify enum value\n allowable_values = [\"bitcoin\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)\n fail ArgumentError, \"invalid value for \\\"blockchain\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'network' is set\n if @api_client.config.client_side_validation && network.nil?\n fail ArgumentError, \"Missing the required parameter 'network' when calling HDWalletsApi.derive_and_sync_new_change_addresses\"\n end\n # verify enum value\n allowable_values = [\"mainnet\", \"testnet\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(network)\n fail ArgumentError, \"invalid value for \\\"network\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/blockchain-data/{blockchain}/{network}/hd/derive-sync-change'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'context'] = opts[:'context'] if !opts[:'context'].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 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(opts[:'derive_and_sync_new_change_addresses_rb'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'DeriveAndSyncNewChangeAddressesR'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiKey']\n\n new_options = opts.merge(\n :operation => :\"HDWalletsApi.derive_and_sync_new_change_addresses\",\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: HDWalletsApi#derive_and_sync_new_change_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "54eef2c05b8f3ce651c1bbdedb03f8ff", "score": "0.568708", "text": "def expa_refresh\n people = nil\n SyncControl.new do |sync|\n sync.start_sync = DateTime.now\n sync.sync_type = 'open_people'\n\n setup_expa_api\n time = Time.new(2016,10,7,0,0,0)\n people = EXPA::People.list_everyone_created_after(time)\n people.each do |xp_person|\n if ExpaPerson.exist?(xp_person)\n xp_person = EXPA::People.find_by_id(xp_person.id)\n person = ExpaPerson.find_by_xp_id(xp_person.id)\n person = ExpaPerson.find_by_xp_email(xp_person.email) if person.nil?\n person.update_from_expa(xp_person)\n person.save\n else\n person = ExpaPerson.new\n person.update_from_expa(xp_person)\n person.save\n send_to_rd(person, nil, self.rd_identifiers[:open], nil)\n end\n end\n\n sync.get_error = false\n sync.count_itens = people.length\n sync.end_sync = DateTime.now\n sync.save\n end\n\n puts \"Listed #{people.length} people finishing #{Time.now}\"\n end", "title": "" }, { "docid": "32324fc24d183edbf5b835a8f35088db", "score": "0.5525957", "text": "def derive_and_sync_new_change_addresses(blockchain, network, opts = {})\n data, _status_code, _headers = derive_and_sync_new_change_addresses_with_http_info(blockchain, network, opts)\n data\n end", "title": "" }, { "docid": "9dba902427973d440002d1e1a4600707", "score": "0.5421653", "text": "def update_address_changes\n address_changes.create\n end", "title": "" }, { "docid": "10e8c35ddbeeba7c843141abdc2512a9", "score": "0.53874743", "text": "def assign_payment_addresses\n # if streamer.provided_own_key?(coin)\n # address = AddressGenerator.generate(coin, streamer.xpubkey(coin), counter)\n # # TODO\n # # add this address into our node as an watchonly address\n # address\n # else\n\n Coin.find_each do |coin|\n coin.payment_addresses.unused.first.update(donation: self)\n end\n # end\n end", "title": "" }, { "docid": "606df04d80c10b32f0ca957d9803bf28", "score": "0.5336403", "text": "def update_peers; end", "title": "" }, { "docid": "7ea8df47b4ff80692d0a9fbe7582742f", "score": "0.5235493", "text": "def addInitialSyncEvents()\n\n\t\t# SBAMM - id 0\n\t\tiTarget = 0\n\t\toRangeSettings = 0..42\n\t\tiChecksumA, iChecksumB = self.checksumForRange(iTarget, oRangeSettings)\n\n\t\tself.addEvent(SssSserialEvent.new(iTarget, SssSEventTypeRequestEEPROMchecksum, SssSEventStatusQued, oRangeSettings, iChecksumA, iChecksumB, SssSEventSyncPriorityRaspberryPi)) if SssSEMapp.oIOframeHandler.isOnlineEthernet?(iTarget)\n\n\t\t# SBAMFDDDs - ids 1..3\n\t\tfor iTarget in 1..3 do\n\n\t\t\tnext if !SssSEMapp.oIOframeHandler.isOnlineEthernet?(iTarget)\n\n\t\t\tiChecksumA, iChecksumB = self.checksumForRange(iTarget, oRangeSettings)\n\n\t\t\tself.addEvent(SssSserialEvent.new(iTarget, SssSEventTypeRequestEEPROMchecksum, SssSEventStatusQued, oRangeSettings, iChecksumA, iChecksumB, SssSEventSyncPriorityRaspberryPi))\n\n\t\t\t# as we are just looping the whole memory area we break it down to\n\t\t\t# max sized pages, we want to sync after all\n\t\t\tfor iPage in 0...SBEEPROMSamountOfPages do\n\t\t\t\toRangePage = self.rangeForFDDpage(iPage)\n\t\t\t\tiChecksumA, iChecksumB = self.checksumForRange(iTarget, oRangePage)\n\n\t\t\t\tself.addEvent(SssSserialEvent.new(iTarget, SssSEventTypeRequestEEPROMchecksum, SssSEventStatusQued, oRangePage, iChecksumA, iChecksumB, SssSEventSyncPriorityArduino))\n\n\t\t\tend # loop each page\n\n\t\t\t# TODO: also sync the middle memory area\n\n\t\tend # for loop FDDDs\n\n\tend", "title": "" }, { "docid": "4633c959f3718fad46432536cd015050", "score": "0.5177648", "text": "def work_addrs\n log.debug { \"addr worker running\" }\n @addrs.delete_if{|addr| !addr.alive? } if @addrs.size >= @config[:max][:addr]\n return if !@connections.any? || @config[:max][:connections] <= @connections.size\n connections = @connections.select(&:connected?)\n return unless connections.any?\n log.info { \"requesting addrs\" }\n connections.sample.send_getaddr\n end", "title": "" }, { "docid": "10155b59ccfd03474c20c2fb5ef0dd15", "score": "0.516262", "text": "def get_new_people_from_expa\n people = nil\n SyncControl.new do |sync|\n sync.start_sync = DateTime.now\n sync.sync_type = 'open_people'\n\n setup_expa_api\n time = SyncControl.get_last('open_people')\n time = Time.now - 60*60 if time.nil? # 1 hour windows\n people = EXPA::People.list_everyone_created_after(time)\n people.each do |xp_person|\n if ExpaPerson.exist?(xp_person)\n xp_person = EXPA::People.find_by_id(xp_person.id)\n person = ExpaPerson.find_by_xp_id(xp_person.id)\n person = ExpaPerson.find_by_xp_email(xp_person.email) if person.nil?\n person.update_from_expa(xp_person)\n person.save\n else\n person = ExpaPerson.new\n person.update_from_expa(xp_person)\n person.save\n send_to_rd(person, nil, self.rd_identifiers[:open], nil)\n end\n end\n\n sync.get_error = false\n sync.count_itens = people.length\n sync.end_sync = DateTime.now\n sync.save\n end\n\n puts \"Listed #{people.length} people finishing #{Time.now}\"\n end", "title": "" }, { "docid": "18c029457730d9b12a249a75bfaf5ddb", "score": "0.5118334", "text": "def on_market_data_incremental_refresh(msg)\n update_book_with(msg)\n end", "title": "" }, { "docid": "2abf8360051a0f4d5d5b0034bafe914e", "score": "0.50899184", "text": "def derive_and_sync_new_receiving_addresses(blockchain, network, opts = {})\n data, _status_code, _headers = derive_and_sync_new_receiving_addresses_with_http_info(blockchain, network, opts)\n data\n end", "title": "" }, { "docid": "1a13def12d227034783911bea09812d7", "score": "0.5064858", "text": "def receive_sync_data\n prepare_sync_request\n sync_notes if @requestedTrunks\n sync_notebooks if @requestedTrunks\n process_sync_data\n end", "title": "" }, { "docid": "c64375482ff81e057f3ab35edd4dd170", "score": "0.5033063", "text": "def populate_rep_data\n session = RR::Session.new\n initializer = RR::ReplicationInitializer.new session\n\n # step 1: clear change log; ensure trigger, initialize big_rep table from data in big_scan\n [:left, :right].each do |database|\n initializer.drop_trigger(database, 'big_rep') rescue nil\n session.send(database).execute \"delete from big_rep\"\n session.send(database).execute \"insert into big_rep select * from big_scan where diff_type = 'same'\"\n session.send(database).execute \"delete from rr_pending_changes\"\n initializer.create_trigger(database, 'big_rep')\n end\n\n # step 2: generate changes\n\n srand BIG_REP_SEED\n\n # Keep tracks of the record ids in each database\n all_ids = {}\n all_ids[:left] = session.left.select_all(\"select id from big_rep\").map {|row| row['id']}\n all_ids[:right] = all_ids[:left].clone\n\n # Next available id value\n next_id = session.left.select_one(\"select max(id) + 1 as id from big_rep\")['id'].to_i\n\n puts \"\\nGenerating #{BIG_REP_CHANGE_NUMBER} changes in big_rep\"\n progress_bar = ProgressBar.new BIG_REP_CHANGE_NUMBER\n (1..BIG_REP_CHANGE_NUMBER).each do\n\n # Updating progress bar\n progress_bar.step\n \n database = [:left, :right][rand(2)]\n\n case rand(100)\n when 0...BIG_REP_INSERT\n attributes = random_attributes\n attributes['diff_type'] = 'insert'\n attributes['id'] = next_id\n all_ids[database] << next_id\n next_id += 1\n session.send(database).insert_record 'big_rep', attributes\n when BIG_REP_INSERT...BIG_REP_UPDATE\n id = all_ids[database][rand(all_ids[database].size)]\n attributes = session.send(database).select_one(\"select * from big_rep where id = '#{id}'\")\n column = number_columns[rand(number_columns.size)]\n attributes[column] = rand(1000)\n session.send(database).update_record 'big_rep', attributes\n else\n i = rand(all_ids[database].size)\n id = all_ids[database].delete_at(i)\n session.send(database).delete_record 'big_rep', 'id' => id\n end\n end\n\n # step 3: move data into backup tables\n [:left, :right].each do |database|\n session.send(database).execute \"delete from big_rep_backup\"\n session.send(database).execute \"insert into big_rep_backup select * from big_rep\"\n session.send(database).drop_table \"big_rep_pending_changes\" rescue nil\n session.send(database).execute \"create table big_rep_pending_changes as select * from rr_pending_changes\"\n initializer.drop_trigger database, 'big_rep'\n session.send(database).execute \"delete from big_rep\"\n session.send(database).execute \"delete from rr_pending_changes\"\n end\nend", "title": "" }, { "docid": "b09d8f12a0036b9188ef93e5d340d7ed", "score": "0.5016818", "text": "def process_sync_data\n delete_expunged_data\n parse_incoming_data\n send_sync_data\n end", "title": "" }, { "docid": "10397f72e0b14965ccd1d708f48405a5", "score": "0.5003383", "text": "def get_new_people_from_expa\n job_status = true\n people = nil\n SyncControl.new do |sync|\n sync.start_sync = DateTime.now\n sync.sync_type = 'open_people'\n\n setup_expa_api\n time = SyncControl.get_last('open_people') || Time.now - 12*60*60 if time.nil? # 12 hour windows\n\n people = EXPA::People.list_everyone_created_after(time)\n\n people.each do |xp_person|\n if ExpaPerson.exist?(xp_person)\n xp_person = EXPA::People.find_by_id(xp_person.id)\n person = ExpaPerson.find_by_xp_id(xp_person.id)\n person = ExpaPerson.find_by_xp_email(xp_person.email) if person.nil?\n person.update_from_expa(xp_person)\n job_status = false unless person.save\n else\n person = ExpaPerson.new\n person.update_from_expa(xp_person)\n job_status = false unless person.save\n job_status = false unless send_to_rd(person, nil, self.rd_identifiers[:open], nil)\n end\n end\n\n sync.get_error = false\n sync.count_itens = people.length\n sync.end_sync = DateTime.now\n job_status = false unless sync.save\n end\n\n puts \"Listed #{people.length} people finishing #{Time.now}\"\n\n job_status\n end", "title": "" }, { "docid": "62454acf9c738504907175f77dda7a76", "score": "0.49710152", "text": "def derive_and_sync_new_receiving_addresses_with_http_info(blockchain, network, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HDWalletsApi.derive_and_sync_new_receiving_addresses ...'\n end\n # verify the required parameter 'blockchain' is set\n if @api_client.config.client_side_validation && blockchain.nil?\n fail ArgumentError, \"Missing the required parameter 'blockchain' when calling HDWalletsApi.derive_and_sync_new_receiving_addresses\"\n end\n # verify enum value\n allowable_values = [\"bitcoin\", \"ethereum\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)\n fail ArgumentError, \"invalid value for \\\"blockchain\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'network' is set\n if @api_client.config.client_side_validation && network.nil?\n fail ArgumentError, \"Missing the required parameter 'network' when calling HDWalletsApi.derive_and_sync_new_receiving_addresses\"\n end\n # verify enum value\n allowable_values = [\"mainnet\", \"testnet\", \"goerli\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(network)\n fail ArgumentError, \"invalid value for \\\"network\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/blockchain-data/{blockchain}/{network}/hd/derive-and-sync'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'context'] = opts[:'context'] if !opts[:'context'].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 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(opts[:'derive_and_sync_new_receiving_addresses_rb'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'DeriveAndSyncNewReceivingAddressesR'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiKey']\n\n new_options = opts.merge(\n :operation => :\"HDWalletsApi.derive_and_sync_new_receiving_addresses\",\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: HDWalletsApi#derive_and_sync_new_receiving_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6d78e448b47da13141d4cdeb43030c5f", "score": "0.4943413", "text": "def create_retrievals\n work_ids = Work.pluck(:id)\n existing_ids = RetrievalStatus.where(:source_id => id).pluck(:work_id)\n\n (0...work_ids.length).step(1000) do |offset|\n ids = work_ids[offset...offset + 1000] & existing_ids\n InsertRetrievalJob.perform_later(self, ids)\n end\n end", "title": "" }, { "docid": "5426d3e65f39d0471efe977959af8725", "score": "0.4933432", "text": "def run\n run_hook :before_run\n\n stats = Consyncful::Stats.new\n load_all_models\n\n sync = start_sync\n\n changed_ids = sync_items(sync, stats)\n\n drop_stale\n\n update_run(sync.next_sync_url)\n stats.print_stats\n\n run_hook :after_run, changed_ids\n end", "title": "" }, { "docid": "5d70316bb9273e70543e5bbcfe50d959", "score": "0.49327126", "text": "def append_records\n # counter is a container hold numbers of AxAccount instance.\n counter = []\n begin\n if counter.empty?\n counter << new(:ax_account_number => next_ax_account_number)\n else\n counter << new(:ax_account_number => next_ax_account_number(counter.last.ax_account_number))\n end\n \n account, addresses = counter.last.fetch_data\n counter.last.attributes = account\n addresses.each do |attr|\n counter.last.ax_account_addresses << AxAccountAddress.new(attr)\n end\n counter.each {|o| o.save }\n append_records # recursive invode mothod self\n rescue => ex\n puts ex.message if AppConfig.DEBUG_MODE\n retry unless counter.size == MAX_COUNTER\n end\n end", "title": "" }, { "docid": "13c0540861a2f36f057c5c49d917dd26", "score": "0.48899186", "text": "def send_phone_invitations\n if contact_numbers.present? && contact_numbers_changed?\n d1 = contact_numbers_was\n d1 = [] if d1.nil?\n new_contacts = contact_numbers - d1\n registered_numbers = User.where(phone_number: new_contacts).pluck(:phone_number)\n invited_phone_numbers = PhoneNumberInvitation.where(phone_number: new_contacts).pluck(:phone_number)\n new_contacts = new_contacts - registered_numbers - invited_phone_numbers\n InvitationSmsService.new(user, new_contacts).perform if new_contacts.present?\n end\n end", "title": "" }, { "docid": "11f90755edea725c40c657ea0228011a", "score": "0.48764008", "text": "def send_sync_data\n prepare_sync_response\n allClear = send_sync_response\n clean_up_bookkeeping if allClear\n end", "title": "" }, { "docid": "da56862182b454ac21704c8b985b06d7", "score": "0.48731852", "text": "def setup\n # back to 0 block.\n # @rpc.truncate(\"0x823b2ff5785b12da8b1363cac9a5cbe566d8b715a4311441b119c39a0367488c\")\n local_height = @api.get_tip_block_number\n # generate 5 blocks to enable the initial cells can be spent.\n\n # send gpc contract to the chain.\n # gpc_data = File.read(@path_to_binary + \"gpc\")\n # gpc_code_hash, gpc_tx_hash = deploy_contract(gpc_data)\n\n # puts \"gpc sent\"\n # sleep(10)\n # send udt contract to the chain.\n udt_data = File.read(@path_to_binary + \"simple_udt\")\n # udt_code_hash, udt_tx_hash = deploy_contract(udt_data)\n udt_code_hash = CKB::Blake2b.hexdigest(udt_data)\n puts \"udt sent\"\n # ensure the tx onchain.\n # tx_checked = [gpc_tx_hash, udt_tx_hash]\n # while true\n # remote_height = @api.get_tip_block_number\n # for i in (local_height + 1..remote_height)\n # block = @api.get_block_by_number(i)\n # for transaction in block.transactions\n # if tx_checked.include? transaction.hash\n # tx_checked.delete(transaction.hash)\n # end\n # end\n # end\n # break if tx_checked == []\n # end\n udt_tx_hash = \"0x63bb08c125c028c556789a1d6e095c89577ecb4d133d5e642c225bdbdc70ab29\"\n # disseminate udt.\n udt_dep = CKB::Types::CellDep.new(out_point: CKB::Types::OutPoint.new(tx_hash: udt_tx_hash, index: 0))\n\n tx = @wallet_A.generate_tx(@wallet_A.address, CKB::Utils.byte_to_shannon(2000), fee: 1000)\n tx.cell_deps.push(udt_dep.dup)\n # generate the udt type script.\n # set the args as the input lock to represent his is the owner, for more deteil, you can\n # have a look at the simple_udt.c.\n\n for input in tx.inputs\n cell = @api.get_live_cell(input.previous_output)\n next if cell.status != \"live\"\n input_lock = cell.cell.output.lock\n input_lock_ser = input_lock.compute_hash\n type_script = CKB::Types::Script.new(code_hash: udt_code_hash,\n args: input_lock_ser, hash_type: CKB::ScriptHashType::DATA)\n end\n\n # generate UDT amount.\n tx.outputs[0].type = type_script\n tx.outputs_data[0] = CKB::Utils.bin_to_hex([10000000].pack(\"Q<\"))\n\n signed_tx = tx.sign(@wallet_A.key)\n # root_udt_tx_hash = @api.send_transaction(signed_tx)\n # puts root_udt_tx_hash\n\n # system(\"rm #{@path_to_file}result.json\")\n # # system(\"rm #{@path_to_file}gpc.log\")\n # # record these info to json. So the gpc client can read them.\n # script_info = { gpc_code_hash: gpc_code_hash, gpc_tx_hash: gpc_tx_hash,\n # udt_code_hash: udt_code_hash, udt_tx_hash: udt_tx_hash,\n # type_script: type_script.to_h.to_json }\n # file = File.new(@path_to_file + \"contract_info.json\", \"w\")\n # file.syswrite(script_info.to_json)\n # file.close()\n\n puts \"done!\"\n end", "title": "" }, { "docid": "d18d3ce9ce47efbed292b32b579dd833", "score": "0.48476493", "text": "def persist_addrs addrs\n addr_txouts, new_addrs = [], []\n\n # find addresses that are already there\n existing_addr = {}\n addrs.each do |i, addr|\n hash160 = Bitcoin.hash160_from_address(addr)\n type = Bitcoin.address_type(addr)\n if existing = @db[:addr][hash160: hash160, type: ADDRESS_TYPES.index(type)]\n existing_addr[[hash160, type]] = existing[:id]\n end\n end\n\n # iterate over all txouts, grouped by hash160\n addrs.group_by {|_, a| a }.each do |addr, txouts|\n hash160 = Bitcoin.hash160_from_address(addr)\n type = Bitcoin.address_type(addr)\n\n if existing_id = existing_addr[[hash160, type]]\n # link each txout to existing address\n txouts.each {|id, _| addr_txouts << [existing_id, id] }\n else\n # collect new address/txout mapping\n new_addrs << [[hash160, type], txouts.map {|id, _| id }]\n end\n end\n\n # insert all new addresses\n new_addr_ids = fast_insert(:addr, new_addrs.map {|hash160_and_type, txout_id|\n hash160, type = *hash160_and_type\n { hash160: hash160, type: ADDRESS_TYPES.index(type) }\n }, return_ids: true)\n\n\n # link each new txout to the new addresses\n new_addr_ids.each.with_index do |addr_id, idx|\n new_addrs[idx][1].each do |txout_id|\n addr_txouts << [addr_id, txout_id]\n end\n end\n\n # insert addr/txout links\n fast_insert(:addr_txout, addr_txouts.map {|addr_id, txout_id| { addr_id: addr_id, txout_id: txout_id }})\n end", "title": "" }, { "docid": "860fb0de4aea5452a8179572c1a297e3", "score": "0.48456717", "text": "def request_saas_for_new_address\n\n r = SaasApi::WalletAddress::Generate.new.perform\n return r unless r.success?\n\n @new_known_address = r.data[:address].downcase\n @known_address_id = r.data[:known_address_id]\n\n\n success\n end", "title": "" }, { "docid": "12857b73802019d45934b4af0d31cf52", "score": "0.48430878", "text": "def main\n\n puts \"Configuring a default endpoint on port 5000...\"\n CgLookupClient::Entry.configure_endpoint\n\n puts \"Creating a new Entry instance...\"\n entry = CgLookupClient::Entry.new(\n {:type_name=>\"Notification\",\n :description=>\"Sinatra Notification Service\",\n :uri=>\"http://localhost:5100/\",\n :version=>\"1\"})\n\n puts \"Registering the new Entry without a callback block...\"\n entry.register\n\n puts \"Waiting a minute for the Entry to be renewed...\"\n sleep 60\n\n\n puts \"\\n\\nCreating a second Entry instance...\"\n entry = CgLookupClient::Entry.new(\n {:type_name=>\"Request\",\n :description=>\"Java Request Service\",\n :uri=>\"http://localhost:5200/\",\n :version=>\"1\"})\n\n puts \"Registering the second Entry with a callback...\"\n entry.register do |update|\n puts \"Entry ID: \" + update[:id].to_s\n puts \"Endpoint: \" + update[:endpoint].to_s\n puts \"Success: \" + update[:success].to_s\n puts \"Message: \" + update[:message].to_s\n end\n\n\n puts \"Waiting a minute for the Entry to be renewed...\"\n sleep 60\n\n\n puts \"\\n\\nLooking up Entries of type Notification.\"\n result = CgLookupClient::Entry.lookup(\"Notification\",\"1\")\n puts \"Got \" + result[:entry].to_s\n\n\n puts \"\\n\\nConfiguring a second endpoint on port 5001...\"\n endpoint = CgLookupClient::RestEndpoint.new(\"http://localhost:5001\",\"1\")\n CgLookupClient::Entry.configure_endpoint(endpoint)\n\n puts \"Waiting a minute for Entries to be registered on all endpoints...\"\n sleep 60\n\n loop do end\nend", "title": "" }, { "docid": "d668b601cf6650bb381557a84fd18b56", "score": "0.482963", "text": "def send_to_address(data)\n previous_transaction_hash = data[0]\n previous_transaction_vout = data[1]\n amount_to_pay = data[2]\n payee_address = data[3]\n\n previous_transaction_hex =\n $BITCOIN_RPC.getrawtransaction previous_transaction_hash\n previous_transaction =\n Bitcoin::Protocol::Tx.new(previous_transaction_hex.htb)\n\n previous_transaction_value =\n previous_transaction.out[previous_transaction_vout].value\n\n previous_address =\n previous_transaction\n .out[previous_transaction_vout]\n .parsed_script.get_address\n\n key = get_key(previous_address)\n\n change_amount = previous_transaction_value - amount_to_pay - TRANSACTION_FEE\n change_address = previous_address\n\n new_transaction = Bitcoin::Protocol::Tx.new\n\n transaction_input = Bitcoin::Protocol::TxIn.from_hex_hash(\n previous_transaction_hash, previous_transaction_vout\n )\n\n new_transaction.add_in(transaction_input)\n\n transaction_output_payee = Bitcoin::Protocol::TxOut.value_to_address(\n amount_to_pay, payee_address\n )\n\n new_transaction.add_out(transaction_output_payee)\n\n transaction_output_change = Bitcoin::Protocol::TxOut.value_to_address(\n change_amount, change_address\n )\n\n new_transaction.add_out(transaction_output_change)\n\n signature_hash = new_transaction.signature_hash_for_input(\n 0, previous_transaction, Bitcoin::Script::SIGHASH_TYPE[:all]\n )\n\n signature = key.sign(signature_hash)\n\n script_sig = Bitcoin::Script.to_signature_pubkey_script(\n signature, key.pub.htb, Bitcoin::Script::SIGHASH_TYPE[:all]\n )\n\n new_transaction.in[0].script_sig = script_sig\n\n # Code to verify input signature\n # verify_transaction = Bitcoin::Protocol::Tx.new(new_transaction.to_payload)\n # p ({verify: verify_transaction.verify_input_signature(0, previous_transaction)})\n\n transaction_id =\n $BITCOIN_RPC.sendrawtransaction new_transaction.to_payload.bth\n\n transaction_id\nend", "title": "" }, { "docid": "b2cc958e2dce3fea4426999c6805baec", "score": "0.48151", "text": "def touch_addresses\n if changes.include?(:bill_address_id) && self.bill_address.present?\n self.bill_address.touch\n end\n\n if changes.include?(:ship_address_id) && self.ship_address.present?\n self.ship_address.touch\n end\n end", "title": "" }, { "docid": "515956f91ad1e188c1b14c38303c75b8", "score": "0.4785084", "text": "def redeem_multisig_to_address(data)\n previous_transaction_hash = data[0]\n previous_transaction_vout = data[1]\n amount_to_pay = data[2]\n payee_address = data[3]\n\n previous_transaction_hex =\n $BITCOIN_RPC.getrawtransaction previous_transaction_hash\n\n previous_transaction =\n Bitcoin::Protocol::Tx.new(previous_transaction_hex.htb)\n\n previous_transaction_value =\n previous_transaction.out[previous_transaction_vout].value\n\n previous_addresses =\n previous_transaction\n .out[previous_transaction_vout].parsed_script.get_addresses\n\n min_signatures_required =\n previous_transaction\n .out[previous_transaction_vout].parsed_script.get_signatures_required\n\n # To create change multisig script\n previous_pubkeys = []\n\n # To sign the previous inputs\n previous_keys = []\n\n previous_addresses.each { |address|\n previous_key = get_key(address)\n previous_pubkeys << previous_key.pub\n previous_keys << previous_key\n }\n\n change_amount = previous_transaction_value - amount_to_pay - TRANSACTION_FEE\n change_pubkeys = previous_pubkeys\n\n change_multisig_script = Bitcoin::Script.to_multisig_script(\n min_signatures_required, *change_pubkeys\n )\n\n new_transaction = Bitcoin::Protocol::Tx.new\n\n transaction_input = Bitcoin::Protocol::TxIn.from_hex_hash(\n previous_transaction_hash, previous_transaction_vout\n )\n\n new_transaction.add_in(transaction_input)\n\n transaction_output_payee = Bitcoin::Protocol::TxOut.value_to_address(\n amount_to_pay, payee_address\n )\n\n new_transaction.add_out(transaction_output_payee)\n\n transaction_output_change = Bitcoin::Protocol::TxOut.new(\n change_amount, change_multisig_script\n )\n\n new_transaction.add_out(transaction_output_change)\n\n signature_hash = new_transaction.signature_hash_for_input(\n 0, previous_transaction, Bitcoin::Script::SIGHASH_TYPE[:all]\n )\n\n previous_keys = previous_keys.reverse()\n key = previous_keys.shift()\n\n signature = key.sign(signature_hash)\n partially_signed = Bitcoin::Script.to_multisig_script_sig(signature)\n\n signed_by_signatures = 1\n\n while signed_by_signatures < min_signatures_required\n\n key = previous_keys.shift()\n signature = key.sign(signature_hash)\n partially_signed = Bitcoin::Script.add_sig_to_multisig_script_sig(\n signature, partially_signed\n )\n signed_by_signatures += 1\n end\n\n script_sig = partially_signed\n\n new_transaction.in[0].script_sig = script_sig\n\n # Code to verify input signature\n # verify_transaction = Bitcoin::Protocol::Tx.new(new_transaction.to_payload)\n # p ({verify: verify_transaction.verify_input_signature(0, previous_transaction)})\n\n transaction_id =\n $BITCOIN_RPC.sendrawtransaction new_transaction.to_payload.bth\n transaction_id\nend", "title": "" }, { "docid": "10f3f97081cf18f35756ff1bed779079", "score": "0.47821262", "text": "def get_transactions(account)\n #http://localhost:4567/account/TYyi6KVer7sXUH7pEVsezMZqL22vqALmbd&nocache=true\n started = Time.now\n #server_transaction = 'shastapi.tronscan.org' \n server_transaction = 'apilist.tronscan.org'\n\n #contract = 'TN8RbeAzW7YA5yuFYAVG42qjJR63DsE1ZN'\n #contract = 'TBLhDkhyXaYESKf9UvB1BQrVXPX6ubjdHo'\n #contract = 'TA4MuGPwQp6RUvD3uUsshZ4FNaYxWRKHbC'\n contract = 'TNABUPeKLdYse99szJDzmBcCRV99VgGsdJ'\n \n @doc_transactions = []\n minimum = 50\n i = 0\n while true\n url_transactions = \"https://#{ server_transaction }/api/contracts/transaction?limit=#{ minimum }&start=#{ i * minimum }&contract=#{ contract }\"\n data_transactions = RestClient.get(url_transactions).body\n doc_transactions = JSON.parse(data_transactions)\n i += 1\n break if doc_transactions['data'].empty?\n @doc_transactions << doc_transactions\n end\n\n binding.pry\n\n transactions_dir = \"cache/transactions\"\n FileUtils.mkdir_p transactions_dir\n events = []\n ops = {:cache => 0, :nocache => 0, :total => 0}\n\n #server_event = 'api.shasta.trongrid.io'\n server_event = 'api.trongrid.io'\n #binding.pry\n\n @doc_transactions.each do |doc_transactions|\n doc_transactions['data'].map { |x| x['txHash'] }.each do |transaction_id|\n\n ops[:total] +=1 \n puts \"Processing Transaction No. #{ ops[:total] } - #{ transaction_id }\"\n transaction_file = File.join(transactions_dir,transaction_id)\n\n if File.exists?(transaction_file) && params[:nocache].nil?\n puts \"Yay! File is cached!\"\n ops[:cache] +=1\n else \n ops[:nocache] +=1\n \t url_events = \"https://#{ server_event }/event/transaction/#{ transaction_id }\"\n data_events = RestClient.get(url_events).body\n File.open(transaction_file,'w+') { |f| f.write(data_events) }\n end\n\n\n data_events ||= File.read(transaction_file)\n\n doc_events = JSON.parse(data_events)\n events << doc_events\n end\n end\n\n \n events_normalized = events.reject { |i| i[0]['event_name'] != 'Registration' rescue nil }.reject { |i| i[0].nil? }.map { |i| i[0]['result'] }\n \n #toBase58(address)\n #binding.pry\n\n #binding.pry\n result = events_normalized.map { |i| { :user_id => i['userId'].to_i, \n :user => toBase58(i['user']),\n :referrer_id => i['referrerId'].to_i, \n :referrer => toBase58(i['referrer']),\n :registration2 => \"registration('#{ i['user'] }','#{ i['referrer'] }')\",\n :registration => \"registration(#{ toBase58(i['user']) },#{ toBase58(i['referrer']) })\"\n }\n }\n\nbinding.pry\n ended = Time.now\n puts \"Duration: #{ ended - started }\"\n \n #binding.pry \n m1_total = result.map { |i| i[:referrer_id] }.group_by(&:itself).transform_values(&:count)\n\n m2_referidos_directos = result.reject { |i| i[:referrer] != account }.reverse[0...3]\n m2_referidos_directos = result.reject { |i| i[:referrer] != account }.reverse[0...3]\n\n {\n \"data\" => { \"registros\" => result },\n \"m1\" => { \n \"todos\" => m1_total\n },\n \"ops\" => ops,\n \"started\" => started, \n \"ended\" => ended, \n \"duration\" => (ended - started)\n }.to_json\n\nend", "title": "" }, { "docid": "016efe852e35ad46c97f46851d27a599", "score": "0.47804424", "text": "def send_addrs\n addrs = pool.peers.select{|p|p != self}.map(&:to_network_addr)\n conn.send_message(Bitcoin::Message::Addr.new(addrs))\n end", "title": "" }, { "docid": "4bf43183bd401a5b6a5440e8d032c6aa", "score": "0.47744608", "text": "def perform_address_update\n\n properties = @token[:properties].present? ? Token.get_bits_set_for_properties(@token[:properties]) : []\n if @owner_address.nil? || properties.exclude?(GlobalConstant::ClientToken.has_ost_managed_owner)\n\n r = request_saas_for_new_address\n return r unless r.success?\n\n update_token_owner_addresses\n update_client_wallet_address\n update_token_properties\n end\n @owner_address = @new_known_address\n success\n end", "title": "" }, { "docid": "52509ee0028831fdb160670bfd3e7a37", "score": "0.47741604", "text": "def setup\n # back to 0 block.\n @rpc.truncate(\"0x823b2ff5785b12da8b1363cac9a5cbe566d8b715a4311441b119c39a0367488c\")\n local_height = @api.get_tip_block_number\n # generate 5 blocks to enable the initial cells can be spent.\n generate_blocks(@rpc, 5)\n\n # send gpc contract to the chain.\n gpc_data = File.read(@path_to_binary + \"gpc\")\n gpc_code_hash, gpc_tx_hash = deploy_contract(gpc_data)\n generate_blocks(@rpc, 5)\n\n # send udt contract to the chain.\n udt_data = File.read(@path_to_binary + \"simple_udt\")\n udt_code_hash, udt_tx_hash = deploy_contract(udt_data)\n\n # ensure the tx onchain.\n tx_checked = [gpc_tx_hash, udt_tx_hash]\n while true\n generate_blocks(@rpc, 5)\n remote_height = @api.get_tip_block_number\n for i in (local_height + 1..remote_height)\n block = @api.get_block_by_number(i)\n for transaction in block.transactions\n if tx_checked.include? transaction.hash\n tx_checked.delete(transaction.hash)\n end\n end\n end\n break if tx_checked == []\n end\n\n # disseminate udt.\n udt_dep = CKB::Types::CellDep.new(out_point: CKB::Types::OutPoint.new(tx_hash: udt_tx_hash, index: 0))\n\n # send UDT randomly for ten times.\n for iter in 0..9\n tx = @wallet_A.generate_tx(@wallet_A.address, CKB::Utils.byte_to_shannon(2000), fee: 1000)\n tx.cell_deps.push(udt_dep.dup)\n # generate the udt type script.\n # set the args as the input lock to represent his is the owner, for more deteil, you can\n # have a look at the simple_udt.c.\n for input in tx.inputs\n cell = @api.get_live_cell(input.previous_output)\n next if cell.status != \"live\"\n input_lock = cell.cell.output.lock\n input_lock_ser = input_lock.compute_hash\n type_script = CKB::Types::Script.new(code_hash: udt_code_hash,\n args: input_lock_ser, hash_type: CKB::ScriptHashType::DATA)\n end\n\n # split the output\n outputs = tx.outputs\n first_output = outputs[0]\n first_output.capacity = get_minimal_capacity(@default_lock_A, type_script, CKB::Utils.bin_to_hex([20].pack(\"Q<\")))\n first_output.type = type_script\n second_output = first_output.dup\n\n first_output.lock = @default_lock_A\n second_output.lock = @default_lock_B\n\n tx.outputs.delete_at(0)\n tx.outputs.insert(0, first_output)\n tx.outputs.insert(0, second_output)\n\n # generate UDT amount.\n tx.outputs_data[0] = CKB::Utils.bin_to_hex([20].pack(\"Q<\"))\n tx.outputs_data[1] = CKB::Utils.bin_to_hex([20].pack(\"Q<\"))\n tx.outputs_data << \"0x\"\n\n signed_tx = tx.sign(@wallet_A.key)\n root_udt_tx_hash = @api.send_transaction(signed_tx)\n generate_blocks(@rpc, 5)\n end\n\n system(\"rm #{@path_to_file}result.json\")\n # system(\"rm #{@path_to_file}gpc.log\")\n # record these info to json. So the gpc client can read them.\n script_info = { gpc_code_hash: gpc_code_hash, gpc_tx_hash: gpc_tx_hash,\n udt_code_hash: udt_code_hash, udt_tx_hash: udt_tx_hash,\n type_script: type_script.to_h.to_json }\n file = File.new(@path_to_file + \"contract_info.json\", \"w\")\n file.syswrite(script_info.to_json)\n file.close()\n end", "title": "" }, { "docid": "26b97fb62068c398b2d9707caad1eb1d", "score": "0.47696796", "text": "def new_bitcoin_address\n send_to_coinapult('/api/getBitcoinAddress', {}, sign: true)\n end", "title": "" }, { "docid": "fc03399e5291c3109299e13aef7d261e", "score": "0.47506002", "text": "def sync_clients\n Client.all(:client_group_id => self.id).each{|client|\n client.center = self.center\n client.save\n }\n Client.all(:client_group_id => self.id).loans.each{|l|\n l.update_history\n }\n end", "title": "" }, { "docid": "b9b4f3c369dc5a473595b577c2ca1ee2", "score": "0.47347766", "text": "def update_zero_contacts_of_all_province(mod_total, mod_num, start, machine)\n limitnum = 50\n options = build_search_option(limitnum, start)\n begin\n User.select(\"uid\").where(\n \"uid>? and has_contact = ? and fans_count = ? and followers_count = ? and weibo_count = ? and UNIX_TIMESTAMP(created_at)%?=?\",\n start, true, 0, 0, 0, mod_total, mod_num\n ).find_in_batches(options) do |users_with_zero_contact|\n \n CACHE.set(\"#{machine}_#{mod_num}_zero_uid\", users_with_zero_contact.first.uid, 7.day)\n status_code = parse_and_save_contacts(users_with_zero_contact, limitnum)\n return status_code if status_code < 0\n end\n rescue Timeout::Error => ex\n puts \"time out in find_in_batches: #{ex}\"\n end\n return StatusCode::NORMAL\n end", "title": "" }, { "docid": "428eac8e2bc28ff742ad755f333f2b78", "score": "0.47338995", "text": "def check_for_replications\n uri = URI(NODEVIEWURL)\n req = Net::HTTP::Get.new(uri.path)\n req[\"content-type\"] = \"application/json\"\n data = nil\n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request req # Net::HTTPResponse object\n data = JSON.parse(response.body)\n end\n \n data['rows'].each do |node|\n begin\n d = node['value']\n puts \"My address: #{@myaddress} Considering: #{d['address']}\"\n if (d['address'] == @myaddress)\n #This is me-- don't try to replicate to myself, it'd be dumb.\n puts \"Won't replicate to myself.\"\n next\n else\n puts \"Proceeding with replication.\"\n end\n \n #signature over (rev+address+cert)\n a = d['address']\n c = d['cert']\n s = d['signature']\n revm = d['_rev'].match(/([0-9]+)-.+/)\n rev = revm[1]\n remote_certificate = OpenSSL::X509::Certificate.new c\n pubkey = OpenSSL::PKey::EC.new (remote_certificate.public_key)\n if pubkey.dsa_verify_asn1(rev+a+c, Base64.decode64(s))\n #Then we've got a valid ID document.\n puts \"Replications: Found valid ID document for #{a}\"\n \n #Now do two things: 1) Push my ID doc to it, and 2) Make sure a replication is running *from* it.\n \n #BaseURL: of the form \"http://hostname.onion:34214/reticle/\"\n \n remoteaddress = \"https://#{a}:34214/reticle/\"\n \n insert_my_node_document(remoteaddress, remote_certificate)\n \n uri = URI(REPLICATORURL+\"rep_#{a}\")\n req = Net::HTTP::Get.new(uri.path)\n req[\"content-type\"] = \"application/json\"\n crepdata = nil\n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request req # Net::HTTPResponse object\n crepdata = JSON.parse(response.body)\n end\n \n if (crepdata['_replication_state'] == \"triggered\")\n #Then we've got a valid, working replication already.\n puts \"I already have a replication for #{remoteaddress}.\"\n next\n end\n \n repdata = {\n \"source\" => remoteaddress,\n \"continuous\" => true,\n \"target\" => \"reticle\"\n }\n \n if crepdata['_rev'] #And, importantly, if we're still here...\n #This means that the replication isn't working.\n repdata['_rev'] = crepdata['_rev'] #Make it rewrite correctly\n end\n \n uri = URI(REPLICATORURL+\"rep_#{a}\")\n req = Net::HTTP::Put.new(uri.path)\n req[\"content-type\"] = \"application/json\"\n req.body = JSON.generate(repdata)\n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request req # Net::HTTPResponse object\n puts \"Response to inserting replication document for #{remoteaddress}: #{response.body}\"\n end\n else\n puts \"Replications: Invalid ID document for #{a}, disregarding.\"\n end\n rescue => e\n #Have to use kernel.puts here... not entirely sure why, but otherwise I get the\n #Error referenced in http://stackoverflow.com/questions/9911781/ruby-global-scope\n puts \"Was unable to do the replication to #{node['value']['address']} because:\"\n puts e.message \n puts e.backtrace.join(\"\\n\")\n end\n puts \"At the bottom of the replication loop for #{node['value']['address']}\"\n end\nend", "title": "" }, { "docid": "20c2d59098452c926d13f023c3bb5832", "score": "0.47320163", "text": "def internalRefresh\n fillFrom(@torrentData)\n end", "title": "" }, { "docid": "e992db297183e840a381c5a3da4533d8", "score": "0.47033057", "text": "def send_offsets\n end", "title": "" }, { "docid": "94df741b695a2c0ccc4361ac4e7c5914", "score": "0.4703297", "text": "def sync days_ago=1\n\n #For performance, only update trips in the future\n options = {\n start: (Time.current - days_ago.day).iso8601[0...-6]\n }\n\n (arrayify(fetch_customer_orders(options).try(:with_indifferent_access).try(:[], :orders).try(:[], :order))).each do |order|\n occ_trip_from_ecolane_trip order\n end\n\n # For trips that are round trips, make sure that they point to each other.\n link_trips\n\n end", "title": "" }, { "docid": "084565c2428d340801b9fc434bbec3ff", "score": "0.46833307", "text": "def send_updates\n return unless approved? && saved_change_to_status?\n\n contacts.each do |contact|\n cid = contact.id\n if Delayed::Job.where('handler LIKE ?', \"%arguments:\\n - #{cid}\\n%\").empty?\n ReliefMessageJob.set(wait: 10.seconds).perform_later cid\n end\n # contact.notify_of contact.offense_ids # creates relief message for all offenses\n end\n end", "title": "" }, { "docid": "bc2c98f1e55622fb2e0f69aea7bcb448", "score": "0.46825632", "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": "95c42138b7890b143e5d334a908bc2fa", "score": "0.46755397", "text": "def get_bbg_fx_quotes()\n \n print \"Starting FX VOL Quote Update from BBG\"\n \n updater = QuoteUpdater.new( DEFAULT_FX_FEED_ADDRESS ) do |f| \n f.getQuoteName.include?(\"FXOption.\")\n end\n\n if updater.feed_address_address.size == 0\n Log.error(Log::ERROR, \"No updates - No Mappings found for Feed Address #{DEFAULT_FX_FEED_ADDRESS}\")\n return false\n end\n \n @request_fields = ['NAME','PX_BID','PX_ASK','PX_OPEN','PX_LAST','PX_HIGH','PX_LOW', 'LAST_UPDATE']\n\n begin\n # BBG needs the FeedAddress.FeedAddress (not the QuoteName)\n @bbg_return_data = updater.request_updata_data( updater.feed_address_address, @request_fields )\n rescue Exception => e\n Log.error(Log::ERROR, \"FX VOL Update failed in BBG ftp request and processing\")\n raise \n end\n\n # Create mapping between Calypso method to call on QuoteValue and the associated request field\n #\n @quote_value_map = {'setBid' => 'PX_BID', 'setAsk' => 'PX_ASK', \n 'setOpen' => 'PX_OPEN', 'setClose' => 'PX_LAST',\n 'setHigh' => 'PX_HIGH', 'setLow' => 'PX_LOW', 'setLast' => 'PX_LAST'}\n\n updater.quote_factor = 100 # BBG values need dividing by 100\n\n date = JDate.getNow\n \n Log.info(Log::INFO, \"Saving [#{@bbg_return_data.size}] FX Vols Quotes AsOfDate #{date.inspect}\" )\n \n @bbg_return_data.each do |quote|\n\n quote.slice!(1,3) # NOTE : Fields 1,2,3 are extra junk we did not request - remove\n\n # Create mapping hash between request field and resulting data item : e.g. 'PX_OPEN' => 1.01\n @quote_data = Hash[*@request_fields.zip(quote).flatten]\n\n # Now get reverse mapping back from the BBG required FeedAddress to the Calypso QuoteName\n quote_name = updater.feed_quote_map[ @quote_data['NAME'] ]\n if(quote_name)\n updater.set_quote( quote_name, @quote_data, @quote_value_map, QuoteValue::YIELD, date )\n\n else\n log :warning, \"No Quote found for #{quote_name}\"\n end\n end\n\n Log.info(Log::INFO, \"FX VOL Quote Update Finished\" )\n \nend", "title": "" }, { "docid": "18cb8e417bcdb218506ace53bda6f66e", "score": "0.46723723", "text": "def document_address_changes\n if self.order_billing.present? && self.changed?\n self.order_billing.recorded_changes << self.formatted_changes\n end\n if self.order_shipping.present? && self.changed?\n self.order_shipping.recorded_changes << self.formatted_changes\n end\n end", "title": "" }, { "docid": "99da33585d1ef712b0ee06dce267b9bf", "score": "0.4638175", "text": "def update_allocations\n puts \"Running payment_process.update_allocations\"\n create_allocation_transactions\n # verify_journal_set\n end", "title": "" }, { "docid": "0b8e266b60a63f09178237abb4de42d4", "score": "0.4637162", "text": "def index1\n SyncData.process\n end", "title": "" }, { "docid": "7c702e66fcefa95d1d06f6b7353dd451", "score": "0.46353725", "text": "def request_recipes_chunk(start_index, max_notes, noteStore, filter, spec)\n # the api call\n notesMetadataList = noteStore.findNotesMetadata(@account.token, filter, start_index, max_notes, spec)\n # once you have your first set of results, go through them to see if the latest\n # account updates actually affected the notes that you're interested. since\n # updates can touch any part of the account, not just the recipes, we can't be\n # sure that the recipes changed until we get a list of them and look at their USNs.\n # we sorted the results by USN to make this quick.\n notesMetadataList.notes.each do |n|\n # check if each note is greater than your previous updateCount\n # if it is, that means this recipe that you're interested did indeed change\n # and you would need to save the modifications to your database.\n # if it is not, then the note did not change.\n # we can stop iterating through the notes and don't\n # need to request more pages of results because we sorted the list so that\n # the highest USNs are on the top. if the highest USNs are lower than or equal to\n # the previous updateCount, then all subsequent recipes can't have changed.\n # that means your database of recipes is up-to-date\n if n.updateSequenceNum > @account.update_count\n recipe = EvernoteRecipe.where(evernote_account_id: @account.id, guid: n.guid).take\n if recipe\n if n.title != recipe.title\n recipe.title = n.title\n end\n if n.updateSequenceNum != recipe.update_sequence_num\n recipe.update_sequence_num = n.updateSequenceNum\n end\n if n.largestResourceSize != recipe.largest_resource_size\n recipe.largest_resource_size = n.largestResourceSize\n end\n recipe.save\n else\n EvernoteRecipe.create(\n evernote_account_id: @account.id,\n title: n.title,\n guid: n.guid,\n update_sequence_num: n.updateSequenceNum,\n largest_resource_size: n.largestResourceSize\n )\n end\n else\n # stopping because our database is up-to-date\n return\n end\n end\n # if we're at this point that means everything we've seen so far has been new\n # and we want more recipes\n # check if there are more by comparing this page's start index and size with\n # the total count\n if notesMetadataList.startIndex + notesMetadataList.notes.length < notesMetadataList.totalNotes\n request_recipes_chunk(start_index + max_notes, max_notes, noteStore, filter, spec)\n end\n end", "title": "" }, { "docid": "3589edebd952e054b7d83d33ebf53aa5", "score": "0.46223292", "text": "def sync_data\n sketch = find_sketch\n links = sketch.links.select{ |l| l[\"logic\"] == \"sync_data\"}\n links.each do |link|\n if link[\"from\"] == mac\n # gets data from this board into the other one\n Board.find_by(mac: link[\"to\"]).sync self\n end\n end\n end", "title": "" }, { "docid": "08c47591a17efcafd92510ff8d3bfb9d", "score": "0.4619189", "text": "def sync\n @index = lookup_index\n end", "title": "" }, { "docid": "414e4cb3e97fae981f48c0377c2420e9", "score": "0.46051347", "text": "def sync_stats(prices)\n @prices = prices\n mail\n end", "title": "" }, { "docid": "cd410459d3d838e627dab7371b56d647", "score": "0.4604446", "text": "def updateEEPROMcaches()\n\n\t\t# loop all known devices requesting checksums\n\t\t# or just ask all and find out which are online\n\t\t@oIOframeHandler.oEventManager.addInitialSyncEvents()\n\n\tend", "title": "" }, { "docid": "752643c81eadb27967ea6c8a30bcdff9", "score": "0.46019238", "text": "def _notify_data_change\n @_data_change.broadcast\n end", "title": "" }, { "docid": "0400bd6649fa04c7e759b86ba2265339", "score": "0.45986536", "text": "def update!\n new_entries = pull!(endpoint(@state), @options.merge(:ot => @last_update_token))\n @entries = new_entries + @entries\n new_entries\n end", "title": "" }, { "docid": "6fc63c6945d09cb8910132d826c7ebc1", "score": "0.4593638", "text": "def set_address address\n\t\t\t\tsuper address\n\t\t\t\tannounce_endpoints\n\t\t\tend", "title": "" }, { "docid": "6a92ff9154048d90c9b6fa71ca9a4cab", "score": "0.45931575", "text": "def index\n @new_addresses = NewAddress.all\n end", "title": "" }, { "docid": "f90dce1eb7f94ac12c2c894da3692da7", "score": "0.45909202", "text": "def add_change(address_book_id, object_uri, operation)\n ds = @sequel[\n \"INSERT INTO #{@address_book_changes_table_name} (uri, synctoken, addressbookid, operation) SELECT ?, synctoken, ?, ? FROM #{@address_books_table_name} WHERE id = ?\",\n object_uri,\n address_book_id,\n operation,\n address_book_id\n ]\n ds.insert\n ds = @sequel[\n \"UPDATE #{@address_books_table_name} SET synctoken = synctoken + 1 WHERE id = ?\",\n address_book_id\n ]\n ds.update\n end", "title": "" }, { "docid": "433e1b9c36f61241b505a113bc014d89", "score": "0.45875645", "text": "def refresh\n Urls.all.each do |record|\n data = Urls.get_share_data record.address\n # comes back as an array, goes right in.\n record.update_attributes(data)\n end\n\n redirect_to :action => :list\n end", "title": "" }, { "docid": "8482a820ab283aa406d45d7b159445ad", "score": "0.45855895", "text": "def update\n # UPDATE OPERATIONS ARE NOT ALLOWED: USERS WILL HAVE TO LOG INTO ESS TO EDIT THEIR DATA. DON'T WANT THINGS TO GET OUT OF SYNC\n end", "title": "" }, { "docid": "8609c386f526bc1f26ae9ed81a7911d7", "score": "0.4580198", "text": "def sync_it_now\n puts \"Attempt Sync\"\n\n # Getting the last sync value.\n last_update_at = get_last_update_at\n\n # querying the page.\n page = @mechanize_agent.get(\"#{ChronuscopClient.configuration_object.chronuscop_server_address}/projects/#{ChronuscopClient.configuration_object.project_number}/translations.xml/?auth_token=#{ChronuscopClient.configuration_object.api_token}&last_update_at=#{last_update_at}\")\n\n # converting the returned xml page into a hash.\n words_hash = XmlSimple.xml_in(page.body)\n\n # catching the case when no-translations are returned.\n if(!words_hash) then\n puts \"Nothing new added.\"\n return\n end\n\n # collecting the translations array.\n all_translations = words_hash[\"translation\"]\n\n # catching the case when no-translations are returned.\n if(!all_translations) then\n puts \"Nothing new added.\"\n return\n end\n\n\n all_translations.each do |t|\n # Inserting into the redis store.\n @redis_agent.set \"#{t[\"key\"]}\",\"#{t[\"value\"]}\"\n\n # Bad hack used here. Should fix this.\n str = t[\"updated-at\"][0][\"content\"]\n key_updated_at = xml_time_to_integer(str)\n\n # Updating the value last_update_at\n if(key_updated_at > last_update_at) then\n last_update_at = key_updated_at\n end\n\n end\n\n # Writing the value of last_update_at to the file.\n write_last_update(last_update_at.to_i)\n puts \"Finished synchronizing !!!\"\n end", "title": "" }, { "docid": "015ed332b1bcc84751a2d2a79b53b15f", "score": "0.45744148", "text": "def refresh\n log(\"refresh.start\")\n\n services_to_db(get_bulk(:services))\n escalation_policies_to_db(get_bulk(:escalation_policies))\n schedules_to_db(get_bulk(:schedules))\n users_to_db(get_bulk(:users))\n\n refresh_incremental(:incidents) { |i| convert_incident(i) }\n refresh_incremental(:log_entries, \"include[]\" => \"incident\") { |le| convert_log_entry(le) }\n\n log(\"refresh.finish\")\n end", "title": "" }, { "docid": "96b627d36230d5b899d3deb1fe53887f", "score": "0.45692533", "text": "def populate_ssi_dive_centers\n load_dive_centers = LoadDiveCenter.where(active_ind: 1)\n training_org = TrainingOrganization.find_by(short_name: 'SSI')\n\n size = load_dive_centers.size\n\n load_dive_centers.each_with_index do |dc, index|\n puts \"#{index} of #{size} dc #{dc.store_number}...\"\n dco_attributes = { store_number: dc.store_number, training_organization: training_org }\n\n puts 'scraping DC....'\n dc_hash = scrape_ssi_dive_centers(dc.store_number)\n\n # dc_hash will return false or a hash. If it returns false we skip this iteration.\n next unless dc_hash\n\n dc_hash[:dive_center_type] = set_dive_center_type(dc.dive_center_type)\n\n puts 'finding address...'\n\n address_json = find_address(dc.lat, dc.lng)\n\n # Added to ensure I'm not adding shit addresses to the DB\n if address_json[1] == 'OK'\n loc_attributes = parse_google_geocode(address_json[0])\n elsif address_json[1] == 'OVER_QUERY_LIMIT'\n puts 'over query limit for google geocode api...'\n break\n elsif address_json[1] == 'ZERO_RESULTS'\n puts 'no results found...'\n next\n else\n puts 'something didnt work here, so we wont do anything'\n next\n end\n\n loc_attributes[:lat] = dc.lat\n loc_attributes[:lng] = dc.lng\n\n puts 'creating location...'\n loc_attributes[:source] = 'SSI'\n loc = Location.create!(loc_attributes)\n\n dc_hash[:location] = loc\n\n ap dc_hash\n puts 'creating dc...'\n dco_attributes[:dive_center] = DiveCenter.create!(dc_hash)\n\n puts 'creating dco...'\n dco = Agency.create!(dco_attributes)\n\n puts 'updating load_dive_center...'\n\n dc.update(active_ind: 0)\n end\nend", "title": "" }, { "docid": "7e577254da04114c8a5eba90e2808333", "score": "0.45613843", "text": "def sync_distributors\n #get customers and sync on the system \n message= \"Sync successfully\"\n customers_from_shop = ShopifyAPI::Customer.find(:all)\n customers_from_shop.each do |customer|\n distributor = Distributor.find_by_email(customer.email)\n if distributor.blank? \n distributor = Distributor.new(email: customer.email, first_name: customer.first_name,\n last_name: customer.last_name, verified_email: customer.verified_email,shopify_id: customer.id)\n if distributor.save\n customer.addresses.each do |ad|\n address = distributor.addresses.build\n address.first_name = ad.first_name\n address.last_name = ad.last_name\n address.address1 = ad.address1\n address.city = ad.city\n address.province = ad.province\n address.phone = ad.phone\n address.zip = ad.zip\n address.country = ad.country\n address.save\n end\n end\n else\n distributor.update_attributes(shopify_id: customer.id)\n customer.addresses.each do |ad|\n address = distributor.addresses.first || distributor.addresses.build\n address.first_name = ad.first_name\n address.last_name = ad.last_name\n address.address1 = ad.address1\n address.city = ad.city\n address.province = ad.province\n address.phone = ad.phone\n address.zip = ad.zip\n address.country = ad.country\n address.save\n end\n end\n end\n respond_to do |format|\n format.html { redirect_to distributors_url, notice: message}\n format.json { head :no_content }\n end\n\n #@distributors = ShopifyAPI::Customer.find(:all)\n end", "title": "" }, { "docid": "464c91ca320ee314e29120f314ad6db5", "score": "0.45591104", "text": "def generate\n if address_type == 'BTC'\n rpc = Payout_bitcoinrpc\n elsif address_type == 'LTC'\n rpc = Payout_litecoinrpc\n end\n addr = rpc.getnewaddress(Rails.configuration.bitcoind_order_address_label)\n self.btc_address = addr\n end", "title": "" }, { "docid": "10de0ca4fc01e0cde7bf78d313f059bd", "score": "0.45564124", "text": "def sync\n end", "title": "" }, { "docid": "2f2b3bbaed15d3fe323638d8725bc56d", "score": "0.45527568", "text": "def create_reminders!\n FilteredAddressList.new(@fetched_mail).each do |hound_address|\n create_or_notify!(hound_address)\n end\n end", "title": "" }, { "docid": "b40f1488f89dc3ac2201fdca6bffb981", "score": "0.45484233", "text": "def on_change_address(old, new)\n configuration.addressables.update_membership(self)\n\n configuration.networks.each do |net|\n net.addressables.update_membership(self) do\n net.cidr.include? new\n end\n end\n end", "title": "" }, { "docid": "dafb09df85a15aeb788cd033f19a63a0", "score": "0.45454416", "text": "def test_gen_tx_by_default_indexer\n wallet = CKB::Wallets::Simple.new(\"ckt1qyqywrwdchjyqeysjegpzw38fvandtktdhrs0zaxl4\", :default_indexer)\n # build tx to transfer 1024 ckb to a multisig address\n tx_builder = wallet.build(\"ckt1qyqkqqppzt0svxzyedfe7jt0dhxhd9rvt2dskqrjem\", 1024_0000_0000)\n # sign with from address's private key\n tx = wallet.sign(tx_builder, \"0x63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d\".from_hex)\n\n rpc = CKB::Config.instance.rpc\n rpc.send_transaction(tx.as_json)\n end", "title": "" }, { "docid": "a50c375bf00d81d70871f3a1efc24633", "score": "0.45439819", "text": "def index\n @dbcrs = DbChangeRequest.last( 20 )\n end", "title": "" }, { "docid": "61946193fbfaddb35a0dd30cf29639e6", "score": "0.45365736", "text": "def sync()\n end", "title": "" }, { "docid": "be1e6caa25216048a87071705a5e8480", "score": "0.45215613", "text": "def process_changes(&block)\n base_sha = current_sha\n yield\n create_service(base_sha).execute\n end", "title": "" }, { "docid": "39efa551463431766524abb474815719", "score": "0.4519616", "text": "def fetch_data\n xml = AxAccount.httpagent(:body => AxAccount.request_xml(ax_account_number)).body\n doc = Hpricot.XML(xml)\n \n account = {\n :account_balance => (doc/\"CustTable_1/AccountBalance\").inner_text,\n :discounts => (doc/\"CustTable_1/Discounts\").inner_text,\n :currency => (doc/\"CustTable_1/Currency\").inner_text,\n :cust_first_name => (doc/\"CustTable_1/CustFirstName\").inner_text,\n :cust_last_name => (doc/\"CustTable_1/CustLastName\").inner_text,\n :email => (doc/\"CustTable_1/Email\").inner_text,\n :cust_group => (doc/\"CustTable_1/CustGroup\").inner_text,\n :language_id => (doc/\"CustTable_1/LanguageId\").inner_text,\n :phone => (doc/\"CustTable_1/Phone\").inner_text,\n :red_one_shipped => (doc/\"CustTable_1/RedOneShipped\").inner_text,\n :address => (doc/\"CustTable_1/Address\").inner_text,\n :city => (doc/\"CustTable_1/City\").inner_text,\n :country_region_id => (doc/\"CustTable_1/CountryRegionId\").inner_text,\n :state => (doc/\"CustTable_1/State\").inner_text,\n :street => (doc/\"CustTable_1/Street\").inner_text,\n :tele_prod_tax_exempt => (doc/\"CustTable_1/TeleProdTaxExempt\").inner_text,\n :zip_code => (doc/\"CustTable_1/ZipCode\").inner_text,\n :created_date => (doc/\"CustTable_1/CreatedDate\").inner_text,\n :modified_date => (doc/\"CustTable_1/ModifiedDate\").inner_text,\n :status => \"UPDATE\"\n }\n \n addresses = []\n (doc/:Address_1).each do |addr_doc|\n addresses << {\n :ax_account_number => ax_account_number,\n :address => (addr_doc/:Address).inner_text,\n :city => (addr_doc/:City).inner_text,\n :country_region_id => (addr_doc/:CountryRegionId).inner_text,\n :state => (addr_doc/:State).inner_text,\n :street => (addr_doc/:Street).inner_text,\n :address_type => (addr_doc/:type).inner_text\n }\n end\n \n contact_people = []\n (doc/:ContactPerson_1).each do |person|\n contact_people << {\n :email => (person/:Email).inner_text,\n :first_name => (person/:FirstName).inner_text,\n :last_name => (person/:LastName).inner_text,\n :name => (person/:Name).inner_text,\n :selected_address => (person/:selectedAddress).inner_text\n }\n end\n \n return account, addresses, contact_people\n end", "title": "" }, { "docid": "3592a6ac5cc8ce1512f00c646486b3a9", "score": "0.4517575", "text": "def sync!\n end", "title": "" }, { "docid": "e0cb514e396ef70c2112bde4304141fb", "score": "0.45154923", "text": "def populate_data\n populate_scan_data\n populate_rep_data\nend", "title": "" }, { "docid": "56602291aaab46555e266039e81057fd", "score": "0.45152342", "text": "def run\n check_for_nbe_or_fail\n\n create_dataset_on_target\n create_standard_columns\n unless @ignore_computed_columns\n migrate_regions unless @source_client.domain == @target_client.domain\n create_computed_columns\n add_geometry_labels\n end\n migrate_data\n publish if @publish_dataset\n\n log.info \"New dataset: #{@target_client.domain}/d/#{target_id}\"\n self\n end", "title": "" }, { "docid": "615fe897f7c8ce0eb8b2c618707a4c2c", "score": "0.45147052", "text": "def set_expense_on_seq\n ledger = Sequence::Client.new(\n ledger_name: 'company-dev',\n credential: 'OUUY4ZFYQO4P3YNC5JC3GMY7ZQJCSNTH'\n )\n sleep 1\n if expense.contract.buy_contract.contract_type == 'C2C'\n else\n if pay_type == 'reject'\n ledger.transactions.transact do |builder|\n builder.retire(\n flavor_id: 'usd',\n amount: amount.to_i,\n source_account_id: 'cons_' + expense.contract.candidate_id.to_s,\n action_tags: { type: 'expense bill payment' }\n )\n end\n else\n if expense.bill_type == 'company_expense'\n ledger.transactions.transact do |builder|\n builder.transfer(\n flavor_id: 'usd',\n amount: payment.to_i,\n source_account_id: 'cust_' + expense.contract.sell_contract.company_id.to_s + '_treasury',\n destination_account_id: 'cust_' + expense.contract.sell_contract.company_id.to_s + '_expense',\n action_tags: {\n type: 'expense bill payment',\n expense_type: expense_type.name,\n contract_id: expense.contract_id,\n bill_type: expense.bill_type\n }\n )\n end\n else\n sleep 1\n puts 'update start'\n ledger.transactions.transact do |builder|\n builder.transfer(\n flavor_id: 'usd',\n amount: payment.to_i,\n source_account_id: 'cust_' + expense.contract.sell_contract.company_id.to_s + '_treasury',\n destination_account_id: 'cons_' + expense.contract.candidate_id.to_s + '_expense',\n action_tags: {\n type: 'expense bill payment',\n expense_type: expense_type.name,\n contract_id: expense.contract_id,\n bill_type: expense.bill_type\n }\n )\n end\n ledger.transactions.transact do |builder|\n builder.retire(\n flavor_id: 'usd',\n amount: payment.to_i,\n source_account_id: 'cons_' + expense.contract.candidate_id.to_s,\n action_tags: { type: 'expense bill payment' }\n )\n end\n puts 'update end'\n end\n end\n end\n end", "title": "" }, { "docid": "ad440940cf6fae382a37bfdae9cb51ae", "score": "0.45124605", "text": "def full_sync\n remote_sync(force: true)\n\n # TODO update with pages of issues instead, this is VERY inefficient with API calls\n issues.active.each { |i| i.delay.remote_sync }\n end", "title": "" }, { "docid": "fbc56b074c8f4144725b32733cb2e439", "score": "0.45097494", "text": "def fill_changelogs\n [].tap do |threads|\n gemfile.changes.each do |gem_name, details|\n threads << Thread.new { retrieve_gem_changes(gem_name, details) }\n end\n end.each(&:join)\n end", "title": "" }, { "docid": "0eab19e04b84ef088fa955564bcd7460", "score": "0.4509027", "text": "def run_bulk\n sync\n end", "title": "" }, { "docid": "7b4c2538efadc3a4747efc60841bd592", "score": "0.45083904", "text": "def refresh\n @addresses = ::Array.new\n @dependents = nil\n ::IO.popen(\"ip -o addr show dev #{@nic}\") do |f|\n f.each do |line|\n parts = line.gsub('\\\\','').split\n next unless parts[2] =~ /^inet/\n next if parts[5] == 'link'\n addr = IP.coerce(parts[3])\n @addresses << addr\n end\n end\n self\n end", "title": "" }, { "docid": "86af88db20b5ead1005937ee7040c3ad", "score": "0.45069474", "text": "def compute_page\n inserts_elements_map,deletes_elements_map,total_count = @source.lock(:md) do |s| \n inserts_elements_map = @client.get_diff_data(:cd,s.docname(:md),@p_size)\n total_count = s.get_value(:md_size).to_i\n deletes_elements_map = s.get_diff_data(:md,@client.docname(:cd),@p_size)\n [inserts_elements_map,deletes_elements_map,total_count]\n end\n # until sync is not done - set cd_size to 0\n # once there are no changes, then, set cd_size to md_size\n cd_size = inserts_elements_map.size > 0 ? 0 : total_count\n @client.put_value(:cd_size, cd_size)\n \n # now, find the exact changes\n inserts,deletes = Store.get_inserts_deletes(inserts_elements_map,deletes_elements_map)\n \n @client.put_data(:page,inserts)\n @client.put_data(:delete_page,deletes,true)\n @client.put_value(:total_count_page,total_count)\n @client.update_elements(:cd,inserts_elements_map,deletes_elements_map)\n \n [total_count,inserts,deletes]\n end", "title": "" }, { "docid": "74a9001b4ab0eb8c4c425f7a2d9f9927", "score": "0.45049626", "text": "def get_next_set\n hash,url = perform_next_page_request\n RepChanges.new hash,url\n end", "title": "" }, { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.4503559", "text": "def sync; end", "title": "" }, { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.4503559", "text": "def sync; end", "title": "" }, { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.4503559", "text": "def sync; end", "title": "" }, { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.4503559", "text": "def sync; end", "title": "" }, { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.4503559", "text": "def sync; end", "title": "" }, { "docid": "a9d9933439022d718e96bf2f0aff7f9e", "score": "0.44997102", "text": "def perform\n self.sync_segments\n self.notify_segment_users\n end", "title": "" }, { "docid": "62fa1c09d36d59502df6b380702b9e63", "score": "0.44983703", "text": "def refresh\n @peerClientHandler.updateDelegateTorrentData self\n end", "title": "" }, { "docid": "cd6c4191cc6d769c35d59d9f83cff8d9", "score": "0.44931078", "text": "def get_data(delay=@opts[:delay], concurrent_connections=@opts[:connections],chunk_size=@opts[:chunk_size], with_messages_and_comments=true)\n puts \"Fetching Data:\"\n if @ids.empty? # let's make sure we've got some ids\n $stderr.puts \"There appear to be no IDs, exiting.\"\n exit(-1)\n end\n\n issue_args = {\n \"messages\" => true # We don't just put with_messages here. Instead, we\n } if with_messages_and_comments # protect against possibly throwing a string into the hash we pass to the request\n\n patch_args = {\n 'comments' => true\n } if with_messages_and_comments\n\n hydra = Typhoeus::Hydra.new(max_concurrency: concurrent_connections) # make a new concurrent run area\n\n\n @ids.each do |issue_id| # for each of the IDs in the pool\n if not @issues.include? issue_id\n issue_request = Typhoeus::Request.new(@@baseurl + \"/api/#{issue_id}\", params: issue_args) # make a new request\n issue_request.on_complete do |issue_resp|\n if issue_resp.success?\n oj_opts = {:symbol_keys => false, :mode => :compat}\n issue_result = Oj.load(issue_resp.body,oj_opts) # push a Hash of the response onto our issues list\n\n #Get the patchset data\n issue_result['patchset_data'] = {}\n issue_result['patchsets'].each do |patch_id|\n patch_request = Typhoeus::Request.new(@@baseurl + \"/api/#{issue_id}/#{patch_id}\", \n params: patch_args, followlocation: true)\n patch_request.on_complete do |patch_resp|\n if patch_resp.success?\n # Add patchset to Issue 'patchset_data'\n issue_result['patchset_data'][patch_id.to_s] = Oj.load(patch_resp.body)\n # Wait some amount of time\n sleep(delay)\n else\n $stderr.puts \"We could not fetch patch #{patch_id} for issue #{issue_id}\"\n end\n end\n\n hydra.queue patch_request # push our request onto the front of the queue\n end\n # BLOCKING CALL\n hydra.run # This runs all the requests that are queued\n \n #Add issue to chunk temp\n @chunk_temp << issue_result\n #Add the id to chunk issue list, so we can pick up from here later.\n @chunk_issues << issue_id\n \n if @chunk_temp.size >= chunk_size\n #Save chunk to disk and reset\n Oj.to_file(@@file_location +\"chunk#{\"%05d\" % @cursor}.json\", @chunk_temp)\n puts \"Saved chunk#{\"%05d\" % @cursor}.json\"\n \n File.open(@@file_location + \"issues_completed.log\", \"a\") { |f| @chunk_issues.each {|chunk_issue_id| f << \"#{chunk_issue_id}\\n\" }}\n @issues.merge @chunk_issues\n\n @chunk_temp = Array.new\n @chunk_issues = Set.new\n @cursor += 1\n end\n\n sleep(delay)\n \n else\n $stderr.puts \"We could not fetch issue #{issue_id}\"\n end\n end\n issue_request.run # run the request\n else\n puts \"Skipping #{issue_id}, already downloaded\"\n end\n end\n\n @issues\n end", "title": "" }, { "docid": "0abcd5bf09b5d5ba606e59be619fcc40", "score": "0.44880152", "text": "def listenForBankUpdates()\n Listen.to(BANK_PATH, :filter => /\\.SC2Bank$/, :latency => POLLING_LATENCY_SECONDS, :force_polling => true) do |modified, added|\n filesChanged = Set.new\n\n # add modified and add files to our set\n modified.each { |modifiedPath| filesChanged.add(modifiedPath) }\n added.each { |addedPath| filesChanged.add(addedPath) }\n\n begin\n # parse banks for each bank file\n filesChanged.each { |absolutePath| sendBank(absolutePath, File.basename(absolutePath)) }\n rescue Exception => e\n # handle e\n # puts \"ERROR: exception caught: \" + e + \"\\n\"\n end\n end\nend", "title": "" }, { "docid": "16945829b1d5733e24736bd3ab22b925", "score": "0.44826925", "text": "def gen_incremental_update(size, percent)\n data = []\n id = 0\n num_updates = ((percent.to_f / 100) * 10).to_i\n num_orig = 10 - num_updates\n (size/10).times do\n update_id = id\n dep_id = id\n num_orig.times { \n data << [id, \"foo#{id}\", id, []]\n id += 1\n }\n num_updates.times {\n data << [id, \"foo#{update_id}\", id, [dep_id]]\n dep_id = id\n id += 1\n }\n end\n data\nend", "title": "" }, { "docid": "6365cecbb0e647ebea7927fa9eb64c1f", "score": "0.44799525", "text": "def getnewaddress(account = nil)\n dogecoin.getnewaddress account\n end", "title": "" }, { "docid": "ff0a63a52c973c9dd3e5c5de828725bd", "score": "0.44781217", "text": "def refresh\n friends = []\n\n begin\n conn = get_connection(1)\n info_map = Info.request(conn, \"node\", \"partition-generation\", \"services\")\n rescue => e\n Aerospike.logger.error(\"Error during refresh for node #{self}: #{e}\")\n\n conn.close if conn\n decrease_health\n\n return friends\n end\n\n verify_node_name(info_map)\n restore_health\n\n @responded.update{|v| true}\n\n friends = add_friends(info_map)\n update_partitions(conn, info_map)\n put_connection(conn)\n friends\n end", "title": "" }, { "docid": "f51de3ecb6c0c24a32e45dd7ff000ff1", "score": "0.44777113", "text": "def index\n @change_requests = ChangeRequest.all\n end", "title": "" }, { "docid": "56c6357f9bc51fe6688b7d7040c378b8", "score": "0.44768372", "text": "def sync\n log_info(\"updating feeds from configuration\")\n disable_missing_feeds\n create_or_update_feeds\n end", "title": "" }, { "docid": "3730a265862542da41c27e8eca74433c", "score": "0.44723874", "text": "def add_initial_contact\n # case_watcher_lists.create(:contact => initial_contact)\n end", "title": "" }, { "docid": "b887e9c13ddf97f6f713cd0503a09a61", "score": "0.44663003", "text": "def index\n @change_email_requests = ChangeEmailRequest.all\n end", "title": "" }, { "docid": "d60c43f4756d9cde64476ec4133fe2de", "score": "0.4460946", "text": "def gossip\n \n end", "title": "" }, { "docid": "e64b861accd86e9268a341c24d91ef33", "score": "0.4460107", "text": "def chunk_it_up\n\n # start with an empty working set before any messages have been received\n working_set = []\n\n # pop a chunk (array of lines of filtered btmon output) off the\n # incoming queue\n while current_msg = @incoming_q.pop\n\n # test if the message indicates the start of a new message\n #\n # also bypass if our working set is empty as this indicates we are\n # receiving our first device of the run\n if starting_chunk?(current_msg) && !working_set.empty?\n\n # if we just got a new message shovel the working set into the\n # outgoing queue and reset it\n address_list = working_set.flatten.reject{|x| x =~ /Direct address/}.join(\"\").scan(/^\\s*.*ddress: ((?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2})/).flatten.uniq\n address_count = address_list.count\n if address_count == 1\n unless BlueHydra.config[\"ignore_mac\"].include?(address_list[0])\n @outgoing_q.push working_set\n end\n elsif address_count < 1\n if BlueHydra.config[\"chunker_debug\"]\n working_set.flatten.each{|msg| BlueHydra.chunk_logger.info(msg.chomp) }\n BlueHydra.chunk_logger.info(\"-------------------------------------------------------------------------------\")\n else\n BlueHydra.logger.warn(\"Got a chunk with no addresses, dazed and confused, discarding...\")\n end\n BlueHydra::Pulse.send_event('blue_hydra',\n {\n key: 'bluehydra_chunk_0_address',\n title: 'BlueHydra chunked a chunk with 0 addresses.',\n message: 'BlueHydra chunked a chunk with 0 addresses',\n severity: 'FATAL'\n })\n else\n if BlueHydra.config[\"chunker_debug\"]\n working_set.flatten.each{|msg| BlueHydra.chunk_logger.info(msg.chomp) }\n BlueHydra.chunk_logger.info(\"-------------------------------------------------------------------------------\")\n else\n BlueHydra.logger.warn(\"Got a chunk with multiple addresss, missing a start block. Discarding corrupted data...\")\n end\n BlueHydra::Pulse.send_event('blue_hydra',\n {\n key: 'bluehydra_chunk_2_address',\n title: 'BlueHydra chunked a chunk with more than 1 uniq address.',\n message: 'BlueHydra chunked a chunk with more than 1 uniq address.',\n severity: 'FATAL'\n })\n end\n #always clear the working set\n working_set = []\n end\n\n # inject a timestamp onto the message parsed out of the first line of\n # btmon output\n ts = Time.parse(current_msg.first.strip.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d*$/)[0]).to_i\n current_msg << \"last_seen: #{ts}\"\n\n # add the current message to the working set\n working_set << current_msg\n end\n end", "title": "" }, { "docid": "7410ff5b3532988fe514c4dffd5e1f55", "score": "0.44532987", "text": "def update!(**args)\n @beacons = args[:beacons] if args.key?(:beacons)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_count = args[:total_count] if args.key?(:total_count)\n end", "title": "" }, { "docid": "7410ff5b3532988fe514c4dffd5e1f55", "score": "0.44532987", "text": "def update!(**args)\n @beacons = args[:beacons] if args.key?(:beacons)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_count = args[:total_count] if args.key?(:total_count)\n end", "title": "" }, { "docid": "0a15bcd9c21ad379ae10988005ad012d", "score": "0.4452031", "text": "def history(*addrs)\r\n\r\n\t\ttransactions = []\r\n\t\taddrs.each do |addr|\r\n\t\t\toffset = 0\r\n\r\n\t\t\twhile 1\r\n\t\t\t\tresult = make_request(BASE_BCI + \"address/#{addr}?format=json&offset=#{offset}\")\r\n\t\t\t\tdata = JSON.parse result\r\n\r\n\t\t\t\ttransactions.concat(data[\"txs\"])\r\n\t\t\t\tif data[\"txs\"].size < 50\r\n\t\t\t\t\tbreak\r\n\t\t\t\tend\r\n\r\n\t\t\t\toffset += 50\r\n\t\t\t\tputs \"Fetching more transactions ... #{offset} \\n\"\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\touts = {}\r\n\t\ttransactions.each do |tx|\r\n\t\t\ttx[\"out\"].each do |out|\r\n\t\t\t\tif addrs.include?(out[\"addr\"])\r\n\t\t\t\t\tkey = tx[\"tx_index\"].to_s + \":\" + out[\"n\"].to_s\r\n\t\t\t\t\touts[key] = {\r\n\t\t\t\t\t\taddress: out[\"addr\"],\r\n\t\t\t\t\t\tvalue: out[\"value\"],\r\n\t\t\t\t\t\toutput: tx[\"hash\"].to_s + \":\" + out[\"n\"].to_s,\r\n\t\t\t\t\t\tblock_height: tx[\"block_height\"] || \"None\"\r\n\t\t\t\t\t}\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ttransactions.each_with_index do |tx, index|\r\n\t\t\ttx[\"inputs\"].each do |inp|\r\n\t\t\t\tif addrs.include?(inp[\"prev_out\"][\"addr\"])\r\n\t\t\t\t\tkey = inp[\"prev_out\"][\"tx_index\"].to_s + \":\" + inp[\"prev_out\"][\"n\"].to_s\r\n\t\t\t\t\tif outs[key]\r\n\t\t\t\t\t\touts[key][\"spend\"] = tx[\"hash\"] + \":\" + index.to_s\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn outs\r\n\tend", "title": "" } ]
e17fa8a4a9fbdcd59946e6f3032ca9e1
Write a method called prime? that takes a single parameter called number and returns true if the parameter is a prime number, or false otherwise. Use the Math.sqrt
[ { "docid": "8852b40229e1692b186bb94c01fa20dd", "score": "0.0", "text": "def prime(number)\n num = 2.0\n # p Math.sqrt(number)\n until num > Math.sqrt(number)\n # until num > Math.sqrt(number)\n # p num\n # p number.remainder(num)\n if (number.remainder(num)) == 0\n return false\n end\n num=num+1;\n end\n return true\nend", "title": "" } ]
[ { "docid": "e3edac979b07f89f7e54d669881af2c7", "score": "0.89329135", "text": "def prime?(number)\n prime(number, Math.sqrt(number).to_i)\nend", "title": "" }, { "docid": "8639da6d1b3ed5251d9960e0ecd886b7", "score": "0.8767812", "text": "def prime? (number)\n p Math.sqrt(number)\nend", "title": "" }, { "docid": "568b6754d2d210d49c54708a9d2d2391", "score": "0.8428264", "text": "def prime?(number)\n return false if number == 0 || number == 1\n return true if number == 2\n\n (2..Math.sqrt(number).to_i).each do |i|\n return false if number % i == 0\n end\n\n true\nend", "title": "" }, { "docid": "b1abfc7c6dbec0fe39dfe204ae4448ff", "score": "0.8418134", "text": "def prime?(number)\n if number <= 1 # return false if number is a negative, 0, or 1\n false\n else\n # possible factors range from 2 to the square root of the number (rounded down to the nearest whole number)\n sqrt = Math.sqrt(number).floor\n factors = (2..sqrt).to_a\n if factors.any?{ |factor| number % factor == 0 }\n false\n else\n true\n end\n end\nend", "title": "" }, { "docid": "9386100b1385ac14c004e67a27c9cf4b", "score": "0.84097034", "text": "def prime?(number)\n return true if number == 2\n return true if number == 3\n\n i = 2\n while i <= Math.sqrt(number).floor\n if number % i == 0\n return false\n end\n i = i + 1\n end\n\n return true\nend", "title": "" }, { "docid": "9386100b1385ac14c004e67a27c9cf4b", "score": "0.84097034", "text": "def prime?(number)\n return true if number == 2\n return true if number == 3\n\n i = 2\n while i <= Math.sqrt(number).floor\n if number % i == 0\n return false\n end\n i = i + 1\n end\n\n return true\nend", "title": "" }, { "docid": "3e6f1dc6ee4319642bab2b7c6f522f1c", "score": "0.84092134", "text": "def is_prime?(number)\n return true if number == 2\n return false if number < 2\n return false if number & 1 == 0\n\n i = 3\n while i < Math.sqrt(number)\n return false if number % i == 0\n i += 1\n end\n return true\nend", "title": "" }, { "docid": "4938e8aa74e8f874b99b9cb721345be4", "score": "0.8360196", "text": "def prime?(num)\n return FALSE if num == 1\n (2..Math.sqrt(num).round).each { |div| return FALSE if num % div == 0 }\n TRUE\n\nend", "title": "" }, { "docid": "a3fd9940068a40d29d479ba87ee51274", "score": "0.832013", "text": "def prime? (num)\r\n 2.upto Math.sqrt(num).to_i do |div|\r\n if num % div == 0\r\n return false\r\n end\r\n end\r\n return true\r\nend", "title": "" }, { "docid": "a3fd9940068a40d29d479ba87ee51274", "score": "0.832013", "text": "def prime? (num)\r\n 2.upto Math.sqrt(num).to_i do |div|\r\n if num % div == 0\r\n return false\r\n end\r\n end\r\n return true\r\nend", "title": "" }, { "docid": "d1265a5fb861363e9d1fc8a3be69d284", "score": "0.83173156", "text": "def prime?(num)\n Math.sqrt(num).to_i.downto(2).each { |i| return false if (num % i).zero? }\n true\nend", "title": "" }, { "docid": "ab32a102e2f61b5b910d5ca2972ed025", "score": "0.8292677", "text": "def is_prime?(num)\n return true if num == 1 || num == 2\n return false if num % 2 == 0\n int = 3\n while int <= Math::sqrt(num)\n return false if num % int == 0\n int += 2\n end\n true\nend", "title": "" }, { "docid": "59cba2268cc6608c2fa3a53c6aa0e9ba", "score": "0.82879525", "text": "def is_prime?(number)\n return false if number == 0 || number == 1\n integers =* (2..Math.sqrt(number).round)\n integers.each {|i| return false if (number % i) == 0}\n true\nend", "title": "" }, { "docid": "7e186740aa96100c40987fb0e6e749a9", "score": "0.82836217", "text": "def prime?(number)\n if number<=1\n return false\n end\n (2..Math.sqrt(number)).each do |n|\n if number%n == 0\n return false\n end\n end\n return true\nend", "title": "" }, { "docid": "26430d1401ab54564e51bf53bd498476", "score": "0.8282278", "text": "def prime?(number)\n return false if number <= 1\n\n sqrt = Math.sqrt(number).to_i\n (1..sqrt).select { |x| number % x == 0 }.count < 2\nend", "title": "" }, { "docid": "6fa6a69fdfa3ac400e327a61b401a7a6", "score": "0.82757276", "text": "def is_prime?(num)\n return true if num == 1 || num == 2\n return false if num % 2 == 0\n divisor = 3\n while divisor <= Math::sqrt(num)\n return false if num % divisor == 0\n divisor += 2\n end\n true\nend", "title": "" }, { "docid": "fa3f24537f1a7ef9ad0cf7c172ef45b5", "score": "0.82589376", "text": "def is_prime?(number)\n # No me hace falta el i = 2, el i = 3 lo pisa o la funcion retorna.\n return false if number % 2 == 0\n\n # No hace falta la variable is_prime. Si el loop termina es primo,\n # y devuelvo true; si encuentro un divisor, devuelvo false.\n # No nos gustan las variables de una sola letra, es poco descriptivo\n # y en general todos los editores de texto tienen autocomplete.\n divisor = 3\n number_sqrt = Math.sqrt(number)\n while divisor <= number_sqrt # No hacen falta los paréntesis\n # Dejo un espacio antes y dps de cada operador, por ejemplo '%' y '+='\n return false if number % divisor == 0\n divisor += 2\n end\n\n true\nend", "title": "" }, { "docid": "e6c3d6b19c198fa139d7379385fc7bb2", "score": "0.82451934", "text": "def prime?(num)\n\tif (num == 1)\n\t\treturn false\n\tend\n\t\t\t\t\t\t\t\t\t#sqrt(num) returns the non-negative sqrt of num\n\tmax_num = Math.sqrt(num).floor #floor returns the largest integer less than or equal to float.\n\t2.upto(max_num) do |i|\n\t\tif (num % i == 0)\n\t\t\treturn false \n\t\tend\n\tend\n\treturn true \nend", "title": "" }, { "docid": "e4beac9192376a466be7bb9640721a04", "score": "0.82382417", "text": "def prime?(number)\n return TRUE if number == 2\n return FALSE if number <= 1\n return FALSE if number%2 == 0\n (3..(Math.sqrt(number)+1)).step(2) do |i|\n if number%i == 0\n return FALSE\n end\n end\n return true\nend", "title": "" }, { "docid": "8a8e036c4761f99e8804e0b2cd2730ed", "score": "0.82253987", "text": "def is_prime?(number)\n Math.sqrt(number).floor.downto(2).each {|n| return false if number % n == 0}\n return true\n end", "title": "" }, { "docid": "c0f81c8af25bfc43594bc09167f01cc8", "score": "0.82233477", "text": "def prime?(num)\n # integers less than 2 cannot be prime\n return false if num < 2\n # even integers greater than 2 cannot be prime\n return false if (num > 2 && num.even?)\n\n # Highest number to check is sqrt of num rounded up\n max = (Math.sqrt(num)).ceil\n\n # iterate 2 to max returning false if i is factor\n (2...max).each do |i|\n return false if num % i == 0\n end\n\n true\nend", "title": "" }, { "docid": "0184fb92ec60eb5789d984f080c403e0", "score": "0.8223276", "text": "def is_prime?(number)\n if number == 0 || number == 1\n return false\n end\n integers = *(2..Math.sqrt(number).round)\n integers.each do |i|\n if number % i == 0\n return false\n end\n end\n true\nend", "title": "" }, { "docid": "95becc05ea387d26bf241270a7f938de", "score": "0.8221637", "text": "def prime?(num)\n return false if num == 1\n # `Math.sqrt(num)` because the greatest factor can be the sqrt, since sqrt(n)**2 = n\n (2..Math.sqrt(num)).none? { |n| num % n == 0 }\nend", "title": "" }, { "docid": "9492123479a6ff2436079736eb6febb9", "score": "0.8205035", "text": "def is_prime?(number)\n number > 1 && !(2..Math.sqrt(number)).any? { |i| number % i == 0 }\nend", "title": "" }, { "docid": "f74bf4193197e09542c4e83c1c1f4651", "score": "0.8200309", "text": "def is_prime?(num)\n (2..Math.sqrt(num).round).none? { |n| (num % n).zero? }\nend", "title": "" }, { "docid": "e5a234a3cb05ef6813a81c3372ce6da1", "score": "0.8198498", "text": "def isPrime(number)\n\n\treturn true if number == 2\n\n\t(2..Math.sqrt(number)).each do |n|\n\t\tif number % n == 0\n\t\t\treturn false\n\t\tend\n\tend\n\n\ttrue\n\nend", "title": "" }, { "docid": "4674c1ce0120830a7ed8bed6b68e2cd7", "score": "0.8190504", "text": "def prime?(num)\n return false if num < 2\n 2.upto(Math.sqrt(num)) {|i|\n return false if num % i == 0\n }\n return true\nend", "title": "" }, { "docid": "5783dab3c0cbcea94ee898143f9f780e", "score": "0.8190418", "text": "def prime?(num)\n (2..((Math.sqrt(num)).to_i)).each do |i|\n return false if num % i == 0\n end\n true\nend", "title": "" }, { "docid": "424f9e37c9bea70d9b55ce58ea9cb141", "score": "0.81885326", "text": "def is_prime? (num)\n return false if num != num.to_i\n return false if num <=1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "c575fcb40aa4c1f8ecf21e8f7b4eb7db", "score": "0.818222", "text": "def prime?(number)\n if number == 1\n return false\n elsif number < 4\n return true\n elsif number % 2 == 0\n return false\n elsif number < 9\n return true\n elsif number % 3 == 0\n return false\n else\n r = (Math.sqrt(number)).floor\n f = 5\n while f <= r\n if number % f == 0\n return false\n elsif number % (f + 2) == 0\n return false\n end\n f += 6\n end\n return true\n end\nend", "title": "" }, { "docid": "bed1e89ea9d823b1bb22d0f31edd6983", "score": "0.8179657", "text": "def prime?(num)\nend", "title": "" }, { "docid": "821d8a195e0592004f40e4a42dade8e8", "score": "0.81762195", "text": "def is_prime?(number)\n (2..Math.sqrt(number).floor).none? do |x|\n number % x == 0\n end\nend", "title": "" }, { "docid": "821d8a195e0592004f40e4a42dade8e8", "score": "0.81762195", "text": "def is_prime?(number)\n (2..Math.sqrt(number).floor).none? do |x|\n number % x == 0\n end\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "dea47ba7784c8b1fe8a138c37ec13c57", "score": "0.81667084", "text": "def prime?(num)\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\nend", "title": "" }, { "docid": "c0b5550ef40c438bf67909aace503d43", "score": "0.8158656", "text": "def IsPrime(number)\r\n if number & 1 == 0\r\n return number == 2\r\n end\r\n \r\n limit = Math.sqrt(number)\r\n \r\n i = 3\r\n while i <= limit\r\n if number % i == 0\r\n return false\r\n end\r\n i += 2\r\n end\r\n \r\n return true\r\n end", "title": "" }, { "docid": "7126b7c11b7116112f8cb20c07a5f6c2", "score": "0.8109046", "text": "def is_prime?(num)\r\n\t# Return false for 1\r\n\treturn false if num == 1\r\n\t# Check if num divisible by 2\r\n return false if num % 2 == 0 && num > 2\r\n # Otherwise check odd numbers\r\n (3..Math.sqrt(num)).step(2).each do |n|\r\n \treturn false if num%n == 0\r\n end\r\n return true;\r\nend", "title": "" }, { "docid": "dd3eba65438f664e02d22639839db8bd", "score": "0.8101393", "text": "def is_prime?(number)\n is_prime = true\n 2.upto(Math.sqrt(number).floor) do |num|\n if number % num == 0\n is_prime = false\n break\n end\n end\n is_prime\nend", "title": "" }, { "docid": "dd3eba65438f664e02d22639839db8bd", "score": "0.8101393", "text": "def is_prime?(number)\n is_prime = true\n 2.upto(Math.sqrt(number).floor) do |num|\n if number % num == 0\n is_prime = false\n break\n end\n end\n is_prime\nend", "title": "" }, { "docid": "dd3eba65438f664e02d22639839db8bd", "score": "0.8101393", "text": "def is_prime?(number)\n is_prime = true\n 2.upto(Math.sqrt(number).floor) do |num|\n if number % num == 0\n is_prime = false\n break\n end\n end\n is_prime\nend", "title": "" }, { "docid": "64231db31e897f0bf50f808617535289", "score": "0.8093187", "text": "def prime?(number)\n#writing pseudocode\n # is it a whole number? Should return false if a decimal\n return false if !number.integer?\n # is it less than two? Should return false\n return false if number < 2\n # should return true if the number is two\n return true if number == 2\n # tesing if number can devided evenly by any integer from 2 to one less than the number. Should return false if yes\n (2..number - 1).each { |int| return false if number % int == 0 }\n # if no number divides it evenly from above, should return true\n true\nend", "title": "" }, { "docid": "3325e6e5bfcb0493580374c17be5e95b", "score": "0.8090726", "text": "def prime?(num)\n\nend", "title": "" }, { "docid": "3325e6e5bfcb0493580374c17be5e95b", "score": "0.8090726", "text": "def prime?(num)\n\nend", "title": "" }, { "docid": "3325e6e5bfcb0493580374c17be5e95b", "score": "0.8090726", "text": "def prime?(num)\n\nend", "title": "" }, { "docid": "3325e6e5bfcb0493580374c17be5e95b", "score": "0.8090726", "text": "def prime?(num)\n\nend", "title": "" }, { "docid": "3325e6e5bfcb0493580374c17be5e95b", "score": "0.8090726", "text": "def prime?(num)\n\nend", "title": "" }, { "docid": "7846e39e5a9db86531808b12f82dc928", "score": "0.809056", "text": "def is_prime?(number)\n (2..(Math.sqrt(number).to_i)).to_a.each do |num|\n return false if number % num == 0\n end\n true\nend", "title": "" }, { "docid": "30d08d0ca237a233ea42c80f32cfc372", "score": "0.80881006", "text": "def is_prime?(num)\n\n return false if num <= 1\n Math.sqrt(num).to_i.downto(2).each {|i| return false if num % i == 0}\n true\n\nend", "title": "" }, { "docid": "5261a2bb1a25bd101f25eca950580611", "score": "0.8084529", "text": "def prime?(number)\n return false if number < 2\n (2..number/2).none? { |factor| number % factor == 0 }\nend", "title": "" }, { "docid": "36b085873ced154968b9f5e8c00ec732", "score": "0.80824155", "text": "def is_prime?(number)\n\tx = Math.sqrt(number).ceil\n\tfor num in 2..x\n\t\tif number % num == 0\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\nend", "title": "" }, { "docid": "8df007bcd58386212e712c50537fd199", "score": "0.8080445", "text": "def prime?(number)\n value_from = 2\n if number < value_from\n return false\n else\n (value_from..(Math.sqrt(number))).each do |i|\n return false if number % i == 0 || number % (i + 2) == 0\n end\n return true\n end\n end", "title": "" }, { "docid": "15ee34df2ae760d6c39c6da08dcc0219", "score": "0.80788", "text": "def prime?(num)\n\t(2 .. Math.sqrt(num)).each {|i| return false if num % i == 0}\n\treturn true\nend", "title": "" }, { "docid": "6806aa991aaa395a3c94bf645257cffc", "score": "0.8077283", "text": "def isPrime(num)\n return false if num <= 1\n return true if [2, 3, 5].include?(num)\n return false if num.even?\n return false if num.to_s.split.map(&:to_i).sum % 3 == 0\n return false if num.to_s.split(\"\")[-1] == \"5\"\n\n Math.sqrt(num).floor.downto(7).each do |n|\n return false if (num % n).zero?\n end\n\n true\nend", "title": "" }, { "docid": "0000771be232c9dec04578a37747d5ed", "score": "0.80763465", "text": "def prime?(num)\n Math.sqrt(num).floor.downto(2).each {|i| p num % i == 0}\nend", "title": "" }, { "docid": "6e4204a073ea8dc0c9a1fd53447644cd", "score": "0.8073036", "text": "def prime?(number)\n\n numSqrt = Math.sqrt(number).floor\n #p numSqrt\n for num in 2..numSqrt\n if number % num == 0 then\n puts false\n return false\n end\n end\n puts true\n return true\n\nend", "title": "" }, { "docid": "87dcf948f37bb892ba8bce3e8e6eba36", "score": "0.8072367", "text": "def isPrime?(num)\n return false if num <= 1\n\n i = 2\n while i <= (Math.sqrt(num)).floor\n if (num % i) == 0\n return false\n end\n i += 1\n end \n\n return true\nend", "title": "" }, { "docid": "3c946207067fda6892a00010b3a2eb1f", "score": "0.80691904", "text": "def primeSqrt?(n)\n\treturn true if n == 2 || n == 3\n\treturn false if n <= 1 || n % 2 == 0 || n % 3 == 0 \n\t\n\t!2.upto(Math.sqrt(n).to_i).to_a.any? {|x| n % x == 0}\n\t\nend", "title": "" }, { "docid": "97595defc6a212b19bf9412c5bdca41f", "score": "0.80625904", "text": "def is_prime?(num)\n\n end", "title": "" }, { "docid": "254ded052b0a270c2dcdf4506a285f79", "score": "0.80568796", "text": "def is_prime?(num)\n if num < 0\n false\n elsif num.between?(0,2)\n true\n elsif ((2..Math.sqrt(num).floor).to_a.all?{|x| num % x != 0})\n true\n else\n false\n end\n end", "title": "" }, { "docid": "c6a6ff7fefa325718ce7a00c24ba716b", "score": "0.80518067", "text": "def is_prime?(num)\n return if num <= 1\n (2..Math.sqrt(num)).none? { |i| (num % i).zero? }\nend", "title": "" }, { "docid": "bed94d0578afe5fa76cfb7b7a471d7f0", "score": "0.8048717", "text": "def prime_number(number)\n non_prime_flag = if number <= 1\n true\n elsif number == 2\n false\n elsif number.even?\n true\n else\n (2..Math.sqrt(number)).any? { |i| number % i == 0 }\n end\n\n if !non_prime_flag\n puts \"The given number #{number} is a Prime.\"\n else\n puts \"The given number #{number} is not a Prime.\"\n end\nend", "title": "" }, { "docid": "68fd389f6752c4595bb96ae5dc2552c8", "score": "0.8043204", "text": "def is_prime(number)\n for i in 2..Math.sqrt(number).to_i\n return false if number % i == 0\n end\n return true\nend", "title": "" }, { "docid": "208197af8d19dd495b0fd77a1c0ed07f", "score": "0.8039699", "text": "def prime?(num)\n Math.sqrt(num).floor.downto(2).each{|i|p num % i ==0}\nend", "title": "" }, { "docid": "fc979fb9f24d93d4010882187862d223", "score": "0.8035346", "text": "def is_prime?(n)\n 2.upto(Math.sqrt(n)) {|f| return false if n % f == 0}\n true\nend", "title": "" }, { "docid": "b5204fb17196314a4c253baa04c2c33b", "score": "0.80312955", "text": "def isPrime?(num)\n i = 2\n while i <= (Math.sqrt(num)).floor\n if (num % i) == 0\n return false\n end\n i += 1\n end \n return true if num > 1\n return false\nend", "title": "" }, { "docid": "cfe25baecc5b7ca777d593bae64748ff", "score": "0.80300885", "text": "def is_prime?(num)\r\n\t# Check if num divisible by 2\r\n return false if num % 2 == 0 && num > 2\r\n # Otherwise check odd numbers\r\n (3..Math.sqrt(num)).step(2).each do |n|\r\n \treturn false if num%n == 0\r\n end\r\n return true;\r\nend", "title": "" }, { "docid": "cfe25baecc5b7ca777d593bae64748ff", "score": "0.80300885", "text": "def is_prime?(num)\r\n\t# Check if num divisible by 2\r\n return false if num % 2 == 0 && num > 2\r\n # Otherwise check odd numbers\r\n (3..Math.sqrt(num)).step(2).each do |n|\r\n \treturn false if num%n == 0\r\n end\r\n return true;\r\nend", "title": "" }, { "docid": "2f4c3cdd8c81d811a2f957da6ff47ee3", "score": "0.802792", "text": "def is_a_prime?(number)\n if number < 2\n return false\n elsif number == 2\n return true\n elsif is_even?(number)\n return false\n end\n\n root = Math.sqrt(number)\n (3..root + 1).to_a.each do |test_number|\n next if is_even?(test_number)\n return false if number.modulo(test_number) == 0\n end\n\n return true\nend", "title": "" }, { "docid": "ea6cb564320adc4c21edf8d06e5cb735", "score": "0.8023284", "text": "def is_prime? num\n 2.upto(Math.sqrt(num)) do |n|\n return false if (num % n == 0)\n end\n return true\nend", "title": "" }, { "docid": "ea6cb564320adc4c21edf8d06e5cb735", "score": "0.8023284", "text": "def is_prime? num\n 2.upto(Math.sqrt(num)) do |n|\n return false if (num % n == 0)\n end\n return true\nend", "title": "" }, { "docid": "53213872d93f02da683108039066b038", "score": "0.80227435", "text": "def is_prime?(num)\r\n\t# Check if num divisible by 2\r\n return false if num % 2 == 0\r\n # Otherwise check odd numbers\r\n (3..Math.sqrt(num)).step(2).each do |n|\r\n \treturn false if num%n == 0\r\n end\r\n return true;\r\nend", "title": "" }, { "docid": "2fe019bd238689527698443c1516c410", "score": "0.80205303", "text": "def prime?(num)\n\t\tif num != 2 and num % 2 == 0\n\t\t\treturn false # all primes (other than 2!) are odd numbers (since all evens divide evenly by 2)\n\t\telse # our test will consist of looking for a number less than n (starting with 3) that divides evenly into n\n\t\t\ti = 3\n\t\t\twhile i*i <= num # stop after we get to sqrt(i)\n\t\t\t\treturn false if num % i == 0\n\t\t\t\ti += 2 # skip even factors\n\t\t\tend\n\t\t\treturn true\n\t\tend\n\tend", "title": "" }, { "docid": "1c0b010a46aab94ad2956fb2fa98bd8d", "score": "0.8015877", "text": "def prime?(number)\n is_prime = true\n\n @@primes.each do |p|\n break if p > Math.sqrt(number).ceil\n\n if number % p == 0\n is_prime = false\n break\n end\n end\n\n is_prime\n end", "title": "" }, { "docid": "4587a1b9c175592d7c6cd162e23d7004", "score": "0.80139625", "text": "def is_prime?(num)\n return false if num % 2 == 0\n\n 3.upto(Math.sqrt(num)) do |n|\n return false if num % n == 0\n end\n\n true\nend", "title": "" }, { "docid": "55a79a5a06d9c456a0c8b584f1c83b2b", "score": "0.80124134", "text": "def is_prime?(num)\n for i in (2..Math.sqrt(num))\n return false if num % i == 0\n end\n true\nend", "title": "" }, { "docid": "f3aa95bbf3e342e5f0c5119f5e620647", "score": "0.8005548", "text": "def prime?(n)\n return true if n == 2\n return true if n == 3\n return false if n % 2 == 0\n m = Math.sqrt(n)\n i = 3\n while i < m\n return false if n % i == 0\n i += 2\n end\n return true\nend", "title": "" }, { "docid": "78a94ec129248145132774ed5373937d", "score": "0.80044836", "text": "def prime?(number)\n return false if number <= 1 \n\n max = Math.sqrt(number)\n\n (2..max).any? do |i| \n if number % i == 0 then return false end\n end\n\n true\n end", "title": "" }, { "docid": "9e1fcec39f4d9655823d15adade08fbf", "score": "0.8001488", "text": "def is_prime?(num)\n return false if num<=1\n Math.sqrt(num).to_i.downto(2).each{|i| return false if num % i == 0}\n true \n end", "title": "" }, { "docid": "badd0f973ae931b05a15962c8510f428", "score": "0.79997796", "text": "def is_prime(number)\n for i in 2..Math.sqrt(number).to_i do\n return false if number % i == 0\n end\n return true\nend", "title": "" }, { "docid": "347296f11b3c8ca995ea5091361a233a", "score": "0.79985756", "text": "def prime?(num)\r\n (2..Math.sqrt(num)).none? {|i| num % i == 0 }\r\nend", "title": "" }, { "docid": "78b04502dc23f4459ddd6654d1126b69", "score": "0.7996461", "text": "def prime?(n)\n return false if n == 1\n (2..Math.sqrt(n)).to_a.none? {|i| n % i == 0}\nend", "title": "" }, { "docid": "d50d89bc7b4b581c16fe557d14ace1bf", "score": "0.79913324", "text": "def is_prime?(num)\nend", "title": "" }, { "docid": "d50d89bc7b4b581c16fe557d14ace1bf", "score": "0.79913324", "text": "def is_prime?(num)\nend", "title": "" }, { "docid": "d50d89bc7b4b581c16fe557d14ace1bf", "score": "0.79913324", "text": "def is_prime?(num)\nend", "title": "" }, { "docid": "ef77bf1f2c0350f361e4ff0bc50ff93e", "score": "0.798962", "text": "def is_prime?(num)\n return false if num == 0\n return true if num == 2\n\n (2..Math.sqrt(num)).none? { |n| (num % n) == 0 }\nend", "title": "" }, { "docid": "d407f0075505d7bc59f5db2ffffd6ce0", "score": "0.7988715", "text": "def prime?(number)\n (2..(number / 2)).each do |num|\n return false if (number % num).zero?\n end\n true\n end", "title": "" }, { "docid": "8f2075d18e74a25a7f83ecc82939d4c2", "score": "0.7983681", "text": "def is_prime?(number)\n \n if number == 2 then return true end\n if number%2 == 0 then return false end\n if number == 3 then return true end\n if number%3 == 0 then return false end\n \n square_root= Math.sqrt(number).to_i # .to_i is not necessary, but it doesn't hurt (9<9.5 is true)\n \n divisor= 5\n while divisor <= square_root\n \n if number%divisor == 0 then return false end\n \n divisor+= 2\n if number%divisor == 0 then return false end\n \n divisor+= 4\n end\n # note the sequence of divisors, 5,7,11,13,17,19,23,25,29,31... <- these are the set of numbers not divisible by either 2 or 3 or both\n \n return true\nend", "title": "" }, { "docid": "03f215ea2b953aefe2f587972f2427cd", "score": "0.7983286", "text": "def is_prime?(n)\n return false if n < 2\n 2.upto(Math.sqrt(n).to_i) { |i| return false if n % i == 0 }\nend", "title": "" }, { "docid": "3d7528543a5134de314bfb0b116091db", "score": "0.79752517", "text": "def is_prime?(given_number)\n if given_number.is_a?(Fixnum) && given_number.is_a?(Integer) && given_number > 1\n 2.upto(Math.sqrt(given_number - 1).ceil) do |x|\n if given_number % x == 0\n return false\n end\n end\n true\n else\n \"Invalid Entry\"\n end\nend", "title": "" }, { "docid": "4a4208d80db5f2b5e62ef745a235529f", "score": "0.7966737", "text": "def is_prime?(number)\n if number % 2 !=0\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "343d42c9d3f428ca95c09d60b3198a9f", "score": "0.79650974", "text": "def prime?(number)\n if number <= 1\n return false\n else\n (2..number/2).none? { |n| number % n == 0 }\n end\nend", "title": "" }, { "docid": "ce5bb00f121a2deb50253785b90e462b", "score": "0.79623663", "text": "def is_prime(number, primes_so_far)\n if primes_so_far[number]\n return true\n end\n i = 2\n while i <= Math.sqrt(number)\n return false if number % i == 0\n i += 1\n end\n return true\nend", "title": "" }, { "docid": "6f77ad83e515bee894286cde6c58f86e", "score": "0.79622954", "text": "def is_prime?(num)\n return false if num < 2\n i = 2\n while i <= Math.sqrt(num)\n if num % i == 0\n return false\n end\n i += 1\n end\n true\nend", "title": "" }, { "docid": "a32aac7307aaea3de95f68eaae0b5b5c", "score": "0.7961814", "text": "def prime? (n)\n\t2.upto Math.sqrt(n).to_i do |div|\n\t\tif n % div == 0:\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\nend", "title": "" }, { "docid": "cfe7b97bfa021ceecf98a6936885ca4f", "score": "0.79545605", "text": "def is_prime?(number)\n factors = []\n (2..(Math.sqrt(number))).each do |multiple|\n if number % multiple == 0\n factors << multiple\n factors << (number / multiple)\n end\n end\n factors == [] ? true : false\nend", "title": "" }, { "docid": "322cfcbb0d39885922b7acd4133148aa", "score": "0.7948117", "text": "def prime?(number)\n # return false if number is not a whole number\n return false if !number.integer?\n\n # return false if number is under 2\n return false if number < 2\n\n # return false if the number can be divided evenly by any number preceding the number\n (2..number-1).each {|int| return false if number % int == 0}\n\n # returns true if the number cannot be divided evenly by any number preceding it\n true\nend", "title": "" }, { "docid": "f973e0d97388fc9cbd7b042d11181f5b", "score": "0.79390097", "text": "def check_prime? input_num\n\n result = (2..Math.sqrt(input_num)).none? { |num| (input_num % num).zero?}\n\nend", "title": "" } ]
3483fb12cb178f5e2a8a2644b68a5887
GET /linksets GET /linksets.json
[ { "docid": "e092cf0bb7970d617183afec24da00a0", "score": "0.7781116", "text": "def index\n @linksets = Linkset.all\n end", "title": "" } ]
[ { "docid": "7d76375506b4ff25ae4938f406e9ede1", "score": "0.7129271", "text": "def index\n @source_linksets = SourceLinkset.all\n end", "title": "" }, { "docid": "ec5d9eedcc925a9cc8802b60904fde83", "score": "0.66114926", "text": "def set_linkset\n @linkset = Linkset.find(params[:id])\n end", "title": "" }, { "docid": "df7003ae63344c3e8cc7ef81c9dea11b", "score": "0.63458246", "text": "def get_links\n @links.get_all\n end", "title": "" }, { "docid": "ba9cd90d64d81654d8324108c4c3bb89", "score": "0.62260735", "text": "def create\n @linkset = Linkset.new(linkset_params)\n\n respond_to do |format|\n if @linkset.save\n format.html { redirect_to @linkset, notice: 'Linkset was successfully created.' }\n format.json { render :show, status: :created, location: @linkset}\n else\n format.html { render :new }\n format.json { render json: @linkset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aaaf670cde6b63614df597204157dc6b", "score": "0.6180176", "text": "def links\n EMPTY_SET\n end", "title": "" }, { "docid": "584f5d34d545f109f9677c416e9f6d0d", "score": "0.6165147", "text": "def links\n data['links']\n end", "title": "" }, { "docid": "584f5d34d545f109f9677c416e9f6d0d", "score": "0.6165147", "text": "def links\n data['links']\n end", "title": "" }, { "docid": "d97d26ea06de8270b1d67edb0bb44c59", "score": "0.6162515", "text": "def setlist\n setlist_json = []\n total_sets = Show.find(params[\"id\"]).total_sets\n Show.find(params[\"id\"]).setlists.each do |setlist|\n song = Song.find(setlist.song_id)\n setlist_json << {\"set_id\" => setlist.set_id, \"song_order\" => setlist.song_order, \"song_name\" => song.song_name, \"segue\" => setlist.song_suffix, \"total_sets\" => total_sets}\n end\n render :json => setlist_json.to_json, :layout => false\n end", "title": "" }, { "docid": "fea388c8419be21b9908d98099201818", "score": "0.61521333", "text": "def all\n setup_file\n \n links_data = File.open('link_db').read\n links = JSON.parse(links_data)\n \n return links\nend", "title": "" }, { "docid": "9cba2178d4d130fa3e8c57f164975cfe", "score": "0.6123047", "text": "def index\n @groupon_links = GrouponLink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupon_links }\n end\n end", "title": "" }, { "docid": "c0936c3b6aa6f3250c4c4c3bd1bd75fe", "score": "0.6115528", "text": "def list_sets\n log_message( \"Listing sets...\" ) unless @logging == false\n set_list = @connection.get( \"set\" )\n return set_list\n end", "title": "" }, { "docid": "e776c5123b387722f2156955790cf641", "score": "0.60246223", "text": "def index\n @links = Link.includes(:link_category).group_by { |link| link.link_category_id }\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "title": "" }, { "docid": "00611167f6f26c253f78814c70fca9a2", "score": "0.5993741", "text": "def links\n KISSmetrics::Client::Response::Links.new(@attributes.fetch('links', []))\n end", "title": "" }, { "docid": "55cbc434907a6cb742efe778dea5bde6", "score": "0.59814787", "text": "def index\n @links = Link.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "title": "" }, { "docid": "26a4867c30665d8f6861a7e627c46b48", "score": "0.59691525", "text": "def links; @links; end", "title": "" }, { "docid": "4ca8c579148a075fa92c7fd6131e4beb", "score": "0.5957091", "text": "def links\n @links.values\n end", "title": "" }, { "docid": "d151f881e063cce61a79ee4a9466ac5e", "score": "0.59542674", "text": "def collections\n response = Nokogiri::XML(open(@base_uri.merge('cgi-bin/oai.exe?verb=ListSets')))\n sets = response.search('//xmlns:set',response.namespaces)\n result = {}\n sets.inject({}) { |hash,set| \n set_id = (set / 'setSpec').text()\n set_desc = (set / 'setName').text()\n hash[set_id] = set_desc\n hash\n }\n end", "title": "" }, { "docid": "ab02693de1a006e96f0a6e4eba0007f5", "score": "0.594696", "text": "def links\n read\n @links\n end", "title": "" }, { "docid": "4d0e97f59461f1ae33696fa28e7d41c8", "score": "0.59440875", "text": "def index\n @sources = LinkSource.all\n\n respond_to do |format|\n format.json { render json: @sources }\n end\n end", "title": "" }, { "docid": "56dbeec358f8e448229b84ec2f280153", "score": "0.5943348", "text": "def sets\n list_directories(\"#{resource_dir}/sets\")\n end", "title": "" }, { "docid": "4674fa91100ffe6a54600e194939940d", "score": "0.59328336", "text": "def list_sets(opts={})\n do_resumable(OAI::ListSetsResponse, 'ListSets', opts)\n end", "title": "" }, { "docid": "659c7c9bb7c4ca03bc21edbed58cd7e2", "score": "0.59310615", "text": "def sets\n my_sets = []\n object.bundles.sets.each do |set|\n my_sets.push(BundleSerializer.new(set))\n end\n my_sets\n end", "title": "" }, { "docid": "1c4aaa179b47781ce144e3eeb54156c6", "score": "0.5896425", "text": "def links\r\n @links.keys\r\n end", "title": "" }, { "docid": "ead77b2a66fecd406e01484950abbd88", "score": "0.5886542", "text": "def links\n @links ||= {}\n end", "title": "" }, { "docid": "5b5127454d47f8c978136d7aa3c07f78", "score": "0.58735627", "text": "def links\n @links\n end", "title": "" }, { "docid": "504ccbda535fe7b1b019468f64e1892d", "score": "0.5861876", "text": "def links\n links = []\n begin\n response = JSON.parse(self.json)\n rescue JSON::ParserError, TypeError => e\n puts e\n response = self.json\n end\n unless response['data']['children'].nil?\n response['data']['children'].each do |child|\n links.push(child['data']['url'])\n end\n return links\n else\n return response\n end\n end", "title": "" }, { "docid": "357482ece7718dc4662ebcaf2b03affb", "score": "0.58572656", "text": "def list_sets(options = {})\n Response::ListSets.new(provider_context, options).to_xml\n end", "title": "" }, { "docid": "bbc7f9dad147ba0ba619f3024a482eaf", "score": "0.58204865", "text": "def get_refsets(uuid, view_params)\n\n coordinates_token = session[:coordinates_token].token\n refsets_results = {}\n sememe_types = {}\n page_number = params[:taxonomy_refsets_page_number]\n page_size = 25\n\n if params[:taxonomy_refsets_page_size] != nil\n page_size = params[:taxonomy_refsets_page_size]\n end\n\n additional_req_params = {coordToken: coordinates_token, expand: 'chronology,nestedSememes,referencedDetails', pageNum: page_number}\n additional_req_params[:maxPageSize] = page_size\n additional_req_params.merge!(view_params)\n\n results = SememeRest.get_sememe(action: SememeRestActions::ACTION_BY_ASSEMBLAGE, uuid_or_id: uuid, additional_req_params:additional_req_params )\n\n refsets_results[:total_number] = results.paginationData.approximateTotal\n refsets_results[:page_number] = results.paginationData.pageNum\n used_column_list = []\n\n display_data = process_attached_refsets(view_params, results.results, sememe_types, [], used_column_list)\n\n refsets_results[:data] = display_data\n refsets_results[:columns] = used_column_list\n return refsets_results\n end", "title": "" }, { "docid": "75bea5dc9056aff45da37ed13c0a67f7", "score": "0.5811791", "text": "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "title": "" }, { "docid": "75bea5dc9056aff45da37ed13c0a67f7", "score": "0.5811791", "text": "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "title": "" }, { "docid": "75bea5dc9056aff45da37ed13c0a67f7", "score": "0.5811791", "text": "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "title": "" }, { "docid": "ad9f678b6c1e554674d2eb2140ced455", "score": "0.5810264", "text": "def links\n\t\t\t@links.keys\n\t\tend", "title": "" }, { "docid": "95ccce327fbd1033a099a3cdd795511e", "score": "0.5807365", "text": "def all_links\n Link.all\n end", "title": "" }, { "docid": "95ccce327fbd1033a099a3cdd795511e", "score": "0.5807365", "text": "def all_links\n Link.all\n end", "title": "" }, { "docid": "8c495c2d724d61c327e3c5550c965ecc", "score": "0.5802921", "text": "def get(set_name)\n url = @uri + \"#{set_name}?api-version=#{api_version}\"\n url\n end", "title": "" }, { "docid": "102d6806f7d056775a3986960896a7e2", "score": "0.5780345", "text": "def index\n @node_sets = NodeSet.all\n end", "title": "" }, { "docid": "a9e51df2242f150bf3d5a8aeee429b66", "score": "0.5757859", "text": "def show\n @api_sets = @handler.get_sets\n @db_sets = @catalog.catalog_sets\n end", "title": "" }, { "docid": "14098edc11849676baef5bd0fd93beac", "score": "0.57452935", "text": "def show\n @links_json = Jbuilder.encode do |json|\n json.array! @collective.links do |link|\n json.extract! link, :id, :url, :title, :collective_id, :position, :summary\n json.link_cover_thumb link.link_cover.thumb.url\n json.link_cover_url link.link_cover.url\n end\n end\n end", "title": "" }, { "docid": "a14f638886d9a7e3d3c0a6ab9350db5d", "score": "0.57440436", "text": "def index\n # hacer paginacion\n @links = Link.all\n render json: {status: 'SUCCESS', message: 'Loaded Links', data: @link},status: :ok\n\tend", "title": "" }, { "docid": "09c009b9d0c5c5bb65bf878869f74f65", "score": "0.5743464", "text": "def set_source_linkset\n @source_linkset = SourceLinkset.find(params[:id])\n end", "title": "" }, { "docid": "25be17fe83c57425120fec1a7eb24421", "score": "0.57398915", "text": "def destroy\n @linkset.destroy\n respond_to do |format|\n format.html { redirect_to linksets_url, notice: 'Linkset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "980333b4daacb533765a44d86eb28515", "score": "0.5709114", "text": "def index\n @item_sets = ItemSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @item_sets }\n end\n end", "title": "" }, { "docid": "a8a5703f0fe1d36f06eaf8119dcbb269", "score": "0.570734", "text": "def multiverse_sets\n sets_json = open(MULTIVERSE_SETLIST_URI).read\n sets_objs = JSON.parse(sets_json)\n\n sets_objs.map do |obj|\n RemoteSetStub.new(obj['name'].andand.strip, obj['sourceURL'].andand.strip, obj['owner'].andand.strip)\n end\n end", "title": "" }, { "docid": "5afb6a7a7792ab43e5b03942fdbb1613", "score": "0.57043016", "text": "def new_generic_set\n @sets = Mtg::Set.includes(:cards).where(:active => true).where(\"mtg_cards.name LIKE ?\", \"#{params[:name]}\").order(\"release_date DESC\").to_a\n respond_to do |format|\n format.json { render :json => @sets.collect(&:name).zip(@sets.collect(&:code)).to_json }\n end\n end", "title": "" }, { "docid": "347bbbfce2c8ec6ad871b6fa0da2d4f5", "score": "0.56848687", "text": "def links\n @links ||= []\n end", "title": "" }, { "docid": "7a8cdcd3a89109d68900fb807672e857", "score": "0.5677481", "text": "def all\n render :json => @link.clicks, :except => [ :id, :updated_at, :link_id ]\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.5674339", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.5674339", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.5674339", "text": "def links\n return @links\n end", "title": "" }, { "docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4", "score": "0.5674339", "text": "def links\n return @links\n end", "title": "" }, { "docid": "aa892084e3d165e1b737b8c8e2ad7596", "score": "0.5654187", "text": "def links\n @links ||= []\n end", "title": "" }, { "docid": "62ab1aed72b2b4d6e1e6b518d5a461ea", "score": "0.56488377", "text": "def index\n @link1s = Link1.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @link1s }\n end\n end", "title": "" }, { "docid": "dd40fb4895a1d558c590296ba0898534", "score": "0.5636914", "text": "def _links\n @links\n end", "title": "" }, { "docid": "5e451968cf59aaa35c2f7fa3488b0af3", "score": "0.56308776", "text": "def top_level_links\n HTTP.get(LinkedData::Client.settings.rest_url)\n end", "title": "" }, { "docid": "7e3bd00010e647637a86b99cc1aa6ced", "score": "0.56297684", "text": "def links=(value)\n @links = value\n end", "title": "" }, { "docid": "7e3bd00010e647637a86b99cc1aa6ced", "score": "0.56297684", "text": "def links=(value)\n @links = value\n end", "title": "" }, { "docid": "7e3bd00010e647637a86b99cc1aa6ced", "score": "0.56297684", "text": "def links=(value)\n @links = value\n end", "title": "" }, { "docid": "7e3bd00010e647637a86b99cc1aa6ced", "score": "0.56297684", "text": "def links=(value)\n @links = value\n end", "title": "" }, { "docid": "fa270e824c2c4c57258ab2b289dc2345", "score": "0.56177264", "text": "def all_image_links\n request.format = :json\n respond_to do |format|\n #links get build from file name and id and by default original size is used\n if params[:album_id] then\n images = Album.find(params[:album_id]).images.image_links.order('created_at DESC')\n else\n images = Image.image_links.order('created_at DESC')\n end\n @links = Array.new\n images.each { |a| @links.push(a.link) }\n format.json { render :json => @links, status: :ok }\n end\n end", "title": "" }, { "docid": "4f22d2e9a6964a79dff0e6c8a55509a6", "score": "0.5605413", "text": "def all_links\n Link.all #the query returns all links\n end", "title": "" }, { "docid": "fab930ece7bf8c6cfd8f9ab40b68373c", "score": "0.56037915", "text": "def links\n some_links = self[\"link\"]\n return nil unless some_links\n some_links = [some_links] unless some_links.kind_of? Array\n LinkCollection.new(some_links)\n end", "title": "" }, { "docid": "2444b6129b5c400c188d0775a4c64362", "score": "0.55946285", "text": "def sitemap\n @linkset\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "d37647c3fd3dd62938bc4bdae31c93a1", "score": "0.5593134", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "3ce1f70dc1379a7da775d9a9f2d1b590", "score": "0.5589862", "text": "def index\n @link_schemas = Project.find(session[:project_id]).link_schemas\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @link_schemas }\n end\n end", "title": "" }, { "docid": "e1941d225653acc2be456c5e1b64c710", "score": "0.5588518", "text": "def url_list\n urls = Url.all.select('id, owner_id, title, link, favicon').order(created_at: :desc)\n render json: {code: 200, urls: urls}\n end", "title": "" }, { "docid": "a5c4e1207f4f2437a8d9c94e56ab7401", "score": "0.5582694", "text": "def convert_path_to_link(path)\n name_list = get_name_list(path)\n urls = create_sets_url(name_list)\n return urls, name_list\nend", "title": "" }, { "docid": "d4b42d4c43f8049d55425d149070c0e1", "score": "0.5581288", "text": "def index\n @ad_sets = AdSet.all\n end", "title": "" }, { "docid": "38fcb3ee44b7133eb79e8cd5a45c1b4e", "score": "0.5574703", "text": "def links\n @links.to_a\n end", "title": "" }, { "docid": "e3d220082fab4900cf79dcb540a456d4", "score": "0.5561047", "text": "def links\n links = []\n\n # 1. Related_URL\n if dif.Related_URL?\n\n dif.Related_URL.each do | link |\n\n if link.URL_Content_Type? and link.URL_Content_Type.Type?\n dif_type = link.URL_Content_Type.Type\n else\n dif_type = nil\n end\n\n rel = case dif_type\n when \"GET DATA\" then \"data\"\n when \"VIEW PROJECT HOME PAGE\" then \"project\"\n when \"VIEW EXTENDED METADATA\" then \"metadata\"\n when \"GET SERVICE\" then \"service\"\n when \"VIEW RELATED INFORMATION\", \"\", nil then \"related\"\n else dif_type\n end\n\n link.URL.each do | url |\n\n links << {\n \"rel\" => rel,\n \"href\" => url,\n \"title\" => link.Description,\n \"type\" => \"text/html\",\n }\n end\n end\n end\n\n # 2. Link to parent metadata\n unless object.Parent_DIF.nil?\n dif.Parent_DIF.each do | parent |\n\n links << {\n \"rel\" => \"parent\",\n \"href\" => base+uuid(self.class.uri(parent))+\".json\",\n \"type\" => \"application/json\"\n }\n\n end\n end\n\n # 3. Links to DOI and \"Online Resource\" (metadata)\n # @todo\n\n if dif.Entry_ID =~ /^(org[.|-]polarresearch\\-)/\n links << {\n \"rel\" => \"via\",\n \"href\" => \"http://risapi.data.npolar.no/oai?verb=GetRecord&metadataPrefix=dif&identifier=oai:ris.npolar.no:#{dif.Entry_ID}\",\n \"type\" => \"application/json\"\n }\n end\n\n # Links to GCMD project on api.npolar.no\n #unless dif.Project.nil?\n # projects = Gcmd::Concepts.new.tuples(\"projects\")\n #\n # links += dif.Project.map {|p|\n # id, label = projects.select { |tup | tup[1] == p[\"Short_Name\"]}[0]\n # unless id.nil?\n # link(\"/gcmd/concept/#{id}.json\", \"project\", label, \"application/json\")\n # else\n # [] #link(\"/gcmd/concept/?q=#{label}&title=false&fields=*&format=json\", \"project\", label, \"application/json\")\n # end\n #\n # }\n #end\n\n links\n end", "title": "" }, { "docid": "441af05f51939d4e9094af595abe12ba", "score": "0.5546675", "text": "def create\n @source_linkset = SourceLinkset.new(source_linkset_params)\n\n respond_to do |format|\n if @source_linkset.save\n format.html { redirect_to @source_linkset, notice: 'Source linkset was successfully created.' }\n format.json { render :show, status: :created, location: @source_linkset }\n else\n format.html { render :new }\n format.json { render json: @source_linkset.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b45daca0f8e776a54ddc1ed46b4563ef", "score": "0.5536169", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "91e4928a4820bf6eb1b1403b0dab009c", "score": "0.55302614", "text": "def index\n render json: @project.public_links, each_serializer: PublicLinkSerializer\n end", "title": "" }, { "docid": "8d9ceb5ffed81a985828387362e5211f", "score": "0.55278707", "text": "def get_link_data( *types )\n all_links = []\n # We'll include a sort by number of path components in this chain so\n # that we can improve the chances of higher-level items not having\n # naming conflicts. For example, the topmost index.html file should\n # not require a prefix!\n app.sitemap.resources\n .select { |r| r.content_type && r.content_type.start_with?( *types ) }\n .sort { |a, b| Pathname(a.destination_path).each_filename.to_a.count <=> Pathname(b.destination_path).each_filename.to_a.count }\n .each do |r|\n reference_path = Pathname(r.destination_path).each_filename.to_a.reverse\n reference_path.shift\n reference = File.basename(r.destination_path, '.*').gsub(%r{ }, '_')\n link = r.url\n hb_link = defined?(r.hb_NavId) ? \"#/#{r.hb_NavId}\" : nil\n title = r.data.title ? r.data.title.gsub(%r{</?[^>]+?>}, '') : nil\n\n i = 0\n while all_links.find { |link| link[:reference] == reference }\n next_piece = reference_path[i].gsub(%r{ }, '_')\n reference = \"#{next_piece}-#{reference}\"\n i += 1\n end\n\n all_links << {:reference => reference, :link => link, :title => title, :hb_link => hb_link}\n end # .each\n\n all_links\n end", "title": "" }, { "docid": "ed91c91ec310956393846f4cf07a254f", "score": "0.5527186", "text": "def index\n @links = Link.all\n end", "title": "" }, { "docid": "c7e41146a6920a5eb9708a589d547d55", "score": "0.5521308", "text": "def index\n @associated_sets = AssociatedSet.all\n end", "title": "" }, { "docid": "f61f977c91800772aee6f4f0b15c26be", "score": "0.55174387", "text": "def links=(value)\n @links = value || []\n end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.55127007", "text": "def links; end", "title": "" }, { "docid": "8f1ab6e77d4d4e2dff38f7432ff44055", "score": "0.5511363", "text": "def get_links\n results = DATABASE.execute(\"SELECT * FROM links WHERE assignment_id = #{@id}\")\n\n store_results = []\n\n results.each do |hash|\n store_results << Link.new(hash)\n end\n\n return store_results\n end", "title": "" }, { "docid": "fbfddec6e32f160b2beed00c030f0060", "score": "0.5501266", "text": "def index\n @link_accounts = LinkAccount.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @link_accounts }\n end\n end", "title": "" }, { "docid": "e5a071a01aa713462fdd6cb869f0a6fa", "score": "0.54865956", "text": "def index\n @relevant_links = RelevantLink.all\n end", "title": "" }, { "docid": "68df356491281eb812a0e2f6d59d12f3", "score": "0.5469491", "text": "def serialized_links\n return nil if new_resource.links.nil?\n return nil if new_resource.links.empty?\n ray = []\n Array(new_resource.links).each do |link|\n parts = link.split(':')\n ray << \"/#{parts[0]}:/#{new_resource.name}/#{parts[1]}\"\n end\n ray\n end", "title": "" } ]
b8c0ca984af8aa7ff319a86b11c522cc
Frame Update (main phase step 6 : refresh)
[ { "docid": "d9f174e01963ae43a2b6d9f39449d315", "score": "0.0", "text": "def update_phase4_step6\n # Clear battler being forced into action\n $game_temp.forcing_battler = nil\n # If common event ID is valid\n if @common_event_id > 0\n # Set up event\n common_event = $data_common_events[@common_event_id]\n $game_system.battle_interpreter.setup(common_event.list, 0)\n end\n # Shift to step 1\n @phase4_step = 1\n end", "title": "" } ]
[ { "docid": "cf64fd117b666f13a2a852428a4bed5b", "score": "0.71743536", "text": "def update\n\t\t@currentFrame += 1 if frame_expired?\n\tend", "title": "" }, { "docid": "b3a4d206ce1557cf1c6bf47084e28512", "score": "0.7173791", "text": "def refresh_frame(run_whereami=true)\n change_frame_to binding_index, run_whereami\n end", "title": "" }, { "docid": "b550ec75cd84ebcc1c959802d7b0e56f", "score": "0.69274455", "text": "def refresh; end", "title": "" }, { "docid": "b550ec75cd84ebcc1c959802d7b0e56f", "score": "0.69274455", "text": "def refresh; end", "title": "" }, { "docid": "b550ec75cd84ebcc1c959802d7b0e56f", "score": "0.69274455", "text": "def refresh; end", "title": "" }, { "docid": "992ca8d0251cbb225e92f9c209c34f0f", "score": "0.68405217", "text": "def refresh!; end", "title": "" }, { "docid": "a817c9bd1f52f9356614df866d64a0a3", "score": "0.67271316", "text": "def refresh\n end", "title": "" }, { "docid": "a817c9bd1f52f9356614df866d64a0a3", "score": "0.67271316", "text": "def refresh\n end", "title": "" }, { "docid": "0520dc947c0cb36ecec23aee1562a359", "score": "0.6720509", "text": "def refresh\n end", "title": "" }, { "docid": "0520dc947c0cb36ecec23aee1562a359", "score": "0.6720509", "text": "def refresh\n end", "title": "" }, { "docid": "b03f9bec34fdad3a0596af377e4ce673", "score": "0.6684701", "text": "def update \n\t\t# determine if we need to go next frame\t\n\t\t\tif Clock.runtime - @last_frame_time > @frame_delay_ms then\n \t\t@current_frame += 1\n \t\t@last_frame_time = Clock.runtime\n\t\tend\n \tif @current_frame >= @frames.size then\n \t\tcase\n\t\t\twhen @last_frame_persist then \t@current_frame = @frames.size - 1 \n\t\t\twhen @last_frame_loop then \t\t\t@current_frame = 0\n\t\t\telse\n\t\t\t\thandle_after_last_frame()\n\t\t\t\treturn # leave function, don't render\n\t\t\tend\t\n \tend\n\t\t@image = @frames[@current_frame]\t\n\t\t\n\t\tif (@image == nil)\n\t\t\tp \"nil image??\"\n\t\t\texit\n\t\tend\n\t\t\n \t@vy += @ay\n \t@vy = bound_vy(@vy)\n \t@vx += @ax\t \n \t@vx = bound_vx(@vx)\n \tvx_relative = @vx - TERRAIN_SPEED # relative to the scrolling frame of reference\n \t@rect.move!(vx_relative, @vy)\n \t@rect = bound_rect(@rect)\n \tif @rect.right < XMIN then handle_offscreen_left() end\n if @rect.left > XMAX then handle_offscreen_right() end\n \tif @rect.bottom < YMIN then handle_offscreen_top() end\n\tend", "title": "" }, { "docid": "9f0b11d30d9a3bd92653ea814604d3f8", "score": "0.66631895", "text": "def refresh\n Ncurses::Panel.update_panels();\n Ncurses.doupdate();\n @window.wrefresh\n end", "title": "" }, { "docid": "c9f3dd2a07a4bf4c0edc7e398e7977bf", "score": "0.65889883", "text": "def refresh()\r\n # time_at_start_of_redraw = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n # Sketchup.active_model.active_view.refresh\r\n # @redraw_delay = Process.clock_gettime(Process::CLOCK_MONOTONIC) - time_at_start_of_redraw \r\n time_at_start_of_redraw = Time.now\r\n Sketchup.active_model.active_view.refresh\r\n @redraw_delay = Time.now - time_at_start_of_redraw\r\n\r\n # @log ? @log << @redraw_delay : @log = [@redraw_delay]\r\n end", "title": "" }, { "docid": "5672448d4e3b2ca0e594716eed32df20", "score": "0.6569535", "text": "def refresh_window\n end", "title": "" }, { "docid": "598986d910a07eb57538ba4a4c64afaf", "score": "0.6544865", "text": "def refresh\n end", "title": "" }, { "docid": "d18992c9bfaa58583cace3ef68b3359a", "score": "0.6530303", "text": "def refresh\n\t\t\t@module_tree.refresh\n\t\t\tcontext_id = @statusbar.get_context_id(\"update\")\n\t\t\t@statusbar.push(\n\t\t\tcontext_id,\n\t\t\t\"Loaded \" +\n\t\t\tframework.stats.num_exploits.to_s + \" exploits, \" +\n\t\t\tframework.stats.num_payloads.to_s + \" payloads, \" +\n\t\t\tframework.stats.num_encoders.to_s + \" encoders, \" +\n\t\t\tframework.stats.num_nops.to_s + \" nops, and \" +\n\t\t\tframework.stats.num_auxiliary.to_s + \" auxiliary\"\n\t\t\t)\n\t\tend", "title": "" }, { "docid": "2aaaae0498d6fc0f966afdc98ecd6dd2", "score": "0.64408356", "text": "def refresh\n # calculates the total number of frames\n @totalFrames = (@bitmap.width.to_f/@bitmap.height).ceil\n @animationFrames = @totalFrames*@frames\n end", "title": "" }, { "docid": "6da6d1f094c19cac3b5b80549eeddd5d", "score": "0.6428452", "text": "def update\n draw\n @win.noutrefresh\n end", "title": "" }, { "docid": "48092857cdca98b27c9bce857524b615", "score": "0.6411973", "text": "def update_loading\n return unless Graphics.frame_count % 4 == 0\n @loading_state += 1\n refresh_square\n end", "title": "" }, { "docid": "31407cf6bcaa975cbbc11b4415e9d630", "score": "0.6384267", "text": "def update\n\t\t# TODO: add framerate calculation to Timer class\n\t\t\n\t\t@fps_history << @window.ofGetFrameRate.round(5)\n\t\tif @fps_history.length > @max_buffer_size\n\t\t\t@fps_history.shift # remove the first element\n\t\tend\n\t\t\n\t\t# check to make sure the buffer is now under the limit.\n\t\t# if it has gone over, need to raise an error of some sort.\n\t\tif @fps_history.length > @max_buffer_size\n\t\t\traise \"fps history buffer saturated\"\n\t\tend\n\tend", "title": "" }, { "docid": "ba0d81fc951048c0f42abacaca3190fe", "score": "0.63084704", "text": "def update\n @frame = Frame.find(params[:id])\n respond_to do |format|\n if @frame.update_attributes(params[:frame])\n @game = @frame.game\n if completed?(@frame) \n if @frame.position == 11\n #do nothing for now\n elsif @game.current_frame == @frame.id \n @game.update_attributes(:current_frame => frameafter(@frame).id,\n :active_frame => frameafter(@frame).id)\n end\n end\n rewrite_totals unless @frame.position == 11\n format.html { redirect_to(@game, :notice => 'Frame was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frame.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7207048c245677a41e0cea352fe1cb1e", "score": "0.62566495", "text": "def refresh\n\t\treprint\n\tend", "title": "" }, { "docid": "f8b4eff71e88adbdcfc0dd7f0a2532cc", "score": "0.6247042", "text": "def refresh\n do_refresh\n end", "title": "" }, { "docid": "0eabcd5ba4e08a913d84272b07f7da3b", "score": "0.6234714", "text": "def refresh\n wrefresh @win\n end", "title": "" }, { "docid": "1623e142326cc1d25c6034e50edb23c9", "score": "0.62295014", "text": "def frames; end", "title": "" }, { "docid": "1623e142326cc1d25c6034e50edb23c9", "score": "0.62295014", "text": "def frames; end", "title": "" }, { "docid": "67dea65c8375a0345791f2c68365307c", "score": "0.6204047", "text": "def update\n super\n update_bitmap # Update flag graphic\n update_screen # Update the position the graphic should be displayed\n update_frame # Update the frame count (and also the low supplies graphics)\n end", "title": "" }, { "docid": "6e782d86e8b8fd4a9e2ca10f8456e3e7", "score": "0.61996543", "text": "def update\n @window.noutrefresh\n update_children\n # toplevel only: update whole screen\n if @parent == nil\n Curses.doupdate\n end\n end", "title": "" }, { "docid": "169de07bea01e747655d27a357e89ed0", "score": "0.61971384", "text": "def update\n #@replay.update\n @return.update\n\n slide_view\n end", "title": "" }, { "docid": "7b0affddb9035cd7ed8a19e2121ffada", "score": "0.6178006", "text": "def frame; end", "title": "" }, { "docid": "7b0affddb9035cd7ed8a19e2121ffada", "score": "0.6178006", "text": "def frame; end", "title": "" }, { "docid": "7b0affddb9035cd7ed8a19e2121ffada", "score": "0.6178006", "text": "def frame; end", "title": "" }, { "docid": "f64a3c90aa27dc9b6a072a5884b1ab7f", "score": "0.6163616", "text": "def on_refresh; end", "title": "" }, { "docid": "76f4b70f0407958b839ea88c45f04a98", "score": "0.6158308", "text": "def refresh_screen\n refresh\n\n Inkblot::Display.again\n end", "title": "" }, { "docid": "b848ea37d97188cd2303b5384593521c", "score": "0.6156811", "text": "def update_application(timer)\n @counter += timer.getTimePerFrame\n @frames += 1\n if (@counter > 1)\n fps = (@frames / @counter.to_f)\n @counter = 0\n @frames = 0\n @frame.setTitle(\"UI Sample: #{java.lang.Math.round(fps)} FPS\")\n end\n @hud.updateGeometricState(timer.getTimePerFrame)\n end", "title": "" }, { "docid": "f836c596c3948713e52da92edf5e139a", "score": "0.61220485", "text": "def frame= frame\n @frame = frame\n frame.frame_tracker.update(frame)\n end", "title": "" }, { "docid": "ce14a43e45f1ed5dd169c063b33fe7a3", "score": "0.6120979", "text": "def update_graph\n render :update do |page|\n page.replace_html :mainPanel, (render :action=> :show_graph)\n end\n end", "title": "" }, { "docid": "ce14a43e45f1ed5dd169c063b33fe7a3", "score": "0.6120979", "text": "def update_graph\n render :update do |page|\n page.replace_html :mainPanel, (render :action=> :show_graph)\n end\n end", "title": "" }, { "docid": "0d51cfcf9393af00b0ad030bd0aa8e70", "score": "0.6110782", "text": "def refresh\n setNeedsDisplay\n end", "title": "" }, { "docid": "eaedf0c65c5844b37f2ec51dd88de069", "score": "0.60881454", "text": "def tgtFrame; end", "title": "" }, { "docid": "3b112fc5609bf6e0a5e5988ea71375dc", "score": "0.6087429", "text": "def refresh\n super 0.1\n end", "title": "" }, { "docid": "732b01c20579db09bb4900eb1b916d55", "score": "0.60664135", "text": "def run_frame(frame); end", "title": "" }, { "docid": "a897de3384b94bc054ddf7334a7b14db", "score": "0.6030784", "text": "def update!(**args)\n @frame_count = args[:frame_count] if args.key?(:frame_count)\n @render_millis = args[:render_millis] if args.key?(:render_millis)\n end", "title": "" }, { "docid": "a897de3384b94bc054ddf7334a7b14db", "score": "0.6030784", "text": "def update!(**args)\n @frame_count = args[:frame_count] if args.key?(:frame_count)\n @render_millis = args[:render_millis] if args.key?(:render_millis)\n end", "title": "" }, { "docid": "bd63b4280d0cc08b28d384553e1f9ed8", "score": "0.60149634", "text": "def framing; end", "title": "" }, { "docid": "ba65b9f07e6a6865671aadca1b6ab044", "score": "0.5998405", "text": "def refresh!\n load if changed?\n end", "title": "" }, { "docid": "04c40c9c6997d56a21233599aefde335", "score": "0.59956676", "text": "def refresh\n do_refresh\n self\n end", "title": "" }, { "docid": "43c08e2822bee9efbb319f4377c0feb7", "score": "0.5995245", "text": "def refresh\n load if changed?\n end", "title": "" }, { "docid": "24850e16125e161c53c6a9c7ce75763a", "score": "0.59927624", "text": "def refresh_viewport\r\n update_gizmo()\r\n false\r\n end", "title": "" }, { "docid": "4222b3325c984cac4bf990b8cd3e8802", "score": "0.59788764", "text": "def refresh\n browser.refresh\n end", "title": "" }, { "docid": "cb2162d3a1fd3434effd12aa702f250f", "score": "0.5971718", "text": "def update() end", "title": "" }, { "docid": "bfe7b7e986654baac4424d4da85d6ae9", "score": "0.5970085", "text": "def update\n\t\t@frame += 1 unless @paused\n\t\tsuper\n\tend", "title": "" }, { "docid": "b89543cadbbc925de83b1c5cc9a0ff35", "score": "0.59678656", "text": "def update\n return if disposed?\n if @gifbitmaps.length>0\n @framecount+=2\n @framecount=@totalframes<=0 ? 0 : @framecount%@totalframes\n frametoshow=0\n for i in 0...@gifdelays.length\n frametoshow=i if @gifdelays[i]<=@framecount\n end\n @currentIndex=frametoshow\n end\n end", "title": "" }, { "docid": "b89543cadbbc925de83b1c5cc9a0ff35", "score": "0.59678656", "text": "def update\n return if disposed?\n if @gifbitmaps.length>0\n @framecount+=2\n @framecount=@totalframes<=0 ? 0 : @framecount%@totalframes\n frametoshow=0\n for i in 0...@gifdelays.length\n frametoshow=i if @gifdelays[i]<=@framecount\n end\n @currentIndex=frametoshow\n end\n end", "title": "" }, { "docid": "275fa0822067a35007b30dc3e3da75f1", "score": "0.5962081", "text": "def update\n respond_to do |format|\n if @frame.update(frame_params)\n format.html { redirect_to @frame, notice: 'Frame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d54056db9dfd38d929ce149960278e30", "score": "0.5961704", "text": "def refresh!\n new_last_refresh = Time.now\n refresh_fragments_since(@last_refresh)\n @last_refresh = new_last_refresh\n end", "title": "" }, { "docid": "f3f84d471d3af3530cecd1593a567d7c", "score": "0.5956154", "text": "def refresh\n self\n end", "title": "" }, { "docid": "b1cbac31d117276a67e2931dc31a70d7", "score": "0.59529495", "text": "def refresh\n browser.browser.refresh\n self.wait_page_load\n end", "title": "" }, { "docid": "ce1279b3eec68d13c25f689fef5a8408", "score": "0.59421545", "text": "def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "ce1279b3eec68d13c25f689fef5a8408", "score": "0.59421545", "text": "def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "ce1279b3eec68d13c25f689fef5a8408", "score": "0.59421545", "text": "def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "ce1279b3eec68d13c25f689fef5a8408", "score": "0.59421545", "text": "def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "ce1279b3eec68d13c25f689fef5a8408", "score": "0.59421545", "text": "def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n @version = args[:version] if args.key?(:version)\n end", "title": "" }, { "docid": "2cf63014042334d0b6b6d107ec4a1143", "score": "0.59393406", "text": "def webView_didCommitLoadForFrame(sender,frame)\n #puts \"we got a commit\"\n end", "title": "" }, { "docid": "8431345f221937ddc521dffe43202552", "score": "0.5932027", "text": "def refresh()\n self.contents.clear\n @ucGold.draw()\n end", "title": "" }, { "docid": "8431345f221937ddc521dffe43202552", "score": "0.5932027", "text": "def refresh()\n self.contents.clear\n @ucGold.draw()\n end", "title": "" }, { "docid": "0e78fd5718e68d4584687b4e8b7d068a", "score": "0.5931174", "text": "def update\n\t\t \t\n\t\t end", "title": "" }, { "docid": "0e2685ab3d985a78d8f983fa17f19205", "score": "0.5930977", "text": "def refresh\n @win.refresh\n children.each { |c|\n c.refresh\n }\n\n component.component.screen.refresh if cdk?\n end", "title": "" }, { "docid": "7a07b0bd498e2e26cb9771681c47a4b6", "score": "0.59129894", "text": "def update_frame\n # If animation frame is different, change graphic\n if @anim_frame != @unit.frame\n @anim_frame = @unit.frame\n end\n case @anim_frame\n when 2\n if @unit.fuel / @unit.max_fuel.to_f <= 0.5\n self.bitmap = RPG::Cache.picture(\"lowfuel\")\n end\n when 3\n if @unit.ammo / @unit.max_ammo.to_f <= 0.34\n self.bitmap = RPG::Cache.picture(\"lowammo\")\n end\n end\n end", "title": "" }, { "docid": "f08c4461387e8531de60583b4c2696af", "score": "0.5910817", "text": "def update\r\n #\r\n # Register a tick with our rather standard tick/framerate counter. \r\n # Returns the amount of milliseconds since last tick. This number is used in all update()-calls.\r\n # Without this self.fps would return an incorrect value.\r\n # If you override this in your Chingu::Window class, make sure to call super.\r\n #\r\n @milliseconds_since_last_tick = @fps_counter.register_tick\r\n \r\n intermediate_update\r\n end", "title": "" }, { "docid": "2955c285792fb5d85ffa8c340eba002e", "score": "0.5909578", "text": "def frame_binding; end", "title": "" }, { "docid": "c637f0753c60aaf12d07d0fd5d78b3e4", "score": "0.5908581", "text": "def increment_frame\n @current_frame += 1\n end", "title": "" }, { "docid": "dd97a4edadf8c03657704bda89b2d489", "score": "0.59012836", "text": "def message_update_processing\r\n Graphics.update\r\n $scene.update\r\n end", "title": "" }, { "docid": "3428ee909c7ff43c4e97a3f03282c24a", "score": "0.58998543", "text": "def update_frame_rate\r\n @frames_rendered += 1\r\n\r\n if ( Time.now - @frame_start_time ) >= 1.0\r\n @frame_rate = ( @frames_rendered / ( Time.now - @frame_start_time ) ).round( 2 )\r\n @frames_rendered = 0\r\n @frame_start_time = Time.now\r\n end\r\n end", "title": "" }, { "docid": "15e1516641235149220b69beb88b46b1", "score": "0.5896486", "text": "def update(interval)\n load_assets\n update_btns\n update_title(interval)\n end", "title": "" }, { "docid": "76089cdb229e14d43462dc9ff3f96838", "score": "0.5890932", "text": "def refresh()\n self.contents.clear\n @ucTotal.draw()\n @ucDifference.draw()\n end", "title": "" }, { "docid": "bea14259ca3183d6049d14e3327dc329", "score": "0.58829117", "text": "def setFrame frame\n super(frame, &nil)\n relayout!\n end", "title": "" }, { "docid": "a3fce6500c3ce5ebc52e331d35f3a6e5", "score": "0.5873908", "text": "def update\n if @frameCounter < 60 then\n @frameCounter += 1\n else\n @frameCounter = 0\n if @totalTime != 0 then\n @totalTime -= 1\n end\n end\n end", "title": "" }, { "docid": "dfc0227d352772ba43511718941be836", "score": "0.58660454", "text": "def deep_refresh\n recalc_height\n update_placement\n create_contents\n refresh\n end", "title": "" }, { "docid": "54417c5e540c1a08eee5eb2e2a59054b", "score": "0.58647716", "text": "def update\n @seeker.refresh # Set the refresh process going\n respond_to do |format|\n format.html { \n render :text => \"Refreshing...\"\n }\n end\n end", "title": "" }, { "docid": "9768ec5a200ec8fd61c4dc2628c44cd0", "score": "0.5856511", "text": "def maha_update_frame_animation\n if @ap_time == 0 # If timer finished\n # Switch frames\n @ap_frame_index = (@ap_frame_index + 1) % @ap_frame_num\n @ap_time = @ap_max_time\n self.src_rect.x = @ap_frame_index*@ap_width\n end\n @ap_time -= 1 if @ap_time > 0 # Decrease timer until finished\n end", "title": "" }, { "docid": "022d23ca104ba64dbb8acb04a0b4a9ea", "score": "0.58479834", "text": "def update_basic\n Graphics.update\n Input.update\n end", "title": "" }, { "docid": "6649e23ae4dd426f80be1bf4c834b4a8", "score": "0.582606", "text": "def update()\n end", "title": "" }, { "docid": "ec0c1df37b9946bd2387c76709a4be56", "score": "0.5825812", "text": "def refresh\r\r\n return table_refresh if table_update? && Theo::AntiLag::PageCheck_Enchancer\r\r\n @events.each_value {|event| next if event.never_refresh; event.refresh }\r\r\n @common_events.each {|event| event.refresh }\r\r\n refresh_tile_events\r\r\n @need_refresh = false\r\r\n end", "title": "" }, { "docid": "bac0043aac028b793f7a7f8afa1669cd", "score": "0.5822202", "text": "def refresh!\n `#@native.refresh(true)`\n end", "title": "" }, { "docid": "bac0043aac028b793f7a7f8afa1669cd", "score": "0.5822202", "text": "def refresh!\n `#@native.refresh(true)`\n end", "title": "" }, { "docid": "1ff38333c715efa56d9b25f3d7637493", "score": "0.58183247", "text": "def refresh\n fail 'not implemented'\n end", "title": "" }, { "docid": "5a747643d1adcf5f85246b34f3c84af1", "score": "0.5817143", "text": "def refresh; raise :subclass_responsiblity; end", "title": "" }, { "docid": "5ca2caa1a207739e77f437de35e41cf1", "score": "0.5814886", "text": "def update ; end", "title": "" }, { "docid": "919c6ae9cb37c6563b6aa48a953371a0", "score": "0.58147734", "text": "def refresh_viewport\r\n #puts 'MergeTool.refresh_viewport'\r\n #update_gizmo()\r\n nil\r\n end", "title": "" }, { "docid": "ecb3899bed475097f0d6403ed4c40583", "score": "0.5807264", "text": "def finalize_frame!\n frame.update_attributes(status: \"closed\")\n end", "title": "" }, { "docid": "7c2b1f6aab869f1d871ffab56f883862", "score": "0.57921636", "text": "def update\n initialize if @viewport.disposed?\n @main_ui.update\n end", "title": "" }, { "docid": "f7633825fab0bed619fd96bcb62ef456", "score": "0.5785034", "text": "def refresh!\n @display_lock.synchronize do\n debug(\"refresh!\")\n @last_refresh = Time.now\n # clear\n move_to_top\n lines_on_screen.each_with_index { |(line,num), i| display line, row: i+1, num: num }\n display_status_bar!\n end\n end", "title": "" }, { "docid": "b29c233817de39078832c08b05983162", "score": "0.5781457", "text": "def update!(**args)\n @frames_data = args[:frames_data] if args.key?(:frames_data)\n end", "title": "" }, { "docid": "c003f13fbfa4924e3f57b336a9b7bede", "score": "0.5772877", "text": "def refresh\n @bridge.refresh\n end", "title": "" }, { "docid": "e8705fc96e142d0022c92e0d6a565957", "score": "0.57679677", "text": "def reload; end", "title": "" }, { "docid": "e8705fc96e142d0022c92e0d6a565957", "score": "0.57679677", "text": "def reload; end", "title": "" }, { "docid": "e8705fc96e142d0022c92e0d6a565957", "score": "0.57679677", "text": "def reload; end", "title": "" }, { "docid": "e8705fc96e142d0022c92e0d6a565957", "score": "0.57679677", "text": "def reload; end", "title": "" }, { "docid": "e8705fc96e142d0022c92e0d6a565957", "score": "0.57679677", "text": "def reload; end", "title": "" }, { "docid": "3af57f43fb0c38d52711d2ec1f10d771", "score": "0.57665354", "text": "def refresh\n system(\"clear\")\n @board.render\n end", "title": "" } ]
1f6dc6995e55a2a71fda1715266dd2e3
List ApplicationAuthentications Returns an array of ApplicationAuthentication objects
[ { "docid": "05119399d636df73d605277c90063067", "score": "0.6092807", "text": "def list_all_application_authentications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_all_application_authentications ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_all_application_authentications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_all_application_authentications, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling DefaultApi.list_all_application_authentications, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/application_authentications'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ApplicationAuthenticationsCollection' \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#list_all_application_authentications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "12571f7f1016e8a6e25466f524bd53e3", "score": "0.76877373", "text": "def list_all_application_authentications(opts = {})\n data, _status_code, _headers = list_all_application_authentications_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "75c67a7ba165d0ee413c526a1ed211b9", "score": "0.7155863", "text": "def index\n @authentications = Authentication.all\n end", "title": "" }, { "docid": "75c67a7ba165d0ee413c526a1ed211b9", "score": "0.7155863", "text": "def index\n @authentications = Authentication.all\n end", "title": "" }, { "docid": "1d594d8c795c4baaa73a5ad4b9eea47a", "score": "0.7086916", "text": "def list_application_authentications(id, opts = {})\n data, _status_code, _headers = list_application_authentications_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "60fb2c82f9a0319f16967939ea31e11f", "score": "0.6876836", "text": "def list_authentications(opts = {})\n data, _status_code, _headers = list_authentications_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "f77812b6d1982f7847a2b80ed6183e57", "score": "0.67229486", "text": "def index\n @authentications = current_user.authentications.all\n end", "title": "" }, { "docid": "732d9116664d026cf01e5baccea8e5de", "score": "0.6546928", "text": "def index\n @authenticaions = Authenticaion.all\n end", "title": "" }, { "docid": "374b3f9eb5011c15744b0b074b119d5b", "score": "0.6467074", "text": "def index\n @authentications = current_user.authentications if current_user\n end", "title": "" }, { "docid": "374b3f9eb5011c15744b0b074b119d5b", "score": "0.6467074", "text": "def index\n @authentications = current_user.authentications if current_user\n end", "title": "" }, { "docid": "bf74a511185d495df8b2231c98de9005", "score": "0.6446483", "text": "def index\n @authentications = current_user.authentications if current_user #Authentication.all\n end", "title": "" }, { "docid": "6cd0ba1ee468065a29dc06bf260768fb", "score": "0.62956494", "text": "def index\n @authentications = current_user.authentications.all if current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @authentications }\n end\n end", "title": "" }, { "docid": "736accb97b00f67acb60618441022b9a", "score": "0.6282644", "text": "def index\n @authentication_tokens = @user.authentication_tokens\n end", "title": "" }, { "docid": "257bbed3b2ea3e90e5254e108c5e73fb", "score": "0.6211407", "text": "def index\n @oauth_applications = OauthApplication.by_name.all\n @oauth_application = @oauth_applications.first\n @users = @oauth_application.users if @oauth_applications.present?\n end", "title": "" }, { "docid": "9096d96865151ecb8c7b1ff4defd0ba9", "score": "0.595301", "text": "def show\n @oauth_application = OauthApplication.find(params[:id])\n @users = @oauth_application.users\n end", "title": "" }, { "docid": "5a7f2d9abbadabc3a4d76997b484268b", "score": "0.5920278", "text": "def index\n @affidavit_of_authenticities = AffidavitOfAuthenticity.all\n end", "title": "" }, { "docid": "bf5ee6a8c7d80495cbba437cc91875ee", "score": "0.59095716", "text": "def index\n @user_applications = current_user.user_applications.all\n end", "title": "" }, { "docid": "57f6436d9ae06d41cc6502e54065dae6", "score": "0.5906922", "text": "def index\n @applications = current_user.applications\n end", "title": "" }, { "docid": "50529a3bccc4840e52f44c7153f3fca8", "score": "0.58579737", "text": "def index\n @all_client_applications = ClientApplication.all.sort {|a,b| a.name <=> b.name }\n @client_applications = current_user.role.client_applications\n @tokens = current_user.tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null'\n end", "title": "" }, { "docid": "e648da1b0c055382a9e71332b6529a05", "score": "0.5845275", "text": "def index\n\t\t@registered_applications = RegisteredApplication.belonging_to current_user\n\tend", "title": "" }, { "docid": "ade889a455c8a03392f3437c1cdea623", "score": "0.5827439", "text": "def accessible_applications\n\t\tapps = []\n\t\tfiltered_roles = role_assignments.uniq{ |a| a.application_id }\n\t\tfiltered_roles.each do |roles|\n\t\t\tapps << roles\n\t\tend\n\t\tapps\n\tend", "title": "" }, { "docid": "23305a99480f254fe57a4e69cc561cd9", "score": "0.58238584", "text": "def index\n presenters = OauthFlowPresenter.wrap(authentication_providers, request)\n respond_with(presenters)\n end", "title": "" }, { "docid": "e334346fb9757c5ad7118b6ca350f237", "score": "0.58033425", "text": "def index\n @autenticacions = Autenticacion.all\n end", "title": "" }, { "docid": "423036c2c31a767be56dd99c0674dcca", "score": "0.579007", "text": "def index\n @auth_providers = AuthProvider.all\n end", "title": "" }, { "docid": "3ff619b0626d114b27f6ebd6bf938087", "score": "0.5786687", "text": "def index\n @the_application = current_user.the_applications\n end", "title": "" }, { "docid": "388b679588d14146b6c645c59db5de62", "score": "0.5781156", "text": "def list_mutual_authentications(opts = {})\n data, _status_code, _headers = list_mutual_authentications_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "0abf11f819acd601d96aa9c4f14d6626", "score": "0.5776284", "text": "def user_authentications(id)\n response = connection.get(\"users/#{id}/authentications\")\n return_error_or_body(response)\n end", "title": "" }, { "docid": "eddd550510c0468b322a99a3945cf9dc", "score": "0.57586503", "text": "def index\n @authmethods = Authmethod.all\n end", "title": "" }, { "docid": "6864e3f18e12f538511450654005a06d", "score": "0.57537735", "text": "def accessible_applications\n begin\n Application.with_permissions_to(:read).includes(:roles)\n rescue Authorization::NotAuthorized\n []\n end\n end", "title": "" }, { "docid": "2d4cc894d318328fd63258e28c49c5e0", "score": "0.5753472", "text": "def showauthcodes\n @authcodes = Authcode.all\n end", "title": "" }, { "docid": "ff8a8e3a6b73ac33703f20425c2de285", "score": "0.5743222", "text": "def index\n @oauth_codes = OauthCode.all\n end", "title": "" }, { "docid": "4a3ce88137bbcd1009bfdf0df3b551e6", "score": "0.5736114", "text": "def index\n @oauths = authed_user.oauths.all\n end", "title": "" }, { "docid": "61c0088a08683194a4ea11a18d07c3ef", "score": "0.5709512", "text": "def index\n @auth_tokens = AuthToken.all\n end", "title": "" }, { "docid": "fd279e0eb4b0d2b7ac08ab80b3bacc2e", "score": "0.57076216", "text": "def list_acls\n server.perform_request('listacls', {:key => 'acls'})\n end", "title": "" }, { "docid": "def3329fed1c257fe7ec985a94f5e1e8", "score": "0.57069397", "text": "def index\n @app_credentials = AppCredential.where(app_id: params[:app_id])\n end", "title": "" }, { "docid": "3028a03ad6145019f93830a598393379", "score": "0.5679794", "text": "def index\n @authentications = current_user.authentications if current_user\n add_breadcrumb :list\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @authentications }\n end\n end", "title": "" }, { "docid": "bd8343b3d9a4c5d75526224de803d9dc", "score": "0.5678876", "text": "def index\n @applications = current_user.company.applications\n end", "title": "" }, { "docid": "6e0b54794a2c9efab41f5924cf5bb585", "score": "0.5670032", "text": "def index\n @auth_accounts = Auth::Account.all\n end", "title": "" }, { "docid": "43357d035003695c35cd9e9c46302749", "score": "0.56553566", "text": "def get_all_provider_accounts\n user_session_execute_api(:get, '/v1/providers/providerAccounts')\n end", "title": "" }, { "docid": "8563cdebb6b6f74fc9b4ff1906b13a11", "score": "0.5645475", "text": "def index\n @users_auths = UsersAuth.all\n end", "title": "" }, { "docid": "d601a67fdbd7c054f0f4f922570e1b93", "score": "0.563949", "text": "def index\n @services = current_user.authentications.order('provider asc')\n @available_services = []\n User.omniauth_providers.each do |s|\n next if current_user.authentications.where(:provider => s.to_s).any?\n @available_services << s\n end\n end", "title": "" }, { "docid": "e2bfe137bc5eae14dd5a6adeb2d306c1", "score": "0.5637126", "text": "def index\n @authcredentials = Authcredential.all\n end", "title": "" }, { "docid": "dcdbb1a4f0a7cfdffd1483c5a8e6c566", "score": "0.56260276", "text": "def index\n @userapplications = Userapplication.all\n end", "title": "" }, { "docid": "43aab885c102c40fae999cc2b0756598", "score": "0.56206155", "text": "def index\n @authentifications = Authentification.all\n end", "title": "" }, { "docid": "0d7f4c13d87c249e7bb044122f67ef84", "score": "0.56168664", "text": "def applications\n logger.debug \"Getting all applications for domain #{self.id}\"\n url = @@end_point + @links['LIST_APPLICATIONS']['href']\n method = @links['LIST_APPLICATIONS']['method']\n request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)\n return send(request)\n end", "title": "" }, { "docid": "98c053ce0fe9f6ed10351290037f2934", "score": "0.5612933", "text": "def get_authenticated_users\n @authedusers\n end", "title": "" }, { "docid": "dddf925de6787cc14ac6c6a4cd5692fd", "score": "0.5607864", "text": "def authorizations_list(page, per_page)\n path = sprintf(\"/api/v2/authorizations\")\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request_paginated(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)\n if err != nil\n return nil, err\n end\n \n return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Authorization.new(item) }, err\n end", "title": "" }, { "docid": "b39054f4f50bfb101f9147a465827166", "score": "0.56066716", "text": "def index\n\n @apps_map = {}\n App.all.each { |app| @apps_map[app.id] = app }\n @application_authorizations = {}\n if is_sea_admin?\n my_delegations = AdminDelegation.all\n @edorgs = (my_delegations.select{|delegation| delegation.appApprovalEnabled}).map{|cur| cur.localEdOrgId}\n @edorgs = @edorgs.sort{|a,b| a <=> b}\n @edorgs.each { |edorg|\n @application_authorizations[edorg] = ApplicationAuthorization.find(:all, :params => {'edorg' => edorg})\n }\n else\n @edorgs = [session[:edOrgId]]\n ApplicationAuthorization.cur_edorg = @edorgs[0]\n @application_authorizations[@edorgs[0]] = ApplicationAuthorization.all\n end\n #Get EDORGS for the authId\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "title": "" }, { "docid": "66baaeba19931d83c42dc705adae4162", "score": "0.5594988", "text": "def index\n @asana_auth_end_points = AsanaAuthEndPoint.all\n end", "title": "" }, { "docid": "b95e5b138c606453d4fc1d4c0c5217c1", "score": "0.5570273", "text": "def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end", "title": "" }, { "docid": "b73fb4b922538970dbcf81c858a5479b", "score": "0.55450785", "text": "def list_endpoint_authentications(id, opts = {})\n data, _status_code, _headers = list_endpoint_authentications_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "b1a0f34ca6089cbf7db363979c4c3550", "score": "0.55402064", "text": "def accounts\n ensure_ready!(:authorization)\n response = connection.get('accounts')\n checked_response_body(response)\n end", "title": "" }, { "docid": "9e4447bd4f61a2d3610c2fbb0bd11331", "score": "0.55270004", "text": "def index\n @authers = Auther.all\n end", "title": "" }, { "docid": "c29bcc6f0e206e01f4d86c076dab8052", "score": "0.5520157", "text": "def authorization_configs\n all_configs = []\n # This API request does not return the 'Link' header enabling pagination\n response = request_uncached request_path\n if response && response.status == 200 && list = safe_json(response.body)\n all_configs.concat(list)\n end\n all_configs\n end", "title": "" }, { "docid": "cb768331a246635558b8fbe0a274f2c5", "score": "0.5517614", "text": "def list_access_tokens(identity)\n Rack::OAuth2::AuthServer.list_access_tokens(identity)\n end", "title": "" }, { "docid": "d1a3e605ad6a3babd0f7b0fde8d53fbe", "score": "0.55074257", "text": "def get_all\n opts = @options.merge(\n headers: headers(auth: true),\n )\n\n req = self.class.get '/application', opts\n handle_status_code req\n\n self.parse(req)['d']\n end", "title": "" }, { "docid": "6c836cecc837a9778d4b8a06a2b8d239", "score": "0.5506685", "text": "def applications\n results = @tropo_client.get(\"applications\")\n result_with_ids = []\n results.each do |app|\n result_with_ids << app.merge!({ :application_id => get_element(app.href) })\n end\n result_with_ids\n end", "title": "" }, { "docid": "611af918f11582efb6b85a4f6e64415f", "score": "0.5502044", "text": "def index\n @client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "611af918f11582efb6b85a4f6e64415f", "score": "0.5502044", "text": "def index\n @client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)\n end", "title": "" }, { "docid": "51441cdceb7901730a77f08a690529e8", "score": "0.55016464", "text": "def index\n @apps = current_user.apps\n end", "title": "" }, { "docid": "5baafb1fdd53bf4ec13d66dc08006ccb", "score": "0.5494134", "text": "def index\n @ebay_auths = EbayAuth.all\n end", "title": "" }, { "docid": "12fee60c5a03b8097361ffb3a9949ee5", "score": "0.5483458", "text": "def list_access_tokens(identity)\n database.view AccessToken.by_identity(identity)\n end", "title": "" }, { "docid": "b803f4c9a929408871003807fa1e1362", "score": "0.5480086", "text": "def index\n @auth_configs = AuthConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @auth_configs }\n end\n end", "title": "" }, { "docid": "2d57ffbe34065f48d718d292bf05b394", "score": "0.54663044", "text": "def auth_token \n accounts.map{|acc| acc.authentication_token}\n end", "title": "" }, { "docid": "12b5f68da86e60aa1e9cdbc10f892b16", "score": "0.5464914", "text": "def accounts\n Yodlee::Account.all(@session).select do |account|\n account.provider_account_id == id\n end\n end", "title": "" }, { "docid": "a554e08d85e07c9572be8782676afa93", "score": "0.54595035", "text": "def list_authorizations\n _client.authorizations\n end", "title": "" }, { "docid": "ceeea8ae655b7ec00a2b331fe3e1d5ce", "score": "0.5444427", "text": "def auth(sync: false)\n if sync || !@accounts || !@accounts[0] || !@accounts[0].numbers\n response = Connector.new(:auth, :get, auth: true, client: client)\n .post(access_token: access_token)\n\n update_accounts(response)\n end\n\n accounts\n end", "title": "" }, { "docid": "33aa1a7a5762c3587b2c269baacbbc4c", "score": "0.54295903", "text": "def index\n @omniauths = Omniauth.all\n end", "title": "" }, { "docid": "0dc3b1807bca34da9993e3ffa4f06de6", "score": "0.54079986", "text": "def list()\n @client.organization_app.list()\n end", "title": "" }, { "docid": "ef9689da26216f7e65eb4e158571d5f3", "score": "0.5407891", "text": "def list_application_authentications_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_application_authentications ...'\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.list_application_authentications\"\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.list_application_authentications, must conform to the pattern #{pattern}.\"\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_application_authentications, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DefaultApi.list_application_authentications, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling DefaultApi.list_application_authentications, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/applications/{id}/authentications'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'AuthenticationsCollection' \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#list_application_authentications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "f063a52bab1eaa507029800b7ec0d30b", "score": "0.54044497", "text": "def get_credentials_list()\n auth = Authentication.new()\n result = auth.check_credentials_file_exists()\n if result\n credentials = auth.get_stored_list_credentials()\n else result\n credentials = auth.prompt_for_list_credentials()\n auth.store_list_credentials(auth.get_encrypted_list_credentials(credentials))\n credentials = auth.get_decrypted_list_credentials(credentials)\n end\n credentials\n end", "title": "" }, { "docid": "09cb3e56b7c2da490d983eef373be490", "score": "0.53940713", "text": "def get_account_list\n account_list = api(\"GetAccountList\")\n account_list.split(\";\")\n end", "title": "" }, { "docid": "0bfad14e794d3d168831bdc53eed8142", "score": "0.53923464", "text": "def iam_list_users\n iam_r.users.to_a\n end", "title": "" }, { "docid": "7177f76e9af7727beb277cdfb8755497", "score": "0.53863305", "text": "def auth_roles_list\n @auth_roles_list ||= listify(auth_roles)\n end", "title": "" }, { "docid": "a831298428fb9d8a132afdd11a63dc8a", "score": "0.5373137", "text": "def all_apps\n HTTParty.get(\"https://api.newrelic.com/api/v1/accounts/#{credentials[0]}/applications.json\", headers: {'x-api-key' => credentials[1]})\n end", "title": "" }, { "docid": "9308ba655afcb5d02db2ce6e47b9bc10", "score": "0.5369064", "text": "def get_auth_a\n\n return [] if self.auth.nil? or self.auth.empty?\n\n arr = self.auth.split('|')\n arr.compact!\n arr.delete('')\n\n return arr\n end", "title": "" }, { "docid": "3aed9bd4448e1b5e8bbd1f35a07962e7", "score": "0.5365904", "text": "def list\n if current_user\n accounts = current_user.accounts\n render json: { accounts: accounts }, status: :ok\n else\n render json: { error: I18n.t('request.forbidden') }, status: :forbidden\n end\n end", "title": "" }, { "docid": "8c903d03e45311f48905e2ea9d3bba05", "score": "0.53646564", "text": "def users\n oauth_response = access_token.get(\"/api/v1/users.json\")\n JSON.parse(oauth_response.body)\n end", "title": "" }, { "docid": "86cacbf661da35a0510fa7dd186eaffe", "score": "0.5358151", "text": "def index\n if current_user.admin?\n #read all users\n @users = User.all\n\n #save all users applications in array\n phasetwo_applications = @users.map do |usr|\n usr.phasetwo_application\n end\n\n #remove nil objects from array\n a = phasetwo_applications.compact\n @phasetwo_applications = a.sort {|x,y| y.updated_at <=> x.updated_at }\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "f5c98c315b01331761f5fd72925d49f5", "score": "0.53470105", "text": "def index\n @authorized_users = AuthorizedUser.all\n end", "title": "" }, { "docid": "7103e2697f75e600d30410d36e615749", "score": "0.5345821", "text": "def authentication_method_configurations\n return @authentication_method_configurations\n end", "title": "" }, { "docid": "f0fcce4cb3dd3d986fae6c93b7ee9979", "score": "0.5338444", "text": "def index\n @app_tokens = AppToken.all\n end", "title": "" }, { "docid": "601d3f50f15c4c6bffb3134730a9050b", "score": "0.5322602", "text": "def authorized_users\n authorizations.map(&:authorized)\n end", "title": "" }, { "docid": "2b570d29a09ee5e7c109389c667b9cb9", "score": "0.5296767", "text": "def index\n @applists = current_user.applists\n end", "title": "" }, { "docid": "535e454c66b7617209457f8be41bf864", "score": "0.5291595", "text": "def facebook_authentication\n authentications.select { |a| a.is_a? FacebookAuthentication }.first\n end", "title": "" }, { "docid": "275851365892b55bcbefe223187d1e3a", "score": "0.5280047", "text": "def index\n if current_user.has_role?(:admin)\n @certificate_applications = CertificateApplication.order('created_at DESC')\n else\n @certificate_applications = current_user.certificate_applications.order('created_at DESC')\n end\n end", "title": "" }, { "docid": "718b728378215a0524797ace01f63dcb", "score": "0.5276986", "text": "def index\n @admin_user_applications = current_user.permitted_applications\n end", "title": "" }, { "docid": "9a2e25d8662ae37bda671d1197fce1bf", "score": "0.52739656", "text": "def get_client_authorization_list(request)\n hash = call_api_json_service(\"/api/client/authorization/get/list\", to_hash(request))\n\n Authlete::Model::Response::ClientAuthorizationListResponse.new(hash)\n end", "title": "" }, { "docid": "11537a10f2c54351e82d0b4434518abd", "score": "0.5273016", "text": "def index\n @otg_authns = OtgAuthn.all\n end", "title": "" }, { "docid": "daee7ef2c384878183fb99032738ba26", "score": "0.5266399", "text": "def index\n @admin_facebook_applications = Admin::FacebookApplication.all\n end", "title": "" }, { "docid": "68462b37c72bbaf0a95ebe8e71a3d60c", "score": "0.5265277", "text": "def edit\n @auths = @authentications.collect(&:provider)\n end", "title": "" }, { "docid": "0afa46b6402e7848ee3f57708480e163", "score": "0.5263693", "text": "def user_apps\n Application.with_user(session['user_id'])\n end", "title": "" }, { "docid": "c67f56faac596ac69c29d1bb12830c36", "score": "0.5257299", "text": "def index\n @user_apps = UserApp.all\n end", "title": "" }, { "docid": "06602ab1de81d41c5cc8d6caf4b27d6f", "score": "0.5256703", "text": "def index\n @app_sessions = AppSession.all\n end", "title": "" }, { "docid": "c9209ed93072b5554e6331b06945eb58", "score": "0.52476376", "text": "def index\n @role_applications = RoleApplication.all\n end", "title": "" }, { "docid": "1150820885609d5cbdc819a0f34cfe42", "score": "0.52440786", "text": "def index\n @member_applications = MemberApplication.all\n authorize! :read, MemberApplication\n end", "title": "" }, { "docid": "155a34bac49e16663da699c08e01aa02", "score": "0.5231196", "text": "def get_apps\n\t\tam = ErAppMember.where(er_user_id: session[:er_usr_parm])\n\t\trender json: am.to_json(include: :er_user_app) , status: 200\n\tend", "title": "" }, { "docid": "0c857fb5cab3a7c80490b22942410915", "score": "0.5225423", "text": "def index\n @applications = Application.all\n end", "title": "" }, { "docid": "0c857fb5cab3a7c80490b22942410915", "score": "0.5225423", "text": "def index\n @applications = Application.all\n end", "title": "" }, { "docid": "0c857fb5cab3a7c80490b22942410915", "score": "0.5225423", "text": "def index\n @applications = Application.all\n end", "title": "" }, { "docid": "0c857fb5cab3a7c80490b22942410915", "score": "0.5225423", "text": "def index\n @applications = Application.all\n end", "title": "" } ]
083ff28a55a04b6a599c383550e0cb92
Login Called from current_user. First attempt to login by the user id stored in the session.
[ { "docid": "f87ce44af1c849da25d71b63011f4772", "score": "0.8397002", "text": "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "title": "" } ]
[ { "docid": "f51a7636fcfd1cf5473efffab97d7a03", "score": "0.84712005", "text": "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "title": "" }, { "docid": "6c6133b819a6c13b5cffed2ce093bd4a", "score": "0.82886606", "text": "def login_from_session\n self.current_user = User.find_by_id( session[ :user_id ] ) if session[ :user_id ]\n end", "title": "" }, { "docid": "78c0b38735f23204af65ac3e348d9023", "score": "0.8275912", "text": "def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend", "title": "" }, { "docid": "4a5668b8d0ad464438cd4fa4158f2657", "score": "0.82355165", "text": "def login_from_session\n self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\n end", "title": "" }, { "docid": "3b8a2389e23c03e0d331c4c1d2439dcf", "score": "0.81700176", "text": "def login_from_session\n self.current_user = User.find(session[:user_id]) if session[:user_id]\n end", "title": "" }, { "docid": "aa05c4b8954185b000d6ea20d6e348c1", "score": "0.7748056", "text": "def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend", "title": "" }, { "docid": "16761cd17419e8464a912981ae9be573", "score": "0.7728636", "text": "def login!\n session[:user_id] = @user.id\n end", "title": "" }, { "docid": "0a9d6c5adc0ad456561c8ec603c7f7e3", "score": "0.7720345", "text": "def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end", "title": "" }, { "docid": "467047ec02cb4317c99feebf09f54b79", "score": "0.77160424", "text": "def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end", "title": "" }, { "docid": "da2febab00eb5ad207e9ea77d231f891", "score": "0.7706442", "text": "def login(user)\n session[:user_id] = user.try(:id)\n @current_user = user\n end", "title": "" }, { "docid": "4d70004acadf0d25380db35532530312", "score": "0.76596427", "text": "def login_user(user)\n session[:current_user_id] = user.id\n end", "title": "" }, { "docid": "684a15757ff34b803a804d2a8ccec933", "score": "0.7594359", "text": "def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end", "title": "" }, { "docid": "af2fd4075c5aae05b5e21bf5ce619862", "score": "0.75753224", "text": "def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end", "title": "" }, { "docid": "d20e8cbdae70d53d5105f5953a911bfb", "score": "0.75356", "text": "def login_from_session\n self.current_ma_user = MA[:user].find_with_conditions(:id => session[MA[:single_resource]]) if session[MA[:single_resource]]\n end", "title": "" }, { "docid": "75dd17329ec791d8074a5235dff5f95c", "score": "0.74700266", "text": "def login( user )\n session[:user_id] = user ? user.id : nil\n end", "title": "" }, { "docid": "22db77a2fa14b434621fed28f0d9ffcc", "score": "0.7456072", "text": "def login user\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "d0bde5397077c27ef691d812e59e03f1", "score": "0.74528474", "text": "def session_login\n @current_user = User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n return false\n end", "title": "" }, { "docid": "596adcf2f1dc2010c325c794ac12f20a", "score": "0.74211115", "text": "def login(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "6b89fbd8b77b39c395d920236093c7ce", "score": "0.741819", "text": "def login\n return unless request.post?\n ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 4.weeks.from_now) if params[:remember_me]\n self.current_user = User.authenticate(params[:login], params[:password])\n if current_user\n redirect_back_or_default(:controller => '/')\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Please try again\"\n end\n end", "title": "" }, { "docid": "1562be3b897cc06753b2156ffac6588e", "score": "0.7415244", "text": "def login_user\n session[:user_id] = @user.id\n end", "title": "" }, { "docid": "d3d174126a79835f7c747d2a175d5377", "score": "0.7383791", "text": "def login\n session[:job_id] = nil\n\n # external auth has been done, skip markus authorization\n if Settings.remote_user_auth\n if @markus_auth_remote_user.nil?\n render 'shared/http_status', formats: [:html], locals: { code: '403', message: HttpStatusHelper::ERROR_CODE['message']['403'] }, status: 403, layout: false\n return\n else\n login_success, login_error = login_without_authentication(@markus_auth_remote_user)\n if login_success\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n return\n else\n render :remote_user_auth_login_fail, locals: { login_error: login_error }\n return\n end\n end\n end\n\n # Check if it's the user's first visit this session\n # Need to accommodate redirects for locale\n if params.key?(:locale)\n if session[:first_visit].nil?\n @first_visit = true\n session[:first_visit] = 'false'\n else\n @first_visit = false\n end\n end\n\n @current_user = current_user\n # redirect to main page if user is already logged in.\n if logged_in? && !request.post?\n redirect_to action: 'index'\n return\n end\n return unless request.post?\n\n # strip username\n params[:user_login].strip!\n\n # Get information of the user that is trying to login if his or her\n # authentication is valid\n validation_result = validate_user(params[:user_login], params[:user_login], params[:user_password])\n unless validation_result[:error].nil?\n flash_now(:error, validation_result[:error])\n render :login, locals: { user_login: params[:user_login] }\n return\n end\n # validation worked\n found_user = validation_result[:user]\n if found_user.nil?\n return\n end\n\n # Has this student been hidden?\n if found_user.student? && found_user.hidden\n flash_now(:error, I18n.t('main.account_disabled'))\n redirect_to(action: 'login') && return\n end\n\n self.current_user = found_user\n\n if logged_in?\n uri = session[:redirect_uri]\n session[:redirect_uri] = nil\n refresh_timeout\n # redirect to last visited page or to main page\n redirect_to( uri || { action: 'index' } )\n else\n flash_now(:error, I18n.t('main.login_failed'))\n end\n end", "title": "" }, { "docid": "eee1d6bdaaaf4b776c34c265b59b8f71", "score": "0.7382921", "text": "def login\n\t\tuser = User.find_by_userid(params[:session][:userid])\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\tsession[:remember_token] = user.id\n\t\t\tsession[:last_seen] = Time.now\n\t\t\tif user.authorizationlevel == 1\n\t\t\t\tredirect_to '/documents'\n\t\t\telsif user.authorizationlevel == 2\n\t\t\t\tredirect_to '/documents'\n\t\t\telsif user.authorizationlevel > 2\n\t\t\t\tredirect_to '/documents'\n\t\t\telse\n\t\t\t\tredirect_to '/'\n\t\t\tend\n\t\telse\n\t\t\tflash[:error] = 'Invalid Login'\n\t\t\tredirect_to '/sessions'\n\t\tend\n\tend", "title": "" }, { "docid": "99bc971b07e19baa3fd2da1143abd1ba", "score": "0.7374631", "text": "def login!(session)\n\t\tsession[:user_id] = id\n\tend", "title": "" }, { "docid": "73b4a9dc19263aec6499074fb7a6a96b", "score": "0.7372114", "text": "def login_user\n\t @user_session = UserSession.new\t \n\tend", "title": "" }, { "docid": "475e501c137002f0425941760959098a", "score": "0.73575836", "text": "def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end", "title": "" }, { "docid": "e69c89aec1c7d12b1cb0ad502a844fca", "score": "0.7351725", "text": "def login_from_session\n self.current_employee = Employee.find_by_id(session[:employee_id]) if session[:employee_id]\n end", "title": "" }, { "docid": "b64f086c5a57767a3635f7f27a43a500", "score": "0.7345578", "text": "def login(user)\n \tsession[:user_id] = user.id\n end", "title": "" }, { "docid": "e21cb06517303e88724884cbb82e4bd3", "score": "0.7340726", "text": "def login\n make_login_call\n end", "title": "" }, { "docid": "2dea5ac2458fa5da5d638a280c5ec66d", "score": "0.73162484", "text": "def login\n session[:user_id] = nil\n end", "title": "" }, { "docid": "fd611e244e8db9d5a21875c5305db599", "score": "0.7313493", "text": "def check_login\n if (current_user.blank? or current_user.username.blank?) and !session[:user_id].blank? \n logger.error(\"logout occurred\")\n session[:user_id] = nil\n elsif session[:user_id].blank? and !current_user_model.blank? and !current_user.blank? \n session[:user_id] = current_user_model.id\n session[:user_id] = '1' if session[:user_id].blank?\n logger.error(\"login occurred\")\n log_request('login')\n end\n end", "title": "" }, { "docid": "806bec92eca4b20191288a325e31a013", "score": "0.73110324", "text": "def login\n if request.get?\n session[:user_id] = nil\n @user = User.new\n else\n @user = User.new(params[:user])\n logged_in_user = @user.try_to_login\n if logged_in_user\n session[:user_id] = logged_in_user.id\n redirect_to(:controller => \"admin\")\n else\n flash[:notice] = \"Sorry, Invalid user/password combination!\"\n end \n end\n end", "title": "" }, { "docid": "adef79c8189e4895bfc5094a9f3a3161", "score": "0.73103076", "text": "def login(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "fac9e8ef6bf48e3f0c96bd43f6f55f38", "score": "0.7293281", "text": "def login_as(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "6a01b620b74905c8dbda63d9222d2ee8", "score": "0.7283568", "text": "def login\n # delete the session from their last login attempt if still there\n session.delete(:auth) unless session[:auth].nil?\n @login_form = LoginForm.new\n end", "title": "" }, { "docid": "b2fe506e0a9f67305014e367ede81586", "score": "0.72824913", "text": "def login user\n @request.session[:user_id] = user.id\n @controller.instance_variable_set('@current_user', user)\n end", "title": "" }, { "docid": "15efe0a103a6a025ebca3605fabf4094", "score": "0.7273118", "text": "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "title": "" }, { "docid": "c13c1a05ea1e291ce0a46da2b1a6ac90", "score": "0.72605705", "text": "def login!(session)\n session[:user_id] = self.id\n end", "title": "" }, { "docid": "9c6294a02d9bf1d6d1e9e5c08395f107", "score": "0.72528803", "text": "def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end", "title": "" }, { "docid": "8a9d6e7ee179a997e0e8e7d8a4631422", "score": "0.724485", "text": "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "title": "" }, { "docid": "63c511c6f7d627499ded35436e158339", "score": "0.7233035", "text": "def login\n\t\tuser = User.authenticate(params[:username],params[:password])\n\t\tif user\n\t\t\tsession[:current_user_id] = user.id\n\t\t\tflash[:notice] = \"logged in\"\n\t\t\tredirect_to '/home'\n\t\telse\n\t\t\tflash[:notice] = \"Wrong username/password\"\n\t\t\tredirect_to '/index'\n\t\tend\n\tend", "title": "" }, { "docid": "fd8e28737ea6eca7a6abee8f35893a98", "score": "0.7231895", "text": "def login!(user, options = {})\n session[:session_token] = user.persistence_token\n session[:active_at] = Time.now\n @current_user = user\n end", "title": "" }, { "docid": "cdb7f8b8e51d770df746b3adeb676c8b", "score": "0.7217501", "text": "def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end", "title": "" }, { "docid": "7055e88406e9d9b2d07282ce2a087634", "score": "0.7203183", "text": "def login_from_session\n self.current_<%= singular_name %> = <%= class_name %>.find_authenticated_model_with_id(session[:<%= singular_name %>]) if session[:<%= singular_name %>]\n end", "title": "" }, { "docid": "df2d9c24191155ca08a0494d44f7b09f", "score": "0.71909624", "text": "def login\n return if generate_blank\n @user = User.new(params[:user])\n if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])\n session[:user].logged_in_at = Time.now\n session[:user].save\n flash[:notice] = 'Login successful'\n redirect_to_stored_or_default :action => 'home'\n else\n @login = params[:user][:login]\n flash.now[:warning] = 'Login unsuccessful'\n end\n end", "title": "" }, { "docid": "e706ff9aeb201383a1c9f7810ac55c60", "score": "0.71898794", "text": "def login\n\t\t# Checks if there's a user associated\n\t\t# with the given email.\n\t\tu = User.find_by_email(params[:email])\n\n\t\t# If we find an email and the user\n\t\t# supplied the correct password we \n\t\t# login the user by starting a session.\n\t\t# We also redirect the user to the\n\t\t# control panel.\n\t\tif u && u.authenticate(params[:password])\n\t\t\t@id = u.id\n\t\t\t@token = Base64.encode64(params[:email] + ':' + params[:password])[0..-2]\n\n\t\t\tsession[:userid] = u.id\n\t\t\trender :template => 'api/v1/login/success'\n\t\telse\n\t\t\trender :status => 401, :template => 'api/v1/login/failure'\n\t\tend\n\tend", "title": "" }, { "docid": "916af17b7c709a70d8aeb126068103f0", "score": "0.71875256", "text": "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "title": "" }, { "docid": "792784bd6a1083f0315dcbf360168dfd", "score": "0.7151495", "text": "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "title": "" }, { "docid": "011862174116b522c0de9206d63b733d", "score": "0.7145679", "text": "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "title": "" }, { "docid": "73e93e80d6651e18d3785baf16ca8d10", "score": "0.7145518", "text": "def login\n user = User.find_by(psid: params[:id])\n session[:user_id] = user.id if user.present?\n redirect_to(session[:target_page] || root_path)\n end", "title": "" }, { "docid": "7a2eff59c59f20d6538c3ffa753a7fde", "score": "0.71427256", "text": "def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end", "title": "" }, { "docid": "d2b7045f501eed4c92cb65b09e1ff9fd", "score": "0.71299404", "text": "def login!(user)\n @current_user = user\n session[:session_token] = user.session_token\n end", "title": "" }, { "docid": "a108025972871ec8b755ef11067bc416", "score": "0.7116174", "text": "def login(user)\n request.session[:uid] = user.id\n end", "title": "" }, { "docid": "05d6ead85a75b657f62445b02f5ec399", "score": "0.7100275", "text": "def login\n if current_user and params[:return_to]\n # Already logged in; just need to send a token to the requesting\n # API client.\n #\n # FIXME: if current_user has never authorized this app before,\n # ask for confirmation here!\n\n send_api_token_to(params[:return_to], current_user)\n elsif params[:return_to]\n redirect_to \"/auth/joshid?return_to=#{CGI.escape(params[:return_to])}\"\n else\n redirect_to \"/auth/joshid\"\n end\n end", "title": "" }, { "docid": "5b084c415fcae9616a8fedd812e25914", "score": "0.70962715", "text": "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "title": "" }, { "docid": "48b3552790be5613d9c91f921b4f59a4", "score": "0.70942575", "text": "def login!(session)\n session[:user_id] = id\n end", "title": "" }, { "docid": "48b3552790be5613d9c91f921b4f59a4", "score": "0.70942575", "text": "def login!(session)\n session[:user_id] = id\n end", "title": "" }, { "docid": "4e2774b4b86094c3f26187c47fa6fadc", "score": "0.70894426", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "06d972abd1e4beb7ef006cc0032f5122", "score": "0.7082068", "text": "def login_attempt\n @user = User.where(email: params[:email]).first\n if @user && @user.password == params[:password]\n session[:user_id] = @user.id\n\n redirect_to root_path\n else\n flash[:notice] = \"Invalid Username or Password\"\n\n render \"login\"\n end\n end", "title": "" }, { "docid": "dad3288feb4e18e0ef2f192e8e937f29", "score": "0.70713973", "text": "def login_by_session(sessid)\n return if @logged_in\n @logged_in = true\n @session = sessid\n end", "title": "" }, { "docid": "e852bf8f74078cc74eeb3d951031f24b", "score": "0.7062396", "text": "def login\r\n\t\t@user = @current_user || User.new\r\n\t\t# If logged in, redirect to the pending orders page. This only happens if we didn't jump_to\r\n\t\t# something in require_authorisation: it's pretty confusing if you get the login screen again\r\n\t\t# _after_ you successfully logged in!\r\n\t\tif @user.permissions >= :client\r\n\t\t\tredirect_to(:controller => 'admin/orders', :action=> 'pending') and return false\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "45d690519a42e7cffd3f472d9468c183", "score": "0.70574015", "text": "def try_to_login\n User.login(self.name, self.password)\n end", "title": "" }, { "docid": "2412c56e1876ee4f5a41dbfd7227eac0", "score": "0.7053054", "text": "def login\n self.login\n end", "title": "" }, { "docid": "87134ac17a584fa5f072641a690da439", "score": "0.705044", "text": "def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end", "title": "" }, { "docid": "9a38d74d69acae2802a17ea5c849b771", "score": "0.70500267", "text": "def login!(session)\n session[:pd_user_id] = self.id\n end", "title": "" }, { "docid": "fea50397d920d76b6f3f9e86339d10a6", "score": "0.7049395", "text": "def login\n # pull the user info from the user model with the login params\n user = User.find_by_login(params[:login])\n # Authenciate with password\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:user_login] = user.login\n session[:user_authority] = user.authority\n # redirect to the landing page\n redirect_to \"/projects\"\n # failed \n else\n redirect_to login_url, alert: \"無効なID、パスワードの組み合わせです。\"\n end\n end", "title": "" }, { "docid": "774c2cea5ba2c04fe8451177d0c272c2", "score": "0.7039518", "text": "def log_in(user_id)\n session[:user_id] = user_id\n end", "title": "" }, { "docid": "aca6ce1973ad48453e0052624c18ecd9", "score": "0.70292944", "text": "def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n \tend", "title": "" }, { "docid": "bb802b2e024e90aac0f63a69f83175f9", "score": "0.70270073", "text": "def login_as(user)\n session[:user_id] = users(user).id\n end", "title": "" }, { "docid": "83986933cad29422eed101ba451f3174", "score": "0.7025348", "text": "def login\n \t# Find a user with params\n \tuser = User.authenticate(@credentials[:password], @credentials[:username])\n \tif user\n\t \t# Save them in the session\n\t \tlog_in user\n\t \t# Redirect to articles page\n\t \tredirect_to articles_path\n\telse\n\t\tredirect_to :back, status: :created\n\tend\n end", "title": "" }, { "docid": "a809894840873331f8aa88e856349f67", "score": "0.7020166", "text": "def login!(session) \n session[:user_id] = id \n end", "title": "" }, { "docid": "2e5e0d8dd7304e95f7a087d519e8c9b0", "score": "0.7019796", "text": "def login(user, password)\n @user = user\n @password = password\n\n User.user = @user\n User.password = @password\n \n Broadcast.user = @user\n Broadcast.password = @password\n\n # Set cached variables to save a lot of REST requests.\n @logged_in = currentUserExists?\n @is_admin = checkIsAdmin?\n return @logged_in\n end", "title": "" }, { "docid": "217baa7045c022b107cfe23bd6aac7c5", "score": "0.7015332", "text": "def login_user_by_id(user_id)\r\n session[:user_id] = user_id\r\n logger.debug(\"Setting session id to #{session[:user_id]}\")\r\n AuditLog.create(:user_id => user_id, :action => \"Logged in\")\r\n end", "title": "" }, { "docid": "195ebe501edc824c333907c289357d2c", "score": "0.70059127", "text": "def login(login, pass)\n @logged_in_user = Fotolia::User.new(self, login, pass)\n res = self.remote_call('loginUser', login, pass)\n raise UserLoginError unless(res['session_id'])\n @session_id = res['session_id']\n end", "title": "" }, { "docid": "2c855925390fef1da188c9a06d8eb3e7", "score": "0.6998063", "text": "def attempt_login\n if params[:username].present? && params[:password].present?\n found_user = User.where(:username => params[:username]).first #this will return the first record\n if found_user\n authorized_user= found_user.authenticate(params[:password])\n end\n end\n if authorized_user\n # reset_session if session[:last_seen] < 1.minutes.ago\n #session[:last_seen] = Time.now\n cookies[:user_id]=authorized_user.id\n #cookies[:user_id]={:expires=>1.minute.from_now}\n cookies[:user_name]=authorized_user.username\n cookies[:hotel_id_for_login_user]=authorized_user.hotel_id\n flash[:notice]=\"You are now logged in.\"\n redirect_to(:action=>'index')\n else\n # session[:last_seen] = Time.now\n flash[:notice]=\"Invalid username/password combination.\" \n redirect_to(:controller=>'homepage',:action=>'login') \nend\nend", "title": "" }, { "docid": "2a79cbbcb3c9b2909f64605614fdfd8a", "score": "0.6995911", "text": "def login!(user) #sets congruency between session token of user and session\n @current_user = user\n session[:session_token] = user.session_token\n end", "title": "" }, { "docid": "0f956405217d8ce4df06dfe9f8a1bd17", "score": "0.69952106", "text": "def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "f73c02155c348d8a35a313ed8124aa06", "score": "0.6994985", "text": "def log_in(user)\n session[:user_id] = user.id\n end", "title": "" }, { "docid": "6ca05941e1400a2307166addfd467ef0", "score": "0.69919664", "text": "def login(params={})\n (current_user) ? link_to_logout(params) : link_to_login(params)\n end", "title": "" }, { "docid": "47f648698f514ae7d1e69de9126c975d", "score": "0.6991653", "text": "def login\n @user = User.where(email: params[:user][:email]).first\n\n if @user.present? && @user.authenticate(params[:user][:password])\n session[:user_id] = @user.id\n render status: 200, notice: \"Signed in successfully\"\n else\n render status: 401, alert: \"Error signing in\"\n end\n end", "title": "" }, { "docid": "973fc04bb49c3eb084ea79685650593b", "score": "0.69880646", "text": "def login!(user, *args, **kwargs)\n login(user, *args, **kwargs)\n session = kwargs[:session] || self\n assert_flash_success(session: session)\n user = User.find_by(login: user) if user.is_a?(String)\n assert_equal(user.id, User.current_id, \"Wrong user ended up logged in!\")\n end", "title": "" }, { "docid": "1212b571deb9d63b1cdbd1014cf56f7b", "score": "0.6975531", "text": "def login \n\t\n\t\t# redirect user to their team library if he or she visits the login screen but is already logged in\n\t\tif !session[:user_id].nil?\n\t\t\tredirect_to(:controller => :flash_teams, :action => :index)\n\t\tend\t\t\n\t\t\n\t\t@title = \"Login\"\n\t\t\n\tend", "title": "" }, { "docid": "56db9910f8213d505b3b0e85338ac212", "score": "0.6972564", "text": "def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end", "title": "" }, { "docid": "cfba5923c8cf56b074b281844cd5f27f", "score": "0.6966169", "text": "def login\n @user = User.find_by(username: params[:session][:username])\n if @user && @user.authenticate(params[:session][:password]) \n flash[:success] = \"Welcome!\"\n session[:signed_in_user_id] = @user.id\n redirect_to user_path(@user)\n else\n flash[:error] = \"Username or Password Incorrect\"\n redirect_to new_login_path\n end\n end", "title": "" }, { "docid": "9386accf14e3615d89a9bd5387f3760d", "score": "0.69573635", "text": "def login\n @user = User.find_by(email: params[:email])\n if @user && @user.authenticate(params[:password])\n session[:user_id] = @user.id\n redirect_to \"/users/#{@user.id}\"\n else\n flash[:errors] = \"Incorrect login information!\"\n redirect_to :back\n end\n end", "title": "" }, { "docid": "ea6568837fa04ddc901cd9b54f2ee170", "score": "0.6951163", "text": "def login(username, password)\n user = User.authenticate(username, password)\n\n unless !user\n @session[:user] = user.id\n end\n\n user\n end", "title": "" }, { "docid": "da3d96a432d52162a11ef1d10da0bf96", "score": "0.69436973", "text": "def login!(session)\n session[:user_id]=id\n end", "title": "" } ]
c77109e43f980fc0432e21663712f621
needs a bit of work it doesn't reveal numbers
[ { "docid": "ed7da62b67b0e17e9ad6d317d2604797", "score": "0.0", "text": "def reveal_cell(row_num, col_num) #planning to be used recursively, used after ensuring the user did not click on a bomb.\n\t\tif (row_num <= 9 && row_num >=0) and (col_num <= 9 && col_num >=0)\n\t\t\tif @grid[row_num][col_num].is_hidden #if this tile is empty it'll unhide and then propagate\n\t\t\t\t#@grid[row_num][col_num].unhide\n\t\t\t\tunhide_tiles(row_num, col_num)\n\t\t\telse\n\t\t\t\t@grid[row_num][col_num].unhide #if this tile is a number it'll just unhide and won't propagate off it.\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "66d3b6a4971262dd57e42a0a5ce2961c", "score": "0.6366409", "text": "def number; end", "title": "" }, { "docid": "66d3b6a4971262dd57e42a0a5ce2961c", "score": "0.6366409", "text": "def number; end", "title": "" }, { "docid": "3d1202a32f6b6d7e8715364dc4544bd0", "score": "0.6312483", "text": "def num; end", "title": "" }, { "docid": "3d1202a32f6b6d7e8715364dc4544bd0", "score": "0.6312483", "text": "def num; end", "title": "" }, { "docid": "75b37d55bf550450975646fe775b4a0a", "score": "0.62077934", "text": "def magic_numbers(count)\nend", "title": "" }, { "docid": "088b8f55cc099c8642ced608cfef8887", "score": "0.61487037", "text": "def old_school num\n numeral = ''\n \n\n numeral += 'M'*(num/1000)\n num = num % 1000\n numeral += 'D'*(num/500)\n num = num % 500\n numeral += 'C'*(num/100)\n num = num % 100\n numeral += 'L'*(num/50)\n num = num % 50\n numeral += 'X'*(num/10)\n num = num % 10\n numeral += 'V'*(num/5)\n num = num % 5\n numeral += 'I'*(num/1)\n num = num % 1\n\n\n\n return numeral \n\nend", "title": "" }, { "docid": "5249a3716ba7e63b29961100e865251d", "score": "0.61446583", "text": "def vat_number; end", "title": "" }, { "docid": "2e6524e6e6537b06867b6429941e7875", "score": "0.6133634", "text": "def prec_i() end", "title": "" }, { "docid": "dd36edc02d71ff588c5268ae434bca59", "score": "0.6046589", "text": "def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend", "title": "" }, { "docid": "1517341070b97466b43a18633f066374", "score": "0.60347384", "text": "def exercise_119 (number)\n end", "title": "" }, { "docid": "528b737d0e56fa36ed3c9a0bc7d2dece", "score": "0.59895754", "text": "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "title": "" }, { "docid": "f9ad63ae5c7cea6c1f15c5ac000ce93e", "score": "0.59320843", "text": "def consume_number; end", "title": "" }, { "docid": "28b34660dee741265a7fbf626d8f2890", "score": "0.5916988", "text": "def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end", "title": "" }, { "docid": "ccc03c5c78eb735123206df08cbfb39b", "score": "0.5912496", "text": "def add_numbers(prev, current)\n# do real calculation\n# total = prev + current\n# For display, need to use i, x and c correctors\n @arabictotaled = 0\n\n# first get the i's right\n case \n when @nextnum.i.length >= 5 # We can have up to 8 i's, so we'll move 5 (if there are that many) to the V's column\n @nextnum.v += \"V\"\n 5.times { |i| @nextnum.i.chop!}\n @arabictotaled += @nextnum.i.length # the \"leftover\" i's are each 1 in the arabictotal; this case settles what number goes into the i's column and adds that many to arabictotaled\n when @nextnum.i.length == 4\n# iflag = true # when we're checking X's, we'll need to know this\n unless @nextnum.v.length % 2 == 1 # if there are 1 or 3 V's, don't display \"IV\" — instead we'll need \"IX\"\n @nextnum.iv += \"IV\"\n end # unless\n @arabictotaled += 4\n when @nextnum.i.length < 4\n @arabictotaled += @nextnum.i.length\n end # case\n\n# now do the v's\n# at most we can have 3 v's (say we added XII + IV, then the X gets converted to V + IIIII to handle the Iminus and then later IIIII gets converted back to V)\n case @nextnum.v.length\n when 3\n @nextnum.v = \"V\"\n @nextnum.x += \"X\"\n @arabictotaled += 5\n if @nextnum.i.length == 4\n @nextnum.iv = \"\"\n @nextnum.ix = \"IX\"\n end\n when 2\n @nextnum.v = \"\"\n @nextnum.x += \"X\"\n # we do not increment arabictotal since the V's column is empty\n when 1\n @arabictotaled += 5\n if @nextnum.i.length == 4\n @nextnum.iv = \"\"\n @nextnum.ix = \"IX\"\n end\n end # case\n\n case \n when @nextnum.x.length >= 5\n @nextnum.l += \"L\"\n 5.times { |i| @nextnum.x.chop!}\n @arabictotaled += (@nextnum.x.length * 10)\n when @nextnum.x.length == 4\n# xflag = true # when we're checking C's, we'll need to know this\n unless @nextnum.l.length % 2 == 1 # if there are 1 or 3 L's, don't display \"XL\" — instead we'll need \"XC\"\n @nextnum.xl += \"XL\"\n else @nextnum.xc +=\"XC\"\n end # unless\n @arabictotaled += 40\n when @nextnum.x.length < 4\n @arabictotaled += (@nextnum.x.length * 10)\n end # case\n\n case @nextnum.l.length\n when 3\n @nextnum.l =\"L\"\n @nextnum.c += \"C\"\n @arabictotaled += 50\n when 2\n @nextnum.l = \"\"\n @nextnum.c += \"C\"\n when 1\n @arabictotaled += 50\n end # case\n\n case\n when @nextnum.c.length >= 5\n @nextnum.d += \"D\"\n 5.times { |i| @nextnum.c.chop!}\n @arabictotaled += (@nextnum.c.length * 100)\n when @nextnum.c.length == 4\n @nextnum.d += \"D\"\n @nextnum.c = \"\"\n @nextnum.cd = \"CD\"\n @arabictotaled += 400\n when @nextnum.c.length < 4\n @arabictotaled += (@nextnum.c.length * 100) \n end # case\n\n case @nextnum.d.length\n when 3\n @nextnum.d =\"D\"\n @nextnum.m += \"M\"\n @arabictotaled += 500\n when 2\n @nextnum.d = \"\"\n @nextnum.m += \"M\"\n when 1\n @arabictotaled += 500\n end # case\n\n case @nextnum.m.length\n when 9\n @nextnum.m = \"MMM\"\n extra = \" +MMM+MMM\"\n @nextnum.mstore = \"MMMMMM\"\n @arabictotaled += 9000\n when 8\n @nextnum.m = \"MMM\"\n extra = \" +MMM+MM\"\n @nextnum.mstore = \"MMMMM\"\n @arabictotaled += 8000\n when 7\n @nextnum.m = \"MMM\"\n extra = \" +MMM+M\"\n @nextnum.mstore = \"MMMM\"\n @arabictotaled += 7000\n when 6\n @nextnum.m = \"MMM\"\n extra = \" +MMM\"\n @nextnum.mstore = \"MMM\"\n @arabictotaled += 6000\n when 5\n @nextnum.m = \"MMM\"\n extra = \" +MM\"\n @nextnum.mstore = \"MM\"\n @arabictotaled += 5000\n when 4\n @nextnum.m.chop! \n extra = \" +M\"\n @nextnum.mstore = \"M\"\n @arabictotaled += 4000\n when 1..3\n extra = \"\"\n @nextnum.mstore = \"\"\n @arabictotaled += (@nextnum.m.length * 1000)\n when 0\n extra = \"\"\n end # case\n\n total = \"\"\n total += @nextnum.m\n if @nextnum.cm == \"CM\"\n total += @nextnum.cm # 3 options: CM, CD or D + C's\n elsif @nextnum.cd == \"CD\"\n total += @nextnum.cd \n else\n total += @nextnum.d \n total += @nextnum.c # There are 4 C's stored here if the number is CM or CD but we don't want to display them\n end\n if @nextnum.xc == \"XC\" # 3 options: XC, XL or L + X's\n total += @nextnum.xc \n elsif @nextnum.xl == \"XL\"\n total += @nextnum.xl \n else\n total += @nextnum.l \n total += @nextnum.x\n end\n if @nextnum.ix == \"IX\" # 3 options: IX, IV or V + I's\n total += @nextnum.ix \n elsif @nextnum.iv == \"IV\"\n total += @nextnum.iv \n else\n total += @nextnum.v \n total += @nextnum.i\n end\n\n# total = @cbeforem + @mtotal + @dtotal + @xbeforec +@ctotal + @ltotal + @ibeforex + @xtotal + @ibeforev + @vtotal + @nextnum.i\n# @altdisplay.text = extra\n update_altdisplay(extra)\n update_arabicdisplay(@arabictotaled)\n # if total.length == 0\n # total = \"nihil\"\n # update_arabicdisplay(0)\n # end\n# total = \"MMCXX\"\n return total\n# return total, @arabictotaled\n# @maindisplay.text += \"#{@prevnum} + #{@nextnum}\" # but not yet\n end", "title": "" }, { "docid": "6970a4bac985e63599bd4f6b2a2c100c", "score": "0.59049046", "text": "def digit; end", "title": "" }, { "docid": "5ca9d6f1d6cee7b3f6e1b5f8a9020867", "score": "0.58917546", "text": "def oldrconv number\n\tset = [1,5,10,50,100,500,1000]\n\tx = 0\n\tlen = set.length\n\twhile x < len\n\t\tresult = number/set[x]\n\t\tbreak if result < 1\n\t\tsres = result\n\t\tx = x + 1\n\tend\n\t\n\tbase = set[x -1]\n\t\n\tif (base !=1)\t\n\tfresult = number%base\n\telse\n\tfresult = number%5\n\tend\n\n\tif (base == 1)\n\t\tform = 'I'* sres\n\telsif (base == 5) \n\t\tform = 'V' * sres\n\telsif (base == 10)\n\t\tform = 'X'* sres\n\telsif (base ==50)\n\t\tform = 'L'* sres\n\telsif (base ==100)\n\t\tform = 'C'* sres\n\telsif (base == 500)\n\t\tform = 'D'* sres\n\telsif (base == 1000)\n\t\tform = 'M'* result\n\tend\n\tif (fresult == 0)\n\t\tputs form\n\telsif (fresult != 0 && base != 1)\n\t\tputs form + 'I'*fresult\n\telse\n\t\tputs 'I' * fresult\n\tend\nend", "title": "" }, { "docid": "016524007af65b254364c86994146425", "score": "0.5889029", "text": "def fix_numerals\n hash = self.clone\n traverse hash\n hash\n end", "title": "" }, { "docid": "e336eff9ec78b80b1953235cb06936a8", "score": "0.5884713", "text": "def pure_number(n)\n arr = []\n arr[0] = \"\"\n blocks = 0\n displacement = 0\n i = 1\n while(i <= n)\n blocks = blocks + 1 if(is_power_of_2?(i+1))\n if(is_4_series?(i, blocks))\n displacement = power_of_num(2, blocks-1)\n arr[i] = \"4\" + arr[i-displacement] + \"4\"\n else\n displacement = power_of_num(2, blocks) \n arr[i] = \"5\" + arr[i-displacement] + \"5\"\n end\n i+=1\n end\n arr\nend", "title": "" }, { "docid": "daf28bf784c81d6e8d65e31b57b80c35", "score": "0.58640355", "text": "def next_number(last)\n\t#checks on the value at the 25th point\n\ttap25 = (last & 0x1000000) != 0 # 1_0000_0000_0000_0000_0000_0000\n\t#checks on the value at the 22nd point\n\ttap22 = (last & 0x200000) != 0 # 0_0010_0000_0000_0000_0000_0000\n\txnor = !(tap25 ^ tap22)\n\t\n\tif xnor\n\t\t#\"<<\" pushes all the digits up\n\t\t#the \"& 0x1FFFFFF\" cuts off any ones that are too large\n\t\t#then adds a one to the end - that OR will always return true, because they're shifted everything up\n\t\treturn ((last << 1) & 0x1FFFFFF) | 0x00000001\n\telse\n\t\treturn ((last << 1) & 0x1FFFFFF)\n\tend\nend", "title": "" }, { "docid": "d12bc44a4551399de34a716a095113b0", "score": "0.58594394", "text": "def shownumbers_mand\n\t\tmult = @num1 * @num2 * @num3\n\t\tputs \"With Mandtory #{@num1} * #{@num2} * #{@num3} = #{mult}\"\n\tend", "title": "" }, { "docid": "bf6740c47f1a3914c80fc7ac01532d4a", "score": "0.58538413", "text": "def wtf_nums()\r\n\tthe_wtf_num = [37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538,\r\n\t\t\t\t\t74324986199524741059474233309513058123726617309629, 91942213363574161572522430563301811072406154908250,\r\n\t\t\t\t\t23067588207539346171171980310421047513778063246676, 89261670696623633820136378418383684178734361726757,\r\n\t\t\t\t\t28112879812849979408065481931592621691275889832738, 44274228917432520321923589422876796487670272189318,\r\n\t\t\t\t\t47451445736001306439091167216856844588711603153276, 70386486105843025439939619828917593665686757934951,\r\n\t\t\t\t\t62176457141856560629502157223196586755079324193331, 64906352462741904929101432445813822663347944758178,\r\n\t\t\t\t\t92575867718337217661963751590579239728245598838407, 58203565325359399008402633568948830189458628227828,\r\n\t\t\t\t\t80181199384826282014278194139940567587151170094390, 35398664372827112653829987240784473053190104293586,\r\n\t\t\t\t\t86515506006295864861532075273371959191420517255829, 71693888707715466499115593487603532921714970056938,\r\n\t\t\t\t\t54370070576826684624621495650076471787294438377604, 53282654108756828443191190634694037855217779295145,\r\n\t\t\t\t\t36123272525000296071075082563815656710885258350721, 45876576172410976447339110607218265236877223636045,\r\n\t\t\t\t\t17423706905851860660448207621209813287860733969412, 81142660418086830619328460811191061556940512689692,\r\n\t\t\t\t\t51934325451728388641918047049293215058642563049483, 62467221648435076201727918039944693004732956340691,\r\n\t\t\t\t\t15732444386908125794514089057706229429197107928209, 55037687525678773091862540744969844508330393682126,\r\n\t\t\t\t\t18336384825330154686196124348767681297534375946515, 80386287592878490201521685554828717201219257766954,\r\n\t\t\t\t\t78182833757993103614740356856449095527097864797581, 16726320100436897842553539920931837441497806860984,\r\n\t\t\t\t\t48403098129077791799088218795327364475675590848030, 87086987551392711854517078544161852424320693150332,\r\n\t\t\t\t\t59959406895756536782107074926966537676326235447210, 69793950679652694742597709739166693763042633987085,\r\n\t\t\t\t\t41052684708299085211399427365734116182760315001271, 65378607361501080857009149939512557028198746004375,\r\n\t\t\t\t\t35829035317434717326932123578154982629742552737307, 94953759765105305946966067683156574377167401875275,\r\n\t\t\t\t\t88902802571733229619176668713819931811048770190271, 25267680276078003013678680992525463401061632866526,\r\n\t\t\t\t\t36270218540497705585629946580636237993140746255962, 24074486908231174977792365466257246923322810917141,\r\n\t\t\t\t\t91430288197103288597806669760892938638285025333403, 34413065578016127815921815005561868836468420090470,\r\n\t\t\t\t\t23053081172816430487623791969842487255036638784583, 11487696932154902810424020138335124462181441773470,\r\n\t\t\t\t\t63783299490636259666498587618221225225512486764533, 67720186971698544312419572409913959008952310058822,\r\n\t\t\t\t\t95548255300263520781532296796249481641953868218774, 76085327132285723110424803456124867697064507995236,\r\n\t\t\t\t\t37774242535411291684276865538926205024910326572967, 23701913275725675285653248258265463092207058596522,\r\n\t\t\t\t\t29798860272258331913126375147341994889534765745501, 18495701454879288984856827726077713721403798879715,\r\n\t\t\t\t\t38298203783031473527721580348144513491373226651381, 34829543829199918180278916522431027392251122869539,\r\n\t\t\t\t\t40957953066405232632538044100059654939159879593635, 29746152185502371307642255121183693803580388584903,\r\n\t\t\t\t\t41698116222072977186158236678424689157993532961922, 62467957194401269043877107275048102390895523597457,\r\n\t\t\t\t\t23189706772547915061505504953922979530901129967519, 86188088225875314529584099251203829009407770775672,\r\n\t\t\t\t\t11306739708304724483816533873502340845647058077308, 82959174767140363198008187129011875491310547126581,\r\n\t\t\t\t\t97623331044818386269515456334926366572897563400500, 42846280183517070527831839425882145521227251250327,\r\n\t\t\t\t\t55121603546981200581762165212827652751691296897789, 32238195734329339946437501907836945765883352399886,\r\n\t\t\t\t\t75506164965184775180738168837861091527357929701337, 62177842752192623401942399639168044983993173312731,\r\n\t\t\t\t\t32924185707147349566916674687634660915035914677504, 99518671430235219628894890102423325116913619626622,\r\n\t\t\t\t\t73267460800591547471830798392868535206946944540724, 76841822524674417161514036427982273348055556214818,\r\n\t\t\t\t\t97142617910342598647204516893989422179826088076852, 87783646182799346313767754307809363333018982642090,\r\n\t\t\t\t\t10848802521674670883215120185883543223812876952786, 71329612474782464538636993009049310363619763878039,\r\n\t\t\t\t\t62184073572399794223406235393808339651327408011116, 66627891981488087797941876876144230030984490851411,\r\n\t\t\t\t\t60661826293682836764744779239180335110989069790714, 85786944089552990653640447425576083659976645795096,\r\n\t\t\t\t\t66024396409905389607120198219976047599490197230297, 64913982680032973156037120041377903785566085089252,\r\n\t\t\t\t\t16730939319872750275468906903707539413042652315011, 94809377245048795150954100921645863754710598436791,\r\n\t\t\t\t\t78639167021187492431995700641917969777599028300699, 15368713711936614952811305876380278410754449733078,\r\n\t\t\t\t\t40789923115535562561142322423255033685442488917353, 44889911501440648020369068063960672322193204149535,\r\n\t\t\t\t\t41503128880339536053299340368006977710650566631954, 81234880673210146739058568557934581403627822703280,\r\n\t\t\t\t\t82616570773948327592232845941706525094512325230608, 22918802058777319719839450180888072429661980811197,\r\n\t\t\t\t\t77158542502016545090413245809786882778948721859617, 72107838435069186155435662884062257473692284509516,\r\n\t\t\t\t\t20849603980134001723930671666823555245252804609722, 53503534226472524250874054075591789781264330331690]\r\n\t# try\r\n\treturn the_wtf_num.inject(0){ |sum, i| sum + i }\r\nend", "title": "" }, { "docid": "0b7766f463561f160cb456bc1907baed", "score": "0.58469117", "text": "def expanded_form(num)\r\n num.digits.each_with_index.map{| val, idx | val * (10 ** idx)}.select{|x| x != 0}.reverse.join(\" + \")\r\nend", "title": "" }, { "docid": "381f12872c57793c96695cc1954cc76c", "score": "0.5827102", "text": "def duns_number; end", "title": "" }, { "docid": "7d5d1dd8431a738982f0fe2a3304a100", "score": "0.58141094", "text": "def englishNumber remaining_number\n if remaining_number == 0\n return 'zero'\n end\n number_string = remaining_number < 0 ? \"negative \" : \"\"\n remaining_number = remaining_number.abs\n\n #build arrays\n onesPlace = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tensPlace = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n teenagers = ['eleven','twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n million_billion = [[100,\"hundred\"]]\n big_array = [\"thousand\",\"million\",\"billion\",\"trillion\",\"quadrillion\",\"quintillion\",\"sextillion\",\"septillion\",\"octillion\",\"nonillion\",\"decillion\",\"undecillion\",\"duodecillion\",\"tredecillion\",\"quattuordecillion\",\"quindecillion\",\"sexdecillion\",\"septendecillion\",\"octodecillion\",\"novemdecillion\",\"vigintillion\",\"unvigintillion\",\"duovigintillion\",\"trevigintillion\",\"quattuorvigintillion\",\"quinvigintillion\",\"sexvigintillion\",\"septenvigintillion\",\"octovigintillion\",\"novemvigintillion\",\"trigintillion\",\"untrigintillion\",\"duotrigintillion\",\"tretrigintillion\",\"quattuortrigintillion\",\"quintrigintillion\",\"sextrigintillion\",\"septentrigintillion\",\"octotrigintillion\",\"novemtrigintillion\",\"quadragintillion\",\"unquadragintillion\",\"duoquadragintillion\",\"trequadragintillion\",\"quattuorquadragintillion\",\"quinquadragintillion\",\"sexquadragintillion\",\"septenquadragintillion\",\"octoquadragintillion\",\"novemquadragintillion\",\"quinquagintillion\",\"unquinquagintillion\",\"duoquinquagintillion\",\"trequinquagintillion\",\"quattuorquinquagintillion\",\"quinquinquagintillion\",\"sexquinquagintillion\",\"septenquinquagintillion\",\"octoquinquagintillion\",\"novemquinquagintillion\",\"sexagintillion\",\"unsexagintillion\",\"duosexagintillion\",\"tresexagintillion\",\"quattuorsexagintillion\",\"quinsexagintillion\",\"sexsexagintillion\",\"septensexagintillion\",\"octosexagintillion\",\"novemsexagintillion\",\"septuagintillion\",\"unseptuagintillion\",\"duoseptuagintillion\",\"treseptuagintillion\",\"quattuorseptuagintillion\",\"quinseptuagintillion\",\"sexseptuagintillion\",\"septenseptuagintillion\",\"octoseptuagintillion\",\"novemseptuagintillion\",\"octogintillion\",\"unoctogintillion\",\"duooctogintillion\",\"treoctogintillion\",\"quattuoroctogintillion\",\"quinoctogintillion\",\"sexoctogintillion\",\"septenoctogintillion\",\"octooctogintillion\",\"novemoctogintillion\",\"nonagintillion\",\"unnonagintillion\",\"duononagintillion\",\"trenonagintillion\",\"quattuornonagintillion\",\"quinnonagintillion\",\"sexnonagintillion\",\"septennonagintillion\",\"octononagintillion\",\"novemnonagintillion\",\"centillion\"]\n big_array.each_with_index do |array_words,index|\n million_billion << [1000 ** (index + 1),array_words]\n end\n\n #bignums\n million_billion.reverse_each do |array_number,array_words|\n currently_writing = remaining_number/array_number\n remaining_number -= currently_writing * array_number\n if currently_writing > 0\n number_string += englishNumber(currently_writing) + ' ' + array_words\n if remaining_number > 0\n number_string += ' '\n end\n end\n end\n #tens\n currently_writing = remaining_number/10\n remaining_number -= currently_writing*10\n if currently_writing > 0\n if ((currently_writing == 1) and (remaining_number > 0))\n number_string += teenagers [remaining_number-1]\n remaining_number = 0\n else\n number_string += tensPlace[currently_writing-1]\n end\n if remaining_number > 0\n number_string += '-'\n end\n end\n #ones\n number_string += onesPlace [remaining_number-1] if remaining_number > 0\n number_string\nend", "title": "" }, { "docid": "614f52abb7d52c648d5797491b6af74e", "score": "0.5809502", "text": "def mambo_no_5; end", "title": "" }, { "docid": "38c128a142f55acde91894db9f5329af", "score": "0.57999593", "text": "def base\n nombre = @nombre\n b = 1# nombre de diese\n nombre.times do |i|\n if i == 0\n next\n end\n espace = \" \"\n has = \"# \"\n \n c = nombre - i# nombre d'espace\n a = nombre - c\n puts \" #{espace*=c} #{has=has*b}\"\n b = (i + 2 + a)-1# nombre de diese\n end\n\nend", "title": "" }, { "docid": "0256e26571ce63b2c8728bd2e5e036f4", "score": "0.5797211", "text": "def interesting_number(number)\n number.each_char.map {|c| c.to_i}\n puts number\nend", "title": "" }, { "docid": "5c09ac746bed455b9db5a2176ce9ad3c", "score": "0.577671", "text": "def english_number number\n\tputs 'Number must be positive' if number < 0\n\tputs 'zero' if number == 0 \n\n\t\n\tunits_in_english = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\ttens_in_english = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', '']\n\tthousands_exponentials_in_engligh = {1 => 'thousand', 2 => 'million', 3 => 'billion', 4 => 'trillion' }\n\n\n\tnum_string = ''\n\t# number in English for all positive non-zero numbers\n\n\tleft = number\n\t# amount left to be translated\n\n\tif left > 0\n\n\t\texp = Math.log(number,1000).to_i\n\t\t# finds out order of magnitude of 'left' variable, as exponential of thousands\n\n\t\twhile left > 0 && exp >= 1\n\t\t\twrite = left / (1000 ** exp)\n\t\t\tleft = left - ( write * (1000 ** exp) )\n\t\t\tif write > 0\n\t\t\t\tnum_string = num_string + units_in_english[write] + ' ' + thousands_exponentials_in_engligh[exp]\n\t\t\tend\n\t\t\texp = Math.log(left,1000).to_i unless left == 0\n\t\tend\n\n\tend\n\n=begin old version of if for thousands\n\t# matar esse if:\n\twrite = left/1000\n\t# finds out how many thousands\n\tleft = left - write*1000\n\t# finds out how much is left after taking out the thousands\n\n\tif write > 0\n\t\tnum_string = num_string + units_in_english[write] + ' thousand '\n\tend\n\n=end\n\n\twrite = left/100\n\t# finds out how many hundreds\n\tleft = left - write*100\n\t# finds out how much is left after taking out the hundreds\n\n\tif write > 0\n\t\tnum_string = num_string + units_in_english[write] + ' hundred'\n\tend\n\n\tif left >= 20\n\t\twrite = left / 10\n\t\t# finds out how many tens\n\t\tnum_string = num_string + ' ' + tens_in_english[write]\n\t\tleft = left - write * 10\n\t\t# finds out how much is left after taking out the tens\n\t\tnum_string = num_string + '-' if left > 0 \n\t\t# appends '-' in case of 'trirty-four', for example\n\tend\n\tif left > 0\n\t\twrite = left\n\t\tnum_string = num_string + units_in_english[write]\n\tend\n\n\tnum_string\nend", "title": "" }, { "docid": "211bcfef382b6f38aa73b2d9454cad26", "score": "0.57740635", "text": "def tenders_num(num)\n\nend", "title": "" }, { "docid": "4f72a6725337879ef77103c66a1833dd", "score": "0.5767553", "text": "def slippery_numbers(n)\nend", "title": "" }, { "docid": "4929921dca6f23fa26b064685911ee99", "score": "0.57638097", "text": "def eureka(num)\n num_arr = num.to_s.split('').collect{ |x| x.to_i }\n i = 0\n num1 = num_arr.reverse\n result1 = 0\n result2 = 0\n while i < num_arr.length\n result1 += num1[i] * (10 ** i)\n result2 += num_arr[i] ** (i + 1)\n i += 1\n end\n result1 == result2\n end", "title": "" }, { "docid": "3944ae401facb6a9e453b77e539874cb", "score": "0.57610613", "text": "def display_nums\n (0...9).each do |ro|\n (0...9).each do |co|\n if @grid[ro][co] == :B\n surround_nums(ro,co)\n end\n end\n end\n end", "title": "" }, { "docid": "e76f8ae48fe28459ba7e346b1fbb8e7c", "score": "0.57592875", "text": "def english_number number\n if number < 0\n return 'Please enter a number that is not negative.'\n end\n if number == 0\n return 'zero'\n end\n\n num_string = ''\n ones_place = ['one', 'two', 'three','four','five', 'six', 'seven', 'eight', 'nine']\n tens_place = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n teenagers = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sisxteen', 'seventeen', 'eighteen', 'nineteen']\n millions = [['hundred',2],['thousand', 3], ['million', 6], ['billion', 9] ]\n\nleft = number\n\nwhile millions.length > 0\n mil_pair = millions.pop\n mil_name = mil_pair[0]\n mil_base = 10 ** mil_pair[1]\n write = left/mil_base\n left = left - write * mil_base\n\n if write > 0\n prefix = english_number write\n num_string = num_string + prefix + ' ' + mil_name\n if left > 0\n num_string =num_string + ' '\n end\n end\n end\n\n\nwrite = left/10\nleft = left - write * 10\n\nif write > 0\n hundreds = english_number write\n num_string = num_string + hundreds + 'hundred'\nif left > 0\n num_string = num_string + ' '\nend\nend\nif write > 0\n if ((write == 1) and (left > 0))\n num_string = num_string + teenagers[left-1]\n left = 0\n else\n num_string = num_string + tens_place[write-1]\n end\n if left > 0\n num_string = num_string + '-'\n end\nend\nwrite = left\nleft = 0\n\nif write > 0\n num_string = num_string + ones_place[write-1]\nend\n\nnum_string\nend", "title": "" }, { "docid": "a53d5918c227c1776b6c2e2a492b8462", "score": "0.5751531", "text": "def additivePersistence(number, times)\n # your magic\n numString = number.to_s\n sum = 0\n numString.each_char {|digit| sum += digit.to_i}\n\n if sum > 9 \n\t times += 1\n puts additivePersistence(sum, times)\n else\n puts times\n end\nend", "title": "" }, { "docid": "e6054b4718f29905c34c6cafc5230b55", "score": "0.5732505", "text": "def bsb_number; end", "title": "" }, { "docid": "ca704d198bb0556c38aa4e15a239d778", "score": "0.5727747", "text": "def thnum()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "9960ec8f3e7936a824dbdd31e6e38bed", "score": "0.57196087", "text": "def dasherize_number(num)\n\nnumx = num.to_s\nlength = numx.length\n\nidx = 0\n\nif numx[1] == nil\n\treturn numx[0]\nend\n\n\nwhile idx < length\nstring = ''\n\tif numx[idx] == 0\n\t\tstring = string + 0\n\t\tidx += 1\n\telsif num[idx] == nil\n\t\treturn string\t\n\telsif (numx[0] % 2) == 0\n\t\tstring = string + numx[0]\n\t\tidx += 1\n\telsif (numx[0] % 2 != 0)\n\t\tstring = string + numx[0] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) == 0) && (numx[idx + 1] % 2) == 0)\n\t\tstring = string + '-' + numx[idx] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) == 0) && (numx[idx + 1] % 2) != 0)\n\t\tstring = string + '-' + numx[idx]\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) != 0) && (numx[idx + 1] % 2) == 0)\n\t\tstring = string + numx[idx] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) != 0) && (numx[idx + 1] % 2) != 0)\n\t\tstring = '-' + numx[idx] + '-'\n\t\tidx += 1\n\telse\n\t\tstring = string + numx[idx]\n\t\tidx += 1\n\tend\t\nend\n\nreturn string\n\nend", "title": "" }, { "docid": "5798b8586d65cdbed8105ee1ae8608a9", "score": "0.57188326", "text": "def expanded_form(num)\n # Your code here\n ans = []\n len = num.to_s.length\n k = (\"1\" + \"0\" * len).to_i/10\n while num > 0\n if num/k >= 1\n ans << num/k * k\n num -= num/k * k\n k = k / 10\n elsif num < 10\n ans << num\n num -= num\n end\n end\n return ans.join(\" + \")\nend", "title": "" }, { "docid": "2b4524c253fc8ff4ba97c8baa763dc35", "score": "0.57141894", "text": "def cardinal; end", "title": "" }, { "docid": "b3ac4258ebbf211b8cb03360f8e4abec", "score": "0.571282", "text": "def to_roman2 number\t\r\n\t@roman = ''\r\n\tmarker = ['I','V','X','L','C','D','M']\r\n\t(0..Math.log10(number).to_i).each do |i|\r\n\t\tputs i\r\n\t\t@unit_number = (number % (10^(i+1)))/10^i\r\n\t\tputs @unit_number\t\r\n\t\t@roman = @roman + show_power_of_ten(@unit_number,marker[2*i+2],marker[2*i+1],marker[2*i])\t\r\n\tend\r\n\t@roman.reverse\r\nend", "title": "" }, { "docid": "032af11b4083ff5f4e38e91555505be3", "score": "0.57036036", "text": "def english_number num\n if num < 0\n return 'Please enter a positive number'\n end\n if num == 0\n return 'zero'\n end\n num_string = ''\nones_place = [' one', ' two', ' three',\n ' four',' five', ' six',\n ' seven', ' eight', ' nine']\ntens_place = [' ten', ' twenty', ' thirty',\n ' forty', ' fifty', ' sixty',\n ' seventy', ' eighty', ' ninety']\nteens = [' eleven',' twelve',' thirteen',\n ' fourteen', ' fifteen',' sixteen',\n ' seventeen', ' eighteen',' nineteen']\n\nleft = num\n\nwrite = left/ 1000000000000\nleft = left - write*1000000000000\n if write > 0\n trillions = english_number write\n num_string = num_string + trillions + ' trillion'\n if left > 0\n num_string = num_string + ''\n end\n end\n\nwrite = left/ 1000000000\nleft = left -write*1000000000\n if write > 0\n billions = english_number write\n num_string = num_string + billions + ' billion'\n if left > 0\n num_string = num_string + ''\n end\n end\n\nwrite = left/ 1000000\nleft = left -write*1000000\n if write > 0\n millions = english_number write\n num_string = num_string + millions + ' million'\n if left > 0\n num_string = num_string + ''\n end\n end\n\nwrite = left / 1000\nleft = left - write*1000\n if write > 0\n thousands = english_number write\n num_string = num_string + thousands + ' thousand'\n if left > 0\n num_string = num_string + ''\n end\n end\n\nwrite = left / 100\nleft = left - write*100\n if write > 0\n hundreds = english_number write\n num_string = num_string + hundreds + ' hundred'\n if left > 0\n num_string = num_string + ''\n end\n end\n\nwrite = left/10\nleft = left - write*10\n if write > 0\n if ((write== 1) and (left > 0))\n num_string = num_string + teen[left-1]\n left = 0\n else\n num_string = num_string + tens_place[write-1]\n end\n end\n\n write = left\n left = 0\n if write > 0\n num_string = num_string + ones_place[write-1]\n end\n\n return num_string\nend", "title": "" }, { "docid": "404855678b1ade7130fb6d72d49c13c2", "score": "0.570274", "text": "def persistence(num)\n return 0 if num.digits.length == 1\n multiplicative_persistence = 0\n until num.digits.length == 1\n num = num.digits.inject(:*)\n multiplicative_persistence += 1\n end\n multiplicative_persistence\nend", "title": "" }, { "docid": "88b796888427a8b68e21f82dde1ec440", "score": "0.568362", "text": "def num\r\n @num\r\n end", "title": "" }, { "docid": "f24f321cff69cfecd76aee290815e234", "score": "0.5673424", "text": "def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_up Math.sqrt(1020304050607080900).floor, 100\n while i < max\n p30 = (i+30) ** 2\n p70 = (i+70) ** 2\n\n if re === \"#{p30}\"\n return \"#{i+30}^2 = #{p30}\"\n elsif re === \"#{p70}\"\n return \"#{i+70}^2 = #{p70}\"\n end\n\n i += 100\n end\nend", "title": "" }, { "docid": "c3a20e49e62587fa54cd5b789d1ae5e9", "score": "0.56669027", "text": "def num_to_eng(int)\n ones_place = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tens_place = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n teens = ['ten', 'eleven', 'twelve', 'thirteen','fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n \n array = int.to_s.split('').map {|x| x.to_i}\n\n if array.length == 1\n p ones_place[int]\n elsif array.length == 2 && array[0] == 1 && array[1] == 0\n p tens_place[1]\n elsif array.length == 2 && array[0] == 1\n p teens[array[1]]\n elsif array.length == 2 && array[0] > 1\n p tens_place[array[0]] + \" \" + ones_place[array[1]]\n elsif array.length == 3 && array[1] == 1\n p ones_place[array[0]] + \" hundred \" + teens[array[2]]\n elsif array.length == 3 && array[1] == 0\n p ones_place[array[0]] + \" hundred \" + ones_place[array[2]]\n elsif array.length == 3 && array[1] > 1\n p ones_place[array[0]] + \" hundred \" + tens_place[array[1]] + \" \" + ones_place[array[2]]\n end\nend", "title": "" }, { "docid": "5a91602b2c2d363764fb86d40280134b", "score": "0.56545943", "text": "def refined_super_digit(n, k)\n refined = \"\"\n\n k.times do \n refined += n.to_s \n end \n refined = refined.to_i\n\n super_digit(refined)\n\nend", "title": "" }, { "docid": "e401a0891e8f3ba4745500bd3b55e994", "score": "0.565122", "text": "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "title": "" }, { "docid": "7a0faed1b008d734a34e9bd6fb81973c", "score": "0.5648009", "text": "def number_s\n return @number_s\n end", "title": "" }, { "docid": "f5830fffbe5d3dc346f0bff6c3008ee7", "score": "0.5647797", "text": "def english_number(number)\n\n # handle edge cases\n return \"Please enter a number that isn't negative.\" if number < 0 \n return 'zero' if number == 0\n\n num_string = ''\n\n ones_place = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tens_place = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n teens = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\n\n left = number\n write = left/1000\n left = left - write*1000\n\n if write > 0 \n thousands = english_number write\n num_string = num_string + thousands + ' thousand'\n if left > 0 \n num_string = num_string + ' and '\n else\n return num_string\n end\n end\n\n #left = number\n write = left/100 # reminder: integer division\n left = left - write*100\n\n if write > 0\n hundreds = english_number write\n num_string = num_string + hundreds + ' hundred'\n if left > 0 \n num_string = num_string + ' and '\n end\n end\n\n write = left/10\n left = left - write*10\n\n if write > 0 \n if ((write == 1) and (left > 0))\n num_string = num_string + teens[left-1]\n left = 0\n else\n num_string = num_string + tens_place[write-1]\n end\n\n if left > 0\n num_string = num_string + '-'\n end\n\n end\n\n write = left\n left = 0\n\n if write > 0 \n num_string = num_string + ones_place[write-1]\n end\n\n num_string\nend", "title": "" }, { "docid": "cc4075893c4b8d356b33c7b933150b1f", "score": "0.56414014", "text": "def numerator() end", "title": "" }, { "docid": "f8c09b7c648b19c3532497a1f99de38f", "score": "0.56391644", "text": "def sci_not(number)\n return \"#{number}.00E0\" if number < 10\n answer = number.to_s\n counter = 0\n num_to_check = number\n \n while num_to_check > 10\n num_to_check /= 10.to_f\n counter += 1\n end\n \n get_last_num = ((number.to_f / (10**counter)).round(2).to_s)\n get_last_num[2].nil? ? (mid_num = 0) : (mid_num = get_last_num[2])\n get_last_num[3].nil? ? (last_num = 0) : (last_num = get_last_num[3]) \n \n return \"#{answer[0]}.#{mid_num}#{last_num}E#{counter}\"\n\nend", "title": "" }, { "docid": "d996063a1bda83fd8644c8cbac831e61", "score": "0.5637236", "text": "def rassoc(p0) end", "title": "" }, { "docid": "8ae3b0c5ee87f2c183aac94f776b4af2", "score": "0.5630779", "text": "def englishNumber number\n if number < 0 # No negative numbers.\n return \"Please enter a number that isn't negative.\"\n end\n if number == 0\n return \"zero\"\n end\n\n numString = \"\"\n\n onesPlace = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"]\n tensPlace = [\"ten\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\n teenagers = [\"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\"]\n\n left = number\n\n write = left/1000 \n left = left - write*1000 \n\n if write > 0\n thousands = englishNumber write\n numString = numString + thousands + \" thousand\"\n\n if left > 0\n numString = numString + \" \"\n end\n end\n\n write = left/100 \n left = left - write*100 \n\n if write > 0\n hundreds = englishNumber write\n numString = numString + hundreds + \" hundred\"\n\n if left > 0\n numString = numString + \" \"\n end\n end\n\n write = left/10 \n left = left - write * 10 \n\n if write > 0\n if ((write == 1) and (left > 0))\n numString = numString + teenagers[left - 1] \n left = 0\n else\n numString = numString + tensPlace[write - 1] \n end\n\n if left > 0 \n numString = numString + \"-\"\n end\n end\n\n write = left\n left = 0\n\n if write > 0\n numString = numString + onesPlace[write - 1]\n end\n\n numString\nend", "title": "" }, { "docid": "3fd9f41349199e73ede10fc0ea3ae23e", "score": "0.56276", "text": "def french_insee_number; end", "title": "" }, { "docid": "692b29ed9d63948394b099ec163cb420", "score": "0.562164", "text": "def numbers_mand(n1,n2,n3)\n\t\t@num1 = n1\n\t\t@num2 = n2\n\t\t@num3 = n3\n\tend", "title": "" }, { "docid": "c52ae31d2d16eb2dd846669804370d56", "score": "0.561822", "text": "def numbers(n)\n\nend", "title": "" }, { "docid": "c728b44b498033a914e41142cb73e76c", "score": "0.561713", "text": "def reference_it(value)\n reference_number = value[0,2].to_s.downcase\n reference_number += value.reverse[0,1].to_s.downcase\n reference_number += random_numeric(6)\n return reference_number\n end", "title": "" }, { "docid": "13d5128ea160bc5f21e527ac758be79a", "score": "0.5616793", "text": "def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend", "title": "" }, { "docid": "85fe95eb53fddc34f34257b5ce119dd3", "score": "0.5611486", "text": "def convert_q_to_phred33(q_value)\r\n return (q_value.round() + 33).chr\r\nend", "title": "" }, { "docid": "7163c2265156e2072993d697ab248310", "score": "0.56092364", "text": "def number_joy(n)\na = n.to_s.chars.map(&:to_i).reduce(:+)\nb = a.to_s.reverse.to_i\n(a * b) == n\nend", "title": "" }, { "docid": "0bbde13569373b7a066be93d27b6b6c3", "score": "0.5603573", "text": "def fancy_number(num)\n \"$\" + num.to_s.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n end", "title": "" }, { "docid": "0b534733798465481fff5a4c7660c335", "score": "0.55965376", "text": "def decimal_mark; end", "title": "" }, { "docid": "fd0c1b5135cc528b9c8964e716ceada3", "score": "0.55937356", "text": "def dv\n split_reversed_rut = @last_rut.to_s.reverse.chars\n seq = [2, 3, 4, 5, 6, 7]\n i = 0\n digit_sum = split_reversed_rut.reduce(0) do |sum, n|\n partial_result = sum.to_i + (n.to_i * seq[i])\n i = i == 5 ? 0 : i + 1\n partial_result\n end\n partial_check_digit = 11 - (digit_sum % 11)\n case partial_check_digit\n when 11\n '0'\n when 10\n 'k'\n else\n partial_check_digit.to_s\n end\n end", "title": "" }, { "docid": "1cb212a04992664fdcd4aaf3209482d8", "score": "0.5587427", "text": "def sol\n '341'\n end", "title": "" }, { "docid": "a078340bef1eb724e8fc454688fd1bf0", "score": "0.5581808", "text": "def number=(_arg0); end", "title": "" }, { "docid": "b3b3564c958f10ba0add0e70c23a7a20", "score": "0.55720717", "text": "def right_numbers\n numbers_with_checksum[7,6]\n end", "title": "" }, { "docid": "a42c5b2512f58d4dbbb8d97c41cc6379", "score": "0.5568418", "text": "def sci_not(num)\n\n return \"#{num}.00E0\" if num < 10\n\n num_str = num.to_s\n power = num_str.length - 1 #Calculates the exponential\n\n digi_float = num / (10**power).to_f\n two_deci = digi_float.round(2).to_s #Rounds of the number to 2 decimal\n\n two_deci[2].nil? ? tenth_place = 0 : tenth_place = two_deci[2]\n two_deci[3].nil? ? unit_place = 0 : unit_place = two_deci[3]\n\n\n puts \"#{num_str[0]}.#{tenth_place}#{unit_place}E#{power.to_s}\" #Final desired output\n\nend", "title": "" }, { "docid": "ac86f3532e7c3f4fb4768668c3096351", "score": "0.5567019", "text": "def tenders_adv(start, num)\n\nend", "title": "" }, { "docid": "42d2ad2800d0e0964655ceb5b6f36c04", "score": "0.55659777", "text": "def conversion(number)\n words_hash = {0=>\"zero\",1=>\"one\",2=>\"two\",3=>\"three\",4=>\"four\",5=>\"five\",6=>\"six\",7=>\"seven\",8=>\"eight\",9=>\"nine\",\n 10=>\"ten\",11=>\"eleven\",12=>\"twelve\",13=>\"thirteen\",14=>\"fourteen\",15=>\"fifteen\",16=>\"sixteen\",\n 17=>\"seventeen\", 18=>\"eighteen\",19=>\"nineteen\",\n 20=>\"twenty\",30=>\"thirty\",40=>\"forty\",50=>\"fifty\",60=>\"sixty\",70=>\"seventy\",80=>\"eighty\",90=>\"ninety\"}\n if words_hash.has_key?number\n return words_hash[number] \n else\n num_string = number.to_s.split(//)\n while num_string.size > 0 \n if num_string.size == 2\n return(\"and\")\n return words_hash[(num_string.join.to_i) - (num_string.join.to_i)%10] \n num_string.shift\n end\n if num_string.size > 4\n return(words_hash[(num_string[0,2].join.to_i) - (num_string[0,2].join.to_i) % 10])\n else\n return(words_hash[num_string[0].to_i]) \n end\n return(scale[num_string.size])\n num_string.shift\n end\n end\n\nend", "title": "" }, { "docid": "86a881943349783282dd10e9bde4272e", "score": "0.55610865", "text": "def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend", "title": "" }, { "docid": "e6ead767c0c7effbc645dcbcadb3b2a3", "score": "0.55579424", "text": "def complete_number\n \"#{self.pre_value} #{self.value} #{self.post_value}\".squeeze(\" \").strip\n end", "title": "" }, { "docid": "76f3e4f70243fbcae14237c5e9045514", "score": "0.5557412", "text": "def featured(integer)\n return \"There is no possible number that fulfills those requirements\" if \n integer >= 9_876_543_210\n integer += 1\n until integer % 7 == 0 && integer.odd? && integer.digits.uniq! == nil\n integer += 1\n end\n integer\nend", "title": "" }, { "docid": "264cacd22ec67ef709fab7ac35bc522c", "score": "0.5557198", "text": "def p15\n\t\nend", "title": "" }, { "docid": "14d67784267f2aa9f0c013f7f1dcd293", "score": "0.55562365", "text": "def hidden_digits(num)\r\n\t\t\tarray = num.match(/(\\d{3})-(\\d{3})-(\\d{3})/).captures\r\n\t\t\tarray2= array.join()\r\n\t\t\tarray2.gsub(/.(?=.{4})/,'*')\r\n\t\tend", "title": "" }, { "docid": "396849ac62c27bf001860a190eb18911", "score": "0.5554413", "text": "def getSet(n)\n\t((n%8).to_s(2).rjust(3,\"0\"))\nend", "title": "" }, { "docid": "01761d231f57a654fc2fdecf1c29eca8", "score": "0.5552531", "text": "def to_english(number)\nsingle_digits = {\n 0 => \"zero\",\n 1 => \"one\",\n 2 => \"two\",\n 3 => \"three\",\n 4 => \"four\",\n 5 => \"five\",\n 6 => \"six\",\n 7 => \"seven\",\n 8 => \"eight\",\n 9 => \"nine\"\n }\n teens = {\n \"zero\" => \"ten\",\n \"one\" => \"eleven\",\n \"two\" => \"twelve\",\n \"three\" => \"thirteen\",\n \"four\" => \"fourteen\",\n \"five\" => \"fifteen\",\n \"six\" => \"sixteen\",\n \"seven\" => \"seventeen\",\n \"eight\" => \"eighteen\",\n \"nine\" => \"nineteen\"\n }\n tens = {\n 0 => \"zero\",\n 2 => \"twenty\",\n 3 => \"thirty\",\n 4 => \"forty\",\n 5 => \"fifty\",\n 6 => \"sixty\",\n 7 => \"seventy\",\n 8 => \"eighty\",\n 9 => \"ninety\"\n }\n\nif number.to_i == 0\n puts \"zero\"\nelse\n\neach_number = number.to_s.split(\"\").reverse\n\neach_number.each_with_index do |n, i|\n if i == 0 || i == 2 || i == 3 || i == 5 || i == 6 || i == 8 || i == 9\n each_number[i].replace(single_digits.fetch(each_number[i].to_i))\n elsif i == 1 && n != \"1\"\n each_number[i].replace(tens.fetch(each_number[i].to_i))\n elsif i == 1 && n == \"1\"\n each_number[i - 1].replace(teens.fetch(each_number[i - 1]))\n each_number[i].replace(\"zero\")\n elsif i == 4 && n != \"1\"\n each_number[i].replace(tens.fetch(each_number[i].to_i))\n elsif i == 4 && n == \"1\"\n each_number[i - 1].replace(teens.fetch(each_number[i - 1]))\n each_number[i].replace(\"zero\")\n elsif i == 7 && n != \"1\"\n each_number[i].replace(tens.fetch(each_number[i].to_i))\n elsif i == 7 && n == \"1\"\n each_number[i - 1].replace(teens.fetch(each_number[i - 1]))\n each_number[i].replace(\"zero\")\n end\nend\n\neach_number.each_with_index do |n, i|\n if i == 2\n each_number[i] = n + \" hundred\"\n elsif i == 3\n each_number[i] = n + \" thousand\"\n elsif i == 4 && each_number[i - 1].match?(/zero/)\n each_number[i] = n + \" thousand\"\n elsif i == 5 \n if each_number[i - 1].match?(/zero/) && each_number[i - 2].match?(/zero/)\n each_number[i] = n + \" hundred thousand\"\n else \n each_number[i] = n + \" hundred\"\n end\n elsif i == 6\n each_number[i] = n + \" million\"\n elsif i == 7 && each_number[i - 1].match?(/zero/)\n each_number[i] = n + \" million\"\n elsif i == 8\n if each_number[i - 1].match?(/zero/) && each_number[i - 2].match?(/zero/)\n each_number[i] = n + \" hundred million\"\n else \n each_number[i] = n + \" hundred\"\n end\n elsif i == 9\n each_number[i] = n + \" billion\"\n end\nend\n\ni = 0\nuntil i == each_number.length\n if each_number[i].match?(/zero/)\n each_number.delete_at(i)\n else\n i += 1\n end\nend\n\nputs each_number.reverse.join(\" \")\n\nend\n\nend", "title": "" }, { "docid": "663239a98c4410b599c7c9e946ccf239", "score": "0.5547864", "text": "def expanded_form(num)\n number = num.to_s # This will be \"12\"\n num_digits = num.to_s.length\n split_number = number.split(\"\").reverse # This will be [\"2\",\"1\"]\n expanded_array = []\n 0.upto(num_digits-1) do |n| # This will be 0 up to 1\n single_split_number = split_number[n].to_i*(10**n)\n next if single_split_number == 0\n expanded_array << single_split_number.to_s\n end\n expanded_array.reverse! # This will be [\"10\",\"2\"]\n output_array = expanded_array.join(\" + \") # Final statement\nend", "title": "" }, { "docid": "885dc993cb9a7575e75c9396e9440ffa", "score": "0.5546994", "text": "def n2e(num)\n\n return '' if num.kind_of?(String) and (num =~ /^[0]+$/)\n return '' if num.kind_of?(String) and (num !~ /^\\d+$/)\n \n num = num.to_i if num.kind_of?(String)\n n = num.to_s.split(//)\n len = n.size\n \n # To create constance inside a function, we need to use instance\n # variables. Ruby 1.9 is very picky about this subject!\n\n @Hundred = 'hundred'\n @Thousand= 'thousand'\n @Million = 'million'\n @Billion = 'billion'\n\n h = { :ones => %w(zero one two three four five six seven\n eight nine ten eleven twelve thirteen\n fourteen fifteen sixtee seventeen eigthteen\n nineteen),\n :twos => %w(nil ten twenty thirty forty fifty sixty \n seventy eighty ninety)\n }\n\n if num < 20\n str = h[:ones][num] \n elsif len == 2\n str = (n[0] > \"1\") ? h[:twos][n[0].to_i] : h['tens'][n[0].to_i-1] \n str += (n[1] > \"0\" ) ? (' ' + h[:ones][n[1].to_i]) : ''\n elsif len == 3\n str = n2e(n[0])+' '+@Hundred+' '+ n2e(n[1]+n[2])\n elsif len == 4\n str = n2e(n[0])+' '+@Thousand+' '+ n2e(n[1]+n[2]+n[3])\n elsif len == 5 \n str = n2e(n[0]+n[1])+' '+ @Thousand +' '\n str += n2e(n[2]+n[3]+n[4])\n elsif len == 6 \n str = n2e(n[0]+n[1]+n[2])+' '+ @Thousand +' '\n str += n2e(n[3]+n[4]+n[5])\n elsif len == 7 \n str = h[:ones][n[0].to_i]+' '+@Million+' '\n str += n2e(n[1]+n[2]+n[3]+n[4]+n[5]+n[6])\n elsif len == 8 \n str = n2e(n[0]+n[1])+' '+ @Million + ' '\n str += n2e(n[2]+n[3]+n[4]+n[5]+n[6]+n[7])\n elsif len == 9 \n str = n2e(n[0]+n[1]+n[2])+' '+ @Million + ' '\n str += n2e(n[3]+n[4]+n[5]+n[6]+n[7]+n[8])\n elsif len == 10 \n str = h[:ones][n[0].to_i]+' '+@Billion+' '\n str += n2e(n[1]+n[2]+n[3]+n[4]+n[5]+n[6]+n[7]+n[8]+n[9])\n elsif len == 11 \n str = n2e(n[0]+n[1])+' '+@Billion+' '\n str += n2e(n[2]+n[3]+n[4]+n[5]+n[6]+n[7]+n[8]+n[9]+n[10])\n elsif len == 12 \n str = n2e(n[0]+n[1]+n[2])+' '+@Billion+' '\n str += n2e(n[3]+n[4]+n[5]+n[6]+n[7]+n[8]+n[9]+n[10]+n[11])\n else\n abort(\"Number Overflow\\n\")\n end\n return str\nend", "title": "" }, { "docid": "88ba0caf44689a0805f0dca16999014e", "score": "0.55449396", "text": "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "title": "" }, { "docid": "48461539c66fbe65ce94d79946aacc0d", "score": "0.5540936", "text": "def to_num(fxn)\n if (@verbose)\n puts(\"#{fxn}\")\n end\n fxn.length.times do |index|\n term = fxn[index].split('+')\n term.length.times do |index|\n if (term[index].include?('~'))\n term[index] = '1'\n else\n term[index] = '0'\n end # if else\n end # each do \n fxn[index] = term.join('').to_i(2)\n end # times do\n if (@verbose)\n puts(\"MAXTERMS: #{fxn}\")\n end\n return fxn\n end", "title": "" }, { "docid": "27d6ee355ce2e0ae1a8c66a47815a21b", "score": "0.5538084", "text": "def p13\n\tnumbers = [\n\t\t37107287533902102798797998220837590246510135740250,\n\t\t46376937677490009712648124896970078050417018260538,\n\t\t74324986199524741059474233309513058123726617309629,\n\t\t91942213363574161572522430563301811072406154908250,\n\t\t23067588207539346171171980310421047513778063246676,\n\t\t89261670696623633820136378418383684178734361726757,\n\t\t28112879812849979408065481931592621691275889832738,\n\t\t44274228917432520321923589422876796487670272189318,\n\t\t47451445736001306439091167216856844588711603153276,\n\t\t70386486105843025439939619828917593665686757934951,\n\t\t62176457141856560629502157223196586755079324193331,\n\t\t64906352462741904929101432445813822663347944758178,\n\t\t92575867718337217661963751590579239728245598838407,\n\t\t58203565325359399008402633568948830189458628227828,\n\t\t80181199384826282014278194139940567587151170094390,\n\t\t35398664372827112653829987240784473053190104293586,\n\t\t86515506006295864861532075273371959191420517255829,\n\t\t71693888707715466499115593487603532921714970056938,\n\t\t54370070576826684624621495650076471787294438377604,\n\t\t53282654108756828443191190634694037855217779295145,\n\t\t36123272525000296071075082563815656710885258350721,\n\t\t45876576172410976447339110607218265236877223636045,\n\t\t17423706905851860660448207621209813287860733969412,\n\t\t81142660418086830619328460811191061556940512689692,\n\t\t51934325451728388641918047049293215058642563049483,\n\t\t62467221648435076201727918039944693004732956340691,\n\t\t15732444386908125794514089057706229429197107928209,\n\t\t55037687525678773091862540744969844508330393682126,\n\t\t18336384825330154686196124348767681297534375946515,\n\t\t80386287592878490201521685554828717201219257766954,\n\t\t78182833757993103614740356856449095527097864797581,\n\t\t16726320100436897842553539920931837441497806860984,\n\t\t48403098129077791799088218795327364475675590848030,\n\t\t87086987551392711854517078544161852424320693150332,\n\t\t59959406895756536782107074926966537676326235447210,\n\t\t69793950679652694742597709739166693763042633987085,\n\t\t41052684708299085211399427365734116182760315001271,\n\t\t65378607361501080857009149939512557028198746004375,\n\t\t35829035317434717326932123578154982629742552737307,\n\t\t94953759765105305946966067683156574377167401875275,\n\t\t88902802571733229619176668713819931811048770190271,\n\t\t25267680276078003013678680992525463401061632866526,\n\t\t36270218540497705585629946580636237993140746255962,\n\t\t24074486908231174977792365466257246923322810917141,\n\t\t91430288197103288597806669760892938638285025333403,\n\t\t34413065578016127815921815005561868836468420090470,\n\t\t23053081172816430487623791969842487255036638784583,\n\t\t11487696932154902810424020138335124462181441773470,\n\t\t63783299490636259666498587618221225225512486764533,\n\t\t67720186971698544312419572409913959008952310058822,\n\t\t95548255300263520781532296796249481641953868218774,\n\t\t76085327132285723110424803456124867697064507995236,\n\t\t37774242535411291684276865538926205024910326572967,\n\t\t23701913275725675285653248258265463092207058596522,\n\t\t29798860272258331913126375147341994889534765745501,\n\t\t18495701454879288984856827726077713721403798879715,\n\t\t38298203783031473527721580348144513491373226651381,\n\t\t34829543829199918180278916522431027392251122869539,\n\t\t40957953066405232632538044100059654939159879593635,\n\t\t29746152185502371307642255121183693803580388584903,\n\t\t41698116222072977186158236678424689157993532961922,\n\t\t62467957194401269043877107275048102390895523597457,\n\t\t23189706772547915061505504953922979530901129967519,\n\t\t86188088225875314529584099251203829009407770775672,\n\t\t11306739708304724483816533873502340845647058077308,\n\t\t82959174767140363198008187129011875491310547126581,\n\t\t97623331044818386269515456334926366572897563400500,\n\t\t42846280183517070527831839425882145521227251250327,\n\t\t55121603546981200581762165212827652751691296897789,\n\t\t32238195734329339946437501907836945765883352399886,\n\t\t75506164965184775180738168837861091527357929701337,\n\t\t62177842752192623401942399639168044983993173312731,\n\t\t32924185707147349566916674687634660915035914677504,\n\t\t99518671430235219628894890102423325116913619626622,\n\t\t73267460800591547471830798392868535206946944540724,\n\t\t76841822524674417161514036427982273348055556214818,\n\t\t97142617910342598647204516893989422179826088076852,\n\t\t87783646182799346313767754307809363333018982642090,\n\t\t10848802521674670883215120185883543223812876952786,\n\t\t71329612474782464538636993009049310363619763878039,\n\t\t62184073572399794223406235393808339651327408011116,\n\t\t66627891981488087797941876876144230030984490851411,\n\t\t60661826293682836764744779239180335110989069790714,\n\t\t85786944089552990653640447425576083659976645795096,\n\t\t66024396409905389607120198219976047599490197230297,\n\t\t64913982680032973156037120041377903785566085089252,\n\t\t16730939319872750275468906903707539413042652315011,\n\t\t94809377245048795150954100921645863754710598436791,\n\t\t78639167021187492431995700641917969777599028300699,\n\t\t15368713711936614952811305876380278410754449733078,\n\t\t40789923115535562561142322423255033685442488917353,\n\t\t44889911501440648020369068063960672322193204149535,\n\t\t41503128880339536053299340368006977710650566631954,\n\t\t81234880673210146739058568557934581403627822703280,\n\t\t82616570773948327592232845941706525094512325230608,\n\t\t22918802058777319719839450180888072429661980811197,\n\t\t77158542502016545090413245809786882778948721859617,\n\t\t72107838435069186155435662884062257473692284509516,\n\t\t20849603980134001723930671666823555245252804609722,\n\t\t53503534226472524250874054075591789781264330331690,\n\t]\n\n\tsum = numbers.reduce(:+)\n\tsum.to_s[0..9].to_i\nend", "title": "" }, { "docid": "95ce7359096e5dfea1d715f052a66275", "score": "0.55376565", "text": "def o_gen_rating(numbers, idx)\n return numbers.first if numbers.size == 1\n\n zeroes = []\n ones = []\n numbers.each { |num| num[idx] == \"0\" ? zeroes.push(num) : ones.push(num) }\n next_nums = zeroes.size <= ones.size ? numbers - zeroes : numbers - ones\n o_gen_rating(next_nums, idx + 1)\nend", "title": "" }, { "docid": "22f07c87da40f0ce0414790ee5ab8f5f", "score": "0.5534118", "text": "def test_16\n MiniUniverse.each do |e|\n assert_equal(\"~d\".format(e), \"~A\".format(e)) unless e.respond_to? :to_int\n end\n end", "title": "" }, { "docid": "748618f9428f2fe7dee101e03e484657", "score": "0.5530311", "text": "def set_last_digits\n end", "title": "" }, { "docid": "8ceedd06682773c9d5eef645fa00a1bf", "score": "0.55281246", "text": "def numid=(_); end", "title": "" }, { "docid": "7c0207d48b9cb7f896199d681229e47d", "score": "0.55265427", "text": "def shownumber_hash\n\t\tmult = @no1 * @no2 * @no3\n\t\tputs \"With hash #{@no1} * #{@no2} * #{@no3} = #{mult}\"\n\tend", "title": "" }, { "docid": "4b0409a34d1a443d4d0b075b0ec438cb", "score": "0.55252457", "text": "def featured(number)\n loop do\n number +=1\n characters = number.to_s.split('')\n if (number.odd?) && (number % 7 == 0) && (characters.uniq == characters) \n p number\n break\n end \n end \nend", "title": "" }, { "docid": "fae22022d6cb2fc6bf77931786b0a8ba", "score": "0.5523044", "text": "def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end", "title": "" }, { "docid": "7580ee4b3bb65a573c0e6df70314d45a", "score": "0.5521444", "text": "def ordv\n large = Array.new([0,0,0,0,0,0,0,0,0,1])\n (1..7830457).each do |n|# digit represents ,2^n\n passover = 0\n 9.downto(0).each do |i|\n large[i] *= 2\n large[i] += passover\n if large[i] >= 10\n large[i] %= 10\n passover = 1\n else\n passover = 0\n end\n end\n end\n (28433 * large.join.to_i + 1)%100000000000\nend", "title": "" }, { "docid": "b19ae96e237c930cbd2c66ec4020b90b", "score": "0.5519935", "text": "def numid; end", "title": "" }, { "docid": "925cd48e76191a40571f99a9273abc55", "score": "0.55104", "text": "def num\n @num\n end", "title": "" }, { "docid": "dc166e7169de94882ffdb390be86403b", "score": "0.5508584", "text": "def english_number original_number\r\n current_number = original_number\r\n exploded_number = []\r\n # Convert number into an array of multiples of base units\r\n CONVERSIONS.each do |base_pair|\r\n if current_number >= base_pair[:number] * 2\r\n # Enter the multiple and the base unit as elements if necessary\r\n exploded_number << current_number / base_pair[:number]\r\n exploded_number << base_pair\r\n current_number %= base_pair[:number]\r\n elsif current_number >= base_pair[:number]\r\n # Enter just the base unit if there's no integer multiple\r\n exploded_number << base_pair\r\n current_number %= base_pair[:number]\r\n end\r\n # Otherwise enter nothing\r\n end\r\n # Eg array [{1000000}, 507, {1000}, 5, 100, 30, 7]\r\n # Reduce array to an English translation\r\n english_result = exploded_number.reduce([\"\",:start]) { |text_string, base_pair|\r\n # Add a space unless it's the start of the string\r\n text_string[0] += ' ' unless text_string[1] == :start\r\n # Convert current number to English if it's a multiple\r\n if base_pair.class == Integer\r\n text_string[0] += english_number(base_pair)\r\n text_string[1] = :multiple\r\n elsif base_pair[:number] >= ONE_PREFIX_BOUNDARY\r\n # Otherwise, if it's >= 100 and preceding unit is not a multiple add 'one'\r\n text_string[0] += 'one ' unless text_string[1] == :multiple\r\n text_string[0] += base_pair[:name]\r\n text_string[1] = :above_boundary\r\n else\r\n # Otherwise, if it's <100 and transitioning from >=100, add 'and'\r\n text_string[0] += 'and ' if text_string[1] == :above_boundary\r\n text_string[0] += base_pair[:name]\r\n text_string[1] = :below_boundary\r\n end\r\n text_string\r\n }[0]\r\n return english_result\r\nend", "title": "" }, { "docid": "785bf76dd5d080333d37066e05b4278f", "score": "0.5507681", "text": "def xform(value)\n value.to_i - 1 \n end", "title": "" }, { "docid": "01d08c899b45ed7ac05ce981a9bc865c", "score": "0.55012655", "text": "def refined_super_digit(n, k)\n \nend", "title": "" }, { "docid": "01d08c899b45ed7ac05ce981a9bc865c", "score": "0.55012655", "text": "def refined_super_digit(n, k)\n \nend", "title": "" }, { "docid": "622cde3d6758303fd77542191b63a235", "score": "0.5498139", "text": "def non_zero_digit; end", "title": "" }, { "docid": "c5192c56542f8816efa836f92602fe83", "score": "0.54966074", "text": "def dudeney_number?(numero)\r\n# hacemos paso por valor del argumento \r\ns = numero\t\r\n# convertimos integer a string para separar los digitos\r\nnewNumber = s.to_s\r\n# separamos los digitos del string\r\nnewNumber.split('')\r\n# tamanio del string \r\ntamanio = newNumber.length\r\n# si numero es iguala 1 se asigna a number\r\n\tif numero == 1\r\n\t\tnumber = 1\r\n# y si tamanio del argumento es de 3 cifras \t\t\r\n\telsif tamanio == 3\r\n# asignamos el valor por posicion\r\n\t\ta = newNumber[0]\r\n\t\tb = newNumber[1]\r\n\t\tc = newNumber[2]\r\n\t\t#convertimos de string a integer cada una de las asignaciones las sumamos y asi determinaremo el cubo perfecto\r\n\tnumber = a.to_i + b.to_i + c.to_i \r\n# si es de 4 cifras el argumento se hace lo mismo pero con 4 cifras \r\n\telsif tamanio == 4\r\n\t\ta = newNumber[0]\r\n\t\tb = newNumber[1]\r\n\t\tc = newNumber[2]\t\t\r\n\t\td = newNumber[3]\r\n\tnumber = a.to_i + b.to_i + c.to_i + d.to_i\r\n\tend\r\n# se eleva al cubo el numero base\r\n\tcubo =(number*number*number)\r\n# si cubo es igual valor del argumento regresa true diciendo que es un numero dudeney \r\n\tif cubo == numero\r\n\t\tr = true\r\n\telse\r\n\t\tr = false\r\n\tend\t\r\n# retorno\r\n\tr\r\nend", "title": "" }, { "docid": "ed353f94c7174dfa99514335c0add47a", "score": "0.54961544", "text": "def english_number number\n\tputs 'Number must be positive' if number < 0\n\tprint 'zero' if number == 0\n\n\tunits_in_english = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\ttens_in_english = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', '']\n\tmultiples = {10 ** 12 => 'trillion', 10 ** 9 => 'billion', 10 ** 6 => 'million', 10 ** 3 => 'thousand', 10 ** 2 => 'hundred'}\n\n\tnum_string = \"\"\n\t# number in English for all positive non-zero numbers\n\n\tleft = number\n\t# amount left to be translated\n\n\tmultiples.each do |key, value|\n\t\t# find out how many multiples:\n\t\twrite = left / key\n\t\t# finds out how much is left after substractiong multiples:\n\t\tleft = left - (write * key)\n\t\tif write >= 10\n\t\t\tnum_string = num_string + (num_string.empty? ? \"\" : \" \") + english_number(write) + ' ' + value\n\t\tend\n\t\tif write > 0 && write < 10\n\t\t\tnum_string = num_string + (num_string.empty? ? \"\" : \" \") + units_in_english[write] + ' ' + value\n\t\tend\n\tend\n\n\tif left >= 20\n\t\twrite = left / 10\n\t\t# finds out how many tens\n\t\tnum_string = num_string + (num_string.empty? ? \"\" : \" \") + tens_in_english[write]\n\t\tleft = left - write * 10\n\t\t# finds out how much is left after taking out the tens\n\t\tnum_string = num_string + '-' if left > 0 \n\t\t# appends '-' in case of 'trirty-four', for example\n\tend\n\n\tif left > 0\n\t\twrite = left\n\t\tnum_string = num_string + ((num_string.empty? or num_string.end_with?(\"-\")) ? \"\" : \" \") + units_in_english[write]\n\tend\n\n\tnum_string\nend", "title": "" }, { "docid": "abeca3c0c1bd6c65f77e8ee373d6851e", "score": "0.5494673", "text": "def return_number(a)\n ((a / 2)**2) * (65 - (a / 2))\nend", "title": "" }, { "docid": "3f0bca19b4fc57c59c0e1838a4f0909f", "score": "0.54912066", "text": "def refined_super_digit(n, k)\n \nend", "title": "" }, { "docid": "47e498267c2a11468cc692afe926cf96", "score": "0.54882026", "text": "def fact num\n if num == 0\n 1\n elsif num == 1\n 1\n elsif num == 2\n 2\n elsif num == 10\n 3628800\n end\nend", "title": "" } ]
90a4fce1025c3645c57167571829a300
Create a screenshot marker Create a new screenshot marker.
[ { "docid": "05ef5d5929eb65949e7fc2e715e3d6ad", "score": "0.7512807", "text": "def screenshot_marker_create(project_id, screenshot_id, screenshot_marker_create_parameters, opts = {})\n data, _status_code, _headers = screenshot_marker_create_with_http_info(project_id, screenshot_id, screenshot_marker_create_parameters, opts)\n data\n end", "title": "" } ]
[ { "docid": "051c91fcec182bf2b78904c8f40eb261", "score": "0.7853304", "text": "def screenshot_marker_create(project_id, screenshot_id, params)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers\", project_id, screenshot_id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::ScreenshotMarkerParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::ScreenshotMarkerParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"POST\", path, reqHelper.ctype, reqHelper.body, 201)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::ScreenshotMarker.new(JSON.load(rc.body)), err\n end", "title": "" }, { "docid": "cd921e8b3ade38f1bf976f1272a32bd1", "score": "0.6990059", "text": "def screenshot_marker_show(project_id, screenshot_id, id)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers/%s\", project_id, screenshot_id, id)\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::ScreenshotMarker.new(JSON.load(rc.body)), err\n end", "title": "" }, { "docid": "ab26f8079729303d685a387d7653839a", "score": "0.6880752", "text": "def place_specific_marker(x, y)\n image(@a, x, y, 10 * 5, 10 * 5)\n end", "title": "" }, { "docid": "d11dd83db7bd607efbfc9fa00fc67f96", "score": "0.6593365", "text": "def screenshot_marker_create_with_http_info(project_id, screenshot_id, screenshot_marker_create_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_create ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_create\"\n end\n # verify the required parameter 'screenshot_id' is set\n if @api_client.config.client_side_validation && screenshot_id.nil?\n fail ArgumentError, \"Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_create\"\n end\n # verify the required parameter 'screenshot_marker_create_parameters' is set\n if @api_client.config.client_side_validation && screenshot_marker_create_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'screenshot_marker_create_parameters' when calling ScreenshotMarkersApi.screenshot_marker_create\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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(screenshot_marker_create_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'ScreenshotMarker' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScreenshotMarkersApi#screenshot_marker_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "47aa558b90f6f23b0985feb5a7583faf", "score": "0.63205945", "text": "def screenshot_marker_show(project_id, screenshot_id, id, opts = {})\n data, _status_code, _headers = screenshot_marker_show_with_http_info(project_id, screenshot_id, id, opts)\n data\n end", "title": "" }, { "docid": "384c30002e8e9422816c6fe10b8479b2", "score": "0.61825114", "text": "def screenshot_marker_update(project_id, screenshot_id, params)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers\", project_id, screenshot_id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::ScreenshotMarkerParams)\n raise PhraseApp::ParamsHelpers::ParamsError.new(\"Expects params to be kind_of PhraseApp::RequestParams::ScreenshotMarkerParams\")\n end\n end\n \n data_hash = params.to_h\n err = params.validate\n if err != nil\n return nil, err\n end\n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"PATCH\", path, reqHelper.ctype, reqHelper.body, 200)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::ScreenshotMarker.new(JSON.load(rc.body)), err\n end", "title": "" }, { "docid": "4b64241559c88d5606745b36dda3d079", "score": "0.60864514", "text": "def create_draggable_marker(map)\n map.record_init('createDraggableMarker();')\n end", "title": "" }, { "docid": "c72f91ad6bd02f55b5e6dc3a6f3224e0", "score": "0.5979044", "text": "def create\r\n if @options.empty?\r\n creation = \"new GMarker(#{MappingObject.javascriptify_variable(@point)})\"\r\n else\r\n creation = \"new GMarker(#{MappingObject.javascriptify_variable(@point)},#{MappingObject.javascriptify_variable(@options)})\"\r\n end\r\n if @info_window && @info_window.is_a?(String)\r\n creation = \"addInfoWindowToMarker(#{creation},#{MappingObject.javascriptify_variable(@info_window)},#{MappingObject.javascriptify_variable(@info_window_options)})\"\r\n elsif @info_window_tabs && @info_window_tabs.is_a?(Hash)\r\n creation = \"addInfoWindowTabsToMarker(#{creation},#{MappingObject.javascriptify_variable(@info_window_tabs.to_a.collect{|kv| GInfoWindowTab.new(kv[0],kv[1] ) })},#{MappingObject.javascriptify_variable(@info_window_options)})\"\r\n elsif @info_window_tabs \r\n creation = \"addInfoWindowTabsToMarker(#{creation},#{MappingObject.javascriptify_variable(Array(@info_window_tabs))},#{MappingObject.javascriptify_variable(@info_window_options)})\"\r\n end\r\n if @address.nil?\r\n creation\r\n else\r\n \"addGeocodingToMarker(#{creation},#{MappingObject.javascriptify_variable(@address)})\"\r\n end\r\n end", "title": "" }, { "docid": "1f83af1a48d4ba6616ee4f2d0bad7bbe", "score": "0.5872052", "text": "def screenshot_marker_delete(project_id, screenshot_id)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers\", project_id, screenshot_id)\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"DELETE\", path, reqHelper.ctype, reqHelper.body, 204)\n if err != nil\n return nil, err\n end\n \n return err\n end", "title": "" }, { "docid": "c1b9d5ddb82ae97b49bd964eb6cbaf03", "score": "0.5850037", "text": "def marker(*args) # :nodoc:\n self << Marker.new(*args)\n end", "title": "" }, { "docid": "e23e209abdfb8477beb10ee51092d911", "score": "0.58370006", "text": "def gmaps4rails_marker_picture\n {\n \"picture\" => \"/images/marker.png\",\n \"width\" => 24,\n \"height\" => 24,\n \"marker_anchor\" => [24,24]\n }\n end", "title": "" }, { "docid": "08db7a091a8a150d3ac1841b7a020129", "score": "0.5773242", "text": "def screenshot_marker_show_with_http_info(project_id, screenshot_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_show ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_show\"\n end\n # verify the required parameter 'screenshot_id' is set\n if @api_client.config.client_side_validation && screenshot_id.nil?\n fail ArgumentError, \"Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_show\"\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 ScreenshotMarkersApi.screenshot_marker_show\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ScreenshotMarker' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: ScreenshotMarkersApi#screenshot_marker_show\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "7260d4c6cffa7743c8f69cd333969fc7", "score": "0.5696864", "text": "def create_marker_data\n if @restaurant.Latitude!=0\n @hash_restaurant_data = Gmaps4rails.build_markers(@restaurant) do |rest,marker|\n marker.lat rest.Latitude\n marker.lng rest.Longitude\n # marker.picture [url:\"where2eat_marker.png\",width:32,height:32]\n if rest.Link!=\"\"\n marker.infowindow \"<a href=#{url_with_protocol(rest.Link)}>#{rest.Name}</a><br>#{rest.Address}\"\n else\n marker.infowindow \"#{rest.Name}<br>#{rest.Address}\"\n end\n end\n else\n @hash_restaurant_data = nil\n end\n end", "title": "" }, { "docid": "50fa3eb8e069526ca1631bd576dac8a7", "score": "0.56466013", "text": "def create_thumbnail\n CreateThumbnail.call(input_file: screenshot_file_path, output_file: thumbnail_file_path)\n end", "title": "" }, { "docid": "732af949467b1c0713c274a7b2197663", "score": "0.56285113", "text": "def create\n @marker = Marker.new(params[:marker])\n\n respond_to do |format|\n if @marker.save\n format.html { redirect_to @marker, notice: 'Marker was successfully created.' }\n format.json { render json: @marker, status: :created, location: @marker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "732af949467b1c0713c274a7b2197663", "score": "0.56285113", "text": "def create\n @marker = Marker.new(params[:marker])\n\n respond_to do |format|\n if @marker.save\n format.html { redirect_to @marker, notice: 'Marker was successfully created.' }\n format.json { render json: @marker, status: :created, location: @marker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb33235bea444e462eef1351e405c72e", "score": "0.5607811", "text": "def create_new_mark!\n tag = @mark.start_tag\n @mark = tag + CommandFormatter.new(@mark.without_tags).format + \n SnipFu::Config[:end_tag]\n end", "title": "" }, { "docid": "1bdb2ace6f9abd51903c9163491c8bbe", "score": "0.55881274", "text": "def mark( marker )\n # do nothing\n end", "title": "" }, { "docid": "57e24a9ebd8b7f582f656bf5b162c075", "score": "0.55706275", "text": "def make_screenshot_here\n data_time = Time.now.strftime('%d-%m-%Y_%H:%M')\n puts \"Saving screenshot #{data_time}.png ...\"\n page.save_screenshot('tmp/screens/' + data_time + '.png')\n end", "title": "" }, { "docid": "34de46db2cb5416ada916069d45d9722", "score": "0.5555379", "text": "def add_single_map_marker(map,entry)\n \n icon_name=\"your_icon\"\n icon_name=\"other_icon\" if session[:user]==nil || (session[:user]!=nil && session[:user]!=entry.user)\n\n # special harccoded icon colors for neil's imported data\n # case entry.user.id\n # when 4: icon_name=\"ProMED\" \n # when 5: icon_name=\"whoEPR\"\n # when 6: icon_name=\"GBIF\"\n # when 10: icon_name=\"NCBI\" \n # end\n\n marker=GMarker.new([entry.lat.to_f,entry.lon.to_f],:icon=>icon_name.intern,:title => entry.organism.name, :info_window => info_window_marker(entry))\n map.overlay_init(marker)\n\n end", "title": "" }, { "docid": "c65322530b69efb466855161bbac7be9", "score": "0.5545545", "text": "def create\n @marker = Marker.new(marker_params)\n\n respond_to do |format|\n if @marker.save\n format.html { redirect_to @marker, notice: 'Marker was successfully created.' }\n format.json { render :show, status: :created, location: @marker }\n else\n format.html { render :new }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6414e0df35b94ee1daa06433d106e888", "score": "0.55431944", "text": "def shape_marker(type, options={})\n raise \"Invalid shape marker type specified\" unless SHAPE_MARKERS.has_key?(type)\n shape_marker_str = \"#{SHAPE_MARKERS[type]},#{options[:color]},#{options[:data_set_index]},#{options[:data_point_index]},#{options[:pixel_size]}\"\n @markers << shape_marker_str\n end", "title": "" }, { "docid": "123acdf291b5b870c51b9ea590aab550", "score": "0.5541685", "text": "def set_shot\n end", "title": "" }, { "docid": "f355525550a2789f1d70f32dd5e61517", "score": "0.5529244", "text": "def create\n @marker = @tour.markers.build(marker_params)\n @marker.user_id = current_user.id\n if @marker.save\n redirect_to(tour_path(@tour), notice: 'Marker was successfully created.')\n else\n redirect_to(tour_path(@tour), alert: 'Error occured in creating marker. Name and address cannot be blank.')\n end\n end", "title": "" }, { "docid": "893d6998ba2423ff67d6065e642c69b2", "score": "0.55228335", "text": "def create_screenshot\n material_path = material.file.file\n movie = ScreenshotService.new(material_path, 10).perform\n update_attribute(:screenshot, File.open(movie.path))\n end", "title": "" }, { "docid": "43c50790f8a82f2261ac4bd63de4d949", "score": "0.55007654", "text": "def create\n @marker = Marker.new(params[:marker])\n\n respond_to do |format|\n if @marker.save\n flash[:notice] = 'Marker was successfully created.'\n format.html { redirect_to(@marker) }\n format.xml { render :xml => @marker, :status => :created, :location => @marker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @marker.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d59157432fc2e8a6811ae520aa48380", "score": "0.5499521", "text": "def screenshot_create(url='', parameters={})\n\t\tparameters[:url] = url\n\t\treturn return_reply('screenshot/create', parameters)\n\tend", "title": "" }, { "docid": "e9fcb05f4181c5a96c3fe8db56803259", "score": "0.5492687", "text": "def create_screenshot(params = {})\n connection.post('screenshots', params)\n end", "title": "" }, { "docid": "dcca3ad072ee9b99f907da63c0bff977", "score": "0.54775405", "text": "def show_marker; end", "title": "" }, { "docid": "dcca3ad072ee9b99f907da63c0bff977", "score": "0.54775405", "text": "def show_marker; end", "title": "" }, { "docid": "7329ef78db09f7b18f8d67e498d06efd", "score": "0.54568624", "text": "def create_mark(result_id, markable_type, markable)\n Mark.create(\n result_id: result_id,\n mark: rand(1..5),\n markable_id: rand(1..5),\n markable_type: markable_type,\n markable: markable)\n end", "title": "" }, { "docid": "0485f27be48a8efb4df2401f9ae601f6", "score": "0.5455411", "text": "def screenshot_markers_list(project_id, id, page, per_page)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers\", project_id, id)\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request_paginated(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)\n if err != nil\n return nil, err\n end\n \n return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::ScreenshotMarker.new(item) }, err\n end", "title": "" }, { "docid": "119b759f12331f0470824a2f4b9adae4", "score": "0.543936", "text": "def create\n if current_user.nil?\n @marker = Marker.new(marker_params)\n @marker.user_id = 0\n else\n @marker = current_user.markers.build(marker_params)\n end\n\n respond_to do |format|\n if @marker.save\n format.html { redirect_to root_path, notice: 'Marker was successfully created.' }\n format.json { render :show, status: :created, location: @marker }\n else\n format.html { render :new }\n format.json { render json: @marker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a6dcd9c396bb65a4c3eaab09d8a9f76", "score": "0.54392874", "text": "def mark(x, y, marker)\t\n @board[x][y] = marker \n\tend", "title": "" }, { "docid": "41382afc854da5432e01953cffeb95e3", "score": "0.5419166", "text": "def create\n marker = Marker.create!(marker_params.merge(:user_id => current_or_guest_user.id))\n render :json => marker\n end", "title": "" }, { "docid": "2d38815fe5f8f35b8bce45affd27f27f", "score": "0.54100907", "text": "def create_markers\n @marker_zones = []\n @marker_zones_bitmap = RPG::Cache.interface('worldmap/zones')\n # Custom icons\n @marker_custom_icons = []\n # Roaming pokemon markers\n @marker_roaming_pokemons = []\n end", "title": "" }, { "docid": "5eb2993ab843d04299d05201a685a5fc", "score": "0.5363016", "text": "def add_marker(id,address,latitude,longitude)\n \"var marker_#{id} = new google.maps.Marker({position: new google.maps.LatLng(#{latitude}, #{longitude}), map: map, title: '#{address}'});\"\n end", "title": "" }, { "docid": "589ab5038cae77910cf49dc3e1e87afc", "score": "0.53554755", "text": "def add_pixel(phone_number:, coordinate:)\n pixels\n .create_with(coordinate: coordinate)\n .find_or_create_by phone_number: phone_number\n end", "title": "" }, { "docid": "366e8efb2d5df88bf42337eb1c48b90a", "score": "0.5354409", "text": "def create\n @screenshot = Screenshot.new(screenshot_params)\n @screenshot.screenshot_file_name = \"#{DateTime.now.strftime(\"%e-%b-%Y-%H-%M\")}.png\"\n respond_to do |format|\n if @screenshot.save\n format.html { head :ok }\n format.json {\n render json: {\n status: :created, screenshot: @screenshot\n }\n }\n else\n format.html { head :error }\n format.json { render json: @screenshot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec4ebbb63a08956fbc8fb6c6cbde6610", "score": "0.53525096", "text": "def generic_marker(waypoint)\n marker = MapMarker.new(waypoint)\n marker.color = \"yellow\"\n return marker\n end", "title": "" }, { "docid": "2b8472278e931edbc0f3e1661071ff05", "score": "0.52922344", "text": "def map_marker(draggable=false, zindex = 0, icon = _icon_class)\n prepare_marker(draggable, zindex, icon)\n end", "title": "" }, { "docid": "46eee4b8a72dd0689b9cbb795bfa6f4e", "score": "0.52898663", "text": "def create\n @time_marker = TimeMarker.new(params[:time_marker])\n\n respond_to do |format|\n if @time_marker.save\n format.html { redirect_to @time_marker, :notice => 'Time marker was successfully created.' }\n format.json { render :json => @time_marker, :status => :created, :location => @time_marker }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @time_marker.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c69a4a6f71da996a069bac2caacc88c0", "score": "0.52893466", "text": "def create_draggable_marker_for_edit(map, post)\n map.record_init(\"createDraggableMarkerForEdit(#{post.pos.y},#{post.pos.x});\")\n end", "title": "" }, { "docid": "9c5e2acfaf7cd18889829bbe12a2390b", "score": "0.5275023", "text": "def take_screenshot; end", "title": "" }, { "docid": "70a11a94a6d5508088a9359ce74be17e", "score": "0.52719116", "text": "def start_marker\n marker = generic_marker(@dep_airport)\n marker.label = \"D\"\n marker.color = \"red\"\n return marker\n end", "title": "" }, { "docid": "1fcd71cd45a2a13b30670f9683bf28bb", "score": "0.5268661", "text": "def screenshot_and_save_page; end", "title": "" }, { "docid": "86b4e356522bc111aa7c1156b7f73c66", "score": "0.52499753", "text": "def create\n @accessablemarker = Accessablemarker.new(accessablemarker_params)\n\n respond_to do |format|\n if @accessablemarker.save\n format.html { redirect_to @accessablemarker, notice: 'Accessablemarker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @accessablemarker }\n else\n format.html { render action: 'new' }\n format.json { render json: @accessablemarker.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4ee1f14b985e3b6f02c93f6bbd327ca", "score": "0.5248798", "text": "def create\n @marker = current_user.markers.new(marker_params)\n\n respond_to do |format|\n if @marker.save\n format.html { redirect_to dashboard_path, notice: 'Marker was successfully created.' }\n format.js { render :show, locals: { action: true, id: @marker.id, lat: @marker.lat, lng: @marker.lng, title: @marker.title, description: @marker.description } }\n else\n format.html { redirect_to dashboard_path, notice: 'Marker was not created.' }\n format.js { render :show, locals: { action: false } }\n end\n end\n end", "title": "" }, { "docid": "93e4819cb690f6c97661f8abef661a79", "score": "0.5225479", "text": "def draw_annotation(location=File.dirname(__FILE__) + \"/../examples/\")\n # canvas = Magick::Image.new(240, 300,\n # Magick::HatchFill.new('white','lightcyan2'))\n \n\t canvas = Magick::Image.new(300, 50) do\n self.background_color = 'none'\n end\n \n myannotation = Magick::Draw.new\n\t\tmyannotation.fill('black')\n myannotation.stroke('black')\n myannotation.font \"Courier-New-Regular\"\n myannotation.pointsize 24\n myannotation.gravity Magick::CenterGravity\n myannotation.text 0, 0, 'Hello'\n myannotation.draw(canvas)\n canvas.rotate!(45)\n canvas.write(location + 'annotation.gif')\n end", "title": "" }, { "docid": "356cf8367da9ed9a4a0adb4b5621bddc", "score": "0.52051723", "text": "def place_marker(location, marker)\n if @board[location] == \"_\"\n @board[location] = marker\n else\n return \"occupied\"; end\n end", "title": "" }, { "docid": "356cf8367da9ed9a4a0adb4b5621bddc", "score": "0.52051723", "text": "def place_marker(location, marker)\n if @board[location] == \"_\"\n @board[location] = marker\n else\n return \"occupied\"; end\n end", "title": "" }, { "docid": "0ca06e511c3ac5bfdc3712f91e00b16c", "score": "0.5200102", "text": "def screenshot_marker_delete_with_http_info(project_id, screenshot_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScreenshotMarkersApi.screenshot_marker_delete ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling ScreenshotMarkersApi.screenshot_marker_delete\"\n end\n # verify the required parameter 'screenshot_id' is set\n if @api_client.config.client_side_validation && screenshot_id.nil?\n fail ArgumentError, \"Missing the required parameter 'screenshot_id' when calling ScreenshotMarkersApi.screenshot_marker_delete\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/screenshots/{screenshot_id}/markers'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'screenshot_id' + '}', CGI.escape(screenshot_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScreenshotMarkersApi#screenshot_marker_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "title": "" }, { "docid": "ff7022909f79908903918c231b71aae5", "score": "0.5188562", "text": "def generate_screenshot\n img = IMGKit.new(self.url).to_jpg\n file = Tempfile.new([\"template_#{self.id}\", 'jpg'], 'tmp',\n :encoding => 'ascii-8bit')\n file.write(img)\n file.flush\n self.screenshot = file\n self.save\n file.unlink \n end", "title": "" }, { "docid": "5c27839feb081d1309f08a96cbba77cc", "score": "0.5181556", "text": "def store_markerformat(rgbFore, rgbBack, marker, grbit, icvFore, icvBack, miSize)# :nodoc:\n record = 0x1009 # Record identifier.\n length = 0x0014 # Number of bytes to follow.\n # rgbFore # Foreground RGB color.\n # rgbBack # Background RGB color.\n # marker # Type of marker.\n # grbit # Format flags.\n # icvFore # Color index marker border.\n # icvBack # Color index marker fill.\n # miSize # Size of line markers.\n\n header = [record, length].pack('vv')\n data = [rgbFore].pack('V')\n data += [rgbBack].pack('V')\n data += [marker].pack('v')\n data += [grbit].pack('v')\n data += [icvFore].pack('v')\n data += [icvBack].pack('v')\n data += [miSize].pack('V')\n\n append(header, data)\n end", "title": "" }, { "docid": "b9635dec5af39080bd7d6c50cad36136", "score": "0.5180297", "text": "def draw_icon(point, icon)\n x, y = point.pixel(@bounding_box)\n icon.draw(@canvas, x, y)\n end", "title": "" }, { "docid": "3a3cc8c80b3d3df97392cf0e56525030", "score": "0.51799726", "text": "def marker(num)\n square_code = current_position[self.class::BOARD_TRANS[num]]\n self.class::MARKERS[square_code]\n end", "title": "" }, { "docid": "c2cac040463648f69cd0161c7e0e59ed", "score": "0.5174452", "text": "def mark\n @marker = @pos\n end", "title": "" }, { "docid": "94f6797891c984609033523ef69f4a3b", "score": "0.51489687", "text": "def create\n @screenshot = Screenshot.new(params[:screenshot])\n\n respond_to do |format|\n if @screenshot.save\n format.html { redirect_to @screenshot, notice: 'Screenshot was successfully created.' }\n format.json { render json: @screenshot, status: :created, location: @screenshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @screenshot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62aded9fd4432b5b18057edde76c34f5", "score": "0.5148639", "text": "def map_poi (response, mark)\n Poi.new(response['id'], response['name'], response['snippet_text'], response['image_url'], mark)\n end", "title": "" }, { "docid": "04fcfcfeb8fd25bc3cd2debc3d65d08a", "score": "0.514397", "text": "def set_marker\n @marker = Marker.find(params[:id])\n end", "title": "" }, { "docid": "04fcfcfeb8fd25bc3cd2debc3d65d08a", "score": "0.514397", "text": "def set_marker\n @marker = Marker.find(params[:id])\n end", "title": "" }, { "docid": "04fcfcfeb8fd25bc3cd2debc3d65d08a", "score": "0.514397", "text": "def set_marker\n @marker = Marker.find(params[:id])\n end", "title": "" }, { "docid": "04fcfcfeb8fd25bc3cd2debc3d65d08a", "score": "0.514397", "text": "def set_marker\n @marker = Marker.find(params[:id])\n end", "title": "" }, { "docid": "df321cc2d5c117a226828a6046f50d0b", "score": "0.51392645", "text": "def create\n @screenshot = Screenshot.new(screenshot_params)\n\n respond_to do |format|\n if @screenshot.save\n format.html { redirect_to @screenshot, notice: 'Screenshot was successfully created.' }\n format.json { render :show, status: :created, location: @screenshot }\n else\n format.html { render :new }\n format.json { render json: @screenshot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bcb73a6c8f68bf2f28c9c03c09e5105c", "score": "0.51358974", "text": "def mark(info=nil)\n #puts \"Marking #{@pos} for #{info.inspect}\"\n @markstack.push(@pos)\n end", "title": "" }, { "docid": "4bd72a45a487268761c0c57bd66a7324", "score": "0.51126117", "text": "def show_picture(id, name, origin, coord_type, x, y, zoom_x, zoom_y, opacity, blend_type)\n add_command(231, [id, name, origin, coord_type, x, y, zoom_x, zoom_y, opacity, blend_type])\n end", "title": "" }, { "docid": "11dd20f424b4ff0a51ac3a9305ea51f0", "score": "0.5101645", "text": "def show\n @marker = @inspection_result.setup_marker\n end", "title": "" }, { "docid": "8e4cf0e4920fa240a31ba0b10e2b212a", "score": "0.510096", "text": "def mapshot\n @screen_local = false\n redraw\n export(TH::Map_Saver::Mapshot_Directory)\n $game_message.add(\"Mapshot taken\")\n end", "title": "" }, { "docid": "d9a35bb4319d8762be158372f3e8ff44", "score": "0.50976455", "text": "def screenshot_as(format); end", "title": "" }, { "docid": "2b7c392376f98b36dcc576e041852683", "score": "0.5096442", "text": "def mark_tile(player_mark, position)\n @field[position] = player_mark\n @all_moves << position\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5091903", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5089934", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "bea6a899a8601300091858ea44a3ba52", "score": "0.5089934", "text": "def set_Marker(value)\n set_input(\"Marker\", value)\n end", "title": "" }, { "docid": "d7d709d00acbd5e1091e15b6c5406541", "score": "0.50890666", "text": "def microsoft_map_drawing\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"MicrosoftMapDrawing\")), __method__, self)\n end", "title": "" }, { "docid": "be8a0ee75937c5968865deb70999eda8", "score": "0.5087968", "text": "def marker\r\n puts \"******\"*20\r\n end", "title": "" }, { "docid": "ad0ccc9c6cc1741e29ba0501add60caf", "score": "0.50821537", "text": "def capture_screen\n create_screenshot\n end", "title": "" }, { "docid": "f396e8e665d68a9aabb4cc26af9d605d", "score": "0.50772965", "text": "def screenshot png_save_path\n @driver.save_screenshot png_save_path\n end", "title": "" }, { "docid": "6d73a376d6714b507cd5054fab1fdc60", "score": "0.50750583", "text": "def mark\n @last_marker = @position\n end", "title": "" }, { "docid": "f878c7a1ad19d9606f158c95207070ad", "score": "0.5073103", "text": "def show_launched\n @launched = Startup.where(:launch_status => true) \n @markers = Gmaps4rails.build_markers(@launched) do |t, marker| \n marker.lat t.latitude\n marker.lng t.longitude \n marker.infowindow t.name \n marker.picture({ \n \"url\" => \"http://rideforclimate.com/nukes/all/images/blue.png\", \n \"width\" => 32, \n \"height\" => 32}) \n end\n render :template => 'maps/index'\n end", "title": "" }, { "docid": "8b5647f041b0f0af44340e6905ca0ce5", "score": "0.50705314", "text": "def take_snapshot(identifier)\r\n newArrayStart= @@test_case_fail_artifacts.length\r\n justFile =@@g_base_dir[(@@g_base_dir.rindex('/')+1)..@@g_base_dir.length]\r\n @driver.save_screenshot(\"#{@@artifact_dir}/#{identifier}_#{justFile}_#{newArrayStart}.png\")\r\n #shortArtifactDir = @@artifact_dir.gsub(\"\\\\\\\\hannover-re.grp\\\\shares\\\\hlrus_ex\\\\CDMI_Project\\\\Testing\\\\AutomationLogs\\\\\",\"\")\r\n\r\n shortArtifactDir = @@artifact_dir.downcase.gsub(\"c:/automation/logs/\",\"#{@@base_url[0..(@@base_url.length-2)]}:8001\\\\\")\r\n #shortArtifactDir = @@artifact_dir.gsub(\"c:/Automation/logs/\",\"#{@@base_url[0..(@@base_url.length-2)]}:8001\\\\\")\r\n\r\n @@test_case_fail_artifacts.push(\"#{shortArtifactDir}/#{identifier}_#{justFile}_#{newArrayStart}.png\")\r\n @util.logging(\"#{identifier} Saved a screenshot at #{@@artifact_dir}/#{identifier}_#{justFile}_#{newArrayStart}.png \")\r\n end", "title": "" }, { "docid": "3639d6b73eb97feb66b7f9810ed4390f", "score": "0.50688076", "text": "def set_screenshot\n @screenshot = Screenshot.find(params[:id])\n end", "title": "" }, { "docid": "3639d6b73eb97feb66b7f9810ed4390f", "score": "0.50688076", "text": "def set_screenshot\n @screenshot = Screenshot.find(params[:id])\n end", "title": "" }, { "docid": "3639d6b73eb97feb66b7f9810ed4390f", "score": "0.50688076", "text": "def set_screenshot\n @screenshot = Screenshot.find(params[:id])\n end", "title": "" } ]
7775753ff31a1514dc33761e9f9b88de
PATCH/PUT /supports/1 PATCH/PUT /supports/1.json
[ { "docid": "a79427455a5a6a567e04fb953544e77f", "score": "0.5136508", "text": "def update\n respond_to do |format|\n if @support.update(user_params)\n format.html { redirect_to supports_url, notice: 'Agent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @support.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "29ebe4868508fbdf158b62b2fe6ed6f7", "score": "0.63372314", "text": "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end", "title": "" }, { "docid": "617ca40a3d7dc649187863a37ddadfa8", "score": "0.61152005", "text": "def update!(**args)\n @supports_client_op_preloading = args[:supports_client_op_preloading] if args.key?(:supports_client_op_preloading)\n @supports_non_finalized_responses = args[:supports_non_finalized_responses] if args.key?(:supports_non_finalized_responses)\n @supports_non_materialized_interactions = args[:supports_non_materialized_interactions] if args.key?(:supports_non_materialized_interactions)\n end", "title": "" }, { "docid": "4e0e59715d19dce2a47fccc2c67326dd", "score": "0.61085606", "text": "def patch!\n request! :patch\n end", "title": "" }, { "docid": "5ed98eec9c229da24cfc3a85cb42a5b6", "score": "0.60610914", "text": "def patch?\r\nHTTP_METHOD_LOOKUP[request_method] == :patch\r\nend", "title": "" }, { "docid": "477d640837f0c28ae3c8788d4cc2bd2c", "score": "0.6034553", "text": "def patch\n req.patch?\n end", "title": "" }, { "docid": "576f27e4c99d0868b0454fedc7deba0c", "score": "0.60022736", "text": "def update # PATCH\n raise NotImplementedError\n end", "title": "" }, { "docid": "833f5b5a4d86e93935fe7912be097b95", "score": "0.5997637", "text": "def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "title": "" }, { "docid": "e7663d0348b74542ff1d2f4fd96156fe", "score": "0.58662575", "text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "title": "" }, { "docid": "02bedcbfaaa3099c58a35a957cdcf961", "score": "0.5843361", "text": "def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\n end", "title": "" }, { "docid": "566b79a755478221953c8e53a0770812", "score": "0.58283865", "text": "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "title": "" }, { "docid": "566b79a755478221953c8e53a0770812", "score": "0.58283865", "text": "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "title": "" }, { "docid": "93125b1643d83a89f7b2347bc2070f99", "score": "0.58209836", "text": "def update!(**args)\n @supports_in = args[:supports_in] if args.key?(:supports_in)\n @supports_under = args[:supports_under] if args.key?(:supports_under)\n end", "title": "" }, { "docid": "12bbad04a8c6e10ba240594ed4352fd7", "score": "0.5817592", "text": "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "title": "" }, { "docid": "8d6a61f3186174209e44862cb0ae05d7", "score": "0.5792906", "text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "title": "" }, { "docid": "9f6fa92012fabed0da3075e72c2bba84", "score": "0.5790384", "text": "def update!(**args)\n @is_supported = args[:is_supported] if args.key?(:is_supported)\n end", "title": "" }, { "docid": "20407f80a0265ab08f2d9a959ed3d9a5", "score": "0.57708716", "text": "def put?\r\nHTTP_METHOD_LOOKUP[request_method] == :put\r\nend", "title": "" }, { "docid": "5d1d0a1cfae8d276693aa145776d8152", "score": "0.56025475", "text": "def update\n respond_with []\n end", "title": "" }, { "docid": "4bd9dfcae3a4919e05763a0f0e20017a", "score": "0.56024754", "text": "def update!(**args)\n @supports_partial_fulfillment = args[:supports_partial_fulfillment] if args.key?(:supports_partial_fulfillment)\n @supports_synchronous_execution = args[:supports_synchronous_execution] if args.key?(:supports_synchronous_execution)\n end", "title": "" }, { "docid": "27bf2343b43b279f3787ae78d10bd689", "score": "0.5593264", "text": "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "title": "" }, { "docid": "d37b39a795a6e081d6480942ece1c538", "score": "0.55737704", "text": "def put!\n request! :put\n end", "title": "" }, { "docid": "d3abc8887989710dfc28e7e38b9df59f", "score": "0.54761404", "text": "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "title": "" }, { "docid": "909b760f54f181542cb95aee2413689b", "score": "0.54662853", "text": "def patch\n end", "title": "" }, { "docid": "129813f878bdb65e40141aa72a205f4e", "score": "0.54493344", "text": "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "title": "" }, { "docid": "ed306c936ad2043230edd933c2a72f6f", "score": "0.5444326", "text": "def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end", "title": "" }, { "docid": "fddd1d1e8f1e9dee90b174d277dde9c2", "score": "0.54293907", "text": "def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end", "title": "" }, { "docid": "d12fbc13d258a640a94368623904b957", "score": "0.5414157", "text": "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b3d6af3e1ade5f41124866b57a6b326", "score": "0.54121584", "text": "def patch(path, **args); end", "title": "" }, { "docid": "d4857011dad2c0f4a109e5c5e32e401f", "score": "0.5411042", "text": "def patch(uri, options = T.unsafe(nil)); end", "title": "" }, { "docid": "93b110625b0b685f91dc51e37a30ff91", "score": "0.5398766", "text": "def update!(**args)\n @express_url_in_settings_response_supported = args[:express_url_in_settings_response_supported] if args.key?(:express_url_in_settings_response_supported)\n @reconnect_client_input_supported = args[:reconnect_client_input_supported] if args.key?(:reconnect_client_input_supported)\n @simple_action_v2_punt_supported = args[:simple_action_v2_punt_supported] if args.key?(:simple_action_v2_punt_supported)\n @supported_action_type = args[:supported_action_type] if args.key?(:supported_action_type)\n @take_screenshot_supported = args[:take_screenshot_supported] if args.key?(:take_screenshot_supported)\n @voice_delight_immersive_ui_supported = args[:voice_delight_immersive_ui_supported] if args.key?(:voice_delight_immersive_ui_supported)\n @voice_delight_stickers_supported = args[:voice_delight_stickers_supported] if args.key?(:voice_delight_stickers_supported)\n @voice_delight_suggestions_supported = args[:voice_delight_suggestions_supported] if args.key?(:voice_delight_suggestions_supported)\n end", "title": "" }, { "docid": "d4ef989d8743bdf8c57e55d4d894dddc", "score": "0.5380928", "text": "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "title": "" }, { "docid": "1ce39e208cb6dbbb78a3265b108371ee", "score": "0.5377544", "text": "def stub_supports(model, feature = :update, supported: true)\n model = model.class unless model.kind_of?(Class)\n feature = feature.to_sym\n\n receive_supports = receive(:supports?).with(feature).and_return(supported)\n allow(model).to receive_supports\n allow_any_instance_of(model).to receive_supports\n\n allow(model).to receive(:types_supporting).with(feature).and_return([nil] + model.descendants.map(&:name))\n end", "title": "" }, { "docid": "4115263eebde636838a7f3be53fc7929", "score": "0.5312421", "text": "def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cdc47fe8bb609a17a67f227428f0bf67", "score": "0.53099775", "text": "def update!(**args)\n @request_extensions = args[:request_extensions] if args.key?(:request_extensions)\n end", "title": "" }, { "docid": "ab222c5b2b58b19f7c6fe5b33aff7354", "score": "0.5307993", "text": "def update\n respond_to do |format|\n if @supported_user.update(supported_user_params)\n format.html { redirect_to @supported_user, notice: 'Supported user was successfully updated.' }\n format.json { render :show, status: :ok, location: @supported_user }\n else\n format.html { render :edit }\n format.json { render json: @supported_user.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e89e1f4225b31cf2dc1822c27265ca1d", "score": "0.53071856", "text": "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b5a7af7facc1511991fcf37a592e26f", "score": "0.52998793", "text": "def update\n respond_to do |format|\n format.html { redirect_to @link_request, notice: 'Updates to requests are not allowed' }\n format.json { render json: [\"updates not allowed\"], status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "0ef1ffc1fa550d7e2c8cb79d855bef6f", "score": "0.5282793", "text": "def http_accept_json(http_method, params, data=nil)\n url = URI.parse(\"http://localhost:7000/test/#{params}\")\n\n Net::HTTP.start(url.host, url.port) do |http|\n initheader = {'Accept:' => 'application/json'}\n response = case http_method\n when :GET\n http.get(url.path, initheader)\n when :PUT\n http.put(url.path, data, initheader)\n when :POST\n http.post(url.path, data, initheader)\n when :DELETE\n http.delete(url.path, initheader)\n end\n JSON.parse(response.body)\n end\nend", "title": "" }, { "docid": "598ce05f6082b7f191b55f93bdaf11d0", "score": "0.52797985", "text": "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "title": "" }, { "docid": "8cfdeca8d8e9182dc79ed631a1142cdb", "score": "0.5255558", "text": "def update!(**args)\n @allows = args[:allows] if args.key?(:allows)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "acb9cd56457f767bfcb1629a54062559", "score": "0.52504915", "text": "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "931f17c5c899a79322a439bd3a6eca7b", "score": "0.52455467", "text": "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bec94fe5e5493ad50df8bee8f37d89f9", "score": "0.52429134", "text": "def update!(**args)\n @supported_types = args[:supported_types] if args.key?(:supported_types)\n end", "title": "" }, { "docid": "473a82eb01e087cc08c2cf828cf3445a", "score": "0.52392507", "text": "def options_to_patch_request(options)\n json = []\n Array[options.delete(:remove)].flatten.compact.each { |i| json << {'op' => 'remove', 'path' => \"/#{camelize_words(i)}\"} }\n options.each { |k, v| json << {'op' => 'add', 'path' => \"/#{camelize_words(k)}\", 'value' => v} }\n json.collect { |i| Hash[i.each_pair.to_a] }\n end", "title": "" }, { "docid": "b777cd9dfb1f45c5aa641ce17bfe6eeb", "score": "0.523838", "text": "def update!(**args)\n @supported_routes = args[:supported_routes] if args.key?(:supported_routes)\n end", "title": "" }, { "docid": "4b9215d987483c4934ce8eb56b5516e1", "score": "0.5237772", "text": "def patch_me(patchset)\n if respond_to? :replace\n replace(patch!(patchset))\n else\n patch!(patchset)\n end\n end", "title": "" }, { "docid": "c22552e6a671fcf79a11291a42cd458c", "score": "0.52365303", "text": "def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "02ff7d7c4afd644788c5a805ac4f0431", "score": "0.52327734", "text": "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "title": "" }, { "docid": "a6d2e276d02c66970a03a21e13d8cf37", "score": "0.5231681", "text": "def patch; end", "title": "" }, { "docid": "a6d2e276d02c66970a03a21e13d8cf37", "score": "0.5231681", "text": "def patch; end", "title": "" }, { "docid": "b6ef14bb2d35d6c777b08d7294ad4168", "score": "0.52273506", "text": "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb88fef9ffa0d872f40dcfb6a7c29bc5", "score": "0.5227003", "text": "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "title": "" }, { "docid": "90f36bc7aaf851ba40a650eb7a89f8cf", "score": "0.5200403", "text": "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_update = args[:can_update] if args.key?(:can_update)\n @has_pending_edits = args[:has_pending_edits] if args.key?(:has_pending_edits)\n @has_pending_verification = args[:has_pending_verification] if args.key?(:has_pending_verification)\n @is_disabled = args[:is_disabled] if args.key?(:is_disabled)\n @is_disconnected = args[:is_disconnected] if args.key?(:is_disconnected)\n @is_duplicate = args[:is_duplicate] if args.key?(:is_duplicate)\n @is_google_updated = args[:is_google_updated] if args.key?(:is_google_updated)\n @is_local_post_api_disabled = args[:is_local_post_api_disabled] if args.key?(:is_local_post_api_disabled)\n @is_pending_review = args[:is_pending_review] if args.key?(:is_pending_review)\n @is_published = args[:is_published] if args.key?(:is_published)\n @is_suspended = args[:is_suspended] if args.key?(:is_suspended)\n @is_verified = args[:is_verified] if args.key?(:is_verified)\n @needs_reverification = args[:needs_reverification] if args.key?(:needs_reverification)\n end", "title": "" }, { "docid": "ff41c367b36f1034a45252daccdf9208", "score": "0.5196721", "text": "def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85d2ed02d760acd40f7badcfec78a18a", "score": "0.51899594", "text": "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "title": "" }, { "docid": "a658715ee4995f2db666c28a9f828a7c", "score": "0.5176806", "text": "def my_stuff\n respond_to do |format|\n @user.valid?\n if @user.update(user_params)\n format.json {render json: '[]', status: :ok}\n else\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "855f81d29ee8ff100cfefb3479cedcdd", "score": "0.5175431", "text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "title": "" }, { "docid": "557b999fae1bc0db25d4cb6211fd86a0", "score": "0.5174844", "text": "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_update = args[:can_update] if args.key?(:can_update)\n @has_pending_verification = args[:has_pending_verification] if args.key?(:has_pending_verification)\n @is_disabled = args[:is_disabled] if args.key?(:is_disabled)\n @is_disconnected = args[:is_disconnected] if args.key?(:is_disconnected)\n @is_duplicate = args[:is_duplicate] if args.key?(:is_duplicate)\n @is_google_updated = args[:is_google_updated] if args.key?(:is_google_updated)\n @is_local_post_api_disabled = args[:is_local_post_api_disabled] if args.key?(:is_local_post_api_disabled)\n @is_pending_review = args[:is_pending_review] if args.key?(:is_pending_review)\n @is_published = args[:is_published] if args.key?(:is_published)\n @is_suspended = args[:is_suspended] if args.key?(:is_suspended)\n @is_verified = args[:is_verified] if args.key?(:is_verified)\n @needs_reverification = args[:needs_reverification] if args.key?(:needs_reverification)\n end", "title": "" }, { "docid": "a54ced7b324c076823fa6b8e01ac25ed", "score": "0.516778", "text": "def update\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @event, :notices => ['Hack was successfully updated.'] }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hack.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1aedba0dcbd1f125f63d7ab0469f59d8", "score": "0.5163604", "text": "def editing_supported?\n !(is_multivalued? || is_resource?)\n end", "title": "" }, { "docid": "7c1fb31723991259dec87f456ab25f3b", "score": "0.5140264", "text": "def update\n raise 'Not implemented'\n # signature_type, success = jsonapi_update.to_a\n\n # if success\n # render_jsonapi(signature_type, scope: false)\n # else\n # render_errors_for(signature_type)\n # end\n end", "title": "" }, { "docid": "a28c66411f7657b3f416a31647d7650d", "score": "0.5135692", "text": "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "title": "" }, { "docid": "9121a6786233adbd6a453f56e2ed5a88", "score": "0.51279384", "text": "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b7242db696342740424246c9f71fb0e", "score": "0.5125027", "text": "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "title": "" }, { "docid": "c894cd2e8136857cb741e05dd610525e", "score": "0.5118981", "text": "def update\n respond_to do |format|\n if @enable.update(enable_params)\n format.html { redirect_to @enable, notice: 'Enable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enable.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a839e2abc2819672eecf49231dadc84c", "score": "0.5118238", "text": "def patch_capability_io_card_capability_def_with_http_info(moid, capability_io_card_capability_def, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.patch_capability_io_card_capability_def ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling CapabilityApi.patch_capability_io_card_capability_def\"\n end\n # verify the required parameter 'capability_io_card_capability_def' is set\n if @api_client.config.client_side_validation && capability_io_card_capability_def.nil?\n fail ArgumentError, \"Missing the required parameter 'capability_io_card_capability_def' when calling CapabilityApi.patch_capability_io_card_capability_def\"\n end\n # resource path\n local_var_path = '/api/v1/capability/IoCardCapabilityDefs/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(capability_io_card_capability_def)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilityIoCardCapabilityDef'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.patch_capability_io_card_capability_def\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CapabilityApi#patch_capability_io_card_capability_def\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "593a44661145186c50e85fe3c02ffd96", "score": "0.51150954", "text": "def patch(path, params = {})\n request(:patch, path, params)\n end", "title": "" }, { "docid": "593a44661145186c50e85fe3c02ffd96", "score": "0.51150954", "text": "def patch(path, params = {})\n request(:patch, path, params)\n end", "title": "" }, { "docid": "dbb344abb971369ada7f4157e97368a9", "score": "0.51085275", "text": "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "title": "" }, { "docid": "d721f723bb60dabb458b6d43c8ef0d0a", "score": "0.5101948", "text": "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f249c9c5077e28e3c451b63545bbb0f", "score": "0.5101574", "text": "def fire_patch(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON_PATCH}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.run(url, headers: headers, timeout: timeout, body: body, method: :patch)\n handle_response(response, method: :patch, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "title": "" }, { "docid": "982351d94a6bf2bede6acac57fc7aed0", "score": "0.5097258", "text": "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "title": "" }, { "docid": "289fb328718fad2052bb4cdea01cf170", "score": "0.5096583", "text": "def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to polymorphic_path(complex_namespace_helper + [@resource]), notice: \"#{@resource_class} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1390d80b3fd2d4a6b423ab1b4b6c3a82", "score": "0.50947046", "text": "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "title": "" }, { "docid": "021a3712fcbd4b890affee9fe5f3d99c", "score": "0.50933", "text": "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_disable = args[:can_disable] if args.key?(:can_disable)\n @can_enable = args[:can_enable] if args.key?(:can_enable)\n @can_update = args[:can_update] if args.key?(:can_update)\n end", "title": "" }, { "docid": "021a3712fcbd4b890affee9fe5f3d99c", "score": "0.50933", "text": "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_disable = args[:can_disable] if args.key?(:can_disable)\n @can_enable = args[:can_enable] if args.key?(:can_enable)\n @can_update = args[:can_update] if args.key?(:can_update)\n end", "title": "" }, { "docid": "021a3712fcbd4b890affee9fe5f3d99c", "score": "0.50933", "text": "def update!(**args)\n @can_delete = args[:can_delete] if args.key?(:can_delete)\n @can_disable = args[:can_disable] if args.key?(:can_disable)\n @can_enable = args[:can_enable] if args.key?(:can_enable)\n @can_update = args[:can_update] if args.key?(:can_update)\n end", "title": "" }, { "docid": "28455fc70613164d95ada5921ecad736", "score": "0.50903755", "text": "def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "31d7f0ca46e8c42490350293d00c1d53", "score": "0.50899386", "text": "def update\n respond_to do |format|\n if @support_request.update(support_request_params)\n format.html { redirect_to @support_request, notice: 'Support request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @support_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cd62b54a76940bbf1ca63efbe6fc753f", "score": "0.5088587", "text": "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a96a80d9e3d715babc1494cd4a40196d", "score": "0.5086487", "text": "def create_method\n :put_json\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.5084395", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "508f3123c827a165965ac5c9e043b60e", "score": "0.508423", "text": "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "title": "" }, { "docid": "060c4f141af30cac6799a67ea9eb6a39", "score": "0.50744283", "text": "def check_header\n if ['POST','PUT','PATCH'].include? request.method\n if request.content_type != \"application/vnd.api+json\"\n head 406 and return\n end\n end\n end", "title": "" }, { "docid": "ffc4d04a75dac8e1ef754bb0ece3b3fe", "score": "0.5070691", "text": "def update\n authorize @specialization\n\n respond_to do |format|\n if @specialization.update(specialization_update_params)\n format.html { redirect_to @specialization, notice: I18n.t(\"activerecord.notice.specialization.success_update\") }\n format.json { render :show, status: :ok, location: @specialization }\n else\n format.html { render :edit }\n format.json { render json: @specialization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41660002b9956aec4d5f5aa1ed72f226", "score": "0.5068239", "text": "def update\n @tutorial = Tutorial.find(params[:id])\n editUpdate = params[:tutorial]\n hideUpdate = editUpdate.extract_keys!([:hidden])\n adminUpdate = editUpdate.extract_keys!([:featured])\n success = false\n \n #EDIT REQUEST\n if can_edit?(@tutorial) \n success = @tutorial.update_attributes(editUpdate)\n end\n \n #HIDE REQUEST\n if can_hide?(@tutorial) \n success = @tutorial.update_attributes(hideUpdate)\n end\n \n #ADMIN REQUEST\n if can_admin?(@tutorial)\n if adminUpdate.has_key?(:featured)\n if adminUpdate['featured'] == true\n adminUpdate['featured_at'] = Time.now()\n else\n adminUpdate['featured_at'] = nil\n end\n end\n \n success = @tutorial.update_attributes(adminUpdate)\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { render json: {}, status: :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors.full_messages(), status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35dda0897dfb8ad33beebc97cd1c422c", "score": "0.50661194", "text": "def patch_capability_sioc_module_capability_def_with_http_info(moid, capability_sioc_module_capability_def, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.patch_capability_sioc_module_capability_def ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling CapabilityApi.patch_capability_sioc_module_capability_def\"\n end\n # verify the required parameter 'capability_sioc_module_capability_def' is set\n if @api_client.config.client_side_validation && capability_sioc_module_capability_def.nil?\n fail ArgumentError, \"Missing the required parameter 'capability_sioc_module_capability_def' when calling CapabilityApi.patch_capability_sioc_module_capability_def\"\n end\n # resource path\n local_var_path = '/api/v1/capability/SiocModuleCapabilityDefs/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(capability_sioc_module_capability_def)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilitySiocModuleCapabilityDef'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.patch_capability_sioc_module_capability_def\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CapabilityApi#patch_capability_sioc_module_capability_def\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ce7f76022537ee70c2bea3cd507f4173", "score": "0.5065877", "text": "def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "title": "" }, { "docid": "5ba1e573fca43b27ce353ecaf4ea1445", "score": "0.5064865", "text": "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "title": "" }, { "docid": "5ba1e573fca43b27ce353ecaf4ea1445", "score": "0.5064865", "text": "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "title": "" }, { "docid": "24302373fcfc1f2b5d01fcc04a32543f", "score": "0.5064297", "text": "def update(data = :object || :json)\n end", "title": "" }, { "docid": "833b404485afb63869e47ca1fc64eb9a", "score": "0.5062302", "text": "def update\n respond_to_update({thing: @author})\n end", "title": "" }, { "docid": "97a2cded63c823d9a2c7c8ba38cc42bb", "score": "0.5061066", "text": "def api_request?\n request.format.json? || request.format.js? || request.format.xml? || request.format.fbtab?\n end", "title": "" }, { "docid": "f36f9b03227e03a64189638805e60a95", "score": "0.50578153", "text": "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "title": "" }, { "docid": "0fde867296068566f7d4a3fb604a53d2", "score": "0.50531626", "text": "def update\n respond_to do |format|\n \n end\n end", "title": "" }, { "docid": "c521f46143f44144c5f3e6fa4310c4d2", "score": "0.5050334", "text": "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c521f46143f44144c5f3e6fa4310c4d2", "score": "0.5050334", "text": "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd8510ad78b09d7cfeddadbd2ac2ba92", "score": "0.50477", "text": "def update\n respond_to do |format|\n if resource.update(params_for_update)\n format.html { redirect_to resource, notice: \"#{resource_class_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: resource }\n else\n format.html { render :edit }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6ec40fcbff362de0b58b91dfc60f9cc1", "score": "0.50473666", "text": "def json_request?\n request.format.json?\n end", "title": "" }, { "docid": "6ec40fcbff362de0b58b91dfc60f9cc1", "score": "0.50473666", "text": "def json_request?\n request.format.json?\n end", "title": "" }, { "docid": "6ec40fcbff362de0b58b91dfc60f9cc1", "score": "0.50473666", "text": "def json_request?\n request.format.json?\n end", "title": "" } ]
e288765aad57e2385d80a01e665c20e8
Given a list of files and directories, create a list of all the Ruby files they contain. If +force_doc+ is true we always add the given files, if false, only add files that we guarantee we can parse. It is true when looking at files given on the command line, false when recursing through subdirectories. The effect of this is that if you want a file with a nonstandard extension parsed, you must name it explicitly.
[ { "docid": "3e331af0914cc1ebb38290a1fdcbf295", "score": "0.6852115", "text": "def normalized_file_list(options, relative_files, force_doc = false,\n exclude_pattern = nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n stat = File.stat rel_file_name rescue next\n\n case type = stat.ftype\n when \"file\"\n next if @last_created and stat.mtime < @last_created\n\n if force_doc or ::RDoc::Parser.can_parse(rel_file_name) then\n file_list << rel_file_name.sub(/^\\.\\//, '')\n end\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDoc::Error, \"I can't deal with a #{type} #{rel_file_name}\"\n end\n end\n\n file_list\n end", "title": "" } ]
[ { "docid": "15ab9e72e0a0f63f10a3fe4ee53eea1b", "score": "0.6948236", "text": "def normalized_file_list(options, relative_files, force_doc = false, exclude_pattern=nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n case type = File.stat(rel_file_name).ftype\n when \"file\"\n file_list << rel_file_name.sub(/^\\.\\//, '') if force_doc || ParserFactory.can_parse(rel_file_name)\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDocError.new(\"I can't deal with a #{type} #{rel_file_name}\")\n end\n end\n file_list\n end", "title": "" }, { "docid": "9a1cebaff92558b20f76853be2c0d82d", "score": "0.6849111", "text": "def normalized_file_list(options, relative_files, force_doc = false,\n exclude_pattern = nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n stat = File.stat(rel_file_name)\n case type = stat.ftype\n when \"file\"\n next if @last_created and stat.mtime < @last_created\n file_list << rel_file_name.sub(/^\\.\\//, '') if force_doc || ParserFactory.can_parse(rel_file_name)\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDoc::Error, \"I can't deal with a #{type} #{rel_file_name}\"\n end\n end\n\n file_list\n end", "title": "" }, { "docid": "83a00a80f69531431f3aa719d920cc3d", "score": "0.6414142", "text": "def files(args = {})\n opts = {\n base_dir: Dir.pwd,\n recursive: false,\n exts: [],\n non_exts: []\n }.merge(args)\n\n base_dir = opts[:base_dir]\n fail CustomError, \"The directory #{base_dir} is not valid or or not readable!\" unless File.exist?(base_dir)\n\n wildcard = opts[:recursive] ? '**' : ''\n exts = opts[:exts]\n non_exts = opts[:non_exts]\n\n file_with_extension = Dir.glob(File.join(base_dir, wildcard, \"*.{#{exts.join(',')}}\"))\n file_with_no_extension = no_extension_files(base_dir, wildcard, non_exts)\n\n (file_with_extension + file_with_no_extension).sort\n end", "title": "" }, { "docid": "7f68aa6a43d2260a14ca29d9911461db", "score": "0.6289561", "text": "def parse_files(files, opts = {})\n opts = { :extension => nil, :directory => nil }.merge opts\n files = [files] unless files.is_a?(Array)\n search_text = files.join(\" \")\n parsed_files = []\n while !files.empty?\n file = files.shift\n unless opts[:directory].nil?\n file = opts[:directory] + \"/\" + file\n end\n unless opts[:extension].nil?\n file = file.sub(/\\.[^\\\\\\/]*$/, \"\") + \".\" + opts[:extension].to_s.tr(\".\", \"\")\n end\n parsed_files += Dir.glob(File.expand_path(file))\n end\n puts I18n.t(:no_match) % search_text if parsed_files.empty?\n parsed_files.uniq\n end", "title": "" }, { "docid": "9b1ce996bda354d165b2c07e18d7d47e", "score": "0.6289139", "text": "def dir_files(dir_path)\n Dir[File.join(dir_path, '*')].to_a.map { |path| Docfile.new(path) }\n end", "title": "" }, { "docid": "ed2f835131ae438d4f9baaa045fc9465", "score": "0.61735046", "text": "def document_files\n allowed_formats = \n if not parsers.empty?\n parsers.collect do |filetype, parser| \n \".\" + parser.file_extension_name\n end.join(\"|\")\n elsif not parser.nil?\n \".\" + parser.file_extension_name\n end\n\n allowed_formats = Regexp.new(allowed_formats)\n \n \tFileUtils.collect_files_from(docs_path).select do |document_filename|\n \t document_filename =~ allowed_formats\n end\n end", "title": "" }, { "docid": "e18a494c4bfc5823bb2199db45b495b6", "score": "0.6170732", "text": "def normalized_file_list(relative_files, force_doc = false,\n exclude_pattern = nil)\n file_list = {}\n\n relative_files.each do |rel_file_name|\n rel_file_name = rel_file_name.sub(/^\\.\\//, '')\n next if rel_file_name.end_with? 'created.rid'\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n stat = File.stat rel_file_name rescue next\n\n case type = stat.ftype\n when \"file\" then\n mtime = (stat.mtime unless (last_modified = @last_modified[rel_file_name] and\n stat.mtime.to_i <= last_modified.to_i))\n\n if force_doc or RDoc::Parser.can_parse(rel_file_name) then\n file_list[rel_file_name] = mtime\n end\n when \"directory\" then\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n\n created_rid = File.join rel_file_name, \"created.rid\"\n next if File.file? created_rid\n\n dot_doc = File.join rel_file_name, RDoc::DOT_DOC_FILENAME\n\n if File.file? dot_doc then\n file_list.update(parse_dot_doc_file(rel_file_name, dot_doc))\n else\n file_list.update(list_files_in_directory(rel_file_name))\n end\n else\n warn \"rdoc can't parse the #{type} #{rel_file_name}\"\n end\n end\n\n file_list\n end", "title": "" }, { "docid": "f20f5c83a70ae8ef5a7b040689e75ce3", "score": "0.6145862", "text": "def src_filelist\n FileList['lib/**/*.rb'].concat ['README.rdoc']\nend", "title": "" }, { "docid": "d664ab4089da243383377a3f0e5973ad", "score": "0.6123663", "text": "def build_file_list\n puts_and_logs 'Finding files...'\n file_list = []\n config[:source].each do |entry|\n if File.directory?(entry)\n populate_list_of_files_from_directory(file_list, entry) \n next\n end\n if File.file?(entry)\n populate_list_of_files_from_file(file_list, entry) \n next\n end\n logger.warn \"\\\"#{entry}\\\" is neither a directory nor a regular file. Ignored...\"\n end\n logger.debug(file_list)\n file_list\n end", "title": "" }, { "docid": "0395e548837fe08ac6cce24188f40c89", "score": "0.6106295", "text": "def all_files(options=nil)\n temp_options(options) if options\n files = []\n files << dependencies if @options[:dependencies]\n files << Dir.glob(File.join(@options[:paths], '**/*')) if @options[:paths]\n reset_options if options\n files.flatten.uniq\n end", "title": "" }, { "docid": "2f059e9b107117a4145e8988c408319f", "score": "0.6097908", "text": "def package_files\n (rdoc_files + lib_files + tests + doc_files + \n programs + extra_files + extension_files).uniq\n end", "title": "" }, { "docid": "9a0446425b26d26bf6c091e0c0fbd904", "score": "0.6028043", "text": "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "title": "" }, { "docid": "b225fb53dddb1dc471aec10458a1582d", "score": "0.6008009", "text": "def exploreFiles( target, results = Array[] )\n # First, check if the target is a directory\n if isDirectory( target )\n # Okay, target is a directory, get all the entries inside the\n # directory and iterate over them\n Dir.entries( target ).each do |path|\n fullPath = \"#{target}/#{path}\"\n # We are now iterating over each of the directory entries. Ignore\n # paths that do NOT end with .ti, they are not Titanium class files\n # and we do not want to create documentation for them.\n\n # However, if a path is a directory, iterate over that too\n if path != \".\" and path != \"..\"\n if isDirectory fullPath\n results = exploreFiles( fullPath, results )\n elsif File.extname( path ) == \".ti\"\n # Alright! The path is marked as a Titanium class file via the .ti ext.\n # Lets begin parsing for functions and comments.\n results.push fullPath\n end\n end\n end\n\n return results\n else\n raise \"Failed to generate documentation. Cannot explore #{target}, is a file\"\n end\nend", "title": "" }, { "docid": "f357aa6d21fd8f4e6d313b5d51727544", "score": "0.5923306", "text": "def merge_to_docc_folder(paths)\n docc_paths_with_files = Set.new\n allowable_paths = paths.select do |path|\n path_str = path.to_s\n\n if path_str =~ /\\.docc(\\/|$)/i\n\n # we want folder with files\n next if path.directory?\n\n # remove everything after \".docc\", but keep \".docc\"\n folder_path = path_str.split(\"\\.docc\")[0] + \"\\.docc\"\n\n docc_paths_with_files << Pathname(folder_path)\n next\n\n end\n true\n end\n\n allowable_paths + docc_paths_with_files.to_a\nend", "title": "" }, { "docid": "f54c98494724cbb3a56aae8afa76ed7a", "score": "0.59143186", "text": "def files\n cli_arguments.each_with_index do |filename, index|\n if Dir.exist?(filename)\n cli_arguments[index] = Dir[\"#{filename}/**/*.md\"]\n end\n end\n cli_arguments.flatten!\n cli_arguments\n end", "title": "" }, { "docid": "29149950f3a910947401de74b0d72f72", "score": "0.5899364", "text": "def make_rdoc_filelist\n\t\tlist = self.project_files.dup\n\n\t\tlist.exclude do |fn|\n\t\t\tfn =~ %r:^(spec|data)/: || !fn.end_with?( *DOCUMENTATION_SUFFIXES )\n\t\tend\n\n\t\treturn list\n\tend", "title": "" }, { "docid": "12f74f449c5afdeec216bd65ac20a357", "score": "0.5893837", "text": "def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end", "title": "" }, { "docid": "12f74f449c5afdeec216bd65ac20a357", "score": "0.58935547", "text": "def list_files(paths = T.unsafe(nil), options = T.unsafe(nil)); end", "title": "" }, { "docid": "c005ff9d7b5120a4b69d89d1179f1316", "score": "0.58405524", "text": "def ruby_files\n file_list '**/{*.{rb,rake,gemspec},{Gem,Rake}file,Puppetfile.*}'\n end", "title": "" }, { "docid": "6a9cdc6b8428233752bd13b140f5267b", "score": "0.5812527", "text": "def list_files(options = {}) \n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n extension = options[:extension]\n\n extension = \".#{extension}\" unless extension == '' or extension.start_with?('.') \n file_wildcard = \"*#{extension}\"\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all \n\n Dir.glob(\"#{path}#{file_wildcard}\")\n end", "title": "" }, { "docid": "70c38185fbb76ec157d787a62bfa1a17", "score": "0.57647526", "text": "def generate_file_files( options, files, classes )\n\t\tdebug_msg \"Generating file documentation in #@outputdir\"\n\t\ttemplatefile = @template_dir + 'filepage.rhtml'\n\n\t\tmodsort = self.get_sorted_module_list( classes )\n\n\t\tfiles.sort_by {|k,v| k }.each do |path, fileinfo|\n\t\t\toutfile = @outputdir + fileinfo[:outfile]\n\t\t\tdebug_msg \" working on %s (%s)\" % [ path, outfile ]\n\t\t\trel_prefix = @outputdir.relative_path_from( outfile.dirname )\n\t\t\tcontext = binding()\n\n\t\t\tdebug_msg \" rendering #{outfile}\"\n\t\t\tself.render_template( templatefile, binding(), outfile )\n\t\tend\n\tend", "title": "" }, { "docid": "695858a285d990d9982e1d9b5dd15d79", "score": "0.5759997", "text": "def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end", "title": "" }, { "docid": "695858a285d990d9982e1d9b5dd15d79", "score": "0.5759997", "text": "def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end", "title": "" }, { "docid": "695858a285d990d9982e1d9b5dd15d79", "score": "0.5759997", "text": "def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end", "title": "" }, { "docid": "8432812f0dc79c3042c092f6930f8783", "score": "0.5752948", "text": "def generate_file_files( options, files, classes )\n\t\tdebug_msg \"Generating file documentation in #@outputdir\"\n\t\ttemplatefile = @template_dir + 'filepage.rhtml'\n\n\t\tfiles.sort_by {|k,v| k }.each do |path, fileinfo|\n\t\t\toutfile = @outputdir + fileinfo[:outfile]\n\t\t\tdebug_msg \" working on %s (%s)\" % [ path, outfile ]\n\t\t\trel_prefix = @outputdir.relative_path_from( outfile.dirname )\n\t\t\tcontext = binding()\n\n\t\t\tdebug_msg \" rending #{outfile}\"\n\t\t\tself.render_template( templatefile, binding(), outfile )\n\t\tend\n\tend", "title": "" }, { "docid": "be072adeab05700444534d1341d3f7bc", "score": "0.5733237", "text": "def all_files\n Dir.glob(\"#{template_path}/**/*\", File::FNM_DOTMATCH).reject{|path| File.directory?(path) }.sort\n end", "title": "" }, { "docid": "d717e30dfc830c5555dc50d2c857d3eb", "score": "0.5719826", "text": "def manifestdoc(files)\n Puppet[:ignoreimport] = true\n files.select { |f| FileTest.file?(f) }.each do |f|\n parser = Puppet::Parser::Parser.new(Puppet::Node::Environment.new(Puppet[:environment]))\n parser.file = f\n ast = parser.parse\n output(f, ast)\n end\n end", "title": "" }, { "docid": "9d62da4e3cf0732eb5b882caa38b33b8", "score": "0.5714889", "text": "def files(*list)\n @files.concat(makelist(list)) unless list.empty?\n @files\n end", "title": "" }, { "docid": "ff0dff707107564dbc3e41ba516deb2e", "score": "0.5695937", "text": "def process_files(manifest, file_list, options = {})\n file_list.each do |file|\n if(File.directory?(file_root(file)))\n manifest.directory(file)\n else\n manifest.file(talia_root(file), file, options)\n end\n end\n end", "title": "" }, { "docid": "79daf5afa73fd12af45ea376f33b3c2d", "score": "0.568806", "text": "def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end", "title": "" }, { "docid": "4da376b0657f717b06e9d0311c5d72f5", "score": "0.56861085", "text": "def files()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |f|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + f )\n\t\t\t\t\tnext unless ( f[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << file( f )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend", "title": "" }, { "docid": "b2c706c3a7978477ed1d7568b01b18da", "score": "0.5684405", "text": "def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end", "title": "" }, { "docid": "8b6d299ef46543d942faf1384f183b94", "score": "0.56632555", "text": "def files() = files_path.glob('**/*')", "title": "" }, { "docid": "929f6aa58fd4581db00309e33c1f5994", "score": "0.5625132", "text": "def parse_files files\n file_list = gather_files files\n @stats = RDoc::Stats.new @store, file_list.length, @options.verbosity\n\n return [] if file_list.empty?\n\n original_options = @options.dup\n @stats.begin_adding\n\n file_info = file_list.map do |filename|\n @current = filename\n parse_file filename\n end.compact\n\n @stats.done_adding\n @options = original_options\n\n file_info\n end", "title": "" }, { "docid": "1cfcedc3ac090974cac75eae7efc0bb6", "score": "0.5618795", "text": "def enhance_file_list\n return unless @enhanced_mode\n @current_dir ||= Dir.pwd\n\n begin\n actr = @files.size\n\n # zshglob: M = MARK_DIRS with slash\n # zshglob: N = NULL_GLOB no error if no result, this is causing space to split\n # file sometimes for single file.\n\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n # FIXME: simplify condition into one\n if @files.size == 1\n # its a dir, let give the next level at least\n return unless @files.first[-1] == '/'\n\n d = @files.first\n # zshglob: 'om' = ordered on modification time\n # f1 = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_files_by_mtime(d)\n\n if f && !f.empty?\n @files.concat f\n @files.concat get_important_files(d)\n end\n return\n end\n #\n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maybe bin, put a couple recent files\n # FIXME: gemspec file will be same as current folder\n if @files.index('Gemfile') || !@files.grep(/\\.gemspec/).empty?\n\n if @files.index('app/')\n insert_into_list('config/', \"config/routes.rb\")\n end\n\n # usually the lib dir has only one file and one dir\n # NOTE: avoid lib if rails project\n flg = false\n @files.concat get_important_files(@current_dir)\n if @files.index('lib/') && !@files.index('app/')\n # get first five entries by modification time\n # f1 = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('lib')&.first(5)\n # @log.warn \"f1 #{f1} != #{f} in lib\" if f1 != f\n if f && !f.empty?\n insert_into_list('lib/', f)\n flg = true\n end\n\n # look into lib file for that project\n # lib has a dir in it with the gem name\n dd = File.basename(@current_dir)\n if f.index(\"lib/#{dd}/\")\n # f1 = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime(\"lib/#{dd}\")&.first(5)\n # @log.warn \"2756 f1 #{f1} != #{f} in lib/#{dd}\" if f1 != f\n if f && !f.empty?\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n\n # look into bin directory and get first five modified files\n # FIXME: not in the case of rails, only for commandline programs\n if @files.index('bin/') && !@files.index('app/')\n # f1 = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n f = get_files_by_mtime('bin')&.first(5)\n # @log.warn \"2768 f1 #{f1} != #{f} in bin/\" if f1 != f\n insert_into_list('bin/', f) if f && !f.empty?\n flg = true\n end\n\n # oft used rails files\n # TODO remove concerns dir\n # FIXME too many files added, try adding recent only\n if @files.index('app/')\n [ \"app/controllers\", \"app/models\", \"app/views\" ].each do |dir|\n f = get_files_by_mtime(dir)&.first(5)\n if f && !f.empty?\n @log.debug \"f has #{f.count} files before\"\n @log.debug \"f has #{f} files before\"\n f = get_recent(f)\n @log.debug \"f has #{f.count} files after\"\n @log.debug \"f has #{f} files after\"\n insert_into_list(\"#{dir}/\", f) unless f.empty?\n end\n end\n\n insert_into_list('config/', \"config/routes.rb\")\n\n # top 3 dirs in app dir\n f = get_files_by_mtime('app/')&.first(3)\n insert_into_list('app/', f) if f && !f.empty?\n flg = true\n end\n return if flg\n\n\n end # Gemfile\n\n # 2019-06-01 - added for crystal and other languages\n if @files.index('src/')\n f = get_files_by_mtime('src')&.first(5)\n insert_into_list('src/', f) if f && !f.empty?\n end\n return if @files.size > 15\n\n # Get most recently accessed directory\n ## NOTE: first check accessed else modified will change accessed\n # 2019-03-28 - adding NULL_GLOB breaks file name on spaces\n # print -n : don't add newline\n # zzmoda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n # zzmoda = nil if zzmoda == ''\n moda = get_most_recently_accessed_dir\n # @log.warn \"Error 2663 #{zzmoda} != #{moda}\" if zzmoda != moda\n if moda && moda != ''\n\n # get most recently accessed file in that directory\n # NOTE: adding NULL_GLOB splits files on spaces\n # FIXME: this zsh one gave a dir instead of file.\n # zzmodf = `zsh -c 'print -rl -- #{moda}*(oa[1]M)'`.chomp\n # zzmodf = nil if zzmodf == ''\n modf = get_most_recently_accessed_file moda\n # @log.warn \"Error 2670 (#{zzmodf}) != (#{modf}) gmra in #{moda} #{zzmodf.class}, #{modf.class} : Loc: #{Dir.pwd}\" if zzmodf != modf\n\n raise \"2784: #{modf}\" if modf && !File.exist?(modf)\n\n insert_into_list moda, modf if modf && modf != ''\n\n # get most recently modified file in that directory\n # zzmodm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`.chomp\n modm = get_most_recently_modified_file moda\n # zzmodm = nil if zzmodm == ''\n # @log.debug \"Error 2678 (gmrmf) #{zzmodm} != #{modm} in #{moda}\" if zzmodm != modm\n raise \"2792: #{modm}\" if modm && !File.exist?(modm)\n\n insert_into_list moda, modm if modm && modm != '' && modm != modf\n end\n\n ## get most recently modified dir\n # zzmodm = `zsh -c 'print -rn -- *(/om[1]M)'`\n # zzmodm = nil if zzmodm == ''\n modm = get_most_recently_modified_dir\n # @log.debug \"Error 2686 rmd #{zzmodm} != #{modm}\" if zzmodm != modm\n\n if modm != moda\n\n # get most recently accessed file in that directory\n # modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n modmf = get_most_recently_accessed_file modm\n raise \"2806: #{modmf}\" if modmf && !File.exist?(modmf)\n\n insert_into_list modm, modmf\n\n # get most recently modified file in that directory\n # modmf11 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n modmf1 = get_most_recently_modified_file modm\n raise \"2812: #{modmf1}\" if modmf1 && !File.exist?(modmf1)\n\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\n ensure\n # if any files were added, then add a separator\n bctr = @files.size\n @files.insert actr, SEPARATOR if actr < bctr\n end\nend", "title": "" }, { "docid": "3e3f3fd0dbdf2e41452cb593ed767ed4", "score": "0.5617149", "text": "def files\n @files = Dir[File.join(root(:site), '**', '*')].inject([]) do |a, match|\n # Make sure its the canonical name\n path = File.expand_path(match)\n file = path.gsub /^#{Regexp.escape root(:site)}\\/?/, ''\n ext = File.extname(file)[1..-1]\n \n if ignored_files.include?(path) or File.directory?(match)\n # pass\n elsif not get_renderer(ext).nil? # Has a renderer associated\n fname = file.chomp(\".#{ext}\")\n fname += get_renderer(ext).default_ext unless File.basename(fname).include?('.')\n a << fname\n else\n a << file\n end\n a\n end\n end", "title": "" }, { "docid": "f14dd7551b786032216250b1e87b233e", "score": "0.5614391", "text": "def find_files(base_dir, flags); end", "title": "" }, { "docid": "1535d17bf4db1031903afaeaad4d8565", "score": "0.56068206", "text": "def enhance_file_list\n return\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]M)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]M)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]M)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]M)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]M)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]M)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]M)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]M)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend", "title": "" }, { "docid": "9c5a4ac55479c9a4d9d2ae405c53b6c2", "score": "0.56013185", "text": "def addSrcFilesByRE(re)\n Dir.for_each(@srcDir) { |f|\n next if File.stat(f).dir?\n @files << f if re =~ f\n }\n end", "title": "" }, { "docid": "0220960c0a278d5c582a96448ccebd54", "score": "0.56005216", "text": "def require_files dir, args = {}\n\trecursive = !!args[:recursive]\n\texcept = args[:except] || []\n\texcept = [except] unless (except.is_a? Array)\n\tdirs = []\n\tif (File.directory? dir)\n\t\tDir.new(dir).each do |file|\n\t\t\tfilepath = File.join dir, file\n\t\t\tnext if (except.include? filepath)\n\t\t\tif (File.file?(filepath))\n\t\t\t\trequire filepath if (file =~ /\\A\\S+\\.rb\\z/)\n\t\t\telsif (File.directory?(filepath))\n\t\t\t\tif (recursive && !(filepath =~ /\\A.*\\/?\\.{1,2}\\z/))\n\t\t\t\t\tdirs << filepath\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdirs.each do |dir|\n\t\t\trequire_files dir, except: except, recursive: true\n\t\tend\n\tend\nend", "title": "" }, { "docid": "55667339ac486500f4d40db3ee3bfd52", "score": "0.5589383", "text": "def appendGlobs(arr, patterns); patterns.each { |p| arr << Dir.glob(p) }; arr.flatten end", "title": "" }, { "docid": "989e3313d280cf6582293ca6465a81ba", "score": "0.55844235", "text": "def generate_file_files\n template_file = @template_dir + 'file-page.html.erb'\n debug_msg \"Generating file documentation\"\n @all_files.each do |file|\n debug_msg \" file #{file.path}\"\n outfile = @output_dir + file.path\n @file = file\n self.render_template(template_file, binding(), outfile)\n end\n end", "title": "" }, { "docid": "eadeeab8f159b04c56df42e53198b681", "score": "0.5583307", "text": "def find_files( dirs, lang, name, exts )\n results = []\n glob_files( dirs, lang, name, exts ) { |file,base,ext| results << file }\n results\n end", "title": "" }, { "docid": "76b5664b360e6ca75c0b223c9053dae2", "score": "0.55819535", "text": "def run_through_directory\n@file_array = []\n Dir.foreach('text_files') do |item|\n next if item == '.' or item == '..'\n @file_array << item\n end\nend", "title": "" }, { "docid": "3a58272405ff3cf6d3d616535456bab3", "score": "0.55793774", "text": "def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end", "title": "" }, { "docid": "5303863294906922cbb0495d678cac80", "score": "0.55787385", "text": "def enhance_file_list\n return unless $enhanced_mode\n # if only one entry and its a dir\n # get its children and maybe the recent mod files a few\n \n # zsh gives errors which stick on stdscr and don't get off!\n # Rather than using N I'll try to convert to ruby, but then we lose\n # similarity to cetus and its tough to redo all the sorting stuff.\n if $files.size == 1\n # its a dir, let give the next level at least\n if $files.first[-1] == \"/\"\n d = $files.first\n #f = `zsh -c 'print -rl -- #{d}*(omM)'`.split(\"\\n\")\n f = get_file_list d\n if f && f.size > 0\n $files.concat f\n $files.concat get_important_files(d)\n return\n end\n else\n # just a file, not dirs here\n return\n end\n end\n # \n # check if a ruby project dir, although it could be a backup file too,\n # if so , expand lib and maby bin, put a couple recent files\n #\n if $files.index(\"Gemfile\") || $files.grep(/\\.gemspec/).size > 0\n # usually the lib dir has only one file and one dir\n flg = false\n $files.concat get_important_files(Dir.pwd)\n if $files.index(\"lib/\")\n f = `zsh -c 'print -rl -- lib/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/\", f)\n flg = true\n end\n dd = File.basename(Dir.pwd)\n if f.index(\"lib/#{dd}/\")\n f = `zsh -c 'print -rl -- lib/#{dd}/*(om[1,5]MN)'`.split(\"\\n\")\n if f && f.size() > 0\n insert_into_list(\"lib/#{dd}/\", f)\n flg = true\n end\n end\n end\n if $files.index(\"bin/\")\n f = `zsh -c 'print -rl -- bin/*(om[1,5]MN)'`.split(\"\\n\")\n insert_into_list(\"bin/\", f) if f && f.size() > 0\n flg = true\n end\n return if flg\n\n # lib has a dir in it with the gem name\n\n end\n return if $files.size > 15\n\n ## first check accessed else modified will change accessed\n moda = `zsh -c 'print -rn -- *(/oa[1]MN)'`\n if moda && moda != \"\"\n modf = `zsh -c 'print -rn -- #{moda}*(oa[1]MN)'`\n if modf && modf != \"\"\n insert_into_list moda, modf\n end\n modm = `zsh -c 'print -rn -- #{moda}*(om[1]MN)'`\n if modm && modm != \"\" && modm != modf\n insert_into_list moda, modm\n end\n end\n ## get last modified dir\n modm = `zsh -c 'print -rn -- *(/om[1]MN)'`\n if modm != moda\n modmf = `zsh -c 'print -rn -- #{modm}*(oa[1]MN)'`\n insert_into_list modm, modmf\n modmf1 = `zsh -c 'print -rn -- #{modm}*(om[1]MN)'`\n insert_into_list(modm, modmf1) if modmf1 != modmf\n else\n # if both are same then our options get reduced so we need to get something more\n # If you access the latest mod dir, then come back you get only one, since mod and accessed\n # are the same dir, so we need to find the second modified dir\n end\nend", "title": "" }, { "docid": "ed1670ce87760a0246613f3e1336e0d7", "score": "0.5578671", "text": "def all(files=nil, options={})\n # if you want the default 'app.files', you can just pass in the options\n if files.is_a?(Hash) && options == {}\n options = files\n files = nil\n end\n\n check_platform = options.fetch(:platform, nil)\n current_platform = App.respond_to?(:template) ? App.template : :ios\n return unless Motion::Require.check_platform(current_platform, check_platform)\n\n Motion::Project::App.setup do |app|\n app.exclude_from_detect_dependencies << ext_file\n\n if files.nil? || files.empty?\n app.files.push ext_file\n app.exclude_from_detect_dependencies += app.files\n app.files_dependencies dependencies_for(app.files.flatten)\n else\n # Place files prior to those in ./app, otherwise at the end.\n preceding_app = app.files.index { |f| f =~ %r(^(?:\\./)?app/) } || -1\n required = Array(files).map { |f| explicit_relative(f) }\n app.exclude_from_detect_dependencies += required\n app.files.insert(preceding_app, ext_file, *required)\n app.files.uniq! # Prevent redundancy\n\n app.files_dependencies dependencies_for(required)\n end\n end\n end", "title": "" }, { "docid": "f4ca55015d2bca9ca09e83b504db9c34", "score": "0.5569428", "text": "def add_default_files_to_definition\n mkdir_p('files')\n default_files = File.join(File.dirname(__FILE__), '../../files')\n files = []\n chdir(default_files) do\n files += Dir.glob(\"**/*\")\n end\n files.each do |filespec|\n dest = File.join('files', filespec)\n unless File.exist?(dest)\n src = File.join(default_files, filespec)\n if File.file?(src)\n destdir = File.dirname(dest)\n mkdir_p(destdir) unless File.exist?(destdir)\n # puts \"cp(#{src}, #{dest}), destdir => #{destdir}\"\n cp(src, dest)\n end\n end\n end\n end", "title": "" }, { "docid": "d080a0265493b3ee26443377e7e2a615", "score": "0.55574536", "text": "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "title": "" }, { "docid": "839c1fad0a7a730b1680fee57900b444", "score": "0.55517465", "text": "def find_files( config )\n files = []\n config.each do |c|\n Config.verify_config_dirs( c )\n\n dir = c[\"directory\"].chomp(\"/\")\n recursive = Config.convert_yaml_bools( c[\"recursive\"] ) \n \n if File.directory? dir \n unless recursive\n Dir.glob( \"#{dir}/*\" ).each do |d|\n files << d unless File.directory? d or File.symlink? d\n end\n else\n Dir.glob(\"#{dir}/**/*\").each do |d|\n files << d unless File.directory? d or File.symlink? d \n end \n end\n else\n Dir.glob( dir ).each do |d|\n files << d \n end\n end\n end\n files\nend", "title": "" }, { "docid": "dc1d4efce410f8a95ff1ffdc02865c69", "score": "0.55356914", "text": "def file_list path = false, only_extensions = []\n data = []\n path = @path unless path\n if File.exists?(path) && File.directory?(path)\n Dir.foreach(path) do |entry|\n next if entry == '..' or entry == '.' or entry.start_with?(\".\")\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n data.concat(file_list(full_path, only_extensions))\n else\n if only_extensions.size > 0\n data << { \n :name => entry,\n :path => full_path\n } if only_extensions.all? {|extension| true if entry.end_with?(extension) }\n else\n data << { \n :name => entry,\n :path => full_path\n }\n end\n end\n end\n end\n return data\n end", "title": "" }, { "docid": "c2b8d3e679d25dfa3be96b4315903b9e", "score": "0.55348134", "text": "def add_files(frameworks_build_phase, files, lib_group, relative_source_directory)\n\tfiles.each { |file|\n\t\tif file != \".\" && file != \"..\"\n\t\t\ta_ref = lib_group.new_file(relative_source_directory + file)\n\t\t\tframeworks_build_phase.add_file_reference(a_ref, true)\n\t\tend\n\t}\nend", "title": "" }, { "docid": "a955c505c8e9030b56fb40050538f034", "score": "0.55041355", "text": "def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end", "title": "" }, { "docid": "45caa502c8937d90a2e4a9a07266a9d9", "score": "0.5503829", "text": "def compile_file_list(output_folder, files, data = {})\n files.each do |target, source|\n Google::LOGGER.debug \"Compiling #{source} => #{target}\"\n target_file = File.join(output_folder, target)\n .gsub('{{product_name}}', @api.prefix[1..-1])\n\n manifest = @config.respond_to?(:manifest) ? @config.manifest : {}\n generate_file(\n data.clone.merge(\n name: target,\n product: @api,\n object: {},\n config: {},\n scopes: @api.scopes,\n manifest: manifest,\n tests: '',\n template: source,\n generated_files: @generated,\n sourced_files: @sourced,\n compiler: compiler,\n output_folder: output_folder,\n out_file: target_file,\n prop_ns_dir: @api.prefix[1..-1].downcase,\n product_ns: @api.prefix[1..-1].camelize(:upper)\n )\n )\n\n %x(goimports -w #{target_file}) if File.extname(target_file) == '.go'\n end\n end", "title": "" }, { "docid": "ce78b32b130639b55e79b0918c0d2c4e", "score": "0.5497706", "text": "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "title": "" }, { "docid": "156b17221ab5162b83ada821aca5cd8a", "score": "0.5474713", "text": "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "title": "" }, { "docid": "8a645ae1837fd3123724b701bb60e948", "score": "0.5473796", "text": "def files(options = {})\n resize_images_if_needed \n files = get_children(\"file\").collect do |file| \n Dirk.new(file, { :attr_file => file.basename.to_s.gsub(file.extname, '.txt') })\n end\n \n files.sort! { |a, b| a.send(options[:sort]).to_s <=> b.send(options[:sort]).to_s } if options[:sort]\n files\n end", "title": "" }, { "docid": "0952ab42dde880ec1ec8c5e603f13635", "score": "0.5472835", "text": "def files(treeish = nil)\n tree_list(treeish || @ref, false, true)\n end", "title": "" }, { "docid": "dfe766cb6a93de4804ee57132c7506e5", "score": "0.546088", "text": "def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end", "title": "" }, { "docid": "f0dacb6561c79a99720218428fb5a2e5", "score": "0.5456103", "text": "def _find_files(*paths)\n paths.flatten!\n paths.map! { |p| Pathname.new(p) }\n files = paths.select(&:file?)\n\n (paths - files).each do |dir|\n files << _find_files(dir.children)\n end\n\n files.flatten.map(&:to_s)\n end", "title": "" }, { "docid": "591a0b372f53dd9aa489f8db4cf1d192", "score": "0.5442438", "text": "def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end", "title": "" }, { "docid": "b73884ec7c7a5a58eff38881067eaee5", "score": "0.5436273", "text": "def find(dirs); end", "title": "" }, { "docid": "ad1fdf390d4213a7a2f5c1c6d48f8790", "score": "0.54345804", "text": "def add_files(files, path, base_dir=\"\")\n files.each do |file|\n # Add all of the subdirectories if they don't already exist\n 1.upto(file.length - 1) do |idx|\n full = base_dir + file[0,idx].join(\"/\") + \"/\"\n if !(entries.map{|e|e.name}.include?(full))\n add_file(full, '')\n end\n end\n # Now add the actual file, grabbing data from the filesystem\n fd = File.open(File.join( path, file ), \"rb\")\n data = fd.read(fd.stat.size)\n fd.close\n add_file(base_dir + file.join(\"/\"), data)\n end\n end", "title": "" }, { "docid": "0cf2f85a48d4ddb0531ba475fc50a079", "score": "0.542613", "text": "def _find_files(*paths)\n paths.flatten.map do |path|\n path = Pathname.new(path)\n path.file? ? [path.to_s] : _find_files(path.children)\n end.flatten\n end", "title": "" }, { "docid": "0f45f489645e5ccb3629a5fde9075aa0", "score": "0.54223627", "text": "def list_files(paths = [], options = {})\n ref = options[:ref] || 'HEAD'\n `git ls-tree --name-only #{ref} #{paths.join(' ')}`.\n split(/\\n/).\n map { |relative_file| File.expand_path(relative_file) }.\n reject { |file| File.directory?(file) } # Exclude submodule directories\n end", "title": "" }, { "docid": "b1b0d4fbbd6a9ffbb6abfa75c2eb16fd", "score": "0.5419448", "text": "def files(type=nil)\n type += '/**' if type\n type ||= '**'\n Dir[snippet_directory + \"/#{type}/*.xml\"]\n end", "title": "" }, { "docid": "73949027a6d243e351c452eec59cd00b", "score": "0.53964496", "text": "def scanCPPFiles file_param\n\n\tif file_param == nil then return end\n\n\tno_ending = file_param.split(\".\")\n\tif File.exist? \"#{no_ending}.cpp\"\n\t\t$cppObjects.push(no_ending[0])\n\n\t\tf = File.open(\"#{no_ending[0]}.cpp\",\"r\").each_line { |line|\n\n\t\t\tline.scan(/^#include \"(.+)\"$/) do |w|\n\t\t\t\t$files_to_do.push(w)\n\t\t\tend\n\t\t}\n\t\t$files_to_do.flatten!\n\t\t$cppObjects.each do |word|\n\t\t\t$files_to_do.reject! {|repeat| repeat.split(\".\")[0] == word}\n\t\tend\n\tend\n\tif $files_to_do != nil then\n\t\t$files_to_do.uniq!\n\t\tscanCPPFiles $files_to_do.pop\n\tend\n\nend", "title": "" }, { "docid": "036a0fc666ed33dfb524bfad27314720", "score": "0.53879476", "text": "def all\n rootdir = Cfg.rootdir\n dirlist = [\"#{rootdir}/*/*\", \"#{rootdir}/*/*/*/*\"]\n filelist = [\"Packages\", \"Packages.gz\", \"Release\", \"Release.gpg\" ]\n files = []\n\n dirlist.each do |dirs|\n Dir.glob(dirs).each do |dir|\n filelist.each do |file|\n fullname = File.join(dir, file)\n files << fullname if File.exists? fullname\n end\n end\n end\n return files\n end", "title": "" }, { "docid": "6c4187cbec4c43b63b99074e3615f020", "score": "0.5376152", "text": "def formatted_file_list(title, source_files); end", "title": "" }, { "docid": "b530de26f7bad5ffb923020a3d803e45", "score": "0.53724056", "text": "def parse_files(options)\n \n file_info = []\n\n files = options.files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list(options, files, true)\n\n file_list.each do |fn|\n $stderr.printf(\"\\n%35s: \", File.basename(fn)) unless options.quiet\n \n content = File.open(fn, \"r\") {|f| f.read}\n\n top_level = TopLevel.new(fn)\n parser = ParserFactory.parser_for(top_level, fn, content, options, @stats)\n file_info << parser.scan\n @stats.num_files += 1\n end\n\n file_info\n end", "title": "" }, { "docid": "f31d36f743727d2fdbf59772e1e92ae7", "score": "0.5371591", "text": "def bundle_files(files)\n output = \"\"\n files.select { |f| !f.content.empty? }.each do |file|\n content = file.content\n path = file.path\n output << bundled_file_header(path) \n output << include_imported_files(content, path) if file.type[:ext] == 'css'\n content << javascript_fix if file.type[:ext] == '.js' \n output << content\n output << bundled_file_footer(path)\n end\n output\n end", "title": "" }, { "docid": "dfab99856d3a74083e90c83c4ffd5496", "score": "0.53656834", "text": "def parse_files\n @parse_files ||=\n begin\n files = expand_dirs_to_files(@path)\n files = file_sort(files)\n\n if @options['only'].present?\n files = file_accept(files, @options['only'])\n end\n\n # By default, tmp, vender, spec, test, features are ignored.\n %w[vendor spec test features tmp].each do |dir|\n files = file_ignore(files, File.join(@path, dir)) unless @options[dir]\n end\n\n # Exclude files based on exclude regexes if the option is set.\n @options['exclude'].each do |pattern|\n files = file_ignore(files, pattern)\n end\n\n %w[Capfile Gemfile Gemfile.lock].each do |file|\n files.unshift File.join(@path, file)\n end\n\n files.compact\n end\n end", "title": "" }, { "docid": "7775b9f3dcde34b5b8547281fc6ad594", "score": "0.5364071", "text": "def getFilesInDirCompiler(path)\n files = []\n #search for all of the files in the directory\n Dir.foreach(path) do |filename|\n #dont include parent files\n next if filename == '.' || filename == '..'\n\n #dont include files that are not jack files\n next unless filename.to_s.include?(\"jack\")\n\n #push the file to the list\n files.push(path+\"/\"+filename)\n end\n\n return files\nend", "title": "" }, { "docid": "821b7652aa68758e22ba54b5ba528e1d", "score": "0.5361897", "text": "def parse_files(*files)\n self.files = []\n seen_extra_files_marker = false\n \n files.each do |file|\n if file == \"-\"\n seen_extra_files_marker = true\n next\n end\n \n if seen_extra_files_marker\n add_extra_files(file)\n else\n self.files << file\n end\n end\n end", "title": "" }, { "docid": "477d66c3ddfb2298b994186851c1b12b", "score": "0.5359178", "text": "def generate_file_files\n setup\n\n page_file = @template_dir + 'page.rhtml'\n fileinfo_file = @template_dir + 'fileinfo.rhtml'\n\n # for legacy templates\n filepage_file = @template_dir + 'filepage.rhtml' unless\n page_file.exist? or fileinfo_file.exist?\n\n return unless\n page_file.exist? or fileinfo_file.exist? or filepage_file.exist?\n\n debug_msg \"Generating file documentation in #{@outputdir}\"\n\n out_file = nil\n current = nil\n\n @files.each do |file|\n current = file\n\n if file.text? and page_file.exist? then\n generate_page file\n next\n end\n\n template_file = nil\n out_file = @outputdir + file.path\n debug_msg \" working on %s (%s)\" % [file.full_name, out_file]\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n unless filepage_file then\n if file.text? then\n next unless page_file.exist?\n template_file = page_file\n @title = file.page_name\n else\n next unless fileinfo_file.exist?\n template_file = fileinfo_file\n @title = \"File: #{file.base_name}\"\n end\n end\n\n @title += \" - #{@options.title}\"\n template_file ||= filepage_file\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:current, current)\n here\n end\n end\n rescue => e\n error =\n RDoc::Error.new \"error generating #{out_file}: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end", "title": "" }, { "docid": "f2a5340166b589b0a89f47324b355c6e", "score": "0.53409165", "text": "def parse_files(options)\n files = options.files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list(options, files, true)\n\n return [] if file_list.empty?\n\n file_info = []\n width = file_list.map { |name| name.length }.max + 1\n\n file_list.each do |fn|\n $stderr.printf(\"\\n%*s: \", width, fn) unless options.quiet\n\n content = if RUBY_VERSION >= '1.9' then\n File.open(fn, \"r:ascii-8bit\") { |f| f.read }\n else\n File.read fn\n end\n\n if /coding:\\s*(\\S+)/ =~ content[/\\A(?:.*\\n){0,2}/]\n if enc = Encoding.find($1)\n content.force_encoding(enc)\n end\n end\n\n top_level = TopLevel.new(fn)\n parser = ParserFactory.parser_for(top_level, fn, content, options, @stats)\n file_info << parser.scan\n @stats.num_files += 1\n end\n\n file_info\n end", "title": "" }, { "docid": "2c61d5d3a2af8eeac5b3c0e1d2cfb9d7", "score": "0.53338957", "text": "def files(rootDir)\n Dir.foreach(rootDir) do |dir|\n if dir != \".\" && dir != \"..\"\n puts \"Processing \" + dir\n Dir.foreach(rootDir + \"/\" + dir) do |file|\n if file != \".\" && file != \"..\"\n open(rootDir + \"/\" + dir + \"/\" + file) do |f|\n yield(f)\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "b6c249c6af1eb0fd1cba7d1feb4ead01", "score": "0.5326931", "text": "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "title": "" }, { "docid": "eca4c7d49fbf85d1dc0c688f86901896", "score": "0.5326776", "text": "def merge(*files)\n files.each do |f|\n f = check_for_file(f)\n @merged << f\n end\n end", "title": "" }, { "docid": "08ffed25629a1af234a666b8a0ef74e4", "score": "0.53202766", "text": "def files(*args)\r\n LocalDirectory.current.files(*args)\r\n end", "title": "" }, { "docid": "0fd814cc034feae38d5b06579f61a697", "score": "0.5311771", "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": "bd53da1ce37fa3ed4ec9104145fdecfb", "score": "0.53089434", "text": "def files\n paths = %W{html/#{slug}.html html/*_fragment.html images/**/* config/*\n html/stylesheets/custom.css}\n Dir[*paths].map do |path|\n BookFile.new(path) unless File.directory?(path)\n end.compact\n end", "title": "" }, { "docid": "cbf0b51df5ae598ce90d4a6eb3549a51", "score": "0.5301755", "text": "def target_files_in_dir(base_dir = T.unsafe(nil)); end", "title": "" }, { "docid": "a94b6b0d2f337d961bdc0339a02092f6", "score": "0.5297172", "text": "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "title": "" }, { "docid": "b74c00a26ad7be428e238c9a4d92ace4", "score": "0.5294252", "text": "def find_swift_files(files=nil, excluded_files=[])\n # Assign files to lint\n files = files ? Dir.glob(files) : (git.modified_files - git.deleted_files) + git.added_files\n\n # Filter files to lint\n return files.\n # Ensure only swift files are selected\n select { |file| file.end_with?('.swift') }.\n # Make sure we don't fail when paths have spaces\n map { |file| Shellwords.escape(file) }.\n # Remove dups\n uniq.\n map { |file| File.expand_path(file) }.\n # Reject files excluded on configuration\n reject { |file|\n excluded_files.any? { |excluded| Find.find(excluded).include?(file) }\n }\n end", "title": "" }, { "docid": "ecf59072d3c739957c0d048920fd7405", "score": "0.5289938", "text": "def files_to_analyze\n require 'find'\n ignore_dirs = ['.git','bin','test','assets','lib','log','vendor','tmp','img', 'images', 'uploads', 'fonts']\n ignore_files = Regexp.union(/^\\..*$/i, /^.*(.md)$/i, /^.*(.json)$/i, /^.*(.yml)$/i, /^.*(.log)$/i, /^.*(.png)$/i, /^.*(.jpg)$/i, /^.*(.jpeg)$/i)\n final_files = []\n # for every file in repository - keep the files to process\n Find.find('.') do |path|\n path_name = File.basename(path)\n if FileTest.directory?(path)\n if ignore_dirs.include?(path_name)\n Find.prune\n else\n next\n end\n else\n if path_name.match(ignore_files)\n next\n else\n path.gsub!(/^\\.\\//, '')\n final_files.push(path)\n end\n end\n end\n return final_files\n end", "title": "" }, { "docid": "ba8244660d2e90e2bd371e744d63e152", "score": "0.5288613", "text": "def files_list(path_list: '', name_list: '')\n # Check\n path_list = [path_list] if path_list.class == String # transform String in Array\n name_list = [name_list] if name_list.class == String # transform String in Array\n path_list.uniq! # Remove duplicate\n name_list.uniq! # Remove duplicate\n (@log.fatal {'FileManager.files_list() : no path given'}; exit ) if :path_list.size == 0\n (@log.fatal {'FileManager.files_list() : no file list given'}; exit ) if :name_list.size == 0\n # Init\n file_array = []\n # Create the list\n for path in path_list\n for file in name_list\n files = Dir.glob(path + '/' + file)\n file_array = file_array + files\n @log.info {\" FileManager search for \\\"#{path}/#{file}\\\" => found : #{Dir.glob(path + '/' + file).size} file(s)\"}\n end\n end\n # Something wrong ?\n if file_array.size == 0\n @log.fatal {\"FileManager : no Input Files found by files_list().path_list : #{path_list.to_s} name_list #{name_list.to_s}\"}; exit\n else\n return file_array\n end\n end", "title": "" }, { "docid": "08e43cc949fcaeda974beeebd43db03a", "score": "0.5286818", "text": "def new_files(recursive=false)\n newfiles = Array.new\n list(recursive).each do |file|\n newfiles << file if !stored?(file) \n end\n return newfiles\n end", "title": "" }, { "docid": "8b968ec17e375769452d06d22f2c4731", "score": "0.52843386", "text": "def parse_files(options)\n files = options.files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list(options, files, true, options.exclude)\n\n return [] if file_list.empty?\n\n jobs = SizedQueue.new(number_of_threads * 3)\n workers = []\n file_info = []\n file_info_lock = Mutex.new\n\n Thread.abort_on_exception = true\n @stats = Stats.new(file_list.size, options.verbosity)\n @stats.begin_adding(number_of_threads)\n\n # Create worker threads.\n number_of_threads.times do\n thread = Thread.new do\n while (filename = jobs.pop)\n @stats.add_file(filename)\n content = read_file_contents(filename)\n top_level = ::RDoc::TopLevel.new filename\n\n parser = ::RDoc::Parser.for(top_level, filename, content, options,\n @stats)\n result = parser.scan\n\n file_info_lock.synchronize do\n file_info << result\n end\n end\n end\n workers << thread\n end\n\n # Feed filenames to the parser worker threads...\n file_list.each do |filename|\n jobs << filename\n end\n workers.size.times do\n jobs << nil\n end\n\n # ...and wait until they're done.\n workers.each do |thread|\n thread.join\n end\n\n @stats.done_adding\n\n file_info\n end", "title": "" }, { "docid": "c1ed3b96a686ddaa4fb90af3b7ba7813", "score": "0.5282912", "text": "def find_files()\n require 'find'\n directory = File.dirname(__FILE__) + '/../templates/' + @template\n @files = Array.new()\n Find.find(directory) do |f|\n if FileTest.file?f\n @files.push(f)\n end\n end\n @files\n end", "title": "" }, { "docid": "cfe185b713f8bd3a3232982f6eead9a1", "score": "0.5272154", "text": "def add_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"edit\", \"-c\", @number, *files)\n @perforce.run(\"add\", \"-c\", @number, *files)\n end\n end", "title": "" }, { "docid": "06656b9b1a7a21538b354ef44702e693", "score": "0.5270271", "text": "def rdoc(outputdir, files, charset = nil)\n\n # then rdoc\n require 'rdoc/rdoc'\n require 'rdoc/options'\n\n # load our parser\n require_relative 'rdoc/parser'\n\n r = RDoc::RDoc.new\n\n # specify our own format & where to output\n options = [ \"--fmt\", \"puppet\",\n \"--quiet\",\n \"--exclude\", \"/modules/[^/]*/spec/.*$\",\n \"--exclude\", \"/modules/[^/]*/files/.*$\",\n \"--exclude\", \"/modules/[^/]*/tests/.*$\",\n \"--exclude\", \"/modules/[^/]*/templates/.*$\",\n \"--op\", outputdir ]\n\n options << \"--force-update\"\n options += [ \"--charset\", charset] if charset\n options += files\n\n # launch the documentation process\n r.document(options)\n end", "title": "" }, { "docid": "c7e600b7c0909da8bff876bce62ce870", "score": "0.52700526", "text": "def create_list_of_files\n @path=find_repository_and_basepath\n @table.window.setTitle(@path)\n files=[]\n Find.find(@path) do |file|\n # we don't want any files from a repository in the list \n next if file=~/(\\.hg|\\.svn|\\.git|\\.pyc)/ \n\n # neither do we want dotfiles in the list\n next if File.basename(file)=~/^\\./ \n \n # file matches, add it to the resulting list\n files << file if FileTest.file?(file)\n\n # wir bauen hier mal einen kleinen Idiotentest ein. Wenn wir mehr\n # als 10000 Dateien gefunden haben dann sind wir vermtl. in einem \n # falschen Verzeichniss und brechen die Suche ab.\n if files.length>10000\n NSRunInformationalAlertPanel('Large directory found!',\n \"Gathered more than 10k files from directory '#{@path}', aborting search!\",'OK',nil,nil)\n NSApp.stop(self)\n raise 'error'\n end\n end\n #@files=files.sort_by { |match| File.basename(match) }\n @files=files.sort\n end", "title": "" }, { "docid": "df908b5e0ed43a7ecb6468ef2b15a04f", "score": "0.5266868", "text": "def scan_dirs(extension,dir,syntax_regex)\n declarations = []\n\n Search.find_all(extension,dir,@excludes) do |path|\n declarations << scan_doc(path,syntax_regex)\n end\n\n declarations.flatten!.sort!.uniq! unless declarations.empty?\n declarations\n end", "title": "" }, { "docid": "4cc5940f324da3274aa2208da2756bca", "score": "0.5257389", "text": "def rdoc(outputdir, files, charset = nil)\n Puppet[:ignoreimport] = true\n\n # then rdoc\n require 'rdoc/rdoc'\n require 'rdoc/options'\n\n # load our parser\n require 'puppet/util/rdoc/parser'\n\n r = RDoc::RDoc.new\n\n RDoc::RDoc::GENERATORS[\"puppet\"] = RDoc::RDoc::Generator.new(\n \"puppet/util/rdoc/generators/puppet_generator.rb\",\n \"PuppetGenerator\".intern,\n \"puppet\")\n\n # specify our own format & where to output\n options = [ \"--fmt\", \"puppet\",\n \"--quiet\",\n \"--exclude\", \"/modules/[^/]*/files/.*$\",\n \"--exclude\", \"/modules/[^/]*/templates/.*$\",\n \"--op\", outputdir ]\n\n options << \"--force-update\" if Options::OptionList.options.any? { |o| o[0] == \"--force-update\" }\n options += [ \"--charset\", charset] if charset\n options += files\n #TODO dedup file paths (not strict duplication sense, parents, children, etc\n\n # launch the documentation process\n r.document(options)\n rescue RDoc::RDocError => e\n raise Puppet::ParseError.new(\"RDoc error #{e}\")\n end", "title": "" }, { "docid": "92a790e91d216c1aacbd159d59929775", "score": "0.525329", "text": "def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end", "title": "" }, { "docid": "618c18c89f3b8abcf70a2b21dd130931", "score": "0.5235436", "text": "def files(dir = nil)\n return Fileset.from_glob(dir) unless dir.nil?\n input_files\n end", "title": "" }, { "docid": "a7f2fca9e52c330bde9034fa16d862d5", "score": "0.5233131", "text": "def try_files(*files)\n try_sources(files, :files)\n end", "title": "" }, { "docid": "5bcc64f9fc67e7440532a2d716326a41", "score": "0.5230106", "text": "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "title": "" }, { "docid": "2b85ff75e0be7d855bf8114fccc65149", "score": "0.5221273", "text": "def parse_files(*files); end", "title": "" } ]
5611bcbe9315908764e798951645a791
gets a valid dependency list works for any object type for tables, it also searches for foreign key refernces as well as plsql references.
[ { "docid": "4eb50a5a050095044548a65ab1ff612d", "score": "0.7837595", "text": "def get_dependencies(object_owner,object_name)\n tbl_dependency_sql = %q{ select UNIQUE b.table_name dependent_table\n from all_constraints a\n join all_constraints b\n on a.r_constraint_name = b.constraint_name\n where a.constraint_type = 'R'\n and a.owner = upper(:object_owner)\n and a.table_name = upper(:object_name)\n order by b.table_name \n }\n \n plsql_dependency_sql = %q{ select \n referenced_name,\n referenced_type\n from all_dependencies\n where owner = upper(:object_owner)\n and name = upper(:object_name)\n and substr(name,1,4) != 'BIN$'\n and substr(referenced_name,1,4) != 'BIN$'\n and referenced_type != 'NON-EXISTENT'\n order by referenced_name \n }\n \n object_type = determine_object_type(object_owner,object_name)\n \n final_sql = object_type == 'TABLE' ? tbl_dependency_sql : plsql_dependency_sql\n \n dependency_list = []\n\n self.exec(tbl_dependency_sql,object_owner,object_name) do |row|\n dependency_list.push({ :object_name => row[0], :object_type => row[1]||='TABLE'})\n end\n \n return dependency_list\n \n end", "title": "" } ]
[ { "docid": "7677dc6aaf7d51fb2af8e87c1de7094b", "score": "0.69694984", "text": "def get_dependencies\n sql = %Q{\n select *\n from all_dependencies dep\n where referenced_name = '#{@table}'\n }\n\n begin\n cursor = @connection.exec(sql)\n while rec = cursor.fetch_hash\n @dependencies << rec\n end\n ensure\n cursor.close if cursor\n end\n end", "title": "" }, { "docid": "f0a385f715c021b52b9d71956f9f9f8d", "score": "0.65510774", "text": "def _setup_identify_deps(dependencies, object_type, path = [])\n model_object = dependencies.rh_get(:objects, object_type)\n objects_list = PrcLib.model.meta_obj.rh_get(object_type, :params, :keys)\n if objects_list.nil?\n PrcLib.warning(\"'%s' as object type is not valid. Not declared.\")\n return [[], [], []]\n end\n\n objects = []\n attrs = []\n deps_attrs = []\n deps_objects = []\n new_path = path + [object_type]\n\n objects_list.each do |attr_path, attr_params|\n a, d_a, o, d_o = _setup_id_each(dependencies, model_object, new_path,\n attr_path, attr_params)\n attrs += a\n deps_attrs += d_a\n objects += o\n deps_objects += d_o\n end\n attrs.uniq!\n deps_attrs.uniq!\n objects.uniq!\n deps_objects.uniq!\n\n _sid_show_debug(3, format(\"'%s' has \", object_type) + '%s',\n attrs, objects)\n _sid_show_debug(4, format(\"'%s' has \", object_type) + 'also indirect %s',\n deps_attrs, deps_objects)\n\n [(objects + deps_objects).uniq, attrs, deps_attrs]\n end", "title": "" }, { "docid": "789e889d44f626fb8c007d2881d521f7", "score": "0.63269085", "text": "def dependency_list\n return @dependency_list if @dependency_list\n\n results = []\n each_strongly_connected_component{|component|\n if component.size == 1\n results << component.first\n else\n cycle = component.map{|x| x.source}.join(\" -> \")\n raise DependencyError.new(\"Dependencies #{cycle} could not be satisfied\")\n end\n }\n @dependency_list = results\n end", "title": "" }, { "docid": "4edac36b9abe83fefde3a9594cad7c8f", "score": "0.63159716", "text": "def dependencies\n klass = self.class\n\n tableized_id = klass.to_s.tableize + \".id\"\n\n join_clause = <<-QUERY\n INNER JOIN nite_dependencies \n ON ((#{tableized_id}=dependentable_a_id) OR (#{tableized_id}=dependentable_b_id)) \n AND (dependentable_type=\\\"#{klass}\\\" AND ((dependentable_a_id = #{self.id}) OR (dependentable_b_id = #{self.id})))\n QUERY\n\n klass.where(\"#{tableized_id}!=#{self.id}\").joins(join_clause)\n\n end", "title": "" }, { "docid": "1597ce91e831ca8ead2c782a1e39b2d1", "score": "0.62649316", "text": "def check_dependencies(type, desc)\n name = desc[:name]\n version = desc[:version]\n vendor = desc[:vendor]\n begin\n dependent_packages = Dependencies_mapping.where(\n {type => {'$elemMatch'=> {name: name,\n vendor: vendor,\n version: version}}})\n return dependent_packages\n rescue Mongoid::Errors::DocumentNotFound => e\n logger.error \"Descriptor #{name} #{version} #{vendor} dependent packages not found\"\n end\n end", "title": "" }, { "docid": "33248d05be01fe1bbc34d239d86af654", "score": "0.61647004", "text": "def setup_autoconfigured_dependencies\n self.reflections.each_value.inject([]) do |dependencies, reflection|\n dependencies << reflection.name if [:destroy, :delete_all].include?(reflection.options[:dependent])\n dependencies\n end\n end", "title": "" }, { "docid": "cf3d074de993fb2852a0b19e9a6b6952", "score": "0.6117079", "text": "def dependencies(table_name)\n reload_inheritance_data!\n @inheritance_dependencies[table_name]\n end", "title": "" }, { "docid": "597eec527f8a2d50bcd9cc7961d96372", "score": "0.60944325", "text": "def ensure_dependencies(list, base)\n with_options = list.extract_options!.to_a\n (list + with_options).map do |name, options|\n dependent_klass = base.model.auxiliary_statements_list[name]\n\n raise ArgumentError, <<-MSG.squish if dependent_klass.nil?\n The '#{name}' auxiliary statement dependency can't found on\n #{self.class.name}.\n MSG\n\n next if base.auxiliary_statements_values.any? do |cte|\n cte.is_a?(dependent_klass)\n end\n\n options ||= {}\n AuxiliaryStatement.build(name, base, bound_attributes, join_sources, **options)\n end\n end", "title": "" }, { "docid": "7169b5fa89cd65730a3b2cab68498230", "score": "0.6072681", "text": "def dependencies(type)\n type = type.to_sym\n deps = Dependencies.new\n deps.push(*superclass.dependencies(type)) if superclass.respond_to?(:dependencies)\n deps.push(*my_dependencies.select { |x| x.type == type })\n deps.uniq\n end", "title": "" }, { "docid": "65bd37bf396701ef007a455f93dea42f", "score": "0.60664445", "text": "def dependent_objects\n self.proxy_dependents.collect{ |dependent_type| instance_eval(dependent_type) }\n end", "title": "" }, { "docid": "47f85f3609a2973ef665cadecf60bed1", "score": "0.6053342", "text": "def needs(db)\n needed = []\n dependencies.each { |d|\n if db.retrieve_by_id(d).empty?\n needed << [d, 1]\n end\n }\n\n needed\n end", "title": "" }, { "docid": "afce54788242942066f932cc0e741f43", "score": "0.6041417", "text": "def dependency_list\n return @dependency_list if @dependency_list\n\n graph = edges.clone\n # will contain sorted elements\n l = []\n # start nodes, those with no incoming edges\n s = nodes.reject{|mf| mf.directives[:slinky_require]}\n while s.size > 0\n n = s.delete s.first\n l << n\n nodes.each{|m|\n e = graph.find{|e| e[0] == n && e[1] == m}\n next unless e\n graph.delete e\n s << m unless graph.any?{|e| e[1] == m}\n }\n end\n if graph != []\n problems = graph.collect{|e| e.collect{|x| x.source}.join(\" -> \")}\n raise DependencyError.new(\"Dependencies #{problems.join(\", \")} could not be satisfied\")\n end\n @dependency_list = l\n end", "title": "" }, { "docid": "339a90c0cf6f6a84267720f031ca008d", "score": "0.60399944", "text": "def dependencies\n @dependencies.map {|name| self.class.find(name) }\n end", "title": "" }, { "docid": "c48c5a016951425880b4cf5452bc68cf", "score": "0.6028318", "text": "def casted_dependents\n @casted_dependents ||= inheritance_dependents.map do |table_name|\n [table_name, connection.schema_cache.lookup_model(table_name)]\n end.to_h\n end", "title": "" }, { "docid": "7619f0fc003c8b0bfb7af0200f630876", "score": "0.60080016", "text": "def dependencies(_ctx)\n Set.new\n end", "title": "" }, { "docid": "d8a8da90d131fc9699ce954b33229dc3", "score": "0.60044944", "text": "def _setup_bs_objs_deps(dependencies, object_type)\n group = { :objs => nil, :attrs => nil }\n if dependencies.rh_exist?(:objects, object_type)\n group[:objs], group[:attrs] = _setup_objects_attr_needs(dependencies,\n object_type)\n return group\n end\n _setup_identify_dep_init(dependencies, object_type)\n group[:objs], _, group[:attrs] = _setup_identify_deps(dependencies,\n object_type)\n group\n end", "title": "" }, { "docid": "ef261b34b0c30a9cb36ce118914f6a7f", "score": "0.6004096", "text": "def referenced_objects\n objects.values.map(&:dependencies).flatten.uniq\n end", "title": "" }, { "docid": "fedcd5198efb1b45402b5490e8ca3e78", "score": "0.60033846", "text": "def get_dependencies(fidl, interaction_types, project_dependencies)\n BRIX11.log(3, '[%s] get dependencies : %s; interaction type(s) = %s', self, fidl, interaction_types.to_a)\n\n idl_prj_dependencies = fidl.project_dependencies\n\n # by default the stub dependencies apply\n project_dependencies.merge(idl_prj_dependencies, :idl_gen, :stub)\n\n # check all required interaction types\n unless interaction_types.nil?\n interaction_types.each do |int_type|\n get_interaction_dependencies(int_type, idl_prj_dependencies, project_dependencies)\n end\n end\n\n # recursively collect dependencies for included IDL\n fidl.includes.each do |ifidl|\n BRIX11.log(4, '[%s] process project dependency : include %s', self, ifidl)\n # only if this is a project member\n if ifidl.is_member?\n rcp = ifidl.recipes.first\n # get project dependencies for included IDL\n rcp.get_dependencies(ifidl, interaction_types, project_dependencies)\n end\n end\n end", "title": "" }, { "docid": "8018d7b39625ccf308a4e17c0c3a0a5b", "score": "0.6001179", "text": "def _setup_objects_attr_needs(dependencies, object_type)\n attrs = []\n\n objects = dependencies.rh_get(:objects, object_type, :objects)\n deps_objects = []\n objects.each do |o|\n attrs += dependencies.rh_get(:objects, o, :attrs)\n found_obj, deps_attrs = _setup_objects_attr_needs(dependencies, o)\n attrs += deps_attrs\n deps_objects += found_obj\n end\n [(objects + deps_objects).uniq, attrs.uniq]\n end", "title": "" }, { "docid": "734d515a47e5d7bd4f7cc92c5a7fd48d", "score": "0.5971533", "text": "def dependents\n ( [Feed, FeedEntry, List, Product, Recipe, PageRef, Referent].collect {|klass| klass.where(picture: @reference).to_a} +\n [Site, User].collect {|klass| klass.where(thumbnail: @reference).to_a} +\n Referment.where(referee: @reference).to_a\n ).flatten\n end", "title": "" }, { "docid": "17b41fefa4f82bf3882c00a16a95b905", "score": "0.5948047", "text": "def draft_reversion_dependencies\n dependencies = []\n\n case self.event.to_sym\n when :create\n associations = self.item.class.reflect_on_all_associations(:has_one) + self.item.class.reflect_on_all_associations(:has_many)\n\n associations.each do |association|\n if association.klass.draftable?\n # Reconcile different association types into an array, even if\n # `has_one` produces a single-item\n associated_dependencies =\n case association.macro\n when :has_one\n self.item.send(association.name).present? ? [self.item.send(association.name)] : []\n when :has_many\n self.item.send(association.name)\n end\n\n associated_dependencies.each do |dependency|\n dependencies << dependency.draft if dependency.draft?\n end\n end\n end\n when :destroy\n associations = self.item.class.reflect_on_all_associations(:belongs_to)\n\n associations.each do |association|\n association_class =\n if association.options.key?(:polymorphic)\n self.item.send(association.foreign_key.sub('_id', '_type')).constantize\n else\n association.klass\n end\n\n if association_class.draftable? && association_class.trashable? && association.name != association_class.draft_association_name.to_sym\n dependency = self.item.send(association.name)\n dependencies << dependency.draft if dependency.present? && dependency.draft? && dependency.draft.destroy?\n end\n end\n end\n\n dependencies\n end", "title": "" }, { "docid": "2de417954a3e8e2d0761b92f402e23a1", "score": "0.594134", "text": "def dependencies\n ensure_is_subclass\n @dependencies ||= Set.new\n @dependencies\n end", "title": "" }, { "docid": "4e6e435fdb14f49c0af7041718e9ecea", "score": "0.5928349", "text": "def collect_prerequisites(obj)\n prereqs = Array.new\n # visit the cascaded attributes\n @prereq_vstr.visit(obj) do |pref|\n # Check each mergeable attribute for prerequisites. The mergeable attributes includes\n # both cascaded and independent attributes. The selection block filters for independent\n # domain objects which don't have an identifier.\n @mergeable.call(pref).each_pair do |ma, mp|\n # Cascaded attributes are not prerequisite, since they are created when the owner is\n # created. The exception is if the owner will be updated but the dependent will not\n # be created upon owner update and the dependent does not reference the owner.\n # In that case, create the dependent before saving the owner. This ensures that the\n # owner saves the reference to the new dependent.\n # \n # Note that each non-prerequisite cascaded reference is still visited in order to ensure\n # that each independent object referenced by a cascaded reference is recognized as a\n # candidate prerequisite.\n if mp.cascaded? then\n unless pref.identifier.nil? or mp.inverse_property or mp.cascade_update_to_create? then\n pref.send(ma).enumerate do |mref|\n prereqs << mref if mref != obj and mref.identifier.nil?\n end\n end\n elsif not bidirectional_unsaved_independent_collection?(pref, mp) then\n # add qualified prerequisite attribute references\n pref.send(ma).enumerate do |mref|\n # Add each unsaved reference that is not a direct or indirect dependent.\n unless mref == obj or mref.identifier or mref.owner_ancestor?(obj) then\n prereqs << mref\n end\n end\n end\n end\n end\n # Remove duplicates.\n prereqs.uniq!\n prereqs\n end", "title": "" }, { "docid": "bb150062f6711d8a4d1eda5617602b6b", "score": "0.5909026", "text": "def dependencies(*args)\n @dependencies ||= []\n args.each do |dependency_type|\n unless @dependencies.include?(dependency_type)\n # Just-in-time require new dependency\n resolve_dependency(dependency_type)\n @dependencies << dependency_type\n end\n end\n @dependencies\n end", "title": "" }, { "docid": "478f410e15d039adde29a609929cc07c", "score": "0.58980477", "text": "def inheritance_dependents\n connection.schema_cache.associations(table_name) || []\n end", "title": "" }, { "docid": "f93b184e43f67a6ac4cab151aef1f42b", "score": "0.589144", "text": "def dependencies\n []\n end", "title": "" }, { "docid": "30b9120e5d5ea5dba406982d11251ea9", "score": "0.5858495", "text": "def is_dependency_for\n key = id\n if key\n self.class.where(\n \"dependencies LIKE ? OR dependencies LIKE ? OR dependencies LIKE ? OR dependencies LIKE ?\",\n \"#{key}\",\n \"#{key},%\",\n \"%, #{key},%\",\n \"%, #{key}\"\n )\n else\n return self.class.none\n end\n end", "title": "" }, { "docid": "79af2d6e932b36b9001aff92d658b1a9", "score": "0.5808041", "text": "def ensure_dependencies!(base)\n requires.each do |dependent|\n dependent_klass = base.model.auxiliary_statements_list[dependent]\n next if base.auxiliary_statements_values.any? do |cte|\n cte.is_a?(dependent_klass)\n end\n\n instance = AuxiliaryStatement.instantiate(dependent, base)\n instance.ensure_dependencies!(base)\n base.auxiliary_statements_values += [instance]\n end\n end", "title": "" }, { "docid": "7373f6399c5aec0474f0c47b56bc88cb", "score": "0.5807078", "text": "def dependencies!\n []\n end", "title": "" }, { "docid": "5543dce434a59d93e4e7e12d8ceb1d98", "score": "0.58028245", "text": "def dependencies\n []\n end", "title": "" }, { "docid": "e67ab747382ebcd39aca7f05fac637b2", "score": "0.57952726", "text": "def resolve_dependencies\n\n\t \t@dependencies=[]\n\t \tparams[:dependencies].each do |dep|\n\t\t\t\tServiceMgr::instance.match_services(dep.service).each do |k,v|\n\t\t\t\t\t@dependencies << { :service => v, :dep => dep }\n\t\t\t\tend\n\t \tend\n\t end", "title": "" }, { "docid": "9d98ec352bed9819126f0c388a77bd8b", "score": "0.57934034", "text": "def dependencies recursive = nil\n if recursive\n resolver.component_dependencies self # FIXME\n else\n requires.map { |f| f.resolved_component }\n end\n end", "title": "" }, { "docid": "3f94541bfc6690b63989b935cf10f68a", "score": "0.57921696", "text": "def dependencies\n @dependencies ||= []\n end", "title": "" }, { "docid": "16cbdb842282c40a3f3109f99ff78546", "score": "0.5789723", "text": "def foreign_key_list(table, opts=OPTS)\n m = output_identifier_meth\n im = input_identifier_meth\n schema, table = schema_and_table(table)\n current_schema = m.call(get(Sequel.function('schema_name')))\n fk_action_map = FOREIGN_KEY_ACTION_MAP\n fk = Sequel[:fk]\n fkc = Sequel[:fkc]\n ds = metadata_dataset.from(Sequel.lit('[sys].[foreign_keys]').as(:fk)).\n join(Sequel.lit('[sys].[foreign_key_columns]').as(:fkc), :constraint_object_id => :object_id).\n join(Sequel.lit('[sys].[all_columns]').as(:pc), :object_id => fkc[:parent_object_id], :column_id => fkc[:parent_column_id]).\n join(Sequel.lit('[sys].[all_columns]').as(:rc), :object_id => fkc[:referenced_object_id], :column_id => fkc[:referenced_column_id]).\n where{{object_schema_name(fk[:parent_object_id]) => im.call(schema || current_schema)}}.\n where{{object_name(fk[:parent_object_id]) => im.call(table)}}.\n select{[fk[:name], \n fk[:delete_referential_action], \n fk[:update_referential_action], \n pc[:name].as(:column), \n rc[:name].as(:referenced_column), \n object_schema_name(fk[:referenced_object_id]).as(:schema), \n object_name(fk[:referenced_object_id]).as(:table)]}.\n order(fk[:name], fkc[:constraint_column_id])\n h = {}\n ds.each do |row|\n if r = h[row[:name]]\n r[:columns] << m.call(row[:column])\n r[:key] << m.call(row[:referenced_column])\n else\n referenced_schema = m.call(row[:schema])\n referenced_table = m.call(row[:table])\n h[row[:name]] = { :name => m.call(row[:name]), \n :table => (referenced_schema == current_schema) ? referenced_table : Sequel.qualify(referenced_schema, referenced_table),\n :columns => [m.call(row[:column])], \n :key => [m.call(row[:referenced_column])], \n :on_update => fk_action_map[row[:update_referential_action]], \n :on_delete => fk_action_map[row[:delete_referential_action]] }\n end\n end\n h.values\n end", "title": "" }, { "docid": "3d02a44928e22577ddcf1a992f0cf587", "score": "0.57619697", "text": "def dependencies\n @dependencies ||= []\n end", "title": "" }, { "docid": "08d590fe7c587573a8306e93103b4ece", "score": "0.5741621", "text": "def get_connected_dtk_component_ids(link_def_type)\n ret = []\n # It is assumed that the dependencies have been added to @dtk_component\n unless dependencies = @dtk_component[:dependencies]\n Log.error(\"Unexpected that no dependencies in #{@dtk_component.inspect}\") \n return ret\n end\n matching_deps = dependencies.select { |dep| (dep.link_def || {})[:link_type] == link_def_type }\n matching_deps.map { |dep| dep.satisfied_by_component_ids }.flatten(1)\n end", "title": "" }, { "docid": "e0066d6a75aa2a518c615f7ddf0172ed", "score": "0.5739797", "text": "def find_expl_dependencies(nodes = Array[root])\n nodes.each { |node|\n if [:lasgn, :attrasgn].include? node.node_type\n v = node.get_variable\n if v != []\n node.expl_dependencies += v\n @dependency_table[node.name] +=\n v.reject { |variable| variable.name == node.name}\n end\n elsif node.node_type == :lval\n node.expl_dependencies << node\n else\n find_expl_dependencies(node.sons)\n end\n if node.sons.first != nil and node.sons.first.node_type == :call\n node.sons.first.expl_dependencies += node.expl_dependencies\n end\n }\n end", "title": "" }, { "docid": "a5fa52b5c5c709998ef2eeaccd59fb7f", "score": "0.5738407", "text": "def referenced_models( model )\n model.schema_definition.properties.values.select do |s| \n s.is_a?(Respect::HasOneSchema) || s.is_a?(Respect::HasManySchema)\n end.map(&:of)\n end", "title": "" }, { "docid": "4f36c014712c95f76918c99bb0546a8a", "score": "0.5733804", "text": "def any_restrict_dependecy?(model_object) \n dependecie_models = Array.new\n model_object.class.reflect_on_all_associations(:has_many).each do |hm| \n if model_object.method(hm.name.to_sym).call.any? and hm.options[:dependent] == :restrict\n model_object.method(hm.name.to_sym).call.each do |d|\n dependecie_models << \" \".concat(d.class.to_s.constantize.model_name.human.pluralize) unless dependecie_models.include?(\" \".concat(d.class.to_s.constantize.model_name.human.pluralize)) \n end\n return dependecie_models\n end\n end \n false\n end", "title": "" }, { "docid": "85aaec34b44238ba342b9de7b2d0014c", "score": "0.57326084", "text": "def referenced_tables(tables)\n rows = self.select_all(<<-end_sql)\n select distinct referencing.relname as referencing_table, referenced.relname as referenced_table\n from pg_class referencing\n left join pg_constraint on referencing.oid = pg_constraint.conrelid\n left join pg_class referenced on pg_constraint.confrelid = referenced.oid\n where referencing.relkind='r'\n and referencing.relname in ('#{tables.join(\"', '\")}')\n and referencing.relnamespace IN\n (SELECT oid FROM pg_namespace WHERE nspname in (#{schemas}))\n end_sql\n result = {}\n rows.each do |row|\n unless result.include? row['referencing_table']\n result[row['referencing_table']] = []\n end\n if row['referenced_table'] != nil\n result[row['referencing_table']] << row['referenced_table']\n end\n end\n result\n end", "title": "" }, { "docid": "5318eea6ead45bb4fe3d9eadc2302028", "score": "0.57296765", "text": "def dependencies\n @dependencies ||= []\n end", "title": "" }, { "docid": "5318eea6ead45bb4fe3d9eadc2302028", "score": "0.57291126", "text": "def dependencies\n @dependencies ||= []\n end", "title": "" }, { "docid": "df90a0a8e12cacd26f5e24a8a2d6113c", "score": "0.57227695", "text": "def _validate_dependencies!(name)\n raise UnknownQuery, \"`#{name}`\" unless @parts.key?(name)\n dependencies = []\n\n @parts[name].parameters.each do |(_, pname)|\n unless @parts.key?(pname)\n raise UnknownQuery, \"`#{pname}` referenced by `#{name}`\"\n end\n\n dependencies << pname\n end\n\n dependencies\n end", "title": "" }, { "docid": "675c142d1bcc93ea43325f97b75f67df", "score": "0.5716538", "text": "def foreign_keys\n\n # Get the ForeignKey object for each absorbed reference path\n @foreign_keys ||=\n begin\n fk_ref_paths = all_absorbed_foreign_key_reference_path\n fk_ref_paths.map do |fk_ref_path|\n trace :fk, \"\\nFK: \" + fk_ref_path.map{|fk_ref| fk_ref.reading }*\" and \" do\n\n from_columns = (columns||all_columns({})).select{|column|\n column.references[0...fk_ref_path.size] == fk_ref_path\n }\n trace :fk, \"from_columns = #{from_columns.map { |column| column.name }*\", \"}\"\n\n # Figure out absorption on the target end:\n to = fk_ref_path.last.to\n if to.absorbed_via\n trace :fk, \"Reference target #{fk_ref_path.last.to.name} is absorbed via:\" do\n while (r = to.absorbed_via)\n m = r.reversed\n trace :fk, \"#{m.reading}\"\n fk_ref_path << m\n to = m.from == to ? m.to : m.from\n end\n trace :fk, \"Absorption ends at #{to.name}\"\n end\n end\n\n # REVISIT: This test may no longer be necessary\n raise \"REVISIT: #{fk_ref_path.inspect} is bad\" unless to and to.columns\n\n # REVISIT: This fails for absorbed subtypes having their own identification.\n # Check the CompanyDirectorEmployee model for example, EmployeeManagerNr -> Person (should reference EmployeeNr)\n # Need to use the absorbed identifier_columns of the subtype,\n # not the columns of the supertype that absorbs it.\n # But in general, that isn't going to work because in most DBMS\n # there's no suitable uniquen index on the subtype's identifier_columns\n\n to_columns = fk_ref_path[-1].to.identifier_columns\n\n # Put the column pairs in the correct order. They MUST be in the order they appear in the primary key\n froms, tos = from_columns.zip(to_columns).sort_by { |pair|\n to_columns.index(pair[1])\n }.transpose\n\n fk = ActiveFacts::RMap::ForeignKey.new(self, to, fk_ref_path, froms, tos)\n to.foreign_keys_to << fk\n fk\n end\n end.\n sort_by do |fk|\n # Put the foreign keys in a defined order:\n# debugger if !fk.to_columns || fk.to_columns.include?(nil) || !fk.from_columns || fk.from_columns.include?(nil)\n [ fk.to.name,\n fk.to_columns.map{|col| col.name(nil).sort},\n fk.from_columns.map{|col| col.name(nil).sort}\n ]\n end\n end\n\n end", "title": "" }, { "docid": "b2eded850045b4d8c69b558998606f5e", "score": "0.5713073", "text": "def gather_dependencies\n specs = @specs_and_sources.map { |spec,_| spec }\n\n dependency_list = Gem::DependencyList.new\n dependency_list.add(*specs)\n\n unless @ignore_dependencies then\n to_do = specs.dup\n seen = {}\n\n until to_do.empty? do\n spec = to_do.shift\n next if spec.nil? or seen[spec.name]\n seen[spec.name] = true\n\n spec.dependencies.each do |dep|\n results = find_gems_with_sources(dep).reverse # local gems first\n\n results.each do |dep_spec, source_uri|\n next if seen[dep_spec.name]\n @specs_and_sources << [dep_spec, source_uri]\n dependency_list.add dep_spec\n to_do.push dep_spec\n end\n end\n end\n end\n\n @gems_to_install = dependency_list.dependency_order.reverse\n end", "title": "" }, { "docid": "281ac6e7ee92702b880a89d919874dec", "score": "0.5711409", "text": "def definitions(type, name)\n key = key(type, name)\n entry = @objects_table.fetch(key) { raise \"internal error. Object #{type} #{name} not found\" }\n entry.xref.filter_map { |e| e.instance_of?(Connect::Xdef) ? [e.file_name, e.lineno] : nil }\n end", "title": "" }, { "docid": "4753475f0b6164b0bb401f68c3ee7fd8", "score": "0.5705066", "text": "def check_dependencies(spec, errors)\n spec.dependencies.each do |dep|\n set = source.search(dep)\n unless set && set.specification\n errors << \"Unable to find a specification for the `#{dep}` \" \\\n 'dependency.'\n end\n end\n end", "title": "" }, { "docid": "dc81910592359b772767cbc4d89f9b89", "score": "0.5678257", "text": "def required_component_dependencies\n resolve_components!\n\n validate_components!\n\n component_dependencies required_components.to_a\n end", "title": "" }, { "docid": "63d37f5042fce54b72140018bf8ee68f", "score": "0.56745744", "text": "def expand_dependencies(obj)\n if obj[:is_leaf] \n rough_deps = obj.delete(:deps)\n real_deps = []\n\n rough_deps.each do |dep|\n # we're considering a dep like \"dbug.js\" or \"../../mootools\" or \"Browser/IframeShim.js\",\n # and we need to convert that into an array of object references to other files.\n # \"dbug.js\" => [the dbug.js hash]\n # \"../../mootools\" => [for each js hash in mootools folder, the js hash]\n real_deps.concat(collect_real_deps(obj, \"../#{dep}\"))\n end\n\n obj[:real_deps] = real_deps\n\n else\n each_resource(obj) do |item, props|\n expand_dependencies(props)\n end\n end\n end", "title": "" }, { "docid": "935b256f99153f96d57ebe5b5642766a", "score": "0.5669602", "text": "def dependencies\n @dependencies ||= self.class.requires.map { |k|\n k.new(fix: @fix, context: @context, shell: @shell, **@options)\n }\n end", "title": "" }, { "docid": "7bc361f60cfcb15d0e5e55677ad46fcd", "score": "0.5663511", "text": "def graph_dependencies(l, mode: :both)\n\t\t\t\t\tmanual_deps=Hash.new([])\n\t\t\t\t\tcase @ptype\n\t\t\t\t\twhen :python_pip2, :python_pip3\n\t\t\t\t\t\t#these are installed when bootstrapping pip but do not appear\n\t\t\t\t\t\t#in the Require: field. I think they may be safely removed\n\t\t\t\t\t\t#after installation of pip?\n\t\t\t\t\t\tmanual_deps.merge!({'pip' => %w(wheel setuptools)})\n\t\t\t\t\twhen :perl_cpan\n\t\t\t\t\t\t#these deps are no longer needed (Module::Build is included in perl5.10, and cpanm now use an http api)\n\t\t\t\t\t\t#manual_deps.merge!({'App::cpanminus' => %w(CPAN::Meta Module::Build), 'WebService::MusicBrainz' => [ \"Class::Accessor\", \"XML::LibXML\", \"XML::NamespaceSupport\", \"XML::SAX\" ], })\n\t\t\t\t\tend\n\t\t\t\t\tr={}\n\t\t\t\t\tl.each do |pkg|\n\t\t\t\t\t\tchildren=[]\n\t\t\t\t\t\tchildren |= package_dependency(pkg) if mode != :manual\n\t\t\t\t\t\tchildren |= manual_deps[pkg] if mode != :auto\n\t\t\t\t\t\tchildren=children.sort.uniq.select {|child| l.include?(child)}\n\t\t\t\t\t\tr[pkg]=children\n\t\t\t\t\tend\n\t\t\t\t\treturn Graph.new(r)\n\t\t\t\tend", "title": "" }, { "docid": "2c72e048e4b7a49b335a83ab772662bd", "score": "0.5662694", "text": "def draft_publication_dependencies\n dependencies = []\n\n my_item =\n if Draftsman.stash_drafted_changes? && self.item.draft?\n self.item.draft.reify\n else\n self.item\n end\n\n case self.event.to_sym\n when :create, :update\n associations = my_item.class.reflect_on_all_associations(:belongs_to)\n\n associations.each do |association|\n association_class =\n if association.options.key?(:polymorphic)\n my_item.send(association.foreign_key.sub('_id', '_type')).constantize\n else\n association.klass\n end\n\n if association_class.draftable? && association.name != association_class.draft_association_name.to_sym\n dependency = my_item.send(association.name)\n dependencies << dependency.draft if dependency.present? && dependency.draft? && dependency.draft.create?\n end\n end\n when :destroy\n associations = my_item.class.reflect_on_all_associations(:has_one) + my_item.class.reflect_on_all_associations(:has_many)\n\n associations.each do |association|\n if association.klass.draftable?\n # Reconcile different association types into an array, even if `has_one` produces a single-item\n associated_dependencies =\n case association.macro\n when :has_one\n my_item.send(association.name).present? ? [my_item.send(association.name)] : []\n when :has_many\n my_item.send(association.name)\n end\n\n associated_dependencies.each do |dependency|\n dependencies << dependency.draft if dependency.draft?\n end\n end\n end\n end\n\n dependencies\n end", "title": "" }, { "docid": "231396ec9cb471fffdab5c9b28d29d8b", "score": "0.5640374", "text": "def foreign_keys\n fk_ref_paths = all_absorbed_foreign_key_reference_path\n\n # Get the ForeignKey object for each absorbed reference path\n fk_ref_paths.map do |fk_ref_path|\n debug :fk, \"\\nFK: \" + fk_ref_path.map{|fk_ref| fk_ref.reading }*\" and \" do\n\n from_columns = (columns||all_columns({})).select{|column|\n column.references[0...fk_ref_path.size] == fk_ref_path\n }\n debug :fk, \"from_columns = #{from_columns.map { |column| column.name }*\", \"}\"\n\n absorption_path = []\n to = fk_ref_path.last.to\n # REVISIT: There should be a better way to find where it's absorbed (especially since this fails for absorbed subtypes having their own identification!)\n while (r = to.absorbed_via)\n absorption_path << r\n to = r.to == to ? r.from : r.to\n end\n raise \"REVISIT: #{fk_ref_path.inspect} is bad\" unless to and to.columns\n\n unless absorption_path.empty?\n debug :fk, \"Reference target #{fk_ref_path.last.to.name} is absorbed into #{to.name} via:\" do\n debug :fk, \"#{absorption_path.map(&:reading)*\" and \"}\"\n end\n end\n\n debug :fk, \"Looking at absorption depth of #{absorption_path.size} in #{to.name} for to_columns for #{from_columns.map(&:name)*\", \"}:\"\n to_supertypes = to.supertypes_transitive\n to_columns = from_columns.map do |from_column|\n debug :fk, \"\\tLooking for counterpart of #{from_column.name}: #{from_column.comment}\" do\n target_path = absorption_path + from_column.references[fk_ref_path.size..-1]\n debug :fk, \"\\tcounterpart MUST MATCH #{target_path.map(&:reading)*\" and \"}\"\n c = to.columns.detect do |column|\n debug :fk, \"Considering #{column.references.map(&:reading) * \" and \"}\"\n debug :fk, \"exact match: #{column.name}: #{column.comment}\" if column.references == target_path\n # Column may be inherited into \"to\", in which case target_path is too long.\n cr = column.references\n allowed_type = fk_ref_path.last.to\n #debug :fk, \"Check for absorption, need #{allowed_type.name}\" if cr != target_path\n cr == target_path or\n cr == target_path[-cr.size..-1] &&\n !target_path[0...-cr.size].detect do |ref|\n ft = ref.fact_type\n next true if allowed_type.absorbed_via != ref # Problems if it doesn't match\n allowed_type = ref.from\n false\n end\n end\n raise \"REVISIT: Failed to find conterpart column for #{from_column.name}\" unless c\n c\n end\n end\n debug :fk, \"to_columns in #{to.name}: #{to_columns.map { |column| column ? column.name : \"OOPS!\" }*\", \"}\"\n\n # Put the column pairs in a defined order, sorting key pairs by to-name:\n froms, tos = from_columns.zip(to_columns).sort_by { |pair|\n pair[1].name(nil)\n }.transpose\n\n ActiveFacts::Persistence::ForeignKey.new(self, to, fk_ref_path[-1], froms, tos)\n end\n end.\n sort_by do |fk|\n # Put the foreign keys in a defined order:\n [ fk.to.name,\n fk.to_columns.map{|col| col.name(nil).sort},\n fk.from_columns.map{|col| col.name(nil).sort}\n ]\n end\n end", "title": "" }, { "docid": "041a95eaf8f1cb58a14d88d007a59320", "score": "0.56355333", "text": "def get_dependencies\n []\n end", "title": "" }, { "docid": "7eb9541dac7a926c2e274687c74bfdba", "score": "0.56343144", "text": "def dependency_classes\n res = []\n\n eagerly_loaded_components.keys.each do |aggr|\n res += component_instance(aggr).dependency_classes\n end\n\n res += self.class.class_ancestors\n\n res << self.class\n res.uniq\n end", "title": "" }, { "docid": "f091f36a81c83edf6a00a939e1a5aee7", "score": "0.5633288", "text": "def check_list\n if Dependency.recursion?(@session_dependency)\n raise BakerError, \"recipe recursion detected\"\n end\n problem_list = Dependency.missing_dependencies(@session_dependency)\n if !problem_list.empty?\n raise DependencyError, \"missing dependencies: #{problem_list.join(',')}\"\n end\n problem_list = Dependency.resource_conflicts(@session_dependency)\n if !problem_list.empty?\n raise ConflictError, \"recipe conflicts: #{problem_list.join(',')}\"\n end\n problem_list = Dependency.install_conflicts(@session_dependency)\n if !problem_list.empty?\n raise ConflictError, \"installed conflicts: #{problem_list.join(',')}\"\n end\n end", "title": "" }, { "docid": "c7cf7980211f7229b2cca37025da8cd6", "score": "0.56169957", "text": "def _setup_identify_dep_init(dependencies, object_type, path = [])\n if path.include?(object_type)\n PrcLib.warning('Loop detection: Be careful! a loop is detected with'\\\n \" the dependency from '%s' to '%s'. \"\\\n 'Dependency ignored.', path.join('/'), object_type)\n return false\n end\n\n return false if dependencies.rh_exist?(:objects, object_type)\n\n model_object = { :objects => [], :objects_attrs => [], :attrs => [] }\n\n dependencies.rh_set(model_object, :objects, object_type)\n true\n end", "title": "" }, { "docid": "1036943d6c24b4f86473edb6859055c9", "score": "0.5609998", "text": "def dependencies\n return @dependencies ||= []\n end", "title": "" }, { "docid": "87f3fbfa9f8a64c2859a54e94132861e", "score": "0.55966204", "text": "def target_definition_list\n @dependencies_by_target_definition.keys\n end", "title": "" }, { "docid": "9808c051f7ee31d55fe72df3ffa78b0d", "score": "0.5589429", "text": "def all_depends\n result = @depends\n # Fetch all from children\n @depends.each do |nested_type|\n # Yes, converting back to set here does some duplicate sorting.\n # But here, performance really isn't our concern.\n result += Set.new(nested_type.all_depends)\n end\n # Return the results as a sorted array\n Array(result).sort_by(&:name)\n end", "title": "" }, { "docid": "5ae7f79d54823b012184e6435276ad5f", "score": "0.5573308", "text": "def fetch_vulnerable_dependencies(dependencies)\n results = []\n grouped = match_vulnerable_dependencies(dependencies).group_by { |d| d[:ID] }\n grouped.each do |_key, values|\n vuln = {}\n values.each do |v|\n vuln = v if v[:Database] == GITHUB_DATABASE_STRING\n end\n results.append(vuln.empty? ? values[0] : vuln)\n end\n\n results\n end", "title": "" }, { "docid": "b0c74be403be10028e2a18484746ac15", "score": "0.5571987", "text": "def depends_on\n if self.depends\n self.depends.split(', ').sort.inject([]) do |res, name|\n if p = self.search_class_name.where(name: name.split(/ /)[0]).first\n res << p\n else\n logger.info(\"No package #{name.split(/ /)[0]} for #{self.depends} in #{self.inspect}\")\n end\n res\n end\n else\n []\n end\n end", "title": "" }, { "docid": "234539906c9ece8c8e9bac8c9cc749b8", "score": "0.5568463", "text": "def dependencies\n # The base presenter doesn't have any dependencies.\n return SortedSet.new if self == Curly::Presenter\n\n @dependencies ||= SortedSet.new\n @dependencies.union(superclass.dependencies)\n end", "title": "" }, { "docid": "959463b49cbcaf4dd6fb9a0a04309ff9", "score": "0.5559773", "text": "def dependencies\n []\n end", "title": "" }, { "docid": "cd140fa391c9aa2c73ffea0fe646ff90", "score": "0.5557749", "text": "def tables_with_referential_integrity\n schemas_and_tables = select_rows <<~SQL.squish\n SELECT DISTINCT s.name, o.name\n FROM sys.foreign_keys i\n INNER JOIN sys.objects o ON i.parent_object_id = o.OBJECT_ID\n INNER JOIN sys.schemas s ON o.schema_id = s.schema_id\n SQL\n schemas_and_tables.map do |schema_table|\n schema, table = schema_table\n \"#{SQLServer::Utils.quoted_raw(schema)}.#{SQLServer::Utils.quoted_raw(table)}\"\n end\n end", "title": "" }, { "docid": "cdf62c77c6197a656973132433c9e8e4", "score": "0.55542856", "text": "def all_dependency_constraints\n dependency_constraints_rec.values\n end", "title": "" }, { "docid": "57670bda67db5a647dfdbf2587744697", "score": "0.5550875", "text": "def create_foreign_key_list(db)\n nouse_foreign_key_list = []\n foreign_key_list = Hash.new { |h, k| h[k] = [] }\n db.tables.each do |tbl|\n next if @ignore_tables.include? tbl\n\n nouse_foreign_key_list << tbl\n db.foreign_key_list(tbl).each do |fk|\n # hash key: referensed table\n # hash value: refer tables\n foreign_key_list[fk[:table]] << tbl\n end\n end\n [foreign_key_list, nouse_foreign_key_list]\n end", "title": "" }, { "docid": "b9802688c0ab36498a456d3ced80ab62", "score": "0.5540096", "text": "def list_component_dependencies(component)\n component.build_requires.select { |dep| components.map(&:name).include?(dep) }\n end", "title": "" }, { "docid": "6f41662366120b32e38985dff749f033", "score": "0.55315024", "text": "def all_obj_dependencies obj\n\t\tcpp = resolve_obj_source_file(obj)\n\t\t# Build a list of hpp files \n\t\thpp = source_dependencies(cpp)\n\t\tloop do \n\t\t\t# Go one level deeper excluding those done already\n\t\t\tnew_files = []\n\t\t\thpp.each do |h| \n\t\t\t\t# We don't want to process twice the same file \n\t\t\t\t# to avoid infinite loops\n\t\t\t\tnew_files += (source_dependencies(h) - hpp - new_files)\n\t\t\tend\n\t\t\t# repeat until nothing comes out\n\t\t\tbreak if new_files == []\n\t\t\thpp += new_files\n\t\tend\n\t\tobj_directory_structure + hpp + [cpp]\n\tend", "title": "" }, { "docid": "56a6a40a96dad9269da1808780adf722", "score": "0.55116546", "text": "def recursive_dependencies\n result = []\n queue = dependencies.dup\n until queue.empty?\n pr = queue.shift\n next if result.include?(pr) || pr == self\n\n result << pr\n queue.concat(pr.dependencies)\n end\n\n result\n end", "title": "" }, { "docid": "b09f26e743778a134d2c8677273a9f07", "score": "0.5508656", "text": "def check_dependencies\n h = { :met => [], :unmet => [] }\n dependencies.each do |dep|\n\n arr = Plugin.available_plugins.select { |cls|\n cls.meets_dependency?(dep[:name], dep[:op], dep[:version])\n }\n\n (arr.empty?) ? h[:unmet] << dep : h[:met] << arr.last\n end\n h\n end", "title": "" }, { "docid": "2d12db64d40929c475331b9cacc36966", "score": "0.5479882", "text": "def find_dependencies \n\n\nend", "title": "" }, { "docid": "e8c079dcbfc8fe7729f42055929983bf", "score": "0.54732627", "text": "def relations\n dependents + dependencies\n end", "title": "" }, { "docid": "1ae12380103bdb97281639185372076d", "score": "0.54682547", "text": "def foreign_key_list(table, opts=OPTS)\n m = output_identifier_meth\n schema, table = metadata_schema_and_table(table, opts)\n foreign_keys = {}\n metadata(:getImportedKeys, nil, schema, table) do |r|\n if fk = foreign_keys[r[:fk_name]]\n fk[:columns] << [r[:key_seq], m.call(r[:fkcolumn_name])]\n fk[:key] << [r[:key_seq], m.call(r[:pkcolumn_name])]\n elsif r[:fk_name]\n foreign_keys[r[:fk_name]] = {:name=>m.call(r[:fk_name]), :columns=>[[r[:key_seq], m.call(r[:fkcolumn_name])]], :table=>m.call(r[:pktable_name]), :key=>[[r[:key_seq], m.call(r[:pkcolumn_name])]]}\n end\n end\n foreign_keys.values.each do |fk|\n [:columns, :key].each do |k|\n fk[k] = fk[k].sort.map{|_, v| v}\n end\n end\n end", "title": "" }, { "docid": "959e51949ffed71d093445efecf542a0", "score": "0.5450251", "text": "def get_dep_libs_list\n\t\tdep_libs_list = Array.new\n\t\t@dep_libs.each do |dep_lib|\n\t\t\tdep_libs_list.push(dep_lib)\n\t\tend\n\t\treturn dep_libs_list\n\tend", "title": "" }, { "docid": "eb35968d5eee35993d0e545c01ae384c", "score": "0.54501164", "text": "def resolve_dependencies\n if parent.check_dependecies(self)\n raise BakerError, \"dependency recursion\"\n end\n puts \"resolving dependencies for #{self.name}\" if $DEBUG\n dep_names = dependencies | applicable_compliment | applicable_supplement\n resolved, @unresolved_dependencies = Catalog.instance.resolve_names(dep_names)\n @resolved_dependencies = resolved.collect{|rn| Catalog.instance.get(rn, self)}\n end", "title": "" }, { "docid": "c96f1d1c89f7e0a71a65ae0795914e97", "score": "0.54440814", "text": "def dependencies\n @dependencies.values\n end", "title": "" }, { "docid": "c96f1d1c89f7e0a71a65ae0795914e97", "score": "0.54440814", "text": "def dependencies\n @dependencies.values\n end", "title": "" }, { "docid": "770c361191c0d161129ebcf021e23abd", "score": "0.5442335", "text": "def get_foreign_keys\n @constraints.each{ |hash|\n if hash['CONSTRAINT_TYPE'] == 'R'\n @foreign_keys << hash['R_CONSTRAINT_NAME']\n end\n }\n\n get_belongs_to()\n end", "title": "" }, { "docid": "c4e3e798cb15b35ea72c6984fb166ab0", "score": "0.543817", "text": "def dependent_gems\n out = []\n Gem.source_index.each do |name,gem|\n gem.dependencies.each do |dep|\n if self.satisfies_requirement?(dep) then\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [gem, dep, sats]\n end\n end\n end\n out\n end", "title": "" }, { "docid": "b828caff9247bb645fe89fa7c2650a58", "score": "0.54353136", "text": "def remaining_dependencies\n dependencies = []\n @current_packages.each do |_, package|\n package.spec.dependencies.each do |dep|\n next if satisfy? dep\n dependencies << dep\n end\n end\n dependencies\n end", "title": "" }, { "docid": "6b0be742a16e8327155cfafba68777c9", "score": "0.5424173", "text": "def dependencies_on(layer)\r\n read_inheritable_attribute(\"#{layer}_dependencies\")\r\n end", "title": "" }, { "docid": "057c83a70d5b62bc6f273fb9dc379848", "score": "0.5420424", "text": "def dependencies\n dependencies_with_paths.keys\n end", "title": "" }, { "docid": "7aa26abf2c4c3463d9b9841ab7a2bee6", "score": "0.5419012", "text": "def check_list\n if dependency_recursion\n raise BakerError, \"resource recursion detected\"\n end\n problem_list = missing_dependencies\n if !problem_list.empty?\n raise DependencyError, \"missing dependencies: #{problem_list.join(',')}\"\n end\n problem_list = resource_conflicts\n if !problem_list.empty?\n raise ConflictError, \"resource conflicts: #{problem_list.join(',')}\"\n end\n problem_list = install_conflicts\n if !problem_list.empty?\n raise ConflictError, \"installed conflicts: #{problem_list.join(',')}\"\n end\n end", "title": "" }, { "docid": "62e52e6a708ef237408be443e79e0194", "score": "0.54188067", "text": "def dependencies = @dependencies ||= DependencySet.new(self)", "title": "" }, { "docid": "8ba150d7b5653f5de61ce142dc8f82da", "score": "0.54132336", "text": "def check_dependencies(tree)\n if tree.content.respond_to?(:dependencies)\n if tree.content.respond_to?(:depends_on_ids) and not tree.content.depends_on_ids.nil?\n # Node ID is directly specified\n condition = Proc.new{|node| node.name == tree.content.depends_on_ids.first}\n else \n # When no node ID is directly specified, the first node found compatible will be selected\n condition = Proc.new{|node| node.content.class.to_s == tree.content.dependencies.first.to_s} \n end\n @direct_ref_node.each{|i,node| \n if condition.call(node)\n tree.content.run_dependencies(node.content)\n return\n end\n }\n end\n end", "title": "" }, { "docid": "56264f41ad605f58d7c21a5542fc759c", "score": "0.54093146", "text": "def recursive_deps\n Formula.expand_deps(self).flatten.uniq\n end", "title": "" }, { "docid": "a6a3663979705ad60685b974f5ce369f", "score": "0.5396859", "text": "def find_non_expl_dependencies(node = root)\n variables = Array.new(node.expl_dependencies)\n until variables.empty? do\n v = variables.shift\n if not (node.expl_dependencies.names | node.non_expl_dependencies.names).include?(v.name)\n node.non_expl_dependencies << v\n end\n if @dependency_table.has_key?(v.name)\n variables += @dependency_table[v.name]\n end\n end\n node.sons.each {|s| find_non_expl_dependencies(s)}\n end", "title": "" }, { "docid": "01b5df497e1bbd93dca76967d8d7fabd", "score": "0.5387036", "text": "def dependencies_on(layer)\n read_inheritable_attribute(\"#{layer}_dependencies\")\n end", "title": "" }, { "docid": "e37f02cf2bf85703cae3b549b6c25617", "score": "0.53831273", "text": "def load_fk_tables(tables, qualifiers)\r\n dataset = []\r\n\r\n tables.each_with_index do |table, index|\r\n qualifier = qualifiers[table.name]\r\n data_table = load_DDO(table.name, self.model_page_nums[table.name+'_page'], qualifier, FK_ROWS)\r\n # Preserve the index so we can select the tab again when the page refreshes\r\n data_table.index = index\r\n dataset << data_table\r\n end\r\n\r\n dataset\r\n end", "title": "" }, { "docid": "ea8a78b7a2a8fc400c3bc5e4a2182eca", "score": "0.5382662", "text": "def dependencies\n\t\t\treturn @dependencies\n\t\tend", "title": "" }, { "docid": "efcc1202e667b342e6aa20c3ce38ae46", "score": "0.53692305", "text": "def dependencies(filter=nil)\n raw = if !filter.nil?\n self.class.dependencies(filter).keys\n else\n (options.dependencies if options.respond_to?(:dependencies)) || @dependencies ||= self.class.dependencies(dependency_filter).keys\n end\n \n case raw\n when String; eval(raw)\n when Proc; instance_eval(&raw)\n else raw\n end\n end", "title": "" }, { "docid": "abd3b402584bbd9da4a8c3fc7dc04b75", "score": "0.53686", "text": "def all_dependencies\n dependencies = []\n dependencies << self.id\n\n self.app_setting_dependencies.each do |dependency|\n dependencies << dependency.dependent_app_setting_option_id\n dependencies << dependency.dependent_app_setting_option.all_dependencies\n end\n dependencies.flatten!\n dependencies.uniq!\n\n dependencies\n end", "title": "" }, { "docid": "bcb1b4a4587e439e9ba25718fa9825ec", "score": "0.5368493", "text": "def blunder_obtain_all_foreign_errors object, conditions = nil\n blunder_obtain_foreign_errors object, nil, conditions\n end", "title": "" }, { "docid": "7b006e91d0a96f947af4f7fa38716e06", "score": "0.53638285", "text": "def foreign_keys(table_name)\n relation, schema = table_name.to_s.split('.', 2).reverse\n quoted_schema = schema ? \"'#{schema}'\" : \"ANY (current_schemas(false))\"\n\n fk_info = select_all <<-SQL\n SELECT nsp.nspname || '.' || t2.relname AS to_table,\n a1.attname AS column ,\n a2.attname AS primary_key,\n c.conname AS name ,\n c.confdeltype AS dependency\n FROM pg_constraint c\n JOIN pg_class t1 ON c.conrelid = t1.oid\n JOIN pg_class t2 ON c.confrelid = t2.oid\n JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid\n JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid\n JOIN pg_namespace t3 ON c.connamespace = t3.oid\n JOIN pg_namespace nsp ON nsp.oid = t2.relnamespace\n WHERE c.contype = 'f'\n AND t1.relname = '#{relation}'\n AND t3.nspname = #{quoted_schema}\n ORDER BY c.conname\n SQL\n\n fk_info.map do |row|\n options = {:column => row['column'], :name => row['name'], :primary_key => row['primary_key']}\n\n options[:dependent] = case row['dependency']\n when 'c' then :delete\n when 'n' then :nullify\n when 'r' then :restrict\n end\n\n PgPower::ConnectionAdapters::ForeignKeyDefinition.new(table_name, row['to_table'], options)\n end\n end", "title": "" }, { "docid": "56f18486fb48da9f2840a274fb574ae4", "score": "0.53606033", "text": "def flexible_dependencies!\n self.flexible_dependencies = true\n self.checked = Set.new\n end", "title": "" }, { "docid": "c3037f8c60b7608f60af16eccbe3d066", "score": "0.53554726", "text": "def collect_dependency(type, dep)\n result = [type]\n return result unless dep.key?(type.name)\n dep[type.name].each do |deptype|\n result.concat(collect_dependency(deptype, dep))\n end\n dep.delete(type.name)\n result\n end", "title": "" }, { "docid": "00c72ebcf0d82eea3d8f438c34ce4e26", "score": "0.5355049", "text": "def dependants\n @environment.calculated_dependencies.map(&:last).flatten.select do |dep|\n dep.to_selector.matches(dep.from, self)\n end\n end", "title": "" }, { "docid": "ca9b533b5bda89d5105eecb699eef06c", "score": "0.5352885", "text": "def foreign_key_list(table, opts={})\n raise NotImplemented, \"#foreign_key_list should be overridden by adapters\"\n end", "title": "" }, { "docid": "0618f8ff313bb44b2a27a800d8016194", "score": "0.5348735", "text": "def get_all_depends(origin, parents_list = nil)\n if $use_packages_only\n depends_vars = %w{LIB_DEPENDS RUN_DEPENDS}\n else\n depends_vars = %w{FETCH_DEPENDS EXTRACT_DEPENDS PATCH_DEPENDS\n\t\t BUILD_DEPENDS LIB_DEPENDS RUN_DEPENDS}\n end\n\n unless $depends.has_key?(origin)\n depends = Set.new\n\n portdir = $portsdb.portdir(origin)\n return [] if not File.directory?(portdir)\n\n begin\n run_make_config(portdir, origin) if $config and !$use_packages_only\n rescue => e\n raise e if e.class == PkgDB::NeedsPkgNGSupport\n puts \"#{e.message}. Ignored.\"\n end\n\n first = false\n if parents_list.nil?\n parents_list = Set.new\n STDERR.print \"[Gathering depends for #{origin} \"\n first = true\n elsif $verbose\n STDERR.print \"(#{origin})\"\n end\n raise RecursiveDependencyError if parents_list.include?(origin)\n parents_list.add(origin)\n\n make_env = get_make_env(origin)\n cmdargs = make_env << 'make'\n\n cmdargs.concat(get_make_args(origin))\n\n `cd #{portdir} && #{shelljoin(*cmdargs)} -V #{depends_vars.join(' -V ')}`.each_line do |line|\n\tline.split(/\\s+/).each do |dep|\n\t dep.sub!(/.*?:/,'')\n\t if dep.rindex(':') != nil\n\t (dep, target) = dep.split(':')\n\t next if target != \"install\"\n\t end\n\t depends.add($portsdb.strip(dep)) if !dep.empty?\n\tend\n end\n\n STDERR.print '.'*depends.length if depends.length > 0\n\n children_deps = Set.new\n depends.each do |dep|\n children_deps.merge(get_all_depends(dep, parents_list)) if !dep.nil?\n end\n if !children_deps.nil?\n depends.merge(children_deps)\n end\n\n STDERR.puts ' done]' if first\n $depends[origin] = depends.to_a.compact\n else\n $depends[origin]\n end\nend", "title": "" } ]
5a82ae0043f70e63ff54e9f7520db6c4
Takes a hash which maps argument number to class type. Returns the map of argument types.
[ { "docid": "c0b720e99e50c8b22d6fb81d3c95c8f4", "score": "0.0", "text": "def args(map = nil)\n @args ||= {}\n @args.merge! map if map\n @args\n end", "title": "" } ]
[ { "docid": "123b8f7196c86b0ccea4124aead33069", "score": "0.60286856", "text": "def class_types\n class_methods_that_should_match.each_with_object Hash.new do |name, hash|\n surrogate_type, actual_type = class_types_for name\n next if surrogate_type == actual_type || name == :clone # ugh :(\n hash[name] = { surrogate: surrogate_type, actual: actual_type }\n end\n end", "title": "" }, { "docid": "4384e5eb99387c3d5d5b354db6258693", "score": "0.5885867", "text": "def hash2args(hash, mapping=self.class.attribute_mapping_to)\n return \"\" unless hash \n arg_list = []\n hash.each {|key, val|\n arg_list += self.get_arguments(key, val, mapping, hash)\n }\n arg_list\n end", "title": "" }, { "docid": "d9e3db86c7f606ba3530d6c171ce5ed6", "score": "0.5868332", "text": "def classify_hash(hsh)\n pos_vals = []\n kw_vals = {}\n rest_vals = hsh.delete(:rest) || []\n pos_args = @definition.positional_args\n hsh.each do |key, val|\n key = key.intern\n case key\n when :help\n @show_help = val\n else\n arg = @definition[key]\n if CommandArgument === arg\n if cmd_inst = arg[token]\n # Merge command's arg set with the current definition\n @definition = @definition.collapse(cmd_inst)\n # Insert command positional arguments\n pos_args.insert(0, *cmd_inst.argument_scope.positional_args)\n pos_vals << cmd_inst.command_value\n else\n self.errors << \"'#{token}' is not a valid value for #{arg}; valid values are: #{\n arg.commands.keys.join(', ')}\"\n end\n elsif !val.nil? || (arg.is_a?(KeywordArgument) && arg.value_optional?)\n set_kw_val(kw_vals, arg, val)\n end\n end\n end\n [pos_vals, kw_vals, rest_vals]\n end", "title": "" }, { "docid": "ff2278c09fe9a58bd9ac7166e9c726f1", "score": "0.5798118", "text": "def hash_to_call_args(hash)\n aux = {}\n hash.each do |k,v|\n key = ( v.is_a?(Array) || self.id_name == k.to_s ) ? k : pluralize(k)\n aux[key] = [v]\n end\n aux\n end", "title": "" }, { "docid": "d0a25eafd110f3196dfadf7f1fce1f3b", "score": "0.57765687", "text": "def type_map_hash(map)\n builder = Rtc::HashBuilder.new(19, 313)\n map.each_pair do |sym, type|\n builder.include(sym)\n builder.include(type)\n end\n builder.get_hash\n end", "title": "" }, { "docid": "25c6375923a236701ac819b13ab5f2ab", "score": "0.5771855", "text": "def used_types_map(&filter)\r\n type_map = Hash.new(0) # class_name (JavaQualifiedName) => cnt\r\n values(&filter).collect { |clazz| clazz.imported_3rd_party_types }.flatten.each do |type|\r\n\r\n # hash keys need to be frozen to keep state\r\n if !type_map.include?(type)\r\n type = type.freeze \r\n end\r\n\r\n type_map[type] += 1\r\n end\r\n type_map\r\n end", "title": "" }, { "docid": "fa7a2bae60a1916b018cbe570369a1af", "score": "0.5704276", "text": "def type hash\n caller_method = caller_locations(1,1)[0].label\n hash.each do |name, typ|\n #puts \"TYPES(#{name}, #{typ})\"\n @_varTypes ||= {}\n @_varTypes[caller_method] ||= {}\n @_varTypes[caller_method][name] = TypeFactory.create typ\n end\n end", "title": "" }, { "docid": "f2ed09ecd40705e70bc80598fa335edd", "score": "0.57000595", "text": "def check_arg_hash_type(key_type, elem_type, arg, mtd, n=0)\n check_arg_type Hash, arg, mtd, n\n arg.each_with_index do |item,i|\n check_arg_type key_type, item.first, mtd, n\n check_arg_type elem_type, item.last, mtd, n if elem_type.kind_of? Class\n check_arg_array_type elem_type.first, item.last, mtd, n if elem_type.kind_of? Array\n end\n end", "title": "" }, { "docid": "d2392a254fdf153ce5fb4d2c1b1c088b", "score": "0.5653597", "text": "def class_names\n class_methods_that_should_match.each_with_object Hash.new do |method_name, hash|\n surrogate_name, actual_name = class_parameter_names_for method_name\n next if surrogate_name == actual_name || method_name == :clone # ugh :(\n hash[method_name] = { surrogate: surrogate_name, actual: actual_name }\n end\n end", "title": "" }, { "docid": "869d762e55c684e94f56fcb807c6745b", "score": "0.55824435", "text": "def key_types=(_arg0); end", "title": "" }, { "docid": "cdaf3d619b3fe89d3a1f49d17d3fba0a", "score": "0.55624074", "text": "def types\n %w[raw reflective].each_with_object({}) do |type, hash|\n hash[type] = type\n end\n end", "title": "" }, { "docid": "9ee9ce1670b51bb9134a3dc54ced9ad1", "score": "0.54779035", "text": "def extract_action_klasses(actions_hash)\n hash = {}\n \n actions_hash.each do |key, params|\n action = ns()::Action[self.class::ACTIONS[\"%016x\" % key.to_i(16)]]\n action ||= ns()::Action[key]\n raise \"BadActionType #{key}\" if !action\n hash.merge!({ action => action::order_params(params)})\n end\n \n return hash\n end", "title": "" }, { "docid": "c1a19b2da76dc19b4159026dd7d61207", "score": "0.54314095", "text": "def hash\n [class_id, object_type].hash\n end", "title": "" }, { "docid": "deccb62d23b9b51938dbe193032880d6", "score": "0.5413207", "text": "def type_map\n TYPE_MAP\n end", "title": "" }, { "docid": "467b36b1b1f4fe12c2c4d5a12c5eff96", "score": "0.5395211", "text": "def classes_hash\n @classes\n end", "title": "" }, { "docid": "f430e7b255bfd031bb35697d64e4efb7", "score": "0.5352589", "text": "def calc_types\n sig_hash = Parser.parse { @proc.call }\n unless sig_hash.is_a?(Hash)\n raise(Error, \"Signature declaration (#{sig_hash.inspect}) \" +\n \"must be a Hash.\")\n end\n # Exactly one k:v pair in hash.\n sig_hash.each do |lhs, rhs|\n @lhs, @rhs = make_product(lhs), rhs\n end\n end", "title": "" }, { "docid": "de5bd9e4faa5ed266248d333ac72ad10", "score": "0.5330691", "text": "def instance_types\n instance_methods_that_should_match.each_with_object Hash.new do |name, hash|\n surrogate_type, actual_type = instance_types_for name\n next if surrogate_type == actual_type\n hash[name] = { surrogate: surrogate_type, actual: actual_type }\n end\n end", "title": "" }, { "docid": "9024cf71fd573401e76243b0c4579f0a", "score": "0.53251237", "text": "def type_class_map\n @type_class_map ||= ( map = {}\n Configuration.flex_models.each do |m|\n m = eval(\"::#{m}\") if m.is_a?(String)\n types = m.flex.type.is_a?(Array) ? m.flex.type : [m.flex.type]\n types.each do |t|\n map[\"#{m.flex.index}/#{t}\"] = m\n end\n end\n map )\n end", "title": "" }, { "docid": "5a833e482890bd2854d254220bb14298", "score": "0.52806467", "text": "def map(name, key_type, value_type, number, value_type_class = T.unsafe(nil)); end", "title": "" }, { "docid": "f71e6a501e7d56a75d65b74df6304545", "score": "0.5256623", "text": "def find_param_structure\n map.each_with_object({}) do|item, memo|\n memo[item.name] = item.type\n memo\n end\n end", "title": "" }, { "docid": "795dcfe34a5ad539f1837099a4651677", "score": "0.5232603", "text": "def argument_enum() @argument_type.values end", "title": "" }, { "docid": "d07567bb306cd1cadca67dc2013b9d84", "score": "0.5204295", "text": "def parse_argument_types(connection, keyspace_name, argument_types)\n argument_types.map do |argument_type|\n @type_parser.parse(argument_type).results.first.first\n end\n end", "title": "" }, { "docid": "c56a3093112c4b97d07b779e85c6889f", "score": "0.51972467", "text": "def numclass(valhash)\n if valhash.has_key?('.signed')\n signed = (valhash['.signed'].eql?('signed')) ? true : false\n else\n signed = true\n end\n\n klass = case valhash['.type']\n when 'char' then signed ? @@cct['signedchar'] : @@cct['unsignedchar']\n when 'short' then signed ? @@cct['signedshort'] : @@cct['unsignedshort']\n when 'int' then signed ? @@cct['signedint'] : @@cct['unsignedint']\n when 'long' then signed ? @@cct['signedlong'] : @@cct['unsignedlong']\n when 'longlong' then signed ? @@cct['signedlonglong'] : @@cct['unsignedlonglong']\n when 'pointer' then @@cct['pointer']\n else puts \"Error: Not a numeric type\"; exit\n end\n return \"#{@@options.abi}::\" + klass\nend", "title": "" }, { "docid": "17ade92817e623fe858782ec7c7de302", "score": "0.51487267", "text": "def convert_hash_to_type(value_types)\n\t\terror_and_exit \"Detected a hash, but could not determine the type of its keys and values; found #{value_types.size} possibilities\" unless value_types.size == 2\n\t\tcase @language\n\t\twhen :java, :java_lombok\n\t\t\treturn \"HashMap<#{convert_ruby_type_to_type(value_types[0])}, #{convert_ruby_type_to_type(value_types[1])}>\"\n\t\telse \n\t\t\terror_and_exit \"Could not convert to output language #{@language}\"\n\t\tend\n\tend", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "54414707e9a12c137e197345a196d33c", "score": "0.5147905", "text": "def hash_args; end", "title": "" }, { "docid": "b8c457e72b9a047688a327411e56125f", "score": "0.51302016", "text": "def _to_hash_type(params)\n return params.map(&method(:_to_hash_type)) if params.is_a?(Array)\n return params.keys.map { |k| [k, _to_hash_type(params[k])] }.to_h if params.is_a?(ActionController::Parameters)\n\n params\n end", "title": "" }, { "docid": "8201455a5c71e1469e31a0aa21545056", "score": "0.5102282", "text": "def check_class_against_hash(klass, hash)\n # Nil matches all klasses\n return hash if hash.nil?\n\n param_type_error(\"Value #{hash.inspect} is not a hash, so cannot match #{klass}.\") unless hash.is_a?(Hash)\n\n class_methods = klass.instance_methods\n # convert symbols to strings since I don't think we trust this hash? We could leak if we try\n # to convert everything in the hash to symbols\n class_methods = class_methods.map { |method| method.to_s }\n body_hash = hash.dup\n if body_hash.kind_of?(Array)\n body_hash = body_hash[0]\n end\n bad_fields = []\n body_hash.keys.each() do | key, value |\n if !class_methods.include?(key.to_s)\n bad_fields << key\n end\n end\n unless bad_fields.empty?\n param_type_error \"Value #{hash.inspect} has disallowed fields #{bad_fields.inspect} that are not in type #{klass}.\"\n end\n\n return hash\n end", "title": "" }, { "docid": "40a47a296c6fca016c5ad0a540485269", "score": "0.5097817", "text": "def hash_key_type\n @table.attribute_definitions.each do |attr|\n if attr.attribute_name == hash_key_name\n return @type_map[\n attr.attribute_type\n ]\n end\n end\n end", "title": "" }, { "docid": "efd3ef84888e144b7478e4fd0c9052a1", "score": "0.5096481", "text": "def parse_argument_types(connection, keyspace_name, argument_types)\n types = @schema.keyspace(keyspace_name).send(:raw_types)\n argument_types.map do |argument_type|\n @type_parser.parse(argument_type, types).first\n end\n end", "title": "" }, { "docid": "e63d9193da968342d75e97b068c7f3c8", "score": "0.5092984", "text": "def map_enums\n ret = { }\n int_MPI_type = lookup_type(\"int\")\n find_enums.each { |enum| ret[enum] = int_MPI_type }\n return ret\n end", "title": "" }, { "docid": "3a74e594d3bde2fdd99d708855c771de", "score": "0.5059918", "text": "def init_hash(num,class_name,hash)\n\t\t(0..num-1).each do |id|\n\t\t\tins=class_name.new(id,self)\n\t\t\thash[id]=ins\n\t\tend\n\n\tend", "title": "" }, { "docid": "cd397e9edd5c6a98ae87d0ed37767dca", "score": "0.5057817", "text": "def request_type_classes(holding, copy = nil)\n request_types(holding, copy).map { |type| \"type-#{type}\" }\n end", "title": "" }, { "docid": "97ca938fa6125ff3eb98006a0edad6e1", "score": "0.5049571", "text": "def map_types!(type_map); end", "title": "" }, { "docid": "97ca938fa6125ff3eb98006a0edad6e1", "score": "0.5049571", "text": "def map_types!(type_map); end", "title": "" }, { "docid": "2f427a3ef8ddf54e442fd0911fbbb48a", "score": "0.5048511", "text": "def pre_process(classes_hash, opts)\n Process::IgnoredClasses.new(classes_hash).process_all!\n Process::GlobalMembers.new(classes_hash, opts).process_all!\n Process::Accessors.new(classes_hash).process_all!\n Process::Ext4Events.new(classes_hash, opts).process_all!\n Process::Enums.new(classes_hash).process_all!\n Process::Overrides.new(classes_hash, opts).process_all!\n\n classes_hash.values\n end", "title": "" }, { "docid": "57a269e085bf01c9b719ab040319b361", "score": "0.50362724", "text": "def type(key); end", "title": "" }, { "docid": "57a269e085bf01c9b719ab040319b361", "score": "0.50362724", "text": "def type(key); end", "title": "" }, { "docid": "b5398fe2c07b6928a6beec10ea2cbaae", "score": "0.50344193", "text": "def build_hash(args)\n define_method(:hash) do\n args.map { |arg| instance_variable_get(\"@#{arg}\") }.unshift(self.class).hash\n end\n end", "title": "" }, { "docid": "1ee1cbcf65027e547e494255c5fca4dd", "score": "0.5033357", "text": "def parse_args_hash(hash)\n inputs = hash.keys.first\n outputs = hash.values.first\n \n return inputs, outputs\n end", "title": "" }, { "docid": "1ee1cbcf65027e547e494255c5fca4dd", "score": "0.5033357", "text": "def parse_args_hash(hash)\n inputs = hash.keys.first\n outputs = hash.values.first\n \n return inputs, outputs\n end", "title": "" }, { "docid": "095b00a57f7703ce0ad8f57bdec3ec1d", "score": "0.50303966", "text": "def required_types\n { :by => Hash,\n :with => Hash }\n end", "title": "" }, { "docid": "46e3552da397ab249d5a04ab3595c1cd", "score": "0.50276595", "text": "def param_types\n fields.to_h { |field| [field.name.to_sym, field.param_type] }\n end", "title": "" }, { "docid": "9c6a5b702cb5c74993867c45b3f4a6ab", "score": "0.50234103", "text": "def compute_token_types(token_names)\n m = HashMap.new\n if ((token_names).nil?)\n return m\n end\n ttype = Token::MIN_TOKEN_TYPE\n while ttype < token_names.attr_length\n name = token_names[ttype]\n m.put(name, ttype)\n ttype += 1\n end\n return m\n end", "title": "" }, { "docid": "98e7facebc9dd010db7db2196621b06d", "score": "0.5018784", "text": "def type_map\n @type_map\n end", "title": "" }, { "docid": "a85527c4b4cdab32ef55e08b89fdb586", "score": "0.5018323", "text": "def initialize(type_map: {})\n @type_map = type_map.with_indifferent_access\n end", "title": "" }, { "docid": "4b86e9a3bfcc47510e5a474a58460917", "score": "0.4990702", "text": "def classnames(*args)\n args.reduce(\"\") do |str, arg|\n classes =\n if arg.is_a? Hash\n arg.reduce([]) { |cs, (classname, condition)| cs + [condition ? classname : nil] }\n elsif arg.is_a? String\n [arg]\n else\n []\n end\n ([str] + classes).reject(&:blank?).join(\" \")\n end\n end", "title": "" }, { "docid": "4e7518e82a51d2f3413f4bcd7310c2d5", "score": "0.49905324", "text": "def hash\n [self.class, name].hash\n end", "title": "" }, { "docid": "4e7518e82a51d2f3413f4bcd7310c2d5", "score": "0.49905324", "text": "def hash\n [self.class, name].hash\n end", "title": "" }, { "docid": "4e7518e82a51d2f3413f4bcd7310c2d5", "score": "0.49905324", "text": "def hash\n [self.class, name].hash\n end", "title": "" }, { "docid": "ad4ad5489f58dd16e09693645417480b", "score": "0.49874896", "text": "def method_information(inspected)\n arg_mapping = argument_mapping\n info = {:method => {}, :instance_method => {}}\n\n inspected.each do |type, methods|\n methods.each do |method|\n args = []\n\n method.parameters.each_with_index do |arg, index|\n name = arg[1] || \"arg#{index + 1}\"\n args << {:type => arg_mapping[arg[0]], :name => name}\n end\n\n info[type][method.name] = args\n end\n end\n\n return info\n end", "title": "" }, { "docid": "a6884a93e62d2ea3a4d7348cbbb62051", "score": "0.49746174", "text": "def retrieve(hash, *args)\n valids = [::Hash, hash.is_a?(Class) ? hash : hash.class]\n args.flatten.inject(hash) do |memo, key|\n break unless valids.detect{ |valid_type|\n memo.is_a?(valid_type) || memo == valid_type\n }\n memo[key.to_s] || memo[key.to_sym] || break\n end\n end", "title": "" }, { "docid": "4fb85c8eb8a5fa1a111b5665adff7cdb", "score": "0.49424762", "text": "def type_map()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "65ad46c6e1990f2c88fe23a2379adc31", "score": "0.4921078", "text": "def prepare_method_arg_hash(args)\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end", "title": "" }, { "docid": "986384baa3e6547836cbe686292d7a4d", "score": "0.49165165", "text": "def types=(_arg0); end", "title": "" }, { "docid": "986384baa3e6547836cbe686292d7a4d", "score": "0.49165165", "text": "def types=(_arg0); end", "title": "" }, { "docid": "986384baa3e6547836cbe686292d7a4d", "score": "0.49165165", "text": "def types=(_arg0); end", "title": "" }, { "docid": "bc1f2b026caf4c90fd679f4e649e4944", "score": "0.49155307", "text": "def hash_argument(args)\n return {} if args.length == 0\n return args.first if args.length == 1 && args.first.is_a?(Hash)\n\n order = [:sample_rate, :tags]\n hash = {}\n args.each_with_index do |value, index|\n hash[order[index]] = value\n end\n\n return hash\n end", "title": "" }, { "docid": "2357ec68da3c5207ed66f0f91a03ea1d", "score": "0.49136272", "text": "def check_types(types)\n i = 0\n types.each_key do |key|\n i += 1\n unless key.kind_of?(types[key]) || key == nil\n raise ArgumentError::new(\"Argument#\" + i.to_s +\n \" should be a kind of \" + types[key].to_s)\n end\n end\n end", "title": "" }, { "docid": "ddae5f305424194a989faee1b7fb1bfa", "score": "0.49031305", "text": "def type(*args)\n args_s = args.size\n raise ArgumentError.new(\"wrong number of arguments\") if args_s > 2\n args.last.each { |key,val| send(\"#{key}=\", val) } if args_s == 2\n @type = args.first if args_s > 0\n @type\n end", "title": "" }, { "docid": "115cffe0be07c04abfb6146873c09d4c", "score": "0.48885956", "text": "def job_class_hash\n @job_class_hash ||= job_classes.each_with_object({}) do |c, a|\n a[c] = c.public_instance_methods(false)\n end\n end", "title": "" }, { "docid": "4941ee0f066b5fee8e0090b78b5a41ee", "score": "0.4862927", "text": "def classify_arguments(args, option_keys=[])\n\n # expand all --opt=val\n exp_args = []\n args.each do |v|\n (a,*b) = v.split(\"=\")\n if option_keys.include?(v)\n exp_args << v\n elsif option_keys.include?(a)\n exp_args << a\n exp_args << b.join(\"=\")\n else\n exp_args << v\n end\n end\n\n option_indices = (0...(exp_args.size-1)).select {|i| option_keys.include?(exp_args[i]) }\n\n args_w_vals = option_indices.reverse.map do |i|\n # reverse order keeps things sane\n arg2 = exp_args.delete_at(i+1)\n arg1 = exp_args.delete_at(i)\n [arg1,arg2]\n end.reverse\n\n (flags, arguments) = exp_args.partition {|v| v[/^-/] }\n [arguments, args_w_vals, flags]\n end", "title": "" }, { "docid": "ea47c06912079c1b939b1f087d9a724f", "score": "0.48605663", "text": "def process_classes(klass_hash, scope)\n interpolate_array(klass_hash['classes'], scope) +\n get_classes_from_groups(\n interpolate_array(klass_hash['class_groups'], scope), scope\n )\n end", "title": "" }, { "docid": "dd65f945a517e3f09410b1991c6c77da", "score": "0.4859813", "text": "def parse_argument_types(connection, keyspace_name, argument_types)\n find_fetcher(connection).parse_argument_types(connection,\n keyspace_name,\n argument_types)\n end", "title": "" }, { "docid": "f3d8c569d58aa049c04e614451b269a5", "score": "0.48355234", "text": "def arg_types\n args.map(&:first).map {|x| x.is_a?(Array) ? x.first : x }.compact\n end", "title": "" }, { "docid": "21356050eff7b4da5862be2c2acb63c4", "score": "0.48331758", "text": "def types(groups = false)\n\n values = {}\n functions.each do |func|\n\n values[func.type.base] = true\n values[func.type.group] = true if groups && func.type.group\n\n func.arguments.each do |arg|\n values[arg.type.base] = true\n values[arg.type.group] = true if groups && arg.type.group\n end\n end\n\n #noinspection RubyYardReturnMatch\n values.keys.map(&:to_sym)\n end", "title": "" }, { "docid": "b6eb955f4820aeb6f5fd37648744a9b0", "score": "0.48317707", "text": "def map(params)\n [:as, :ruby].each {|k| params[k] = params[k].to_s if params[k] } # Convert params to strings\n \n if params.key?(:as) and params.key?(:ruby)\n @as_mappings[params[:as]] = params[:ruby]\n @ruby_mappings[params[:ruby]] = params[:as]\n end\n \n if params.key?(:as)\n params[:ruby] = get_ruby_class_name(params[:as])\n end\n end", "title": "" }, { "docid": "937dd867d6e092e2259df63acfce8f99", "score": "0.4831763", "text": "def get_class_frequencies(class_array)\n freqs = {}\n class_array.each do |clazz|\n freqs[clazz] = 0 unless freqs[clazz]\n freqs[clazz] += 1\n end\n return freqs\n end", "title": "" }, { "docid": "1d9f1b8afe482fd5f64d1372c8b47835", "score": "0.48224822", "text": "def types\n type_classes | (index_classes - type_classes.map(&:index)).flat_map(&:types)\n end", "title": "" }, { "docid": "9c75d7d49208ea370efbe34b7c22bc7e", "score": "0.48221925", "text": "def class_map(methods)\n ClassMap.build_from_methods(methods)\n end", "title": "" }, { "docid": "b58ea91ef593222af01fa091f325a6ce", "score": "0.4821946", "text": "def class_inheritable_hash(*syms)\n class_inheritable_reader(*syms)\n class_inheritable_hash_writer(*syms)\n end", "title": "" }, { "docid": "8b4bbc5a7c6b663fee828de17dda6552", "score": "0.4819579", "text": "def hash\n [self.class, to_sym].hash\n end", "title": "" }, { "docid": "c36250c05d58c5084bf384928408fdf5", "score": "0.4818172", "text": "def classes\n @by_class.keys\n end", "title": "" }, { "docid": "f4c7a4dd0d1d68902426e55bd8cc6755", "score": "0.48177505", "text": "def takes_class_params\n params.fetch(:takes_class, {})\n end", "title": "" }, { "docid": "64d08b046986abd6183c84e724659446", "score": "0.48113328", "text": "def gen_attr_type_hash\n ATTR_TYPES.each { |type, attrs| attrs.each { |a| normalized_attributes[type][a] = true } }\n gen_time_attr_type_hash\n end", "title": "" }, { "docid": "8c853a6eea629a74ce153f9b72a5932e", "score": "0.4810441", "text": "def find_arg_specs\n self.class.constants.each do |constant|\n val = self.class.const_get(constant)\n if val.is_a? Hash\n all_arg_specs = true\n val.each do |key,value|\n unless value.is_a? ArgSpec or value.is_a? ArrayArgSpec or value.is_a?(HashArgSpec)\n all_arg_specs = false\n break\n end\n end\n \n if all_arg_specs\n return val\n end\n end\n end\n \n return nil\n end", "title": "" }, { "docid": "1cbc2d235590f9480740cb330a9e5acb", "score": "0.4806509", "text": "def frequencies(builds)\n frequencies = {}\n builds.each do |build|\n klass = classify(build)\n frequencies[klass] = [] if frequencies[klass].nil?\n frequencies[klass] << build\n end\n\n frequencies\nend", "title": "" }, { "docid": "bb96d29e69ecdc3cbbc1fe96b8700e7b", "score": "0.47963673", "text": "def params\n hash_from_methods keys\n end", "title": "" }, { "docid": "86d1815d0f2acdfe1bc89d31345bdb3e", "score": "0.47914124", "text": "def reflections(klass)\n klass.reflections.each_with_object({}) { |(key, value), memo| memo[key.to_s] = value }\n end", "title": "" }, { "docid": "e1c5fb32b132e8fe3945db4d7caa8fd7", "score": "0.47849628", "text": "def value_types=(_arg0); end", "title": "" }, { "docid": "49ac36cd618de69eef39897474b7ce55", "score": "0.47839838", "text": "def count_classes(keys, skip_traits = false)\n keys.each do |key|\n key = key.to_s\n klass = key.singularize.camelize.constantize\n puts \"** #{key}: #{klass.count}\"\n end\n puts \"Traits: #{TraitBank.count}\" unless skip_traits\n end", "title": "" }, { "docid": "2c94372656cf6c5441f50e4b2c09a035", "score": "0.4783556", "text": "def exercise_four a\n\t## A nicer less run throughs way\n\tresult = {}\n\ta.each {|e| result[e.class] ||= []; result[e.class] = result[e.class] << e }\n\tresult.values \n\t\n\tclasses = a.map { |x| x.class }.uniq.map { |type| a.select { |num| num.class == type } }\n\t#classes.each_with_index { |cla, i| a.each { |elem| if elem.class.to_s == cla.to_s then classes[i] ||= [] and classes[i] << elem end } }\nend", "title": "" }, { "docid": "830c511eeff79c6ffe9f75c85b34bbe4", "score": "0.47813246", "text": "def meaningful_arguments(arguments)\n self_arguments = self.arguments.to_set\n result = Hash.new\n arguments.each_assigned_argument do |key, value|\n if self_arguments.include?(key)\n result[key] = value\n end\n end\n result\n end", "title": "" }, { "docid": "830c511eeff79c6ffe9f75c85b34bbe4", "score": "0.47813246", "text": "def meaningful_arguments(arguments)\n self_arguments = self.arguments.to_set\n result = Hash.new\n arguments.each_assigned_argument do |key, value|\n if self_arguments.include?(key)\n result[key] = value\n end\n end\n result\n end", "title": "" }, { "docid": "273581569376a49324705466279dbde8", "score": "0.4780538", "text": "def inject(map)\n map.keys.each { |k| @class_map[k] = map[k] unless @class_map.key?(k) }\n end", "title": "" }, { "docid": "bacc64dd47ad053dd209415443fac345", "score": "0.4769538", "text": "def attribute_values_from_hash(hash)\n names = attribute_names(include_class_attribute: true).map(&:to_sym)\n hash.values_at(*names)\n end", "title": "" }, { "docid": "167d1ce9d1daaa5a0f801d98270e5ecd", "score": "0.47620463", "text": "def store(klass, arg_class)\n unless arg_class.ancestors.include? Argument::Base\n warn \"Tanuki::Argument::Base is not an ancestor of `#{arg_class}'\"\n end\n @assoc[klass] = arg_class\n end", "title": "" }, { "docid": "7ba36523142ed4b8f8804ee87f2cc9d8", "score": "0.47609907", "text": "def optkey(args, *rest)\n args_1 = args.dup\n bind = binding?(rest.car) ? rest.shift : nil\n @locals = nil\n vals = rest.map do |keys|\n val = if array?(keys)\n case keys.length\n when 1\n name = keys.car.to_s\n get_class_or_key(args_1, Object, keys.car, nil)\n when 2\n name = keys.car.to_s\n get_class_or_key(args_1, keys.cadr.class, *keys)\n when 3\n name = keys.cadr.to_s\n get_class_or_key(args_1, *keys)\n else\n assert_type(keys.length.between?(1, 3), keys, 1,\n \"an array of one to three elements [class, :key, default]\")\n end\n else\n name = keys.to_s\n get_class_or_key(args_1, Object, keys, nil)\n end\n @locals = val\n eval(\"#{name} = @locals\", bind)\n val\n end\n remove_instance_variable(\"@locals\")\n if vals.length == 1\n vals.first\n else\n vals\n end\nend", "title": "" }, { "docid": "cc7192ee9b018b5c138a639fad4df553", "score": "0.47601113", "text": "def map_to_prepared_args(hash)\n args = {}\n hash.each{|k,v| args[k.to_s.gsub('.', '__')] = v}\n args\n end", "title": "" }, { "docid": "97e18e1269b7aa0f008ee37a6d87004f", "score": "0.47599", "text": "def hash # :nodoc:\n return (57 + @name.hash) * @type.hash\n end", "title": "" }, { "docid": "95adcdf584b505c6746ad8a7f39b06e7", "score": "0.47583017", "text": "def validate_arguments!(**args)\n return if self.class.argument_types.nil?\n\n self.class.argument_types.each do |key, klass|\n case args[key]\n when *Array(klass).map(&:constantize) then nil # Object is okay\n else raise ArgumentClassMismatch.new(key, expected: klass, actual: args[key]&.class&.to_s)\n end\n end\n end", "title": "" }, { "docid": "17fcdcb128944e7ca236acf788edf377", "score": "0.47545248", "text": "def arg_spec_hash args\n HashArgSpec.new args\n end", "title": "" }, { "docid": "b7b72240c2268be46e049e8bc7c1a4a4", "score": "0.47469145", "text": "def gen_attr_type_hash\n attr_types.each { |type, attrs| attrs.each { |a| Environment.normalized_attributes[type][a] = true } }\n gen_time_attr_type_hash\n end", "title": "" }, { "docid": "d71972ea1640f48288835c3e48894bce", "score": "0.47441256", "text": "def java_types(params)\n return nil if params.nil?\n\n params.map {|e| e.class.java_class.name }.to_java(:string)\n end", "title": "" }, { "docid": "f00789d0bcc4bd0aad9e6ae98fd53dc6", "score": "0.47338748", "text": "def build_type_to_entry_map(entries)\n type_to_entry_map = {}\n entries.each do |entry|\n game_type = SurvivorEntry.name_to_game_type(entry.game_type)\n if type_to_entry_map.has_key?(game_type)\n type_to_entry_map[game_type] << entry\n else\n type_to_entry_map[game_type] = [entry]\n end\n end\n return type_to_entry_map\n end", "title": "" }, { "docid": "f00789d0bcc4bd0aad9e6ae98fd53dc6", "score": "0.47338748", "text": "def build_type_to_entry_map(entries)\n type_to_entry_map = {}\n entries.each do |entry|\n game_type = SurvivorEntry.name_to_game_type(entry.game_type)\n if type_to_entry_map.has_key?(game_type)\n type_to_entry_map[game_type] << entry\n else\n type_to_entry_map[game_type] = [entry]\n end\n end\n return type_to_entry_map\n end", "title": "" }, { "docid": "96a1e2b86f0041f33904cb8f046d45ca", "score": "0.47308093", "text": "def target_to_count_hash(target)\n begin\n targetJSON = JSON.parse(target)\n classes = targetJSON.map{ |t| t[\"classname\"] }\n counts = Hash.new(0)\n classes.each do |v|\n counts[v] += 1\n end\n return counts\n rescue Exception => ex\n logger.debug \"In target_to_count_hash: #{ex}\"\n return {}\n end\n end", "title": "" } ]
dafb17247152d7a0373f31df8f1b308c
GET /lbaas GET /lbaas.json
[ { "docid": "90a12f10803c3edb3896052753f08eee", "score": "0.6744664", "text": "def index\n @lbaas = Lbaa.all\n @lbaas = Lbaa.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbaas }\n end\n end", "title": "" } ]
[ { "docid": "049a6408d6130136027d509dd5762587", "score": "0.6797146", "text": "def show\n @lbaa = Lbaa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbaa }\n end\n end", "title": "" }, { "docid": "958a3b9beeba36f5aa3bade9483abc57", "score": "0.61314595", "text": "def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend", "title": "" }, { "docid": "fe86e0d9c859116a8da115c108a07c36", "score": "0.60002965", "text": "def ambassadors(params = {})\n self.class.get('/ambassador/all', params)\n end", "title": "" }, { "docid": "2b6ab693d6423c6d051886ecaac151fa", "score": "0.59382147", "text": "def index\n @lbds = Lbd.all\n @lbds = Lbd.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbds }\n end\n end", "title": "" }, { "docid": "74abbc0d82adf1c4e449c350eaa7045c", "score": "0.59046143", "text": "def new\n @lbaa = Lbaa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lbaa }\n end\n end", "title": "" }, { "docid": "511a632b6391c80c1b0e0b06d9d9831d", "score": "0.5902103", "text": "def show\n @lbd = Lbd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbd }\n end\n end", "title": "" }, { "docid": "79c29ad1c82e94f0b99f35c6923fb9b8", "score": "0.59019125", "text": "def create\n @lbaa = Lbaa.new(params[:lbaa])\n\n respond_to do |format|\n if @lbaa.save\n format.html { redirect_to :action => 'index' }\n format.json { render json: @lbaa, status: :created, location: @lbaa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lbaa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "19499c847b501cfda14771f3599b3192", "score": "0.58924824", "text": "def list_all_tenantcircles_for_a_version_box(args = {}) \n get(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args)\nend", "title": "" }, { "docid": "c83970b8c7686acf4050b95b8bae128a", "score": "0.5889526", "text": "def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end", "title": "" }, { "docid": "c4bfce5a98e6fea1ca08eec6cb713f33", "score": "0.57836735", "text": "def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end", "title": "" }, { "docid": "87975fd6678d652f492cb46e9aafc762", "score": "0.5770741", "text": "def index\n @lbcs = Lbc.all\n @lbcs = Lbc.where(:section => 'A').order(\"id\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbcs }\n end\n end", "title": "" }, { "docid": "9d8da5209ff0e26298b2d9496f3845dd", "score": "0.5761852", "text": "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "title": "" }, { "docid": "8ef701f198b4c61bf82f1bcd05950f70", "score": "0.5730157", "text": "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "title": "" }, { "docid": "2bc46712fac52c18d7095f88606f736d", "score": "0.5713337", "text": "def index\n\tadd_breadcrumb \"Listado de librerias\", :librerias_index_path\n @librerias = Libreria.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @librerias }\n end\n end", "title": "" }, { "docid": "4a2b45925a115751df0545dedf8f60b6", "score": "0.570705", "text": "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "title": "" }, { "docid": "733ffeef89b17c8c4b56adeccb14c92e", "score": "0.569931", "text": "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "title": "" }, { "docid": "f1289fadb663703612e04205dad5508b", "score": "0.56925434", "text": "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "title": "" }, { "docid": "c271cb733ae66ff5aad0f33384b825b0", "score": "0.56793994", "text": "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend", "title": "" }, { "docid": "1a6217f15f5a47fd6aadfe7f71d3d058", "score": "0.5667605", "text": "def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end", "title": "" }, { "docid": "5b198978eae0f07e3e59c1cd554ecc91", "score": "0.5659565", "text": "def show\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "title": "" }, { "docid": "2499c962f4777308529666ce340eed48", "score": "0.5617904", "text": "def get_aos_version_box_by_name(args = {}) \n get(\"/aosversions.json/aosversionbox/name/#{args[:aosVersionBoxName]}\", args)\nend", "title": "" }, { "docid": "3cc447bc8c6f3f46adda571f770e55dc", "score": "0.55856913", "text": "def index\n @lbdds = Lbdd.all\n @lbdds = Lbdd.where(:section => 'A').order(\"id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lbdds }\n end\n end", "title": "" }, { "docid": "6cd23b139d03c5b0377d989e1180e3a8", "score": "0.55854857", "text": "def index\n @admin_agencies = Admin::Agency.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_agencies }\n end\n end", "title": "" }, { "docid": "22e196e17da9a5c43e9c9bde0e49a821", "score": "0.5566283", "text": "def list_backoffice_information_for_arrays_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/arrays/#{args[:tenantId]}\", args)\nend", "title": "" }, { "docid": "1356f97457e9394705f975b40c02302f", "score": "0.5540649", "text": "def show\n @lbc = Lbc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbc }\n end\n end", "title": "" }, { "docid": "beb89604800e6fb4866582b8a0b5fdb4", "score": "0.55364805", "text": "def index\n @busgroups = Busgroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @busgroups }\n end\n end", "title": "" }, { "docid": "18bee71ad444e6596f5de8c18cdddd39", "score": "0.55155045", "text": "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "title": "" }, { "docid": "44d6e844616f6f2a43f2c447ff742350", "score": "0.5507585", "text": "def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end", "title": "" }, { "docid": "870831c583c76e1eeae5be8256af3ffb", "score": "0.55070305", "text": "def lba_children\n \tif (params[:id] == 'root') then\n @lbas = Lba.roots\n else\n \tif (params[:rel] == 'lba') then\n \t lba = Lba.find(params[:id])\n \t @lbas = lba.children\n \t @lbos = lba.lbos\n \t @interfaces = lba.interfaces\n \t @build_features = lba.build_features\n @mapped_features = @feature.build_features\n \telsif (params[:rel] == 'lbo') then\n \t lbo = Lbo.find(params[:id])\n \t @build_features = lbo.build_features\n \t @logical_entities = lbo.logical_entities\n @mapped_features = @feature.build_features\n \telsif (params[:rel] == 'le') then\n \t le = LogicalEntity.find(params[:id])\n \t @logical_entity_attributes = le.logical_entity_attributes\n \telsif (params[:rel] == 'build_feature') then\n \t bf = BuildFeature.find(params[:id])\n \t @build_features = bf.children\n # @mapped_features = @feature.build_features\n end\n end\n puts \"build_features\"\n ap @build_features\n puts \"mapped_features\"\n ap @mapped_features\n\n\t\trespond_to do |format|\n format.html { render :partial => 'lbas/lba_children',\n :locals => {:lbas => @lbas,\n :lbos => @lbos,\n :bfs => @build_features,\n \t\t\t:mapped_features => @mapped_features,\n :les => @logical_entities,\n :le_attributes => @logical_entity_attributes,\n :interfaces => @interfaces\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n end\n end", "title": "" }, { "docid": "26ab357f9e0b2eb3fda9aeef8d65ebde", "score": "0.5474212", "text": "def index\n @sequence_databases = SequenceDatabase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sequence_databases }\n end\n end", "title": "" }, { "docid": "3e68f8956b29e5e8556d766022a1f1c0", "score": "0.5467986", "text": "def show\n\tadd_breadcrumb \"Datos de la librería\", :librerias_path\n @libreria = Libreria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @libreria }\n end\n end", "title": "" }, { "docid": "c35dc8bacd929743f4e6b3f84703392f", "score": "0.54498273", "text": "def index\n @allocations = Allocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @allocations }\n end\n end", "title": "" }, { "docid": "92000b9a6147a3524c90ce8d741db205", "score": "0.5435184", "text": "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "title": "" }, { "docid": "4d3e536fa5b371ed7164e1d4a9a4c3d2", "score": "0.5417021", "text": "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "title": "" }, { "docid": "6fd73dd6b56e6241d00959b7e7824140", "score": "0.54159486", "text": "def index\n @bagels = Bagel.all\n end", "title": "" }, { "docid": "bc2365bfaa3d07cb858848f3c12d40e0", "score": "0.53868127", "text": "def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end", "title": "" }, { "docid": "81d095ec4c39440350557f88f499f7e4", "score": "0.53839636", "text": "def show\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load_balancer_check }\n end\n end", "title": "" }, { "docid": "513891b778620cf28f7f4605b16fd64f", "score": "0.5378551", "text": "def index\n ota = Array.new\n if params[:facility].nil?\n # 自分の施設情報だけを返す\n facilities = current_user.facilities\n facilities.each do |facility|\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n\n ota.concat(\n facility.ota.select do |otum|\n otum.provider != 'default'\n end\n )\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota: ota.as_json(except: [\n :password,\n :token,\n :created_at,\n :updated_at\n ], include: [\n :ota_rooms\n ])\n }, status: 200\n end", "title": "" }, { "docid": "1dc071cf255257f68293a5c2cedb21a7", "score": "0.5369404", "text": "def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end", "title": "" }, { "docid": "535943a7673309f0cfed6f070ae9af73", "score": "0.5347235", "text": "def index\n @bagtypes = Bagtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bagtypes }\n end\n end", "title": "" }, { "docid": "0164f50addfb5a2b537a405ddd811acf", "score": "0.5345545", "text": "def show\n @lbdd = Lbdd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbdd }\n end\n end", "title": "" }, { "docid": "0164f50addfb5a2b537a405ddd811acf", "score": "0.5345545", "text": "def show\n @lbdd = Lbdd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lbdd }\n end\n end", "title": "" }, { "docid": "28cba76a9fe83b40f16907bcdd38941c", "score": "0.534533", "text": "def get_aos_version_box_by_id(args = {}) \n get(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend", "title": "" }, { "docid": "9bcfac4ead27201056935a23c5bd18e7", "score": "0.53331834", "text": "def index\n screen_name(\"Admin-Indice-Manifestaciones-FRBR\")\n @frbr_manifestations = FrbrManifestation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @frbr_manifestations }\n end\n end", "title": "" }, { "docid": "f3d1f62c5645b249b1aee8e0fc8dafa1", "score": "0.5330617", "text": "def index\n @lightbulbs = Lightbulb.all\n end", "title": "" }, { "docid": "46335a8ce775828eff364973c66d753b", "score": "0.53248495", "text": "def show\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bl }\n end\n end", "title": "" }, { "docid": "179d89298ec11597fd8f3c979ec808ea", "score": "0.5324007", "text": "def index\n @config_avaliacaos = ConfigAvaliacao.all\n add_breadcrumb \"Config. Avaliaçao\", config_avaliacaos_path, :title => \"Voltar para a Página principal\"\n\n end", "title": "" }, { "docid": "f14be0f66dc6187f3b89c9cebf0daa40", "score": "0.5323436", "text": "def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end", "title": "" }, { "docid": "32c194259ec830bfa371b464b96cdc9b", "score": "0.5322141", "text": "def index\n allow :get\n expires_in 60.seconds\n\n nodes = @kavlan.nodes_vlan(params[:vlan_id])\n result = {\n 'total' => nodes.length,\n 'offset' => 0,\n 'items' => nodes.map { |n| { 'uid' => n, 'vlan' => params[:vlan_id] } },\n 'links' => links_for_collection\n }\n\n result['items'].each do |item|\n item['links'] = links_for_item(item)\n end\n\n render_result(result)\n end", "title": "" }, { "docid": "162725cb20a0038961bf6a45587decff", "score": "0.53210706", "text": "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "title": "" }, { "docid": "c259a85f6a3a7c83e52f6dd3bf230d0e", "score": "0.5318635", "text": "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "title": "" }, { "docid": "86d9ecbf92bb30d55764d4c652ab64b4", "score": "0.53025395", "text": "def init_brands\n response = @conn.get do |req|\n req.url \"/api/v1/brands\"\n req.headers = rest_headers\n end\n\n @brands = json(response.body)[:brands]\n end", "title": "" }, { "docid": "fed32e6e9bd93f03b86bc2c60114ba49", "score": "0.5282761", "text": "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "title": "" }, { "docid": "0382563017f71f768645d1909a3a3ff7", "score": "0.52762306", "text": "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "title": "" }, { "docid": "358986151d2728092dcf53260791afdb", "score": "0.5268017", "text": "def retrieve_elb(name)\n Clients.elb.describe_load_balancers(\n load_balancer_names: [name],\n ).load_balancer_descriptions[0]\nend", "title": "" }, { "docid": "e81aef8f520ae1bafbae3cafcb761704", "score": "0.5266668", "text": "def show\n @banda = Banda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banda }\n end\n end", "title": "" }, { "docid": "5a85bc384021181eb058c3bb1b5573f8", "score": "0.525951", "text": "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "title": "" }, { "docid": "20c1044351c268574b5d93024b07bbf5", "score": "0.52557474", "text": "def show\n @beacon = Beacon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beacon }\n end\n end", "title": "" }, { "docid": "ba9a57e668ef9452a6518c4c8296e087", "score": "0.5254549", "text": "def list_arrays_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "title": "" }, { "docid": "57e0a7ece8e93e59fb0cfb705b0110c7", "score": "0.5252102", "text": "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "title": "" }, { "docid": "fa3f285e083a8b74880fd50360a4f7da", "score": "0.5248708", "text": "def index\n @habrausers = current_user.habrausers\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @habrausers }\n end\n end", "title": "" }, { "docid": "d1cfd7860b9401ca54f0db52b0539be8", "score": "0.52470946", "text": "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "title": "" }, { "docid": "8476d68fe4b0265c227dffcab7c20986", "score": "0.5244814", "text": "def get(path, busca=nil)\n @client.get(path, busca)\n end", "title": "" }, { "docid": "2436ab94153dcb517be8f624fd0d3da9", "score": "0.5225856", "text": "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BundleApi.list ...\"\n end\n # resource path\n local_var_path = \"/bundles.json\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n 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 => 'BundleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BundleApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c50f2afd12303bd1bf695b9753a46de9", "score": "0.5223249", "text": "def show\n @bdatabase = Bdatabase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bdatabase }\n end\n end", "title": "" }, { "docid": "f57c587fb52700586d523936a5e12b6f", "score": "0.5217185", "text": "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "title": "" }, { "docid": "36d350fee811e7bb7427ddf974b31a6f", "score": "0.52147806", "text": "def index\n @lobs = Lob.all\n\n render json: @lobs\n end", "title": "" }, { "docid": "692bd0cfce5c4fa7126021ffaf9f66f6", "score": "0.5211514", "text": "def index\n @dhcp_ranges = DhcpRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dhcp_ranges }\n end\n end", "title": "" }, { "docid": "8a1dde65838c8f369de36da31a42c059", "score": "0.520989", "text": "def show\n @storage_lun = StorageLun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storage_lun }\n end\n end", "title": "" }, { "docid": "f0e06b1dc6c00613fcc81507743c760b", "score": "0.52096665", "text": "def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end", "title": "" }, { "docid": "07703f2ab96a0dd148f1b5fba767caf5", "score": "0.5209656", "text": "def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end", "title": "" }, { "docid": "7a7718b2cefa0249e1142179c1de773d", "score": "0.5203189", "text": "def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "title": "" }, { "docid": "c01038440bb33f614edb91f12d6529c5", "score": "0.5200768", "text": "def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end", "title": "" }, { "docid": "7d7893724e78d0c005f668c7abc1e2d0", "score": "0.5192385", "text": "def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @abuckets }\n end\n end", "title": "" }, { "docid": "74b03316462a8906ad612523272c44f2", "score": "0.5192063", "text": "def index\n add_breadcrumb 'Graves'\n @graves = Grave.all\n end", "title": "" }, { "docid": "f38b0c120af53a53fdcf80431d72463f", "score": "0.5190407", "text": "def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end", "title": "" }, { "docid": "d5eb7f58f96c508afc99520d96d47a63", "score": "0.5186822", "text": "def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end", "title": "" }, { "docid": "e2aac7de319dd0950ce034b1c92de94e", "score": "0.51855844", "text": "def show\n @ball_landing = BallLanding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ball_landing }\n end\n end", "title": "" }, { "docid": "7efd24b192528b9be31da68f5427942b", "score": "0.51832825", "text": "def index\n\n #@bundles = Bundle.paginate(page: params[:page], :per_page => 10)\n #@bundles = Bundle.paginate(page: params[:page]).order('id')\n\n @bundles = Bundle.order('id').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bundles }\n end\n end", "title": "" }, { "docid": "ddb6a5c6816ebb9dd2e55bad83748c9d", "score": "0.5181795", "text": "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "title": "" }, { "docid": "ddb6a5c6816ebb9dd2e55bad83748c9d", "score": "0.5181795", "text": "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "title": "" }, { "docid": "b9443713684ca2d5fb10f4e959d70d43", "score": "0.5179831", "text": "def index\n @fabricas = Fabrica.all\n end", "title": "" }, { "docid": "372f6b7d28a01b60f766a0d437ce41ef", "score": "0.51780325", "text": "def index\n @azuls = Azul.all\n end", "title": "" }, { "docid": "72ce08419d5ce80bce41ce897be74359", "score": "0.5173662", "text": "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @sites = current_user.account.sites || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "cba9dc86a2d20925cf4ffe4f996eced3", "score": "0.51728415", "text": "def index\n @bandas = Banda.all\n end", "title": "" }, { "docid": "e655e31720bc3c0ae3ac8e58adab2497", "score": "0.517272", "text": "def index\n\t\tvendas = Venda.all\n\t\trender json: vendas, status: :ok\n\tend", "title": "" }, { "docid": "f17c217078f38466252e7a387bbc24c9", "score": "0.51723236", "text": "def index\n @zabbix_servers = ZabbixServer.all\n\n respond_to do |format|\n format.json\n format.html\n end\n end", "title": "" }, { "docid": "e6669fa9dc8c9aa45d7e141b7a6dae57", "score": "0.51661414", "text": "def bridges_list\n get \"bridges\"\n end", "title": "" }, { "docid": "7d78d46636cba1a22f0a0d3e3e32b0c4", "score": "0.51655245", "text": "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "title": "" }, { "docid": "99540e0c7388da464f88c9c6567043af", "score": "0.5165477", "text": "def index\n @librarians = Librarian.all\n end", "title": "" }, { "docid": "99540e0c7388da464f88c9c6567043af", "score": "0.5165477", "text": "def index\n @librarians = Librarian.all\n end", "title": "" }, { "docid": "cae220edb0cb916fea26e3bb6bc872c4", "score": "0.5162981", "text": "def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end", "title": "" }, { "docid": "3e5c65cf21c383f4ba3c25e93a00d6d1", "score": "0.51620656", "text": "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "title": "" }, { "docid": "258ed7f3ee33e8737f4abf28b7225395", "score": "0.515266", "text": "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "title": "" }, { "docid": "fc127254d5e866bf4830bcbbadafd20c", "score": "0.5143504", "text": "def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end", "title": "" }, { "docid": "8652289da666ad220e39073e810c16eb", "score": "0.51380724", "text": "def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end", "title": "" }, { "docid": "a54f9d437a35b76a34cbf4ad88ee490f", "score": "0.513702", "text": "def index\n @referenceboxes = Referencebox.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @referenceboxes }\n end\n end", "title": "" }, { "docid": "0d485b0bcf6e6251d6b4aa660fc99bfa", "score": "0.5134154", "text": "def index\n @nvs_subsystems = NvsSubsystem.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_subsystems }\n end\n end", "title": "" }, { "docid": "534a1856f3aa21ae397edc113946d46c", "score": "0.5132665", "text": "def json_index_bundles\n\n @bundles = Bundle.where(\"active = 'y'\").order(:id)\n respond_to do |format|\n format.json { render json: @bundles.as_json()\n\n }\n end\n\n end", "title": "" }, { "docid": "a2995bbd79a3856269beec1a12ab287e", "score": "0.5130914", "text": "def index\n @brands, @alphaParams = Brand.all.alpha_paginate(params[:letter], {:js => true, :bootstrap3 => true}){|brand| brand.name}\n\n # @brands.each do |brand|\n # brand[\"logo_url\"] = brand.logo.url if brand.logo\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "title": "" } ]
03a1f07890d0a4d633b6d3eb181b1e6a
PUT /product_costs/1 PUT /product_costs/1.json
[ { "docid": "8e4b3befe95e6ff8ee39c349bd1c3835", "score": "0.7357003", "text": "def update\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:spree_product_cost])\n format.json { head :ok }\n else\n format.json { render json: @product_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "5f65adc41a73ed6cb3c7a4db0dee4f75", "score": "0.66342247", "text": "def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f65adc41a73ed6cb3c7a4db0dee4f75", "score": "0.66342247", "text": "def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5f65adc41a73ed6cb3c7a4db0dee4f75", "score": "0.663403", "text": "def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cf6ded90ccedd448ed982b724476716", "score": "0.66318756", "text": "def wo_update_costs_from_purchase_order\n order = params[:order]\n pct = params[:pct].to_f / 100\n tbl = params[:tbl]\n cost = 0\n costs = 0\n if order != '0'\n @order = PurchaseOrder.find(order)\n # Assignment\n cost = @order.taxable\n costs = (pct / 100) * cost\n end\n # Format numbers\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "ecf50fdcca348f49eaa41498136042bf", "score": "0.6618167", "text": "def update\n @cost = Cost.get(params[:id])\n\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23cefab9b743d65365f5a46daf330280", "score": "0.6616812", "text": "def create\n @adquisition_cost = AdquisitionCost.new(adquisition_cost_params)\n @product_id = @adquisition_cost.product_id\n @product = Product.find(@product_id)\n @standard_price = @product.standard_price\n @actual_cost = @product.cost\n @percentage = (@standard_price - @actual_cost) / @actual_cost\n @new_standard_price = (@adquisition_cost.cost * @percentage) + @adquisition_cost.cost\n\n respond_to do |format|\n if @adquisition_cost.save\n @product.update(cost: @adquisition_cost.cost, standard_price: @new_standard_price)\n format.html { redirect_to @adquisition_cost, notice: 'Adquisition cost was successfully created.' }\n format.json { render :show, status: :created, location: @adquisition_cost }\n else\n format.html { render :new }\n format.json { render json: @adquisition_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de85f4fb1d61987f1b381edfec4fcea7", "score": "0.6601742", "text": "def update\n @costs_of_bitcoin = CostsOfBitcoin.find(params[:id])\n\n respond_to do |format|\n if @costs_of_bitcoin.update_attributes(params[:costs_of_bitcoin])\n format.html { redirect_to @costs_of_bitcoin, notice: 'Costs of bitcoin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @costs_of_bitcoin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98957f06a465180b7632ef86641a1364", "score": "0.6596471", "text": "def change_cost(new_cost)\n CONNECTION.execute(\"UPDATE products SET cost = #{new_cost} WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "ef3b9e75876e9e09c5146edd888ba9f0", "score": "0.65563077", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :new }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "caf53135669f2dabc26ce7825a359031", "score": "0.65383524", "text": "def dn_update_amount_and_costs_from_price_or_quantity\n cost = params[:cost].to_f / 10000\n price = params[:price].to_f / 10000\n qty = params[:qty].to_f / 10000\n tax_type = params[:tax_type].to_i\n discount_p = params[:discount_p].to_f / 100\n discount = params[:discount].to_f / 10000\n product = params[:product]\n tbl = params[:tbl]\n if tax_type.blank? || tax_type == \"0\"\n if !product.blank? && product != \"0\"\n tax_type = Product.find(product).tax_type.id\n else\n tax_type = TaxType.where('expiration IS NULL').order('id').first.id\n end\n end\n tax = TaxType.find(tax_type).tax\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n costs = qty * cost\n tax = amount * (tax / 100)\n qty = number_with_precision(qty.round(4), precision: 4)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n price = number_with_precision(price.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n @json_data = { \"quantity\" => qty.to_s, \"cost\" => cost.to_s, \"costs\" => costs.to_s,\n \"price\" => price.to_s, \"amount\" => amount.to_s, \"tax\" => tax.to_s,\n \"discountp\" => discount_p.to_s, \"discount\" => discount.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "5c35e05134d29a8cb04bee28cad06706", "score": "0.65070045", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :edit }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c35e05134d29a8cb04bee28cad06706", "score": "0.65070045", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :edit }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c35e05134d29a8cb04bee28cad06706", "score": "0.65070045", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :edit }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1efc561c02b9814070c7e6bc81c39a0e", "score": "0.64506036", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :edit }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65bd62dba45224a095ce633b14c43090", "score": "0.6445872", "text": "def update\n r_params = resolve_params \n @quick_cost = QuickCost.find(params[:id])\n @quick_cost.cost.update_attributes(r_params[:cost])\n\n respond_to do |format|\n if @quick_cost.save\n format.html { redirect_to(@quick_cost, :notice => 'Duplicate cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quick_cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "909f37468cccdc871da3d084909f6cad", "score": "0.641018", "text": "def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to(costs_path, :notice => 'Cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d01fde3b074f3c0c7b97264510758cf3", "score": "0.63818437", "text": "def update\n product = Product.find(params[:id])\n product.price = params[:price]\n product.save\n\n #Respond with status with given json if saved.\n if product.save\n render json: { status: 200, message: \"Successfully updated the price.\"}.to_json\n else\n render json: { status: 400, message: \"Error, could not update the price. Please check all fields.\" }.to_json\n end\n end", "title": "" }, { "docid": "a4e0e852a4e04595a6f4f06efe02c107", "score": "0.6334939", "text": "def update\n logger.info \"PUT method\"\n\n @product = Product.find(params[:id], :include => [:prd_attribute, :prd_members, :prd_subscriptions, :prd_tariffs, :prd_balances, :prd_thresholds, :prd_promotions, :prd_additional_services])\n\n product_id = @product.id\n\n\tcase params[:target]\n\t\twhen \"prd_attibute\": \n\t\twhen \"prd_subscriptions\":\n\t\t\tPrdSubscription.save_to_db(params['prd_subscriptions'], product_id)\n\n\t\twhen \"prd_tariffs\":\n\t\t\tPrdTariff.save_to_db(params['prd_tariffs'], product_id)\n\n\t\twhen \"prd_balances\":\n\t\t\tPrdBalance.save_to_db(params['prd_balances'], product_id)\n\n\t\twhen \"prd_thresholds\":\n\t\t\tPrdThreshold.save_to_db(params['prd_thresholds'], product_id)\n\n\t\twhen \"prd_promotions\":\n\t\t\tPrdPromotion.save_to_db(params['prd_promotions'], product_id)\n\n\t\twhen \"prd_additional_services\":\n\n\t\t\tPrdAdditionalService.save_to_db(params['prd_additional_services'], product_id)\n @prd_attribute = @product.prd_attribute\n \t\t # send_to_cs(@product.prd_attribute, @product.prd_subscriptions, @product.prd_promotions, @product.prd_additional_services )\n\n #f = open(\"http://localhost:3000/ccbs_products/\"+@prd_attribute.id.to_s+'.json')\n\n #debugger\n #webpage = f.read\n #f.close\n\n\t\t #make_rules(product_id, @product.prd_attribute.name)\n\tend\n\n respond_to do |format|\n if @product.update_attributes(@put_product)\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "474f93587051124f6627d8aec2464184", "score": "0.6331901", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n recalculate_top_price\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00211ffadbc6b2d4f917fdd60c48f613", "score": "0.63276064", "text": "def wo_update_costs_from_cost_or_enforcement_pct\n cost = params[:cost].to_f / 10000\n pct = params[:pct].to_f / 100\n tbl = params[:tbl]\n costs = (pct / 100) * cost\n pct = number_with_precision(pct.round(2), precision: 2)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"pct\" => pct.to_s, \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "a98f2293416b2b61139bcb898ceee2de", "score": "0.63004947", "text": "def wo_update_amount_and_costs_from_price_or_quantity\n cost = params[:cost].to_f / 10000\n price = params[:price].to_f / 10000\n qty = params[:qty].to_f / 10000\n tax_type = params[:tax_type].to_i\n product = params[:product]\n tbl = params[:tbl]\n if tax_type.blank? || tax_type == \"0\"\n if !product.blank? && product != \"0\"\n tax_type = Product.find(product).tax_type.id\n else\n tax_type = TaxType.where('expiration IS NULL').order('id').first.id\n end\n end\n tax = TaxType.find(tax_type).tax\n amount = qty * price\n costs = qty * cost\n tax = amount * (tax / 100)\n qty = number_with_precision(qty.round(4), precision: 4)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n price = number_with_precision(price.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n @json_data = { \"quantity\" => qty.to_s,\n \"cost\" => cost.to_s, \"costs\" => costs.to_s,\n \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"tbl\" => tbl.to_s }\n\n respond_to do |format|\n format.html # wo_update_amount_and_costs_from_price_or_quantity.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "title": "" }, { "docid": "24045b8ba9c3c3a6e03fb0850290f64c", "score": "0.62813866", "text": "def update\n @cost_of_good = CostOfGood.find(params[:id])\n\n respond_to do |format|\n if @cost_of_good.update_attributes(params[:cost_of_good])\n format.html { redirect_to @cost_of_good, notice: 'Cost of good was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost_of_good.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b1bd6f7ba194cdd14ecbfb5cd0c1b1b7", "score": "0.62528133", "text": "def update\n @cost = Cost.find(params[:id])\n\n respond_to do |format|\n if @cost.update_attributes(params[:cost])\n format.html { redirect_to(@cost, :notice => 'Cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18a6d3d363d1cf11da2f8d7736f35136", "score": "0.62388253", "text": "def update\n respond_to do |format|\n if @operating_cost.update(operating_cost_params)\n format.html { redirect_to @operating_cost, notice: 'Operating cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operating_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ce5dfcd50bd9637dffd6ba45d3b7846", "score": "0.6238316", "text": "def update\n @quote_line_cost = QuoteLineCost.find(params[:id])\n\n respond_to do |format|\n if @quote_line_cost.update_attributes(quote_line_cost_params)\n format.html { redirect_to @quote_line_cost, notice: 'Quote line cost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote_line_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d4c031aeb65b6e79048940139076971", "score": "0.6229857", "text": "def update\n authorize @item\n\n respond_to do |format|\n if @item.update(item_params)\n @item.update(cost: item_params[:cost].to_f * 100) #convert to cent\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b735d9f21ad627e8ed6e20d8f2fce6fe", "score": "0.6210581", "text": "def update\n @progressive_cost = ProgressiveCost.find(params[:id])\n\n respond_to do |format|\n if @progressive_cost.update_attributes(params[:progressive_cost])\n format.html { redirect_to(@progressive_cost, :notice => 'Progressive cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @progressive_cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4328a75fef2563b1e88991a3e0295c6", "score": "0.62082636", "text": "def wo_update_costs_from_cost_or_minutes\n cost = params[:cost].to_f / 10000\n minutes = params[:minutes].to_f / 100\n tbl = params[:tbl]\n costs = minutes * cost\n minutes = number_with_precision(minutes.round(2), precision: 2)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"minutes\" => minutes.to_s,\n \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "811f4d0ede998e544a147aeb34b6087a", "score": "0.6203685", "text": "def wo_update_costs_from_cost_or_distance\n cost = params[:cost].to_f / 10000\n distance = params[:distance].to_f / 100\n tbl = params[:tbl]\n costs = distance * cost\n distance = number_with_precision(distance.round(2), precision: 2)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"distance\" => distance.to_s,\n \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "bfb94420c35cc2d10a2789e5d5d211d4", "score": "0.6201839", "text": "def update_cost_price\n self[:cost_price] = cost_price\n end", "title": "" }, { "docid": "639be9da984ebd9c1fbf94728160f879", "score": "0.6198655", "text": "def update\n @product = Product.find(params[:id])\n apply_other_price_if_required\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "475504b701908d13f00d2748bc471afe", "score": "0.6179094", "text": "def update\n respond_to do |format|\n if @cost.update(cost_params)\n format.html { redirect_to @cost, notice: 'Le coût a été mis à jour.' }\n format.json { render :show, status: :ok, location: @cost }\n else\n format.html { render :edit }\n format.json { render json: @cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4658c0228475fb97c2a685853cebf15a", "score": "0.6178293", "text": "def update\n\n @product_cost_master.update(product_cost_master_params)\n flash[:success] = 'You have updated prices successfully!'\n redirect_to productwithcosts_path\n # respond_to do |format|\n # if @product_cost_master.update(product_cost_master_params)\n # redirect_to productwithcosts_path\n # # format.html { redirect_to @product_cost_master, notice: 'Product cost master was successfully updated.' }\n # #format.json { render :show, status: :ok, location: @product_cost_master }\n # else\n # format.html { render :edit }\n # format.json { render json: @product_cost_master.errors, status: :unprocessable_entity }\n # end\n # end\n\n end", "title": "" }, { "docid": "eb2ce718a71599dc82b4414022a9e342", "score": "0.61703044", "text": "def update_cost(params)\n params[:from] = to_rounded_s(params[:from] || Time.now.utc.to_date)\n params[:to] = to_rounded_s(params[:to] || Time.now.utc)\n params[:cost] = params[:cost].to_f\n params[:timezone] ||= 'UTC'\n params[:campaignId] ||= params.delete(:campaign_id)\n @connection.post('report/manual-cost', params)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.6167053", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.6167053", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.6167053", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "befa79e305ffbf8196362a926992583e", "score": "0.6167053", "text": "def update!(**args)\n @cost_scenario = args[:cost_scenario] if args.key?(:cost_scenario)\n end", "title": "" }, { "docid": "38233b8bb147a1d04b9fbd4354608817", "score": "0.614654", "text": "def update\n respond_to do |format|\n if @new_travel_cost.update(new_travel_cost_params)\n format.html { redirect_to @new_travel_cost, notice: 'New travel cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_travel_cost }\n else\n format.html { render :edit }\n format.json { render json: @new_travel_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ace698942c5d346c43871f588859c36", "score": "0.6145355", "text": "def update\n respond_to do |format|\n if @place_cost.update(place_cost_params)\n format.html { redirect_to @place_cost, notice: 'Place cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @place_cost }\n else\n format.html { render :edit }\n format.json { render json: @place_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bcd231ca7d3400160bf7b40dbd80c628", "score": "0.6136444", "text": "def update\n respond_to do |format|\n if @package_cost.update(package_cost_params)\n format.html { redirect_to backend_package_cost_url(@package_cost), notice: 'Package cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_cost }\n else\n format.html { render :edit }\n format.json { render json: @package_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07e82b4eb740bec84d68f30cbc5c6343", "score": "0.6133843", "text": "def set_cost\r\n @cost = Cost.find(params[:id])\r\n end", "title": "" }, { "docid": "d8a477f2db2330ecade920280c0b11ad", "score": "0.61007094", "text": "def update\n \n respond_to do |format|\n if @potion.update(potion_params)\n if params[\"ingredients\"] && params[\"ingredients\"].size > 0\n \n Potion.destroy_recipes(@potion.id)\n Potion.save_ingredients(params[\"ingredients\"], @potion.id)\n \n costs = Potion.compute_production_costs(params[\"ingredients\"])\n @potion.production_cost = costs\n @potion.save\n end\n format.html { redirect_to @potion, notice: 'Potion was successfully updated.' }\n format.json { render :show, status: :ok, location: @potion }\n else\n format.html { render :edit }\n format.json { render json: @potion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c22396382e68f04288877e1b3b0d1947", "score": "0.6097649", "text": "def po_update_description_prices_from_product\n product = params[:product]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end", "title": "" }, { "docid": "2db61b98d52196920871f2b3c450be52", "score": "0.6090305", "text": "def or_update_description_prices_from_product\n product = params[:product]\n description = \"\"\n qty = 0\n price = 0\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n @prices = @product.purchase_prices\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n price = @product.reference_price\n amount = qty * price\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id }\n render json: @json_data\n end", "title": "" }, { "docid": "8bf4e275273bb38af11de21f8bcb7836", "score": "0.60767585", "text": "def update!(**args)\n @cost = args[:cost] if args.key?(:cost)\n @currency_code = args[:currency_code] if args.key?(:currency_code)\n @id = args[:id] if args.key?(:id)\n @revenue = args[:revenue] if args.key?(:revenue)\n @tax = args[:tax] if args.key?(:tax)\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "3851072e3484a2529b7717566d2a0200", "score": "0.60751396", "text": "def set_cost\n @cost = Cost.find(params[:id])\n end", "title": "" }, { "docid": "e96ec09f5b3f7dfece9f097cd9f90131", "score": "0.6066499", "text": "def wo_update_costs_from_vehicle\n vehicle = params[:vehicle]\n distance = params[:distance].to_f / 100\n tbl = params[:tbl]\n cost = 0\n costs = 0\n if vehicle != '0'\n @vehicle = Vehicle.find(vehicle)\n # Assignment\n cost = @vehicle.cost\n costs = distance * cost\n end\n # Format numbers\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "518c45123e27809ac607b32cc9512969", "score": "0.6060024", "text": "def update\n respond_to do |format|\n if @current_travel_cost.update(current_travel_cost_params)\n format.html { redirect_to @current_travel_cost, notice: 'Current travel cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_travel_cost }\n else\n format.html { render :edit }\n format.json { render json: @current_travel_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5ea2967fef34d3cb10f2ff882a49eeab", "score": "0.6050425", "text": "def update\n @v1_product = V1::Product.find(params[:id])\n\n if @v1_product.update(v1_product_params)\n head :no_content\n else\n render json: @v1_product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "831cfb5e643d8a35d178854a63d08968", "score": "0.6046383", "text": "def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dbfb30e0834ffb788ce378f361ddbd7c", "score": "0.6044857", "text": "def update\n previous_subscription = @subscription\n respond_to do |format|\n if @subscription.update(subscription_params)\n @subscription.update_cost(previous_subscription)\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26ab610ea3bf671221992f0aaf562a63", "score": "0.604435", "text": "def update\n begin\n product = Product.find(plan_params[:product_id])\n \t\t @plan.update!(product: product)\n \t\t redirect_to @plan, notice: 'Plan was successfully updated.'\n \t\trescue\n \t\trender json: @plan.errors, status: :unprocessable_entity \n \tend\n end", "title": "" }, { "docid": "9fdb829ba3465e172f969f3c5f6355f5", "score": "0.60385484", "text": "def update\n respond_to do |format|\n if @adquisition_cost.update(adquisition_cost_params)\n format.html { redirect_to @adquisition_cost, notice: 'Adquisition cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @adquisition_cost }\n else\n format.html { render :edit }\n format.json { render json: @adquisition_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d8f9f92d3afe5f39351e645eda4400e", "score": "0.6035203", "text": "def update\n \n if @product.update(product_params)\n render JSON: @product\n else\n render JSON: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "57313b308dca2eb5cb64a0486a753ae2", "score": "0.60323447", "text": "def update\n @product_pricing = ProductPricing.find(params[:id])\n\n respond_to do |format|\n if @product_pricing.update_attributes(params[:product_pricing])\n format.html { redirect_to(@product_pricing, :notice => 'Product pricing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product_pricing.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b2c55c702cd6c508e37a3fed0fde4e1", "score": "0.60216594", "text": "def update\n overall_cost = ComputePrice.execute(@furniture, set: @set, **compute_price_params)\n respond_to do |format|\n if @admin_selling_config_price.update(admin_selling_config_price_params.to_h.merge({ overall_cost: overall_cost }))\n @furniture.update_attributes(available: true)\n format.html { redirect_to admin_furniture_furnitures_path, notice: mk_notice(@admin_selling_config_price, @furniture.name, 'تنظیمات قیمت‌گذاری', :update) }\n format.json { render json: @admin_selling_config_price, status: :ok, location: admin_furniture_furnitures_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_selling_config_price.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b0ed39dea7e3bb35fb7d92d1c36ecdc", "score": "0.60187453", "text": "def update\n product_id = params[:id]\n # get a particular product from the db\n @product1 = Product.find_by(id: product_id)\n # to modify the particular product \n @product1.name = params[:input_name] || @product1.name\n @product1.price = params[:input_price] || @product1.price\n @product1.price = params[:input_supplier] || @product1.supplier\n @product1.description = params[:input_description] || @product1.description\n @product1.image = params[:input_image] || @product1.image\n @product1.save\n render \"show.json.jbuilder\"\n end", "title": "" }, { "docid": "274f22ac8c98d92d4bf17030b674def5", "score": "0.60170525", "text": "def wo_update_orders_costs_from_supplier\n supplier = params[:supplier]\n pct = params[:pct]\n tbl = params[:tbl]\n cost = 0\n costs = 0\n if supplier != '0'\n @supplier = Supplier.find(supplier)\n @orders = @supplier.blank? ? orders_dropdown : @supplier.purchase_orders.includes(:supplier).by_supplier_no\n else\n @orders = orders_dropdown\n end\n # Purchase orders array\n @orders_dropdown = orders_array(@orders)\n # Format numbers\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"order\" => @orders_dropdown, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "198e9d31868b7bf0d2039c842f8ad3b8", "score": "0.6016829", "text": "def update\n @costing.update(costing_params)\n @costing.landed_cost = @costing.foreign_cost.to_i * ((100 + @costing.markup.to_f ) / 100)\n respond_to do |format|\n if @costing.save\n format.html { redirect_to @costing, notice: 'Costing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @costing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9435587bbcef24abffe48c7949518355", "score": "0.6014096", "text": "def producto_params\n params.require(:product).permit(:description, :cost)\n end", "title": "" }, { "docid": "f255510e7d892c202f9c0780f182c924", "score": "0.6011513", "text": "def ci_update_amount_from_price_or_quantity\n price = params[:price].to_f / 10000\n qty = params[:qty].to_f / 10000\n tax_type = params[:tax_type].to_i\n discount_p = params[:discount_p].to_f / 100\n discount = params[:discount].to_f / 10000\n product = params[:product]\n tbl = params[:tbl]\n if tax_type.blank? || tax_type == \"0\"\n if !product.blank? && product != \"0\"\n tax_type = Product.find(product).tax_type.id\n else\n tax_type = TaxType.where('expiration IS NULL').order('id').first.id\n end\n end\n tax = TaxType.find(tax_type).tax\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax = amount * (tax / 100)\n qty = number_with_precision(qty.round(4), precision: 4)\n price = number_with_precision(price.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n @json_data = { \"quantity\" => qty.to_s, \"price\" => price.to_s, \"amount\" => amount.to_s, \"tax\" => tax.to_s,\n \"discountp\" => discount_p.to_s, \"discount\" => discount.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "5e5a351873ebbb38d2d2fb30153695df", "score": "0.6006778", "text": "def update\n @special_price = SpecialPrice.find(params[:id])\n @special_price.update_attributes(params[:special_price])\n\n # UPDATE ALL PRODUCTS WITH THIS PRICE\n products = @special_price.products.all\n products.each do |product|\n product.update_attributes(:sales_price => @special_price.try(:price_each_size).to_f * product.size.to_f)\n end\n # END UPDATE ALL PRODUCTS WITH THIS PRICE\n\n get_data\n end", "title": "" }, { "docid": "12e79317e5cc9caeadc9e8f9e88bbae0", "score": "0.6002762", "text": "def update\n respond_to do |format|\n if @travel_cost.update(travel_cost_params)\n format.html { redirect_to @travel_cost, notice: 'Travel cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_cost }\n else\n format.html { render :edit }\n format.json { render json: @travel_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23649727950af66cc620106e4097b3f0", "score": "0.6002556", "text": "def update\n @cost_type = CostType.find(params[:id])\n\n respond_to do |format|\n if @cost_type.update_attributes(params[:cost_type])\n format.html { redirect_to @cost_type, notice: 'Cost type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43e72fad0ea386c715a4bb37811dc58e", "score": "0.6001966", "text": "def update\n respond_to do |format|\n order_params[:cost] = convert_money(order_params[:cost])\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n @client_id = @order.client_id\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "844df73da35de0c2656694eb3879bf2b", "score": "0.5999371", "text": "def update\n @product = Product.find(params[:id])\n if params[:product][:min_quantity].blank?\n params[:product][:min_quantity] = -1\n end\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de8b3593f4984dfe1f10b0dfb70c2923", "score": "0.599633", "text": "def update!(**args)\n @cost = args[:cost] if args.key?(:cost)\n @currency_code = args[:currency_code] if args.key?(:currency_code)\n @original_price = args[:original_price] if args.key?(:original_price)\n @price = args[:price] if args.key?(:price)\n @price_effective_time = args[:price_effective_time] if args.key?(:price_effective_time)\n @price_expire_time = args[:price_expire_time] if args.key?(:price_expire_time)\n @price_range = args[:price_range] if args.key?(:price_range)\n end", "title": "" }, { "docid": "ab7ae82d44431d4780064de7285c1bfe", "score": "0.5990735", "text": "def update\n @cost_bill = CostBill.find(params[:id])\n @cost_bill.cost_type = CostType.find(params[:cost_type][:id])\n respond_to do |format|\n if @cost_bill.update_attributes(params[:cost_bill])\n format.html { redirect_to @cost_bill, notice: 'Cost bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65a5023022fc4e97e9e601acb30bbeab", "score": "0.5989773", "text": "def update\n @sales_quotation_cost = SalesQuotationCost.find(params[:id])\n\n # format create_log(subject, object, detail, employee_name)\n create_log(\"Update Cost\", \"Sales Order\", \"Update detail with header id:#{@sales_quotation_header.sq_id}, \n description:#{params[:sales_quotation_cost][:description]}, \n quantity from:#{@sales_quotation_cost.quantity} to:#{params[:sales_quotation_cost][:quantity]}, \n price from:#{@sales_quotation_cost.price} to:#{params[:sales_quotation_cost][:price]}, \n disc price from:#{@sales_quotation_cost.discount_item_price} to:#{params[:sales_quotation_cost][:discount_item_price]}, \n disc from:#{@sales_quotation_cost.discount_item} to:#{params[:sales_quotation_cost][:discount_item]}, \n total from:#{@sales_quotation_cost.amount} to:#{params[:sales_quotation_cost][:amount]}.\".strip, current_user.full_name)\n \n respond_to do |format|\n if @sales_quotation_cost.update_attributes(params[:sales_quotation_cost])\n get_sales_cost_details\n # Get Sales Order Header information\n get_sales_quotation_header\n\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_quotation_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "065bd35edfdc1792b30aef7c46bbcb8b", "score": "0.5988875", "text": "def update\n if @product.update_attributes(product_params)\n render json: @product\n else\n render_errors 400, @product.errors.full_messages\n end\n end", "title": "" }, { "docid": "f1f9ae0dfd2800ecff4639491e8d35f2", "score": "0.5984127", "text": "def update\n @factory_input_cost = FactoryInputCost.find(params[:id])\n\n respond_to do |format|\n if @factory_input_cost.update_attributes(params[:factory_input_cost])\n format.html { redirect_to(@factory_input_cost, :notice => 'Factory input cost was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @factory_input_cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b25fc855436283d25def60769da979d2", "score": "0.59802854", "text": "def update\r\n\r\n last_cost = @quantity.cost\r\n last_weight = @quantity.weight\r\n cost_kilo = ( last_cost / last_weight )\r\n \r\n Quantity.transaction do \r\n\r\n lot = Lot.find_by(id: @quantity.lot_id)\r\n product_treatment_phase = ProductTreatmentPhase.joins(:lot).where(lot_id: lot.id, cost: lot.cost, weight: lot.weight, product_id: @quantity.product_id).last\r\n \r\n cost_lot_total = (lot.weight * lot.cost)\r\n cost_lot_total = (cost_lot_total - last_cost)\r\n lot.weight = ( lot.weight - last_weight )\r\n cost_kilo_lot = ( cost_lot_total / lot.weight )\r\n lot.cost = cost_kilo_lot \r\n \r\n old_cost_lot = ( lot.weight * lot.cost )\r\n new_weight = ( lot.weight + quantity_params[:weight] )\r\n new_cost = ( ( old_cost_lot + quantity_params[:cost] ) / new_weight )\r\n \r\n lot.update(cost: new_cost, weight: new_weight)\r\n product_treatment_phase.update(cost: new_cost, weight: new_weight)\r\n\r\n if @quantity.update(quantity_params)\r\n render json: @quantity \r\n else\r\n render json: @quantity.errors, status: :unprocessable_entity\r\n end\r\n \r\n end # closed transaction \r\n end", "title": "" }, { "docid": "1f7c3a69989387bc8c8ac0aaab11b811", "score": "0.59680194", "text": "def rn_update_description_prices_from_product\n product = params[:product]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end", "title": "" }, { "docid": "c3b080f6042a57608feef776dce9e5cf", "score": "0.59560215", "text": "def update\n updated_params = convert_price_to_cent(product_params)\n respond_to do |format|\n if @product.update(updated_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34f215039036b88f52e4ec3ffec17963", "score": "0.5953431", "text": "def update\n price_in_cents = product_params[:price_in_cents].to_d * 100\n @product.update(product_params.merge(price_in_cents: price_in_cents))\n end", "title": "" }, { "docid": "60068f0f289176a384f1c3fd373ac1fa", "score": "0.59490204", "text": "def update\n @line_item.quantity = params[:quantity]\n @line_item.save\n render json: @line_item\n end", "title": "" }, { "docid": "af44c0dc8dc46a0a8c04c0ee3ae2c872", "score": "0.5942823", "text": "def wo_update_costs_from_cost_or_hours\n cost = params[:cost].to_f / 10000\n hours = params[:hours].to_f / 10000\n tbl = params[:tbl]\n costs = hours * cost\n hours = number_with_precision(hours.round(4), precision: 4)\n cost = number_with_precision(cost.round(4), precision: 4)\n costs = number_with_precision(costs.round(4), precision: 4)\n @json_data = { \"hours\" => hours.to_s,\n \"cost\" => cost.to_s, \"costs\" => costs.to_s, \"tbl\" => tbl.to_s }\n\n respond_to do |format|\n format.html # wo_update_costs_from_cost_or_hours.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "title": "" }, { "docid": "f09147afb9f5b43fb19f0d86e0d0c8a3", "score": "0.5933024", "text": "def cost_params\r\n params.require(:cost).permit(:value, :user_id, :benefit_id)\r\n end", "title": "" }, { "docid": "5c6319d5d1359344b6f84703adc4eefa", "score": "0.59279466", "text": "def rn_update_amount_from_price_or_quantity\n price = params[:price].to_f / 10000\n qty = params[:qty].to_f / 10000\n tax_type = params[:tax_type].to_i\n discount_p = params[:discount_p].to_f / 100\n discount = params[:discount].to_f / 10000\n product = params[:product]\n tbl = params[:tbl]\n if tax_type.blank? || tax_type == \"0\"\n if !product.blank? && product != \"0\"\n tax_type = Product.find(product).tax_type.id\n else\n tax_type = TaxType.where('expiration IS NULL').order('id').first.id\n end\n end\n tax = TaxType.find(tax_type).tax\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax = amount * (tax / 100)\n qty = number_with_precision(qty.round(4), precision: 4)\n price = number_with_precision(price.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n @json_data = { \"quantity\" => qty.to_s, \"price\" => price.to_s, \"amount\" => amount.to_s, \"tax\" => tax.to_s,\n \"discountp\" => discount_p.to_s, \"discount\" => discount.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "c74bec90ce777a5cd7b189f2bd0741a4", "score": "0.5925811", "text": "def update\n @purchase = Purchase.find(params[:id])\n @object = eval(@purchase.purchasable_type + '.find ' + @purchase.purchasable_id.to_s)\n \n if @purchase.purchasable_type == 'Dress'\n @purchase.total_cost = (@object.net_cost + @object.vat_cost)*@purchase.quantity\n else\n @purchase.purchasable.shopping_cart_items.each do |sci|\n sci.update_costs\n @purchase.total_cost = sci.total_cost + @purchase.total_cost\n end\n end\n session[:matriclick_purchase_price] = @purchase.price\n \n respond_to do |format|\n if @purchase.update_attributes(params[:purchase])\n format.html { redirect_to buy_confirm_path(:purchase_id => @purchase) }\n format.json { head :ok }\n else\n format.html { redirect_to buy_details_path(:purchasable_id => @purchase.purchasable_id.to_s, :purchasable_type => @purchase.purchasable_type), notice: 'Debes completar todos los campos y aceptar los términos y condiciones.<br />Recuerda agregar la dirección de despacho si es requerida.<br />Debes elegir una talla y la cantidad no debe superar la disponibilidad.<br />' }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3bb7e6580bec0dba0c458394ff0786c8", "score": "0.5921129", "text": "def set_product_cost_master\n @product_cost_master = ProductCostMaster.find(params[:id])\n \n end", "title": "" }, { "docid": "9b50856de94edc42b7a70f934aa09d71", "score": "0.5905679", "text": "def adquisition_cost_params\n params.require(:adquisition_cost).permit(:product_id, :cost)\n end", "title": "" }, { "docid": "eca942bbd5967002452aa05471a28f40", "score": "0.59037954", "text": "def ci_update_description_prices_from_product\n product = params[:product]\n tbl = params[:tbl]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n price = @product.sell_price\n code = @product.product_code\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "title": "" }, { "docid": "80b5cb518218550333712dfdbbe07cfd", "score": "0.58944815", "text": "def update\n # logger.debug \"New article: #{@product.price_tax_excluded}\"\n logger.debug \"Article should be valid: #{@product.valid?}\"\n if @product.update(product_params)\n render plain: \"Successfully Updated!\"\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d75d8b9a96567bd98a61f97a179117b9", "score": "0.5884465", "text": "def setprice\n\t\t@product = Product.where(id: params[:id]).first\n\n\t\tif @product\n\t\t\t@product.update(price: product_params[:price])\n\n\t\t\trender json: @product, status: :ok\n\t\telse\n\t\t\trender json: { 'message':\"There is no such product with id #{params[:id]}...\"}\n\t\tend\n\tend", "title": "" }, { "docid": "641592ac8bdc4e262d8ca4f443c92c5d", "score": "0.58831203", "text": "def update\n respond_to do |format|\n if @express_price.update(express_price_params)\n format.html { redirect_to @express_price, notice: 'Express price was successfully updated.' }\n format.json { render :show, status: :ok, location: @express_price }\n else\n format.html { render :edit }\n format.json { render json: @express_price.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36703907ad07197bdda1f7ddcd660124", "score": "0.5877668", "text": "def update\n if @product.update(product_params)\n render json: {\n status: :updated,\n product: @product\n }\n else\n render json: {\n status: 500\n }\n end\n end", "title": "" }, { "docid": "7f54a2f76d6ab661e888924c3530f166", "score": "0.5872159", "text": "def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "title": "" } ]
4b003d115e5f6aed8034475a7cc14f89
p stock_buy([10, 7, 5, 8, 11, 9]) You have a list of integers, and for each index you want to find the product of every integer except the integer at that index. Write a function get_products_of_all_ints_except_at_index() that takes a list of integers and returns a list of the products. For example, given: [1, 7, 3, 4] your function would return: [84, 12, 28, 21] by calculating: [734, 134, 174, 173]
[ { "docid": "fefe9065c2a29d738943a0c383bfd152", "score": "0.69496894", "text": "def get_products_of_all_ints_except_at_index(a)\n prod = 1\n a.each { |n| prod *= n if n != 0 }\n a.map { |n| n == 0 ? prod : prod / n }\nend", "title": "" } ]
[ { "docid": "c9154a2b8aa0acd85094951162a9cd97", "score": "0.81137574", "text": "def get_products_of_all_ints_except_at_index3(list)\n products = Array.new(list.count)\n max_index = list.count-1\n\n # Get product of numbers before index\n current_product = 1\n (0..max_index).each do |index|\n products[index] = current_product\n current_product *= list[index]\n end\n\n # Get product of numbers after index\n current_product = 1\n (0..max_index).each do |index|\n products[max_index-index] *= current_product\n current_product *= list[max_index-index]\n end\n products\nend", "title": "" }, { "docid": "bdab04660498bb2566e290f0194d3dfa", "score": "0.79442096", "text": "def get_products_of_all_ints_except_at_index2(list)\n products_before = Array.new(list.count)\n products_after = Array.new(list.count)\n current_before_product = 1\n current_after_product = 1\n (0..list.count-1).each do |index|\n products_before[index] = current_before_product\n current_before_product *= list[index]\n products_after[list.count-1-index] = current_after_product\n current_after_product *= list[list.count-1-index]\n end\n\n products = []\n (0..list.count-1).each do |index|\n products << products_before[index] * products_after[index]\n end\n products\nend", "title": "" }, { "docid": "966b1934690029050724f8aec67a0d48", "score": "0.7747536", "text": "def get_products_of_all_ints_except_at_index1(list)\n return [1] unless list.count > 1\n\n products = Array.new(list.count) # This is faster to create array of exact size\n\n (0..list.count-1).each do |index|\n cloned_list = list.clone\n cloned_list.delete_at(index)\n products[index] = cloned_list.reduce(&:*)\n end\n products\nend", "title": "" }, { "docid": "cd042191fb082ce8bf2ce09edfcf2d46", "score": "0.77331084", "text": "def get_products_of_all_ints_except_at_index(ary)\n ary.each_with_index do |num, i|\n \n end\n #returns array of products\nend", "title": "" }, { "docid": "759f7cbdbb7793659f467612fbaa15a8", "score": "0.77272666", "text": "def get_products_of_all_int_except_at_index int_array\n prods_except_at_index = []\n i = int_array.length-1\n product_so_far = 1\n\n 0.upto(i) do |x|\n prods_except_at_index << product_so_far\n product_so_far *= int_array[x]\n end\n\n product_so_far = 1\n \n (i).downto(0) do |x|\n prods_except_at_index[x] *= product_so_far\n product_so_far *= int_array[x]\n end\n\n return prods_except_at_index\nend", "title": "" }, { "docid": "05467b6689a5b902d19b9d8dc258f042", "score": "0.75908315", "text": "def get_products_of_all_ints_except_at_index(arr)\n length = arr.length\n i = 0\n products = []\n length.times do\n multiple = arr.dup\n multiple.delete_at(i)\n products << multiple.inject(:*)\n i += 1\n end\nend", "title": "" }, { "docid": "b8f5cff0fc3ff9455703a9dd5490b2aa", "score": "0.75765985", "text": "def get_products_of_all_ints_except_at_index(arr)\n products = []\n (0...arr.length).each do |index|\n product = 1\n arr.each do |num|\n if num != arr[index]\n product *= num\n end\n end\n products << product \n end\n products\nend", "title": "" }, { "docid": "9982ffcf825574b3af66859959db0c02", "score": "0.7559311", "text": "def get_products_of_all_ints_except_at_index(int_array)\n products_array = []\n int_array.each_with_index do |integer,i|\n array_with_no_int = int_array - [int_array.slice(i)]\n products_array << array_with_no_int.inject(:*)\n end\n products_array\nend", "title": "" }, { "docid": "b1587309c896a2fa5012867c8a1ea2dc", "score": "0.7538418", "text": "def get_products_of_all_ints_except_at_index(array)\n answer = []\n array.count.times do\n num = array.shift\n answer << array.inject(:*)\n array << num\n end\n answer\nend", "title": "" }, { "docid": "6b19acd6f49754ea459a0870e6b1dee7", "score": "0.7535964", "text": "def get_products_of_all_ints_except_at_index(int_array)\n # ex\n # [1, 2, 3]\n # should return\n # 2 * 3\n # 1 * 3\n # 2 * 1\n # => [6, 3, 2]\n res = []\n \n # Return array\n res\nend", "title": "" }, { "docid": "d75b05e990fc08ad8fd9d3e1864a54df", "score": "0.7521847", "text": "def get_products_of_all_int_except_at_index int_array\n prods_except_at_index = []\n\n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n\n product_so_far = 1\n i = 0\n while i < int_array.length\n prods_except_at_index[i] = product_so_far\n product_so_far *= int_array[i]\n i+=1\n end\n \n # for each integer, we find the product of all the integers after it. since each index in products already has the product of all the integers before it, now we're storing the total product of all other integers\n\n product_so_far = 1\n i = int_array.length - 1\n while i >= 0\n prods_except_at_index[i] *= product_so_far\n product_so_far *= int_array[i]\n i -= 1\n end\n return prods_except_at_index\nend", "title": "" }, { "docid": "efe184dd56d4c94a371db63b584db7dc", "score": "0.75102746", "text": "def get_products_of_all_ints_except_at_index(array)\n products_of_ints_except_at_index = [1] * array.length # => [1,1,1,1,1]\n\n # iterate through forwards, storing the products of all ints BEFORE the index\n product = 1\n i = 0\n while i < array.length\n products_of_ints_except_at_index[i] = product\n # [1,1,1,1,1]\n # [1,1,1,1,1]\n # [1,1,2,1,1]\n # [1,1,2,12,1]\n # [1,1,2,12,60]\n product *= array[i]\n # 1,2,12,60,540\n i += 1\n end\n\n # iterate through backwards, storing the products of all ints AFTER the index\n product = 1\n i = array.length - 1\n while i >= 0\n products_of_ints_except_at_index[i] *= product\n # [1,1,2,12,60]\n # [1,1,2,108,60]\n # [1,1,90,108,60]\n # [1,270,90,108,60]\n # [540,270,90,108,60]\n product *= array[i]\n # 9,45,270,540,540\n i -= 1\n end\n products_of_ints_except_at_index\nend", "title": "" }, { "docid": "26c05dfb429304eb6eaa150e101d9d3c", "score": "0.7429019", "text": "def get_products_of_all_ints_except_at_index(nums)\n prods = []\n\n nums.each_with_index do |num1, i|\n prod = 1\n nums.each_with_index do |num2, j|\n next if i == j\n prod = prod * num2\n end\n\n prods[i] = prod\n end\n\n prods\nend", "title": "" }, { "docid": "45cec7d35afb03cfcb7c81437e0894ee", "score": "0.7408149", "text": "def get_products_of_all_ints_except_at_index(arr)\n raise IndexError, 'Requires at least 2 numbers' if arr.length < 2\n # get products of ints before each index\n products_of_ints_except_index = []\n product = 0\n i = 0\n while i < arr.length\n products_of_ints_except_index[i] = product\n product *= arr[i]\n i += 1\n end\n product = 0\n i = arr.length - 1\n while i >= 0\n products_of_ints_except_index *= product\n product *= arr[i]\n i -= 1\n end\n return products_of_ints_except_index\nend", "title": "" }, { "docid": "7f28826ad7b83d2474dd49e7a5d8c8f5", "score": "0.74061835", "text": "def get_products_of_all_ints_except_at_index(arr)\n arr_length = arr.length\n\n products_before = [1]\n products_after = Array.new(arr_length + 1){ 1 }\n\n product_array = []\n\n (0..arr_length - 2).each do |i|\n products_before << arr[i] * products_before[i]\n\n products_after[arr_length - 2 - i] = arr[arr_length - 1 - i] * products_after[arr_length - 1 - i]\n end\n\n (0..arr_length - 1).each do |i|\n product_array << products_before[i] * products_after[i]\n end\n\n product_array\nend", "title": "" }, { "docid": "d755826ab2c28beb1fa199749e636621", "score": "0.7340853", "text": "def get_products_of_all_ints_except_at_index(nums)\n raise 'input must be array of two ints or more' unless nums.length > 1\n\n # walk forward over nums and store product before i in prods_from_left\n left_i = 0\n last_prod_on_left = 1\n prods_from_left = [1] * nums.length\n\n # walk backward over nums and store product after i in prods_from_right\n right_i = nums.length - 1\n last_prod_on_right = 1\n prods_from_right = [1] * nums.length\n\n while left_i < nums.length\n left_num = nums[left_i]\n right_num = nums[right_i]\n\n if left_i == 0\n last_prod_on_left = left_num\n last_prod_on_right = right_num\n left_i += 1\n right_i -= 1\n next\n end\n\n prods_from_left[left_i] = last_prod_on_left\n last_prod_on_left = last_prod_on_left * left_num\n\n prods_from_right[right_i] = last_prod_on_right\n last_prod_on_right = last_prod_on_right * right_num\n\n left_i += 1\n right_i -= 1\n end\n\n # create new array with products except at the current index\n # by multiplying value of prods_from_left and prods_from_right at the current index\n prods_except_at_index = [1] * nums.length\n prods_from_left.each_with_index do |prod_from_left, i|\n prods_except_at_index[i] = prod_from_left * prods_from_right[i]\n end\n\n prods_except_at_index\nend", "title": "" }, { "docid": "87019629b6be297888d1d0833e409999", "score": "0.72649187", "text": "def get_product_of_all_ints_except_at_index(integers)\n array_product = integers.inject(&:*)\n integers.map { |int| array_product / int }\nend", "title": "" }, { "docid": "856c2ed665c058f8ad5862c6f7f161a2", "score": "0.72633016", "text": "def products_except_me(numbers)\n product_idx = 0\n new_numbers = []\n while product_idx < 4\n new_numbers << array_product(numbers, product_idx)\n product_idx += 1\n end\n return new_numbers\nend", "title": "" }, { "docid": "9b56da6f36d9b58d62f9e5f52404c1c6", "score": "0.7231111", "text": "def get_products_of_all_ints_except_at_index(numbers_array)\n numbers_array.each.with_index.reduce([[], numbers_array.dup], &method(:reducer)).first\nend", "title": "" }, { "docid": "68422407dfea591d86dde2f5d2c0309b", "score": "0.7203169", "text": "def products_except_me(numbers)\n result = []\n numbers.each_index do |i|\n product = 1\n numbers.each_with_index do |el, j|\n product *= el if i != j\n end\n result << product\n end\n result\nend", "title": "" }, { "docid": "19f243690681de9cc3342ff88a90f99a", "score": "0.7115126", "text": "def get_products_of_all_ints_except_at_index(int_array)\n if int_array.length < 2\n raise IndexError, 'Getting the product of numbers at other indices requires at least 2 numbers'\n end\n\n products_of_all_ints_except_at_index = []\n\n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < int_array.length\n products_of_all_ints_except_at_index[i] = product_so_far\n product_so_far *= int_array[i]\n i += 1\n end\n\n # for each integer, we find the product of all the integers\n # after it. since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = int_array.length - 1\n while i >= 0\n products_of_all_ints_except_at_index[i] *= product_so_far\n product_so_far *= int_array[i]\n i -= 1\n end\n\n products_of_all_ints_except_at_index\nend", "title": "" }, { "docid": "2cd6afe262c329d1589485ae526f1a2f", "score": "0.7081458", "text": "def get_products_of_all_ints_except_at_index(int_array)\n\n if int_array.length < 2\n raise IndexError, 'Getting the product of numbers at other indices requires at least 2 numbers'\n end\n \n products_of_all_ints_except_at_index = []\n \n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < int_array.length\n products_of_all_ints_except_at_index[i] = product_so_far\n product_so_far *= int_array[i]\n i += 1\n end\n \n # for each integer, we find the product of all the integers\n # after it. since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = int_array.length - 1\n while i >= 0\n products_of_all_ints_except_at_index[i] *= product_so_far\n product_so_far *= int_array[i]\n i -= 1\n end\n \n return products_of_all_ints_except_at_index\n end", "title": "" }, { "docid": "22a9cae1921a2e65902a48b407d60ee4", "score": "0.7048996", "text": "def get_products_of_all_ints_except_at_index(int_array)\r\n\r\n if int_array.length < 2\r\n raise IndexError, 'Getting the product of numbers at other indices requires at least 2 numbers'\r\n end\r\n \r\n products_of_all_ints_except_at_index = []\r\n \r\n # For each integer, we find the product of all the integers\r\n # before it, storing the total product so far each time.\r\n product_so_far = 1\r\n i = 0\r\n while i < int_array.length\r\n products_of_all_ints_except_at_index[i] = product_so_far\r\n product_so_far *= int_array[i]\r\n i += 1\r\n end\r\n \r\n # For each integer, we find the product of all the integers\r\n # after it. Since each index in products already has the\r\n # product of all the integers before it, now we're storing\r\n # the total product of all other integers.\r\n product_so_far = 1\r\n i = int_array.length - 1\r\n while i >= 0\r\n products_of_all_ints_except_at_index[i] *= product_so_far\r\n product_so_far *= int_array[i]\r\n i -= 1\r\n end\r\n \r\n products_of_all_ints_except_at_index\r\n end", "title": "" }, { "docid": "92824ed6e155865e6a8c57523dd9c617", "score": "0.70161283", "text": "def get_products_of_all_ints_except_at_index(array)\n solution = []\n for i in (0..array.length - 1)\n product = 1\n rejected = array.reject { |n| n == array[i] }\n rejected.each { |value| product *= value }\n solution << product\n i += 1\n end\n p solution\nend", "title": "" }, { "docid": "d758bd852d711b08987e1eb459a51d81", "score": "0.69495964", "text": "def get_products_2(arr)\n\n products_before_index = []\n\n before_index = 0 \n product = 1\n while before_index < arr.length \n products_before_index.push(product)\n product *= arr[before_index]\n before_index += 1\n end\n\n # product of all integers after each index \n # start from the end, save the product and multiply by arr[i-1]\n\n\n products_after_index = []\n after_index = arr.length - 1\n product_so_far = 1 \n while after_index >= 0\n products_after_index.unshift(product_so_far)\n product_so_far *= arr[after_index] \n after_index -= 1 \n end\n\n\n i = 0 \n result = []\n while i < arr.length\n before = products_before_index[i]\n after = products_after_index[i]\n result.push(before * after)\n i += 1 \n end\n result\nend", "title": "" }, { "docid": "31437f1e698ab3f3977c8ba5bd0f361a", "score": "0.69232076", "text": "def products_except_me(numbers)\n total_product = product(numbers)\n result = []\n\n numbers.each do |n|\n result << total_product / n\n end\n\n result\nend", "title": "" }, { "docid": "8b78f1cd8235f25292beebbc615980d9", "score": "0.6866743", "text": "def get_products_of_all_ints_except_at_index(nums)\n raise 'input must be array of two ints or more' unless nums.length > 1\n\n # walk forward over nums and store last_prod_on_left at current index of prods_except_at_index,\n # then calculate the new last_prod_on_left using current num\n left_i = 0\n last_prod_on_left = 1\n\n prods_except_at_index = [1] * nums.length\n\n # multiply running values of prods left of current index\n while left_i < nums.length\n left_num = nums[left_i]\n\n if left_i == 0\n last_prod_on_left = left_num\n left_i += 1\n next\n end\n\n prods_except_at_index[left_i] = last_prod_on_left\n last_prod_on_left = last_prod_on_left * left_num\n\n left_i += 1\n end\n\n # walk backward over nums and store last_prod_on_right at current index of prods_except_at_index\n # then calculate the new last_prod_on_right using current num\n # at the same time, multiply prods_except_at_index value at current index by the last prod_on_right\n # which will give you the product of all other numbers except that current index\n right_i = nums.length - 1\n last_prod_on_right = 1\n while right_i >= 0\n right_num = nums[right_i]\n\n if right_i == nums.length - 1\n last_prod_on_right = right_num\n right_i -= 1\n next\n end\n\n prods_except_at_index[right_i] = last_prod_on_right * prods_except_at_index[right_i]\n last_prod_on_right = last_prod_on_right * right_num\n\n right_i -= 1\n end\n\n prods_except_at_index\nend", "title": "" }, { "docid": "ba5f3c2383999e84ed0a44d9a155b141", "score": "0.671646", "text": "def get_products_of_all_ints_except_at_index1(arr)\n\tproducts = []\n\tfor i in 0...arr.size\n\t\tproducts[i] = 1\n\tend\n\n\tfor i in 0...arr.size\n\t\tfor j in 0...arr.size\n\t\t\tif j == i\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\tproducts[i] *= arr[j]\n\t\t\tend\n\t\tend\n\tend\n\treturn products\nend", "title": "" }, { "docid": "e80e85c9e7db6acea33125c13c0c0506", "score": "0.66913253", "text": "def products_except_me(arr)\n result = []\n arr.each_index do |idx|\n target_arr = arr[0...idx] + arr[idx+1..-1]\n result << target_arr.reduce(:*)\n end\n\n result\nend", "title": "" }, { "docid": "75144c146d4c8bbfadabded2c85950ab", "score": "0.66696125", "text": "def product(int_array)\n products_of_all_ints_except_at_index = []\n \n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < int_array.length\n products_of_all_ints_except_at_index[i] = product_so_far\n product_so_far *= int_array[i]\n i += 1\n end\n \n # for each integer, we find the product of all the integers\n # after it. Since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = int_array.length - 1\n while i >= 0\n products_of_all_ints_except_at_index[i] *= product_so_far\n product_so_far *= int_array[i]\n i -= 1\n end\n return products_of_all_ints_except_at_index\nend", "title": "" }, { "docid": "6ae62b73f93fc41cdb9b069660b14e73", "score": "0.655417", "text": "def products_except_me(numbers)\n numbers.reduce([]) do |products, el|\n products << array_product(numbers) / el\n end\nend", "title": "" }, { "docid": "d1343aeaa5c4fcebf7d505d1188bcc1d", "score": "0.6522279", "text": "def products_except_me(numbers)\n prod = numbers.reduce(:*)\n lst = []\n i = 0\n while i < numbers.length\n lst << prod/numbers[i]\n i +=1\n end\n return lst\nend", "title": "" }, { "docid": "03557a2a80f00013ff5e7a5095e5c698", "score": "0.6518518", "text": "def products_except_me(numbers)\n\n\nend", "title": "" }, { "docid": "7325ffd395d1c76135fe1436b14951a0", "score": "0.6478183", "text": "def products_except_me(numbers)\nend", "title": "" }, { "docid": "ad30f7aeb7a9b7d05ad46f5738b9f334", "score": "0.6451844", "text": "def others_prod(arr)\n if arr.length < 2\n raise IndexError, 'Getting the product of numbers at other indices requires at least 2 numbers'\n end\n\n products_of_all_ints_except_at_index = []\n\n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < arr.length\n products_of_all_ints_except_at_index[i] = product_so_far\n product_so_far *= arr[i]\n i += 1\n end\n\n # for each integer, we find the product of all the integers\n # after it. since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = arr.length - 1\n while i >= 0\n products_of_all_ints_except_at_index[i] *= product_so_far\n product_so_far *= arr[i]\n i -= 1\n end\n\n return products_of_all_ints_except_at_index\nend", "title": "" }, { "docid": "388a0dc1d4ce02fead034b22b63e42e9", "score": "0.64226013", "text": "def product(array)\n prod_array = []\n array.each_index do |i|\n non_i_array = array.slice(0, i) + array.slice(i + 1, array.length)\n prod_array << non_i_array.inject{|prod, j| prod * j }\n end\n prod_array\nend", "title": "" }, { "docid": "f4e35bcc5d39f7f4f005bc422c5465c9", "score": "0.64181465", "text": "def product_except_self(nums)\n all_products = []\n prod_so_far_preceding = 1\n\n i = 0\n while i < nums.length\n all_products << prod_so_far_preceding\n prod_so_far_preceding *= nums[i]\n i += 1\n end\n\n prod_so_far_following = 1\n j = nums.length - 1\n while j >= 0\n all_products[j] *= prod_so_far_following\n prod_so_far_following *= nums[j]\n j -= 1\n end\n\n all_products\nend", "title": "" }, { "docid": "60d97e12f921986117c76b868866bbee", "score": "0.63954026", "text": "def stock_picker(price_list)\n return nil if price_list.length < 2\n buy_index = 0\n sell_index = buy_index + 1\n profit = price_list[sell_index] - price_list[buy_index] # get first profit amount\n\n price_list.each_with_index do |amount, index|\n i = index + 1\n while i < price_list.length\n if ( price_list[i] - amount > profit )\n profit = price_list[i] - amount\n sell_index = i\n buy_index = index\n end\n i += 1\n end\n end\n\n return [buy_index, sell_index]\nend", "title": "" }, { "docid": "7ad6bc8bc94f8d9eda785ff300ef6f7f", "score": "0.6355287", "text": "def products_except_me(nums)\n baseline = array_product(nums)\n nums.map {|el| baseline / el}\nend", "title": "" }, { "docid": "6e9376211ea106193fb625913cdb6ed1", "score": "0.62926894", "text": "def stock_picker(stock_prices)\n prices = stock_prices.dup\n result = []\n profit = 0\n while prices.size > 1\n min_p = prices.min\n index_of_min = prices.index(min_p)\n arr = prices[index_of_min..prices.length]\n max_p = arr.max\n if max_p - min_p > profit\n profit = max_p - min_p\n result.replace([stock_prices.index(min_p), stock_prices.index(max_p)])\n end\n prices = prices[0...index_of_min]\n end\n result\nend", "title": "" }, { "docid": "5918d1c0ca231dc0ff05415518c65316", "score": "0.62776715", "text": "def stockpicker(*nums)\n nums.map do |i| \n i.map do |j|\n p \"j = #{j}\"\n p \"i = #{i}\"\n i.each{|item| p item - j}\n end\n end\nend", "title": "" }, { "docid": "5e0433bb1b24d6bb1ca673977cd5187d", "score": "0.6275401", "text": "def buy_fruit(grocery_list)\n items = []\n grocery_list.each do |product, quantity|\n quantity.times { |_| items << product }\n end\n items\nend", "title": "" }, { "docid": "79296dec303abdac682e2f581d3412a3", "score": "0.6273487", "text": "def calculate_product\n i = 0\n total = 1\n totals = []\n array_of_numbers = turn_number_into_array\n array_of_numbers.each do |test|\n array_of_numbers.each_with_index do |num, index|\n\n if i + 12 > index && i <= index\n\n total *= num.to_i\n elsif i + 12 == index\n total *= num.to_i\n totals << total\n end\n end\n\n i+=1\n total = 1\n end\n end", "title": "" }, { "docid": "3e6a08bf0f3f94f5f4a90c424abd33ce", "score": "0.62536293", "text": "def stock_picker(stocks)\n #get all combinations of the profits\n doubles = stocks.repeated_combination(2).to_a\n #find the largest profit and return that pair of stock prices\n summed = doubles.max{|pair1,pair2| (pair1[1]-pair1[0])<=>(pair2[1]-pair2[0])}\n #create an array for the days to buy and sell\n arr=[]\n #find the index of the price to buy and add to the array\n arr[0] = stocks.index(summed[0]) \n #find the index of the price to sell and add to the array\n arr[1] = stocks.index(summed[1]) \n #return the array of day to buy and day to sell\n arr\n end", "title": "" }, { "docid": "5a500d62de8f65a479294b6486c8da52", "score": "0.6248077", "text": "def get_products(array)\n answer = []\n\n product = 1\n array.length.times do |index|\n answer << product\n product *= array[index]\n end\n\n product = 1\n (array.length - 1).downto(0) do |index2|\n answer[index2] *= product\n product *= array[index2]\n end\n\n answer\n end", "title": "" }, { "docid": "28362db8d2900d9a37ae63774c03211d", "score": "0.6219005", "text": "def stock_picker(sp)\n\ti = 0\n\tprofit = 0\n\tbuy = -1\n\tsell = -1\n\tsp.each do |a|\n\t\tj = 0\n\t\tsp.each do |b|\n\t\t\tif j > i\n\t\t\t\ttmp = b-a\n\t\t\t\tif tmp > 0 && tmp > profit\n\t\t\t\t\tprofit = tmp\n\t\t\t\t\tbuy = i\n\t\t\t\t\tsell = j\n\t\t\t\tend\n\t\t\tend\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn [buy,sell]\nend", "title": "" }, { "docid": "8f467154722d56bafb92778e947d4886", "score": "0.6201905", "text": "def product_except_self(nums)\n products = Array.new(nums.length, 1)\n running_product = 1\n\n # This loop multiplies product up to each number (but not including,\n # as we multiply products[idx] before updating the running_product with\n # the current value).\n nums.length.times do |idx|\n products[idx] *= running_product\n running_product *= nums[idx]\n end\n i = nums.length - 1\n running_product = 1\n until i < 0\n products[i] *= running_product\n running_product *= nums[i]\n i -= 1\n end\n products\nend", "title": "" }, { "docid": "9c124ec673cad734ac2b5a4914059c23", "score": "0.6198803", "text": "def stock_picker(prices)\n result = [0,[]]\n prices[0..-2].each_with_index do |buy_price, i|\n prices[(i + 1)..-1].each_with_index do |sell_price, j| \n diff = sell_price - buy_price\n if diff > result[0]\n result[0] = diff\n result[1] = [i,i + j + 1]\n end\n end\n end\n\n return result[1]\nend", "title": "" }, { "docid": "035614c0181549304ec8d088c911c69a", "score": "0.61560756", "text": "def products_array2(array)\n i = 0\n length = array.length\n \n new_array = []\n \n while i < length\n total = 1\n array.each_with_index do |num, index| \n if i != index\n total *= num\n end\n end\n new_array << total\n i += 1\n end\n \n return new_array\nend", "title": "" }, { "docid": "64328122a46b9d187442efd78a90cba6", "score": "0.61328584", "text": "def other_products(array)\n raise IndexError(\"Requires at least 2 nums\") if array.length < 2\n\n products = []\n\n # for each int, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < array.length\n products[i] = product_so_far\n product_so_far *= array[i]\n i += 1\n end\n # for each integer, we find the product of all the integers\n # after it. since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = array.length - 1\n while i >= 0\n products[i] *= product_so_far\n product_so_far *= array[i]\n i -= 1\n end\n products\nend", "title": "" }, { "docid": "02062e15bfe6223786731a0b70b37d0a", "score": "0.611833", "text": "def stock_picker(prices)\n high_profit = 0\n buy_day = 0\n sell_day = 0\n prices.each_with_index do |price, index|\n for i in 1..(prices.length-1)-index\n if prices[index+i]-price > high_profit\n high_profit = prices[index+i] - price\n buy_day = index\n sell_day = index+i\n end\n end \n end\n return [buy_day, sell_day] \nend", "title": "" }, { "docid": "bd9a1612f6e90777a96f2fcc9ad3e089", "score": "0.60940385", "text": "def stock_picker(prices)\n # To store previous profit value\n previous_value = -1_000_000_000\n price_combination_range = (0..prices.size - 1).to_a\n # To generate all 2 element combinations with indexes\n price_combinations_pairs = price_combination_range.combination(2).to_a\n # Reducing Combinations of indexes into profit-days combo\n price_combinations_pairs.each_with_object([]) do |pair, profit_data|\n profit_value = prices[pair[1]] - prices[pair[0]]\n next unless profit_value > previous_value\n\n profit_data.clear\n profit_data.push(profit_value, pair[0], pair[1])\n previous_value = profit_value\n end\nend", "title": "" }, { "docid": "e8deb330a933a5997688aed5a0025f97", "score": "0.60822874", "text": "def product(input_array)\n answer = []\n product = 1\n \n input_array.each.with_index do |input, index|\n answer[index] = 1 if index == 0\n answer[index] = product if index > 0\n product *= input\n end\n \n product = 1\n (input_array.length-1).downto(0) do |index|\n answer[index] = answer[index] * product if index != input_array.length-1\n product *= input_array[index]\n end\n \n answer\nend", "title": "" }, { "docid": "9522a15b6c24f01767add121a57212fd", "score": "0.6075228", "text": "def buy_fruit(list)\n cart = []\n list.each do |item|\n item[1].times { cart << item[0] }\n end\n cart\nend", "title": "" }, { "docid": "95df25060936a167132c5e4a23af8064", "score": "0.60450876", "text": "def stock_piker (stock_prices)\n lowest_per_day = []\n stock_prices.each_with_index do |buy_price, buy_index|\n profit = 0\n s_index = 0\n b_index = 0\n stock_prices.each_with_index do |sell_price, sell_index|\n if sell_index > buy_index\n if (sell_price - buy_price) > profit\n profit = sell_price - buy_price\n s_index = sell_index\n b_index = buy_index\n end\n end\n end\n lowest_per_day.push([b_index, s_index, profit])\n end\n puts \"#{lowest_per_day}\"\n profit = 0\n array = []\n lowest_per_day.each do |lowest|\n if lowest[2] > profit\n array = lowest\n profit = lowest[2]\n end\n end\n return array\nend", "title": "" }, { "docid": "56c232b1847fa9828e6c691c938d1286", "score": "0.60371155", "text": "def buy_fruit(list)\n list.map {|fruit, quantity| [fruit] * quantity}.flatten\nend", "title": "" }, { "docid": "f2491ff5ee068e8f2852d149e0414c93", "score": "0.6033659", "text": "def calculate_products_of_all_other_elements(nums)\n product_of_other_elements = Array.new(nums.length, 1)\n\n nums.each_with_index do |_num1, i|\n nums.each_with_index do |num2, j|\n product_of_other_elements[i] = product_of_other_elements[i] * num2 if i != j\n end\n end\n\n product_of_other_elements\nend", "title": "" }, { "docid": "f2491ff5ee068e8f2852d149e0414c93", "score": "0.6033659", "text": "def calculate_products_of_all_other_elements(nums)\n product_of_other_elements = Array.new(nums.length, 1)\n\n nums.each_with_index do |_num1, i|\n nums.each_with_index do |num2, j|\n product_of_other_elements[i] = product_of_other_elements[i] * num2 if i != j\n end\n end\n\n product_of_other_elements\nend", "title": "" }, { "docid": "a5428bcc8b0abd84c80dc232bd65b68a", "score": "0.6029174", "text": "def stock_picker(stocks)\n i_min = 0\n j_max = 0\n difference_max = 0\n\n stocks.each_with_index do |i_stock, i_index|\n # Start j-loop from i_index, since you have to buy before you sell\n stocks[i_index..-1].each_with_index do |j_stock, j_index|\n if j_stock - i_stock > difference_max\n difference_max = j_stock - i_stock\n i_min = i_index\n # For j_max I add i_index, since the j-loop starts from i_index (and therefor not 0)\n j_max = j_index + i_index\n end\n end\n end\n\n puts \"[#{i_min},#{j_max}] # for a profit of $#{stocks[j_max]} - $#{stocks[i_min]} == $#{difference_max}\"\nend", "title": "" }, { "docid": "cc85a3715b68b9bcc79eed15bbc624ef", "score": "0.6024956", "text": "def stock_picker(stock_array)\n\n # [1,4] [buy, sell] best day to buy and then sell\n # take current_index of the array and compare it to values ahead < stock_array.length\n\n buy_sell = []\n largest_sum = 0\n current_index = 0\n\n stock_array.each_with_index { |value, index|\n\n i = index + 1\n\n puts \"#{value}: next index #{i}\"\n\n while i < stock_array.length do\n\n if value < stock_array[i]\n\n sum = stock_array[i] - value\n\n puts \"#{sum} = #{stock_array[i]} - #{value}\"\n\n\n if sum > largest_sum\n\n largest_sum = sum\n\n buy_sell.pop()\n buy_sell.pop()\n\n buy_sell.push(index)\n buy_sell.push(i)\n \n end\n\n i += 1\n\n else\n\n i += 1\n\n end\n\n end\n\n }\n\n puts largest_sum # Prints largest_sum for when best day to sell\n p buy_sell # Prints array containing buy and sell days\n\nend", "title": "" }, { "docid": "d387c01bd4201ceb538eaf4f00de9626", "score": "0.60220975", "text": "def stock_picker(stocks)\n max_profit, buy, sell = 0\n\n (stocks.length).times do |i|\n \tprofit = stocks[i..-1].max - stocks[i]\n \tif profit > max_profit\n \t\tbuy = i\n \t\tsell = stocks.index(stocks[i..-1].max)\n \t\tmax_profit = profit\n \tend\n end\n [buy,sell]\nend", "title": "" }, { "docid": "64d6ac45005f56562aa1f612d13c3c7c", "score": "0.60176224", "text": "def deduct_stocks_from_store\n Stock.where(product_id: barcode, store_id: store_id).take.deduct_stocks(quantity)\n end", "title": "" }, { "docid": "1f9cbe26ed3e43942f2418459b68b893", "score": "0.60103804", "text": "def stock_picker(array)\n # assume you buy the stock everyday and held\n # then u sell it some point in future\n # store that combination somewhere\n # store that proft somewhere\n # should a new day combination profit be better\n # replace that set\n \n profit = 0\n i = 0\n while i < array.length - 1 do\n # array.length = 1 to provide for edge case \n # if current element > all others left, continue\n # else, mark lowest combination and profit\n buy = array[i]\n sell = array[i + 1,array.length - 1].max\n currentProfit = sell - buy\n if currentProfit > profit\n profit = currentProfit\n buyIndex = array.find_index(buy)\n sellIndex = array.find_index(sell)\n end\n i = i + 1\n end\n \n \n answer = []\n answer.push(buyIndex)\n answer.push(sellIndex)\n \n if profit > 0 \n p answer\n p profit\n else\n p \"not profitable\"\n end\n \n \n end", "title": "" }, { "docid": "ff696fef76a79c5a81dc7cff67e12352", "score": "0.60052824", "text": "def product(nums)\n nums.drop(1).reduce(nums.first) { |product, i| product * i }\nend", "title": "" }, { "docid": "e7b35708fb630956de23c3bb97f7a99b", "score": "0.6001", "text": "def product_without_i(numbers)\n return numbers if numbers.empty?\n\n total = numbers.reduce(:*)\n\n numbers.map do |n|\n total / n\n end\nend", "title": "" }, { "docid": "6b6891d855a125e11c69562303a9a51c", "score": "0.5991221", "text": "def multiply_list(nums1, nums2)\n products = []\n nums1.each_index do |idx|\n products << nums1[idx] * nums2[idx]\n end\n products\nend", "title": "" }, { "docid": "0c804f7721e837d2ef30b4390eb823bd", "score": "0.59854776", "text": "def shop_cart(product, quantity, price)\n array_of_products = []\n total_value_in_stock = quantity.to_i * price.to_i\n\n create_new_product = [product, quantity, price, total_value_in_stock]\n\n array_of_products << create_new_product\n\n return array_of_products\nend", "title": "" }, { "docid": "daeef5c18726b2ede410eb70cca44c5c", "score": "0.59724385", "text": "def stock_picker(stock_list)\n current_min = 0\n max_index = 1\n min_index = 0\n # max_profit = 0\n # buy_sell = 90\n stock_list.each_with_index do |stock, index|\n # update current min\n if stock < stock_list[current_min]\n current_min = index\n end\n # update index based on max profit\n if stock_list[max_index] - stock_list[min_index] < stock - stock_list[current_min]\n max_index = index\n min_index = current_min\n end\n end\n [min_index, max_index]\nend", "title": "" }, { "docid": "ed212dc230156027277edbae1e9e0920", "score": "0.5970641", "text": "def buy_fruit(list)\n list.map { |fruit, quantity, second_quantity| [fruit] * quantity * second_quantity }.flatten\nend", "title": "" }, { "docid": "1de0542d9e1600d871ac00fa071ddb5e", "score": "0.5967398", "text": "def stock_picker stock_prices\n\tbuy_ind = 0\n\tsell_ind = 1\n\n\thighest_price = 0\n\n\tstock_prices.each_with_index do |price, buy_day|\n\t\tsell_day = buy_day +1\n\n\t\twhile sell_day < stock_prices.length\n\t\t\tif stock_prices[sell_day] - price > highest_price\n\t\t\t\tbuy_ind = buy_day\n\t\t\t\tsell_ind = sell_day\n\t\t\t\thighest_price = stock_prices[sell_day] - price\n\t\t\tend\n\t\t\tsell_day +=1\n\t\tend\n\tend\n\t[buy_ind, sell_ind]\n\nend", "title": "" }, { "docid": "0ace25bc57d0bd53f3db8874f7726a8c", "score": "0.59655726", "text": "def multiply_list(list_1, list_2)\n products = []\n list_1.each_with_index do |item, index|\n products << item * list_2[index]\n end\n products\nend", "title": "" }, { "docid": "0ace25bc57d0bd53f3db8874f7726a8c", "score": "0.59655726", "text": "def multiply_list(list_1, list_2)\n products = []\n list_1.each_with_index do |item, index|\n products << item * list_2[index]\n end\n products\nend", "title": "" }, { "docid": "0ace25bc57d0bd53f3db8874f7726a8c", "score": "0.59655726", "text": "def multiply_list(list_1, list_2)\n products = []\n list_1.each_with_index do |item, index|\n products << item * list_2[index]\n end\n products\nend", "title": "" }, { "docid": "8c264c501373aee5e151709e96693016", "score": "0.59632933", "text": "def buy_fruit(grocery_list)\n new_array = []\n grocery_list.each do |item|\n item[1].times { new_array << item[0] }\n end\n new_array\n # LS solution\n # list.map { |fruit, quantity| [fruit] * quantity }.flatten\nend", "title": "" }, { "docid": "7202d323ebce887d1ebe4d5469883237", "score": "0.59613776", "text": "def find_items(sum, prices)\n # O(n)\n prices.each_with_index do |price, index|\n complement = sum - price\n # O(n)\n if price == complement && prices.count(price) == 2\n return find_all_index(price, prices)\n # O(n)\n elsif price == complement && prices.count(price) == 1\n next\n elsif prices.include? complement\n return index + 1 , prices.find_index(complement) + 1\n end\n end\n end", "title": "" }, { "docid": "9b28ee9e03f8c1358c26b04d367b89e3", "score": "0.596092", "text": "def generate_product_array_v1(array)\n result = []\n\n array.each_index do |i|\n value = array[i]\n\n product = 1\n\n array.each_index do |j|\n product *= array[j] unless i == j\n end\n\n result << product\n end\n\n result\nend", "title": "" }, { "docid": "582dc8a5228b4a2ba557080e8923cef6", "score": "0.59585625", "text": "def stock_picker(stocks)\n # Keep track of the best possible profit and lowest price seen so far\n profit = 0\n cheapest_index = 0\n \n # Keep track of indices of best combo\n best_buy = 0\n best_sell = 0\n \n stocks.each_with_index do |stock, i|\n # establish index of cheapest stock\n if stock < stocks[cheapest_index]\n cheapest_index = i\n end\n \n current = stock - stocks[cheapest_index]\n if stock - stocks[cheapest_index] > profit\n profit = stock - stocks[cheapest_index]\n best_buy = cheapest_index\n best_sell = i\n end\n end\n [best_buy, best_sell]\nend", "title": "" }, { "docid": "95739af557e58c818e99d09747a02319", "score": "0.5955742", "text": "def buy_fruit(list)\n grocery_list = []\n list.each do |item, qty|\n qty.times { grocery_list << item }\n end\n grocery_list\nend", "title": "" }, { "docid": "bd9885354756f7f669cc7d3358b4085c", "score": "0.5951384", "text": "def stock_picker stocks\n\tstocks_copy = Array.new(stocks)\n\tbest = []\n\tmax_profit = 0\n\tstocks.each_with_index do |buy, i|\n\t\tstocks_copy.each_with_index do |sell, j|\n\t\t\tif (j > i)\n\t\t\t#if (j < i)\n\t\t\t#\tnext\n\t\t\t#end\n\t\t\t\tif sell - buy > max_profit\n\t\t\t\t\tmax_profit = sell - buy \n\t\t\t\t\tbest[0] = i\n\t\t\t\t\tbest[1] = j\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tbest\nend", "title": "" }, { "docid": "243bdbbc29be7fbccc41295ca93032a6", "score": "0.5940557", "text": "def stock_picker1(prices)\n maxProfit = 0\n res=[]\n (0..prices.length - 2).each do |i|\n (i + 1..prices.length - 1).each do |j|\n if prices[j] - prices[i] > maxProfit\n maxProfit = prices[j] - prices[i]\n res=[i,j]\n end\n end\n end\n res\nend", "title": "" }, { "docid": "b20c3ad6dd2c779ac1c82c01aaa32cb2", "score": "0.5934648", "text": "def refund(prices)\n index = 0\n amount = 0\n while index < prices.length\n amount -= prices[index]\n index += 1\n end\n amount\nend", "title": "" }, { "docid": "93d0bac0fcb655673455e2ffd797b0a1", "score": "0.59247917", "text": "def stock_picker(prices)\n answer_array = []\n day_to_buy = 0\n day_to_sell = 0\n profit = prices[1] - prices[0]\n prices.each_with_index do |buy_price, buy_day|\n prices.each_with_index do |sell_price, sell_day|\n if sell_day > buy_day\n if sell_price - buy_price > profit\n profit = sell_price - buy_price\n day_to_buy = buy_day\n day_to_sell = sell_day\n end\n end\n end\n end\n answer_array << day_to_buy\n answer_array << day_to_sell\n print answer_array\nend", "title": "" }, { "docid": "5e24d9955a2adff7143bcda1c90801e8", "score": "0.5921944", "text": "def stock_picker(array)\n max_difference = []\n max = 0\n\n array.each.with_index do |buy_price, buy_index|\n array[buy_index+1..-1].each.with_index do |sell_price, sell_index|\n \n profit = sell_price - buy_price\n\n if profit > max\n max = profit\n max_difference = [buy_index, sell_index + buy_index + 1]\n end\n end\n end\n max_difference\nend", "title": "" }, { "docid": "9eb8287b9c8912b19f7ed1cb946d5647", "score": "0.5921722", "text": "def buy_fruit(grocery_list)\n result = []\n grocery_list.each do |sub_list|\n sub_list[1].times { result << sub_list[0] }\n end\n result\nend", "title": "" }, { "docid": "395719ba8d101e339b3c3154fee232ec", "score": "0.59207755", "text": "def buy_fruit(grocery_list)\n result = []\n grocery_list.each do |sub_list|\n sub_list[1].times do \n result << sub_list[0]\n end\n end\n result\nend", "title": "" }, { "docid": "d574b4780168911e863078f6a3a013f2", "score": "0.5920489", "text": "def stocks(array)\n arr = []\n (0...array.length - 1).each do |buy_d|\n (buy_d + 1..array.length - 1).each do |sell_d|\n buy_price = array[buy_d]\n sell_price = array[sell_d]\n if ((sell_price.to_f - buy_price.to_f) / buy_price.to_f) >= 0.2\n arr << [buy_d, sell_d]\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "e292577a3efcdc9d4658054dd67a2974", "score": "0.59198755", "text": "def stock_picker(stocks)\n best_days = []\n largest_difference = 0\n buy = 0\n sell = 0\n stocks.reverse!\n\n stocks.each do |n|\n stocks[stocks.index(n)..-1].each do |i|\n profit = n - i\n if profit > largest_difference\n \tlargest_difference = profit\n \tbuy = i\n \tsell = n\n end\n end\n end\n stocks.reverse!\n if buy == 0 && sell == 0\n \tputs \"I reccomend you do not buy!\"\n else\n \tbest_days << stocks.index(buy)\n \tbest_days << stocks.index(sell)\n end\n\n puts best_days.to_s\n\nend", "title": "" }, { "docid": "74050b8d952be3094f157464b46ec66e", "score": "0.5913973", "text": "def buy_fruit(grocery_list)\n result = []\n grocery_list.each { |sub_array| sub_array[1].times {|i| result << sub_array[0]} } \n result\nend", "title": "" }, { "docid": "9d2b9ae57da9dee03fbd72e6b21f69d0", "score": "0.59067684", "text": "def multiply_list(arr1, arr2)\n products_array = []\n arr1.each_with_index { |int, idx| products_array << int * arr2[idx] }\n products_array\nend", "title": "" }, { "docid": "9415c89ed0c0dde40c575f83f81b27f8", "score": "0.5893138", "text": "def remove_product(prod,q)\n newq = @product_list[prod] - q\n if newq >= 0\n #We have enough products to remove\n @product_list[prod] = newq\n return 99\n else\n puts \"Error: Not that many to remove!\"\n return 0\n end\n end", "title": "" }, { "docid": "bdf2c492cfacb2360426347a03868be4", "score": "0.5889139", "text": "def product(numbers)\n result = 1\n index = 0\n while index < numbers.length\n result = result * numbers[index]\n index += 1\n end\n result\nend", "title": "" }, { "docid": "70a09faf74aa0a881a8bc0a0912de9dd", "score": "0.58820665", "text": "def buy_fruit(list)\n result = []\n list.each do |array|\n array[1].times { result << array[0] }\n end\n result\nend", "title": "" }, { "docid": "32a83e67c37230c55711e065f14dda7d", "score": "0.5881341", "text": "def stock(stock_arr)\n highest_profit = 0 \n best_day_to_buy = 0\n best_day_to_sell = 0 \n stock_arr.each do |stock| \n for i in stock_arr.index(stock)...stock_arr.length \n profit = stock_arr[i] - stock \n if highest_profit < profit \n highest_profit = profit \n best_day_to_buy = stock_arr.index(stock)\n best_day_to_sell = i \n end\n end\n end\n puts \"[#{best_day_to_buy},#{best_day_to_sell}]\"\n\n\nend", "title": "" }, { "docid": "0c438853ac78d57e73312bc19696b476", "score": "0.58809125", "text": "def buy_fruit(grocery_list)\n return_arr = []\n\n grocery_list.each do |arr|\n arr[1].times { return_arr << arr[0] }\n end\n return_arr\nend", "title": "" }, { "docid": "66575aeaf4c198c12729d71c6aebd6d0", "score": "0.5877998", "text": "def product(array)\n index = 0\n product = array[index]\n while index < array.length\n product = product * array[index]\n index += 1\n end\n return product\n\nend", "title": "" }, { "docid": "3846fcfe3f7004049afa1eb5ccd03af1", "score": "0.587333", "text": "def buy_fruit(list)\r\n result = []\r\n list.each do |item|\r\n item[1].times do\r\n result << item[0]\r\n end\r\n end\r\n result\r\nend", "title": "" }, { "docid": "27e6c19b739573fc32aa4d12e345e310", "score": "0.586653", "text": "def stock_picker(prices)\n\n buy = 0\n sell = prices.length - 1\n spread = []\n i = 1\n\n while i < prices.length\n\n curr_diff = prices[sell] - prices[buy]\n\n if prices[i] <= prices[buy] && i < sell && prices[sell] - prices[i] >= curr_diff\n buy = i\n end\n\n if prices[i] >= prices[sell] && i > buy && prices[i] - prices[buy] >= curr_diff\n sell = i\n end\n\n i += 1 \n end\n\n spread << buy << sell\n return spread\n\nend", "title": "" }, { "docid": "816cefd35e807ce5446bdf57236ae490", "score": "0.58594626", "text": "def stock_picker(prices)\n\n profit = 0.0#edge case where there is no profit not covered\n indexes = [0,0]\n\n prices.each do |buy|\n #I hate the line below.\n prices[prices.index(buy)..prices.index(prices.last)].each do |sell|\n \n if sell-buy>profit\n profit = sell-buy\n indexes = [prices.index(buy), prices.index(sell)]\n end\n\n end\n\n end\n\n return \"Days:#{indexes}, Profit:#{profit}\"\n\nend", "title": "" }, { "docid": "ab8db7cbd9db063106e265ae818ddb8e", "score": "0.5855802", "text": "def product_except_self(nums)\n product = nums.inject(:*)\n nums = nums.map { |n| n = product/n }\n nums\nend", "title": "" }, { "docid": "ee87058baf7cb9d5e898d064904d1e2e", "score": "0.58523566", "text": "def multiply_list(array1, array2)\n products = []\n array1.each_with_index do |item, index|\n products << item * array2[index]\n end\n products\nend", "title": "" } ]
628afe3bdb11d43941df34a7b6ddd746
PUT /mouse_racks/1 PUT /mouse_racks/1.json
[ { "docid": "7c7461528bdd1cd453c70ae5cb3e0faa", "score": "0.787827", "text": "def update\n @mouse_rack = @mouse_racks.find(params[:id])\n respond_to do |format|\n if @mouse_rack.update_attributes(params[:mouse_rack])\n format.json { render json: @mouse_rack }\n else\n format.json { render json: @mouse_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "02e5b877165942ace13da110f8d15202", "score": "0.6219037", "text": "def show\n @mouse_rack = @mouse_racks.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @mouse_rack }\n end\n end", "title": "" }, { "docid": "763225aec880ab8250215498fa2e3d74", "score": "0.61580336", "text": "def index\n \n respond_to do |format|\n format.json { render json: @mouse_racks }\n end\n end", "title": "" }, { "docid": "3a35de4ee3fe3791abe653a28c4555a4", "score": "0.60788083", "text": "def destroy\n @mouse_rack = @mouse_racks.find(params[:id])\n @mouse_rack.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e4606d2082a1af4e0a12f2180ed985c6", "score": "0.579397", "text": "def create\n @mouse_rack = MouseRack.new(params[:mouse_rack])\n @mouse_rack.user_id = current_user.id\n respond_to do |format|\n if @mouse_rack.save\n format.json { render json: @mouse_rack, status: :created }\n else\n format.json { render json: @mouse_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2572fb900123dab962d92dfd5cd31505", "score": "0.5588862", "text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend", "title": "" }, { "docid": "f293a22ba10d1a76320f9d4965abd12d", "score": "0.5520844", "text": "def update\n @hair = Hair.find(params[:id])\n\n respond_to do |format|\n if @hair.update_attributes(params[:hair])\n format.html { redirect_to @hair, notice: 'Hair was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hair.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "da7c4240076c21fae6ac35a04b3a91eb", "score": "0.55183625", "text": "def update\n @horse = Horse.find(params[:id])\n\n respond_to do |format|\n if @horse.update(horse_params)\n format.html { redirect_to @horse.race }\n format.json { render :show, status: :ok, location: @horse }\n else\n format.html { redirect_to @horse.race }\n format.json { render json: @horse.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "75a742d98341b117c390f694844e9b7f", "score": "0.54825824", "text": "def update\n @shuttle = Shuttle.find(params[:id])\n\n respond_to do |format|\n if @shuttle.update_attributes(params[:shuttle])\n format.html { redirect_to @shuttle, notice: 'Shuttle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shuttle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6cf765839e6e6636e5b30035cddb891", "score": "0.5427802", "text": "def update\n respond_to do |format|\n if @racket.update(racket_params)\n format.html { redirect_to @racket, notice: 'Racket was successfully updated.' }\n format.json { render :show, status: :ok, location: @racket }\n else\n format.html { render :edit }\n format.json { render json: @racket.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.5425745", "text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end", "title": "" }, { "docid": "b89ee7f82db1a464812385e705cd4d0b", "score": "0.54221183", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b47a1ea1f9b00e8029c66fe2d490d08", "score": "0.5386571", "text": "def update\n respond_to do |format|\n if @snake.update(snake_params)\n format.html { redirect_to @snake, notice: \"Snake was successfully updated.\" }\n format.json { render :show, status: :ok, location: @snake }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @snake.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9f92ec8451bf88efca2fa39b3c00f10", "score": "0.538226", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9f92ec8451bf88efca2fa39b3c00f10", "score": "0.538226", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e53e607d6c2bd230a2bc42e6a5f10726", "score": "0.5378043", "text": "def update\n @shark = Shark.find(params[:id])\n\n respond_to do |format|\n if @shark.update_attributes(params[:shark])\n format.html { redirect_to @shark, notice: 'Shark was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shark.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d895ac3ef472e05ef60038263bab06cd", "score": "0.53712046", "text": "def update\n respond_to do |format|\n if @snake.update(snake_params)\n format.html { redirect_to @snake, notice: 'Snake was successfully updated.' }\n format.json { render :show, status: :ok, location: @snake }\n else\n format.html { render :edit }\n format.json { render json: @snake.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c8484a8480f3ea22af3d572d7532e9e", "score": "0.53711385", "text": "def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e4810a1f987c0ab5ab7668647e0e91a", "score": "0.5368947", "text": "def update\n respond_to do |format|\n if @poi_racket_info.update(poi_racket_info_params)\n format.html { redirect_to @poi_racket_info, notice: 'Poi racket info was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_racket_info }\n else\n format.html { render :edit }\n format.json { render json: @poi_racket_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3cfc581cc93599a6865ea4640b37fea6", "score": "0.53686213", "text": "def update\n @snake = Snake.find(params[:id])\n\n respond_to do |format|\n if @snake.update_attributes(params[:snake])\n format.html { redirect_to @snake, :notice => 'Snake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @snake.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0bc6bed2e33a7843c42a2884fcd53b9", "score": "0.5367102", "text": "def update\n respond_to do |format|\n if @shark.update(shark_params)\n format.html { redirect_to @shark, notice: 'Shark was successfully updated.' }\n format.json { render :show, status: :ok, location: @shark }\n else\n format.html { render :edit }\n format.json { render json: @shark.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8526bda945752e27df3ffdba1b7efea0", "score": "0.53579956", "text": "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "822ff0e584ba95e9ed5f4f2348e7bba9", "score": "0.53528315", "text": "def create\n @building = building\n @physical_rack = building.physical_racks.new(params[:physical_rack])\n\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to building_physical_rack_path(@building.id, @physical_rack), notice: 'Physical rack was successfully created.' }\n format.json { render json: @physical_rack, status: :created, location: @physical_rack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.5350966", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "5001babcfed5b3b3b85ac3b5b6f2b834", "score": "0.5287772", "text": "def update\n respond_to do |format|\n if @shot.update(shot_params)\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot }\n else\n format.html { render :edit }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b311ab3e8cc32165d187985299bb307a", "score": "0.5276086", "text": "def set_racket\n @racket = Racket.find(params[:id])\n end", "title": "" }, { "docid": "b311ab3e8cc32165d187985299bb307a", "score": "0.5276086", "text": "def set_racket\n @racket = Racket.find(params[:id])\n end", "title": "" }, { "docid": "8237c05b1b5e0a294c98d06d6bd3b807", "score": "0.5267032", "text": "def update\n respond_to do |format|\n if @poi_shuttlecocks_info.update(poi_shuttlecocks_info_params)\n format.html { redirect_to @poi_shuttlecocks_info, notice: 'Poi shuttlecocks info was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_shuttlecocks_info }\n else\n format.html { render :edit }\n format.json { render json: @poi_shuttlecocks_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b0e933b4ca7cc1495bb58d31bde2993", "score": "0.5263191", "text": "def set_poi_racket_info\n @poi_racket_info = PoiRacketInfo.find(params[:id])\n end", "title": "" }, { "docid": "a05c543879ff332e1fd8326c5618483c", "score": "0.5260948", "text": "def show\n @building = building\n @physical_rack = building.physical_racks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physical_rack }\n end\n end", "title": "" }, { "docid": "a0c8d8fdac84026d5050e7503de44a7e", "score": "0.5257729", "text": "def destroy\n @building = building\n @physical_rack = building.physical_racks.find(params[:id])\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to building_physical_racks_url(building) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fd75000e08cff362defb0fc93eff473e", "score": "0.5248628", "text": "def save!\n result = JSON.parse(RestClient.put(uri, raw.to_json))\n \n # update our stats\n raw[\"_id\"] = result[\"id\"]\n raw[\"_rev\"] = result[\"rev\"] \n \n result[\"ok\"]\n end", "title": "" }, { "docid": "9c410f9b4bf28b813518d4489ff8786e", "score": "0.52429396", "text": "def hput(path, data)\n\t\t\trequest = Net::HTTP::Put.new(\"#{@server.path}#{path}\")\n\t\t\trequest.add_field('Content-Type', 'application/json')\n\t\t\trequest.body = data.to_json\n\t\t\tresponse = @http.request(request)\n\t\t\treturn response.code.to_i\n\t\tend", "title": "" }, { "docid": "9c410f9b4bf28b813518d4489ff8786e", "score": "0.52429396", "text": "def hput(path, data)\n\t\t\trequest = Net::HTTP::Put.new(\"#{@server.path}#{path}\")\n\t\t\trequest.add_field('Content-Type', 'application/json')\n\t\t\trequest.body = data.to_json\n\t\t\tresponse = @http.request(request)\n\t\t\treturn response.code.to_i\n\t\tend", "title": "" }, { "docid": "516293bd7a60059a7be7a5ac1a725e64", "score": "0.5235993", "text": "def put(path, data)\n request(:put, path, JSON.dump(data))\n end", "title": "" }, { "docid": "eae7f58eac1f5b33f8e613f48675e18e", "score": "0.5228098", "text": "def update\n respond_to do |format|\n if @shot_put_head.update(shot_put_head_params)\n format.html { redirect_to @shot_put_head, notice: 'Shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80fd0b3e085d26a6fddec3ac7246ea2d", "score": "0.52187324", "text": "def update\n @species = Species.find(params[:id])\n\n if @species.update(species_params)\n head :no_content\n else\n render json: @species.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "13261d800424fb3cd3f38b877dfdfaa6", "score": "0.521293", "text": "def set_stocks\n get_luxire_stock\n @luxire_stock.virtual_count_on_hands = params[:luxire_stock][:count]\n @luxire_stock.physical_count_on_hands = params[:luxire_stock][:count]\n @luxire_stock.save\n render json: @luxire_stock, status: '200'\n end", "title": "" }, { "docid": "824a5cbdb3400e207aca524409f0d32d", "score": "0.5208965", "text": "def create\n @snake = Snake.new(params[:snake])\n\n @snake.trunk << Trunk.create({\n :bgcolor => \"#292\",\n :length => 4\n })\n\n @snake.trunk << Trunk.create({\n :bgcolor => \"#292\",\n :length => 4\n })\n\n respond_to do |format|\n if @snake.save\n format.html { redirect_to @snake, :notice => 'Snake was successfully created.' }\n format.json { render :json => @snake, :status => :created, :location => @snake }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @snake.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "45f30b6deb596c76b96495c731a4658b", "score": "0.5207646", "text": "def update\n @game = Game.find(params[:id])\n @score_by_holes = JSON.parse(params[:score_by_holes])\n\n i = 0\n @score_by_holes.each do |score_by_hole|\n sbh = @game.scores(i).score_by_holes(params[:number_hole] - 1)\n sbh.nb_shots = score_by_hole.nb_shots\n sbh.save\n i += 1\n end\n\n respond_to do |format|\n if @game.save\n format.json { render json: @game, status: :ok }\n else\n format.json { render json: \"{ 'error' : 'Bad parameters, score by hole not added' }\", status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b4828b80bd6dfca7088638c54451a01", "score": "0.52009106", "text": "def update\n @building = building\n @physical_rack = PhysicalRack.find(params[:id])\n\n respond_to do |format|\n if @physical_rack.update_attributes(params[:physical_rack])\n format.html { redirect_to building_physical_rack_path(@building.id, @physical_rack), notice: 'Physical rack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e26e10d5d15421b19202f667e0223d64", "score": "0.51996017", "text": "def update\n respond_to do |format|\n if @smoke.update(smoke_params)\n format.html { redirect_to @smoke, notice: 'Smoke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @smoke.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43fdecba17efc7932ab9d9d4f0786094", "score": "0.51819146", "text": "def put(path, data = nil, model = 'raw')\n request(:put, path, data, model)\n end", "title": "" }, { "docid": "c6eb065c79b33e964754cf32aeb1a2a4", "score": "0.5181451", "text": "def update\n respond_to do |format|\n if @rack_info.update(rack_info_params)\n format.html { redirect_to @rack_info, notice: 'Rack info was successfully updated.' }\n format.json { render :show, status: :ok, location: @rack_info }\n else\n format.html { render :edit }\n format.json { render json: @rack_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fff8b42237f137206cea3041fb49c7ca", "score": "0.51784456", "text": "def add_one\n @habit.streak = @habit.streak + 1\n render json: @habit, location: @habit if @habit.save\n end", "title": "" }, { "docid": "df5a07b4d9478579b5aa455cef367e8e", "score": "0.5178404", "text": "def update\n respond_to do |format|\n if @stick.update(stick_params)\n format.html { redirect_to @stick, notice: \"Stick was successfully updated.\" }\n format.json { render :show, status: :ok, location: @stick }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @stick.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "533290fded7e36e47d47126b3311a1f7", "score": "0.5171816", "text": "def new\n @building = building\n @physical_rack = building.physical_racks.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @physical_rack }\n end\n end", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.5164799", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "bc3105220ecb2ba5ef02316edfcb51cb", "score": "0.51590705", "text": "def update\n @hike = Hike.find(params[:id])\n end", "title": "" }, { "docid": "7a337f093a07bebaec4cefb554a191e7", "score": "0.51546776", "text": "def update\n respond_to do |format|\n if @rack_in_hall.update(rack_in_hall_params)\n format.html { redirect_to @rack_in_hall, notice: 'Rack in hall was successfully updated.' }\n format.json { render :show, status: :ok, location: @rack_in_hall }\n else\n format.html { render :edit }\n format.json { render json: @rack_in_hall.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b4fbe2bb4554c75214ec612a847f458e", "score": "0.51531434", "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": "c1a5efe1665fcef58d8acae2e3c57a3b", "score": "0.51508975", "text": "def update\n @shoot = Shoot.find(params[:id])\n\n respond_to do |format|\n if @shoot.update_attributes(params[:shoot])\n format.html { redirect_to @shoot, notice: 'Shoot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shoot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.51491165", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "c5a5c7b0eb437b2c3172008b2b99bc03", "score": "0.51443595", "text": "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "dad9359d8ea0e3ef98069110fd8a79b8", "score": "0.5143492", "text": "def update\n @serverrack = Serverrack.find(params[:id])\n\n respond_to do |format|\n if @serverrack.update_attributes(params[:serverrack])\n format.html { redirect_to @serverrack, notice: 'Serverrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serverrack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "97c424d873111c1c8d3ced40db82bb63", "score": "0.5139038", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to(@shot, :notice => 'Shot was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a87346ddd69afb8d918a441b6ead7d8c", "score": "0.51342404", "text": "def update\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n format.html { redirect_to @shelf, notice: 'Shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70e4c5eb6a8651f20cecc80f6397edf3", "score": "0.51327366", "text": "def index\n @building = building\n @physical_racks = building.physical_racks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @physical_racks }\n end\n end", "title": "" }, { "docid": "1395a23f6219b686f7fd4c4a75c9e8a7", "score": "0.51290876", "text": "def update\n @horse = Horse.find(params[:id])\n\n respond_to do |format|\n if @horse.update_attributes(params[:horse])\n format.html { redirect_to race_path(:id => @horse.race.id), notice: 'Horse was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @horse.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed2e15f6ba8fd29b75bf51f1632c34ed", "score": "0.5115799", "text": "def update\n #@shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n format.html { redirect_to @shelf, notice: 'Shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2701deba7bce4965d5769e47c1b82985", "score": "0.5107554", "text": "def cheater\n puts(\"YOU HAVE TRIED TO CHEAT ME!\")\n RESTful.put(\"#{URL_MICROSERVICE_PLAYER}/cheater\", {'id' => @idPlayer}.to_json, 'application/json')\n sleep(2)\n end", "title": "" }, { "docid": "56046090275ab457e8e4fcf2f5e5dbc5", "score": "0.5103045", "text": "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to @shelf, notice: 'Shelf was successfully updated.' }\n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4506c305a85f1e3edae33518dbac2805", "score": "0.5102745", "text": "def update\n #binding.pry\n #1st you retrieve the location thanks to params[:location_id]\n ###location = Location.find(params[:location_id])\n #2nd you retrieve the net_rack thanks to params[:id]\n #@net_rack = net_racks.find(params[:id])\n\n respond_to do |format|\n # if @net_rack.update_attributes(params[:net_rack])\n if @net_rack.update(net_rack_params)\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource net_rack\n format.html { redirect_to([@net_rack], :notice => 'Rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @net_rack.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a1180b85a98a5e652f2c5f2f1e253ca7", "score": "0.51021427", "text": "def put\n end", "title": "" }, { "docid": "45b5e95e0b381ba25da85af0957273a5", "score": "0.5101993", "text": "def update\n @find_rainbow = FindRainbow.find(params[:id])\n\n respond_to do |format|\n if @find_rainbow.update_attributes(params[:find_rainbow])\n format.html { redirect_to @find_rainbow, notice: 'Find rainbow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @find_rainbow.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ecc92701880256c7d5d82ba762fb6716", "score": "0.5101838", "text": "def update\n respond_to do |format|\n if @haircut_tag.update(haircut_tag_params)\n format.html { redirect_to @haircut_tag, notice: 'Haircut tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @haircut_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a4ce587bb319fbab73be544a843bc789", "score": "0.5093791", "text": "def update\n respond_to do |format|\n if @ground_track.set(ground_track_params)\n format.html { redirect_to @ground_track, notice: 'Ground track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ground_track.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.5091569", "text": "def put(path , params = {})\n request(:put , path , params)\n end", "title": "" }, { "docid": "a3fae9e18774682384f964f9fc7aab12", "score": "0.5082567", "text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n flash[:notice] = 'Shot was successfully updated.'\n format.html { redirect_to(@shot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ee492a40647304cf644980ad3467e02a", "score": "0.50743693", "text": "def update\n @trap = Trap.find(params[:id])\n\n respond_to do |format|\n if @trap.update_attributes(params[:trap])\n format.html { redirect_to @trap, :notice => 'Trap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trap.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "254ba545a8f4304d0e8070e1938de26b", "score": "0.5072811", "text": "def update\n respond_to do |format|\n if @barrack.update(barrack_params)\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { render :show, status: :ok, location: @barrack }\n else\n format.html { render :edit }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "865da3c83ce05dcdc165fe58be589165", "score": "0.5070745", "text": "def update\n @round_hole = RoundHole.find(params[:id])\n @round_hole.update_attributes(round_hole_params)\n respond_with @round_hole\n end", "title": "" }, { "docid": "75d3d5f3ac2a57a51483481181d40a7d", "score": "0.5068299", "text": "def update\n @spoke = Spoke.find(params[:id])\n\n respond_to do |format|\n if @spoke.update_attributes(params[:spoke])\n format.html { redirect_to @spoke, notice: 'Spoke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoke.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b2279afe6beeda46968e088ad4a14d68", "score": "0.506218", "text": "def yogaChange\n results = $db.query(\"\n \t\tUPDATE Interest\n \t\tSET name='Hot Yoga'\n \t\tWHERE name='Yoga';\n \t\")\nend", "title": "" }, { "docid": "bc1a2c881733b6255afced46976f2b77", "score": "0.506206", "text": "def save\n overwrite @api.put(\"/projects/#{shortcode_url}.json\", 'name' => name)\n end", "title": "" }, { "docid": "c9851e906cf0a6800fef5b108c803dd9", "score": "0.5060507", "text": "def update\n @subrack = Subrack.find(params[:id])\n\n respond_to do |format|\n if @subrack.update_attributes(params[:subrack])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subrack.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06b5c4d6c9f2f7874c4d01a9ac0add9e", "score": "0.50600475", "text": "def update\n @kick = Kick.find(params[:id])\n kick_params = params.require(:kick).permit(:title, :description, :time, :location, :user_id, :latitude, :longitude,\n :name, :scale, :avatar,\n :user_avatar, :filepicker_url, :filepicker_avatar_url)\n\n respond_to do |format|\n if @kick.update_attributes(kick_params)\n format.html { redirect_to @kick, notice: 'Kick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kick.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "06b5c4d6c9f2f7874c4d01a9ac0add9e", "score": "0.50600475", "text": "def update\n @kick = Kick.find(params[:id])\n kick_params = params.require(:kick).permit(:title, :description, :time, :location, :user_id, :latitude, :longitude,\n :name, :scale, :avatar,\n :user_avatar, :filepicker_url, :filepicker_avatar_url)\n\n respond_to do |format|\n if @kick.update_attributes(kick_params)\n format.html { redirect_to @kick, notice: 'Kick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kick.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1dcfc425b809389919ac6b6e380b3069", "score": "0.5055441", "text": "def update\n @shoe = current_user.shoes.find(params[:id])\n\n respond_to do |format|\n if @shoe.update_attributes(params[:shoe])\n format.html { redirect_to runs_path, notice: 'Laufschuh erfolgreich geändert' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "afc538262d40a8db35fa11b74901a262", "score": "0.5053402", "text": "def update\n respond_to do |format|\n if @hike.update(hike_params)\n format.html { redirect_to @hike, notice: 'Hike was successfully updated.' }\n format.json { render :show, status: :ok, location: @hike }\n else\n format.html { render :edit }\n format.json { render json: @hike.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "697ec233e93e2b402cb2e27939a28196", "score": "0.50512594", "text": "def index\n @physical_racks = PhysicalRack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @physical_racks }\n end\n end", "title": "" }, { "docid": "15087e72aa2abec0eebffbdc95327612", "score": "0.50508976", "text": "def add_stretch_to_routine\n @routine = Routine.find(params[:id])\n @stretch = Stretch.find(params[:stretch_id])\n\n @routine.stretches << @stretch\n\n render json: @routine, include: :stretches\n end", "title": "" }, { "docid": "3092c3310df163eabdbd98ff9f880c42", "score": "0.5046705", "text": "def update\n @taught = Taught.find(params[:id])\n \n respond_to do |format|\n if @taught.update_attributes(params[:taught])\n format.html { redirect_to @taught, :notice => 'Taught was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @taught.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b159e99996c0dc60d165248acee53805", "score": "0.50452256", "text": "def update\n @shot = current_user.shots.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to mine_url, :notice => \"Shot updated\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5cfeeb87b155ec6ce9a736bf1a83207a", "score": "0.50439256", "text": "def create\n @hair = Hair.new(params[:hair])\n\n respond_to do |format|\n if @hair.save\n format.html { redirect_to @hair, notice: 'Hair was successfully created.' }\n format.json { render json: @hair, status: :created, location: @hair }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hair.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b88a70347254001d402e24a93b4039c8", "score": "0.5041968", "text": "def update_story(h)\n target_url = BASEURL.gsub('PROJECT_ID',@full_story['project_id'].to_s).gsub('STORY_ID',@full_story['id'].to_s)\n # target_url = \"http://requestb.in/187efvm1\" ##REMOVE\n StoryUpdater.put(target_url,:body => h.to_json)\n end", "title": "" }, { "docid": "882c8317370987b86425c0adbf5bfe8c", "score": "0.5035587", "text": "def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "title": "" }, { "docid": "5830cdf5ab8efd95d3f0e4f5f020b3c7", "score": "0.5034996", "text": "def update\n respond_to do |format|\n if @shooting.update(shooting_params)\n format.html { redirect_to @shooting, notice: 'Shooting was successfully updated.' }\n format.json { render :show, status: :ok, location: @shooting }\n else\n format.html { render :edit }\n format.json { render json: @shooting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c8d17c24a9f8845d8be5149ca11666ef", "score": "0.50283873", "text": "def update\n @figure = Figure.find(params[:id])\n\n respond_to do |format|\n if @figure.update_attributes(params[:figure])\n format.html { redirect_to @figure, notice: 'Figure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @figure.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a3e919048d19c7d8e6c9bb8b3fbc105", "score": "0.50246286", "text": "def update\n @closer = Closer.find(params[:id])\n\n respond_to do |format|\n if @closer.update_attributes(params[:closer])\n format.html { redirect_to(@closer, :notice => 'Closer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @closer.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20d4b250d18e97d55879a70728d0e5be", "score": "0.5018296", "text": "def api_put(path, data = {})\n api_request(:put, path, :data => data).parsed\n end", "title": "" }, { "docid": "8b93ea7ae7fceff43ec1e252866a411d", "score": "0.5018018", "text": "def update\n @storm = Storm.find(params[:id])\n\n respond_to do |format|\n if @storm.update_attributes(params[:storm])\n format.html { redirect_to @storm, notice: 'storm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storm.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5d9822236160940be75d51be418fb892", "score": "0.5016408", "text": "def create\n @snake = Snake.new(snake_params)\n\n respond_to do |format|\n if @snake.save\n format.html { redirect_to @snake, notice: \"Snake was successfully created.\" }\n render json: @snake\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @snake.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b4033cede56324f24343a995ee9df69", "score": "0.5015258", "text": "def update\n respond_to do |format|\n if @spice.update(spice_params)\n format.html { redirect_to @spice, notice: 'Spice was successfully updated.' }\n format.json { render :show, status: :ok, location: @spice }\n else\n format.html { render :edit }\n format.json { render json: @spice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ea6ae83c58ada908a0405ee94dc898c", "score": "0.50075144", "text": "def update\n @ride = Ride.find(params[:id])\n\n if @ride.update(ride_params)\n head :no_content\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8cf3c292bb7ed43df575064db157d999", "score": "0.50070846", "text": "def set_shark\n @shark = Shark.find(params[:id])\n end", "title": "" }, { "docid": "5535cd0d4ab06d3ca5fafa7af5c7a608", "score": "0.5007021", "text": "def set_shuttle\n if params[:shuttle_id]\n @shuttle = Shuttle.find(params[:shuttle_id])\n else\n @shuttle = Shuttle.find(params[:id])\n end\n end", "title": "" }, { "docid": "1840a4c9d9f35b2ec5675b7b3751ee4f", "score": "0.5006126", "text": "def update\n @hair_type = HairType.find(params[:id])\n\n if @hair_type.update_attributes(params[:hair_type])\n redirect_to action: \"index\", notice: 'Hair type was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "title": "" }, { "docid": "75405ee915084f9674b1b8d4eb6539bf", "score": "0.50015295", "text": "def update\n # raise params.to_s\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to @shelf, notice: t('notice.shelf.update') }\n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "329df16eeb909ff8683c05fb85f07ea0", "score": "0.4995749", "text": "def update\n @subrack_name = SubrackName.find(params[:id])\n\n respond_to do |format|\n if @subrack_name.update_attributes(params[:subrack_name])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subrack_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a2e764b512c6c80a40755c70aa25893", "score": "0.4993216", "text": "def update\n respond_to do |format|\n if @sky_track.set(sky_track_params)\n format.html { redirect_to @sky_track, notice: 'Sky track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sky_track.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
bdb56477805cd13b999ea3d2af972a63
From angles.rb: solar right ascension
[ { "docid": "86ee8c6440e08a4d207559343a268f45", "score": "0.0", "text": "def ra_Sun() \r\n y0 = sin( al(@ma, @ta, Celes.faom03(@ta)) ) * cos( Celes.nut06a(@ajd, 0)[ 1 ] + \r\n Celes.obl06(@ajd, 0) )\r\n Celes.anp( PI + atan2( -y0, -cos( al(@ma, @ta, Celes.faom03(@ta)) ) ) ) \r\n end", "title": "" } ]
[ { "docid": "2b875166a67d6189b11d6dd07cb3d9e4", "score": "0.68480235", "text": "def right\r\n @angle += ROTATION_ANGLE\r\n end", "title": "" }, { "docid": "10b3b692c7fa067b42570c846bf3a8e9", "score": "0.67405874", "text": "def angle_rads \n\t\t\t2.0 * Math.atan2( self.vec.mag, self.scalar ) \n\t\tend", "title": "" }, { "docid": "71fd1980eff07e76ce075a3fc62a2543", "score": "0.66970676", "text": "def polar\n theta = 0.0\n if Point.close_to(self.x, 0)\n if self.y > 0\n theta = 90.0\n elsif self.y < 0\n theta = 270.0\n end\n else\n theta = Point.rad2deg(Math.atan(self.y/self.x))\n if self.x < 0.0\n theta += 180.0\n end\n if theta < 0.0\n theta += 360.0\n end\n end\n theta\n end", "title": "" }, { "docid": "3b479c5864a93f1a72f08bd2336aa5ae", "score": "0.66703534", "text": "def calculate_radians\n if x_length == 0 || y_length == 0\n angle_to_start_of_quadrant\n else\n case angle_to_end_of_quadrant\n when DEGREES_90\n angle_ignoring_quadrant\n when DEGREES_180\n DEGREES_180 - angle_ignoring_quadrant\n when DEGREES_270\n DEGREES_180 + angle_ignoring_quadrant\n else\n DEGREES_360 - angle_ignoring_quadrant\n end\n end\n end", "title": "" }, { "docid": "a25bf612873ffbdddab2ef3ea3c6ba81", "score": "0.66622484", "text": "def determind_sight_angles(angle)\n case direction\n when 2; value = [270 + angle, 270 - angle]\n when 4; value = [180 + angle, 180 - angle]\n when 6; value = [ 0 + angle, 0 - angle]\n when 8; value = [ 90 + angle, 90 - angle]\n end\n value[0] = (value[0] + 360) % 360\n value[1] = (value[1] + 360) % 360\n return value\n end", "title": "" }, { "docid": "8a57a28875280073f17bac04a32f8f01", "score": "0.66074073", "text": "def polar\n return abs, arg\n end", "title": "" }, { "docid": "71408dfbd1f360cf8d3fb7e978eaa029", "score": "0.66034734", "text": "def turn_right\n @angle += ROTATION_SPEED\n end", "title": "" }, { "docid": "954712a5836bd25fe80bfe124ad14560", "score": "0.6537529", "text": "def angle_delta_orbit() \r\n -1.0 * eqc( @ma, @ta ) \r\n end", "title": "" }, { "docid": "16e581a8529ba86ce288224becf9f004", "score": "0.6520105", "text": "def right(degrees)\n raise ArgumentError unless degrees.is_a?(Numeric)\n @heading += degrees\n @heading %= 360\n end", "title": "" }, { "docid": "908d4d42226511ec2594e9fbe6f4a1dd", "score": "0.65196514", "text": "def declination_rad\n if @declination_rad.nil?\n @declination_rad = inclination_rad - PI / 2\n @declination_rad -= PI / 2 while @declination_rad > PI / 2\n end\n @declination_rad\n end", "title": "" }, { "docid": "2b7f6fa8a55ca773f0ad4c6b850612ba", "score": "0.64975506", "text": "def right(degrees)\n turn(-degrees)\n end", "title": "" }, { "docid": "af393eefa8cdfb428a6b533be9c892f6", "score": "0.64969105", "text": "def max_orbit_phi\n PI / 2 - declination_rad\n end", "title": "" }, { "docid": "f3050c1666c67dca290727a4be77e6ad", "score": "0.6467763", "text": "def deg2rad\n self * (Math::PI/180)\n end", "title": "" }, { "docid": "4e3248a9679a32ff78423b61bb46a6a5", "score": "0.64555883", "text": "def angle_equation_of_time() \r\n delta_orbit() + delta_oblique()\r\n end", "title": "" }, { "docid": "8d6904ade4b8b9278c5d003717a52c25", "score": "0.64316654", "text": "def ordinal_azimuth; end", "title": "" }, { "docid": "096bd833372ab6114305c03df39cc5aa", "score": "0.63890874", "text": "def rotate_right\n @facing =\n @cardinals_rev[@cardinals_rev.index(@facing) - 1]\n self\n end", "title": "" }, { "docid": "61f9375b9913170ac78eb2fd77075b7d", "score": "0.6372809", "text": "def polar\n [abs, arg]\n end", "title": "" }, { "docid": "9e59b0b4624cca63d202d86012063d57", "score": "0.6369818", "text": "def other_angle(a, b)\n 180 - (a + b)\nend", "title": "" }, { "docid": "b4cdce1b994c130166a8b5d9a171da20", "score": "0.6366135", "text": "def half_wind_azimuth; end", "title": "" }, { "docid": "7af9efa276014b75a4d591f772035117", "score": "0.6365242", "text": "def cardinal_azimuth; end", "title": "" }, { "docid": "5d5199f544aa4043f0ea86806b809dff", "score": "0.63638765", "text": "def find_direction(r_o, c_o, r_q, c_q)\n (Complex(c_o - c_q, r_o - r_q).phase / Math::PI * 4).round\nend", "title": "" }, { "docid": "8503a349a220e7602021f50100c03347", "score": "0.6363431", "text": "def other_angle(a, b)\n 180 - (a + b)\nend", "title": "" }, { "docid": "da3d39a7bade87d06dda5c92f13dffac", "score": "0.6339389", "text": "def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend", "title": "" }, { "docid": "6378bd87bdd4c9be953785fd29fc30cc", "score": "0.6334072", "text": "def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end", "title": "" }, { "docid": "5c0cc256891bff5afe792db6e7f0da1d", "score": "0.63324356", "text": "def right(values) # turn left\n multiple(values).each { |degree| rotate(-degree) }\n end", "title": "" }, { "docid": "43b5b2bc4aafa1eb52ef49c84b3be7a7", "score": "0.6325005", "text": "def rad\n x = self[0]\n y = self[1]\n if x >= 0 && y >= 0\n Math.atan( y.to_f/x )\n elsif x < 0 && y >= 0\n Math::PI + Math.atan( y.to_f/x )\n elsif x < 0 && y < 0\n Math::PI + Math.atan( y.to_f/x )\n else\n 2*Math::PI + Math.atan( y.to_f/x )\n end\n end", "title": "" }, { "docid": "ecacd5ae087293b6fd3cb14761169faf", "score": "0.63071746", "text": "def compute_Ra(dr, solar_declination, latitude, solar_time_angle_start, solar_time_angle_end)\n #equation 28\n solar_constant = 0.0820 #MJ/m2day\n _Ra = ((12*60)/Math::PI) * \n solar_constant * \n dr * \n ((solar_time_angle_end - solar_time_angle_start) * \n Math.sin(latitude) * \n Math.sin(solar_declination) + \n Math.cos(latitude) * \n Math.cos(solar_declination) *\n (Math.sin(solar_time_angle_end) - Math.sin(solar_time_angle_start)))\nend", "title": "" }, { "docid": "f91148ecfd59fcba54382d1dcc942122", "score": "0.6305937", "text": "def angular_velocity_rad_s\n 2 * PI / period_s\n end", "title": "" }, { "docid": "adbb86f9476ee5131bbb46d01fd6f3a9", "score": "0.6294228", "text": "def left(degrees)\n right(-degrees)\n end", "title": "" }, { "docid": "6f62aa423c317bda363d2df6731b1882", "score": "0.62882626", "text": "def angle_delta_oblique() \r\n #al(@ma, @ta, Celes.faom03(@ta)) - ra_Sun()\r\n al_Sun() - ra_Sun() \r\n end", "title": "" }, { "docid": "934ee505c8f7295cb92b78f7556b79c4", "score": "0.62707484", "text": "def compass_direction\n angle = Sketchup.active_model.shadow_info[\"NorthAngle\"].degrees\n rotation = Geom::Transformation.rotation(ORIGIN, Z_AXIS, -angle)\n\n Y_AXIS.transform(rotation)\n end", "title": "" }, { "docid": "ba3ba5652008573cb302ca7dbf92efdf", "score": "0.6239706", "text": "def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end", "title": "" }, { "docid": "f4744913df23a5cf6500c860657f1f06", "score": "0.62322545", "text": "def right?\n angles.map(&:degrees).include? 90.0\n end", "title": "" }, { "docid": "328dea46ac04f86a37c6821514f31196", "score": "0.6203856", "text": "def azimuth; end", "title": "" }, { "docid": "48bae66be0441e2d5fb862017afd6230", "score": "0.61997867", "text": "def rotate_right\n placed?\n @direction = case @direction\n when \"NORTH\" then \"EAST\"\n when \"EAST\" then \"SOUTH\"\n when \"SOUTH\" then \"WEST\"\n when \"WEST\" then \"NORTH\"\n end\n end", "title": "" }, { "docid": "0d690bd6dfeec25b4f0907f0a450d234", "score": "0.6182239", "text": "def right!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::EAST\n when Direction::EAST\n @facing = Direction::SOUTH\n when Direction::SOUTH\n @facing = Direction::WEST\n when Direction::WEST\n @facing = Direction::NORTH\n else\n raise %q{Cannot rotate right}\n end\n end", "title": "" }, { "docid": "7c326730bafe708b4c6b4d059d4cfc83", "score": "0.61626506", "text": "def yaw\n to_euler[0]\n end", "title": "" }, { "docid": "86c841ae3cdac4ae2c837c064080af77", "score": "0.6161072", "text": "def sum_of_interior_angles\n 180 * (@number_of_sides - 2)\n end", "title": "" }, { "docid": "9a4f047b8fa5a339f3ad8c96d37f08a8", "score": "0.6151393", "text": "def rad2deg\n self * (180/Math::PI)\n end", "title": "" }, { "docid": "ef1a4185cf59a5bd1e23c51556cd7154", "score": "0.6143435", "text": "def g2r(n)\n\tn*(Math::PI/180)\nend", "title": "" }, { "docid": "64b3af4b04c252812ef1ecc39ed59475", "score": "0.61315745", "text": "def radians\n self * 180 / Math::PI\n end", "title": "" }, { "docid": "965a865f036437d0a49441a99687b779", "score": "0.6124381", "text": "def turn_right\n @orientation = CompassPoints::RIGHT_TURNS[@orientation] if placed?\n end", "title": "" }, { "docid": "c06a06eeafbdcad84c854ee9c00e42d1", "score": "0.6118104", "text": "def angle_deg\n angle * RAD_TO_DEG\n end", "title": "" }, { "docid": "0201540dd1647632435939adcda52437", "score": "0.6088463", "text": "def rt_ascen\n radian_to_degree(bigdecimal_atan2(bigdecimal_cos(degree_to_radian(obliquity)) * bigdecimal_sin(degree_to_radian(ec_lon)), bigdecimal_cos(degree_to_radian(ec_lon))))\n end", "title": "" }, { "docid": "ef7cce3550a775e6e8215af290c31073", "score": "0.60845196", "text": "def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend", "title": "" }, { "docid": "aa759206f0ccd913ffcc9401df821edd", "score": "0.6082939", "text": "def angle_delta_psi() \r\n Celes.nut06a(@ajd, 0)[ 0 ]\r\n end", "title": "" }, { "docid": "d7ccd9c65284fd13316bf4d1e82cb0cb", "score": "0.60795146", "text": "def angle\n equation_1 = @wind_velocity * ETA\n apparent_wind_agl = @real_wind_agl - 0.0001\n\n until @variance > equation_1 - 0.001 && @variance < equation_1 + 0.001\n equation_2 = sailboat_transform(apparent_wind_agl)\n\n apparent_wind_agl -= 0.00001\n @variance = equation_1 - equation_2\n end\n puts \"Apparent Wind Angle:\\n#{apparent_wind_agl}\"\n apparent_wind_agl\n end", "title": "" }, { "docid": "1557804e5afdb8fa378e5fb769e909b4", "score": "0.60625935", "text": "def right\n rotate(1)\n end", "title": "" }, { "docid": "4776d271db8017cd24f506eae1e328f9", "score": "0.60451204", "text": "def to_rad\n self * Math::PI / 180\n end", "title": "" }, { "docid": "5784f85671406022577d57e02e646868", "score": "0.6029422", "text": "def quarter_wind_azimuth; end", "title": "" }, { "docid": "3e5875c31c9a7359de86d6afb871c079", "score": "0.60281265", "text": "def reduce_angle(a)\n modtwopi(a)\n end", "title": "" }, { "docid": "a403a033cb128f5cb26cc3b6abe45ff3", "score": "0.6025931", "text": "def polar(x,y)\n theta = Math.atan2(y,x) # Compute the angle\n r = Math.hypot(x,y) # Compute the distance\n [r, theta] # The last expression is the return value\nend", "title": "" }, { "docid": "3c36f5d98cd0ddee308e1ac648737935", "score": "0.6024428", "text": "def radians\n Science::Angle.new(self, :radians)\n end", "title": "" }, { "docid": "fc10b4ff2ac930474c4c92f2825032e9", "score": "0.6023876", "text": "def map_direction_to_angle(dir)\n return $direction_map[dir]\nend", "title": "" }, { "docid": "be69320a8677192a9b588d1e83876373", "score": "0.60186243", "text": "def rotate(left_or_right)\n facing = [\"N\",\"E\",\"S\",\"W\"]\nif left_or_right == \"L\"\n final = facing[facing.index(@direction)-1]\n @direction = final\nelsif left_or_right == \"R\"\n final = facing[(facing.index(@direction)+1) % facing.length]\n @direction = final\n else\n puts \"error\"\n end\nend", "title": "" }, { "docid": "b28d0864e6d701542ca6aa78eae3543f", "score": "0.60102814", "text": "def rotate_right\n @facing_direction = Direction[@facing_direction.degrees + Direction::RIGHT]\n self\n end", "title": "" }, { "docid": "3ed21c476e47355a2c1de636f01262f1", "score": "0.59966636", "text": "def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend", "title": "" }, { "docid": "bf39e4d337520f43ef8f83c8d8fe8e54", "score": "0.5991423", "text": "def angle\n rad / Math::PI * 180\n end", "title": "" }, { "docid": "88e628308807fa924704b9bec4380bcd", "score": "0.5981537", "text": "def rot180\n rot :d180\n end", "title": "" }, { "docid": "11be126f5fce58820d22ecf7ebcf22ce", "score": "0.59746903", "text": "def turn_right\n difference = heading - 270\n (difference < 10 && difference > 0) ? turn(difference) : turn(-10)\n end", "title": "" }, { "docid": "cac863e4e0461f231d8ab0ee1f663163", "score": "0.5968763", "text": "def right position\n # if currently facing north\n if position[2] == \"north\"\n # right will make it face east\n position[2] = \"east\"\n # if currently facing south\n elsif position[2] == \"south\"\n # right will make it face west\n position[2] = \"west\"\n # if currently facing east\n elsif position[2] == \"east\"\n # right will make it face south\n position[2] = \"south\"\n # if currently facing west\n elsif position[2] == \"west\"\n # right will make it face north\n position[2] = \"north\"\n end\n position\nend", "title": "" }, { "docid": "6a07d409f4555f327bcde18749bcc821", "score": "0.5963192", "text": "def racquetRight(racquet)\n\tif racquet + 2 != SCREEN_X-1 #If the rightermost part of the racket isn't in the right wall\n return racquet + 1 #return the current position but 1 to the right\n else \n return racquet\n end\nend", "title": "" }, { "docid": "62b495146096234808dd1247dd54d16f", "score": "0.5953168", "text": "def turn_right\n index = DIRECTIONS.index(@facing)+1\n @facing = DIRECTIONS[index] || DIRECTIONS[0]\n end", "title": "" }, { "docid": "5a5940c5e7c775df08cdea7b274733e5", "score": "0.5952542", "text": "def min_orbit_phi\n -max_orbit_phi\n end", "title": "" }, { "docid": "d2250e3514c245805dcb77adee259a83", "score": "0.59403783", "text": "def convertToRadians(val)\n return val * PIx / 180\n end", "title": "" }, { "docid": "d2250e3514c245805dcb77adee259a83", "score": "0.59403783", "text": "def convertToRadians(val)\n return val * PIx / 180\n end", "title": "" }, { "docid": "48dda35bd2c2141655da7a761c042141", "score": "0.592452", "text": "def angle_of_specified_radius\n @angle_of_radius\n end", "title": "" }, { "docid": "c0bc4f437461396686834b631cd19ea1", "score": "0.5908549", "text": "def calculate_orientation\n x, y = @components.values\n if x.pos? and y.zero?\n 0.deg\n elsif x.zero? and y.pos?\n 90.deg\n elsif x.neg? and y.zero?\n 180.deg\n elsif x.zero? and y.neg?\n 270.deg\n elsif x.pos? and y.pos?\n Math.atan( y/x ).rad # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.pos?\n angle = Math.atan( y/x.abs ).rad\n (180 - angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.neg? and y.neg?\n angle = Math.atan( y.abs/x.abs ).rad\n (180 + angle.deg).deg # Will return an Angle object (with the property \"degrees\")\n elsif x.pos? and y.neg?\n angle = Math.atan( y.abs/x ).rad\n (360 - angle.deg).deg\n end\n end", "title": "" }, { "docid": "e2990b85f0a7ac048e60efacb5d91945", "score": "0.5903609", "text": "def to_radians\n self * Math::PI.fdiv(180)\n end", "title": "" }, { "docid": "ff30fea25cb24308d26904faf9e8eeb6", "score": "0.5889643", "text": "def radar_zone\n strength = radar_strength\n solar_system = without_locking { planet.solar_system }\n [\n (solar_system.x - strength)..(solar_system.x + strength),\n (solar_system.y - strength)..(solar_system.y + strength)\n ]\n end", "title": "" }, { "docid": "cf78597b59b3091a30af9beba4cce87d", "score": "0.5880711", "text": "def y\n r * Math.sin(theta)\n end", "title": "" }, { "docid": "8cef361383b8e993df35a8de5c262ec0", "score": "0.5875872", "text": "def left(degrees)\n right(-degrees)\n end", "title": "" }, { "docid": "2f735c25d457488f8232d6d2fdc9c0d1", "score": "0.5872206", "text": "def rotateRight()\n fourTypeRotate(Tetromino::COUNTERCLOCKWISE)\n end", "title": "" }, { "docid": "e4c8a4af74c21eb7b41912de372173c6", "score": "0.58653265", "text": "def right(degrees)\n must_be_number(degrees, 'turn')\n self.heading = heading + degrees.to_f\n end", "title": "" }, { "docid": "f801d9bb783728270ee5fde348eea046", "score": "0.5863915", "text": "def r t90\n t90 >= 0 ?\n r0*(1 + a*t90 + b*t90**2) :\n r0*(1 + a*t90 + b*t90**2 - 100*c*t90**3 + c*t90**4)\n end", "title": "" }, { "docid": "e34b51729024930a10b5aa745b74cbda", "score": "0.5863498", "text": "def to_rad(angle)\n angle * Math::PI / 180\n end", "title": "" }, { "docid": "e976ca51929b0ef7a6b33a07baddd02a", "score": "0.5852919", "text": "def tilt\n a = self.orientation\n return 0 if not a\n \n # The direction is the second value in the array\n dir = a[1]\n \n # Compute the angle betwen the direction and [0,0,1] and subtract 90 degrees\n angle = dir.angle_between(Z_AXIS) - Math::PI/2.0\n -angle\nend", "title": "" }, { "docid": "b22c0d879ac9f8b268e01a809e4e5750", "score": "0.58456767", "text": "def rotational_period\n return 2.0 * Math::PI / self.angular_velocity\n end", "title": "" }, { "docid": "42efb9d7c4f7047a50739b284f87f63f", "score": "0.58451813", "text": "def min_angle\n 6 * self.min\n end", "title": "" }, { "docid": "6bc9b6d3a286682368fa074a80cdc5c6", "score": "0.5844055", "text": "def stabilise\n\t\tif almost_at_angle(0, @angle, @rotation_speed)\n\t\t\tupdate_angle(0)\n\n\t\telsif almost_at_angle(180, @angle, @rotation_speed)\n\t\t\tupdate_angle(180)\n\n\t\telsif first_quadrant?(@angle) || third_quadrant?(@angle)\n\t\t\tupdate_angle(calculate_angle(-@rotation_speed))\n\n\t\telse\n\t\t\tupdate_angle(calculate_angle(@rotation_speed))\n\n\t\tend\n\tend", "title": "" }, { "docid": "b144520163d4de162c17201f6dfd2ad5", "score": "0.5842578", "text": "def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end", "title": "" }, { "docid": "8461dda22ad20940a7d718ef9a9a16f7", "score": "0.58383983", "text": "def turnright(degrees: 90)\n send_command 0x74, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end", "title": "" }, { "docid": "686578364f34b541c6c1ea0e9a47d8b2", "score": "0.5833064", "text": "def degrees\n self * Math::PI / 180\n end", "title": "" }, { "docid": "d5e9b0294209996da3f0cf75f3dfc24c", "score": "0.5830166", "text": "def facing_direction_sub\n @direction\n end", "title": "" }, { "docid": "0b1f0d18551015d4a57b33a372a57b00", "score": "0.5828182", "text": "def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend", "title": "" }, { "docid": "0b1f0d18551015d4a57b33a372a57b00", "score": "0.5828182", "text": "def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend", "title": "" }, { "docid": "f180e42032247a88b259d9f5987621e0", "score": "0.5827115", "text": "def rad2rad(rad)\r\n remt(rad, PI2)\r\n end", "title": "" }, { "docid": "2e862a4384c521eff24451320beea452", "score": "0.5818999", "text": "def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end", "title": "" }, { "docid": "1d11e2729eec35d62cc1b029983b1f22", "score": "0.5814624", "text": "def deg2rad(deg)\n deg*Math::PI/180\n end", "title": "" }, { "docid": "f4329bede9823e566f3a7c01262b8ba3", "score": "0.5813843", "text": "def right\n self.y = (y+1)%10\n end", "title": "" }, { "docid": "1c5e100c3410fde2d77eb8944c18653a", "score": "0.58074975", "text": "def bearing\n\n if self > 360\n self - 360\n elsif self < 0\n 360 + self\n else\n self\n end\n\n end", "title": "" }, { "docid": "47716f2311df9467c8e71b2ca18d0863", "score": "0.57934123", "text": "def orient_if_sure(px, py, rx, ry, qx, qy)\n l = (ry - py) * (qx - px)\n r = (rx - px) * (qy - py)\n ((l - r).abs >= (3.3306690738754716e-16 * (l + r).abs)) ? l - r : 0\n end", "title": "" }, { "docid": "e624cc01deb3bc19a46bc2159b802093", "score": "0.57909024", "text": "def f(unit)\n x = (unit / ::Math.cos(angle_radians)).abs\n y = (unit / ::Math.sin(angle_radians)).abs\n\n operator =\n if (@angle % 360).zero? || (@angle % 270).zero?\n :+\n else\n :-\n end\n\n @x = @x.send(operator, x) if !x.infinite? && x.abs <= unit\n @y = @y.send(operator, y) if !y.infinite? && y.abs <= unit\n end", "title": "" }, { "docid": "0a350e0716e8daf9abe34c99e51e94fe", "score": "0.57841325", "text": "def anglecw\n 360 - angle\n end", "title": "" }, { "docid": "1bfe24f37cd4766a8a8ecfeed011ef59", "score": "0.5782488", "text": "def rotateRight()\n twoTypeRotate()\n end", "title": "" }, { "docid": "f0c9dfcde289cf7f07c2e40a2a053b2f", "score": "0.5781955", "text": "def -(other)\n return self.class.radians(@angle - other)\n end", "title": "" }, { "docid": "d32236b21ee2fd8c38243996f63513bb", "score": "0.5779803", "text": "def compute_Rso(_Ra, elevation)\n # equation 37\n # solar radiation that would reach surface under cloudless conditions\n #TODO: calibrate a and b for each station?\n _Rso = (0.75 + 2 * (10**(-5) * elevation.to_f )) * _Ra\nend", "title": "" }, { "docid": "0cff5973f58bcccd6b27d4dbbc8b9b9e", "score": "0.5778403", "text": "def Vector3dPolarAngle(arg0)\n ret = _invoke(1610744183, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "title": "" }, { "docid": "a40508c9bd64ef335f3d2af20ae777fa", "score": "0.57767975", "text": "def angle\n @angle\n end", "title": "" }, { "docid": "2fc3f3283c1b1b1475d1e1623068cfd4", "score": "0.5767716", "text": "def toRadians(degree)\n return degree*Math::PI/180\nend", "title": "" }, { "docid": "a83608422296a263a7998c7c93ff4027", "score": "0.5760637", "text": "def compass_dir(deg)\n case deg\n when 0..45\n :uarr\n when 46..90\n :nearr\n when 91..135\n :rarr\n when 136..180\n :searr\n when 181..225\n :darr\n when 226..270\n :swarr\n when 271..315\n :larr\n when 316..360\n :nwarr\n end\n end", "title": "" } ]
218382c96f0a183ce87e201c7aaa0401
Return the database associated with this collection.
[ { "docid": "0fcb9392358f6eb7d6efa7baa6900a20", "score": "0.8500175", "text": "def db\n collection.db\n end", "title": "" } ]
[ { "docid": "f8357affe6b61a7007a1d713a3e82b15", "score": "0.79871553", "text": "def database\n @database || self.class.database\n end", "title": "" }, { "docid": "2ee1317f98330f6c014d075ce68dee49", "score": "0.79138434", "text": "def database\n self.class.database\n end", "title": "" }, { "docid": "ffc1e0bc34c0be6a7ec4055fba50184c", "score": "0.79115987", "text": "def database\n @database ||= self.class.database\n end", "title": "" }, { "docid": "13036b656b5eeff8ad62614c8806146d", "score": "0.7901045", "text": "def database\n @database || self.class.database\n end", "title": "" }, { "docid": "a41ceaf5f09bd359740c23bbaa2eb549", "score": "0.7898361", "text": "def database\n @database ||= determine_database\n end", "title": "" }, { "docid": "9459e2a47d16543f19c415ca51885d6b", "score": "0.78097004", "text": "def collection\n database[collection_name]\n end", "title": "" }, { "docid": "b2a2733df2161393f8c07d363b780836", "score": "0.7629973", "text": "def db\n self.class.db\n end", "title": "" }, { "docid": "de7e09aa1dc9c6dcb016a7c0c535002b", "score": "0.7619037", "text": "def database\n @@db\n end", "title": "" }, { "docid": "6019ab9f5e2876bda99daf8de19db7a5", "score": "0.76087344", "text": "def database\n @database\n end", "title": "" }, { "docid": "6019ab9f5e2876bda99daf8de19db7a5", "score": "0.76087344", "text": "def database\n @database\n end", "title": "" }, { "docid": "c1354dcdf6c29144b5f95fa5558966f7", "score": "0.7600417", "text": "def determine_database\n self.class.database \n end", "title": "" }, { "docid": "ec983d5940c99c683d29a438daf9420e", "score": "0.75788015", "text": "def database\n if database_name.nil?\n MongoMapper.database\n else\n connection.db(database_name)\n end\n end", "title": "" }, { "docid": "7b973c50fdc91cb862c69cf34c811a48", "score": "0.74999815", "text": "def database\n self.class_database || CouchRest::Model.default_database\n end", "title": "" }, { "docid": "1af0173b436acae5df6b728c344c2dad", "score": "0.7476615", "text": "def db\n return self.class.db\n end", "title": "" }, { "docid": "80754421fa22368d4544e4404b4a9208", "score": "0.7438297", "text": "def collection\n connection.db[table_name]\n end", "title": "" }, { "docid": "dc3febd594c3041b7b90fec32a31b68c", "score": "0.7344921", "text": "def database\n database_name ? connection.db(database_name) : nil\n end", "title": "" }, { "docid": "12722414d0739db825b335f203c72cb0", "score": "0.7308086", "text": "def collection\n @collection ||= self.db.collection(self.collection_name)\n end", "title": "" }, { "docid": "969400c1ed63816a7dc4ae85829c6ff9", "score": "0.71727943", "text": "def getDB\n @db\n end", "title": "" }, { "docid": "fbd4de61f26e70a9bbaf4320537e55ee", "score": "0.71667874", "text": "def db\n @db ||= finder_result.connection\n end", "title": "" }, { "docid": "f14b1d61839249607f26aabf1a6a9d02", "score": "0.7149255", "text": "def db\n @db ||= Database.new\n end", "title": "" }, { "docid": "dfbbd44edd01fc0e4bfd3e59ff44ae5f", "score": "0.7117737", "text": "def db\n return @db if @db\n @db = self == Model ? Sequel.synchronize{DATABASES.first} : superclass.db\n raise(Error, \"No database associated with #{self}: have you called Sequel.connect or #{self}.db= ?\") unless @db\n @db\n end", "title": "" }, { "docid": "dfbbd44edd01fc0e4bfd3e59ff44ae5f", "score": "0.7117737", "text": "def db\n return @db if @db\n @db = self == Model ? Sequel.synchronize{DATABASES.first} : superclass.db\n raise(Error, \"No database associated with #{self}: have you called Sequel.connect or #{self}.db= ?\") unless @db\n @db\n end", "title": "" }, { "docid": "68c37c79b7ff6c8d6e41117ee08f56a4", "score": "0.7095743", "text": "def db\n self.class.db\n end", "title": "" }, { "docid": "a77c54a98c47a5ac0b6504d08dfdebf7", "score": "0.708097", "text": "def database(name)\n Database.new(connection.db(name))\n end", "title": "" }, { "docid": "98df5a0487a147c727ce236a73785418", "score": "0.70782083", "text": "def db\n return @args[:db]\n end", "title": "" }, { "docid": "5e1e727241ad14debee4a44f55d117cc", "score": "0.7060831", "text": "def db\n self.config[:db]\n end", "title": "" }, { "docid": "0b7cc2c2fdc3a5083dee6358d2d67114", "score": "0.7020048", "text": "def database\n @database ||= opts.fetch(:database, parsed_uri.path[1..-1])\n end", "title": "" }, { "docid": "bf953d1b99a508b44b5e71b1b2ea803f", "score": "0.7017459", "text": "def database\n config[\"database\"]\n end", "title": "" }, { "docid": "4e5e9a8afe3ef0337cfb7da8a1e644c0", "score": "0.70157427", "text": "def database_name\n @database_name\n end", "title": "" }, { "docid": "a4fb9eeb659c93884a3508f3d4d1b1af", "score": "0.699763", "text": "def current_database\n query('select current_database()')[0][0]\n end", "title": "" }, { "docid": "048e06f68121768a81b89f24050f7397", "score": "0.69831365", "text": "def database(name)\n Database.new(self, name)\n end", "title": "" }, { "docid": "2c1d74a0e18bf28c2d95474eab3a1700", "score": "0.6969117", "text": "def db\n @db ||= new_connection\n end", "title": "" }, { "docid": "c0e3adb6df66e64bb1a135aa4bff1376", "score": "0.69240654", "text": "def database\n @database ||= match[9]\n end", "title": "" }, { "docid": "782b5db3eaca6da913265cde4eb678eb", "score": "0.68946344", "text": "def _db\n @_db ||= Sequel::DATABASES.first || Sequel.sqlite\n end", "title": "" }, { "docid": "2c12f3962c1858bc64588546aa4cf762", "score": "0.6878492", "text": "def database\n Jrodb::Database[:default]\n end", "title": "" }, { "docid": "252aec24f5d2498d047b0bdf4b0fc9cf", "score": "0.6869765", "text": "def db\n @db ||= find_or_create_database\n end", "title": "" }, { "docid": "fe3e307e1c381a2753025400b2bfec07", "score": "0.6857206", "text": "def database\n @database ||= begin\n uid_split = uid.split(':')\n uid_split.length > 1 ? uid_split[0] : nil\n end\n end", "title": "" }, { "docid": "8f168bf0dfb6f47985a28c61acd9e05a", "score": "0.6848641", "text": "def database; datastore['DATABASE']; end", "title": "" }, { "docid": "bd313253e66884c344b5ca209c0d1cac", "score": "0.6806958", "text": "def database\n @database ||= match[9]\n end", "title": "" }, { "docid": "230f0219fd7500a1288e2ac436ea06aa", "score": "0.676049", "text": "def get_db(dbname)\n Database.new(dbname, @socket, self)\n end", "title": "" }, { "docid": "53a01b0c5540102e69d5369f6ef24773", "score": "0.676035", "text": "def database_name\n @dbi.db_name\n end", "title": "" }, { "docid": "53a01b0c5540102e69d5369f6ef24773", "score": "0.676035", "text": "def database_name\n @dbi.db_name\n end", "title": "" }, { "docid": "98a560abaa3dca9730b81cb83720e6a3", "score": "0.67537314", "text": "def database\n @database ? @database : Database::ADMIN\n end", "title": "" }, { "docid": "05091eb9abd6d3d4f135ac2da77f5c54", "score": "0.6707324", "text": "def database name\n CouchRest::Database.new(self, name)\n end", "title": "" }, { "docid": "3b86835ac5c3df538f7e2d1aed712f5c", "score": "0.6699576", "text": "def find_db\n db = nil\n if !database.nil?\n db = rds.db_instances[database]\n elsif !environment.nil?\n db = find_db_by_environment(environment)\n end\n db\n end", "title": "" }, { "docid": "d19ff38bddeab31a2dcc32ba48bfbadd", "score": "0.6688921", "text": "def name\n db_name = URI.parse(uri(self)).path.to_s.sub(\"/\", \"\")\n db_name.blank? ? database : db_name\n end", "title": "" }, { "docid": "9a77fd1ce456b27e8d5821a2308ed5cc", "score": "0.66846853", "text": "def database \n # NOTE:: Having an instance variable here, causes problems\n # when having two Sinatra Apps, each with their own db setup.\n # the instance variable retains only the last setup, so the\n # first setup is overwritten.\n @database ||= ::DataMapper.setup(dm_setup_context, dm_database_url)\n end", "title": "" }, { "docid": "f084ff81bb318f2f0983cb351c8e3713", "score": "0.66642886", "text": "def databases\n get '_all_dbs'\n end", "title": "" }, { "docid": "e2f2d49f37ac8d67f01f6be5b9e23c16", "score": "0.66614056", "text": "def [](db_name)\n DB.new(db_name, self, :logger => @logger)\n end", "title": "" }, { "docid": "2832569699da4bc6654a0b5dca645c69", "score": "0.6660687", "text": "def database\n \"--db='#{ name }'\"\n end", "title": "" }, { "docid": "ccc2019993f373985e9774171c3dd9f0", "score": "0.6651893", "text": "def collection\n @collection ||= mongo.collection(Boom.config.attributes[\"mongodb\"][\"collection\"])\n end", "title": "" }, { "docid": "5775667e6d4cb378d9cf9eb47c9cdb29", "score": "0.66514206", "text": "def db\n Doozer::Configs.db_conn\n end", "title": "" }, { "docid": "5775667e6d4cb378d9cf9eb47c9cdb29", "score": "0.66514206", "text": "def db\n Doozer::Configs.db_conn\n end", "title": "" }, { "docid": "ffb8201926ed748d6d8dd71059fa0f5b", "score": "0.6630333", "text": "def database\n \"--db='#{ name }'\" if name\n end", "title": "" }, { "docid": "962a628b03af9fd2fa24f53a4b1e5c2a", "score": "0.66245246", "text": "def get_database_object\n\t\t\t\t\t$TRACE.debug 5, \"getting database object #{self.database_object} for object #{self.class}:#{self.id}, called by #{caller[0]}\"\n\t\t\t\t\tself.database_object\n\t\t\t\tend", "title": "" }, { "docid": "4e67ec6437cf3a7d6bb4cfae8f12d899", "score": "0.66196537", "text": "def database(opts = nil)\n if opts\n @database ||= Sequel.connect(opts)\n find_or_create_sequence_number\n end\n @database\n end", "title": "" }, { "docid": "2b6c5b8abadc52ca04b9a0e5c5feb0c9", "score": "0.6615494", "text": "def database_name\n __evaluate__(storage_options[:database])\n end", "title": "" }, { "docid": "0246e00659737435818d408b8492c8f3", "score": "0.6609315", "text": "def [](dbname)\n self.db[dbname]\n end", "title": "" }, { "docid": "6e7bfd237bbe55f1682bae3022f54c0c", "score": "0.6604878", "text": "def database! name\n create_db(name) rescue nil\n database name\n end", "title": "" }, { "docid": "df399d64cdfed4ffda9d551b072159b7", "score": "0.66048396", "text": "def get_database(db_name)\n Monga::Database.new(@client, db_name)\n end", "title": "" }, { "docid": "5bd3ad7f8709d80b2a32e02ed04c4a2f", "score": "0.65999424", "text": "def name\n @db_name\n end", "title": "" }, { "docid": "dca0d02707aa114e1ad3936ebc43e5aa", "score": "0.65976566", "text": "def database_id\n service.database\n end", "title": "" }, { "docid": "ba383c2fb6bb36b88752d140269fa11d", "score": "0.6590956", "text": "def db_interface\n self.class.database_interface\n end", "title": "" }, { "docid": "3176e27ec29a7686258485baaa65b1b1", "score": "0.6585721", "text": "def database_name\n data[:database_name]\n end", "title": "" }, { "docid": "5ee4dc4b9a5ef014d51fcb3351dc76a8", "score": "0.65768504", "text": "def database_name\n @opts[:database]\n end", "title": "" }, { "docid": "79f9a939de2ea20373836a8862f40c7e", "score": "0.65515906", "text": "def db\n framework.db.active\n end", "title": "" }, { "docid": "09390b8d6517dfd9acfa0530e2df3c0c", "score": "0.6545618", "text": "def current_database #:nodoc:\n select_one(\"select sys_context('userenv','db_name') db from dual\")[\"db\"]\n end", "title": "" }, { "docid": "98ea4af6d0097b08df937093c6634961", "score": "0.65386736", "text": "def db\n @connection.pg rescue nil\n end", "title": "" }, { "docid": "b5e0dda93a2de87b3e7c29a751dc17ef", "score": "0.6533346", "text": "def database\n @database ||= Database.create # defaults to 'aqua' \n end", "title": "" }, { "docid": "58cb11df6d8547e1eeddacdd7072ea6c", "score": "0.6526081", "text": "def db\n unless @db # not connected\n @db = Sequel.connect(self.db_uri, :logger => self.log)\n end\n @db\n end", "title": "" }, { "docid": "a7ed5b631dc35eab493d9c8a95b24f8d", "score": "0.6522925", "text": "def collection\n return nil if embedded?\n @collection_name = self.to_s.demodulize.tableize\n @collection ||= Mongoid.database.collection(@collection_name)\n end", "title": "" }, { "docid": "afc4c347794efa5384eac8e4c33e4d42", "score": "0.6507923", "text": "def current_database\n select_value('select current_database()', 'SCHEMA')\n end", "title": "" }, { "docid": "ab787fbcef67c2de9cddd5bfb8e55696", "score": "0.6486171", "text": "def database\n Database.initialize_with(connection)\n end", "title": "" }, { "docid": "7dfa22c1265c7290afd852b292b6c7c3", "score": "0.64801675", "text": "def database\n @database ||= begin\n if ENV['DATABASE_URL']\n Sequel.connect(ENV['DATABASE_URL'])\n elsif RUBY_PLATFORM == 'java'\n Sequel.connect(jdbc_settings)\n else\n Sequel.connect(database_settings)\n end\n end\n end", "title": "" }, { "docid": "7a423f17ede1c8bc151a7381edc427ca", "score": "0.6471404", "text": "def database database_id\n ensure_service!\n grpc = service.get_database instance_id, database_id\n Database.from_grpc grpc, service\n rescue Google::Cloud::NotFoundError\n nil\n end", "title": "" }, { "docid": "22841c3a76301902878dc8c7a0e7803c", "score": "0.64652693", "text": "def collections_coll\n settings.db['collections']\n end", "title": "" }, { "docid": "a6a27df8f0bcd8c1cad5ec7a2729d666", "score": "0.6462777", "text": "def database(options = nil)\n unless options.nil?\n @database = options\n ::DataMapper.setup(:default, @database)\n end\n @database\n end", "title": "" }, { "docid": "cc91ce130c84e7127609f5ba831e6409", "score": "0.64513755", "text": "def collection\n mongo_session[collection_name]\n end", "title": "" }, { "docid": "01b9af03e00b17165f03e9ce507666e0", "score": "0.6430533", "text": "def db_name\n data[:db_name]\n end", "title": "" }, { "docid": "90881d32aa81ed949211c179b99a9366", "score": "0.64220935", "text": "def out_database_name\n if options[:out]\n if options[:out].respond_to?(:keys) && (db = options[:out][:db])\n db\n else\n database.name\n end\n end\n end", "title": "" }, { "docid": "9b91aa1b2caeef101cb15f0e3c112b9b", "score": "0.64198726", "text": "def collection\n @collection ||= database.collection Crocoduck::Store.server_collection\n end", "title": "" }, { "docid": "36e60085c1cf1e58ad499d671eb9bc76", "score": "0.6413084", "text": "def databases\n database_names.map { |name| database(name) }\n end", "title": "" }, { "docid": "bfc0291edfc75e4574a530cc1398ae9c", "score": "0.6410493", "text": "def collection\n Jrodb::Collection::Basic.new(self)\n end", "title": "" }, { "docid": "23b58ce0738ae05be5eb6cbdd468b4b2", "score": "0.6404323", "text": "def db_instance_class\n data.db_instance_class\n end", "title": "" }, { "docid": "19aea8c2a8e27c1492d05e7a42bd3d72", "score": "0.6398025", "text": "def collection\n @collection ||= PublicEarth::Db::Collection.find_by_id!(collection_id)\n end", "title": "" }, { "docid": "b09ceb149af697b9a41c275ce4508783", "score": "0.63958037", "text": "def get_db\n if @db==nil\n @db = Mongo::Connection.new(@db_host, @db_port).db(@db_name)\n QME::MongoHelpers.initialize_javascript_frameworks(@db)\n end\n @db\n end", "title": "" }, { "docid": "b09ceb149af697b9a41c275ce4508783", "score": "0.63958037", "text": "def get_db\n if @db==nil\n @db = Mongo::Connection.new(@db_host, @db_port).db(@db_name)\n QME::MongoHelpers.initialize_javascript_frameworks(@db)\n end\n @db\n end", "title": "" }, { "docid": "56f1f3fc2dfa7b63f1ecb5bb6693e1f8", "score": "0.6394425", "text": "def aggregation_database_collection_for(context)\n (@aggregation_database_collection ||= {})[context] ||= Mongo::Collection.new(self.collection.database, aggregation_collection_for(context))\n end", "title": "" }, { "docid": "4fd2349609ed8b83fa100da698323de5", "score": "0.6391983", "text": "def db\n\t\tframework.db.active\n\tend", "title": "" }, { "docid": "5c20d2132186c3e96f8b6833acf32ae3", "score": "0.63849413", "text": "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "title": "" }, { "docid": "9ec0fde3f687743f408305e00417da40", "score": "0.63777363", "text": "def get_database(key)\n return nil unless @databases.has_key?(key)\n\n # Get the database entry.\n # If it is a 'Proc' then execute the proc and use the value that is returned.\n db = @databases[key]\n db = db.call if db.kind_of?(Proc)\n # Connect to the database, if required and return.\n db.connect_and_migrate\n db\n end", "title": "" }, { "docid": "e7b7f89caf23ee955233b3b591c7b0d2", "score": "0.63762987", "text": "def db\n @db ||= YAML::Store.new(DB_FILE)\n end", "title": "" }, { "docid": "1d19977979f921795aa65f64a7ba36b3", "score": "0.63729465", "text": "def server\n @database.server\n end", "title": "" }, { "docid": "1d19977979f921795aa65f64a7ba36b3", "score": "0.63729465", "text": "def server\n @database.server\n end", "title": "" }, { "docid": "35a770f2f740dd8f965a8fc15224264d", "score": "0.6368287", "text": "def db_path\n @db\n end", "title": "" }, { "docid": "56996bb4d957f3bd08d8a0ebe9a24b84", "score": "0.6366868", "text": "def current_database_name\n ActiveRecord::Base.connection_pool.spec.config[:name] || 'default'\n end", "title": "" }, { "docid": "52d98ca66ca4ab56853e2bad1c73f102", "score": "0.63552845", "text": "def database_name\n database&.name\n end", "title": "" }, { "docid": "6735480093a16779b78252c537e88584", "score": "0.63403666", "text": "def collection\n mongo_session[collection_name]\n end", "title": "" } ]
eb575392b77d558d5cd6d5644ff06c48
SYNCING INSTANCE METHODS, OVERRIDE THESE AS NECESSARY
[ { "docid": "c65e6d4f8a481421b5f890fba6d0d6aa", "score": "0.0", "text": "def remote_sync_if_necessary(options={})\n false\n end", "title": "" } ]
[ { "docid": "5f425ad03adb4e70f41f8b6437800177", "score": "0.7136891", "text": "def sync; end", "title": "" }, { "docid": "e966882dbec4522c6f1c3f074547e82c", "score": "0.71029407", "text": "def sync() end", "title": "" }, { "docid": "e966882dbec4522c6f1c3f074547e82c", "score": "0.71029407", "text": "def sync() end", "title": "" }, { "docid": "e966882dbec4522c6f1c3f074547e82c", "score": "0.71029407", "text": "def sync() end", "title": "" }, { "docid": "1f3f5b33d7214f7fa8f48368aa69e3c8", "score": "0.7084737", "text": "def sync()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "9f24b5e6085f6af17ba825df6f5c16cb", "score": "0.7077325", "text": "def sync\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") % {class: self.class, method: __method__}\n end", "title": "" }, { "docid": "074e2007cd18967abfcad402a968be78", "score": "0.69609356", "text": "def old_sync; end", "title": "" }, { "docid": "ac8fa792681b17cbb432efbbe8a351bc", "score": "0.6761955", "text": "def synchronize_all_methods; end", "title": "" }, { "docid": "ee32170953528ccd2c51b1460576dd74", "score": "0.65678084", "text": "def sync\n end", "title": "" }, { "docid": "ee32170953528ccd2c51b1460576dd74", "score": "0.65678084", "text": "def sync\n end", "title": "" }, { "docid": "def3281eb65b34ab24758bc9acd9509f", "score": "0.6537894", "text": "def old_sync=(_arg0); end", "title": "" }, { "docid": "7c182b08893f55b8ed76503bcbee775a", "score": "0.6526116", "text": "def sync\n @sync ||= Sync.new self\n end", "title": "" }, { "docid": "7c182b08893f55b8ed76503bcbee775a", "score": "0.6526116", "text": "def sync\n @sync ||= Sync.new self\n end", "title": "" }, { "docid": "29990a99532359504a5971ea57c15872", "score": "0.64064676", "text": "def freeze\n __getobj__.freeze\n super()\n end", "title": "" }, { "docid": "126eab45625d75cb65bd13c8e50d0696", "score": "0.63876605", "text": "def freeze; end", "title": "" }, { "docid": "612e47f6121878670d2d8a580fce04b0", "score": "0.63732964", "text": "def exec_sync\n raise \"You must override `exec_sync' in your class\"\n end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6367539", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.6367539", "text": "def implementation; end", "title": "" }, { "docid": "54f4ab6da99fc3b5f887c391b2ea6811", "score": "0.6355912", "text": "def sync=\n end", "title": "" }, { "docid": "84ec78407eeb0340748a0cc194fc1854", "score": "0.63488907", "text": "def fsync()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "117787e0efb78a3324d20bd121252ce0", "score": "0.6330684", "text": "def synchronized?; end", "title": "" }, { "docid": "5fd009af1fd1f4ce3dd5c3f838241c29", "score": "0.63149035", "text": "def freeze\n super\n # Nothing to do here\n extend Freezer\n self\n end", "title": "" }, { "docid": "8d26a202e6accc450b483ecda1cee74a", "score": "0.6298943", "text": "def sync\n api_obj.fetch(:self)\n self\n end", "title": "" }, { "docid": "3103349d09f884a9193b8c4ac184a666", "score": "0.6191863", "text": "def wrapper; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.6134195", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.6134195", "text": "def instance; end", "title": "" }, { "docid": "b5b25700e97a3ff8649acd443cb60f46", "score": "0.6134195", "text": "def instance; end", "title": "" }, { "docid": "1f2eb5e28766431bfc24d74c6c6f8482", "score": "0.6112023", "text": "def synchronize\n if defined?(super)\n super\n else\n yield\n end\n end", "title": "" }, { "docid": "6acf07c4383497db2d1763c1311560bf", "score": "0.6099187", "text": "def freeze() end", "title": "" }, { "docid": "6acf07c4383497db2d1763c1311560bf", "score": "0.6099187", "text": "def freeze() end", "title": "" }, { "docid": "56d7da3b0277b710920d975bf3ceac69", "score": "0.6043818", "text": "def synchronize(updater); end", "title": "" }, { "docid": "5565a534fb5a110771798cb8f0750959", "score": "0.6042407", "text": "def synchronize!(updater); end", "title": "" }, { "docid": "34b3b8c1b66d3f3e3e9ca7464e4c0be2", "score": "0.60089815", "text": "def _synced\n @_synced ||= {}\n end", "title": "" }, { "docid": "70c566f6ee4fdae2f8cb7f5a8f546dcd", "score": "0.5993071", "text": "def freeze\n super\n\n @instance_insert_dataset.freeze if @instance_insert_dataset\n self\n end", "title": "" }, { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.5961297", "text": "def private; end", "title": "" }, { "docid": "0b161da874b62b6d7e2faf739ff74a0b", "score": "0.59480035", "text": "def freeze\n end", "title": "" }, { "docid": "0b161da874b62b6d7e2faf739ff74a0b", "score": "0.59480035", "text": "def freeze\n end", "title": "" }, { "docid": "d30efd2ddd0b0b4fbf3b7cdf5b46be44", "score": "0.59442025", "text": "def instance=(instance); end", "title": "" }, { "docid": "b6cdb602688cb467044265f35e127fee", "score": "0.5944071", "text": "def wrapper\n self.class.wrapper(self)\n end", "title": "" }, { "docid": "7120c99e71f676e3bf2cf4f93158ca5c", "score": "0.59416664", "text": "def intern_state\n super\n end", "title": "" }, { "docid": "08d4e8def9911c5ea60a13d7904078ee", "score": "0.59012157", "text": "def instance_cache; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.58902013", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.58902013", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.58902013", "text": "def lock; end", "title": "" }, { "docid": "19e781da141a570a1c5cdaeef82b65fb", "score": "0.5835091", "text": "def sync=(p1)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "26233d328dd5eae835bd31288fa205d8", "score": "0.5830506", "text": "def freeze\n self\n end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1", "score": "0.58275056", "text": "def internal; end", "title": "" }, { "docid": "3b29b5c2364518da7c4b23bbb3495f50", "score": "0.5817009", "text": "def intern\n self\n end", "title": "" }, { "docid": "7b06d11c5b61422d4f0257465fdbeb5d", "score": "0.5816097", "text": "def wrapper\n self\n end", "title": "" }, { "docid": "5f0d38b3067c4c25b839168df24022f0", "score": "0.5777091", "text": "def sync\n cached_dataset(:_sync) do\n clone(:async=>false)\n end\n end", "title": "" }, { "docid": "af4a51b0cb91881dc1cf53434211a2a0", "score": "0.577681", "text": "def sync=(p0) end", "title": "" }, { "docid": "af4a51b0cb91881dc1cf53434211a2a0", "score": "0.577681", "text": "def sync=(p0) end", "title": "" }, { "docid": "af4a51b0cb91881dc1cf53434211a2a0", "score": "0.577681", "text": "def sync=(p0) end", "title": "" }, { "docid": "ec048a9419d0b271fbe91b29437b3770", "score": "0.5775104", "text": "def initialize\n super\n\n self.callbacks = ::ActiveSupport::HashWithIndifferentAccess.new\n self.callbacks_queue = []\n\n self.responses = ::ActiveSupport::HashWithIndifferentAccess.new\n self.responses_queue = []\n\n self.client = ::Syncano::Clients::Sync.instance\n self.received_data = ''\n end", "title": "" }, { "docid": "021fb545323f5164b8fb3332af3cd7cd", "score": "0.57570356", "text": "def status\n @sync.synchronize{super}\n end", "title": "" }, { "docid": "7d1bee01372227f20e18fd90c6e9a60f", "score": "0.57224476", "text": "def singleton_state\n super\n end", "title": "" }, { "docid": "59bffe6ea6f1eb4a9e13bf7a89663064", "score": "0.5716748", "text": "def realize_self\n raise NotImplementedError\n end", "title": "" }, { "docid": "6577862a712ca380a6f46ff3956c4367", "score": "0.57165325", "text": "def start_synchronize(updater); end", "title": "" }, { "docid": "bcc0d5e5877ec84e27d6f5cb45edb698", "score": "0.5716412", "text": "def proxy\n super\n end", "title": "" }, { "docid": "88a89d0a5d51b8ac464ecc002461b238", "score": "0.57104015", "text": "def freeze\n super\n _container.freeze\n self\n end", "title": "" }, { "docid": "2279478387fcce51058b2372cd56fd81", "score": "0.57031965", "text": "def finish_synchronize; end", "title": "" }, { "docid": "c9730966c297ab068ef013cb1d4104fc", "score": "0.56952924", "text": "def flush_instance\n raise NotImplementedError, 'flush_instance needs to be implemented by child providers'\n end", "title": "" }, { "docid": "83d076041ab7fb09b70bc7d0886144f3", "score": "0.56866837", "text": "def mirror_state\n super\n end", "title": "" }, { "docid": "f276ba9124c33ebec208ede1b2d743ba", "score": "0.5680832", "text": "def sync! # semi-public.\n source = deprecate_potential_readers_used_in_sync_or_save(fields) # TODO: remove in 1.1.\n\n input_representer = mapper.new(source).extend(InputRepresenter) # FIXME: take values from self.fields!\n\n input = input_representer.to_hash\n\n mapper.new(aliased_model).extend(Writer).from_hash(input)\n end", "title": "" }, { "docid": "b4a5004c4a6f8e2c40cdf2c31548286c", "score": "0.56732684", "text": "def sync\n if not cloned?\n clone\n else\n update\n end\n end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.5670548", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.5670548", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.5670548", "text": "def init; end", "title": "" }, { "docid": "5cf2cba0ee7f9825b63b087af5363b37", "score": "0.5670548", "text": "def init; end", "title": "" }, { "docid": "e6431ff47476c9014fb64198d5853e1e", "score": "0.56631285", "text": "def overrides; end", "title": "" }, { "docid": "30db4e5d165a6098d1aeb8f8dd7b66e8", "score": "0.562997", "text": "def initialize() end", "title": "" }, { "docid": "0b130e143276d18d29d888772e5220ec", "score": "0.56256205", "text": "def proxy; self end", "title": "" }, { "docid": "3c296a5e508a29b44edc50c01a143226", "score": "0.56058496", "text": "def vendored\n clone unless cloned?\n super\n end", "title": "" }, { "docid": "a6d2e276d02c66970a03a21e13d8cf37", "score": "0.56044054", "text": "def patch; end", "title": "" }, { "docid": "a6d2e276d02c66970a03a21e13d8cf37", "score": "0.56044054", "text": "def patch; end", "title": "" }, { "docid": "169d0727249768e39ed731ebe4f99374", "score": "0.5584871", "text": "def refork; end", "title": "" }, { "docid": "3923598cefdb39ff94e39293456a9cf0", "score": "0.558346", "text": "def call\n # implement in subclasses\n end", "title": "" }, { "docid": "b6fa8b924af2e24dd0705c99770dcf93", "score": "0.5580711", "text": "def initialize_copy(original)\n @options = original.options.dup\n @connect_lock = Mutex.new\n @monitoring = @cluster ? monitoring : Monitoring.new(options)\n @database = nil\n @read_preference = nil\n @write_concern = nil\n end", "title": "" }, { "docid": "a6e1d151845103c65097b65080da3338", "score": "0.5575368", "text": "def singleton_methods; end", "title": "" }, { "docid": "eadf06350e3bf8c90ce5ed097178b671", "score": "0.5574574", "text": "def pre_sync\n #move\n end", "title": "" }, { "docid": "99090a4bde2901ee6b7fa616a41f0cc2", "score": "0.55731446", "text": "def _sync\n # Reset the stash map to ensure that it's reset before the next\n # transaction is being started.\n @_stash_map = nil\n\n db_obj = {\n 'class_id' => @store.class_map.class_to_id(self.class.to_s),\n 'data' => _serialize\n }\n @store.db.put_object(db_obj, @_id)\n end", "title": "" }, { "docid": "89ea7ca58a6f0c384701f7c5fe348f26", "score": "0.5559386", "text": "def base; self; end", "title": "" }, { "docid": "e2816f9148c67b81a547940f77ca2651", "score": "0.5559382", "text": "def fsync() end", "title": "" }, { "docid": "e2816f9148c67b81a547940f77ca2651", "score": "0.55573106", "text": "def fsync() end", "title": "" }, { "docid": "e2816f9148c67b81a547940f77ca2651", "score": "0.55573106", "text": "def fsync() end", "title": "" }, { "docid": "4f2986c3dc979605a7b148b553a70e0c", "score": "0.55440676", "text": "def initialize(orig)\n super\n @__id = orig.__id__\n ObjectSpace.define_finalizer orig, @@final\n ObjectSpace.define_finalizer self, @@final\n __old_status = Thread.critical\n begin\n Thread.critical = true\n @@id_map[@__id] = [] unless @@id_map[@__id]\n ensure\n Thread.critical = __old_status\n end\n @@id_map[@__id].push self.__id__\n @@id_rev_map[self.__id__] = @__id\n end", "title": "" }, { "docid": "7d06220fedb60fd9d0f2b8a269f8590f", "score": "0.55421984", "text": "def connection_mirror_state\n super\n end", "title": "" }, { "docid": "7d06220fedb60fd9d0f2b8a269f8590f", "score": "0.55421984", "text": "def connection_mirror_state\n super\n end", "title": "" }, { "docid": "b986f9f412efaeff4ce8454f896e67f5", "score": "0.5539718", "text": "def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end", "title": "" }, { "docid": "f26d5bd44eb6cf0fd965b23e31e33e33", "score": "0.5528163", "text": "def initialize\n super('unify')\n freeze\n end", "title": "" }, { "docid": "3b6a79d9cf9c4935dc09ca5d35db9040", "score": "0.5527067", "text": "def after_sync\n end", "title": "" }, { "docid": "9eb26acf800d36bce8200a7cbae731d8", "score": "0.55213296", "text": "def icloud_sync\n raise \"not yet implemented\"\n end", "title": "" }, { "docid": "b2ff3a7bddee0c3ff753bf2b47d76f79", "score": "0.5503682", "text": "def fsync\n end", "title": "" }, { "docid": "b2ff3a7bddee0c3ff753bf2b47d76f79", "score": "0.5503682", "text": "def fsync\n end", "title": "" }, { "docid": "e62fd14171d9a0efd019433a725761e1", "score": "0.55036426", "text": "def work\n raise \"implement this in a class that includes this module\"\n end", "title": "" }, { "docid": "fdbb780b2dfa97121c35b193cf17cba2", "score": "0.54988796", "text": "def initialize(...)\n super\n mon_initialize\n end", "title": "" }, { "docid": "40aee2af08676dbdee927bf17f978b27", "score": "0.5496037", "text": "def begin_resync\n raise NotImplementedError\n end", "title": "" }, { "docid": "6f26e0ade27941f889115f5257e05db2", "score": "0.5493161", "text": "def sync=(arg0)\n end", "title": "" }, { "docid": "cea2f3562cc3f5380093bb0e61cacf49", "score": "0.5476563", "text": "def delegate_object_reader_method; end", "title": "" }, { "docid": "be736e662423633f709f7c6f20bb74e0", "score": "0.5474676", "text": "def prepareForReuse; end", "title": "" }, { "docid": "d2a5230ddc76fa6a6c283cda97ecf337", "score": "0.5469042", "text": "def implementation=(implementation); end", "title": "" } ]
1088ea54bac4c1440b4d5e0f7014e910
Alters the number of rows and/or columns. ==== Parameter(s) +rows+ number of rows; +columns+ number of columns;
[ { "docid": "4df0335f545ed71318a724b53ee9a0cc", "score": "0.7233284", "text": "def resize(rows, columns)\n raise ArgumentError, \"number of rows must be greater than or equal to zero\" if rows < 0\n raise ArgumentError, \"number of columns must be greater than or equal to zero\" if columns < 0\n if rows * columns > 0\n @values = Array.new(rows) { |row| Array.new(columns) { |column| self[row, column] } }\n else\n @values = []\n end\n self\n end", "title": "" } ]
[ { "docid": "a98916f77d93b60fc30c5bd5d1d0bedb", "score": "0.7490427", "text": "def rows=(rows)\n resize_field rows, @columns\n end", "title": "" }, { "docid": "460bc44767d0dd31465a646fd23d13b6", "score": "0.72265214", "text": "def update!(**args)\n @cols = args[:cols] if args.key?(:cols)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "0d013d922a055f3decdd844a97890886", "score": "0.70655686", "text": "def columns=(columns)\n resize_field @rows, columns\n end", "title": "" }, { "docid": "8e16d11b674caa9bfe7495aec919878b", "score": "0.7013185", "text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "570b721b722fe70395b796eb49aa20c0", "score": "0.6826761", "text": "def resize_field(rows, columns)\n @fields = Array.new(rows) { Array.new(columns) }\n @columns = columns\n @rows = rows\n create_cells\n link_cells\n end", "title": "" }, { "docid": "e3f086273826ef547ee88654b343ba69", "score": "0.67481244", "text": "def expand(rows, columns)\n if rows_count < rows || columns_count < columns\n resize([rows_count, rows].max, [columns_count, columns].max)\n end\n self\n end", "title": "" }, { "docid": "da5a2a2654e45759b71fedb85058807b", "score": "0.6627822", "text": "def columns=(integer); end", "title": "" }, { "docid": "455ca18597852c9cc1922a9fd4e0150b", "score": "0.66170466", "text": "def initialize(rows = 0, columns = 0)\n resize_field rows, columns\n end", "title": "" }, { "docid": "d622744da85e47f0b9f9281dd440d74f", "score": "0.63350356", "text": "def update!(**args)\n @cols = args[:cols] if args.key?(:cols)\n @data = args[:data] if args.key?(:data)\n @rows = args[:rows] if args.key?(:rows)\n @type = args[:type] if args.key?(:type)\n end", "title": "" }, { "docid": "88a9d02a4467f68102629678a3337498", "score": "0.63322014", "text": "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @column_span = args[:column_span] if args.key?(:column_span)\n @row = args[:row] if args.key?(:row)\n @row_span = args[:row_span] if args.key?(:row_span)\n end", "title": "" }, { "docid": "94c854b97fca33e2b9e3171cbfec3c70", "score": "0.6240982", "text": "def columns=(n)\n @columns = n\n end", "title": "" }, { "docid": "fc57935520f851900765cbc0834a973c", "score": "0.6224777", "text": "def initialize(rows = self.class.blank_grid)\n @rows = rows\n end", "title": "" }, { "docid": "b6cb9fc2f65ee96b1fe7f54665b5165c", "score": "0.6221541", "text": "def rows=(value)\n @rows = value\n end", "title": "" }, { "docid": "771cdbb859ac995da163bbc6cb94f625", "score": "0.61935586", "text": "def reset(cols, rows)\n\n\t@cols = cols.to_i.abs\n\t@rows = rows.to_i.abs\n\t@created = true\n\n\tx = 0\n\tuntil x > @rows\n\t y = 0\n\t until y > @cols\n\t\tset_pixel(\"#{y}-#{x}\", COLOR_WHITE)\n\t\ty = y+1\n\t end\n\t x = x+1\n\tend\n\n end", "title": "" }, { "docid": "2ce8b18527f08529753c7cf123419d2d", "score": "0.6185638", "text": "def initialize(rows)\n @rows = rows \n @cols = []\n @blks = []\n adjust_values\n @solution = \"\"\n @valid = validate_all\n @solved = false\n @value_changed = true\n end", "title": "" }, { "docid": "a35084a78efd0edb4f82205ac513af34", "score": "0.6142753", "text": "def initialize(num_rows,num_columns)\n @num_rows = num_rows\n @num_columns = num_columns\n @rows = []\n for x in 1..num_rows\n fresh_row = Row.new(num_columns)\n @rows << fresh_row\n end\n end", "title": "" }, { "docid": "4930a011cbedfa21d49da41c38e7914b", "score": "0.6131238", "text": "def set(cols, rows, lays, cell_w, cell_h, cell_d)\n @columns = cols.to_i\n @rows = rows.to_i\n @layers = lays.to_i\n @cell_width = cell_w.to_i\n @cell_height = cell_h.to_i\n @cell_depth = cell_d.to_i\n self\n end", "title": "" }, { "docid": "61bfbb64f854ebb82461b1d42ee66df3", "score": "0.61034966", "text": "def increment_size\n\t\tincremented_size = row_count + 1\n\n\t\t@rows = Array.new(incremented_size){Array.new(incremented_size, 0)}\t# adding a row and a column to the current Matrix\n\t\t@row_count = incremented_size\t# incrementing the counter of rows\n\t\t@column_count = incremented_size\t# incrementing the counter of columns\n\tend", "title": "" }, { "docid": "a0de293619154fdd844bfd343f588250", "score": "0.60549176", "text": "def add(rows, columns, character=\"O\")\n raise ArgumentError.new(\"rows and columns should be greater than 0\") if rows < 1 || columns < 1\n raise ArgumentError.new(\"rows and columns should be less than or equal to 250\") if rows > 250 || columns > 250\n # TODO : to change the size of the bitmap(matrix) by calling this method multiple times comment the following line.\n raise ArgumentError.new(\"rows and columns should be less than or equal to 250\") if self.data.is_a?(Matrix) && (rows > self.data.row_count || columns > self.data.column_count)\n @data = Matrix.build(rows, columns) {character}\n end", "title": "" }, { "docid": "9fbd156d23187c8ec92a2b831ed37eb4", "score": "0.6053599", "text": "def add_columns! *columns\r\n matrix_new = add_columns *columns\r\n @rows = matrix_new.to_a\r\n @column_size = @rows[0].size\r\n end", "title": "" }, { "docid": "cf2476b752e3231cc695a1f52b67d37f", "score": "0.6041112", "text": "def update!(**args)\n @column_headers = args[:column_headers] if args.key?(:column_headers)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "f4d21198c41fc446fdbd641c9b1c8000", "score": "0.6009665", "text": "def rowify(opts)\n unless opts[:rows].respond_to? :to_i\n raise \"Columns must be an integer\" unless opts[:columns].respond_to? :to_i\n opts[:rows] = (@cards.size / opts[:columns].to_i).ceil\n end\n opts\n end", "title": "" }, { "docid": "e657ec3b04674a6f65f9a0b7a973def5", "score": "0.6006289", "text": "def update!(**args)\n @row_count = args[:row_count] if args.key?(:row_count)\n end", "title": "" }, { "docid": "6b5acdc91de24e32454b2885df00753b", "score": "0.59559333", "text": "def update!(**args)\n @column_headers = args[:column_headers] if args.key?(:column_headers)\n @errors = args[:errors] if args.key?(:errors)\n @kind = args[:kind] if args.key?(:kind)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "4246834c6b602b037857f5c7ac47526d", "score": "0.59357595", "text": "def add_rows! *rows\r\n matrix_new = add_rows *rows\r\n @rows = matrix_new.to_a\r\n end", "title": "" }, { "docid": "17501d82daa1aca01f8c4fb186489fc8", "score": "0.5935342", "text": "def setCells(info, rows, maxcols, sub_size)\n if rows > @rows\n rows = @rows\n end\n\n # Copy in the new info.\n (1..rows).each do |x|\n (1..@cols).each do |y|\n if x <= rows && y <= sub_size[x]\n @info[x][y] = @info[x][y][0..[@colwidths[y], @info[x][y].size].min]\n else\n self.cleanCell(x, y)\n end\n end\n end\n end", "title": "" }, { "docid": "336deddbc4025a64787c31dd2db50d87", "score": "0.583118", "text": "def update!(**args)\n @annotation_specs = args[:annotation_specs] if args.key?(:annotation_specs)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "b76b106ad47d5162cae298c44654767e", "score": "0.58190787", "text": "def resize_to_fit(cols, rows = nil)\n rows ||= cols\n change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|\n resize(ncols, nrows)\n end\n end", "title": "" }, { "docid": "2bd9960d6b3026e95f28da60ad396dbe", "score": "0.57957095", "text": "def initialize(file,nRows, nCols)\n\t\t@nRows=nRows\n\t\t@nCols=nCols\n\t\tsuper(file)\n\t\tresize\n\tend", "title": "" }, { "docid": "9ab83abe878c532092aa9ad5414a7072", "score": "0.57811", "text": "def size\n\t\t@rows * @columns\n\tend", "title": "" }, { "docid": "3da4876cf04dd7db2894717b89c5f5e4", "score": "0.57714844", "text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @columns_int16 = args[:columns_int16] if args.key?(:columns_int16)\n @columns_int32 = args[:columns_int32] if args.key?(:columns_int32)\n @columns_int64 = args[:columns_int64] if args.key?(:columns_int64)\n @columns_int8 = args[:columns_int8] if args.key?(:columns_int8)\n @values = args[:values] if args.key?(:values)\n end", "title": "" }, { "docid": "307bf8ed053ca20ded1b65bf2ffadaf2", "score": "0.57688504", "text": "def add_rows *rows\r\n matrix_a = self.to_a\r\n\r\n rows.each {|m|\r\n if m.column_size != self.column_size\r\n raise ArgumentError, \"number of columns should be identical\"\r\n end\r\n\r\n matrix_a += m.to_a\r\n }\r\n\r\n Matrix.rows(matrix_a)\r\n end", "title": "" }, { "docid": "332eba631ca13f9e05bdef7f978e5f1f", "score": "0.57612073", "text": "def row=(row)\n @row = Utility.clamp(row, 0, GRID_ROWS - 1)\n end", "title": "" }, { "docid": "ff36c7241e3428955af1c82b8dd83027", "score": "0.573452", "text": "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @max_count = args[:max_count] if args.key?(:max_count)\n @stride_length = args[:stride_length] if args.key?(:stride_length)\n end", "title": "" }, { "docid": "36e0e421784414649ad8d8e83ae11c75", "score": "0.573078", "text": "def set_row!(row, rowname: nil)\n rowname ||= get_new_rowname\n case row\n when Array then\n raise \"row must have #{ncols} columns\" unless row.length == ncols\n row = Hash[*colnames.zip(row).flatten(1)]\n when Hash then\n else raise 'row must be Array or Hash'\n end\n if @rownames[rowname] then\n @rows[@rownames[rowname]] = row\n else\n @rownames[rowname] = @rows.length\n @rows << row\n end\n self\n end", "title": "" }, { "docid": "af66615f8be2f35526d4b373df901b3a", "score": "0.5716825", "text": "def setrowcol r, c\n @row = r unless r.nil?\n @col = c unless c.nil?\n end", "title": "" }, { "docid": "7b3a8b674e01c9e74de64f43799e3fa1", "score": "0.57099193", "text": "def update!(columns)\n update(nil, columns)\n end", "title": "" }, { "docid": "9e61a711ece623fbb3a56ba806f9b272", "score": "0.570488", "text": "def intefy!\n @num_cols = @num_cols.to_i\n @col_width = @col_width.to_i\n @gutter = @gutter.to_i\n end", "title": "" }, { "docid": "cf3d197ebc65fe8e1daa11b7c78d6f88", "score": "0.5687836", "text": "def colrow=(val) @records.set(GRT_COLROW, val); end", "title": "" }, { "docid": "9e9efb46807291293f248a627ac9d818", "score": "0.56749815", "text": "def columns=(arr)\n @columns = arr\n update_height\n end", "title": "" }, { "docid": "95b764dffd279ab32a4c411995fc8bc7", "score": "0.56602776", "text": "def update!(**args)\n @dimension_passed = args[:dimension_passed] if args.key?(:dimension_passed)\n @passed = args[:passed] if args.key?(:passed)\n @row_count = args[:row_count] if args.key?(:row_count)\n end", "title": "" }, { "docid": "cde2d63402a6ba36bcb58fe2c042dc2b", "score": "0.5639591", "text": "def feed_rows(rows)\n write_bytes(27, 74, rows)\n end", "title": "" }, { "docid": "654eb97529ee3598787fd2c40c1f5367", "score": "0.56278497", "text": "def update!(**args)\n @header = args[:header] if args.key?(:header)\n @is_table = args[:is_table] if args.key?(:is_table)\n @row = args[:row] if args.key?(:row)\n @total_rows = args[:total_rows] if args.key?(:total_rows)\n end", "title": "" }, { "docid": "d1cb945a2988c5272d16dafa8ff30006", "score": "0.56218064", "text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end", "title": "" }, { "docid": "d1cb945a2988c5272d16dafa8ff30006", "score": "0.56218064", "text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n end", "title": "" }, { "docid": "3a932f77a06ced46e4b485eef6b72276", "score": "0.55990654", "text": "def update!(**args)\n @totals = args[:totals] if args.key?(:totals)\n @samples_read_counts = args[:samples_read_counts] if args.key?(:samples_read_counts)\n @row_count = args[:row_count] if args.key?(:row_count)\n @rows = args[:rows] if args.key?(:rows)\n @is_data_golden = args[:is_data_golden] if args.key?(:is_data_golden)\n @data_last_refreshed = args[:data_last_refreshed] if args.key?(:data_last_refreshed)\n @maximums = args[:maximums] if args.key?(:maximums)\n @sampling_space_sizes = args[:sampling_space_sizes] if args.key?(:sampling_space_sizes)\n @minimums = args[:minimums] if args.key?(:minimums)\n end", "title": "" }, { "docid": "d7e466283247c7cbc824371812f46f3c", "score": "0.5594627", "text": "def initialize(width, height)\n @width = width\n @height = height\n @rows = [0] * height\n end", "title": "" }, { "docid": "c55eedb35272fe03dcc29f9b21b7ed5a", "score": "0.5556202", "text": "def []=(row, column, value)\n @rows[row][column] = value\n end", "title": "" }, { "docid": "31974c7bc48c68a405555f7c643f37dd", "score": "0.55554265", "text": "def with_numrows(numrows)\n clone(:numrows=>numrows)\n end", "title": "" }, { "docid": "8bb9c7331f387db427218e790240d420", "score": "0.5549357", "text": "def reset(cols, rows)\n\t\t@holeSize = 3 + rand(2)\n\t\t@holeHeight = rows / 4 + rand * (rows / 2)\n\t\t@tubePosition = cols - 1\n\t\t@lastPosition = @tubePosition\n\t\t@passed = false\n\tend", "title": "" }, { "docid": "0695fea1f8e3027134dc32fccdaeed93", "score": "0.55349505", "text": "def columns=(value)\n return if @columns == value\n @columns = value\n refresh\n end", "title": "" }, { "docid": "87c2ae8ebb1082f10f845782174baa4b", "score": "0.55323005", "text": "def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @shuffle_questions = args[:shuffle_questions] if args.key?(:shuffle_questions)\n end", "title": "" }, { "docid": "ea257a6659b51c22d69e363209db2ef5", "score": "0.5530217", "text": "def move row, col\n @row = row\n @col = col\n end", "title": "" }, { "docid": "14bf3cdfd55fccddacc523e1ba649bdf", "score": "0.5522816", "text": "def []=(row, column, obj)\n raise IndexError, \"row #{row} is out of bounds\" if row < -rows_count\n raise IndexError, \"column #{column} is out of bounds\" if column < -columns_count\n expand(row+1, column+1)\n @values[row][column] = obj\n end", "title": "" }, { "docid": "ce705e79029ef21b6701309b02595426", "score": "0.55175805", "text": "def row_space(); @row_space; end", "title": "" }, { "docid": "f6f78dadac0620ea60daf1a74f77e65f", "score": "0.5510151", "text": "def add_rows(rows)\n sizes = rows.collect {|r| r.size }.uniq\n expected_size = @table_columns.size\n errors = sizes.select {|s| s != expected_size }\n raise ArgumentError.new(\"Given a row of data with #{errors.to_sentence} entries, but there are only #{expected_size} columns in the table\") if errors.any?\n @data += rows\n end", "title": "" }, { "docid": "f95d6d9c63341d53d18be5e0326245c1", "score": "0.5501193", "text": "def setrowcol r, c\n # 2010-02-07 21:32 is this where i should add ext_offsets\n #$log.debug \" #{@name} w.setrowcol #{r} + #{@ext_row_offset}, #{c} + #{@ext_col_offset} \"\n # commented off 2010-02-15 18:22 \n #r += @ext_row_offset unless r.nil?\n #c += @ext_col_offset unless c.nil?\n if @form\n @form.setrowcol r, c\n #elsif @parent_component\n else\n raise \"Parent component not defined for #{self}, #{self.class} \" unless @parent_component\n @parent_component.setrowcol r, c\n end\n #setformrowcol r,c \n end", "title": "" }, { "docid": "181efd4b66a0336c1af7c409cd52a369", "score": "0.5500868", "text": "def limit rows\n raise ArgumentError, \"Invalid limit. Must be a non-negative integer.\" unless rows.is_a?(Fixnum) && rows >= 0\n spawn :@limit, rows\n end", "title": "" }, { "docid": "fdf578586e1f15f1ce59b26f9699df4c", "score": "0.5489114", "text": "def rows=(val)\n if (cr=colrow)\n @records.set(GRT_COLROW, [cr[0], val])\n else\n @records.set(GRT_COLROW, [nil, val])\n end\n end", "title": "" }, { "docid": "dc7f3bbb9583df9e3d01b7d9ccff5ef8", "score": "0.54786736", "text": "def set_char_matrix(rows,cols)\n # maximum number of displayable characters in any row\n cols = 0 if cols < 0\n cols = 99 if cols > 99\n @cols = cols\n @gsi.mnc = @cols.to_s.rjust(2,' ')\n\n # maximum number of displayable rows\n rows = 0 if rows < 0\n rows = 99 if rows > 99\n @rows = rows\n @gsi.mnr = @rows.to_s.rjust(2,' ')\n end", "title": "" }, { "docid": "2756540e521af03f6e92eee0c01b3e5c", "score": "0.5476978", "text": "def initialize(rows)\n @rows = rows\n end", "title": "" }, { "docid": "367b64e8b0d382e3d19526ea777da262", "score": "0.5473407", "text": "def initialize(rows, r = nil, c = nil)\n raise ArgumentError, \"Expected array, but #{rows} found\" unless rows.is_a? Array\n rows.each do |r|\n \traise ArgumentError, \"Expected array, but #{r} found\" unless r.is_a? Array\n end\n if rows.empty? \n raise TypeError, \"number of rows is expected to be an integer, not #{r.class}\" unless r.is_a? Integer\n raise TypeError, \"number of columns is expected to be an integer, not #{c.class}\" unless c.is_a? Integer\n @r = r \n @c = c \n else\n @r = rows.size\n @c = rows.first.size\n end\n rows.each do |r| \n \traise ArgumentError, \"Inconsistent matrix detected\" unless r.size == @c \n end \n @rows = rows\n Check.ensure_symbolic self\n end", "title": "" }, { "docid": "29707938e6c4343c29e889bd41289b99", "score": "0.5441413", "text": "def resize(width, height); end", "title": "" }, { "docid": "accb46ad64343afd7abe2c4cead3e74a", "score": "0.54375905", "text": "def refresh\n @cols = @defaults = nil\n self\n end", "title": "" }, { "docid": "8a24863f261b2dd9f7c73d67558de702", "score": "0.5432533", "text": "def update!(**args)\n @altitude_multiplier = args[:altitude_multiplier] if args.key?(:altitude_multiplier)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "8a24863f261b2dd9f7c73d67558de702", "score": "0.5432533", "text": "def update!(**args)\n @altitude_multiplier = args[:altitude_multiplier] if args.key?(:altitude_multiplier)\n @rows = args[:rows] if args.key?(:rows)\n end", "title": "" }, { "docid": "e6645a6889b1b7954f470577198298a5", "score": "0.5419329", "text": "def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscols > 6\n @pagesize = @grows * @gviscols\nend", "title": "" }, { "docid": "5d44fc1fd017a20e83eaed8e80f6abf3", "score": "0.54115003", "text": "def update!(**args)\n @col_span = args[:col_span] if args.key?(:col_span)\n @detected_languages = args[:detected_languages] if args.key?(:detected_languages)\n @layout = args[:layout] if args.key?(:layout)\n @row_span = args[:row_span] if args.key?(:row_span)\n end", "title": "" }, { "docid": "18896b000d08c140cbacf539c38ee197", "score": "0.5400197", "text": "def update start_row, start_col, end_row, end_col\n temp = @board[start_row][start_col]\n @board[start_row][start_col] = \"[ ]\"\n @board[end_row][end_col] = temp\n end", "title": "" }, { "docid": "badbc9c7c677573e7eca1f83fe5d2943", "score": "0.5397962", "text": "def set_position(row, col)\n if row.between?(0, 7) && col.between?(0, 7)\n @position[:row] = row\n\t @position[:col] = col\n\tend\n end", "title": "" }, { "docid": "e0f9e74d7a94ac0452ec98a6d5fa7295", "score": "0.539458", "text": "def columns=(val)\n if (cr=colrow)\n @records.set(GRT_COLROW, [val, cr[1]])\n else\n @records.set(GRT_COLROW, [val, nil])\n end\n end", "title": "" }, { "docid": "d6112c16242b493ae73307f92d96582b", "score": "0.5393658", "text": "def set_cell(args)\n arr = @rows.flatten\n arr[arr.find_index(args[:position])] = args[:piece]\n @rows = arr.enum_for(:each_slice, 3).to_a\n end", "title": "" }, { "docid": "985a1d37fe6229acc757df5a1ab0a85d", "score": "0.5392236", "text": "def size\n rows * columns\n end", "title": "" }, { "docid": "e4c396d843f38658199915c9b99fa4fa", "score": "0.5392015", "text": "def fill!(values)\n values = values.to_a if values.respond_to? :to_a\n if nrows == 1 then\n raise \"values must have #{ncols} elements\" unless values.length == ncols\n elsif ncols == 1 then\n raise \"values must have #{nrows} elements\" unless values.length == nrows\n else\n values = values.flatten(1) if values.length > 0 and values[0].is_a? Array\n raise \"values must have #{nrows}x#{ncols} (= #{nrows*ncols}) elements\" unless values.length == nrows*ncols\n end\n nrows.times do |rowid|\n row = @rows[@rownames.keys[rowid]]\n colnames.each.with_index do |colname, j| row[colname] = values[rowid*ncols + j] end\n end\n self\n end", "title": "" }, { "docid": "858fd30bb644ab43cf993f34e07b02aa", "score": "0.5391151", "text": "def sh_set_lines_and_columns(lines, cols)\r\n ENV[\"LINES\"] = lines.to_s\r\n ENV[\"COLUMNS\"] = cols.to_s\r\n end", "title": "" }, { "docid": "7d1d46126f933b1a32184ba183d3dfca", "score": "0.5380604", "text": "def update!(row = @row, col = @col)\n @cells[row][col] = yield at(row, col)\n end", "title": "" }, { "docid": "94d40900027819ab936053da8ba1571c", "score": "0.5377005", "text": "def adjust_values\n @cols = @rows.transpose\n @blks[0] = [@rows[0][0], @rows[0][1], @rows[0][2], @rows[1][0], @rows[1][1], @rows[1][2], @rows[2][0], @rows[2][1], @rows[2][2]] #1\n @blks[1] = [@rows[0][3], @rows[0][4], @rows[0][5], @rows[1][3], @rows[1][4], @rows[1][5], @rows[2][3], @rows[2][4], @rows[2][5]] #2\n @blks[2] = [@rows[0][6], @rows[0][7], @rows[0][8], @rows[1][6], @rows[1][7], @rows[1][8], @rows[2][6], @rows[2][7], @rows[2][8]] #3\n @blks[3] = [@rows[3][0], @rows[3][1], @rows[3][2], @rows[4][0], @rows[4][1], @rows[4][2], @rows[5][0], @rows[5][1], @rows[5][2]] #4 \n @blks[4] = [@rows[3][3], @rows[3][4], @rows[3][5], @rows[4][3], @rows[4][4], @rows[4][5], @rows[5][3], @rows[5][4], @rows[5][5]] #5\n @blks[5] = [@rows[3][6], @rows[3][7], @rows[3][8], @rows[4][6], @rows[4][7], @rows[4][8], @rows[5][6], @rows[5][7], @rows[5][8]] #6\n @blks[6] = [@rows[6][0], @rows[6][1], @rows[6][2], @rows[7][0], @rows[7][1], @rows[7][2], @rows[8][0], @rows[8][1], @rows[8][2]] #7\n @blks[7] = [@rows[6][3], @rows[6][4], @rows[6][5], @rows[7][3], @rows[7][4], @rows[7][5], @rows[8][3], @rows[8][4], @rows[8][5]] #8\n @blks[8] = [@rows[6][6], @rows[6][7], @rows[6][8], @rows[7][6], @rows[7][7], @rows[7][8], @rows[8][6], @rows[8][7], @rows[8][8]] #9 \n solved\n end", "title": "" }, { "docid": "5a7b8625b2d9cc06f3fd7eec6b3dd275", "score": "0.53667426", "text": "def row(grid_size, row_num)\n row_values = ' ' * grid_size\n row_values[row_num - 1] = '*'\n row_values[grid_size / 2] = '*'\n row_values[grid_size - row_num] = '*'\n row_values\nend", "title": "" }, { "docid": "69be51d7924fe51b7c2770bde171ad57", "score": "0.5356284", "text": "def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end", "title": "" }, { "docid": "3529486c156c6daf377312b51685bd87", "score": "0.5349986", "text": "def update!(**args)\n @column = args[:column] if args.key?(:column)\n @columns = args[:columns] if args.key?(:columns)\n end", "title": "" }, { "docid": "62820ad962b23cdfc1262951930a16a4", "score": "0.5347895", "text": "def resize_to_fill(ncols, nrows = nil, gravity = CenterGravity)\n copy.resize_to_fill!(ncols, nrows, gravity)\n end", "title": "" }, { "docid": "574c6ab7656340bfd2f9846e503da89c", "score": "0.5344164", "text": "def increase_rows(row)\n @sheet_data.size.upto(row) do\n @sheet_data << Array.new(@sheet_data[0].size)\n end\n end", "title": "" }, { "docid": "0f807f40d0c9244c7c53c1a1bdc50263", "score": "0.534177", "text": "def insert_rows( before, number=1 )\n @data = @data.insert( ( col_index( before ) - 1 ), *Array.new( number, [nil] ) )\n calc_dimensions\n end", "title": "" }, { "docid": "cd9b29c843a7a086b0254e6a2e7c67c5", "score": "0.53385395", "text": "def matrix_replace(row, column, newvalue)\n self[row*9 + column] = newvalue\n end", "title": "" }, { "docid": "6b51e08409085d7b936eda018d362c48", "score": "0.5337403", "text": "def []=(row, column, value)\n end", "title": "" }, { "docid": "2b695eb2d118056140831399973d3a0b", "score": "0.53319514", "text": "def row_space=(val)\n @row_space = val\n update_xy\n end", "title": "" }, { "docid": "2142a22d9ad3441e1983a6d11f7c0212", "score": "0.53276277", "text": "def append_sudoku(lat, lng, row = -1, col = -1)\n\n end", "title": "" }, { "docid": "5053c6ff2d12c53987b569f93a4ebc25", "score": "0.53268564", "text": "def initialize(rows, rownames: nil, colnames: nil)\n @rows = rows\n @rownames = (rownames || Hash[*rows.length.times.map do |i| [i, i] end.flatten(1)]).to_ordered_hash\n unless colnames then\n colnames = {}\n rows.each do |row| row.keys.each do |colname| colnames[colname] = true end end\n colnames = colnames.keys\n end\n @colnames = colnames.collect do |colname| colname.to_s.to_sym end\n end", "title": "" }, { "docid": "feacdc1a7c078797390759fe0108b8b0", "score": "0.531974", "text": "def set_row(row, height = nil, format = nil, hidden = 0, level = 0, collapsed = 0)\n record = 0x0208 # Record identifier\n length = 0x0010 # Number of bytes to follow\n\n colMic = 0x0000 # First defined column\n colMac = 0x0000 # Last defined column\n # miyRw; # Row height\n irwMac = 0x0000 # Used by Excel to optimise loading\n reserved = 0x0000 # Reserved\n grbit = 0x0000 # Option flags\n # ixfe; # XF index\n\n return if row.nil?\n\n # Check that row and col are valid and store max and min values\n return -2 if check_dimensions(row, 0, 0, 1) != 0\n\n # Check for a format object\n if format.kind_of?(Format)\n ixfe = format.get_xf_index\n else\n ixfe = 0x0F\n end\n\n # Set the row height in units of 1/20 of a point. Note, some heights may\n # not be obtained exactly due to rounding in Excel.\n #\n unless height.nil?\n miyRw = height *20\n else\n miyRw = 0xff # The default row height\n height = 0\n end\n\n # Set the limits for the outline levels (0 <= x <= 7).\n level = 0 if level < 0\n level = 7 if level > 7\n\n @outline_row_level = level if level > @outline_row_level\n\n # Set the options flags.\n # 0x10: The fCollapsed flag indicates that the row contains the \"+\"\n # when an outline group is collapsed.\n # 0x20: The fDyZero height flag indicates a collapsed or hidden row.\n # 0x40: The fUnsynced flag is used to show that the font and row heights\n # are not compatible. This is usually the case for WriteExcel.\n # 0x80: The fGhostDirty flag indicates that the row has been formatted.\n #\n grbit |= level\n grbit |= 0x0010 if collapsed != 0\n grbit |= 0x0020 if hidden != 0\n grbit |= 0x0040\n grbit |= 0x0080 unless format.nil?\n grbit |= 0x0100\n\n header = [record, length].pack(\"vv\")\n data = [row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe].pack(\"vvvvvvvv\")\n\n # Store the data or write immediately depending on the compatibility mode.\n if @compatibility != 0\n @row_data[row] = header + data\n else\n append(header, data)\n end\n\n # Store the row sizes for use when calculating image vertices.\n # Also store the column formats.\n @row_sizes[row] = height\n @row_formats[row] = format unless format.nil?\n end", "title": "" }, { "docid": "ae3aca553c6ba767965a1da921f46ef6", "score": "0.5319452", "text": "def set(row = @row, col = @col, val)\n row, col = wrap(row, col)\n @cells[row][col] = val\n end", "title": "" }, { "docid": "bb37f35f86dc0e0d8ad98e221654c755", "score": "0.5318667", "text": "def create(rows: 10, cols: 10, color: \"B\")\n delete_state\n get_state\n @rows = rows\n @cols = cols\n @image = Array.new(rows) do\n Array.new(cols) { color }\n end\n save_state\n self\n end", "title": "" }, { "docid": "a5568ee1d096084acd6a1d85a6eb6dbd", "score": "0.5317371", "text": "def clear(row, col)\n\n end", "title": "" }, { "docid": "d0ee457620b317fefde9277f49c12b60", "score": "0.53162926", "text": "def grid(cols, rows)\n vert rows do |r, i|\n r.horz cols do |c, j|\n yield r, c, i, j if block_given?\n end\n end\n end", "title": "" }, { "docid": "e05cc17f7072b700abea4b94a898a228", "score": "0.53110915", "text": "def create_rows\n (row_count.to_i - rows.size).times { rows.create(position: rows.size) }\n end", "title": "" }, { "docid": "54714bc16ae60f8f7842f20c154f262d", "score": "0.53053176", "text": "def initialize (row_list)\n @rows = row_list\n @rows_reduced = 0\n end", "title": "" }, { "docid": "885f94dbd5d16da3da6cdf97abd2e920", "score": "0.5302752", "text": "def update!(**args)\n @altitude_multiplier = args[:altitude_multiplier] if args.key?(:altitude_multiplier)\n @column_count = args[:column_count] if args.key?(:column_count)\n @encoded_data = args[:encoded_data] if args.key?(:encoded_data)\n @row_count = args[:row_count] if args.key?(:row_count)\n end", "title": "" }, { "docid": "885f94dbd5d16da3da6cdf97abd2e920", "score": "0.5302752", "text": "def update!(**args)\n @altitude_multiplier = args[:altitude_multiplier] if args.key?(:altitude_multiplier)\n @column_count = args[:column_count] if args.key?(:column_count)\n @encoded_data = args[:encoded_data] if args.key?(:encoded_data)\n @row_count = args[:row_count] if args.key?(:row_count)\n end", "title": "" }, { "docid": "26568c660880f237b9c12d2d0b5d9e7a", "score": "0.52995485", "text": "def OLDsetrowcol r, c\n $log.debug \" SCROLL setrowcol #{r}, #{c} + #{@cols_panned}\"\n # aha ! here's where i can check whether the cursor is falling off the viewable area\n cc = nil\n rr = nil\n if c\n cc = c #+ @cols_panned\n if c+@cols_panned < @orig_left\n # this essentially means this widget (button) is not in view, its off to the left\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} < #{@orig_left} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n if c+@cols_panned > @orig_left + @display_w\n # this essentially means this button is not in view, its off to the right\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} > #{@orig_left} + #{@display_w} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n end\n if r\n rr = r+@rows_panned\n end\n super rr, cc\n end", "title": "" }, { "docid": "a7240903f303c0bd70ffd4b07dd2f5b9", "score": "0.5286423", "text": "def resize(width, height)\n end", "title": "" }, { "docid": "28ca1d60150dd8fd271f552acb4e6e46", "score": "0.5283306", "text": "def set(m)\n 0.upto(m.row_size - 1) do |i|\n 0.upto(m.column_size - 1) do |j|\n self[i, j] = m[i, j]\n end\n end\n self.wrap = m.wrap\n end", "title": "" } ]
1cb908970b4af66a3b7db5743ac12de7
Returns true if the two models have equivalent steps and false otherwise.
[ { "docid": "10136b0bb33ce091597ddcd15068c30e", "score": "0.7280424", "text": "def ==(other)\n return false unless other.respond_to?(:steps)\n\n steps == other.steps\n end", "title": "" } ]
[ { "docid": "83425621993dc7fab74dada1c7c8206f", "score": "0.6892695", "text": "def is_equal?(step_nr)\n return step_nr == self.step\n end", "title": "" }, { "docid": "ee538926ced35d831bf32bd309a5d28e", "score": "0.638238", "text": "def is_tied_with?(other)\n #vm: (self.pts == other.pts) and (self.goal_diff == other.goal_diff) and (self.goals_for == other.goals_for)\n self.pts == other.pts\n end", "title": "" }, { "docid": "9d525a49ec32973f162524f5376d9fef", "score": "0.63587683", "text": "def is_equivalent()\n return !is_same() && \n @atkDifference == 0 && \n @defDifference == 0 &&\n @spiDifference == 0 &&\n @agiDifference == 0 &&\n @evaDifference == 0 &&\n @hitDifference == 0\n end", "title": "" }, { "docid": "9d525a49ec32973f162524f5376d9fef", "score": "0.63587683", "text": "def is_equivalent()\n return !is_same() && \n @atkDifference == 0 && \n @defDifference == 0 &&\n @spiDifference == 0 &&\n @agiDifference == 0 &&\n @evaDifference == 0 &&\n @hitDifference == 0\n end", "title": "" }, { "docid": "3a0f9b09e8e0961da1ad7f211aa80c15", "score": "0.6297466", "text": "def diff?\n !diff.empty? || associations_changed?\n end", "title": "" }, { "docid": "f1094eecce184c7b93ab6e5d4bebd993", "score": "0.627943", "text": "def identical?\n @changes.empty?\n end", "title": "" }, { "docid": "7016b4170936a49e833148f705ddfa4c", "score": "0.62497777", "text": "def reverse_equal?(other)\n # TODO: implement\n return false\n end", "title": "" }, { "docid": "9a462f2de8ceb705132fc2afd286ab5d", "score": "0.6249187", "text": "def exact_translation? ( coord_trace_1, coord_trace_2 )\n return false if coord_trace_1.size != coord_trace_2.size\n return each_step_equivalent?(coord_trace_1, coord_trace_2)\nend", "title": "" }, { "docid": "168dbdfc04e2974a27ceb87843b550f8", "score": "0.61904263", "text": "def ==(other)\n return false unless other.is_a?(CukeModeler::Step)\n\n text_matches?(other) &&\n table_matches?(other) &&\n doc_string_matches?(other)\n end", "title": "" }, { "docid": "1ce9964ed52f1fb86ee5f2d17ef58e39", "score": "0.6164708", "text": "def broken?\n if self.steps.length == 0\n return false\n else\n step_positions = self.steps.order(:position).pluck(:position)\n if step_positions.length > 1\n expected_positions = (0..step_positions.length-1).to_a \n else\n expected_positions = [0]\n end\n return (expected_positions != step_positions) || self.steps.where(:position => 0).length>1\n end\n end", "title": "" }, { "docid": "1e60d136c1870e5886313428bd17461e", "score": "0.6158098", "text": "def same_step?(section)\n expected = section.questions.first.step\n section.questions.drop(1).all? do |question|\n question.step == expected\n end\n end", "title": "" }, { "docid": "b6c4abd22a06ed83053364525ba12506", "score": "0.6148965", "text": "def same(other)\n result = @startPos == other.startPos && @steps == other.steps && @endPos == other.endPos\n end", "title": "" }, { "docid": "a7e9383d5522469eb51faab8910bfd89", "score": "0.61128014", "text": "def equivalent?(dfa1, dfa2)\n return \"not same number of states\" unless dfa1.state_count==dfa2.state_count\n equivalent_states!(dfa1.initial_state, dfa2.initial_state, {})\n end", "title": "" }, { "docid": "830d96a0b492d1fcbe3dd37094be9946", "score": "0.6073923", "text": "def equivalent?(other)\n return false unless other.instance_of?(self.class)\n\n transformations.any? { |grid| other.same?(grid) }\n end", "title": "" }, { "docid": "2dd6501dd68b117adaa35c2322bba1f5", "score": "0.60383314", "text": "def eql?(other)\n return true if equal?(other)\n return false unless other.respond_to?(:model) && model.equal?(other.model)\n eql_attributes?(other)\n end", "title": "" }, { "docid": "601eb2efd22851728c4f1c0f53cc6195", "score": "0.6030804", "text": "def mutual?\n @forward_associations.any? and @reverse_associations.any?\n end", "title": "" }, { "docid": "1d84cf89f4c304b3e74136c4d5677a50", "score": "0.60282224", "text": "def is_different?\n @before = @obj.send(@attribute)\n @after = @new_obj.send(@attribute) \n return false if @before.blank? and @after.blank?\n @compare_proc.blank? ? @before != @after : compare_objs\n end", "title": "" }, { "docid": "cb2ac5f46255e46cdc2ec704091cf849", "score": "0.5954744", "text": "def two_step_move?\r\n (self.game.moves.last.start_row - self.game.moves.last.end_row).abs == 2\r\n end", "title": "" }, { "docid": "ca15cd014f25766ff5c9b59cded3b9d4", "score": "0.5953512", "text": "def last_step?\n current_step == steps.last\n end", "title": "" }, { "docid": "7d35b696fbe63e9d3e09f59f17bd9d67", "score": "0.59482694", "text": "def equal?\n @equal\n end", "title": "" }, { "docid": "057de6dd487306fc1f2c8d492c1c2634", "score": "0.5940902", "text": "def same_model? one, two, series=[]\n return true if one == two\n vars1 = model_series_variations([one], series).collect{|x| just_alphanumeric(x)}\n vars2 = model_series_variations([two], series).collect{|x| just_alphanumeric(x)}\n vars1.each do |var|\n vars2.each do |var2|\n if var.length > 2 and var2.length > 2\n return true if var2.match(/#{var}/)\n return true if var.match(/#{var2}/)\n else\n return true if var == var2\n end\n end\n end\n return false\n end", "title": "" }, { "docid": "0499a78c9337558893aa85f395a66a40", "score": "0.5938737", "text": "def all_valid? \n steps.all? do |step| \n self.current_step = step \n valid? \n end \n end", "title": "" }, { "docid": "f29b8999a67f90a5f4d927e4a3c9fc45", "score": "0.59251875", "text": "def equivalent_states?(s, t)\n s.raw_data == t.raw_data\n end", "title": "" }, { "docid": "02d257b6303de7a21879ad35cff1b01a", "score": "0.59106135", "text": "def same_attribute?\n left.left.equal?(right.left)\n end", "title": "" }, { "docid": "801b02a52ddd3d8d221a11099bedb31c", "score": "0.5910501", "text": "def was_changed?\n @previous_record = self.last_revision\n return true unless @previous_record\n \n # Check page attributes for changing\n @page_attributes.each do |attribute|\n return true if attribute[1].to_s != @previous_record[attribute[0]].to_s\n end\n \n # Check page parts attributes for changing\n @page_parts_attributes.each_with_index do |page_part_attributes, index|\n previous_part = @previous_record.page.parts[index].last_revision rescue nil\n return true unless previous_part\n \n page_part_attributes.each do |attribute|\n return true if attribute[1].to_s != previous_part[attribute[0]].to_s\n end\n end\n \n return false\n end", "title": "" }, { "docid": "72ee4309aa000a46b331925021de4ca4", "score": "0.59027857", "text": "def equivalent?(other, ignore_same_face_center_cycles: true)\n ignore = ignore_same_face_center_cycles\n canonicalize(ignore_same_face_center_cycles: ignore).part_cycles ==\n other.canonicalize(ignore_same_face_center_cycles: ignore).part_cycles\n end", "title": "" }, { "docid": "1f86fd19e5677e73fb739380d8bf17a8", "score": "0.5892353", "text": "def diff?\n !diff.empty?\n end", "title": "" }, { "docid": "e6f609f0a2dc58446e76f1987db66771", "score": "0.5887578", "text": "def ==(other)\n initial_args == other.initial_args && history == other.history\n end", "title": "" }, { "docid": "70a5eaa3a7a11676572d04cabe0e42a3", "score": "0.58705217", "text": "def eql?(other)\n return false unless other.is_a?(self.class) &&\n @lower == other.lower &&\n @upper == other.upper &&\n @step == other.step\n return true\n end", "title": "" }, { "docid": "0b9c45db523b7aeb374498230d7bca7c", "score": "0.58585167", "text": "def finished_with?(step)\n @steps_array.length == step.index\n end", "title": "" }, { "docid": "2c45bfe7db5e630cca609ab61e7b59ad", "score": "0.5848502", "text": "def last_step? \n current_step == steps.last \n end", "title": "" }, { "docid": "bd2dfd4ab765f48f76806c8e7014ea0e", "score": "0.5844906", "text": "def current_step?\n current_step == step\n end", "title": "" }, { "docid": "cf0f70338df11ea8f0a8e37b7d4a3eb0", "score": "0.5840811", "text": "def consistent?\n @initial < @final\n end", "title": "" }, { "docid": "97d694394fd616b03d1aec42d04c834a", "score": "0.58295524", "text": "def contradiction?\n left.respond_to?(:inverse) &&\n right.respond_to?(:inverse) &&\n left.inverse.eql?(right)\n end", "title": "" }, { "docid": "4b5f605146832400abdb9998fde3dad5", "score": "0.5823045", "text": "def phonetically_different?\n not phonetically_same?\n end", "title": "" }, { "docid": "03081f4cb699e7d4d82d8591c5e1cff8", "score": "0.58137286", "text": "def sync_step?\n calc_statistics\n if @out_of_sync_delta > 0.001\n false\n else\n true\n end\n end", "title": "" }, { "docid": "9b0786a49defaa0aaf2cd43cdf6d5ad9", "score": "0.5813573", "text": "def same_as?(l2)\r\n\t\t# comparing self.option_values with l2.option_values _should_ work, but doesn't. If you\r\n\t\t# instead compare the .line_item_option_values, it works...\r\n\t\t#\r\n\t\t# Does this mean has_many :through is a horrible hack? Maybe...\r\n\t\tself.product.id == l2.product.id && self.line_item_option_values == l2.line_item_option_values\r\n\tend", "title": "" }, { "docid": "3af61d8acd34f246a3e22bd4d34a21a0", "score": "0.58063287", "text": "def learning_successful?\n @step_list[-1].all_correct?\n end", "title": "" }, { "docid": "6dd0d90ad26cf6c8b13d05eaa14c2715", "score": "0.57961315", "text": "def graph_equal_trans?(o2)\ncheck_pre((o2.graph_obj?))\n(o2.union2d?) ? self.graph_equal_?(o2) : false\nend", "title": "" }, { "docid": "ec407827fb236dbce3ae0410c560fa5f", "score": "0.5793187", "text": "def ==(other)\n return false\n # This needs to be fixed\n if BaseTransformer === other \n ret = true\n if !ret\n return false\n else\n ret = self.state.keys.sort == other.state.keys.sort\n if !ret\n return false\n end\n state.each_pair do |key,val|\n if other.state[key].class != val.class\n return false\n end\n end\n return true\n end\n else\n return false\n end\n end", "title": "" }, { "docid": "f501c2f4241bee6cdb910c4ee2f64690", "score": "0.5786141", "text": "def eql?(other)\n super && directions.eql?(other.directions)\n end", "title": "" }, { "docid": "93d367bfa3bda7805b5fe6a128872c3f", "score": "0.5768307", "text": "def same_revision?\n current_revision == target_revision\n end", "title": "" }, { "docid": "a3df8a18179a837ed911027e132eeb75", "score": "0.57588804", "text": "def graph_equal_trans?(o2) o2.point2d? end", "title": "" }, { "docid": "0ca798071fa7225cc768954508fabaaa", "score": "0.5757706", "text": "def equivalent(sim)\r\n sim.equivalence_id == self.equivalence_id\r\n end", "title": "" }, { "docid": "d7e65c1a3ef11be73c897e59e0bd123f", "score": "0.57552856", "text": "def cycle?\n first.hash == last.hash\n end", "title": "" }, { "docid": "4c21e423ff2ecb9c902df070d84c8bc0", "score": "0.5750364", "text": "def first_step?\n current_step == steps.first\n end", "title": "" }, { "docid": "3e5f6de27b485a50a8861705adccb03f", "score": "0.5743816", "text": "def ==(other)\n model == other.model\n end", "title": "" }, { "docid": "3b502fa1b632ba3fa8cc949c97de7021", "score": "0.5733454", "text": "def is_same_as?(other)\n normal = vertex_one == other.vertex_one && vertex_two == other.vertex_two\n inverse = vertex_one == other.vertex_two && vertex_two == other.vertex_one\n normal || inverse\n end", "title": "" }, { "docid": "2e8cf7f1f5939fabfe03499ac0fd0418", "score": "0.5725981", "text": "def ==(other)\n if equal?(other)\n return true\n end\n\n unless other.respond_to?(:model) && model.base_model.equal?(other.model.base_model)\n return false\n end\n\n cmp?(other, :==)\n end", "title": "" }, { "docid": "5fabe6ab630b85eb65abf5d7fe608349", "score": "0.57215273", "text": "def equal_in_delta?(m0, m1, delta = 1.0e-10)\n delta = delta.abs\n m0.row_size.times {|i|\n m0.column_size.times {|j|\n x=m0[i,j]; y=m1[i,j]\n return false if (x < y - delta or x > y + delta)\n }\n }\n true\n end", "title": "" }, { "docid": "2cdc7efb4a0ba853d1ce88d1f117b4dd", "score": "0.5716908", "text": "def easy_steps?\n easy_steps == \"true\"\n end", "title": "" }, { "docid": "bd75afce1bcb6697d3d8f308dc8a9890", "score": "0.5702995", "text": "def equivalent_states!(s1, s2, equivalences)\n return \"#{s1.index} and #{s2.index} don't agree on flags\" \\\n unless s1.initial? == s2.initial? \\\n and s1.accepting? == s2.accepting? \\\n and s1.error? == s2.error?\n return \"#{s1.index} and #{s2.index} don't agree on out symbols #{s1.out_symbols.inspect} #{s2.out_symbols.inspect}\"\\\n unless s1.out_symbols.sort == s2.out_symbols.sort\n equivalences[s1.index] = s2.index\n s1.out_symbols.each do |symbol|\n s1_target = s1.dfa_step(symbol)\n s2_target = s2.dfa_step(symbol)\n return false if (s1_target.nil? or s2_target.nil?)\n if equivalences.has_key?(s1_target.index)\n return \"#{s1.index} and #{s2.index} don't agree on #{symbol}\"\\\n unless equivalences[s1_target.index]==s2_target.index\n else\n return msg \\\n if msg=equivalent_states!(s1_target, s2_target, equivalences)\n end\n end\n nil\n end", "title": "" }, { "docid": "477f306e3d18dae55e7127d16cdda83d", "score": "0.57005835", "text": "def first_step? \n current_step == steps.first \n end", "title": "" }, { "docid": "a1078a66917874d8227080dfbfe2e07b", "score": "0.5699794", "text": "def diffable?\n false\n end", "title": "" }, { "docid": "a1078a66917874d8227080dfbfe2e07b", "score": "0.5699794", "text": "def diffable?\n false\n end", "title": "" }, { "docid": "a38bc0c9f269c603a608d76aa49a54a6", "score": "0.56973755", "text": "def same_as?(other)\n return false if other.nil?\n attributes.except('id', 'updated_at', 'created_at', 'user_id') == other.attributes.except('id', 'updated_at', 'created_at', 'user_id')\n end", "title": "" }, { "docid": "a38bc0c9f269c603a608d76aa49a54a6", "score": "0.56973755", "text": "def same_as?(other)\n return false if other.nil?\n attributes.except('id', 'updated_at', 'created_at', 'user_id') == other.attributes.except('id', 'updated_at', 'created_at', 'user_id')\n end", "title": "" }, { "docid": "1cabe0739a16d2ad5f62e4234bac911c", "score": "0.56949055", "text": "def equal?\n @operands.first == @operands.last\n end", "title": "" }, { "docid": "a0dccecac8094a08022fa1b2340db6e5", "score": "0.5691873", "text": "def diffable?\n false\n end", "title": "" }, { "docid": "a89cc778a3bf53c5e75334d7db02fe8d", "score": "0.5683527", "text": "def ==(other)\n return true if equal?(other)\n return false unless other.respond_to?(:model) && model.base_model.equal?(other.model.base_model)\n eql_attributes?(other)\n end", "title": "" }, { "docid": "812a249bc386325ab526eedd0d2de347", "score": "0.56720287", "text": "def completed_changed?\n completed_before_save != completed\n end", "title": "" }, { "docid": "1ff96d2aea20b00cc95c061b94870b02", "score": "0.5671918", "text": "def completed?\n @step == @total_steps\n end", "title": "" }, { "docid": "12a7075d31abd913343bcb374a7eae86", "score": "0.5644286", "text": "def identical?\n exists?\n end", "title": "" }, { "docid": "12a7075d31abd913343bcb374a7eae86", "score": "0.5644286", "text": "def identical?\n exists?\n end", "title": "" }, { "docid": "c4740f11133355a76ad350d1efb2a937", "score": "0.56420845", "text": "def test_equals_edgecases\n Sketchup.active_model.start_operation \"test_equals_edgecases\"\n model = Sketchup.active_model\n materials = model.materials\n materials.each do |m|\n assert_equal(true, m == m,\n 'Failed in test_equals_edgecases' )\n end\n Sketchup.active_model.commit_operation\n Sketchup.undo\n end", "title": "" }, { "docid": "affb4a2bbbb7d2a28eae5e02278b0add", "score": "0.5638128", "text": "def evaluate_next_step_on_change?\n next_step.in? %i[cannot_add_registration_not_yet_open need_training_setup]\n end", "title": "" }, { "docid": "959f00237589634c117b1b6c4d319970", "score": "0.56315696", "text": "def equal_by_trans?(in_obj1, in_obj2)\n if not equal_by_dim?(in_obj1, in_obj2) then false\n elsif point?(in_obj1) or point?(in_obj2) then point?(in_obj1) and point?(in_obj2)\n elsif shape?(in_obj1) and shape?(in_obj2) then equal_by_tree?(translate(in_obj1, get_tralsation(bounds(in_obj1), bounds(in_obj2))), in_obj2)\n else false\n end\nend", "title": "" }, { "docid": "282082fd3a9acd9e683e6a1ad06804f8", "score": "0.56242347", "text": "def ===(other)\n self.attributes == other.attributes\n end", "title": "" }, { "docid": "eff298b352f1e650442b0fd9fc74f314", "score": "0.5621493", "text": "def synced_attributes_changed?\n (model.previous_changes.keys & synced_attributes).present?\n end", "title": "" }, { "docid": "0b7e67c55c3e0775443da81388f4c8eb", "score": "0.5616651", "text": "def eql_attributes?(other)\n return false if key != other.key\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n loaded, not_loaded = properties.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end", "title": "" }, { "docid": "f9ae747478c4b898733d8f0ff07fc7d7", "score": "0.5609245", "text": "def graph_equal_?(o2)\n check_pre((o2.graph_obj?))\n (o2.point1d?) ? (self.int == o2.int) : false\nend", "title": "" }, { "docid": "8e1503f950c26074da118c26fc0d3e64", "score": "0.5601012", "text": "def graph_equal_trans?(o) check_pre(o.range2d?); first.graph_equal_trans?(o.first) and last.graph_equal_trans?(o.last) end", "title": "" }, { "docid": "90a10748c725599cd4345e0dc19662b3", "score": "0.55977976", "text": "def phonetically_same?\n segmentation.phonetic_operations[from..to].all? {|op| op.nil?}\n end", "title": "" }, { "docid": "dad3a1aab272903c73e17ac001ae9f10", "score": "0.5587965", "text": "def ==(other)\n return false unless super\n self.force == other.force\n end", "title": "" }, { "docid": "ac0f929b099da70d19a29f4efa3597d3", "score": "0.55838543", "text": "def referee?\n return true if referring_motion && ( referring_motion.committee != committee )\n false\n end", "title": "" }, { "docid": "0234da2a8afed9d339bc6819660481b0", "score": "0.5581633", "text": "def same?(other)\n self.debut == other.debut and \n self.duree == other.duree and \n self.activite == other.activite\n end", "title": "" }, { "docid": "b89a89d06c62acb755ff60739672960f", "score": "0.5581348", "text": "def==(other_train)\n number == other_train.number && type == other_train.type\n end", "title": "" }, { "docid": "29345f772c3d7ee0cdf724909602ec02", "score": "0.5575582", "text": "def palindrome?\r\n return self.reverse == self\r\n end", "title": "" }, { "docid": "14938fc1a15c688ec9ea34a8a937f28f", "score": "0.55750585", "text": "def equal?\n versions.reject { |v| v == versions.first }.length.zero?\n end", "title": "" }, { "docid": "0c8a004e7e4d869b5684bdf05fd40d17", "score": "0.5572368", "text": "def graph_equal_trans?(o) check_pre(o.union_shape?); first.graph_equal_trans?(o.first) and last.graph_equal_trans?(o.last) end", "title": "" }, { "docid": "8735066c790244fc5b30be610db76c00", "score": "0.5567905", "text": "def samedirection?(vector2)\n end", "title": "" }, { "docid": "9cf44fc768a8bc1238efc614d4235431", "score": "0.5560973", "text": "def two_way?\n @two_way\n end", "title": "" }, { "docid": "180d63ba0b0d9d322468bff57e96429d", "score": "0.55591714", "text": "def ==(other)\n self.class === other &&\n @model == other.instance_variable_get(:@model)\n end", "title": "" }, { "docid": "78be6f57893d8352d00d64e426737ea3", "score": "0.5557234", "text": "def equal?(other)\n %i[street_number route intersection premise subpremise city postcode\n state].each_with_object({}) do |type, acc|\n acc && (send(type) == other.send(type))\n end\n end", "title": "" }, { "docid": "2f9eccab84734fd1890c54da38a5c84c", "score": "0.55547744", "text": "def samedirection?(vector)\n end", "title": "" }, { "docid": "758328e272b476277864cd0ed28f5c58", "score": "0.5551366", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self.point1d? and o2.point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "758328e272b476277864cd0ed28f5c58", "score": "0.5551366", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self.point1d? and o2.point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "758328e272b476277864cd0ed28f5c58", "score": "0.5551366", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self.point1d? and o2.point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "758328e272b476277864cd0ed28f5c58", "score": "0.5551366", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self.point1d? and o2.point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "758328e272b476277864cd0ed28f5c58", "score": "0.5551366", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self.point1d? and o2.point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "4a92eaaf21272e92e3ebfdcc9ae3e037", "score": "0.5548712", "text": "def equal_by_trans?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n bounds_obj1 = bounds(graph_obj1)\n bounds_obj2 = bounds(graph_obj2)\n if (not equal_by_dim?(graph_obj1, graph_obj2) or (not (bounds_obj1.size == bounds_obj2.size))) then false\n elsif equal_by_tree?(translate(graph_obj1, shift(bounds_obj1, bounds_obj2)), graph_obj2) then true\n else false\n end\nend", "title": "" }, { "docid": "3a4bf3a6f634ea89932861d7385e9cc8", "score": "0.55482316", "text": "def deterministic?\n @states.each{|s| return false if not s.deterministic_transitions? }\n return true\n end", "title": "" }, { "docid": "0cfbbf8cefc43131f94dc7bbf7e36636", "score": "0.5545521", "text": "def graph_equal_?(o2)\n check_pre((self.graph_obj? and o2.graph_obj?))\n if (self .point1d? and o2 .point1d?) or\n (self== Point2d and o2== Point2d) or \n (self.shape1d? and o2.shape1d?) or\n (self.shape2d? and o2.shape2d?) then\n self == o2\n else\n check_pre((false))\n end\nend", "title": "" }, { "docid": "b3a0cb1223f3a391680b0ea6b3e1dd81", "score": "0.55401176", "text": "def eql?(other)\n other.points == points\n end", "title": "" }, { "docid": "58fb239653a33f9f5abce8fb956c10f9", "score": "0.5529037", "text": "def good_step?( step = self.step )\n complete_step?( step ) and filled_step?( step ) and regular_step?( step )\n end", "title": "" }, { "docid": "6da1f72b29ffe1a0d6e146a4e660c8ba", "score": "0.5528452", "text": "def emrip?\n prime? and reverse != self and reverse.prime?\n end", "title": "" }, { "docid": "9f51d18558225b6f5f9e1cb8ab408835", "score": "0.5520172", "text": "def eql?(obj)\n (obj.class == model) && (obj.values == values)\n end", "title": "" }, { "docid": "90f5fdece8220cee8875d5416bf0a1b1", "score": "0.55193365", "text": "def prereq_validation(given_params)\n given_params[:steps_attributes].each do |attributes|\n attributes.each do |step|\n if step.include?(\"step_mappers_attributes\")\n nums = []\n immeds = []\n preheats = []\n step[:step_mappers_attributes].each do |mapper|\n if mapper[1][:_destroy] == \"false\"\n nums.push(mapper[1][:prereq_step_number])\n immeds.push(mapper[1][:immediate_prereq])\n preheats.push(mapper[1][:preheat_prereq])\n end\n unless nums == nums.uniq\n return false\n end\n num_immeds = 0\n immeds.each do |immed|\n if immed == \"1\"\n num_immeds = num_immeds + 1\n end\n if num_immeds > 1\n return false\n end\n end\n num_preheats = 0\n preheats.each do |preheat|\n if preheat == \"1\"\n num_preheats = num_preheats + 1\n end\n if num_preheats > 1\n return false\n end\n end\n end\n end\n end\n end\n end", "title": "" }, { "docid": "b6a34d59f6add3253507fdbb9c2c4a0e", "score": "0.5518503", "text": "def new_status_different?(previous)\n return true unless previous.present?\n status != previous.status\n end", "title": "" }, { "docid": "b6a34d59f6add3253507fdbb9c2c4a0e", "score": "0.5518503", "text": "def new_status_different?(previous)\n return true unless previous.present?\n status != previous.status\n end", "title": "" } ]
bcf313efd08ab4a28f0ea421a074352c
DELETE /passions/1 DELETE /passions/1.json
[ { "docid": "fd05aef5d8ad63cde39ce93c967722f2", "score": "0.7451597", "text": "def destroy\n @passion = Passion.find(params[:id])\n @passion.destroy\n\n respond_to do |format|\n format.html { redirect_to passions_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "b3d40e2bf9c059fe2cb1078180f895ee", "score": "0.7274911", "text": "def destroy\n @pass.destroy\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "40014e5ef76989bfce473a250c66c923", "score": "0.71905625", "text": "def destroy\n @pass = Pass.find(params[:id])\n @pass.destroy\n\n respond_to do |format|\n format.html { redirect_to passes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "929e33dde4a01af07893ca39159551fa", "score": "0.71135753", "text": "def destroy\n @passion = Passion.find(params[:id])\n @passion.destroy\n\n respond_to do |format|\n format.html { redirect_to(passions_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8bd3dc4926f6bb4e122c3bb028f12936", "score": "0.7038222", "text": "def delete_guest_access_portal(args = {}) \n delete(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend", "title": "" }, { "docid": "8bd3dc4926f6bb4e122c3bb028f12936", "score": "0.7038222", "text": "def delete_guest_access_portal(args = {}) \n delete(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend", "title": "" }, { "docid": "773e5d611adeb09776f9c841e1b876cc", "score": "0.6925938", "text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end", "title": "" }, { "docid": "315777392009aeaab444090eba86c5c5", "score": "0.69233036", "text": "def destroy\n @passdown.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b445c184893647d3482f8fbc6a507a52", "score": "0.6890613", "text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end", "title": "" }, { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.6840049", "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": "75a785bddc2252b3dfe08070dcb44399", "score": "0.682453", "text": "def delete(args)\n if args[:json]\n post(args.merge(method: :delete))\n else\n get(args.merge(method: :delete))\n end\n end", "title": "" }, { "docid": "accc45c9ad9b46a6e834b78c0915a5fc", "score": "0.6758084", "text": "def destroy\n @one_day_pass.destroy\n respond_to do |format|\n format.html { redirect_to one_day_passes_url, notice: 'One day pass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0b24cbc6495df3923ea7679acbcd8deb", "score": "0.67500913", "text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend", "title": "" }, { "docid": "6a19ba99f0d1f7225b5ed73fe068136d", "score": "0.6741919", "text": "def delete(path, params: {}, headers: {})\n request_json :delete, path, params, headers\n end", "title": "" }, { "docid": "525c76e8f4071d7a0182c23386c7ad77", "score": "0.67406845", "text": "def destroy\n @locality = Locality.find(params[:id])\n @pass = @locality.pass\n @locality.destroy\n\n\n respond_to do |format|\n format.html { redirect_to @pass }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0223322a704cdeb2c5d0b6fc71048e7c", "score": "0.6732567", "text": "def destroy\n @pathway = Pathway.find(params[:id])\n @pathway.destroy\n\n respond_to do |format|\n format.html { redirect_to pathways_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.6720689", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "ad8a6c1aff9ae42210b0c0c7fa2fe31b", "score": "0.6705021", "text": "def destroy\n @passlost.destroy\n respond_to do |format|\n format.html { redirect_to passlosts_url, notice: 'Passlost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ed0ab7fbc1f01ac66df4fd868e773718", "score": "0.6658177", "text": "def destroy\n @gatepass.destroy\n respond_to do |format|\n format.html { redirect_to gatepasses_url, notice: 'Gatepass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "472a5c93995f0ac8a19c55ee1f94c024", "score": "0.66323495", "text": "def destroy\n @http_passer = Http::Passer.find(params[:id])\n @http_passer.destroy\n\n respond_to do |format|\n format.html { redirect_to http_passers_url }\n format.json { head :ok }\n end\n\n Http::Passer.send_to_redis\n end", "title": "" }, { "docid": "0387aa3c568d857184e97a214e580a14", "score": "0.6586742", "text": "def delete(path, params = {}, payload = {})\n JSON.parse Generic.delete(@base_url, @headers, path, params, payload)\n end", "title": "" }, { "docid": "ca0cff79501045b9409ac8012f675d25", "score": "0.65866387", "text": "def destroy\n @pass_d_point = PassDPoint.find(params[:id])\n @pass_d_point.destroy\n\n respond_to do |format|\n format.html { redirect_to pass_d_points_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0661ff25d0ad9c36635b228e8f772e3b", "score": "0.6559618", "text": "def destroy\n @telemetry = Telemetry.find(params[:id])\n #path = \"telemetries/IXV/#{@telemetry.database.version}/#{@telemetry.name}_#{@telemetry.version}\"\n delete = %x[rm -R #{@telemetry.path}]\n @telemetry.destroy\n respond_to do |format|\n format.html { redirect_to telemetries_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4b526420bc000a217b0836db8661a068", "score": "0.65475446", "text": "def destroy\n @passanger.destroy\n respond_to do |format|\n format.html { redirect_to passangers_url, notice: \"Passanger was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a45cc554e9e03fdd24e7dd7b84d9b6ca", "score": "0.652671", "text": "def destroy\n @royalpass.destroy\n respond_to do |format|\n format.html { redirect_to royalpasses_url, notice: 'Royalpass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7452c4d15daf08108aaa5a1b728adb31", "score": "0.6508969", "text": "def destroy\n @json.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "852a7c7c8da4c88c2ad193c88f1350b3", "score": "0.6503864", "text": "def destroy\n if @current.admin?\n @trip_pass.destroy\n respond_to do |format|\n format.html { redirect_to trip_passes_url, notice: 'Trip pass was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to trip_passes_url, alert: 'Not authorized to destroy trip pass.'\n end\n end", "title": "" }, { "docid": "d0b66dbec738530d0c774948b1852627", "score": "0.6503855", "text": "def destroy\n @pasien = Pasien.find(params[:id])\n @pasien.destroy\n\n respond_to do |format|\n format.html { redirect_to pasiens_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8f314271b6ddc87eeeea2ba210ec49d1", "score": "0.6491638", "text": "def delete\n render json: Person.delete(params[\"id\"])\n end", "title": "" }, { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.647671", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "ce4959a2ffa6531fe306be50f0c4a69a", "score": "0.64709234", "text": "def destroy\n @path_of_plant.destroy\n respond_to do |format|\n format.html { redirect_to path_of_plants_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8026b9688e141ab07fb8bc978139b23a", "score": "0.64635277", "text": "def destroy\n @events = Event.all\n @fastpass = Fastpass.find(params[:id])\n @fastpass.destroy\n\n respond_to do |format|\n format.html { redirect_to(fastpasses_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "4baec51c6ffea95baf8ab5901290d4be", "score": "0.6448672", "text": "def destroy\n @tribute.destroy\n respond_to do |format|\n format.html { redirect_to tributes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cfea572d114948e2ea084b545c3be8cd", "score": "0.64442784", "text": "def destroy\n request = RestClient.delete File.join(API_SERVER,\"rest-api/departments\",params['id'])\n redirect_to :action => :index\t\n end", "title": "" }, { "docid": "b9ec212f62402c26e0f73d4d5a7d4eca", "score": "0.644377", "text": "def _delete(path, isD2l = true, headers = {})\n headers[:content_type] = :json\n auth_uri = path\n auth_uri = create_authenticated_uri(path, 'DELETE') if isD2l == true\n RestClient.delete(auth_uri, headers)\nend", "title": "" }, { "docid": "c1cde2518cb592b6add14fe05ae1b37d", "score": "0.6435631", "text": "def delete\n options = self.to_h \n uri = self.class.path_builder(:delete, self.id)\n data = {}\n data['id'] = self.id \n data = data.to_json\n VivialConnect::Client.instance.make_request('DELETE', uri, data)\n end", "title": "" }, { "docid": "718fd485f95a30a8c897e2403defb29f", "score": "0.6434725", "text": "def delete(path, params={}); make_request(:delete, host, port, path, params); end", "title": "" }, { "docid": "137f30822b269caf4dc7bb545e0edc19", "score": "0.64331245", "text": "def destroy\n @walking.destroy\n respond_to do |format|\n format.html { redirect_to walkings_url, notice: 'Passeio excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5c181505ac0deedddfba684db419e428", "score": "0.642031", "text": "def delete\n render json: Own.delete(params[\"id\"])\n end", "title": "" }, { "docid": "49f10b67d9b7348f009ee915aabe33e0", "score": "0.6412961", "text": "def destroy\n @distance_essential = DistanceEssential.find(params[:id])\n @distance_essential.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": "feb05fa712cede2232b7a79bf0cdeb56", "score": "0.64113814", "text": "def delete\n render json: Entry.delete(params[\"id\"])\n end", "title": "" }, { "docid": "9106867cee9e8775ba817195d3bc2020", "score": "0.64100003", "text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end", "title": "" }, { "docid": "f0f00fa785a41508306a4f49587387b4", "score": "0.64091897", "text": "def destroy\n @direction = current_user.directions.find(params[:id])\n @direction.destroy\n\n respond_to do |format|\n format.html { redirect_to directions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f685fa1063629a82ab0fcc67b6adcb1e", "score": "0.6407647", "text": "def destroy\n @tache = Tache.find(params[:id])\n @tache.destroy\n\n respond_to do |format|\n format.html { redirect_to taches_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "acf3fdc96c4646c01364b78ab325575b", "score": "0.64068127", "text": "def destroy\n @palpite = Palpite.find(params[:id])\n @palpite.destroy\n\n respond_to do |format|\n format.html { redirect_to palpites_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1f57cef94c1b0c64b7d7a36c71b0084c", "score": "0.63979274", "text": "def destroy\n @gate = Gate.find(params[:id])\n @gate.destroy\n\n respond_to do |format|\n format.html { redirect_to gates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c53a7ddfb5f66bdab62b1fc4305a0473", "score": "0.63959175", "text": "def delete *args\n make_request :delete, *args\n end", "title": "" }, { "docid": "8b34eba501fe79793a5edff2602a7596", "score": "0.6395046", "text": "def delete\n p \"WE IN DELETE\"\n\n p params[:id] \n\n\n begin\n p \"are we ok?\"\n # will need to change to full delete\n response = RestClient.delete \"https://gtcollab.herokuapp.com/api/meetings/\" + params[:id], {authorization: $token}\n \n p \"are we ok?\"\n objArray = JSON.parse(response.body)\n p objArray\n p \"are we ok?\"\n\n rescue => e\n p \"are we not ok?\"\n p e.response\n p e.response.body\n end\n\n redirect_to course_path(params[:course_id], :name => params[:name], :joined => params[:joined])\n end", "title": "" }, { "docid": "25e59fde77c505d20e270a06fd2f20e8", "score": "0.6392512", "text": "def destroy\n @walkthrough.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'requests', action: \"show\", id: @walkthrough.request_id }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "822ddea2e45bf78350003645efcbdb54", "score": "0.63883704", "text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end", "title": "" }, { "docid": "73aa28cb67988a7dffef14377a19a0f4", "score": "0.63815266", "text": "def delete( path, params = nil )\n path = \"#{path}?#{params.map{|k,v|\"#{k}=#{v}\"}.join('&')}\" if params\n parse( @access_token.delete( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path ) )\n end", "title": "" }, { "docid": "dcabc7105368a0530e0a631635a8b3bb", "score": "0.6380169", "text": "def destroy\n @passenger = Passenger.find(params[:id])\n @passenger.destroy\n\n respond_to do |format|\n format.html { redirect_to passengers_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "dcabc7105368a0530e0a631635a8b3bb", "score": "0.6380169", "text": "def destroy\n @passenger = Passenger.find(params[:id])\n @passenger.destroy\n\n respond_to do |format|\n format.html { redirect_to passengers_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "b530d57fd1601db5fe49d269dfac029f", "score": "0.6375254", "text": "def delete_rest_call(path, params = nil)\n uri = URI.parse('#{@base_url}#{path}')\n req_path = uri.path\n if params\n uri.query = URI.encode_www_form(params)\n req_path = '#{uri.path}?#{uri.query}'\n end\n request = Net::HTTP::Delete.new(req_path)\n return JSON.parse(send_request(request, uri).body)\n end", "title": "" }, { "docid": "47a3c9c28e1fcd0fcae5ea58416b42bd", "score": "0.63744456", "text": "def delete(path)\n api :delete, path\n end", "title": "" }, { "docid": "8615df946e3eae3e23dd9d5db72ece78", "score": "0.63723314", "text": "def destroy\n @stepstone.destroy\n\n respond_to do |format|\n format.html { redirect_to adventure_path( @adventure ) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d43d9506018f275f0a068ce1b3026504", "score": "0.63705695", "text": "def destroy\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "77c6d995d47726907fa130dfac5e04da", "score": "0.63619804", "text": "def destroy\n #@trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cc33324594434fa2cf233c653c3a6042", "score": "0.63617146", "text": "def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end", "title": "" }, { "docid": "59322e542e383fbb019450abd09e033c", "score": "0.6356373", "text": "def destroy\n @way.destroy\n respond_to do |format|\n format.html { redirect_to ways_url, notice: 'Маршрут успешно удален.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "450279cf721c70c6ebca8f222d47868b", "score": "0.6355721", "text": "def destroy\n @trip = current_user.trips.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fa4a47c22c1292a387595d2dd2890645", "score": "0.6355606", "text": "def destroy\n @steppy = Steppy.find(params[:id])\n @steppy.destroy\n\n respond_to do |format|\n format.html { redirect_to steppies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "356b64c9570080a682bc91fda2723d82", "score": "0.63510215", "text": "def destroy\n @plant = Plant.find(params[:id])\n @plant.destroy\n\n respond_to do |format|\n format.html { redirect_to plants_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7bbad0a981376b17dee29763961ad90f", "score": "0.63504624", "text": "def destroy\n @chainlet = Chainlet.find(params[:id])\n @chainlet.destroy\n\n respond_to do |format|\n format.html { redirect_to chainlets_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3935d09e48ca8261442f6718568cf0b8", "score": "0.6350129", "text": "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90edca05eaf1a7b204a42d820eb5d2ab", "score": "0.6346533", "text": "def destroy\n @antagonism = Antagonism.find(params[:id])\n @antagonism.destroy\n\n respond_to do |format|\n format.html { redirect_to antagonisms_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "723c777ee787d79a6fa4a54949d5e272", "score": "0.6346459", "text": "def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to tripes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "df58e48a8bb0986cbbab4de8ab37761e", "score": "0.6338303", "text": "def delete_mutant(m_id)\n\n request = API_URL + \"mutants/#{m_id}\"\n @response = RestClient.delete request\n log_mutant(\"deleted\")\n return\nend", "title": "" }, { "docid": "a722a50dee2af89798c1692a33390dce", "score": "0.6337018", "text": "def destroy\n @trip_waypoint.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_trip_path(@trip_waypoint.trip.id), notice: \"L'étape a été supprimée.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c0e04e7b24575da23f7965e8dad6e32c", "score": "0.633645", "text": "def delete(path, params = {})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "6db2c290b32a370affc3cfadd69bb8e7", "score": "0.63334316", "text": "def destroy\n if @api_v1_person.destroy\n render json: 'deletado'\n end\n \n end", "title": "" }, { "docid": "5b22920d931949e6c08fc758420043b8", "score": "0.63312435", "text": "def destroy\n @dust_bath.destroy\n respond_to do |format|\n format.html { redirect_to dust_baths_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6daf0c097600d41bbb023b69f2d9d012", "score": "0.6327305", "text": "def destroy\n @digestive.destroy\n respond_to do |format|\n format.html { redirect_to digestives_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "706dba35f4cde5cfb4e8d673b9b0d8e7", "score": "0.6325927", "text": "def del\n del_plan params[:tape_merge]\n redirect_to '/plans?history=-1'\n end", "title": "" }, { "docid": "6d23fae51f1913672553af1d4d555ad6", "score": "0.6325211", "text": "def destroy\n @path.destroy\n respond_to do |format|\n format.html { redirect_to paths_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d23fae51f1913672553af1d4d555ad6", "score": "0.6325211", "text": "def destroy\n @path.destroy\n respond_to do |format|\n format.html { redirect_to paths_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "068860d255a6d73f4eaed381d50f61fb", "score": "0.63236475", "text": "def destroy\n @pasar = Pasar.find(params[:id])\n @pasar.destroy\n\n respond_to do |format|\n format.html { redirect_to pasars_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c30bfb0cbaeef1e039d9b832deabe0bf", "score": "0.6322142", "text": "def destroy\n authorize! :destroy, @water_fountain\n @water_fountain.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f90c473244f50c35b80cdd09b10e45b", "score": "0.63213664", "text": "def destroy\n @dzial.destroy\n respond_to do |format|\n format.html { redirect_to dzials_url, notice: 'Dział został usunięty.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "81ccda4b6d243781371531722b4f5b48", "score": "0.6321118", "text": "def destroy\n @permit.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9ce52ea3ca38bcdbf0d46fb6a877ce93", "score": "0.63192356", "text": "def destroy\n @hypocrite = Hypocrite.find(params[:id])\n @hypocrite.destroy\n\n respond_to do |format|\n format.html { redirect_to hypocrites_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "83824714428182d740d3c2e5a6691f7d", "score": "0.6316107", "text": "def destroy\n @policial = Policial.find(params[:id])\n @policial.destroy\n\n respond_to do |format|\n format.html { redirect_to policials_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "81d10c0b231a7d39637a8e0823196f88", "score": "0.6313847", "text": "def destroy\n @walk.destroy\n respond_to do |format|\n format.html { redirect_to walks_url, notice: 'Walk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "57b799133d29316426c358002043baa2", "score": "0.63123", "text": "def delete_rest(path, headers={}) \n run_request(:DELETE, create_url(path), headers) \n end", "title": "" }, { "docid": "13ae14ba45d4a21ffd492d500ef1a447", "score": "0.631066", "text": "def destroy\n @walk.destroy\n respond_to do |format|\n format.html { redirect_to walks_url, notice: \"Walk was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e49a73f4f3dbdfebd3a14ac64e54de8e", "score": "0.6306756", "text": "def destroy\n @json_datum.destroy\n respond_to do |format|\n format.html { redirect_to json_data_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "887432e4b57a71666f432ad34958877c", "score": "0.6304768", "text": "def destroy\n @solicitud = Solicitud.find(params[:id])\n @solicitud.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bacb7d80e0d5a1966e8da1d64f74e14a", "score": "0.63025725", "text": "def destroy\n @tryal = Tryal.find(params[:id])\n @tryal.destroy\n\n respond_to do |format|\n format.html { redirect_to tryals_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "86790a2414f9537214c4a7386f2b291f", "score": "0.6302056", "text": "def destroy\n if current_user.is_admin?\n @patner = Patner.find(params[1])\n @patner.destroy\n\n respond_to do |format|\n format.html { redirect_to patners_url }\n format.json { head :no_content }\n end\n else\n raise ActionController::RoutingError.new('Not Found')\n end\n end", "title": "" }, { "docid": "19c2ee4c7a6ca658a056af2fa63e95f8", "score": "0.63003397", "text": "def delete\n Polygon.find(params[:id]).vertices.destroy_all\n\n Polygon.find(params[:id]).destroy\n redirect_to :back\n end", "title": "" }, { "docid": "488f46974b1226289163b7202161c953", "score": "0.6299644", "text": "def destroy\n if not check_logged_in then\n return\n end\n @personal_plant = PersonalPlant.find(params[:id])\n @personal_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_plants_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3da92ce397b3cb2144927030c5364f04", "score": "0.6297457", "text": "def delete(path, params: {}, body: {})\n request(:delete, path, params: params, body: body)\n end", "title": "" }, { "docid": "6c537b3a0008ef6459c518123cbcc9d5", "score": "0.6296476", "text": "def delete(path, params = {})\n request :delete, path, params\n end", "title": "" }, { "docid": "a0977883af26eeeaccdf29b191c1f782", "score": "0.6295112", "text": "def destroy\n @diet = Diet.find(params[:id])\n @diet.destroy\n\n respond_to do |format|\n format.html { redirect_to current_user}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "221858579afa4f11746f587f4bfaf259", "score": "0.6294266", "text": "def delete\n\n thePlayer = Player.find(@player_id)\n render :json => thePlayer.destroy, :except => [:password_digest]\n\n end", "title": "" }, { "docid": "2802be9a09af1633319f82c5c41f146a", "score": "0.6293002", "text": "def destroy\n @match1 = Match1.find(params[:id])\n @match1.destroy\n\n respond_to do |format|\n format.html { redirect_to match1s_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9c8ef0b4313fef9d26c4290371bc530d", "score": "0.629165", "text": "def delete!\n client.delete(:path => base_path)\n nil\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.62897474", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.62897474", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.62897474", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" }, { "docid": "b2834e6124c920737809b7669107f8b2", "score": "0.62897474", "text": "def delete(path, params={})\n request(:delete, path, params)\n end", "title": "" } ]
09ff78a5fa8001aa2bc82d81002c1093
Create a node with the given path. The node data will be the given data, and node acl will be the given acl. The path is returned. The ephemeral argument specifies whether the created node will be ephemeral or not. An ephemeral node will be removed by the ZooKeeper automatically when the session associated with the creation of the node expires. The sequence argument can also specify to create a sequential node. The actual path name of a sequential node will be the given path plus a suffix "_i" where i is the current sequential number of the node. Once such a node is created, the sequential number will be incremented by one. If a node with the same actual path already exists in the ZooKeeper, a KeeperException with error code KeeperException::NodeExists will be thrown. Note that since a different actual path is used for each invocation of creating sequential node with the same path argument, the call will never throw a NodeExists KeeperException. If the parent node does not exist in the ZooKeeper, a KeeperException with error code KeeperException::NoNode will be thrown. An ephemeral node cannot have children. If the parent node of the given path is ephemeral, a KeeperException with error code KeeperException::NoChildrenForEphemerals will be thrown. This operation, if successful, will trigger all the watches left on the node of the given path by exists and get API calls, and the watches left on the parent node by children API calls. If a node is created successfully, the ZooKeeper server will trigger the watches on the path left by exists calls, and the watches on the parent of the node by children calls. Called with a hash of arguments set. Supports being executed asynchronousy by passing a callback object. ==== Arguments :path path of the node :data initial data for the node :acl defaults to ACL::OPEN_ACL_UNSAFE, otherwise the ACL for the node :ephemeral defaults to false, if set to true the created node will be ephemeral :sequence defaults to false, if set to true the created node will be sequential :callback provide a AsyncCallback::StringCallback object or Proc for an asynchronous call to occur :context context object passed into callback method ==== Examples ===== create node, ACL will default to ACL::OPEN_ACL_UNSAFE zk.create(:path => "/path", :data => "foo") => "/path" ===== create ephemeral node zk.create(:path => "/path", :data => "foo", :ephemeral => true) => "/path" ===== create sequential node zk.create(:path => "/path", :data => "foo", :sequence => true) => "/path0" ===== create ephemeral and sequential node zk.create(:path => "/path", :data => "foo", :ephemeral => true, :sequence => true) => "/path0" ===== create a child path zk.create(:path => "/path/child", :data => "bar") => "/path/child" ===== create a sequential child path zk.create(:path => "/path/child", :data => "bar", :sequence => true) => "/path/child0" ===== create asynchronously with callback object class StringCallback def process_result(return_code, path, context, name) do processing here end end callback = StringCallback.new context = Object.new zk.create(:path => "/path", :data => "foo", :callback => callback, :context => context) ===== create asynchronously with callback proc callback = proc do |return_code, path, context, name| do processing here end context = Object.new zk.create(:path => "/path", :data => "foo", :callback => callback, :context => context)
[ { "docid": "bc35820227ad8ee86540ba4bf83f3bfa", "score": "0.6525626", "text": "def create(args)\n path = args[:path]\n data = args[:data]\n acl = args[:acl] || ZooKeeper::ACL::OPEN_ACL_UNSAFE\n flags = 0\n flags |= ZooDefs::CreateFlags::EPHEMERAL if args[:ephemeral]\n flags |= ZooDefs::CreateFlags::SEQUENCE if args[:sequence]\n callback = args[:callback]\n context = args[:context]\n \n if callback\n callback.extend Zk::AsyncCallback::StringCallback unless callback.is_a?(Proc) || callback.respond_to?(:processResult)\n super(path, data.to_java_bytes, acl.collect {|acl| Zk::ACL.to_java(acl)}, flags, callback, context)\n else\n super(path, data.to_java_bytes, acl.collect {|acl| Zk::ACL.to_java(acl)}, flags)\n end\n rescue Exception => e\n raise KeeperException.by_code(e.code)\n end", "title": "" } ]
[ { "docid": "a6311cfe3262924944dc1fcd96668839", "score": "0.65457755", "text": "def create(path)\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end", "title": "" }, { "docid": "8ec1d06a28590d06e7c1c52e52e0b7b4", "score": "0.6409369", "text": "def create(path, data='', opts={})\n h = { :path => path, :data => data, :ephemeral => false, :sequence => false }.merge(opts)\n\n if mode = h.delete(:mode)\n mode = mode.to_sym\n\n case mode\n when :ephemeral_sequential\n h[:ephemeral] = h[:sequence] = true\n when :persistent_sequential\n h[:ephemeral] = false\n h[:sequence] = true\n when :persistent\n h[:ephemeral] = false\n when :ephemeral\n h[:ephemeral] = true\n else\n raise ArgumentError, \"Unknown mode: #{mode.inspect}\"\n end\n end\n\n rv = check_rc(@cnx.create(h), h)\n\n h[:callback] ? rv : rv[:path]\n end", "title": "" }, { "docid": "3a130b0cf64c83121b0c27e585c1bf78", "score": "0.64043266", "text": "def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end", "title": "" }, { "docid": "5e83ed082a77e1f41f61a9653994a6a8", "score": "0.6399463", "text": "def create(path)\n log.debug \"synapse: creating ZK path: #{path}\"\n # recurse if the parent node does not exist\n create File.dirname(path) unless @zk.exists? File.dirname(path)\n @zk.create(path, ignore: :node_exists)\n end", "title": "" }, { "docid": "10c50c2ab808bd995bce403d191c217b", "score": "0.61581016", "text": "def create_path\n unless @zk.exists?(@znode)\n @zk.create(@znode, encode(current_nodes))\n logger.info(\"Created ZooKeeper node #{@znode}\")\n end\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "8e7cfd549f52d108922dbf17cb27dd80", "score": "0.60873", "text": "def create_path\n @zk.create(ZNODE_PATH)\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "b8a8881b0fcc080cef0cd1ffa201660f", "score": "0.583238", "text": "def create_path(full_path, value=nil)\n paths = full_path.split('/')\n # Don't create the child node yet\n paths.pop\n paths.shift\n path = ''\n paths.each do |p|\n path << \"/#{p}\"\n # Ignore errors since it may already exist\n @zookeeper.create(:path => path)\n end\n if value\n @zookeeper.create(:path => full_path, :data => value, :ephemeral => @ephemeral)\n else\n @zookeeper.create(:path => full_path)\n end\n end", "title": "" }, { "docid": "52fca2ee19f79e5e16a68e057df4580f", "score": "0.5745758", "text": "def create_path\n @zk.create(self.class.path(@root_znode))\n rescue ZK::Exceptions::NodeExists\n # best effort\n end", "title": "" }, { "docid": "b72be2fb627449634bc57fd99a6299fe", "score": "0.53076833", "text": "def mkdir(path)\n @nodes[path] ||= Node.new(path, @index, nodes: {})\n end", "title": "" }, { "docid": "76ea9c62b02647034d8d0c8dc243912a", "score": "0.52969646", "text": "def safe_create(path)\n path_elements = path.split(\"/\").reject{ |x| x==\"\" }\n \n all = []\n while(!path_elements.empty?)\n all << path_elements\n path_elements = path_elements[0..-2]\n end\n\n all.reverse.each do |path_elements|\n path = \"/\" + path_elements.join(\"/\")\n zk.create(:path => path) unless exists?(path)\n end\n end", "title": "" }, { "docid": "498d423a246c470a3a874a43ff641c4e", "score": "0.5253243", "text": "def create(path)\n raise ContainerError, \"Container already exists.\" if exists?\n\n if path.is_a?(Hash)\n args = \"-n #{name}\"\n\n if !!path[:config_file]\n unless File.exists?(path[:config_file])\n raise ArgumentError, \"File #{path[:config_file]} does not exist.\"\n end\n args += \" -f #{path[:config_file]}\"\n end\n\n if !!path[:template]\n template_dir = path[:template_dir] || \"/usr/lib/lxc/templates\"\n template_path = File.join(template_dir,\"lxc-#{path[:template]}\")\n unless File.exists?(template_path)\n raise ArgumentError, \"Template #{path[:template]} does not exist.\"\n end\n args += \" -t #{path[:template]} \"\n end\n\n args += \" -B #{path[:backingstore]}\" if !!path[:backingstore]\n args += \" -- #{path[:template_options].join(\" \")}\".strip if !!path[:template_options]\n\n LXC.run(\"create\", args)\n exists?\n else\n unless File.exists?(path)\n raise ArgumentError, \"File #{path} does not exist.\"\n end\n\n LXC.run(\"create\", \"-n\", name, \"-f\", path)\n exists?\n end\n end", "title": "" }, { "docid": "3574203c312b308a48d537b8a30a3d49", "score": "0.5241095", "text": "def create(path)\n f = new path\n f.touch\n f\n end", "title": "" }, { "docid": "645ae3adafc4f38ebecb8514f7cf02df", "score": "0.52230847", "text": "def mkdir!(path, attrs = T.unsafe(nil), &callback); end", "title": "" }, { "docid": "8eb2cd008942ce9b4f920fcbdbf39861", "score": "0.5176158", "text": "def parse_create_args(path, *args)\n opts = args.extract_options!\n\n # be somewhat strict about how many arguments we accept.\n if args.length > 1\n raise ArgumentError, \"create takes path, an optional data argument, and options, you passed: (#{path}, *#{args})\"\n end\n\n # argh, terrible documentation bug, allow for :sequential, analagous to :sequence\n if opts.has_key?(:sequential)\n if opts.has_key?(:sequence)\n raise ArgumentError, \"Only one of :sequential or :sequence options can be given, opts: #{opts}\"\n end\n\n opts[:sequence] = opts.delete(:sequential)\n end\n\n data = args.first || ''\n\n rval = { :path => path, :data => data, :ephemeral => false, :sequence => false }.merge(opts)\n\n if mode = rval.delete(:mode)\n mode = mode.to_sym\n\n case mode\n when :ephemeral_sequential\n rval[:ephemeral] = rval[:sequence] = true\n when :persistent_sequential\n rval[:ephemeral] = false\n rval[:sequence] = true\n when :persistent\n rval[:ephemeral] = false\n when :ephemeral\n rval[:ephemeral] = true\n else\n raise ArgumentError, \"Unknown mode: #{mode.inspect}\"\n end\n end\n\n rval\n end", "title": "" }, { "docid": "876ee8877c3833dc24ca4deda8364e13", "score": "0.51551366", "text": "def mkdir(path,options = {})\n make_node(path).init_dir(options)\n end", "title": "" }, { "docid": "aa4c3680aa00029123d0b66f5a56c70b", "score": "0.5153698", "text": "def create path, mode = 'rw', perm = 0644\n prefix = File.dirname(path)\n target = File.basename(path)\n\n with_fid do |prefix_fid|\n walk_fid prefix_fid, prefix\n\n # create the file\n talk Tcreate.new(\n :fid => prefix_fid,\n :name => target,\n :perm => perm,\n :mode => MODES.parse(mode)\n )\n end\n end", "title": "" }, { "docid": "3441d6f708da558d68678e22c6a359fe", "score": "0.5136902", "text": "def create(_path, **_opts)\n raise 'not implemented'\n end", "title": "" }, { "docid": "2e644845890311e4d1071749509f60de", "score": "0.4979399", "text": "def process(path, metadata)\n existing_node = @root.child_at_path(path)\n if existing_node.present?\n return process_existing_node(existing_node, metadata)\n end\n\n # If the new entry includes parent folders that don't yet exist in your local state, \n # create those parent folders in your local state.\n parent = @root.mkdir_p(parent_path_for(path))\n\n Node.create!({\n dropbox_id: user.id,\n name: path_to_name(path),\n dropbox_path: path,\n size: metadata['bytes'],\n filetype: metadata['mime_type'],\n parent: parent\n })\n end", "title": "" }, { "docid": "ef2b246b69e4052f04680a7f363d480b", "score": "0.49620205", "text": "def create(path, name, data, *options)\n raise \"create not implemented by class #{self.class}\"\n end", "title": "" }, { "docid": "5df4e00d918aac786d7003b05747d6b6", "score": "0.49394098", "text": "def create(path)\n @connection.create(path)\n end", "title": "" }, { "docid": "8cf832ceea3a4eebb138c8a0d7ac6900", "score": "0.49224153", "text": "def create!\n Dir.mkdir(path)\n end", "title": "" }, { "docid": "22e3337c688aee3edcb5bf0d6c05f87b", "score": "0.49127275", "text": "def create\n FileUtils.mkdir path unless exist?\n end", "title": "" }, { "docid": "5a86e3ad8a072c266ae4f9438d09eb91", "score": "0.49029493", "text": "def create_node (args = {})\n Node.create(node_id: self.id, value: args[:value], tree_id: nil)\n end", "title": "" }, { "docid": "f1f974ff7fd0248a7eff13a1cc9976c5", "score": "0.48772058", "text": "def create\n FileUtils.mkdir_p @path\n end", "title": "" }, { "docid": "fd2a523706b010e896e2490150b147fd", "score": "0.48709303", "text": "def mkdir(path)\n @mkdir_proc.call(path) unless @mkdir_proc.nil?\n end", "title": "" }, { "docid": "c480ff34050fa3dbffbf8e7c362d359a", "score": "0.48595962", "text": "def create_lock_path!(prefix='lock')\n @mutex.synchronize do\n unless lock_path_exists?\n @lock_path = @zk.create(\"#{root_lock_path}/#{prefix}\", :mode => :ephemeral_sequential)\n @parent_stat = @zk.stat(root_lock_path)\n end\n end\n\n logger.debug { \"got lock path #{@lock_path}\" }\n @lock_path\n rescue NoNode\n create_root_path!\n retry\n end", "title": "" }, { "docid": "6ee74405fa09efdcf968dbd26727e613", "score": "0.4856066", "text": "def zk_path_exists?(path, create_if_not_exist = false)\n return true if path.empty?\n \n \n if @zk.get(path: path)[:stat].exists?\n @zk_validated_paths << path \n return true\n end\n return false unless create_if_not_exist\n\n p = path.split('/')[0 ... -1].join('/')\n zk_path_exists?(p, true)\n @zk.create(path: path)\n @zk_validated_paths << path\n true\n end", "title": "" }, { "docid": "e679d37dfe47636e0f713d9f76c76bdf", "score": "0.48503137", "text": "def mkdir(path, &block)\n replicate(block, :command => \"mkdir\", :path => path)\n end", "title": "" }, { "docid": "fe2d97f7610b9c5d38966b65c11c5b35", "score": "0.48477742", "text": "def mkdir(path)\n dir_path = fs_path(path)\n if (File.exist? dir_path) \n if (! File.directory? dir_path)\n raise Tree::NodeConflict.new(\"#{path} exists as a file\")\n end\n # nothing to do -- an existing directory is fine\n else\n FileUtils.mkdir_p(dir_path)\n end\n end", "title": "" }, { "docid": "80ead4783a242d7f02b6a3e2689103e9", "score": "0.48370436", "text": "def mkdir(path, attrs); end", "title": "" }, { "docid": "53b38a949cce4a1540e398d9463ca2d7", "score": "0.48228678", "text": "def create_nodes(path, blocks)\n if MANDATORY_INFOS.any? {|t| path.meta_info[t].nil?}\n raise Webgen::NodeCreationError.new(\"At least one of #{MANDATORY_INFOS.join('/')} is missing\",\n \"path_handler.tipue_search\", path)\n end\n\n if @website.config['website.base_url'].empty?\n raise Webgen::NodeCreationError.new(\"The configuration option 'website.base_url' needs to be set\",\n \"path_handler.tipue_search\", path)\n end\n\n path.ext = 'js'\n path['node_class'] = Node.to_s\n path['write_order'] = 'z'\n create_node(path) do |node|\n set_blocks(node, blocks)\n node.node_info[:entries] = {:flatten => true, :and => node['entries']}\n @website.ext.item_tracker.add(node, :nodes, :node_finder_option_set,\n {:opts => node.node_info[:entries], :ref_alcn => node.alcn}, :content)\n end\n end", "title": "" }, { "docid": "52eb0e80669614bcfd7f05c331ef3284", "score": "0.48118415", "text": "def mkdir(path)\n succeeds(\"mkdir \\\"#{path}\\\"\")\n self\n end", "title": "" }, { "docid": "edf8ce23c5eb9411104387d5e33bce90", "score": "0.48102826", "text": "def mkdir_p(path)\n succeeds(\"mkdir -p \\\"#{path}\\\"\")\n self\n end", "title": "" }, { "docid": "b18061ffccc9f7499b283ba4be154678", "score": "0.4809774", "text": "def create(\n node,\n deadline: nil\n )\n req = V1::NodeCreateRequest.new()\n\n req.node = Plumbing::convert_node_to_plumbing(node)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"Nodes.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = NodeCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.node = Plumbing::convert_node_to_porcelain(plumbing_response.node)\n resp.token = (plumbing_response.token)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp\n end", "title": "" }, { "docid": "6c5adf97a451b5e4f83785a46618aaa1", "score": "0.4806128", "text": "def mkdir_p(path)\n path.mkpath\n end", "title": "" }, { "docid": "816e24fa49a7a003e340fac863d2080d", "score": "0.48049924", "text": "def create!\n FileUtils.mkdir_p path unless exist?\n end", "title": "" }, { "docid": "55c89a7084ccd244e20ed3ac8fb130c6", "score": "0.47800934", "text": "def create!\n FileUtils.mkdir(self.path)\n self.nodes.each {|node| node.create! }\n end", "title": "" }, { "docid": "2b4fa4a5843f3ae391145a433b6ef2aa", "score": "0.47707677", "text": "def create(node, destroy = false)\n pos = PositionFactory.new(node)\n\n case\n when destroy\n Destroy.new(node, pos.previous)\n when node.record.new_record?\n Create.new(node, pos.current)\n else\n create_from_transition(node, pos.transition)\n end\n end", "title": "" }, { "docid": "1fbc0d3abea8f27d7e7ef40eedef6544", "score": "0.47700676", "text": "def create\n FileUtils.mkdir_p path\n end", "title": "" }, { "docid": "1dec02f81d0459e491236fe007fd6848", "score": "0.47524256", "text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end", "title": "" }, { "docid": "1dec02f81d0459e491236fe007fd6848", "score": "0.47524256", "text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end", "title": "" }, { "docid": "1dec02f81d0459e491236fe007fd6848", "score": "0.47524256", "text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end", "title": "" }, { "docid": "92f7c1c0f38491a7a082a8cde7fe3f07", "score": "0.47084245", "text": "def create(node)\n reqs = required_positional_params(node.instance_method(:initialize))\n keyreqs = required_keyword_params(node.instance_method(:initialize))\n if keyreqs.empty?\n node.new(*reqs)\n else\n node.new(*reqs, **keyreqs)\n end\n end", "title": "" }, { "docid": "97cbdc8400bfa3d67a42e45175227510", "score": "0.4707283", "text": "def mkdir(path)\n return if Dir.exist?(path)\n shellout!(\"mkdir -p #{path}\")\n end", "title": "" }, { "docid": "04d1f0062c060fc54968b5b635386742", "score": "0.4699564", "text": "def mkdir(path)\n raise ReadOnlyError unless writeable?\n realpath = (path.end_with?(\"/\") ? path.chop : path)\n response, data = Net::HTTP.start(@server_url.host, @server_url.port) do |http|\n http.post(build_path_url(realpath) + \"?t=mkdir\", nil)\n end\n raise ArgumentError.new(\"Directory exists\") if response.code == \"400\"\n Object.new @server_url, data\n end", "title": "" }, { "docid": "f1582cd2046944d960ce4f76fd4d1fdc", "score": "0.4690012", "text": "def create_node\n @neo.createNode\n end", "title": "" }, { "docid": "fabb0bc9a4582c4859f89422fb86bb29", "score": "0.46845883", "text": "def mkdir(path)\n \n end", "title": "" }, { "docid": "e34da1187fee8fab9002df0b62ce0164", "score": "0.46771005", "text": "def node_definition(node, path, cookbook_path)\n box = node[1]['box'].to_s\n node_params = make_node_params(node, @boxes.get_box(box))\n @configuration_generator.generate_node_info(node, node_params, @registry).and_then do |info|\n @configuration_generator.create_role_files(path, info[:node_params][:name], info[:role_file_content])\n if box_valid?(info[:box])\n Result.ok(generate_node_defenition(info[:node_params], cookbook_path, path))\n else\n @ui.warning(\"Box #{box} is not installed or configured ->SKIPPING\")\n Result.ok('')\n end\n end\n end", "title": "" }, { "docid": "7a51bed43e41003584d5dd5bde1a8f35", "score": "0.46658295", "text": "def create_dir path\n path = with_root path\n ::Dir.mkdir path\n end", "title": "" }, { "docid": "68b42079bf77f59870673afa2efb3455", "score": "0.46347636", "text": "def get_recursive(full_path, watch=false, create_path=true, &block)\n watch_proc = watcher if watch\n\n # Get value for this node\n result = @zookeeper.get(:path => full_path, :watcher => watch_proc)\n\n # Create the path if it does not exist\n if create_path && (result[:rc] == ::Zookeeper::ZNONODE)\n create_path(full_path)\n result = @zookeeper.get(:path => full_path, :watcher => watch_proc)\n end\n\n # Cannot find this node\n return 0 if result[:rc] == ::Zookeeper::ZNONODE\n\n check_rc(result)\n value = @deserializer.deserialize(result[:data])\n stat = result[:stat]\n\n # ZooKeeper assigns a nil value to all parent nodes when no value is supplied\n # Call block if this is a leaf node, or if it is a parent node with a value\n if block && ((stat.num_children == 0) || value != nil)\n block.call(relative_key(full_path), value, stat.version, stat.num_children)\n end\n\n # Iterate over children if any\n node_count = 1\n # Ephemeral nodes cannot have children\n if !(stat.ephemeral_owner && (stat.ephemeral_owner != 0)) && (watch || (stat.num_children > 0))\n # Also watch this node for child changes\n result = @zookeeper.get_children(:path => full_path, :watcher => watch_proc)\n\n # This node could have been deleted already\n if result[:rc] == ::Zookeeper::ZOK\n children = result[:children]\n\n # Save the current list of children so that we can figure out what\n # a child changed event actually means\n @children[full_path] = children if watch\n\n # Also watch children nodes\n children.each do |child|\n node_count += get_recursive(File.join(full_path,child), watch, &block)\n end\n end\n end\n node_count\n end", "title": "" }, { "docid": "8cc14a6754740f9fa5b104995c52e475", "score": "0.4609376", "text": "def create(path, name, data, *options)\n if use_memory_store?(path)\n @memory_store.create(path, name, data, *options)\n\n elsif path[0] == \"cookbooks\" && path.length == 2\n # Do nothing. The entry gets created when the cookbook is created.\n\n # /policy_groups/GROUP/policies/NAME\n elsif path[0] == \"policy_groups\" && path[2] == \"policies\"\n # Just set or create the proper entry in the hash\n update_json(to_chef_fs_path(path[0..1]), {}, *options) do |group|\n if policies.key?(path[3])\n raise ChefZero::DataStore::DataAlreadyExistsError.new(path, group)\n end\n\n group[\"policies\"] ||= {}\n group[\"policies\"][path[3]] = { \"revision_id\" => Chef::JSONCompat.parse(data) }\n group\n end\n\n # create [/organizations/ORG]/users/NAME (with content '{}')\n # Manipulate the `members.json` file that contains a list of all users\n elsif is_org? && path == [ \"users\" ]\n update_json(\"members.json\", [], *options) do |members|\n # Format of each entry: { \"user\": { \"username\": \"jkeiser\" } }\n if members.any? { |member| member[\"user\"][\"username\"] == name }\n raise ChefZero::DataStore::DataAlreadyExistsError.new(path, entry)\n end\n\n # Actually add the user\n members << { \"user\" => { \"username\" => name } }\n end\n\n # create [/organizations/ORG]/association_requests/NAME (with content '{}')\n # Manipulate the `invitations.json` file that contains a list of all users\n elsif is_org? && path == [ \"association_requests\" ]\n update_json(\"invitations.json\", [], *options) do |invitations|\n # Format of each entry: { \"id\" => \"jkeiser-chef\", 'username' => 'jkeiser' }\n if invitations.any? { |member| member[\"username\"] == name }\n raise ChefZero::DataStore::DataAlreadyExistsError.new(path)\n end\n\n # Actually add the user (TODO insert org name??)\n invitations << { \"username\" => name }\n end\n\n else\n unless data.is_a?(String)\n raise \"set only works with strings\"\n end\n\n with_parent_dir(path + [name], *options) do |parent, name|\n\n parent.create_child(name, data)\n rescue Chef::ChefFS::FileSystem::AlreadyExistsError => e\n raise ChefZero::DataStore::DataAlreadyExistsError.new(to_zero_path(e.entry), e)\n\n end\n end\n end", "title": "" }, { "docid": "430a1a0fe3e124d18bd8ff7aa11d2ec6", "score": "0.46089992", "text": "def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end", "title": "" }, { "docid": "5e10b930cdbf607454e4dca727c3e711", "score": "0.46036232", "text": "def mkdir(path, queue=false)\n execute('mkdir' , clean_path(path), queue)[0]\n end", "title": "" }, { "docid": "e28753e3d47c344742f928079746e1ff", "score": "0.4593327", "text": "def create!(path)\n be = new(path)\n be.save!\n\n be\n end", "title": "" }, { "docid": "5d9c1d5ace23de050f44827569a2335e", "score": "0.45894986", "text": "def create_dir path\n ::Dir.mkdir path\n end", "title": "" }, { "docid": "dbad312aeb5832b8249ae7bd4f95b8ee", "score": "0.45841345", "text": "def mkdir_p(path)\n Pathname.new(path).dirname.mkpath\n end", "title": "" }, { "docid": "4662dfe005545cea122db3bde2fb0550", "score": "0.4579832", "text": "def create_node(node, tag=nil)\n node.options[:chef_provisioner] = node.try_opt(:type)\n disk_config = node.try_opt(:rackspace_disk_config) || \"AUTO\"\n instance_info = @rackspace.servers.create(\n :flavor_id => node.try_opt(:rackspace_flavor_id),\n :image_id => node.try_opt(:rackspace_image_id),\n :name => node.name,\n :disk_config => disk_config)\n Souffle::Log.info \"#{node.name} Instance ID #{instance_info.id}\"\n node.options[:rackspace_instance_id] = instance_info.id\n node.options[:node_password] = instance_info.password\n node.options[:node_name] = [node.name, node.domain].compact.join('.')\n wait_until_node_running(node) { node.provisioner.created }\n end", "title": "" }, { "docid": "52d40ce96f7097fdddce43fe421038a6", "score": "0.45650345", "text": "def find_or_create_by_path(path, attributes = {})\n subpath = _ct.build_ancestry_attr_path(path, attributes)\n return self if subpath.empty?\n\n found = find_by_path(subpath, attributes)\n return found if found\n\n attrs = subpath.shift\n _ct.with_advisory_lock do\n # shenanigans because children.create is bound to the superclass\n # (in the case of polymorphism):\n child = self.children.where(attrs).first || begin\n # Support STI creation by using base_class:\n _ct.create(self.class, attrs).tap do |ea|\n # We know that there isn't a cycle, because we just created it, and\n # cycle detection is expensive when the node is deep.\n ea._ct_skip_cycle_detection!\n self.children << ea\n end\n end\n child.find_or_create_by_path(subpath, attributes)\n end\n end", "title": "" }, { "docid": "b6a255eb5445b5b8c223250e42768999", "score": "0.45629478", "text": "def ensure_path(path)\n FileUtils.mkdir_p path\n end", "title": "" }, { "docid": "3013c5cc224561e18d31a1186ff0a58f", "score": "0.45605198", "text": "def create(path, opts={}, &block)\n path = full_path(path)\n opts = opts.merge(\n bucket: name,\n key: path,\n )\n opts[:acl] ||= @acl if @acl\n opts[:server_side_encryption] ||= @sse if @sse\n opts[:storage_class] ||= @storage_class if @storage_class\n\n temp = BFS::TempWriter.new(path, opts) do |t|\n File.open(t, binmode: true) do |file|\n @client.put_object(opts.merge(body: file))\n end\n end\n return temp unless block\n\n begin\n yield temp\n ensure\n temp.close\n end\n end", "title": "" }, { "docid": "93c27121c2d09ad6ec7df841aab282ac", "score": "0.45588148", "text": "def mkdir(path)\n create_folder(path)\n end", "title": "" }, { "docid": "707443bb02a2dacd4cc17c834bc71ff9", "score": "0.4558387", "text": "def path_exists?(path, create_if_not_exist = false)\n return true if path.empty?\n\n\n # if @zk.get(path: path)[:stat].exists?\n # @zk_validated_paths << path\n # return true\n # end\n # return false unless create_if_not_exist\n#\n # p = path.split('/')[0 ... -1].join('/')\n # zk_path_exists?(p, true)\n # @zk.create(path: path)\n # @zk_validated_paths << path\n # true\n end", "title": "" }, { "docid": "3fd9bbd4b7d7189245845168b6f4cf78", "score": "0.455616", "text": "def create(options = {})\n options[:name] ||= SecureRandom.hex\n\n create_options = { p: port }\n create_options[:c] = options[:name] if options[:name]\n create_options[:n] = options[:config_name] if options[:config_name]\n create_options[:d] = options[:dir] if options[:dir]\n\n Retriable.retriable do\n raise \"Not started yet\" unless started?\n end\n\n # short-circuit if we're using persisted data with an existing core/collection\n return if options[:persist] && create_options[:c] && client.exists?(create_options[:c])\n\n exec(\"create\", create_options)\n\n options[:name]\n end", "title": "" }, { "docid": "bd8f7ad769dd51df1c0522cefd3410ee", "score": "0.45534593", "text": "def create_node(props = {}) # :nodoc:\n node = instance.createNode\n props.each_pair{|k,v| node[k] = v}\n node\n end", "title": "" }, { "docid": "ca31f65acd305ac456e24f5940c569bc", "score": "0.45476398", "text": "def create_path(path)\n directory = File.dirname(path)\n FileUtils.mkdir_p directory unless Dir.exist?(directory)\n end", "title": "" }, { "docid": "d7dc45c3c6f4b72bddd85a1beddbda10", "score": "0.4547516", "text": "def create_file path\n dir = File.dirname path\n FileUtils.mkdir_p dir\n FileUtils.touch path\n end", "title": "" }, { "docid": "7e93b6b7547a3a2296f2349af2397f0f", "score": "0.45454448", "text": "def mkdir_p(path, mode = 0o600)\n super(path, mode)\n end", "title": "" }, { "docid": "1c208b77d9c33ae1c4a65eef94a3227d", "score": "0.45411152", "text": "def create_node(name:, client: ec2, **config)\n resp = Smash::CloudPowers::Node::Instance.create!(name: name, client: ec2, **config)\n i_var_name = \"#{name}_node\"\n instance_attr_accessor i_var_name\n instance_variable_set(to_i_var(i_var_name), resp)\n end", "title": "" }, { "docid": "74814793019c6d4fef81b66ab0030b2c", "score": "0.45408347", "text": "def mkdir(path, chmod: nil)\n if chmod\n run \"mkdir -p #{path} && chmod #{chmod} #{path}\"\n else\n run \"mkdir -p #{path}\"\n end\n end", "title": "" }, { "docid": "ba868c82f5345f9ee23734865882e5fe", "score": "0.45354128", "text": "def create(path, opts={}, &block)\n full = @root.join(norm_path(path))\n FileUtils.mkdir_p(full.dirname.to_s)\n\n temp = BFS::TempWriter.new(full, opts) {|t| FileUtils.mv t, full.to_s }\n return temp unless block\n\n begin\n yield temp\n ensure\n temp.close\n end\n end", "title": "" }, { "docid": "4ca440a6a973d9e7cac904f07f499ebf", "score": "0.45246828", "text": "def mkdir(path, queue = false)\n execute('mkdir', clean_path(path), queue)[0]\n end", "title": "" }, { "docid": "d927712fc868be7cc7b08fe347013151", "score": "0.45201078", "text": "def folder_create(path)\n make_request(:create,\"#{folders_url(path)}.xml\")\n end", "title": "" }, { "docid": "c09740990c4e44bf0ef132cb802cda70", "score": "0.45133385", "text": "def create_node\n logger.info(\"create_node #{self.node}\")\n MiddleMan.worker(:xmpp_worker).async_xmpp_create_node(:arg=>self.node)\n self.node\n end", "title": "" }, { "docid": "ac095548d36ae0fcae6ade0465576955", "score": "0.45078215", "text": "def perform\n create_path\n node = @options.empty? ? ANY_SLAVE : \"#{@options[:host]}:#{@options[:port]}\"\n @zk.set(ZNODE_PATH, node)\n end", "title": "" }, { "docid": "8972f5b7cff10cca0d68289d137c414d", "score": "0.45071265", "text": "def p_createNodeAndChildren (db, node, primaryParentID, prefix)\n\tname = node.xpath('./Name').text\n\tpath = node.xpath('./Path').text\n\tanchor = node.xpath('./Anchor')\n\tif anchor != nil\n\t\tanchor = anchor.text\n\tend\n\t\n\tif OPTIONS[:debug]\n\t\tSTDERR.puts \"#{prefix} Processing #{name}\"\n\tend\n\t\n\t# integer - not sure what format it is\n\tchecksum = nil\n\tnodeID = nil # will reconnect later\n\tbaseurl = nil\n\tfilename = nil\n\t\n\tdb.execute(\"INSERT INTO ZNODEURL (Z_ENT, Z_OPT, ZCHECKSUM, ZNODE, ZANCHOR, ZBASEURL, ZFILENAME, ZPATH) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n\t\t9, 1, checksum, nodeID,\n\t\tanchor, baseurl, filename, path\n\t\t\n\t)\n\tnodeURLID = db.last_insert_row_id\n\t\n\tisSearchable = 1\n\tnodeType = 1\n\tkID = nil # no idea what it is : it tends to be really negative numbers\n\tsubNodeCount = 0 # we'll fix this later once we know the count\n\t\n\tdb.execute(\"INSERT INTO ZNODE (Z_ENT, Z_OPT, ZINSTALLDOMAIN, ZKDOCUMENTTYPE, ZKID, ZKISSEARCHABLE, ZKNODETYPE, ZKSUBNODECOUNT, ZPRIMARYPARENT, ZKNAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\",\n\t\t8, 2, 1, 0,\n\t\tkID, isSearchable, nodeType, subNodeCount,\n\t\tprimaryParentID, name\n\t)\n\tnodeID = db.last_insert_row_id\n\t\n\t# update nodeURL\n\tdb.execute(\"UPDATE ZNODEURL SET ZNODE=? WHERE Z_PK=?\", nodeID, nodeURLID)\n\t\n\t# handle children\n\tchildren = node.xpath('./Subnodes/Node')\n\tchildrenCount = children.count\n\tchildrenIndex = 0\n\t\n\tchildren.each do |subnode|\n\t\tchildrenIndex += 1\n\t\tsubNodeID = p_createNodeAndChildren(db, subnode, nodeID, prefix + \"[#{childrenIndex}/#{childrenCount}]\")\n\t\t\n\t\t# create the subnode link\n\t\t# ordering starts at 1\n\t\tdb.execute(\"INSERT INTO ZORDEREDSUBNODE (Z_ENT, Z_OPT, ZORDER, ZNODE, ZPARENT) VALUES (?, ?, ?, ?, ?)\",\n\t\t\t11, 1, subNodeCount+1, subNodeID, nodeID\n\t\t)\n\t\tsubNodeCount += 1\n\tend\n\t\n\t# update node with the final count\n\tdb.execute(\"UPDATE ZNODE SET ZKSUBNODECOUNT=? WHERE Z_PK=?\", subNodeCount, nodeID)\n\t\n\t# done\n\treturn nodeID\nend", "title": "" }, { "docid": "86df98dc5075757a1156deaea3c6e2d9", "score": "0.45069727", "text": "def mkdir(path, options={})\n via = options.delete(:via) || :run\n # XXX need to make sudo commands wrap the whole command (sh -c ?)\n # XXX removed the extra 'sudo' from after the '||' - need something else\n invoke_command \"test -d #{path} || #{sudo if via == :sudo} mkdir -p #{path}\"\n invoke_command \"chmod #{sprintf(\"%3o\",options[:mode] || 0755)} #{path}\", :via => via if options[:mode]\n invoke_command \"chown -R #{options[:owner]} #{path}\", :via => via if options[:owner]\n groupadd(options[:group], :via => via) if options[:group]\n invoke_command \"chgrp -R #{options[:group]} #{path}\", :via => via if options[:group]\n end", "title": "" }, { "docid": "0f67e5eecbd0818247d4dfcd44b2a88b", "score": "0.45012826", "text": "def create_node(position)\n # do not create if node is the finish\n return nil if position == @serial.index('F')\n\n @open_list << {\n position: position,\n parent: @node,\n distance: @node[:distance] + 1\n }\n end", "title": "" }, { "docid": "114352cd91824808564bc3b1fdfb0ad7", "score": "0.4499306", "text": "def mkdir(path);end", "title": "" }, { "docid": "114352cd91824808564bc3b1fdfb0ad7", "score": "0.4499306", "text": "def mkdir(path);end", "title": "" }, { "docid": "a14d92be3e1d31167e38b0bea4050b7a", "score": "0.44941637", "text": "def find_or_create_by_path(path, attributes = {})\n path = path.is_a?(Enumerable) ? path.dup : [path]\n node = self\n attrs = {}\n attrs[:type] = self.type if ct_subclass? && ct_has_type?\n path.each do |name|\n attrs[name_sym] = name\n child = node.children.where(attrs).first\n unless child\n child = self.class.new(attributes.merge(attrs))\n node.children << child\n end\n node = child\n end\n node\n end", "title": "" }, { "docid": "3c5cb17eb2764238b95eeac01d8b7347", "score": "0.44817132", "text": "def create_object_on_path( path, acl, metadata, data, mimetype, hash = nil)\n uri = URI::HTTP.build( {:host => @host, :port => @port,\n :path => build_resource( path ) } )\n\n headers = {}\n if( data == nil )\n data = \"\"\n end\n\n headers[\"content-length\"] = String(data.length())\n\n if( acl )\n process_acl( acl, headers )\n end\n\n if( metadata )\n process_metadata( metadata, headers )\n end\n\n if( hash )\n update_hash( hash, data, headers )\n end\n\n request = build_request( EsuRestApi::POST, uri, headers, mimetype )\n request.body = data\n\n response = @session.request( request )\n\n handle_error( response )\n\n return ID_EXTRACTOR.match( response[\"location\"] )[1].to_s\n end", "title": "" }, { "docid": "67e70e1434ea15c8441e472bfba37b1c", "score": "0.44755057", "text": "def create(path, metadata)\n resource = new(path, metadata)\n resource.create\n resource\n end", "title": "" }, { "docid": "4ffabb94a5ca3d9d6a62fefcd56a1d96", "score": "0.44741517", "text": "def create_node(name, data = {})\n load_data(:nodes, name, data)\n end", "title": "" }, { "docid": "ed1c0a8e72941bf196a4d441bb0e8798", "score": "0.4464648", "text": "def find_or_create_by_path(path, attributes = {})\n path = [path] unless path.is_a? Enumerable\n node = self\n attrs = {}\n attrs[:type] = self.type if ct_subclass? && ct_has_type?\n path.each do |name|\n attrs[name_sym] = name\n child = node.children.where(attrs).first\n unless child\n child = self.class.new(attributes.merge(attrs))\n node.children << child\n end\n node = child\n end\n node\n end", "title": "" }, { "docid": "b2efe464dc0b6eaa8e4a95652968c482", "score": "0.44617617", "text": "def create(*args)\n # since we don't care about the inputs, just glob args\n rc, new_path = czk.create(*args)\n [rc, strip_chroot_from(new_path)]\n end", "title": "" }, { "docid": "e3cf59f25d5c21891c0056b4ad409ab1", "score": "0.44601467", "text": "def create\n if exists?\n return false\n else\n # create folder if not existent\n unless File.directory?(File.dirname(path))\n FileUtils.mkdir_p(File.dirname(path))\n end\n File.write(path, \"\")\n return true\n end\n end", "title": "" }, { "docid": "e3dbf6ce35dbd5d12ce80b4a65b49342", "score": "0.4457427", "text": "def get_node(path, create = false)\n n = @root\n path.sub(/^\\//, \"\").split(\"/\").each do |elem|\n if not n[elem]\n if not create\n return nil\n else\n n[elem] = Node.new(elem)\n end\n end\n n = n[elem]\n end\n if n.nil?\n puts \"Warning, unknown object #{path}\"\n end\n n\n end", "title": "" }, { "docid": "3f9b2c755e3a4f20ea90eee8ef2f3d51", "score": "0.44560146", "text": "def create(config_path)\n # Get a Hash from the config JSON\n config = read_config(config_path, :create)\n\n # Get path for the manifest (secondary) file\n manifest = relative_config_path(config_path, config['manifest'])\n\n # Initialize .torrent Creator\n creator = Actions::Create.new(\n manifest: manifest,\n announce: config['announceURL'],\n source: config['source'],\n output: config['output'],\n piece_size: config['pieceSize'],\n privacy: config['private']\n )\n\n # Create torrents\n creator.execute\n end", "title": "" }, { "docid": "8ac6a72800f49742e818fcec2c918028", "score": "0.44528216", "text": "def create(mode=\"a+\", &block)\n name =~ /\\./ ? create_file(mode, &block) : create_directory(&block)\n end", "title": "" }, { "docid": "68ef5db1b2c86d4f9a8368e7b955f248", "score": "0.44511372", "text": "def mkdir(*path)\n path = self.path(*path)\n FileUtils.mkdir_p(path) unless File.directory?(path)\n path\n end", "title": "" }, { "docid": "7bb38f8396993025410d6d30726c3d25", "score": "0.4445355", "text": "def create(relative_path, opts = {})\n data, _status_code, _headers = create_with_http_info(relative_path, opts)\n data\n end", "title": "" }, { "docid": "7bb38f8396993025410d6d30726c3d25", "score": "0.4445355", "text": "def create(relative_path, opts = {})\n data, _status_code, _headers = create_with_http_info(relative_path, opts)\n data\n end", "title": "" }, { "docid": "761f619a200e1840b2460e8f8a9c98f2", "score": "0.44400284", "text": "def mkdir(path)\n path = @path.join path\n FileUtils.mkpath path\n end", "title": "" }, { "docid": "e7ca8de18b3a2ce41f32d789938c0ec5", "score": "0.4437729", "text": "def mkdir_p(path)\n stdout, stderr, _, _ = exec(\"mkdir -p #{path.inspect}\", :with_codes => true)\n\n if stderr =~ /Permission denied/\n base.say_status :permission_error, stderr, :red\n raise PermissionError, \"unable to create directory #{path}\"\n end\n end", "title": "" }, { "docid": "a5115fb09b9127420052811d0e9b9568", "score": "0.4433795", "text": "def create(path, encoding: self.encoding, perm: self.perm, **_opts, &block)\n full = @root.join(norm_path(path))\n FileUtils.mkdir_p(full.dirname.to_s)\n\n BFS::Writer.new(full, encoding: encoding, perm: perm) do |temp|\n FileUtils.mv temp, full.to_s\n end.perform(&block)\n end", "title": "" }, { "docid": "27ece4d215638492606f95ff475d9fad", "score": "0.4422625", "text": "def create_node args\n self.respond_to?(\"new_\"+args[:type]) ? self.send((\"new_\"+args[:type]), args) : self.errors[\"node\"] = \"#{args[:type]} is not defined\"\n end", "title": "" }, { "docid": "bff5979c72216d24c176853232e94c02", "score": "0.44180903", "text": "def create!(path) # :nodoc:\n Utils.prepare(path) {|io| yield(io) }\n end", "title": "" }, { "docid": "c9e38d882cb2fec714b975ded839e2cb", "score": "0.44146934", "text": "def create_folder path, options={}\n response = post(\"/#{path}\", options)\n end", "title": "" }, { "docid": "a1de9f92b091c105d71065d07531b320", "score": "0.4404792", "text": "def make_path(path)\n FileUtils.mkdir_p(path)\n end", "title": "" }, { "docid": "f6ed3a03fb553992c9a24ded37ef7643", "score": "0.44023445", "text": "def node_create(name, dsn)\n typed_exec(\"SELECT pglogical.create_node($1, $2)\", name, dsn)\n end", "title": "" } ]
9356bbb094e2be6406618bcbeaccfaf0
it should return a value when hit when object.hit is invoked
[ { "docid": "f8a3258d09fb4d4edaa38c93888a5d24", "score": "0.0", "text": "def test_hit_reduces_the_health_of_the_ship\n assert_equal @ship.health, @ship.length\n @ship.hit\n assert_equal @ship.health, @ship.length - 1\n @ship.hit\n assert_equal @ship.health, @ship.length - 2\n @ship.hit\n assert_equal true, @ship.sunk?\n end", "title": "" } ]
[ { "docid": "a5ec6b4354f92076459995192bc8ab05", "score": "0.81153953", "text": "def hit\n @hit\n end", "title": "" }, { "docid": "cbf98a2fdadd8c472e4d86ac09ba0b47", "score": "0.778353", "text": "def hit; end", "title": "" }, { "docid": "343ed82f74dcf9711856ea1f779d3acb", "score": "0.7326833", "text": "def hit\n param_adder(v_s_hit,:hit)\n end", "title": "" }, { "docid": "49a39c4291459d484f9e1deae6dc46b8", "score": "0.701738", "text": "def hit_by?(obj)\n end", "title": "" }, { "docid": "56aef18f4ad0032c3f4dccf2ea1f16bf", "score": "0.6717006", "text": "def get_hit(a_point)\n occupied_points.reject! { |point| point.is_equal(a_point) }\n set_state('damage') \n check_if_is_sink_and_change_state\n end", "title": "" }, { "docid": "b45ead9dc0d930fd2c13948b904e7dff", "score": "0.6663743", "text": "def hit\n malus_hit = has2w ? CPanel::TWHIT : 0\n party_bonus(ex_attr_hit, :hit) - malus_hit\n end", "title": "" }, { "docid": "9670feb1b769d0f07939e00a8f01ad90", "score": "0.66308844", "text": "def attack(player) \n player.get_hit\n end", "title": "" }, { "docid": "9167c8dd11ce1aa266f16248362c78b7", "score": "0.65507805", "text": "def hit?\n # code hit? here\nend", "title": "" }, { "docid": "b11600e3263b0da99afcf2ac826f4690", "score": "0.65271413", "text": "def hit\n # refactor- i don't like how hit? and hit are mostly the same\n # methods shouldnt be called multiple times\n # attacker xp is intermingled with hit which might be better in 'Game'\n\n if hit? # TODO fix, this calls so many methods\n @attacker.experience += 10\n end\n\n damage\n end", "title": "" }, { "docid": "4a6e12e5debd324815aacbdbe26bd996", "score": "0.6506794", "text": "def dice_calc_hit( user, obj = nil )\n dnd = IEX::DND_DAMAGE\n if obj == nil # for a normal attack\n die_val = calculate_dice_value(dnd::HIT_DICE[0], dnd::DND_DAMAGE::HIT_DICE[1])\n bonus_atk = (user.atk - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION\n targ_def = ((self.def - dnd::STAT_SUBTRACT) / dnd::STAT_DIVISION)\n if (die_val + bonus_atk) >= targ_def\n hit = 100\n else\n hit = 0\n end \n physical = true\n elsif obj.is_a?(RPG::Skill) # for a skill\n hit = obj.hit # get success rate\n physical = obj.physical_attack\n else # for an item\n hit = 100 # the hit ratio is made 100%\n physical = obj.physical_attack\n end\n if physical # for a physical attack\n hit /= 4 if user.reduce_hit_ratio? # when the user is blinded\n end\n return hit\n end", "title": "" }, { "docid": "6bf1685432ecdd0608172f749efca6bc", "score": "0.6489695", "text": "def takeHit(x)\n @hp = @hp - x\n return @hp\n end", "title": "" }, { "docid": "6bf1685432ecdd0608172f749efca6bc", "score": "0.6489695", "text": "def takeHit(x)\n @hp = @hp - x\n return @hp\n end", "title": "" }, { "docid": "9e9b465434356e2ad3ac877c1c9ba370", "score": "0.6482073", "text": "def hit\n\t\tdeal self.player\n\t\tcase self.player.score\n\t\twhen 21\n\t\t\treturn self.player\n\t\twhen 21..@infinity\n\t\t\treturn self.dealer\n\t\twhen 1..20\n\t\t\treturn nil\n\t\tend\n\tend", "title": "" }, { "docid": "3f2d2f65465606d396448ac60dce9ea9", "score": "0.64762926", "text": "def calc_hit(user, obj = nil)\n if obj == nil # for a normal attack\n hit = user.hit # get hit ratio\n physical = true\n elsif obj.is_a?(RPG::Skill) # for a skill\n hit = obj.hit # get success rate\n physical = obj.physical_attack\n else # for an item\n hit = 100 # the hit ratio is made 100%\n physical = obj.physical_attack\n end\n if physical # for a physical attack\n hit /= 4 if user.reduce_hit_ratio? # when the user is blinded\n end\n return hit\n end", "title": "" }, { "docid": "296841456da238eeebb868e1bd17cb55", "score": "0.64564717", "text": "def dealer_hit?\n self.get_score < 17\n end", "title": "" }, { "docid": "1e0f43fabafc1f8a80e63338c0fd552e", "score": "0.6443355", "text": "def hit_taken(hit)\n puts \"#{type} has been hit for #{hit.impact}\"\n end", "title": "" }, { "docid": "c169e8398853a50c80618c5ecec06674", "score": "0.6355028", "text": "def hit?\n is_hit_critical || is_hit_successful\n end", "title": "" }, { "docid": "ac93251764d904a27fe4b3df3c253d8f", "score": "0.6320981", "text": "def hit\n @health > 0 ? @health -= 1 : @health\n end", "title": "" }, { "docid": "3d7a837269e66b4bf730d2d8f0ece954", "score": "0.6306947", "text": "def hits; @hits; end", "title": "" }, { "docid": "a5c64aaa86d06775eb4881fac2cf5766", "score": "0.62784284", "text": "def test_hit\n sub = Ship.new('sub', 2)\n sub.hit\n assert_equal 1, sub.health\n end", "title": "" }, { "docid": "92ab8e5b04a2ef4906ac3c86b0a97225", "score": "0.6218392", "text": "def hit(card)\n @hand.hit(card)\n end", "title": "" }, { "docid": "98487141eb4bd9db289dda9fa0b25141", "score": "0.6210956", "text": "def checkHit \n if !self.ship_id.blank?\n if self.hit == true\n return 'already_hit'\n else\n self.hit = true\n self.save\n return 'hit'\n end\n else\n return 'miss'\n end \n end", "title": "" }, { "docid": "a74b233da1b324a969c30340357a7db6", "score": "0.619859", "text": "def hit_one\n\t if self.hit.blank?\n\t update_attribute(:hit, 1)\n\t else\n\t update_attribute(:hit, hit.to_i+1)\n\t end\n end", "title": "" }, { "docid": "731724f35eb62ceb91f27577c5912684", "score": "0.61057836", "text": "def cache_hit; end", "title": "" }, { "docid": "f3fc05e994215def1b9abc778bacdc06", "score": "0.60965306", "text": "def test_hit_method\r\n test_batter = PlayerBatter.new(\"test\")\r\n test_batter.hit(1)\r\n assert test_batter.bases == [1]\r\n test_batter.hit(3)\r\n assert test_batter.bases == [0,0,1]\r\n assert test_batter.home_runs == 1\r\n end", "title": "" }, { "docid": "02f9e5c9bb31d70a1195c2fabb20fd4d", "score": "0.6096285", "text": "def receive_hit\n @hp -= @hit\n end", "title": "" }, { "docid": "913e2bf0b42ca9ff7ef03866d12e2722", "score": "0.6091036", "text": "def hitMe(card)\n @hit = card\n if @hit.value.class == Array\n @cardValue += @hit.value[0]\n else\n @cardValue += @hit.value\n end\n\n\n @cards.push(@hit)\n\n if @cardValue >= MAX_VALUE\n return true\n end\n\n return false\n\n\n end", "title": "" }, { "docid": "f5e8fd47d050b96e0201858a5e3808be", "score": "0.60873353", "text": "def hit_by(object, object2)\n object.each_collision(object2) do |_o1, _o2|\n return true\n end\n false\n end", "title": "" }, { "docid": "8c3b0da5beb41e702b4a8dda55cc5f11", "score": "0.60711014", "text": "def hit block\n block.hit(options)\n end", "title": "" }, { "docid": "9331bdb49746ed2820e70d61a4ead479", "score": "0.60663164", "text": "def cache_hit=(_arg0); end", "title": "" }, { "docid": "687202f887289dfe3bbc8d6dde545f29", "score": "0.60524666", "text": "def hit_roll\r\n stat(:hit_roll)\r\n end", "title": "" }, { "docid": "e3fdaf117d223440212cafbd84573db9", "score": "0.60186666", "text": "def hit\n c = @contents.pop\n adjust_count c\n c\n end", "title": "" }, { "docid": "2195e9c50225fa7a908cc8b3e16f2988", "score": "0.59879375", "text": "def set_skill_hit_value(user, skill)\n return true unless $game_temp.in_battle\n atk_hit = Damage_Algorithm_Type > 1 ? user.agi : user.dex\n eva = 8 * self.agi / atk_hit + self.eva\n hit = (self.cant_evade? or self.hp <= 0) ? 100 : (100 - (eva * skill.eva_f / 100.0)) \n return (rand(100) < hit)\n end", "title": "" }, { "docid": "2e8c17e121af347cd6cdd540ae27101e", "score": "0.59674084", "text": "def set_attack_hit_result(attacker)\n return ((rand(100) < attacker.hit) and set_attack_hit_value(attacker))\n end", "title": "" }, { "docid": "127816b241e320d41728884e8534d29e", "score": "0.59537935", "text": "def test_get_hit\n @hand.get_hit\n assert_equal(1, @hand.my_hand.size )\n end", "title": "" }, { "docid": "a93d2869580ac15ba4c355202130b27d", "score": "0.5947612", "text": "def score(obj)\n 1\n end", "title": "" }, { "docid": "3515e50aea780ad80d535dace0e52125", "score": "0.5931335", "text": "def take_hit\n @health -= 1\n @health\n end", "title": "" }, { "docid": "462ed72942ff41ed0eb4d7945882adb1", "score": "0.591843", "text": "def hits\n @hits\n end", "title": "" }, { "docid": "d0158f1cbc74bf20e365fa90aa3419c1", "score": "0.5916348", "text": "def test_item_hit(user, item)\n @result.clear\n @result_pre_tested = true\n @result.used = item_test(user, item)\n @result.missed = (@result.used && rand >= item_hit(user, item))\n @result.evaded = (!@result.missed && rand < item_eva(user, item))\n @result\n end", "title": "" }, { "docid": "718475ab9cdf55d87809f58920ffbf9e", "score": "0.5903665", "text": "def hit?\n @rank >= 10\n end", "title": "" }, { "docid": "718475ab9cdf55d87809f58920ffbf9e", "score": "0.5903665", "text": "def hit?\n @rank >= 10\n end", "title": "" }, { "docid": "67f6fe766c60f44f6c1460b27334a939", "score": "0.5893212", "text": "def weapon_hit(target, damage_bonus = 0, hit_bonus = 0, custom_noun = nil, weapon = nil, noun_name_override = nil)\r\n # get data from weapon item or hand-to-hand\r\n weapon = weapon || self.weapons.first\r\n noun = custom_noun || weapon.noun\r\n noun = noun.to_noun\r\n hit = false\r\n\r\n # check for override event - i.e. burst rune\r\n\r\n if responds_to_event(:override_hit)\r\n override = { confirm: false, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event( self, :override_hit, override )\r\n if override[:confirm]\r\n return\r\n end\r\n end\r\n if weapon.responds_to_event(:override_hit)\r\n override = { confirm: false, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event( weapon, :override_hit, override )\r\n if override[:confirm]\r\n return\r\n end\r\n end\r\n # calculate hit chance ... I guess burst rune auto-hits?\r\n hit_chance = (hit_bonus + attack_rating( weapon ) - target.defense_rating ).clamp( 5, 95 )\r\n if rand(0...100) < hit_chance\r\n damage = damage_rating(weapon) + damage_bonus + (self.damage_roll * Constants::Damage::DAMROLL_MODIFIER).to_i\r\n hit = true\r\n else\r\n damage = 0\r\n end\r\n\r\n # modify hit damage\r\n\r\n if responds_to_event(:calculate_weapon_hit_damage)\r\n data = { damage: damage, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event( self, :calculate_weapon_hit_damage, data )\r\n damage = data[:damage].to_i\r\n end\r\n\r\n target.receive_damage(self, damage, noun, false, false, noun_name_override)\r\n\r\n if hit\r\n if responds_to_event(:override_receive_hit)\r\n override = { confirm: false, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event( target, :override_receive_hit, override )\r\n if override[:confirm]\r\n return\r\n end\r\n end\r\n if responds_to_event(:on_hit)\r\n data = { damage: damage, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event(self, :on_hit, data)\r\n end\r\n if weapon.responds_to_event(:on_hit)\r\n data = { damage: damage, source: self, target: target, weapon: weapon }\r\n Game.instance.fire_event(weapon, :on_hit, data)\r\n end\r\n end\r\n return\r\n end", "title": "" }, { "docid": "77a47894d6926b75bc58812017a19e80", "score": "0.58875215", "text": "def set_attack_hit_value(attacker)\n atk_hit = Damage_Algorithm_Type > 1 ? attacker.agi : attacker.dex\n eva = 8 * self.agi / atk_hit + self.eva\n hit = (self.cant_evade? or self.hp <= 0) ? 100 : 100 - eva\n return (rand(100) < hit)\n end", "title": "" }, { "docid": "5917d5005cfb39bcc9a05e900379bec2", "score": "0.58692425", "text": "def cache_hit(response)\n response\n end", "title": "" }, { "docid": "ea26bf481c99fa3e07462f1868254097", "score": "0.5860386", "text": "def hit?\t\n\t\t@rank >= 10 \n\tend", "title": "" }, { "docid": "ae339bc36b200038fa2e72ee6e6d7542", "score": "0.5852358", "text": "def hit (map)\n if @is_destroyable\n @health -= @damage_per_hit\n\n if @health <= 0\n @is_destroyed = true\n @is_ghost = true\n\n # Map should get updated automatically because ruby is pass by reference\n end\n end\n end", "title": "" }, { "docid": "e5fcb5cb142db2a68afb48ad2dff59dc", "score": "0.58431226", "text": "def hit_percentage\n @hits.to_f / @shots\n end", "title": "" }, { "docid": "e5fcb5cb142db2a68afb48ad2dff59dc", "score": "0.58431226", "text": "def hit_percentage\n @hits.to_f / @shots\n end", "title": "" }, { "docid": "13243552660fd9c96623c73bc86025f8", "score": "0.58416414", "text": "def hit(segment)\n @hits[segment] = true\n end", "title": "" }, { "docid": "f5febe5dae569f9cdc0c5d4510d1e2c5", "score": "0.5820845", "text": "def hit_or_miss(player, roll10)\n hit_roll = roll10.roll\n\n if hit_roll < player.agility\n return \"hit\"\n end\nend", "title": "" }, { "docid": "c6926f7ffbbd968ee1e0e25421283840", "score": "0.5818148", "text": "def hit\n @health -= 1\n end", "title": "" }, { "docid": "f7f452b1b7aec49bd7579433301b4c32", "score": "0.57975584", "text": "def set_skill_hit(user, skill)\n skill_hit = skill.magic? ? skill.hit : (skill.hit * user.hit / 100.0)\n return (rand(100) < skill_hit)\n end", "title": "" }, { "docid": "d17e278395fe155255bbb9737c3689aa", "score": "0.5795238", "text": "def hit_me\r\n\tend", "title": "" }, { "docid": "947b50060f5a09bd78040a975907168b", "score": "0.57910585", "text": "def hits\n @hits ||= box_score.fetch(:hits) { 0 }.to_i\n end", "title": "" }, { "docid": "431cc1cb212e1168b48f8b8ca8f42c1a", "score": "0.5790171", "text": "def contract_hits\n player_rounds.with_contract_hit\n end", "title": "" }, { "docid": "808c0db0be24b9cf9bf6ed517cacfad6", "score": "0.57894826", "text": "def hit\n if @life > 0\n @life -= 1\n end\n end", "title": "" }, { "docid": "e111ad45fa9b712df2f3930336008f1f", "score": "0.57837534", "text": "def hit_rate(user, item)\r\n # Critic hit\r\n is_critical?(user)\r\n\r\n # Hit Rate Estimation\r\n value = 1 + Random.rand(100)\r\n eva = user.mmp - evasion\r\n puts \"Enemy : \" + value.to_s + \" vs \" + eva.to_s\r\n return (value >= eva)\r\n end", "title": "" }, { "docid": "527796f46a01391c66866aa268a6c388", "score": "0.5767693", "text": "def chance_of_hit(user, target)\n # TODO: lock-on return 100 if target is locked by user\n return 100 *\n accuracy_mod(user) *\n evasion_mod(target) *\n send(ACCURACY_ITEM_MULTIPLIER[user.item_db_symbol], user, target) *\n send(EVASION_ITEM_MULTIPLIER[target.item_db_symbol], user, target) *\n send(ACCURACY_ABILITY_MULTIPLIER[user.ability_db_symbol], user, target) *\n send(EVASION_ABILITY_MULTIPLIER[target.ability_db_symbol], user, target) *\n (logic.global_gravity? ? GRAVITY_MODIFIER : 1)\n end", "title": "" }, { "docid": "531d316bf1c9af0ec4190e741be62b0e", "score": "0.57674396", "text": "def has_hit(hit)\n asap = []\n asap.push hit.to_left, hit.to_left.to_left if field[hit.to_right] == :hit\n asap.push hit.to_right, hit.to_right.to_right if field[hit.to_left] == :hit\n asap.push hit.to_up, hit.to_up.to_up if field[hit.to_dn] == :hit\n asap.push hit.to_dn, hit.to_dn if field[hit.to_up] == :hit\n if asap.empty?\n # Force shooting around\n asap = [ hit.to_left,\n hit.to_right,\n hit.to_up,\n hit.to_dn\n ].reject { |l| l.nil? } \n end\n asap.each { |l| @shot_queue.push l }\n end", "title": "" }, { "docid": "923eddecf53c6e5091848ce919da4af0", "score": "0.5762497", "text": "def hit?(segment)\n @hits[segment] || false\n end", "title": "" }, { "docid": "4a4f7c6156ccbbe6812a0a6983354514", "score": "0.57611465", "text": "def set_skill_hit_result(user, skill)\n return (set_skill_hit(user, skill) and set_skill_hit_value(user, skill))\n end", "title": "" }, { "docid": "e79922ee5fc28989b08e8da995d072b4", "score": "0.5737213", "text": "def verified_hits\n hits.select { |h| h.result }\n end", "title": "" }, { "docid": "9f145f245185002c02093555e9d64a0b", "score": "0.5734543", "text": "def hit options={}\n fire options if hot?(options)\n end", "title": "" }, { "docid": "2e63e50bfa24e356cc41d694b74bf6ab", "score": "0.57220423", "text": "def receive_damage\n @hit_points -= 10\nend", "title": "" }, { "docid": "431fc25ca21c623952a5519644e55080", "score": "0.5719843", "text": "def hit_die\n @current_hit_die\n end", "title": "" }, { "docid": "759d06907c2d9c8e8d5001559f6dcbf0", "score": "0.57111335", "text": "def getHits()\n return @hits\n end", "title": "" }, { "docid": "a53663e8eae9b3b7b673a4e016fea5f8", "score": "0.5696715", "text": "def hit_ship(cell)\n @ships.each do |ship|\n ship.hit cell\n end\n end", "title": "" }, { "docid": "26ce47bcaa73b9f56942256245742664", "score": "0.5690073", "text": "def to_hit\n json = @json_val\n \n # Return nil on processing error\n return nil unless json\n \n Hit.new(:clicked_at => Time.at(json[\"t\"]), :page => json[\"u\"], :is_mobile => is_mobile?, :agency => agency)\n end", "title": "" }, { "docid": "452aa011118b927bc47aa440bb7e9bb8", "score": "0.56688005", "text": "def method_missing(meth, *args, &block)\n respond_to_missing?(meth) ? result['hits']['hits'].send(meth, *args, &block) : super\n end", "title": "" }, { "docid": "35fb40b8e24cb5f58afee7d7404c823d", "score": "0.5666634", "text": "def hit?()\n return ((now > 1) and (health(now) < health(now-1))) ? true : false\n end", "title": "" }, { "docid": "7f5541367c6ec2b245bca701b4935e88", "score": "0.5662889", "text": "def chance_to_hit(hit_percent, attacker, defender)\n random = rand(100)\n chance_to_hit = hit_percent - defender.dodge\n if chance_to_hit >= random\n #puts \"The enemy took damage\"\n hit(attacker, defender)\n else \n puts \"#{attacker.name} missed!\".yellow\n end \nend", "title": "" }, { "docid": "e739a422010fa93dd0c4bd3c1b0b68ea", "score": "0.5658486", "text": "def block_hit?(x,y)\n return destroying?(x,y) if @block_hit==true# && distance(h+(@tile_size/2),v,x,y)<(@tile_size*1.5)\n end", "title": "" }, { "docid": "9448ae65ca5bc73e90b5f35fbfa21440", "score": "0.5654632", "text": "def test_if_ship_has_been_hit_thrice\n @cruiser.hit\n @cruiser.hit\n @cruiser.hit\n assert_equal 0, @cruiser.health\n end", "title": "" }, { "docid": "832af6d2ed535484a12b509ce188c59b", "score": "0.5650827", "text": "def hit! damage = 1\n self.hitpoints -= damage\n hit if hitpoints > 0\n respond_to?(:kill!) ? kill! : destroy! if hitpoints < 0\n end", "title": "" }, { "docid": "41aa5929515b1799169628a8ee8d75aa", "score": "0.56445354", "text": "def hit(hand, card)\n if (card.valid)\n hand.hit(card)\n end\n end", "title": "" }, { "docid": "8fe8f57579ce8af3d5b1dccebd283c05", "score": "0.5643149", "text": "def hit\n # get a card\n card = @deck.dealOneCard\n\n raise \"ran out out cards\" if card.nil?\n\n # add this card to the hand\n @hand << card\n\n # and calculate the hands value. Aces count as 11 until the hand\n # value is greater than 21\n if card.rank == @deck.ace_rank\n if @value <= 10\n @has_ace = true\n @value += 11\n else\n @value += 1\n end\n # face cards are 10\n elsif card.rank > 10\n @value += 10\n else\n @value += card.rank\n end\n\n # check to see if we have an ace and are over 21\n if @value > Blackjack::GOAL_HAND && @has_ace\n @value -= 10\n @has_ace = false\n end\n\n return @value\n end", "title": "" }, { "docid": "12d2e2a7f3b67162a4a0f1cbc9c4f975", "score": "0.5629624", "text": "def found\r\n @match\r\n end", "title": "" }, { "docid": "08f0b6093bb279790b7a06ee301efa77", "score": "0.56279725", "text": "def hit\n r1 = Geo::Line.new(14.0,14.0,15.0,15.0)\n \n # r2 = Geo::Line.new(15,15,20,20)\n rota = Geo::LineSet.new\n rota << r1\n #rota << r2\n #rota._reindex\n g = 0\n #gps = Geo::Point.new(14.45, 14.45)\n gps = {\n :x => 14.47644,\n :y => 14.47645\n }\n catch :hit do\n while(g<360) do\n \n walk = xwalker(gps, g)#XX, YY, g)\n walker = Geo::Line.new(gps[:x], gps[:y], walk[:x], walk[:y])\n i = rota.intersects?(walker)\n puts \"#{g}º -> \" + i.to_s\n #throw :hit if i\n g+=45\n end\n end\nend", "title": "" }, { "docid": "371ea41da854b0d500c7da5a9beecac4", "score": "0.56131804", "text": "def test_hits\r\n assert_equal([4,0], @mastermind.hits([1,2,3,4]))\r\n assert_equal([3,0], @mastermind.hits([1,2,3,6]))\r\n assert_equal([2,0], @mastermind.hits([1,2,5,9]))\r\n assert_equal([1,0], @mastermind.hits([1,6,7,8]))\r\n assert_equal([2,2], @mastermind.hits([1,2,4,3]))\r\n assert_equal([2,1], @mastermind.hits([1,2,4,8]))\r\n assert_equal([1,3], @mastermind.hits([1,4,2,3]))\r\n assert_equal([0,4], @mastermind.hits([4,3,2,1]))\r\n assert_equal([0,2], @mastermind.hits([9,3,7,1]))\r\n end", "title": "" }, { "docid": "177820548b0a7f1fa35950695c7c0ddf", "score": "0.559472", "text": "def hit!(card)\n active_hand.hit! card\n check_done\n end", "title": "" }, { "docid": "9fc0e637be4e85625ba1a7e91b859028", "score": "0.55804026", "text": "def hit(key)\n automatically \"hit #{key}\"\n end", "title": "" }, { "docid": "9c950866f4a6d65a8f2e0c291ed2d18b", "score": "0.5562755", "text": "def hit?(agent)\n if rand < (1.0 - (agent.defence / (3.0 * self.attack)))\n true\n else\n false\n end\n end", "title": "" }, { "docid": "80c6b4cb6d6e61adee205ec9f2525ce4", "score": "0.5561684", "text": "def collision obj\n end", "title": "" }, { "docid": "3c532d0bd562d5032175728b229342ae", "score": "0.5557012", "text": "def hit(key, *modifiers)\n not_supported('hit')\n end", "title": "" }, { "docid": "8b05580ff6eae3191f3133e63db12e05", "score": "0.5555893", "text": "def hit_percentage\n @hits.to_f / @shots\n end", "title": "" }, { "docid": "ad435183b22727bba9ca2545be1d47f9", "score": "0.55511576", "text": "def [](key)\n @mutex.synchronize do\n @accesses += 1\n val = @objects[key]\n if val\n # puts \"Reset timer for #{key}\"\n @hits += 1\n val.reset\n val = val.obj\n resort\n end\n # if (@accesses % 100) == 0\n if (@accesses % 20) == 0\n # STDERR.puts \"Cache '#{@name}' hit rate: %0.2f%% over #{accesses} accesses\" % [ hit_rate ]\n end\n val\n end\n end", "title": "" }, { "docid": "ff5657744ee9f16e379c8408f00c221c", "score": "0.55456316", "text": "def hit_percentage\n if @hit_percentage.nil?\n @hit_percentage = @hits.to_f / @shots\n end\n\n @hit_percentage\n end", "title": "" }, { "docid": "30a50bbe395dd68682db506b6004c794", "score": "0.554317", "text": "def take_damage(amount)\n @hitpoints -= amount\nend", "title": "" }, { "docid": "98b2abcb9239fb5d66838b89b6907aea", "score": "0.552821", "text": "def match_score(val); end", "title": "" }, { "docid": "98b2abcb9239fb5d66838b89b6907aea", "score": "0.552821", "text": "def match_score(val); end", "title": "" }, { "docid": "1e9dd3e758817ba09c1a3cf1e315b57b", "score": "0.5525324", "text": "def fire(player)\n player.receive_hit(10)\n check_game_status\n end", "title": "" }, { "docid": "f3a1398514f5d57f110147e0575bfac5", "score": "0.55225456", "text": "def take_a_hit?\n if(!@turn_over)\n return count_hand < 17\n end\n end", "title": "" }, { "docid": "f44ff707d8d1b70b0adce5e5f74901db", "score": "0.5520269", "text": "def hit(c_cards)\n c_cards.pop\nend", "title": "" }, { "docid": "f44ff707d8d1b70b0adce5e5f74901db", "score": "0.5520269", "text": "def hit(c_cards)\n c_cards.pop\nend", "title": "" }, { "docid": "a810bc2bc4f57f738d9c6a78774baae0", "score": "0.55196697", "text": "def hit(hit_value)\r\n case hit_value\r\n when 1\r\n @bases.unshift(1)\r\n reset()\r\n when 2\r\n @bases.unshift(0,1)\r\n reset()\r\n when 3\r\n @bases.unshift(0,0,1)\r\n reset()\r\n when 4\r\n @bases.unshift(0,0,0,1)\r\n reset()\r\n end\r\n \r\n # Add home-run if baserunner makes it to home base\r\n until @bases.length < 4\r\n if @bases[-1] == 1\r\n @home_runs += 1\r\n @bases.pop\r\n else\r\n @bases.pop\r\n end\r\n end\r\n end", "title": "" }, { "docid": "ef5520794c94d518ecc445c4f8116269", "score": "0.55092734", "text": "def hit\n @card = @deck.deal_card\n @hand_value += @card.value\n @cards.push(@card)\n end", "title": "" }, { "docid": "c8a93b26f55f2ffee3414d70c93bf7f5", "score": "0.5507968", "text": "def first_hit_state\n super\n end", "title": "" }, { "docid": "2072b173a57ec62d24fdfec691709fc7", "score": "0.5500664", "text": "def post_hit_ref\n last_ref = history[0]\n co = get_co_ords(last_ref)\n x = numbers[co[\"x\"]]\n y = co[\"y\"].to_i\n dir = rand(0..1)\n increment = rand(0..1)\n case dir\n when 0\n case increment\n when 0\n x += 1 if x < @grid.size\n when 1\n x -= 1 if x > 1\n end\n when 1\n case increment\n when 0\n y += 1 if y < @grid.size\n when 1\n y -= 1 if y > 1\n end\n end\n @ref = letters[x] + y.to_s\n end", "title": "" }, { "docid": "ea659d6873031ff766e32e5da79d1f21", "score": "0.5500068", "text": "def receive_damage\n @hit_points -= 10\n end", "title": "" }, { "docid": "002393ed1011349454a7bdd445ebbf16", "score": "0.54909134", "text": "def find_object(x, y)\n #puts(\"looking for object at #{x/32}|#{y/32} (#{x}|#{y})\")\n @map.objects.each { |obj|\n if obj.x/32 == x/32 and obj.y/32 == y/32\n #puts(\"found #{obj.inspect}\")\n return obj\n end\n }\n return nil\n end", "title": "" }, { "docid": "cd7489f772382eb9a57848ecc449c005", "score": "0.54859155", "text": "def hits=(value)\n @hits = value\n end", "title": "" } ]
7b5e18fc494cd227b3fa07111c9e8e59
Internal: Generates a String key for a given request object. The request object is folded into a sorted Array (since we can't count on hashes order on Ruby 1.8), encoded as JSON and digested as a `SHA1` string. Returns the encoded String.
[ { "docid": "7f665abb6bb51cc83420ffbc656626f0", "score": "0.7294946", "text": "def cache_key_for(request)\n cache_keys = request.each_with_object([]) do |(key, value), parts|\n parts << [key.to_s, value]\n end\n\n Digest::SHA1.hexdigest(@serializer.dump(cache_keys.sort))\n end", "title": "" } ]
[ { "docid": "38c2b54d2c90dc20262a0fe54bb8cb74", "score": "0.64900875", "text": "def generate\n data = flatten(stringify_keys(@params)).join\n digest = OpenSSL::Digest::Digest.new(\"sha1\")\n Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, \"#{@url}#{data}\")).strip\n end", "title": "" }, { "docid": "e9fc41cfcbc484ba9638a4c80d9ed294", "score": "0.64637995", "text": "def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end", "title": "" }, { "docid": "e9fc41cfcbc484ba9638a4c80d9ed294", "score": "0.64637995", "text": "def generate_request_signature(components)\n string_to_sign = components.join(\"\\n\")\n\n digest = OpenSSL::Digest.new('sha1')\n Base64.encode64(OpenSSL::HMAC.digest(digest, @configuration.secret_key, string_to_sign))\n end", "title": "" }, { "docid": "d73a0d7b67f273fdfbd66a2aead69f6e", "score": "0.6453389", "text": "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "title": "" }, { "docid": "d73a0d7b67f273fdfbd66a2aead69f6e", "score": "0.6453389", "text": "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "title": "" }, { "docid": "ee94805dbfef351d127146941c888c74", "score": "0.6449595", "text": "def generate_hashkey_for(params, api_key)\n sorted_params = sort_params(params)\n params_string = concat_params(sorted_params)\n Digest::SHA1.hexdigest \"#{params_string}&#{api_key}\"\n end", "title": "" }, { "docid": "ae24dfa519e41c26fffffa4587eaf743", "score": "0.6236965", "text": "def compute_hashkey api_key, params\n joined_params = params.sort.map do |k,v|\n \"#{k}=#{v}\"\n end.join(JOIN_CHAR)\n Digest::SHA1.hexdigest \"#{joined_params}#{JOIN_CHAR}#{api_key}\"\n end", "title": "" }, { "docid": "5ec300a8a9e572c0b67cd5d0926f7dc2", "score": "0.6184468", "text": "def request_key(method, url, opt={})\n OpenSSL::Digest::SHA1.new([method, url.to_s].join(' ')).hexdigest\n end", "title": "" }, { "docid": "53d6af28a4a3a341e7a52ebf3e8141dc", "score": "0.60889375", "text": "def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end", "title": "" }, { "docid": "c56424214e6fa53eb3e6b22c4c12e044", "score": "0.6064886", "text": "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "title": "" }, { "docid": "ad29c57e34a99f27096d00fe23210681", "score": "0.6057812", "text": "def _build_object_key( obj )\n index = self.__pack[:keys].length\n self.__pack[:keys] << _pack_object( obj )\n index # return key\n end", "title": "" }, { "docid": "e3d9c88f4ebb2c395c4722a12beb005a", "score": "0.60105747", "text": "def params_digest\n return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n end", "title": "" }, { "docid": "f4efc61de302a2f6e2c5b3258318bd6f", "score": "0.6000471", "text": "def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end", "title": "" }, { "docid": "fc6ded77c430d9b7224392180bea204a", "score": "0.59184307", "text": "def generate_registration_key(components)\n string_to_encode = components.join('|')\n\n Digest::MD5.hexdigest(string_to_encode)\n end", "title": "" }, { "docid": "f70ac02a0d366373ae89958f435a6731", "score": "0.59046304", "text": "def gen_key( string )\n md5 = Digest::MD5.hexdigest( string )\n return md5[0, 3] + md5[29, 31]\nend", "title": "" }, { "docid": "8f081ac89acc33670b74e3bc9287d893", "score": "0.57978386", "text": "def encode(str)\n CGI::escape(Base64.encode64(hmac_sha1_digest(@aws_secret_access_key, str)).strip)\n end", "title": "" }, { "docid": "845021c2a5012833d13d52b8c3c14552", "score": "0.5779024", "text": "def generate_signature(base_string)\n key = OpenSSL::HMAC.digest('sha1', client_secret, base_string)\n CGI::escape(Base64.encode64(key).chomp)\n end", "title": "" }, { "docid": "4e87df4f449a7cfb2f56643b10f6c584", "score": "0.57760584", "text": "def build_key(event_name, date)\n [Counterman::PREFIX, event_name, date.join(\"-\")].join(\"_\")\n end", "title": "" }, { "docid": "d0bb62e6fac49645a16ef9fe52eb59f0", "score": "0.5760397", "text": "def object_to_cache_key(object)\n if object.is_a?(String)\n return object\n elsif object.respond_to?(:cache_key)\n return object.cache_key\n elsif object.is_a?(Array)\n return object.map{ |element| object_to_cache_key(element) }.to_param\n elsif object.respond_to?(:to_param)\n return object.to_param\n else\n return object.to_s\n end\n end", "title": "" }, { "docid": "7a9bf03b426e9d8195d958c4a62a2bff", "score": "0.57498014", "text": "def gen_key(string_key)\n b_key = self._hash_digest(string_key)\n return self._hash_val(b_key) { |x| x }\n end", "title": "" }, { "docid": "28d287a41a772ee4f7f0fdcdb56f0caa", "score": "0.5721578", "text": "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "title": "" }, { "docid": "aae0dd62c8a3641ac05f651f6337a177", "score": "0.5705777", "text": "def generate_key; end", "title": "" }, { "docid": "6f5796b79f7dc7aedc7daa3d608d5372", "score": "0.5703816", "text": "def generate_api_sig(options={})\n # Every request requires the api_key parameter\n options.merge! @auth\n # Keys must be sorted alphabetically\n api_sig = options.sort { |a, b| a.to_s <=> b.to_s }.join\n Digest::MD5.hexdigest(\"#{@secret}#{api_sig}\")\n end", "title": "" }, { "docid": "f0ac985e6b7026c62c9c0ef0a62cbd14", "score": "0.570066", "text": "def _make_request_str(ar, sep)\n ## Do the Hash version\n ret_str = ''\n if ar.kind_of?(Hash)\n ret_str = ar.map do |k,v|\n \"#{k}=#{v}\"\n end.join sep\n\n elsif ar.kind_of?(Array)\n ret_str = ar.map {|v| '#{v}' }.join sep\n end\n\n return ret_str\n end", "title": "" }, { "docid": "2703faa3f2639a89bb48c7990ab4dcaf", "score": "0.56962264", "text": "def params_digest\n # return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n Digest::SHA1.hexdigest(params.to_s)\n end", "title": "" }, { "docid": "e8e7265b76a13bcf8d6a98723a418529", "score": "0.56942433", "text": "def generate_key_from_object(obj)\n obj.class.name.underscore.to_sym\n end", "title": "" }, { "docid": "e00ad9a5e62cbbb8d994277d84e5f1af", "score": "0.56894076", "text": "def insist_key(*args)\n self.to_s + ':' + Digest::SHA1.hexdigest(args.join(','))\n end", "title": "" }, { "docid": "b2e98e802fdefd3c3e2f1f5233d4d5eb", "score": "0.5681486", "text": "def expanded_key(key) # :nodoc:\n return key.cache_key_with_version.to_s if key.respond_to?(:cache_key_with_version)\n return key.cache_key.to_s if key.respond_to?(:cache_key)\n\n case key\n when Array\n if key.size > 1\n key = key.collect{|element| expanded_key(element)}\n else\n key = key.first\n end\n when Hash\n key = key.sort_by { |k,_| k.to_s }.collect{|k,v| \"#{k}=#{v}\"}\n end\n\n key = key.to_param\n if key.respond_to? :force_encoding\n key = key.dup\n key.force_encoding('binary')\n end\n key\n end", "title": "" }, { "docid": "a6540312a91265c17b416a47569ec82b", "score": "0.5670128", "text": "def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end", "title": "" }, { "docid": "aa3d3207a9dc8aab928f09b4041be770", "score": "0.5647201", "text": "def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end", "title": "" }, { "docid": "e4f0fd67d85afa24e08b6f05d6f445cd", "score": "0.5645868", "text": "def build_key(event_name, date)\n [Minuteman::PREFIX, event_name, date.join(\"-\")].join(\"_\")\n end", "title": "" }, { "docid": "f80fe9be1e35f05ed4cd76f52e634fc5", "score": "0.56438607", "text": "def make_key t\n (sig_key(t) + sum_key(t))[0..MAX_KEY_SIZE].sub(/\\0+\\z/, \"\")\n end", "title": "" }, { "docid": "ef125ad86f7a1a73f03ec0bb9ea48acb", "score": "0.5629969", "text": "def create_api_key(string, pepper = rand(9**99).to_s)\n # Hash then encrypt our seed string\n 10.times do\n # Run our string through 10 rounds of SHA512, each time \"peppering\" it with random data\n 10.times do\n string = sha512(string.to_s + pepper)\n end\n # Encrypt the end result to further obfuscate things\n string = encrypt(string + pepper)\n end\n return string[0...64] # return the end result, stripping to 64 characters\nend", "title": "" }, { "docid": "2442bf7ac4974b1c9408c02e4f4787ac", "score": "0.56293434", "text": "def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end", "title": "" }, { "docid": "df41a5d05e223bfe36ed2808dea36114", "score": "0.56221765", "text": "def key_for(resource_name)\n [prefix, resource_name].join\n end", "title": "" }, { "docid": "548d1243f84f5144fd5120be0653bf3a", "score": "0.5597979", "text": "def current_key_prefix(search_type)\n Base64.urlsafe_encode64(\"#{search_type.chr}\\0#{@key_id.chr}\")\n end", "title": "" }, { "docid": "b843479191ea5fada012e763570f3420", "score": "0.5589401", "text": "def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end", "title": "" }, { "docid": "2394be05760e411d5e827bb31875a682", "score": "0.5572244", "text": "def build_key(h)\n keys.inject('') {|acc, key| acc = \"#{acc}\\x01#{h[key]}\"}[1..-1]\n end", "title": "" }, { "docid": "fa8781f5294cf66450a3ed010b9c0314", "score": "0.5553833", "text": "def key\n to_a[0..(num_key_fields-1)].join(\"-\")\n end", "title": "" }, { "docid": "71cd74a27b4cb99643fa6cf91adc2807", "score": "0.5544942", "text": "def to_s\n @real_key\n end", "title": "" }, { "docid": "b345e362da4080a983d74afea45c2565", "score": "0.5542789", "text": "def signature_base_string\n [\n @http_method.dup,\n percent_encode(base_url),\n percent_encode(request_params),\n percent_encode(nonce.to_s),\n percent_encode(@business_guid)\n ].join('&')\n end", "title": "" }, { "docid": "6e934580be3303dd075017c371e3b2d2", "score": "0.55381995", "text": "def magic_number(input)\n str = if input.is_a?(String)\n input\n elsif input.is_a?(Array)\n input.flatten.map(&:to_s).sort.join('&')\n elsif input.is_a?(Hash)\n flatten_hash(input).map { |k, v| \"#{k}=#{v}\" }.sort.join('&')\n else\n fail(\"Not supported input format: #{input.class}\")\n end\n Digest::SHA256.hexdigest(str)\n end", "title": "" }, { "docid": "f35797fa466bc2c22aa23597e5765d15", "score": "0.55286646", "text": "def expanded_key(key)\n return key.cache_key.to_s if key.respond_to?(:cache_key)\n\n case key\n when Array\n if key.size > 1\n key.collect { |element| expanded_key(element) }\n else\n expanded_key(key.first)\n end\n when Hash\n key.collect { |k, v| \"#{k}=#{v}\" }.sort!\n else\n key\n end.to_param\n end", "title": "" }, { "docid": "2207cf8ddaa36c39a4e2dc2bfcf7821b", "score": "0.5521846", "text": "def create_url_key(str, url_key_field, klass)\n str = UrlKey.escape(str)\n str = rand(30000).to_s(36) if str.length < 1\n key = str\n counter = 1\n until klass.find(:all, :conditions => [\"#{url_key_field} = ?\", key]).empty?\n key = \"#{str}-#{counter}\"\n counter += 1\n end\n\n key\n end", "title": "" }, { "docid": "f211db1750e78f89b523b2975bf8176b", "score": "0.5512749", "text": "def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end", "title": "" }, { "docid": "6952f38337bfe7a6031b779d4883af2e", "score": "0.5496981", "text": "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "title": "" }, { "docid": "0eeff48905b276a1896c4a5ec8b548f7", "score": "0.549556", "text": "def stringified_keys; end", "title": "" }, { "docid": "e6b76d195b6f6405def7ec84ee9e4478", "score": "0.5491325", "text": "def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end", "title": "" }, { "docid": "47de560a774ffd49074f393fb15e079c", "score": "0.54871184", "text": "def key_for(source, seed = name)\n source = source.keys + source.values if source.is_a?(Hash)\n\n ingredients = Array(source).map { |v| identify(v) }\n ingredients.unshift(seed)\n\n Digest::MD5.hexdigest(ingredients.join('|'))\n end", "title": "" }, { "docid": "93d1f7e8f7901c1fbfaa1f338ce79172", "score": "0.54815114", "text": "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "title": "" }, { "docid": "87990a78b566639a3a80ffb9ab7d838a", "score": "0.5477818", "text": "def generate!\n raise ArgumentMissingError unless has_all_required_inputs?\n payload = Base64.urlsafe_encode64(data.to_json).gsub(/[\\=\\n]/, '')\n signature = Base64.urlsafe_encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha256'),\n secret,\n HEADER + '.' + payload\n )\n ).strip.gsub(/[\\=\\n]/, '')\n [HEADER, payload, signature].join('.')\n end", "title": "" }, { "docid": "97484115ef6002704dd58a170927de90", "score": "0.54775834", "text": "def hashkey_calculation(query)\n validate(query)\n query += '&' + api_key.to_s\n Digest::SHA1.hexdigest(query)\n end", "title": "" }, { "docid": "3eea3d58fc9a80f8bf5c560be9b0430f", "score": "0.5475739", "text": "def key(name = nil)\n \"#{@id}:#{name}\"\n end", "title": "" }, { "docid": "6e3d6de161d3aca6f0f472c164e8a957", "score": "0.5473741", "text": "def request_string\n \"#{authentication_string}&\" + @request_parameters.\n reject{|k| self.send(k).blank?}.map(&:to_s).sort.map{|k|\n \"#{k.to_s.upcase}=#{escape(self.send(k))}\"\n }.flatten.join('&')\n end", "title": "" }, { "docid": "4ab5fc5338f99365890fb535f19632e6", "score": "0.5468579", "text": "def canonicalize_request\n \"Method:#{http_method.to_s.upcase}\\nHashed Path:#{digester.hash_string(canonical_path)}\\nX-Ops-Content-Hash:#{hashed_body}\\nX-Ops-Timestamp:#{canonical_time}\\nX-Ops-UserId:#{user_id}\"\n end", "title": "" }, { "docid": "848af9c1c7928cfc749822001d361a32", "score": "0.544585", "text": "def generate_signature_base_string(method, url, params, get_post_params = {})\n normalized_url = normalize_url(url)\n normalized_params = normalize_request_param(params, get_post_params)\n return method + \"&\" + normalized_url.urlencode + \"&\" + normalized_params.urlencode\n end", "title": "" }, { "docid": "f08f2b517301b74c20d3dfaf074b108a", "score": "0.54360527", "text": "def signature_helper(params, secret) # :nodoc:\n args = []\n params.each{|k,v| args << \"#{k}=#{v}\"}\n sortedArray = args.sort\n requestStr = sortedArray.join(\"\")\n return Digest::MD5.hexdigest(\"#{requestStr}#{secret}\")\n end", "title": "" }, { "docid": "6a60ea7d3b8a677e068623d342e964d7", "score": "0.542948", "text": "def hash2cgiString(h)\r\n # Order the keys alphabetically. It's not strictly necessary but makes\r\n # output easier to determine (helps testing)\r\n # This requires that the keys be strings, since symbols aren't sortable\r\n h2 = {}\r\n h.each {|key, value| h2[key.to_s] = value}\r\n alpha_keys = h2.keys.sort\r\n \r\n # Escape all the values first\r\n alpha_keys.each {|key| h2[key] = CGI::escape(h2[key].to_s) if (h2[key])}\r\n \r\n # Create the string\r\n alpha_keys.collect {|key| \"#{key}=#{h2[key]}\"}.join('&')\r\n end", "title": "" }, { "docid": "bfd11007d14fdac1db253037b9416895", "score": "0.5413134", "text": "def create_string_to_sign(scope, context)\n scope_hash = OpenSSL::Digest.new(@hash_algo, scope)\n context_hash = OpenSSL::Digest.new(@hash_algo, context)\n sprintf \"SIGNER-HMAC-%s\\n%s\\n%s\\n%s\\n%s\", @hash_algo.upcase, @self_key, @client_id, scope_hash, context_hash\n end", "title": "" }, { "docid": "79730ec1608a9c013f54ea792601f62a", "score": "0.54055053", "text": "def deeply_stringify_keys(obj)\n deep_key_stringifier.call( obj )\n end", "title": "" }, { "docid": "de940bd257c932c0e7dfc67dcb2060f7", "score": "0.53920907", "text": "def encode_object(object)\n scramble_encode(\"#{object.class}-#{object.id}\")\n end", "title": "" }, { "docid": "bdb9e324645ea2fa40834c4d48b285ea", "score": "0.53879035", "text": "def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end", "title": "" }, { "docid": "bdb9e324645ea2fa40834c4d48b285ea", "score": "0.53879035", "text": "def encode(payload)\n JWT.encode(payload, secret_key, 'HS256')\n end", "title": "" }, { "docid": "96bad84289a982143835a3be32de68de", "score": "0.53873837", "text": "def string_to_sign\n [\n SIGNV4ALGO,\n date,\n credential_scope,\n Digestor.hexdigest(canonical_request)\n ].join(\"\\n\")\n end", "title": "" }, { "docid": "aeb454a313e4ecfa526c3e1f43f841a9", "score": "0.53806657", "text": "def make_key(string)\n string.to_s.strip.downcase.gsub(key_replace, '_')\n end", "title": "" }, { "docid": "b98fda6ce47ea4ddc64b8ef1af3bed16", "score": "0.5373329", "text": "def to_s\n id_for(sha1)\n end", "title": "" }, { "docid": "72df302858bb8976af1dc993c368b693", "score": "0.53720355", "text": "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "title": "" }, { "docid": "39fbe05b3e1ea66edf60d242ec36477e", "score": "0.5362471", "text": "def key_name\n \"#{prefix}:#{@id}\"\n end", "title": "" }, { "docid": "53d4cc3e5e107d8563f8040a6e315cc6", "score": "0.5356977", "text": "def get_request_counter_key(type, name)\n generate_store_key(\"#{type}-r:#{name}\")\n end", "title": "" }, { "docid": "8b4db55688c6f8491104f7b9d1cf26a0", "score": "0.5354215", "text": "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "title": "" }, { "docid": "235b2e3dea9b37e6126d235d21f3adfa", "score": "0.5350604", "text": "def stringify_hash_keys(hash); end", "title": "" }, { "docid": "49e93ff7a4309b112c236c2c2b65a752", "score": "0.53495604", "text": "def generate_request(query)\n validate(query)\n URI(API_URL + '?' + query + \"&hashkey=\" + hashkey_calculation(query))\n end", "title": "" }, { "docid": "36f764f6bee87b1a43ea6d6d8d8b3319", "score": "0.5347549", "text": "def expand_key(object)\n if object.respond_to?(:cache_key)\n object.cache_key\n else\n \"#{object.class.name}/#{object.id}/#{object.updated_at.to_i}\"\n end\n end", "title": "" }, { "docid": "fe422921512503535699ca6b14fd8025", "score": "0.5341174", "text": "def hash(ts)\n sig = [\n Rackspace::Email::Api.configuration.user_key,\n Rackspace::Email::Api.configuration.user_agent,\n ts,\n Rackspace::Email::Api.configuration.api_key\n ].join('')\n\n Base64.encode64(Digest::SHA1.digest(sig))\n end", "title": "" }, { "docid": "3115cc1de536d74c7915941185f3dcd4", "score": "0.53371197", "text": "def generate_cache_key_name\n alphabetical = [@origin_a, @origin_b].sort\n \"#{alphabetical.first}_#{alphabetical.last}_#{@destination_city}_#{@date_there}_#{@date_back}\"\n end", "title": "" }, { "docid": "7b533bbc38f00554bf30dfe58b1a58f5", "score": "0.53263766", "text": "def sign_digest(params)\n sign = []\n params.sort.each do |p|\n sign << p[0].to_s + '=' + p[1].to_s + '&'\n end\n sign << \"key=#{@key}\"\n Digest::MD5.hexdigest(sign.join).upcase\n end", "title": "" }, { "docid": "fc10a47d26d5ad3e29c10a49a43e1d7a", "score": "0.5319122", "text": "def hashed_key_and_args(key, *args)\n base = args.inject('') do |memo, arg|\n memo << (':' + arg.class.to_s + ':') << case arg\n when Array\n hashed_key_and_args(key, *arg)\n when Hash\n hashed_key_and_args(key, *arg.to_a)\n when NilClass, Numeric, String, Symbol\n arg.to_s\n else\n raise ArgumentError, 'can only compute digest for primitive objects'\n end\n\n Digest::SHA1::hexdigest(memo)\n end\n\n key + ':' + base\n end", "title": "" }, { "docid": "a94b3e62c9b00f2ecfba833e2ddaad5a", "score": "0.5317465", "text": "def full_key\n [name, key].join(\"/\")\n end", "title": "" }, { "docid": "c1c578e620e29b3221561806843685f0", "score": "0.531716", "text": "def to_s\n key.to_s\n end", "title": "" }, { "docid": "0780f85849d696422874369a00e396bb", "score": "0.53160805", "text": "def request_key(cntrl)\n check_hash = 0\n cntrl.each_byte do |b|\n check_hash += b\n pp check_hash\n end\n check_hash *= REQUEST_KEY_MAGIC\n pp check_hash\n check_hash %= 65536\n check_hash\n end", "title": "" }, { "docid": "4e4544e078d844f8d1e92f0e00456e7e", "score": "0.53137976", "text": "def valid_keys_to_query_string(o)\n str = ''\n o.each { |k,v| str << \"#{k}=#{v}&\" if VALID_KEYS.include?(k) }\n str\n end", "title": "" }, { "docid": "3edb5abac89ab1b7e1cd4980b7f301ad", "score": "0.5313105", "text": "def stringify_keys; end", "title": "" }, { "docid": "3edb5abac89ab1b7e1cd4980b7f301ad", "score": "0.5313105", "text": "def stringify_keys; end", "title": "" }, { "docid": "3edb5abac89ab1b7e1cd4980b7f301ad", "score": "0.5313105", "text": "def stringify_keys; end", "title": "" }, { "docid": "093c11c4ac07f469c3efe92c806b8623", "score": "0.53130794", "text": "def to_bytes; @key; end", "title": "" }, { "docid": "093c11c4ac07f469c3efe92c806b8623", "score": "0.53130794", "text": "def to_bytes; @key; end", "title": "" }, { "docid": "a065fb9ba2998d451a5f07c89c5d4211", "score": "0.5309579", "text": "def kv_encode(h); h.map {|k,v| k.to_s + \":\" + v.to_s + 10.chr }.join end", "title": "" }, { "docid": "bce306379ccb3c683f2c30d55f07a621", "score": "0.53025407", "text": "def marshal(request_object)\n JSON.pretty_generate(request_object.to_h)\n end", "title": "" }, { "docid": "8af14539426bc9f6b9a122ca86eab841", "score": "0.52948236", "text": "def to_s\n JWT.encode(to_h, ENV['JWT_KEY'])\n end", "title": "" }, { "docid": "9ecf74ad7f79d41e1384a34a50c13d58", "score": "0.52869457", "text": "def stringify_hash(input)\n input.inject({}){|h,(k,v)| h[k.to_s] = v.to_s; h}\n end", "title": "" }, { "docid": "21965f8aef2f5cc34470f841a4212476", "score": "0.52793545", "text": "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "title": "" }, { "docid": "21965f8aef2f5cc34470f841a4212476", "score": "0.52793545", "text": "def encrypt(string)\n Digest::SHA1.hexdigest(string)\n end", "title": "" }, { "docid": "2ed3d6f9461f173b85618df6bf9aeddb", "score": "0.5272841", "text": "def build_signature_for(url, params)\r\n data = url + params.sort.join\r\n digest = OpenSSL::Digest.new('sha1')\r\n Base64.strict_encode64(OpenSSL::HMAC.digest(digest, ENV['TWILIO_AUTH_TOKEN'], data))\r\n end", "title": "" }, { "docid": "702d82ba3556943a4c45ddbc9a84c775", "score": "0.52665555", "text": "def name_as_hash_key\n operation_as_string << @name << boost_as_string\n end", "title": "" }, { "docid": "a954ddf265d52cefc3c3e5d8216f42ff", "score": "0.5263676", "text": "def stringify_keys\n reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) }\n end", "title": "" }, { "docid": "ddb76b9a8d0440367ebea129bf520d94", "score": "0.52544594", "text": "def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end", "title": "" }, { "docid": "ddb76b9a8d0440367ebea129bf520d94", "score": "0.52544594", "text": "def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end", "title": "" }, { "docid": "ddb76b9a8d0440367ebea129bf520d94", "score": "0.52544594", "text": "def stringify_keys\n reduce({}) { |hsh, (k, v)| hsh.merge(k.to_s => v) }\n end", "title": "" }, { "docid": "9777524fabac3466b11b2ad6057ed666", "score": "0.525047", "text": "def SignerKey(input = nil)\n case input\n when Transaction\n SignerKey.pre_auth_tx(input.hash)\n when /^[0-9A-Za-z+\\/=]{44}$/\n SignerKey.hash_x(Stellar::Convert.from_base64(input))\n when /^[0-9a-f]{64}$/\n SignerKey.hash_x(Stellar::Convert.from_hex(input))\n when /^.{32}$/\n SignerKey.hash_x(input)\n else\n SignerKey.ed25519(KeyPair(input))\n end\n end", "title": "" }, { "docid": "e631a60311ed824f9e0999345a106f43", "score": "0.52494895", "text": "def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end", "title": "" } ]
09050955a6c25f02f8af18385acb98d4
Confirms that artwork is for sale
[ { "docid": "9c4c014dec8ac4052af88f4fc23b8ac0", "score": "0.7981274", "text": "def artwork_for_sale\n @artwork = Artwork.find(params[:artwork_id])\n return unless @artwork.status != 'For Sale'\n\n redirect_to root_url\n flash[:warning] = \"Artwork is not for sale. We can't submit your order.\"\n end", "title": "" } ]
[ { "docid": "654a3635ccf5e6407f61cdec6770dae1", "score": "0.66925365", "text": "def for_sale?\n status == 'for_sale'\n end", "title": "" }, { "docid": "69f1fb3dd583a0173015aa6a26fa96b1", "score": "0.6626889", "text": "def is_on_sale\n if self.promotion_rules.map(&:promotion).collect{|pr| pr.name.downcase }.include?(\"warehouse sale\".downcase)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "e221d5a54ddd4f32fec2ac92c4e39333", "score": "0.6425847", "text": "def for_sale?\n self.UnitInSales != 1\n end", "title": "" }, { "docid": "e71248778a667d5f92eda05ee1357f0d", "score": "0.60849476", "text": "def own_art\n @artwork = Artwork.find(params[:artwork_id])\n return unless current_user?(@artwork.user)\n\n redirect_to root_url\n flash[:danger] = \"You can't buy your own art.\"\n end", "title": "" }, { "docid": "f3319b6b6ea787b714633937b7987c45", "score": "0.6017838", "text": "def product_on_sale?(product)\n if product.onsale == true\n return '<span class=\"badge bg-success\">OFERTA!</span>'\n end\n end", "title": "" }, { "docid": "5dc3f3f41cb15ad3368f25842bc96768", "score": "0.60133386", "text": "def sale()\n itemCount = 0\n if Input.cart.discount_code == nil # IF the cart has a discount code\n puts \"\" # Shopify would not allow the proper logic here so this is a work around IF statement\n else # IF NOT remove it\n Input.cart.line_items.each do |line_item|\n product = line_item.variant.product\n if (product.id == 9556534093)\n Input.cart.discount_code.reject(message: \"Not usable with lab pre-orders\")\n end\n end\n end\nend", "title": "" }, { "docid": "c53efdde165b5ab6e433dca1a28aac2a", "score": "0.5929063", "text": "def sale?\n ###\n # Because uniform price only pulls from the master variant, \n # pull the sale price from the master variant\n ###\n if self.is_master\n return false if self.sale_price.nil?\n return false if self.sale_price.zero?\n else\n return false if self.product.master.sale_price.nil?\n return false if self.product.master.sale_price.zero?\n end\n true\n end", "title": "" }, { "docid": "84fe583ed02a5fc6b092fc6b0692abb0", "score": "0.5831588", "text": "def sale_message\n if price <= 2\n return \"Discount item!\"\n elsif price > 2\n return \"On sale!\"\n end\n end", "title": "" }, { "docid": "1bce1f04e748a340ea2d1e94bd9b4a27", "score": "0.5794522", "text": "def on_sale_text\n value = self.on_sale ? \"Yes\" : \"No\"\n end", "title": "" }, { "docid": "cf1efe4428ea7cf7a8fd33d15e3e6292", "score": "0.5770816", "text": "def sold?\n (self.sold == 1)\n end", "title": "" }, { "docid": "cf1efe4428ea7cf7a8fd33d15e3e6292", "score": "0.5770816", "text": "def sold?\n (self.sold == 1)\n end", "title": "" }, { "docid": "6837b8ee256ed42ac83adf68e913cab4", "score": "0.5745589", "text": "def sale_message\n\t\tif price.to_i < 2\n\t\t\tmessage = \"Discount Item!\"\n\t\telse\n\t\t\tmessage = \"On Sale!\"\n\t\tend\n\t\tmessage\n\tend", "title": "" }, { "docid": "f3f63a8a940498c73859b076be233b3f", "score": "0.57265794", "text": "def sale_message\n if price.to_i < 2\n \"Discount Item\"\n else\n \"On Sale!\"\n end\n end", "title": "" }, { "docid": "18bbb4c0a2dc0a87626a22cc77e8c6cb", "score": "0.5678769", "text": "def sold?\n (status == SOLD)\n end", "title": "" }, { "docid": "18bbb4c0a2dc0a87626a22cc77e8c6cb", "score": "0.5678769", "text": "def sold?\n (status == SOLD)\n end", "title": "" }, { "docid": "18bbb4c0a2dc0a87626a22cc77e8c6cb", "score": "0.5678769", "text": "def sold?\n (status == SOLD)\n end", "title": "" }, { "docid": "131dcbd2ae96778c81a44a2fe81cb130", "score": "0.5661289", "text": "def check_sales\n sale = false\n data.site.products_a.each do |id, product|\n if product.is_sale\n sale = true\n break\n end\n end\n if sale === false\n data.site.products_b.each do |id, product|\n if product.is_sale\n sale = true\n break\n end\n end\n end\n sale\n end", "title": "" }, { "docid": "9b4344cc92585e1b1626cee259d27286", "score": "0.56196207", "text": "def draw_item_sale\n return 0 unless shop.item_in_sale?(item)\n change_color crisis_color\n draw_text(line_rect(1), sprintf(Vocab.in_sale, shop.item_discount(item)), 1)\n 1\n end", "title": "" }, { "docid": "878b6e9c5809d3c1406ecc169eb68571", "score": "0.56041056", "text": "def product_on_sale?(product, quantity = 1.0)\n user_group = current_user ? current_user.user_group : nil\n product.magento_type != 'giftvoucher' && product.on_sale?(user_group, current_store, quantity)\n end", "title": "" }, { "docid": "b53bfd6dbd0af4432fce604b1e088a92", "score": "0.55995786", "text": "def artist?\n artists.present?\n end", "title": "" }, { "docid": "d49a2fe2fbdb8e206c2e28ebe8dbf958", "score": "0.55593544", "text": "def require_payment\n case\n when current_user.role.name == \"administrator\"\n true # Administrators can view assets\n when current_user.id == params[:artist_id]\n true # Artists can view their own works\n else\n # Unless the user has a subscription, Have a user pay to get access to an artist's assets\n if current_user.user_subscriptions.where(artist: @artist).empty?\n redirect_to new_artist_subscription_path(@artist)\n end\n end\n end", "title": "" }, { "docid": "347b6175689cb8cbb9902ab320f0e5b9", "score": "0.5542516", "text": "def item_has_sale_price? item\n\t\t\t!Item.find_by_name(item).sale_price.nil?\n\t\tend", "title": "" }, { "docid": "4c2641b0b375763831b7dee87b24f437", "score": "0.5520386", "text": "def is_apply_sale_tax\n if (@productType == ProductType::BOOK or \n @productType == ProductType::FOOD or \n @productType == ProductType::MEDICAL)\n return false\n end\n return true\n end", "title": "" }, { "docid": "84226a3a88ad59e3459eff6b6a35aa8f", "score": "0.551747", "text": "def purchased?\n @purchased\n end", "title": "" }, { "docid": "9a539a5ab91bb18d1dfd6642fe825d0b", "score": "0.5500516", "text": "def is_short_sale?\n self.dig_for_boolean(\"listingSummary\", \"isShortSale\")\n end", "title": "" }, { "docid": "ab51c6e97e0956646379ba057e515ea9", "score": "0.5491491", "text": "def infringes_trademark?\n rejection_reason == 'trademark' if video?\n end", "title": "" }, { "docid": "734234fe68150718dd7974a5b58bad9c", "score": "0.54865867", "text": "def purchased?\n if Purchase.find_by(listing_id: self.id) \n true \n else \n false\n end \nend", "title": "" }, { "docid": "3d0bd6b8d4b2667153b72f3b76b03f6c", "score": "0.5462236", "text": "def artist_check\n if show_params[:artist_id].empty?\n flash[:warning] = 'An active artist must be selected.'\n form_collections\n @show = Show.create(show_params)\n render 'new'\n end\n end", "title": "" }, { "docid": "93c65c62d1bbf718d4de2d532a3fbf89", "score": "0.54578817", "text": "def update_sale_artwork(sale_id, artwork_id, params = {})\n object_from_response(self, Artsy::Client::Domain::SaleArtwork, :put, \"/api/v1/sale/#{sale_id}/sale_artwork/#{artwork_id}\", params)\n end", "title": "" }, { "docid": "078676ebcf9f72f4919d31b453b6234f", "score": "0.54567236", "text": "def purchased?\n quantity == purchased\n end", "title": "" }, { "docid": "a14b12705cf6c5414bdaff8fb8de326f", "score": "0.5441658", "text": "def stripe_ready\n @artwork = Artwork.find(params[:artwork_id])\n return unless @artwork.user.stripe_user_id.empty?\n\n redirect_to root_url\n flash[:danger] = 'This artist is not ready yet to accept payments. Stay tuned..'\n end", "title": "" }, { "docid": "4e358e6393d01c5812edbeb9d1ce2169", "score": "0.5431491", "text": "def for_sale\n @images = Artwork.where(for_sale: true).paginate(page: params[:page], per_page: 12)\n end", "title": "" }, { "docid": "a55f2768576a0abac5c8817814dfaadb", "score": "0.5427603", "text": "def claim\n if self.is_claimed == true\n \"Yes, someone is bringing this item.\"\n else\n \"Nope, click on the item name to bring the item!\"\n end\n end", "title": "" }, { "docid": "996bef547149a5a35b1051b3d035b365", "score": "0.5424567", "text": "def delete_artwork(current_user)\n user_artwork = self.user_artwork(current_user)\n if user_artwork.sold == true\n UserArtwork.delete_all(artwork_id: self.id)\n Artwork.find(self.id).delete\n else\n user_artwork.delete\n end\n end", "title": "" }, { "docid": "2831ac77daef33a3cc68a70446b714a0", "score": "0.54240924", "text": "def quotation?\n !cart?\n end", "title": "" }, { "docid": "d258d04bd13f6a6107f00ae773894240", "score": "0.53947926", "text": "def show_discount_teaser?(cart)\n return false if cart.event_registrations.blank?\n return false if current_user.current_member?\n return false unless cart.membership_applications.blank?\n cart.event_registrations.any? { |reg| reg.cost > reg.member_cost } \n end", "title": "" }, { "docid": "c4651a74f5ffdaa1dfe2c63feaf7b9c8", "score": "0.5378261", "text": "def magazine_item_on_rent?\n\t magazine_items.each do |i|\n\t return true if i.is_rent\n\t end\n\t return false \n\tend", "title": "" }, { "docid": "e202911f7e0bb1a624108a56ad598569", "score": "0.53659713", "text": "def thesis?\n true\n end", "title": "" }, { "docid": "a39047c8c2174babc4c1884d72d0b4f4", "score": "0.53560793", "text": "def ineligible?\n summarized_assessment_result == :ineligible\n end", "title": "" }, { "docid": "c933200a623e09b67c70be776b084ba1", "score": "0.53488123", "text": "def trainee?\n enrolled?\n end", "title": "" }, { "docid": "9d03ad9f3c9e3685a5529d972ec1962f", "score": "0.5348101", "text": "def show\n @book = Book.find(@sale.book_id)\n @buyer = User.find(@sale.buyer_id)\n @seller = User.find(@sale.seller_id)\n if @sale.trade_id != nil\n @trade = Book.find(@sale.trade_id)\n @body_text = \"#{@buyer.first_name} wants to trade with you\"\n end\n @state = case @sale.state\n when 0\n \"Waiting on Your Input\"\n when 1\n \"Finished\"\n else\n \"Something's Not Right\"\n end\n\n end", "title": "" }, { "docid": "f249016dafdec1aafe257506f421a527", "score": "0.5341946", "text": "def seller?\n seller\n end", "title": "" }, { "docid": "c44fb09b4b0ce0da9f01785c5ba8be2d", "score": "0.53200066", "text": "def review?(subject)\n items_left_to_review_for(subject) > 0\n end", "title": "" }, { "docid": "ec908427ecb5cf250c43c22b46628a81", "score": "0.53183377", "text": "def not_issued?\n if line_items.where(\"quantity_issued > 0\").exists?\n errors.add(:base, 'Order has been used by sales orders')\n return false\n end\n\n return true\n end", "title": "" }, { "docid": "30a38cc5a33686d03dbff21f22257ca9", "score": "0.5316691", "text": "def pre_art_pcb(design_review, review_results)\n return (review_results.find { |rr| rr.role.name == \"PCB Design\" } &&\n design_review.review_type.name == \"Pre-Artwork\")\nend", "title": "" }, { "docid": "f16ace4345cd340dce495558ca46f080", "score": "0.5310371", "text": "def show\n @favorite_exists = Favorite.where(artwork: @artwork, customer: current_customer) == [] ? false : true\n # @artist = Artist.find(current_artist.id)\n \n end", "title": "" }, { "docid": "4571f1aaa91aca3f340d55316cb78831", "score": "0.5308817", "text": "def sold_separately?\n @product_availability.human != \"NotSoldSeparately\"\n end", "title": "" }, { "docid": "77e33273068c6c57e334ab434f322ba9", "score": "0.5308071", "text": "def can_sell?(entity, bundle)\n return false if entity != bundle.owner\n return false unless @game.check_sale_timing(entity, bundle.corporation)\n return false unless sellable_bundle?(bundle)\n\n # This is our new clause for 1871, if this is the corporation\n # selling, we can sell all of them\n return true if bundle.corporation == bundle.owner\n\n selling_minimum_shares?(bundle)\n end", "title": "" }, { "docid": "2df351862b327e35e656ec5f12eb6bfb", "score": "0.530368", "text": "def add_artwork_to_sale(sale_id, params = {})\n object_from_response(self, Artsy::Client::Domain::SaleArtwork, :post, \"/api/v1/sale/#{sale_id}/sale_artwork\", params)\n end", "title": "" }, { "docid": "58d3c59b9d1434f23d3226f30300b216", "score": "0.53022677", "text": "def correct?\n self.snippet.senseeval_inventory_id == self.senseeval_inventory_id\n end", "title": "" }, { "docid": "de638fbc3950a7aa19095144ef6cefd9", "score": "0.5301609", "text": "def single_listing(listing_id)\n artwork_query = api.get(ARTWORK_ENDPOINT + '/' + listing_id)\n # So, sometimes the contnet_type isn't set? That's odd\n # p \"Artwork query content type: #{artwork_query.content_type}\"\n artwork = artwork_query.parse\n unless artwork[\"title\"].nil?\n artwork\n else \n error_response(artwork['message'])\n end\n\n end", "title": "" }, { "docid": "eed8456d24ba070ef841082d22783345", "score": "0.5278517", "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": "96fe8be680a2cf670b9631b2865e6dfb", "score": "0.52759", "text": "def create\n \n if user_signed_in?\n\n @item_art = ItemArt.new(item_art_params)\n\n #Search code magic\n\n c = 0\n \n until c==1 do\n \n search_code = (SecureRandom.hex(2)).downcase\n \n unless ItemArt.where(:search_code => search_code).exists?\n\n @item_art.update(:search_code => search_code)\n\n c=1\n\n end\n\n end\n\n ##end search code\n\n if current_user.is_artist\n\n @item_art.update(:user_id => current_user.id)\n\n end\n\n respond_to do |format|\n if @item_art.save\n format.html { redirect_to works_path, notice: 'Item art was successfully created.' }\n format.json { render :show, status: :created, location: @item_art }\n else\n format.html { render :new }\n format.json { render json: @item_art.errors, status: :unprocessable_entity }\n end\n end\n\n else\n\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "32fe439327b320bf42c476cb15d6841b", "score": "0.52719945", "text": "def president_can_sell?(entity, corporation)\n return true unless corporation.owner == entity\n return true if !@game.concession_pending?(corporation) || corporation == @game.mhe\n\n corporation.share_holders[entity] > 20\n end", "title": "" }, { "docid": "90e1572b4552c2837c8d830aeb5c10c1", "score": "0.52650046", "text": "def seller?\n is_seller\n end", "title": "" }, { "docid": "f4cd72a06cfcb65af81ef33ffa028bda", "score": "0.52635974", "text": "def validate_if_double_sale\n if self.payment_transaction_id && PaymentTransaction.find(self.payment_transaction_id).success?\n raise DoubleSaleException, \"Jetsteal seat #{self.id} has been sold twice due to race condition\"\n end\n end", "title": "" }, { "docid": "6c7c67c951f566f4128ae62ac68d159e", "score": "0.52565634", "text": "def pre_artwork_complete(design)\n\n pre_art_review_type = ReviewType.get_pre_artwork\n pre_art_design_review = design.design_reviews.detect { |dr| \n dr.review_type_id == pre_art_review_type.id\n }\n\n done = ReviewStatus.find_by_name('Review Completed')\n done.id == pre_art_design_review.review_status_id\n \n end", "title": "" }, { "docid": "7c39a17ea5d3c7b5a3421ffb5258c770", "score": "0.5253286", "text": "def create\n if product = Product.find_by_id(sale_product_params[:product_id])\n if current_seller != product.seller\n redirect_to sale_products_path, notice: \"You are not the owner of the product.\"\n else\n @sale_product = SaleProduct.new(sale_product_params)\n @sale_product.seller = product.seller\n @sale_product.product.on_sale = true\n respond_to do |format|\n if @sale_product.save\n @sale_product.product.save\n format.html { redirect_to @sale_product, notice: 'Sale product was successfully created.' }\n format.json { render :show, status: :created, location: @sale_product }\n else\n format.html { render :new, notice: 'Sale product is invalid!' }\n format.json { render json: @sale_product.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n respond_to do |format|\n format.html { render :new, notice: 'Product does not exist!' }\n format.json { render json: @sale_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c31fe590ee30606e4cf771b51a79252", "score": "0.5249019", "text": "def buyer_reviewed?\n return self.seller_rating.present?\n end", "title": "" }, { "docid": "7be752ac0f8f4e4f4f65dddb67eddc0b", "score": "0.5241577", "text": "def restoration_ex_details_needed?\n @restoration_ex_yes_no == 'Y' && exempt_breakdown_needed?\n end", "title": "" }, { "docid": "6f2df1913c3e7eab865402bd5f28a957", "score": "0.52406096", "text": "def can_be_bought_for_solr\n result = \"no\"\n result = \"yes\" if available_for_sale == true\n result\n end", "title": "" }, { "docid": "2343a4a1b1b787ad66c3af19421cb2b9", "score": "0.5237027", "text": "def must_buy_train?(entity)\n return false if entity.id == 'PEIR'\n\n super\n end", "title": "" }, { "docid": "bb75a4d87a4be253eba513c93efed00e", "score": "0.52337974", "text": "def review?\n false\n end", "title": "" }, { "docid": "418f1f79e84bb63d072bd5ce97f6d5d1", "score": "0.52321464", "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": "9b592750207b3b1ee3ad862802ace4b5", "score": "0.52317464", "text": "def settleable?\n listing.seller.default_deposit_account?\n end", "title": "" }, { "docid": "e2ce8b5011add9923a2718fff9d1e30f", "score": "0.52306664", "text": "def show\n @sales = Sale.share_holder_is @share_holder\n end", "title": "" }, { "docid": "3962cf7eef98d3676d750c034c381de8", "score": "0.5227146", "text": "def create\n @sale = Sale.new(sale_params)\n \n \n\n respond_to do |format|\n if @sale.save\n book = Book.find(@sale.book_id)\n if @sale.trade_id != nil\n trade = Book.find(@sale.trade_id)\n trade.make_invisible\n end\n book.make_invisible\n # @book.toggle(:visibility)\n # @trade.toggle(:visibility)\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": "7337e228cb4d6b661ed1643dba355aa9", "score": "0.52176857", "text": "def discounted?\n discounted_total?\n end", "title": "" }, { "docid": "08c8930dc5afef86010a3e989d19538e", "score": "0.52155155", "text": "def can_sell?(entity, bundle)\n return unless bundle\n return false if entity != bundle.owner\n\n corp = bundle.corporation\n bought_this = @round.current_actions.uniq(&:class).size.positive? &&\n ((@round.current_actions.last.instance_of?(Action::Par) &&\n @round.current_actions.last.corporation == corp) ||\n (@round.current_actions.last.instance_of?(Action::BuyShares) &&\n @round.current_actions.last.bundle.corporation == corp))\n return false if bought_this\n\n super\n end", "title": "" }, { "docid": "08c8930dc5afef86010a3e989d19538e", "score": "0.52155155", "text": "def can_sell?(entity, bundle)\n return unless bundle\n return false if entity != bundle.owner\n\n corp = bundle.corporation\n bought_this = @round.current_actions.uniq(&:class).size.positive? &&\n ((@round.current_actions.last.instance_of?(Action::Par) &&\n @round.current_actions.last.corporation == corp) ||\n (@round.current_actions.last.instance_of?(Action::BuyShares) &&\n @round.current_actions.last.bundle.corporation == corp))\n return false if bought_this\n\n super\n end", "title": "" }, { "docid": "dddb58a802a30abad5147dab0e7c504f", "score": "0.52119243", "text": "def trigger?\n !applicable_discount.nil?\n end", "title": "" }, { "docid": "c95abbe1d7004a3969e190a59e549115", "score": "0.5200731", "text": "def can_sell?(entity, bundle)\n return false if entity != bundle.owner\n return false unless @game.check_sale_timing(entity, bundle)\n return false unless sellable_bundle?(bundle)\n return false if @game.class::MUST_SELL_IN_BLOCKS && @corporations_sold.include?(bundle.corporation)\n\n # This is our new clause for 1871, if this is the corporation\n # selling, we can sell all of them\n return true if bundle.corporation == bundle.owner\n\n selling_minimum_shares?(bundle)\n end", "title": "" }, { "docid": "ba87798e208c69dc798bfb5e15a850ec", "score": "0.52002954", "text": "def current_publisher?(article)\n article.author == current_author\n end", "title": "" }, { "docid": "f4bdd780edd21302d11338bb708d2b4c", "score": "0.5199599", "text": "def cured?\n @cured\n end", "title": "" }, { "docid": "f4bdd780edd21302d11338bb708d2b4c", "score": "0.5199599", "text": "def cured?\n @cured\n end", "title": "" }, { "docid": "f4bdd780edd21302d11338bb708d2b4c", "score": "0.5199599", "text": "def cured?\n @cured\n end", "title": "" }, { "docid": "6d526475d0e22b176d423b710f348964", "score": "0.5197482", "text": "def article?\n !!article\n end", "title": "" }, { "docid": "3b1222b429676127392922d3232117f7", "score": "0.51964253", "text": "def should_i_hide_it?\n if gizmo_context == GizmoContext.donation or gizmo_context == GizmoContext.gizmo_return or gizmo_context == GizmoContext.disbursement\n return true\n elsif gizmo_context == GizmoContext.sale\n return false\n else\n raise NoMethodError\n end\n end", "title": "" }, { "docid": "a6384e9545da653d6dd56f4d9e113a4f", "score": "0.5186119", "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": "29945213f10b77b5ee977c9abae7e1c4", "score": "0.51853544", "text": "def price_consented?\n price_consent_status == 1\n end", "title": "" }, { "docid": "38d5545ba0f67bcaecd3edec7802be47", "score": "0.5184643", "text": "def has_artists\n if Artist.all.blank?\n flash[:warning] = \"There needs to be at least one artist in the database.\"\n redirect_to artists_url\n end\n end", "title": "" }, { "docid": "050f353779e474aa5cbc9756e84fb4f7", "score": "0.5182422", "text": "def ticket?\n @item.name == \"Backstage passes to a TAFKAL80ETC concert\"\n end", "title": "" }, { "docid": "5fc08dc49a9ed888cd877674ce131c0b", "score": "0.5177623", "text": "def fully_discounted?\n adjustment_total + line_items.map(&:final_amount).sum == 0.0\n end", "title": "" }, { "docid": "69567427b4f8f23725fea94806e9d5d1", "score": "0.51754767", "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": "30ac492f416079112d5b60f7e99b4128", "score": "0.51718724", "text": "def item_satisfy?(item)\n item.product_code == @product_code\n end", "title": "" }, { "docid": "564c02c13734d076965ff4ba919c3cd6", "score": "0.51703066", "text": "def alreadyHandled art, process_type\n if (process_type == \"similar artists\")\n aStat = art.a_stat\n elsif (process_type == \"similar tracks\")\n aStat = art.aggregate_similar_tracks_stat\n end\n if (aStat == nil) \n if (process_type == \"similar artists\")\n aStat = AStat.new\n elsif (process_type == \"similar tracks\")\n aStat = AggregateSimilarTracksStat.new\n end\n \n \n aStat.altnet_id = art.id\n aStat.status = 0\n aStat.save\n puts \"inserted\"\n return false\n end\n \n if (aStat.status !=0 )\n return true\n else\n return false \n end\n end", "title": "" }, { "docid": "2add38af41ef23231b18841caa6f859b", "score": "0.5169773", "text": "def discounted?\n raise NotImplementedError # TODO\n end", "title": "" }, { "docid": "a18eea7bb8b4cadeb8d90959da90b652", "score": "0.51697683", "text": "def item_sold\n errors.add(:product, \"cannot be added to cart if they are already sold\") if product.status == 'Sold'\n end", "title": "" }, { "docid": "d190f16337a9b68db2e3a00a23aa2f35", "score": "0.5167412", "text": "def track_inventory?\n @fields[17] == 'Y'\n end", "title": "" }, { "docid": "0a5cec672382188be3c2f72d0247c080", "score": "0.5164248", "text": "def discounted?\n tickets.size == 8\n end", "title": "" }, { "docid": "7584e40738ddb4058eaf1aa343325b2b", "score": "0.5162908", "text": "def test_buying_a_product\n dave = regular_user\n dave.get \"/store/index\"\n dave.is_viewing \"index\"\n dave.buys_a @ruby_book\n dave.has_a_cart_containing @ruby_book\n dave.checks_out DAVES_DETAILS\n dave.is_viewing \"index\"\n check_for_order DAVES_DETAILS, @ruby_book\n end", "title": "" }, { "docid": "7584e40738ddb4058eaf1aa343325b2b", "score": "0.5162908", "text": "def test_buying_a_product\n dave = regular_user\n dave.get \"/store/index\"\n dave.is_viewing \"index\"\n dave.buys_a @ruby_book\n dave.has_a_cart_containing @ruby_book\n dave.checks_out DAVES_DETAILS\n dave.is_viewing \"index\"\n check_for_order DAVES_DETAILS, @ruby_book\n end", "title": "" }, { "docid": "c3dea38438b1e5eafd87133f3ace7ab2", "score": "0.51550436", "text": "def terms_accepted?\n true\n end", "title": "" }, { "docid": "37340c200ef1f2c90c140de2b8cf54b7", "score": "0.5153747", "text": "def handle_testing\n if self.for_testing?\n self.mark_as_paid\n end\n end", "title": "" }, { "docid": "d72fa9333c1c4333fe01ed6c2289e932", "score": "0.51520085", "text": "def is_discounted\n if price < 2\n return \"True\"\n else\n return \"False\"\n end\n end", "title": "" }, { "docid": "f27a4b8c98aca32fec129d00b283f2e4", "score": "0.5150634", "text": "def discount?\n raw_discount > 0\n end", "title": "" }, { "docid": "ba7629f66abee99ed2b8eafed237b657", "score": "0.5150365", "text": "def magazine?\n if @item[:item][\"volumeInfo\"][\"printType\"].upcase == \"MAGAZINE\"\n true\n else\n false\n end\n end", "title": "" }, { "docid": "154737af11c7873e92e0f62ac8d3e529", "score": "0.51475185", "text": "def artist_order_notice\n ReceiptMailer.artist_order_notice(Order.first, User.first, Artist.find_by(id: 4))\n end", "title": "" }, { "docid": "3a7fcf4832aaa566b391249373db9aae", "score": "0.5143734", "text": "def license_needs_review?(app, source, record)\n # review is not needed if the record is set as reviewed\n require_version = data_source == \"configuration\" || source.class.require_matched_dependency_version\n return false if app.reviewed?(record, require_version: require_version)\n\n # review is not needed if the top level license is allowed\n return false if app.allowed?(record[\"license\"])\n\n # the remaining checks are meant to allow records marked as \"other\"\n # that have multiple licenses, all of which are allowed\n\n # review is needed for non-\"other\" licenses\n return true unless record[\"license\"] == \"other\"\n\n licenses = record.licenses.map { |license| license_from_text(license.text) }\n\n # review is needed when there is only one license notice\n # this is a performance optimization for the single license case\n return true unless licenses.length > 1\n\n # review is needed if any license notices don't represent an allowed license\n licenses.any? { |license| !app.allowed?(license) }\n end", "title": "" }, { "docid": "b00403672b487b69e4ff20535d04ea67", "score": "0.5143139", "text": "def bot_art_me(event)\n if artists.add?(event.message.author.name) then\n event.respond \"arrite! added now! i will call u wen its drawing time!!\"\n else\n event.respond \"you want me to add you again?? okay! okay! i added you again...\"\n event.respond \"...but not really\"\n end\n end", "title": "" } ]
2e41bb6735331d8a2541e952f2e63c7b
This is called when the delete button is hit, and removes a composer from the list
[ { "docid": "0d8c506cc4146b20006a526eed0351bf", "score": "0.686716", "text": "def delete_composer\n logger.debug \"**** DELETE COMPOSER ****\"\n @composer = Role.find(params[:id])\n if params[:work_id]\n @composers = session[(\"composers_\" + params[:work_id]).to_sym]\n else\n @composers = session[:composers]\n end\n @composers.delete(@composer)\n if params[:work_id]\n session[(\"composers_\" + params[:work_id]).to_sym] = @composers\n else\n session[:composers] = @composers\n end\n \n @dom_id = generate_id(@composer)\n \n logger.debug \"Dom id is #{@dom_id}\"\n end", "title": "" } ]
[ { "docid": "57ff587210c8ab382319a5bc2a2436fa", "score": "0.68512934", "text": "def destroy\n @composer = Composer.find(params[:id])\n @composer.destroy\n\n respond_to do |format|\n format.html { redirect_to composers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b11ce644f0e096399595c67eefbeb984", "score": "0.67516845", "text": "def destroy\n @composer = Composer.find(params[:id])\n @composer.destroy\n\n respond_to do |format|\n format.html { redirect_to(composers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f7a278fbc049df514f5b4cb84892c8d0", "score": "0.656274", "text": "def destroy\n @composer.destroy\n respond_to do |format|\n format.html { redirect_to composers_url, notice: 'Composer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "850d81b64fd378d82bbc4add91f21b10", "score": "0.6145713", "text": "def remove_button_clicked()\n\t\t\t@to_delete_row = @form.folderList.currentRow\n\t\tend", "title": "" }, { "docid": "ca8c253a809ef594e326b8cc0e8fc8bf", "score": "0.6107284", "text": "def remove item\n @components.remove item\n end", "title": "" }, { "docid": "d8da73344ab4c9179c8ce72e888f10de", "score": "0.6034136", "text": "def grocery_item_deleter(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "title": "" }, { "docid": "f12717f757f2098940190e5068a86b8a", "score": "0.59754044", "text": "def remove_chosen_presenter\n self.chosen_presenter = nil\n self.save\n end", "title": "" }, { "docid": "eebf288897a22af64d063f17d8dc1123", "score": "0.59430075", "text": "def remove remove_card\r\n @card_list.remove remove_card\r\n end", "title": "" }, { "docid": "7fd591ab2c6973502523dba045b1a553", "score": "0.58841527", "text": "def remove_item\n\n end", "title": "" }, { "docid": "10e8e1fb99aac459a2e0a590d586c275", "score": "0.58780175", "text": "def remove remove_card\n @card_list.remove remove_card\n end", "title": "" }, { "docid": "95cf698432bda3e311657a1b73c486b5", "score": "0.5771711", "text": "def destroy\n @colaborattor.destroy\n respond_to do |format|\n format.html { redirect_to colaborattors_url, notice: I18n.t('messages.destroyed_with', item: @colaborattor.colaborattorname) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cfdbd0ffc8f4a397e9b6abc3206d5553", "score": "0.57546866", "text": "def contractor_remove\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the contractor\n @contractor = ContractorUser.find(params[:contractor_id])\n\n # remove the contractor\n if @contract.is_contractor?(@contractor)\n\n @contract.contractor_user=nil\n @contract.save\n \n end\n \n redirect_to edit_client_contract_path(@client, @contract, :contracts_page => @contracts_page, :status => @status)\n \n end", "title": "" }, { "docid": "b8abfc8654e0a790d35152b3b084494f", "score": "0.57511514", "text": "def remove(name)\n self.button(:title=>\"Remove contact #{name}\").click\n wait_for_ajax\n self.class.class_eval { include RemoveContactsPopUp }\n end", "title": "" }, { "docid": "51a63580898fabef603b372248c935e7", "score": "0.5747053", "text": "def remove(name)\n self.button(:title=>\"Remove contact #{name}\").click\n self.wait_for_ajax\n self.class.class_eval { include RemoveContactsPopUp }\n end", "title": "" }, { "docid": "021c8c0843c7273a171224fcedd0bfe2", "score": "0.57453316", "text": "def delete_park\n nomPark = builder.get_object(\"label_nomPark1\").text\n indexComboPark = ctrl.del_park nomPark\n\n #Maj de la combo box\n combo_main.remove_text (indexComboPark+1)\n\n #Vidage des frames\n framePan.each{|child| framePan.remove(child)}\n framePar.each{|child| framePar.remove(child)}\n\n #Changement du nom\n builder.get_object(\"label_nomPark1\").text=\"\\#Unknown\\#\"\n\n end", "title": "" }, { "docid": "cf549178bcd68f920984c95b1d142a85", "score": "0.5699413", "text": "def destroy_comic(selected_RL)\n ReadingList.destroy(selected_RL)\n puts \"Your comic has been removed from your list.\"\n end", "title": "" }, { "docid": "93f918d8c2d48470014710459a53be55", "score": "0.5688389", "text": "def delete_card\n prompt = TTY::Prompt.new\n your_cards = self.cards\n card_names = your_cards.map { |card| card[\"name\"] }\n selected_card_name = prompt.select('Choose a character to delete', card_names, filter: true, cycle: true, help: \"(Start typing to filter results)\", help_color: :green, active_color: :yellow)\n selected_card = Card.find_by(name: selected_card_name)\n choice = UserCard.find_by user_id: self.id, card_id: selected_card.id\n response = prompt.select(\"Are you sure you want to delete #{selected_card_name.upcase}?\", %w(Yes No))\n if response == \"Yes\"\n choice.destroy\n bar = TTY::ProgressBar.new(\"Deleting #{selected_card_name.upcase} [:bar]\", total: 30)\n 30.times do\n sleep(0.05)\n bar.advance(1)\n end\n puts \"#{choice.card.name.upcase} was deleted from your collection!\"\n sleep(1)\n system('clear')\n title\n else\n check_collection\n end\n end", "title": "" }, { "docid": "8d52d448895a86dd2f37a93700cae551", "score": "0.56870735", "text": "def destroy\n if @cliente.destroy\n @error = false\n @message = \"Se ha eliminado el cliente\"\n get_clientes\n else\n @error = true\n @message = \"Ha ocurrido un problema al tratar de eliminar el cliente. #{@cliente.errors.full_messages.to_sentence}\"\n end\n\n render 'reload_list', format: :js\n end", "title": "" }, { "docid": "569b309a7785191ab8ecd4c049861fc8", "score": "0.5674847", "text": "def remove_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # find the approver\n @approver = User.find(params[:user_id])\n\n # double check use is an approver\n if @contract.is_approver?(@approver)\n\n # delete them from the list\n @contract.approver_users.delete(@approver)\n \n end\n \n redirect_to edit_client_contract_path(@client, @contract)\n \n end", "title": "" }, { "docid": "63a29dfd3fd9a56599cc58b4bd6e64d8", "score": "0.5669357", "text": "def remove\n\t @pieces[chosen] -= 1\n\t update_buttons chosen\n\tend", "title": "" }, { "docid": "47a7297c153e0b4877124404a1ed0bb1", "score": "0.5652453", "text": "def remove list\n list_action list, \"remove\"\n end", "title": "" }, { "docid": "3e5f1d1eec3f082ce78c66661af1fcf8", "score": "0.5641874", "text": "def delete_creator\n # somehow search for creator based on params\n # creator = Creator.where(\"provider = ? AND p_id = ?\", params[\"provider\"], params[\"p_id\"])\n # remove creator from user's list\n # self.creators.delete(creator)\n # if the creator is no longer followed, delete it\n # creator.delete if creator.users.nil?\n end", "title": "" }, { "docid": "dccb5bc68a90323b8a5de25aa0799533", "score": "0.5636838", "text": "def manage_cars_remove_car_check\n @ui.manage_cars_remove_car_input_msg\n car_to_del_id = gets.chomp\n raise 'Unexisting car' unless cars.find { |car| car.id == car_to_del_id }\n car_del = cars.find { |car| car.car_id == car_to_del_id }\n @cars.delete(car_del)\n @cars_free.delete(car_del)\n @ui.manage_cars_remove_car_success_msg\n end", "title": "" }, { "docid": "988cf0a86ccffaa5859347e0d7e517bf", "score": "0.563008", "text": "def remove_item_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.id(\"/btnRemoveCurrentOrder\"), __method__, self)\n end", "title": "" }, { "docid": "8bfecb9f4ade6fb3263c2f196024b16c", "score": "0.5626782", "text": "def remove(*a)\n # event is namespaced to not accidently trigger closing the dialog box\n select(*a).trigger('clockwork.remove')\n select(*a).remove()\n end", "title": "" }, { "docid": "cf2df538caecd00df5adf58dedd4e36b", "score": "0.56218", "text": "def destroy\n @component = Component.find(params[:id])\n\tEntry.tagged_with(@component.tag).each do |entry|\n\t\tentry.comp_list.remove(@component.tag)\n\t\tentry.tags_string = tasks_string(entry) + \" \" + comps_string(entry) + \" \" + systems_string(entry)\n\t\tentry.save\n\tend\n\t@component.destroy\n\tredirect_to admin_edit_form_path\n end", "title": "" }, { "docid": "bafd64db741d7bbfb4fa9dc3ecd15520", "score": "0.5616097", "text": "def delete_item (grocery, item_name)\n grocery.delete(item_name)\n display_list(grocery)\n end", "title": "" }, { "docid": "2f075bef94e57794636a97d552aaca00", "score": "0.5613869", "text": "def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end", "title": "" }, { "docid": "dcd6e7c9564a6c2acfcbbbdaedbfd06f", "score": "0.5611817", "text": "def remove_actor(actor_id)\r\n # アクターを削除\r\n @actors.delete($game_actors[actor_id])\r\n # プレイヤーをリフレッシュ\r\n $game_player.refresh\r\n end", "title": "" }, { "docid": "dda61164ef1ed75b7f02a5bbd5351bdc", "score": "0.56078124", "text": "def destroy\n @composing.destroy\n respond_to do |format|\n format.html { redirect_to composings_url, notice: 'Composing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c5941b5475e62d8acfc52dd27830143", "score": "0.5597241", "text": "def destroy\n @driverslist.destroy\n respond_to do |format|\n format.html { redirect_to driverslists_url, notice: 'Driverslist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a0d5b35d31802a428a3fba3da78b3f7c", "score": "0.5588056", "text": "def destroy\n @order_item_extra.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "c69c73a69d0f04db604e378ef5db191a", "score": "0.558463", "text": "def destroy\n @drivers_licesnse.destroy\n respond_to do |format|\n format.html { redirect_to drivers_licesnses_url, notice: 'Drivers licesnse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c7dea44e60687cc9bde9496b12b4c249", "score": "0.5575707", "text": "def destroy\n\n @coference.destroy\n respond_to do |format|\n format.html { redirect_to menu_extension_1_path, notice: 'La actividad se elimino con exito.' }\n format.json { head :no_content }\n end\n\n end", "title": "" }, { "docid": "bd3ed5bc9da53adc68ead1783876d20a", "score": "0.5574997", "text": "def destroy\n @prov_composer_bios = ProvComposerBios.find(params[:id])\n @prov_composer_bios.destroy\n\n respond_to do |format|\n format.html { redirect_to prov_composer_bios_url }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "12e0c9e4a326c41550fcff105727b8cf", "score": "0.557215", "text": "def delete_factor()\n delete.click\n modal_delete_factor.click\n end", "title": "" }, { "docid": "5815d57d2b9c167a440de8f125b9dfe2", "score": "0.5570459", "text": "def destroy\n @editor_pick.destroy\n respond_to do |format|\n format.html { redirect_to editor_picks_url, notice: 'Editor pick was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c40b3e6af721cda6bc32840032304142", "score": "0.55637723", "text": "def destroy\n @pick_item.destroy\n respond_to do |format|\n format.html { redirect_to pick_items_url, notice: '删除成功.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e56e1f63f263126df09b248958913c9b", "score": "0.5558491", "text": "def delete_widget widget\n @widgets.delete widget\n end", "title": "" }, { "docid": "e56e1f63f263126df09b248958913c9b", "score": "0.5558491", "text": "def delete_widget widget\n @widgets.delete widget\n end", "title": "" }, { "docid": "0a9290c43f55f0f7b121985f997fcf68", "score": "0.5557756", "text": "def destroy\n @addon_list_item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "61f2ebdcdde99424586511c78ce6ea24", "score": "0.5554907", "text": "def remove\n super\n update_tabs\n end", "title": "" }, { "docid": "a8102e2551a561188ac1ead81a904838", "score": "0.5547794", "text": "def remove\r\n self.update(deleted: true)\r\n end", "title": "" }, { "docid": "fe1e7b6ff4748cd12ceac612013c486f", "score": "0.5545655", "text": "def remove_item\n part = Part.find(params[:part_id])\n order = Order.find(params[:order_id])\n respond_to do |format|\n if part && order\n list_item = PartsInOrder.find_by({part_id: part.id, order_id: order.id})\n if list_item\n list_item.destroy!\n msg = { :status => \"ok\", :message => \"Success!\"}\n format.json { render json: msg }\n else\n msg = { :status => \"error\", :message => \"This Part is not in this order!\"}\n format.json { render json: msg }\n end\n else\n msg = { :status => \"error\", :message => \"Missing Part or Order in the DB!\"}\n format.json { render json: msg }\n end\n end\n end", "title": "" }, { "docid": "a84dcf3d7d358f642e6a3780b928e99e", "score": "0.5543639", "text": "def delete_movie_from_list(arg)\n puts \"You've removed #{arg.title} from your list.\"\n arg.destroy\n main_menu_options\n end", "title": "" }, { "docid": "f3cecda60f89d4d416442dba61134017", "score": "0.5540769", "text": "def destroy\n @client = clients.find(params[:id])\n @client.destroy\n redirect_to(user_company_clients_url(current_company))\n end", "title": "" }, { "docid": "713b60a835102022f2b84fcc66478d73", "score": "0.55396724", "text": "def destroy\n @pick_list.destroy\n respond_to do |format|\n format.html { redirect_to pick_lists_url, notice: 'Pick list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5828d9962f0715e68eb3bba5a13f5e8", "score": "0.55384994", "text": "def remove_item(grocery_list,item_name)\r\n\t \r\n\t grocery_list.delete(item_name)\r\n\r\nend", "title": "" }, { "docid": "f980a4cfa5155fc92176eb24466ddb77", "score": "0.5532351", "text": "def delete\n # TODO: implement delete\n end", "title": "" }, { "docid": "3a796166b1c9a2288f49cf2269a2b067", "score": "0.5530096", "text": "def remove(grocery_list, item)\n grocery_list.delete(item)\nend", "title": "" }, { "docid": "96289be8ac40eabef5dffe4b57e2d8ec", "score": "0.5520741", "text": "def destroy\n @match_pick.destroy\n respond_to do |format|\n format.html { redirect_to match_picks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cf469d015840667eee18366c7bb6ab08", "score": "0.5518597", "text": "def remove; end", "title": "" }, { "docid": "cf469d015840667eee18366c7bb6ab08", "score": "0.5518597", "text": "def remove; end", "title": "" }, { "docid": "cf469d015840667eee18366c7bb6ab08", "score": "0.5518597", "text": "def remove; end", "title": "" }, { "docid": "cf469d015840667eee18366c7bb6ab08", "score": "0.5518597", "text": "def remove; end", "title": "" }, { "docid": "79f6c1dc625b7028742c1da69decc7cf", "score": "0.55016255", "text": "def delete\n \n end", "title": "" }, { "docid": "01e8ade60ec1ff1fe02b7610466fcec4", "score": "0.55013704", "text": "def destroy\n @company_client.destroy\n respond_to do |format|\n format.html { redirect_to company_clients_url, notice: 'Клиент был успешно удален' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7aa558d9758ef66169b60ee185d8c30b", "score": "0.5501364", "text": "def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_comics_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2cbc95e36cfd10ec28607c4dbd7d1ae4", "score": "0.5500048", "text": "def destroy #remove_score_item\n elem = \"score_item_\" << params[:id]\n\n ScoreItem.destroy(params[:id])\n # if ScoreItem.destroy(params[:id])\n # render :update do |page|\n # page[elem].visual_effect :blind_up\n # page[elem].remove\n # end\n # end\n end", "title": "" }, { "docid": "c13dea77f2e7d0efce904406fcb14f87", "score": "0.5497669", "text": "def destroy\n @cordinator.destroy\n respond_to do |format|\n format.html { redirect_to cordinators_url, notice: 'El cordinador se ha eliminado correctamente' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7d900f6ffe553dbf065f33879dc12921", "score": "0.54963124", "text": "def remove_item(grocery_list, rem_item)\r\n grocery_list.delete(rem_item)\r\n p grocery_list\r\nend", "title": "" }, { "docid": "ee201187d48a5f5b7ba4b0ab0eeb0cd4", "score": "0.5496138", "text": "def destroy\n @partnership = Partnership.find(params[:id])\n @partnership.destroy\n head :no_content\n end", "title": "" }, { "docid": "5ca054a173142cf9e334ab2b7a46bbe2", "score": "0.5490113", "text": "def destroy\r\n @composition.destroy\r\n head :no_content\r\n end", "title": "" }, { "docid": "bfbed270ede34e06ddf53d3b5ecf8ef7", "score": "0.5488894", "text": "def destroy\n @order_pick = OrderPick.find(params[:id])\n @order_pick.destroy\n\n respond_to do |format|\n format.html { redirect_to order_picks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7f3babf7fec04bd1aa6716837d4647b5", "score": "0.5483542", "text": "def destroy\n if PcbProject.exists?(:pcb_id=>@pcb.id)\n\tflash[:error]=\"PCB is used in a project. Remove from project first\"\n\tredirect_to @pcb\n\telse\n \t\torg_name = @pcb.sch_file\n \t\torg_name2 = @pcb.brd_file\n \t\torg_name3 = @pcb.photo\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name));\n \t\t rescue => ex\n \t\tend\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name2));\n \t\t rescue => ex\n \t\tend\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name3));\n \t\t rescue => ex\n \t\tend\n\t\t@pcb.destroy\n\t\trespond_to do |format|\n\t\t format.html { redirect_to pcbs_url, notice: 'Pcb deleted' }\n\t\t format.json { head :no_content }\n\t\tend\n\tend\n end", "title": "" }, { "docid": "2c8d11e3cc2b652122eaae18b6f78dc6", "score": "0.5482187", "text": "def destroy\n #@food_item automatically set to FoodItem.find(params[:id])\n\n @food_item.destroy\n\n respond_to do |format|\n if request.xhr?\n format.html { render partial: 'shared/undo_button', locals: {version_id: @food_item.versions.last.id}}\n else\n format.html { redirect_to food_items_url, notice: 'Food item deleted successfully'}\n end\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "39e1a7e7319c8d4891f09c7913313b92", "score": "0.54810107", "text": "def destroy\n @partnership.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d6a2e6b807c8dde713b49cf628a6b0b9", "score": "0.54782116", "text": "def destroy\n @companion.destroy\n respond_to do |format|\n format.html { redirect_to companions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "decada714db52551eb4e4663eeda7963", "score": "0.54728884", "text": "def tradeoff_product_remove\n choice = Choice.find(params[:id]) \n choice.tips.clear\n render :update do |page|\n page.replace_html(\"dropzone_choice_#{choice.id}\", \"\")\n end\n end", "title": "" }, { "docid": "f0cd99031fcfdbdbde518b18ec27b3ba", "score": "0.54628277", "text": "def destroy\n # Display list with indices\n recipes = @cookbook.all\n # Ask user for index\n index = @view.ask_user_for_index(recipes)\n # Remove from cookbook\n @cookbook.remove_recipe(index - 1)\n end", "title": "" }, { "docid": "3775a3931bee23bfb3c92385507dfd38", "score": "0.5455973", "text": "def destroy\n @fp7_contractor.destroy\n respond_to do |format|\n format.html { redirect_to fp7_contractors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ca2023e36ba4d4cac60dab181d854817", "score": "0.54528606", "text": "def destroy\n @comic.destroy\n redirect_to :back\n end", "title": "" }, { "docid": "787e7670c53c35794946e65cae91ab9c", "score": "0.54509133", "text": "def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end", "title": "" }, { "docid": "3dab62fe2c703e1d39c2a64a81ab2cb6", "score": "0.5449656", "text": "def destroy\n @choice.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "3d31aee5693f6061c21564fdbf5e0915", "score": "0.5445939", "text": "def destroy\n @vendor_part = VendorPart.find(params[:id])\n @vendor_part.destroy\n\n respond_to do |format|\n format.html { redirect_to vendor_parts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "124a24f0de5694f88721fc348482d200", "score": "0.54442763", "text": "def remove plataform\n end", "title": "" }, { "docid": "b0515924eeac76a3b6d06b076ead709c", "score": "0.54414415", "text": "def remove_item(grocery_list, item)\r\n grocery_list.delete(item) \r\n \r\nend", "title": "" }, { "docid": "518466b87db71feb279646c0cb9200a0", "score": "0.543986", "text": "def destroy\n capitol_id = @capitol.id\n licenta_id = @capitol.licenta_id\n numar = @capitol.numar\n @capitol.destroy\n\n # actualizeaza numerele la restul capitolelor de dupa asta distrus\n @capitole = Capitol.where(\"licenta_id = ? and numar > ?\", \"#{licenta_id}\", \"#{numar}\")\n if @capitole.count > 0\n @capitole.each do |cap|\n cap.update_attributes(numar: cap.numar-1)\n end\n end\n\n # sterge si todo-urile capitolului aluia din baza de date\n Todo.where(capitol_id: capitol_id).delete_all\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "64ee1583bc8bb7e4d700bdda1d63171f", "score": "0.54383874", "text": "def remove_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/, :id=>/_remove_/).button.click\n end", "title": "" }, { "docid": "ae3279da3334ff40fd46e5971ba86b54", "score": "0.54381245", "text": "def destroy\n @maintenance_item = MaintenanceItem.find(params[:id])\n @binder = Binder.find(@maintenance_item.binder_id)\n \n authorize! :destroy, @maintenance_item\n \n binder_id = @maintenance_item.binder_id\n @maintenance_item.destroy\n @maintenance_items = MaintenanceItem.where(:binder_id => binder_id).order(\"name\")\n\n respond_to do |format|\n format.html { redirect_to binder_maintenance_items_path(Binder.find(binder_id)) }\n format.json { head :no_content }\n format.js\n end\n end", "title": "" }, { "docid": "be0db64c0ae28054970f19fe77d989c4", "score": "0.54293597", "text": "def delete_item(item)\n @chores.delete(item)\n end", "title": "" }, { "docid": "12e7bf5a58036d82497d634a0ff5a38b", "score": "0.5424313", "text": "def remove_book(selected)\n\tb = Book.find(selected)\n\tb.destroy\nend", "title": "" }, { "docid": "24615d9b2dc25417d8464260b34cbfe8", "score": "0.54218876", "text": "def remove_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find(params[:collaborator_id])\n @project.users.delete(@collaborator)\n\n redirect_to project_path(@project), :alert => \"Supervisor is deleted successfully\"\n end", "title": "" }, { "docid": "edf3febea581abbb39585c72857037c3", "score": "0.54196817", "text": "def destroy\n @group_addon_list.destroy\n respond_to do |format|\n format.html { redirect_to group_addon_lists_url, notice: 'Group add on list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "808357163a7fb714f06d0b2080b01f4e", "score": "0.54136056", "text": "def delete\n self.class.delete(\"evss_dependents_retrieve_#{@user.uuid}\")\n end", "title": "" }, { "docid": "4192b034d8e919afb45470e9e7d52b14", "score": "0.5411977", "text": "def delete_from(grocery, item)\n grocery.delete(item)\n grocery\nend", "title": "" }, { "docid": "e8275726258e9bd020771df3c6503496", "score": "0.5410362", "text": "def destroy\n @selecionado.destroy\n respond_to do |format|\n format.html { redirect_to selecionados_url, notice: 'Selecionado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08821c78ef3c97e9908fb69692335556", "score": "0.54088026", "text": "def delete_dosing_factor()\n delete.click\n modal_delete_factor.click\n end", "title": "" }, { "docid": "d7db38bb0e915bf131d98395b11972d5", "score": "0.5407911", "text": "def grocery_deleter(groceries,item_delete)\n\n\tgroceries.delete(item_delete)\n\n\treturn groceries\n\nend", "title": "" }, { "docid": "db402cc46a20dd91f3ed5e0a7152801c", "score": "0.54058444", "text": "def remove(prep_id)\n\t\t@kb.delete_at(prep_id)\n\tend", "title": "" }, { "docid": "e3742a7f3cf6eced4af24264277daf3b", "score": "0.54047865", "text": "def remove!\n destroy\n end", "title": "" }, { "docid": "bf26398c50f686380da195f28e557619", "score": "0.5401085", "text": "def removeItemFromBackpack _obj, _args\n \"_obj removeItemFromBackpack _args;\" \n end", "title": "" }, { "docid": "8e2330d1297caef7e95b0490e2aa9d81", "score": "0.5397517", "text": "def destroy\n @binder_contractor = BinderContractor.find(params[:id])\n @binder = Binder.find(@binder_contractor.binder_id)\n \n authorize! :destroy, @binder_contractor\n \n @deleteId = @binder_contractor.id\n @binder_contractor.destroy\n @binder_contractors = working_binder.binder_contractors\n \n respond_to do |format|\n format.html { redirect_to binder_contractors_url }\n format.json { head :no_content }\n format.js\n end\n end", "title": "" }, { "docid": "ae9278cca07d157571cd86221d21e0c2", "score": "0.53931165", "text": "def brief_vendor_del_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n item = brief_vendor.items.find_by_parent_id(params[:item_id])\n\n item.destroy\n\n redirect_to(cheil_brief_vendor_items_url(params[:brief_id],params[:vendor_id])) \n end", "title": "" }, { "docid": "c59067a6f361e835507a0a7eb16b667e", "score": "0.5392328", "text": "def destroy\n \t@competitor = Competitor.find(params[:id])\n \t@competitor.destroy\n \tredirect_to competitors_path\n end", "title": "" }, { "docid": "58be96573ffac53bfb1f5053490b0639", "score": "0.53905934", "text": "def remove_data!\n connector.remove_torrent @ids, true\n @deleted = true\n end", "title": "" }, { "docid": "9217a426b4f30b36b4041fb5cbe44dac", "score": "0.53876543", "text": "def remove_item(item)\n $grocery_list.delete(item)\n # puts \"List with #{item} deleted\"\n $grocery_list\nend", "title": "" }, { "docid": "7e1a1dc5a93deda66752a8bb8ccf70cb", "score": "0.53846514", "text": "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Данные по клиенту удалены.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "36a3b5eea74a10b39ab1503b084e5dab", "score": "0.5383348", "text": "def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend", "title": "" }, { "docid": "36a3b5eea74a10b39ab1503b084e5dab", "score": "0.5383348", "text": "def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend", "title": "" } ]
e2c4f37f39fe94f7904b5dbb7e3e9153
Returns the list of objects browsable through all pages with the current filters. Should only be called after the +grid+ helper.
[ { "docid": "ddc3a19526fe129a5a707e0f5e7b899d", "score": "0.61890036", "text": "def all_pages_records\n raise WiceGridException.new('all_pages_records can only be called only after the grid view helper') unless self.view_helper_finished\n resultset_without_paging_with_user_filters\n end", "title": "" } ]
[ { "docid": "1582d7ea23d166dbb23da73768c0e0c5", "score": "0.6426723", "text": "def all_current_filters\n res = []\n\n # need to eager load customers and milestones, so using custom finder here \n proj_permissions = current_user.project_permissions.all(:include => { :project => [ :customer, :milestones ] })\n projects = proj_permissions.map { |pp| pp.project }.uniq\n selected_filters_for(:project, projects).each do |value, id|\n res << link_to_remove_filter(:filter, _(\"Project\"), value, id)\n end\n\n customers = projects.map { |p| p.customer }.uniq\n customers = customers.sort_by { |c| c.name.downcase }\n selected_filters_for(:customer, customers).each do |value, id|\n res << link_to_remove_filter(:filter, _(\"Client\"), value, id)\n end\n\n milestones = projects.inject([]) { |array, project| array += project.milestones }\n selected_filters_for(:milestone, milestones).each do |value, id|\n res << link_to_remove_filter(:filter, _(\"Milestone\"), value, id)\n end\n\n selected_status_names_and_ids.each do |value, id|\n res << link_to_remove_filter(:filter_status, _(\"Status\"), value, id)\n end\n\n selected_user_names_and_ids.each do |value, id|\n res << link_to_remove_filter(:filter_user, _(\"User\"), value, id)\n end\n\n current_user.company.properties.each do |property|\n filter_name = property.filter_name\n filter_ids = TaskFilter.filter_ids(session, filter_name)\n values = property.property_values\n selected = values.select { |pv| filter_ids.include?(pv.id) }\n objects_to_names_and_ids(selected, :name_method => :value).each do |value, id|\n res << link_to_remove_filter(filter_name, property.name, value, id)\n end\n end\n\n return res\n end", "title": "" }, { "docid": "a7d2e3c60d44637175532e758c673e03", "score": "0.6400587", "text": "def list\n @objects = @object_class.page params[:page]\n end", "title": "" }, { "docid": "bc375bd77de8914410fe9eee28c3558a", "score": "0.6384971", "text": "def prepare_show\n @page = params[:page] || 1\n types = CollectionItem.types\n @collection_item_scopes = [[I18n.t(:selected_items), :selected_items], [I18n.t(:all_items), :all_items]]\n @collection_item_scopes << [I18n.t(\"all_#{types[@filter.to_sym][:i18n_key]}\"), @filter] if @filter\n collection_ids = recently_visited_collections(@collection.id)\n get_collection_objects(collection_ids) unless collection_ids.nil?\n end", "title": "" }, { "docid": "4595691f8f4cd86fd0f741853e7fd82b", "score": "0.6380756", "text": "def page_list\n Page.active.all\n end", "title": "" }, { "docid": "633572da0c05ee5856eebb94db9276a3", "score": "0.6337152", "text": "def list\n @objects = @model.paginate :per_page => @model.per_page, :page => params[:page]\n end", "title": "" }, { "docid": "208e54865f37b6926b30b9f31aebfc64", "score": "0.625308", "text": "def get_paginated_collection\n model.all(@options)\n end", "title": "" }, { "docid": "f26a4ff0c13e0d7252472b6fe18707bc", "score": "0.62384367", "text": "def index\n @pick_item_filters = PickItemFilter.order(:user_id).paginate(:page=>params[:page])\n end", "title": "" }, { "docid": "dbc82530efcc29f0876b74173b905893", "score": "0.62196237", "text": "def all_pages_records\n raise WiceGridException.new(\"all_pages_records can only be called only after the grid view helper\") unless self.view_helper_finished\n resultset_without_paging_with_user_filters\n end", "title": "" }, { "docid": "a34074412059abc634ae3a6516fe7366", "score": "0.6207892", "text": "def filter\n @pages = @page_collection.latest_page_search_results\n render partial: \"chemistry/page_collections/filtered\", layout: false\n end", "title": "" }, { "docid": "838d535f99538f00cc7e807512ed9b70", "score": "0.6022185", "text": "def index\n @items = Item.all.page(params[:page]).per(9)\n @filtered_data = Array.new\n end", "title": "" }, { "docid": "1c10bf7ed2541628ef38fd6ae6f92cd2", "score": "0.6008023", "text": "def index\n @data_filters = DataFilter.search(params[:search], params[:page], current_user)\n @paginated_objects = @data_filters\n params[:list_conditions] = 'all'\n session[:page] = params[:page] || 1 \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @all_viewable_data_filters }\n end\n end", "title": "" }, { "docid": "a679bf337bfe03aa61745f885cda8b6e", "score": "0.59976363", "text": "def collection\n @collection ||= end_of_association_chain.paginate :conditions => 'visible = 1', :page => params[:page], :per_page => 10, :order => 'created_at DESC'\n end", "title": "" }, { "docid": "12e497c88aac2851598c18ca1a74c58d", "score": "0.5990233", "text": "def each(filters = filters)\n begin\n page = self.all(filters)\n # We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion\n base_each = Fog::Collection.instance_method(:each)\n base_each.bind(page).call {|snapshot| yield snapshot}\n end while self.filters[:marker]\n end", "title": "" }, { "docid": "570089e498c3decbe320b6b4f1ec8129", "score": "0.598895", "text": "def index\n @active_items = Item.active.alphabetical.paginate(:page => params[:page]).per_page(9)\n @active_bread = Item.active.alphabetical.for_category(\"bread\").paginate(:page => params[:page]).per_page(6)\n @active_pastries = Item.active.alphabetical.for_category(\"pastries\").paginate(:page => params[:page]).per_page(6)\n @active_muffins = Item.active.alphabetical.for_category(\"muffins\").paginate(:page => params[:page]).per_page(6)\n if logged_in? && !current_user.role?(:customer)\n @inactive_items = Item.inactive.alphabetical.paginate(:page => params[:page]).per_page(10)\n end \n end", "title": "" }, { "docid": "576c71affb6caefe07bb82ee076315d0", "score": "0.5986034", "text": "def current_objects\n @page = params[:page] && params[:page].to_i || 1\n @per_page = 20\n which = is_admin? ? current_model : current_model.approved\n if params[:user_id]\n @user = User.find_by_param(params[:user_id])\n which = which.by_user(@user.id)\n #TODO: set page_title etc. Also handle all this logic less if/elsify\n end\n @visualizations ||= which.paginate(page: @page, per_page: @per_page, include: [:user], order: 'approved_at DESC, name ASC')\n end", "title": "" }, { "docid": "bbb2a1a0ed94d00b89857c314a02449e", "score": "0.59798807", "text": "def list #index all sub_inspectors\n @grid = initialize_grid(MODEL_NAME.where(status: \"A\"), per_page: 4) #wice grid\n authorize! :show, params[:controller] \n end", "title": "" }, { "docid": "fa92b513524a3ee4a7437fab3bf786bc", "score": "0.5950699", "text": "def fetch_pages\n items = all\n list = graph.get_objects(items.map(&:page_id), { fields: [:id, :name, :picture] }) rescue {}\n items.each do |item|\n item.page = list[item.page_id.to_s]\n end\n items\n end", "title": "" }, { "docid": "4868f1986e2a68d89a72bed2db80881f", "score": "0.59437925", "text": "def items_for_current_page\n\t\tcp = current_page_number\n\t\traise PageNumberOutOfRange.new( \"Page Number: #{cp} is out of range: 1..#{count_pages}\" ) unless valid_page_number?( cp )\n\t\titems_on_page( cp )\n\tend", "title": "" }, { "docid": "11f2a380ee4d68a345b2787cfa2983b9", "score": "0.5941283", "text": "def all\n fail NoMethodError, \"Resource #{name} does not expose .all\" unless exposed_method?(:all)\n list = []\n page_count.times do |i|\n list += page(i + 1)\n end\n list\n rescue NotFound\n []\n end", "title": "" }, { "docid": "c2f30cf125e50a9c0b3fcd72053ca17f", "score": "0.5924854", "text": "def do_list\n list = if options[:all]\n wf.list(ALL_PAGE_SIZE, :all)\n else\n wf.list(options[:offset] || 0, options[:limit] || 100)\n end\n\n respond_to?(:list_filter) ? list_filter(list) : list\n end", "title": "" }, { "docid": "a57e7e59f89efde32c1c4c2686eb75dd", "score": "0.5917647", "text": "def index\n @batch_items = BatchItem\n .order(sort_column + ' ' + sort_direction)\n .where(batch_id: @batch.id)\n .page(params[:page]).per(params[:per_page])\n .includes(:collection)\n end", "title": "" }, { "docid": "583fe6052621a27b925f0b43238001f6", "score": "0.5906442", "text": "def index\n @filter = SupplierFilter.new(filter_params)\n @suppliers = @filter.call.page(params[:page])\n end", "title": "" }, { "docid": "1ea7508ec089d30db959d1fc24723dc0", "score": "0.5905635", "text": "def index\n page = params[:page] || 1\n @combos = Combo.order(:id).page page\n end", "title": "" }, { "docid": "20d8453b84dd221ce1fbaa1686ee6289", "score": "0.59043574", "text": "def visible_pages\n Page.find_all_by_comic_id_and_is_shown(self.id, 1, :order => :sequence)\n end", "title": "" }, { "docid": "874afc8eef242e4a46bd56e9915ded9b", "score": "0.59033537", "text": "def table_listing\n link_to_create \n blank_slate\n if collection.any?\n table class: collection_class do\n if respond_to?(:any_filters?) and any_filters?\n p class:'lead' do\n text \"found #{pluralize(collection.limit(nil).count, resource_name.titlecase)} that match your filters:\"\n end\n end\n table_header\n each_item &method(:row)\n if after_table = self.class.after_table_block\n instance_exec &after_table\n end\n end\n pagination\n end \n end", "title": "" }, { "docid": "4744f92ed73e786cb0305a892a5fe89b", "score": "0.5901894", "text": "def index\n @page_objects = PageObject.all\n end", "title": "" }, { "docid": "00f101d176c6ac46dad4ca4f7e421507", "score": "0.5894543", "text": "def current_objects\n \n # If we have a device id param then we can filter on it\n if params[:device_id]\n @current_objects ||= parent_object.statements.with(:application).on(params[:device_id]).paginate(paging_params)\n else\n @current_objects ||= parent_object.statements.with(:application).paginate(paging_params)\n end\n end", "title": "" }, { "docid": "af649819f006d1c93d8aa95560a0c031", "score": "0.5890188", "text": "def all\n all_in_visible.to_a\n end", "title": "" }, { "docid": "fc7b4f432ce0afa220096b794ebbdf5e", "score": "0.587624", "text": "def index\n @processor_coolers = ProcessorCooler.paginate(page: params[:page], per_page: 4)\n end", "title": "" }, { "docid": "4a8fbda19093530ee3e504d493b7dd47", "score": "0.5873307", "text": "def each(filters_arg = filters)\n if block_given?\n begin\n page = self.all(filters_arg)\n # We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion\n base_each = Fog::Collection.instance_method(:each)\n base_each.bind(page).call { |snapshot| yield snapshot }\n end while self.filters[:marker]\n end\n self\n end", "title": "" }, { "docid": "ede07eacb1578107bf0c0b0f0e7eb3e5", "score": "0.5867025", "text": "def find_collection_for_pagination(model, conditions, order_by, paginator)\n model.find_all(conditions, order_by, paginator.current.to_sql)\n end", "title": "" }, { "docid": "55148067ef534070eb951e411f267c05", "score": "0.5840419", "text": "def mostly_active(page = 1)\n paginate(:all, :page => page,\n :per_page => RASTER_PER_PAGE,\n :conditions => conditions_for_mostly_active)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "59f63b00512e222c99efc445795e954a", "score": "0.5836632", "text": "def all\n PaginatedResource.new(self)\n end", "title": "" }, { "docid": "cf6e6831f32d3554371d338a52afc91b", "score": "0.58297133", "text": "def index\n @breadcrumbs = [['Batches']]\n @batches = @batches.order(:name).page(params[:page]).decorate\n end", "title": "" }, { "docid": "0ce12a678f702e2b706603168e7d3c59", "score": "0.58277285", "text": "def index\n @policy_scope = policy_scope(resource_scope)\n @filter_scope = filter_scope(@policy_scope)\n @sorted_scope = sort_scope(@filter_scope)\n @pagination_object = paginate_scope(@sorted_scope, page_params)\n\n render({\n json: @pagination_object.results,\n root: collection_root_key,\n each_serializer: serializer_klass,\n meta: {\n page: @pagination_object.page_meta,\n sort: sorting_meta(@filter_scope)\n }\n })\n end", "title": "" }, { "docid": "82a7ca60080137fef7dbd90234f597d6", "score": "0.5818737", "text": "def index\n @all_billings = PatientBillingInfo.joins(:billing_info_bill_items)\n .where(\"patient_billing_infos.active_status is true and patient_billing_infos.del_status is false\").distinct\n .paginate(:page => params[:page], :per_page => 30).order('patient_billing_infos.created_at desc')\n end", "title": "" }, { "docid": "444f0c7b491f09a56c07f2ab8b446356", "score": "0.5811662", "text": "def index\n @pagy, @books = pagy(Book.where(approved: true).order(params[:sort]).all, items: 10)\n end", "title": "" }, { "docid": "9090c68990fb5413f9a7cf8895b8bf8b", "score": "0.5807088", "text": "def filter\n @pages = @page_category.latest_page_search_results\n render partial: \"chemistry/page_categories/filtered\", layout: false\n end", "title": "" }, { "docid": "9627a92befee8f2aeee80af5cc1db8b1", "score": "0.5783083", "text": "def index\n @organization_charge_others = @model_class.all.page params[:page]\n end", "title": "" }, { "docid": "f6966c370eefcd072ba387a57862198c", "score": "0.5779443", "text": "def list_all\n return render_too_many_results if too_many_results\n return index_query_results if params.include?(:by)\n\n query = create_query(:Image, :all, by: default_sort_order)\n show_selected_images(query)\n end", "title": "" }, { "docid": "fa0166b908608b4f1a2b12b4fb365916", "score": "0.5777526", "text": "def index\n @bills = Bill.paginate(:page => params[:page]).order('id').per_page(5)\n end", "title": "" }, { "docid": "29f26b68915a6f948517fe6ec6aa8dee", "score": "0.57763356", "text": "def list\r\n\r\n @restricted_fields = []\r\n pagin_opts = {:include => []}\r\n pagin_opts[:page]\t = params[:page].to_i > 0 ? params[:page].to_i : 1\r\n pagin_opts[:per_page]\t = (params[:per_page] || cookies[:smart_queries_per_page] || 50).to_i\r\n pagin_opts[:order]\t = @default_order if @default_order\r\n pagin_opts[:order]\t||= 'smart_queries.' +params[:sort_by] if !params[:sort_by].blank?\r\n pagin_opts[:conditions] ||= @default_filter if @default_filter\r\n pagin_opts[:conditions] ||= params[:conditions] if params[:conditions].is_a?(Hash)\r\n pagin_opts[:joins]\t||= @joins_fields || []\r\n\r\n @smart_queries = SmartQuery.paginate(pagin_opts)\r\n render(:xml => @smart_queries.to_xml(:dasherize => false, :only => [:id,:name,:table_sid,:joining_criteria,:criteria])) and return if params[:format] == 'xml'\r\n render(:json => @smart_queries) and return if params[:format] == 'json'\r\n render(:pdf => @smart_queries, :action => :list) and return if params[:format] == 'pdf'\r\n if !params[:group_by].blank? && [\"name\", \"table_sid\"].include?(params[:group_by])\r\n @smart_queries_groups = @smart_queries.inject({}) { |acc,elt|\r\n crit = nil\r\n if [].include?(params[:group_by])\r\n crit = elt.send(params[:group_by]) ? elt.send(params[:group_by]).disp_name : nil\r\n else\r\n crit = elt.attributes[params[:group_by]]\r\n end\r\n acc[crit] ||= []\r\n acc[crit] << elt\r\n acc\r\n }\r\n end\r\n end", "title": "" }, { "docid": "385070da7a701ca219bd06a9820c7dcd", "score": "0.5767257", "text": "def mostly_active(page = 1)\n paginate(:all, :page => page,\n :per_page => RASTER_PER_PAGE,\n :conditions => conditions_for_mostly_active,\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "2c46ae5f521eb2db6a6d1578314cfcb9", "score": "0.57670546", "text": "def return_objects_using_filter(collection, filter_hash)\n # setup_data\n @data.fetch_objects_by_filter(filter_hash, collection)\n end", "title": "" }, { "docid": "385070da7a701ca219bd06a9820c7dcd", "score": "0.5767009", "text": "def mostly_active(page = 1)\n paginate(:all, :page => page,\n :per_page => RASTER_PER_PAGE,\n :conditions => conditions_for_mostly_active,\n :order => \"created_at DESC\")\n end", "title": "" }, { "docid": "4c1c2079e9ad56620701ed7e51b25c78", "score": "0.5760701", "text": "def index\n add_breadcrumb \"Invoices\", :accounts_invoices_path, { :title => \"Invoices\" }\n # @accounts_invoices = AccountsInvoice.paginate(page: params[:page], :per_page => Settings.pagination_per_page)\n invoice_scope = AccountsInvoice.all\n invoice_scope = invoice_scope.like(params[:filter]) if params[:filter]\n @accounts_invoices = smart_listing_create(:accounts_invoices,\n invoice_scope,\n partial: \"accounts_invoices/listing\",\n default_sort: { invoice_date: \"desc\" })\n end", "title": "" }, { "docid": "caf70e470c0d343b8244d8525a0e7eeb", "score": "0.5748825", "text": "def return_objects_using_filter(collection, filter_hash)\n @data.fetch_objects_by_filter(collection, filter_hash)\n end", "title": "" }, { "docid": "087f260c35cf19401a18d7285e5bbe66", "score": "0.5742906", "text": "def build_collection_items\n @per_page = @view_as.max_items_per_page || 50\n @collection_results = @filter == 'editors' ? [] :\n @collection.items_from_solr(:facet_type => @filter, :page => @page, :sort_by => @sort_by, :per_page => @per_page, :view_style => @view_as)\n @collection_items = @collection_results.map { |i| i['instance'] }\n if params[:commit_select_all]\n @selected_collection_items = @collection_items.map {|ci| ci.id.to_s }\n end\n end", "title": "" }, { "docid": "ec183f08c009f806caff0a6b9bc85d09", "score": "0.5741796", "text": "def index\n @invoices = Invoice.all.order(state: :desc)\n @invoices = Kaminari.paginate_array(@invoices).page(params[:page]).per(5)\n @filterrific = initialize_filterrific(\n Invoice,\n params[:filterrific],\n persistence_id: false\n ) or return\n\n @invoices = @filterrific.find.page(params[:page]).paginate(:per_page => 5, :page => params[:page])\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "59a149ed160a820d5a1a1fc0dd9a0a2a", "score": "0.5741359", "text": "def auto_paging_each(&blk); end", "title": "" }, { "docid": "59a149ed160a820d5a1a1fc0dd9a0a2a", "score": "0.5741359", "text": "def auto_paging_each(&blk); end", "title": "" }, { "docid": "9389d04ce27f9c492967a8c725de2e64", "score": "0.5738609", "text": "def index\n # Filter record OR Return all items\n @filterrific = initialize_filterrific(Bin, params[:filterrific], \n select_options: { \n search_by_agency: Agency.alphabetical.all.to_a.map(&:name),\n search_by_program: Program.alphabetical.all.to_a.map(&:name) \n },\n persistence_id: false \n ) or return \n @bins = @filterrific.find.paginate(:page => params[:page]).per_page(10)\n puts(\"Bins: \",@bins)\n #@bins = Bin.all.paginate(:page => params[:page]).per_page(10)\n end", "title": "" }, { "docid": "d4360adbd1bc61e53541f72bfbc8aa49", "score": "0.5727413", "text": "def call\n serialize_records\n filter_records if filters.present?\n sort_records if params[:order_by].present?\n select_pages\n\n self\n end", "title": "" }, { "docid": "6bc31ebd70ef3a85d8b315e3a356f149", "score": "0.572274", "text": "def index\n @objects = RestoredObject.all.where(current_step: 'active').order(created_at: :desc).page params[:page]\n authorize @objects\n end", "title": "" }, { "docid": "6393014f8fca9d54bf80fab8a8296e03", "score": "0.57219607", "text": "def list_all(filter = {})\n url = build_url\n url = yield(url) || url if block_given?\n response = rest_get(url)\n results = JSON.parse(response)['value'].map { |hash| model_class.new(hash) }\n filter.empty? ? results : results.select { |obj| filter.all? { |k, v| obj.public_send(k) == v } }\n end", "title": "" }, { "docid": "105130e9973f495003f3aac6efcd7494", "score": "0.57180226", "text": "def all\n query = \"SELECT items.* FROM items LEFT OUTER JOIN items_library_locations ON items.id=items_library_locations.item_id \n WHERE library_location_id IN (1,4,5) AND is_approved=true ORDER BY title_main_245a\"\n @books = Item.paginate_by_sql([query], :per_page => 5, :page => params[:page])\n end", "title": "" }, { "docid": "13bf719694e849af337ffd307be3d992", "score": "0.5716998", "text": "def pagy_get_items(obj, pagy)\n obj.offset(pagy.offset).limit(pagy.limit)\n end", "title": "" }, { "docid": "183b976aa3e819b88603a5828fe07d41", "score": "0.5716758", "text": "def index\n @photos = Photo.visible.order(id: :desc).page params[:page]\n end", "title": "" }, { "docid": "e8551aa24df5cb3c6f530f2f478eab6c", "score": "0.57166433", "text": "def index\n filters_to_cookies(all_filters)\n @thickness_user = current_user\n params[:per_page] = 50 if params[:per_page].blank?\n params[:sorted_by] = 'newest' if params[:sorted_by].blank?\n params[:show_statistics] = 'no' if params[:show_statistics].blank?\n count_filters\n @unpaged_blocks = apply_scopes(Block.includes(:readings))\n begin\n @pagy, @blocks = pagy(@unpaged_blocks.includes(:user), items: params[:per_page])\n rescue\n @pagy, @blocks = pagy(@unpaged_blocks.includes(:user), items: params[:per_page], page: 1)\n end\n respond_to do |format|\n format.html\n format.xlsx {\n timestamp = DateTime.current.strftime(\"%Y%m%d_%H%M%S\")\n response.headers['Content-Disposition'] = \"attachment; filename=\\\"ThicknessExport_#{timestamp}.xlsx\\\"\"\n }\n end\n end", "title": "" }, { "docid": "e6960753a7bd9bff263bff64aa497f23", "score": "0.57140726", "text": "def index\n @borders = Border.all.paginate(page: params[:page]).per_page(10)\n end", "title": "" }, { "docid": "e6960753a7bd9bff263bff64aa497f23", "score": "0.57140726", "text": "def index\n @borders = Border.all.paginate(page: params[:page]).per_page(10)\n end", "title": "" }, { "docid": "5f1b5dd824582b245dc66238fc730d40", "score": "0.5713229", "text": "def filters\n Filter.all\n end", "title": "" }, { "docid": "1fd7e6f8a82fdd218b4434529b731eed", "score": "0.57103455", "text": "def list_all\n peoples = []\n params = {'per_page' => 100}\n items = total_items\n total_pages = items / params['per_page']\n total_pages = total_pages + 1 if items % params['per_page'] > 0\n\n for i in 1...total_pages\n params['page'] = i\n peoples.concat(list_by_param(params))\n end\n\n peoples\n end", "title": "" }, { "docid": "2fd8084e3b04b06b4a6dd343f439a2f9", "score": "0.570678", "text": "def index\n\n # Pagination Query & Decoration\n # TODO - split this up onto multiple lines, getting a little messy\n items = pagination_config[:decorator].decorate_collection(model.where(params[:query]).order_by(params[:order]).page( @page ).per( @perPage ))\n\n # Template struct\n @paginated = OpenStruct.new({\n page: items.current_page,\n per_page: items.limit_value,\n total_pages: items.total_pages,\n total_entries: items.total_count,\n item_template: pagination_config[:item_template],\n items: items\n })\n\n # Renders the template\n render 'base/paginated'\n end", "title": "" }, { "docid": "8dda35fdf7adadfa4bea20c35c10dd95", "score": "0.57062435", "text": "def pages(filter=@filter)\n PagesView.new(@pages_id, filter) # Reuse views?\n end", "title": "" }, { "docid": "ff267ef6012bd0c4cb98e59fd7570cc3", "score": "0.5705826", "text": "def all_with_filters(filters = {})\n\n\t\t\tpage = filters[:page]\n\n\t\t\tcards = Card.joins(\"\n\t\t\t\tLEFT JOIN card_relationships\n\t\t\t\t\tON card_relationships.card_id = cards.id\n\t\t\t\tLEFT JOIN card_occasions\n\t\t\t\t\tON card_occasions.card_id = cards.id\n\t\t\t\tLEFT JOIN card_flavors\n\t\t\t\t\tON card_flavors.card_id = cards.id\n\t\t\t\tLEFT JOIN card_vendors\n\t\t\t\t\tON card_vendors.card_id = cards.id\").paginate(page: page, per_page: 40)\n\n\t\t\t#Card.joins(\"LEFT JOIN card_relationships ON card_relationships.card_id = cards.id LEFT JOIN card_occasions ON card_occasions.card_id = cards.id LEFT JOIN card_flavors ON card_flavors.card_id = cards.id LEFT JOIN card_vendors ON card_vendors.card_id = cards.id\").paginate(page: 1)\n\t\t\t\n\t\t\twhere_statement = String.new\n\n\t\t\tfilterCount = 1\n\t\t\tfilters.each do |index, filter|\n\t\t\t\tputs \"index: #{index} and filter: #{filter}\"\n\t\t\t\tif filter.nil? || filter.empty?\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tcase index\n\t\t\t\twhen :occasions\n\t\t\t\t\twhere_string = filterCount == 1 ? \"card_occasions.occasion_id IN (:occasion_ids)\" : \" AND card_occasions.occasion_id IN (:occasion_ids)\"\n\t\t\t\t\twhere_statement << ActiveRecord::Base.send(:sanitize_sql_array, [where_string, occasion_ids: filter])\n\t\t\t\t\tfilterCount+=1\n\t\t\t\twhen :relationships\n\t\t\t\t\twhere_string = filterCount == 1 ? \"card_relationships.relationship_id IN (:relationship_ids)\" : \" AND card_relationships.relationship_id IN (:relationship_ids)\"\n\t\t\t\t\twhere_statement << ActiveRecord::Base.send(:sanitize_sql_array, [where_string, relationship_ids: filter])\n\t\t\t\t\tfilterCount+=1\n\t\t\t\twhen :flavors\n\t\t\t\t\twhere_string = filterCount == 1 ? \"card_flavors.flavor_id IN (:flavor_ids)\" : \" AND card_flavors.flavor_id IN (:flavor_ids)\"\t\t\t\t\t\n\t\t\t\t\twhere_statement << ActiveRecord::Base.send(:sanitize_sql_array, [where_string, flavor_ids: filter])\n\t\t\t\t\tfilterCount+=1\n\t\t\t\twhen :vendors\n\t\t\t\t\twhere_string = filterCount == 1 ? \"card_vendors.vendor_id IN (:vendor_ids)\" : \" AND card_vendors.vendor_id IN (:vendor_ids)\"\t\t\t\t\t\n\t\t\t\t\twhere_statement << ActiveRecord::Base.send(:sanitize_sql_array, [where_string, vendor_ids: filter])\n\t\t\t\t\tfilterCount+=1\n\t\t\t\telse\n\t\t\t\t\tputs \"this is the case: #{index}\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tfiltered_cards = cards.where(where_statement)\n\t\t\tfiltered_cards.distinct\n\n\t\t\tfiltered_cards\n\n\t\tend", "title": "" }, { "docid": "e84662a0360ecb31cca1ec1d7d2bc04e", "score": "0.57055897", "text": "def index\n \n @filter = params[:filter]? params[:filter] : {}\n @last_id = Offer.last.id\n \n @offers = Offer.filter_index(current_user, @filter.clone, params[:page])\n \n respond_to do |format|\n format.html\n format.xml { render :xml => @offers }\n end\n end", "title": "" }, { "docid": "e2106d90b28b526ffab4d88e1eb5629f", "score": "0.5703727", "text": "def index\n @collections = Collection.where(user: current_user).paginate(per_page: 5, page: params[:page])\n end", "title": "" }, { "docid": "f8c21e2b90d18ad8a1beb01a24dd484d", "score": "0.5702293", "text": "def all\n @@pages\n end", "title": "" }, { "docid": "bf3c41661cfe3bf2f8692b226f2b1fec", "score": "0.56964123", "text": "def set_filters\n @owners = Owner.all\n @brands = Brand.all\n @conditions = Condition.all\n @tape_formats = TapeFormat.all\n @process_steps = ProcessStep.order(:order)\n end", "title": "" }, { "docid": "bc518d7a9a8ef86979db2bf9645e23f4", "score": "0.56939", "text": "def pagy_get_items(collection, pagy)\n collection.offset(pagy.offset).limit(pagy.items).fast_page\n end", "title": "" }, { "docid": "c1936776d18ab04ac1d6d7aefb506799", "score": "0.56902695", "text": "def items_and_filters; end", "title": "" }, { "docid": "504b9e1626b848056ea26827d8a9c5c7", "score": "0.5687641", "text": "def render_items\n @list.items = case @footer.filters.selected.value\n when :active\n @items.reject { |item| item[:done] }\n when :completed\n @items.select { |item| item[:done] }\n else\n @items\n end.sort_by { |item| item[:text].to_s }\n end", "title": "" }, { "docid": "d2077d8458609ac6bc73b0df41ffea27", "score": "0.5679573", "text": "def index\n @objects = RestoredObject.all.where(current_step: 'active').page params[:page]\n authorize @objects\n end", "title": "" }, { "docid": "d0949f1b48467f5e8cea93d4c1f300e2", "score": "0.5674502", "text": "def index\n @filter_checked = params[:filter_checked] || session[:filter_checked] || false\n session[:page] = params[:page] || session[:page]\n session[:filter_checked] = @filter_checked\n \n @conditions = [\"is_checked =?\",@filter_checked]\n \n @items = Item.paginate(:page => session[:page], :conditions => @conditions, :order => \"lat desc, lng desc\")\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end", "title": "" }, { "docid": "39c47b0bbdd68aa974e56b5eaea6f75f", "score": "0.5665423", "text": "def index\n @filterings = Filtering.all\n end", "title": "" }, { "docid": "1989816213977af876d784ff2b00e406", "score": "0.56612176", "text": "def index\n @pipelines &&= @pipelines.page(params[:page])\n end", "title": "" }, { "docid": "812007954510e38db3370f75ea69e153", "score": "0.56596506", "text": "def index\n # paginates to show 5 per page\n if (user_signed_in? && current_user.has_role?(:admin))\n @items = Item.paginate(page: params[:page])\n else\n @items = Item.paginate(page: params[:page]).where(active: true)\n end\n end", "title": "" }, { "docid": "28b4e9a9c5942355b137c00590cec0ab", "score": "0.5656983", "text": "def index\n parse_filter_params if params[:filter]\n\n items = Item.filter(params[:filter])\n @items = Item.sort(items, params[:sort]).page(params[:page])\n\n if request.xhr?\n render partial: \"items\", locals: { items: @items }, layout: false\n else\n render :index\n end\n end", "title": "" }, { "docid": "c5e84c811f04cf861925468722f42119", "score": "0.5656931", "text": "def get_all_cars_in_page(page)\n # Todo: For each element of the page that contains the car, get that car's information.\n # For example:\n listItem = []\n count = 0\n listBrand = get_list_brand(page)\n listBrand.each do |brand|\n listModel = get_models_by_brand(brand[:brand_id])\n listModel.each do |model|\n listEngine = get_engines_by_model(model[:model_id])\n listEngine.each do |engine|\n listFilterItem = get_filter_items_by_model_and_engine(engine[:engine_id], model[:model_id])\n listFilterItem.each do |filterItem|\n listItemContainer = get_item_container_by_filter(filterItem)\n listItemContainer.each do |page_container|\n itemInfo = get_item_detail_info(page_container)\n itemInfo[:brand] = brand[:brand_name]\n itemInfo[:model] = model[:model_name]\n itemInfo[:engine] = engine[:engine]\n listItem << itemInfo\n count += 1\n puts count\n if count == 10\n return listItem\n end\n end\n end\n end\n end\n end\n \n return listItem\n #page.search('table tbody tr').each do |car_container|\n #get_car_info(car_container)\n #end\nend", "title": "" }, { "docid": "c5e84c811f04cf861925468722f42119", "score": "0.5656931", "text": "def get_all_cars_in_page(page)\n # Todo: For each element of the page that contains the car, get that car's information.\n # For example:\n listItem = []\n count = 0\n listBrand = get_list_brand(page)\n listBrand.each do |brand|\n listModel = get_models_by_brand(brand[:brand_id])\n listModel.each do |model|\n listEngine = get_engines_by_model(model[:model_id])\n listEngine.each do |engine|\n listFilterItem = get_filter_items_by_model_and_engine(engine[:engine_id], model[:model_id])\n listFilterItem.each do |filterItem|\n listItemContainer = get_item_container_by_filter(filterItem)\n listItemContainer.each do |page_container|\n itemInfo = get_item_detail_info(page_container)\n itemInfo[:brand] = brand[:brand_name]\n itemInfo[:model] = model[:model_name]\n itemInfo[:engine] = engine[:engine]\n listItem << itemInfo\n count += 1\n puts count\n if count == 10\n return listItem\n end\n end\n end\n end\n end\n end\n \n return listItem\n #page.search('table tbody tr').each do |car_container|\n #get_car_info(car_container)\n #end\nend", "title": "" }, { "docid": "69e86612e490f5ac7df9c7cb72d673fa", "score": "0.56508666", "text": "def index\n @brands = Brand.page params[:page]\n end", "title": "" }, { "docid": "4267c09289756046920f34ed8f684f91", "score": "0.56499875", "text": "def index\n respond_to do |format|\n format.html do\n @recent_objects = CollectionObject.recent_from_project_id(sessions_current_project_id)\n .order(updated_at: :desc)\n .includes(:identifiers, :taxon_determinations)\n .limit(10)\n render '/shared/data/all/index'\n end\n format.json do\n @collection_objects = ::Queries::CollectionObject::Filter.new(params).all\n\n @collection_objects = add_includes_to_filter_result(@collection_objects)\n\n @collection_objects = @collection_objects\n .page(params[:page])\n .per(params[:per])\n end\n end\n end", "title": "" }, { "docid": "4dac2b2934d2aabc202c8af6a7958900", "score": "0.56457746", "text": "def index\n @pagy, @conservation_records = pagy(ConservationRecord.order(id: :desc), items: 100)\n end", "title": "" }, { "docid": "763164e92a76c5ddbefd91329b8f323a", "score": "0.5639593", "text": "def all\n attribute_maps = [] # [{...}, {...}]\n @pages = CEO::Paginator.new(\n @model,\n current_page: current_page,\n per_page: @options.fetch(:per_page, 20)\n )\n\n self.total_pages = @pages.total_pages\n\n @pages.each do |thing|\n attr_object = {}\n\n # TODO: Make all of this into a method.\n # map first-level values to a hash\n keys.each do |key|\n attr_object[self.class.acronymize(key)] = thing[key.to_s]\n end\n\n # map nested values to a hash\n @queries.each do |query|\n attr_object.merge! query_eval(thing, query)\n end\n attribute_maps << attr_object\n end\n attribute_maps\n end", "title": "" }, { "docid": "1c2bd76c86b6813723cc51a1dd4834f3", "score": "0.5632891", "text": "def index\n\n tabs = side_tabs_for_alphabets(:companies)\n filters = filters_for_associations(:companies)\n\n if tabs.nil? and filters.nil?\n @companies = Company.paginate(:per_page=>Company.per_page, :page=>params[:page])\n else\n @companies = Company.order(\"title ASC\").search(tabs.merge!(filters)).paginate(:per_page=>Company.per_page, :page=>params[:page])\n end\n \n respond_to do |format|\n format.html\n format.js\n format.json { render :json=>@companies.to_json(:include=>:industry) }\n format.xml { render :xml => @companies }\n end\n end", "title": "" }, { "docid": "478db00a8e316157b381a828cf886a61", "score": "0.5627942", "text": "def all!\n where(page_size: -1).contents!\n end", "title": "" }, { "docid": "fcc73f2d61a5133244fd1c6cbbc35e80", "score": "0.56263363", "text": "def index\n if params[:filter].present? && Order.respond_to?(params[:filter])\n @orders = Order.admin_list.send(params[:filter]).page params[:page]\n else\n @orders = Order.admin_list.all.page params[:page]\n end\n end", "title": "" }, { "docid": "e4e2016b65ab7fecabfe660ec8624a8d", "score": "0.56257915", "text": "def pages\n \t@pages = Page.find_viewable_pages\n end", "title": "" }, { "docid": "6092d25b6435a6e9c566c43dfcd464f6", "score": "0.56243724", "text": "def paginated_collection\n collection_paginator.new(collection, params).call\n end", "title": "" }, { "docid": "0db1be7a0069dacfc0f0650826e5393d", "score": "0.5622571", "text": "def index\n @registry_conditions = Registry::Condition.paginate(:page => params[:page])\n end", "title": "" } ]
f415850c0351cef1c729577758673549
This method adds a HeapNode instance to the heap Time Complexity: O(logn) Space Complexity: O(1) if you're adding one new node
[ { "docid": "d83ab3b95657992206cce637161c2b78", "score": "0.7600958", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length - 1)\n return\n end", "title": "" } ]
[ { "docid": "e2f68e1f6a42c9887091da64c3d67ea6", "score": "0.77560693", "text": "def add(key, value = key)\n # add new node to end\n @store << HeapNode.new(key, value)\n\n # heap-up from added node to reestablish the heap property\n heap_up(@store.length - 1) if @store.length > 1\n end", "title": "" }, { "docid": "3f04e406a3782a9cd5ad0d444fad956e", "score": "0.7738265", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n\n index = @store.length - 1\n heap_up(index) #index of new node\n end", "title": "" }, { "docid": "754be4fee4ef4f75f14559b03e34d281", "score": "0.77376944", "text": "def add(key, value = key)\n node = HeapNode.new(key, value)\n @store << node\n\n new_idx = @store.length - 1\n heap_up(new_idx) if @store.length > 1 # heap up only if there is something to sort\n end", "title": "" }, { "docid": "526c2b93e59b3d57107c0b27f69051e1", "score": "0.7736046", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1) # move the new added node up (swap with parent only)\n end", "title": "" }, { "docid": "df46fc210750940ed762f2dc3ebbbe6c", "score": "0.76847464", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n index = @store.length-1\n heap_up(index) if @store.length > 1\n end", "title": "" }, { "docid": "7d8c82771f3388a736c2ce490f8ed629", "score": "0.76315343", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store.push(new_node)\n \n index = @store.length - 1\n heap_up(index)\n end", "title": "" }, { "docid": "09f5c16d6110797c1187670e8a5dce97", "score": "0.76220554", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n \n heap_up(@store.length() - 1)\n end", "title": "" }, { "docid": "9c421f6a27874711767b5be51f9c0613", "score": "0.7619241", "text": "def add(key, value = key)\n heap_node = HeapNode.new(key, value)\n @store << heap_node\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "d506182c69793047a27d91c42e733be4", "score": "0.76073277", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n \n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "77b5fad20c63c5d2151511a6fe68ea7f", "score": "0.7594952", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n return if @store.length < 2\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "7a2db255c8b31052f072bec5b47aeec9", "score": "0.75898427", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "7a2db255c8b31052f072bec5b47aeec9", "score": "0.75898427", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "7a2db255c8b31052f072bec5b47aeec9", "score": "0.75898427", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "7a2db255c8b31052f072bec5b47aeec9", "score": "0.75898427", "text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "6e310fb2a75001ce80d362d380f762d3", "score": "0.7584218", "text": "def add(key, value = key)\n node = HeapNode.new(key, value)\n @store << node\n i = @store.length-1\n heap_up(i)\n\n end", "title": "" }, { "docid": "1473b8cfd2487dd5aa7d161e4ef1b72b", "score": "0.75818336", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length-1)\n return\n end", "title": "" }, { "docid": "b1faa16db92e1cfc9bfbf812852b9547", "score": "0.757696", "text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "b3a4142c5d3cd99ccbc95750de5d1930", "score": "0.7572932", "text": "def add(key, value = key)\n new_node = HeapNode.new(key,value)\n @store.push(new_node)\n heap_up(@store.length - 1)\n end", "title": "" }, { "docid": "081015d1bd53198ac2ba9f5fff5a4d34", "score": "0.75277305", "text": "def add(key, value = key)\n if @store.length == 0\n @store << HeapNode.new(key, value)\n return\n end\n\n @store << HeapNode.new(key, value)\n heap_up(@store.length - 1)\n \n end", "title": "" }, { "docid": "a4cce6de81f28445f9d198e39a6e5857", "score": "0.7501108", "text": "def add trie_node\n case\n when trie_node.heap_index != -1\n @nodes[trie_node.heap_index].occurs += 1\n heapify_down_from(trie_node.heap_index)\n when @nodes.length == @capacity\n replace_root_with(trie_node) if trie_node.occurs > @nodes[0].occurs\n else\n @nodes.push(HeapNode.new(trie_node, @nodes.length))\n heapify_up_from((@nodes.length-1))\n end\n end", "title": "" }, { "docid": "c54fd4e6a9cf0ff9b1ab8974b2be72aa", "score": "0.74856204", "text": "def add(key, value = key)\n new_element = HeapNode.new(key, value)\n next_index = @store.length\n @store[next_index] = new_element\n heap_up(next_index)\n\n end", "title": "" }, { "docid": "3848e2ceb71cdac5535b22aa068c8977", "score": "0.7306248", "text": "def insert(element)\n @heap << element\n heapify_up\n p @heap\n end", "title": "" }, { "docid": "c5aa516fbe1da269f25c3ceaada3d940", "score": "0.7210432", "text": "def insert_heap(current_node, new_node)\n # puts current_node.title\n if current_node.left == nil\n current_node.left = new_node\n new_node.parent = current_node\n return current_node\n elsif current_node.right == nil\n current_node.right = new_node\n new_node.parent = current_node\n return current_node\n else\n queue = []\n queue.push(current_node)\n while queue.size != 0\n n = queue.shift\n if n.left.left == nil || n.left.right == nil\n return insert_heap(n.left, new_node)\n elsif n.right.left == nil || n.right.right == nil\n return insert_heap(n.right, new_node)\n else\n n.children.each do |child|\n queue.push(child)\n end\n end\n end\n end\n end", "title": "" }, { "docid": "52099f8644a8db7b57e59c39b30744ce", "score": "0.7201416", "text": "def insert(element)\n node = Node.new(element)\n @heap_arr << node\n\n bubble_up(node)\n end", "title": "" }, { "docid": "ebce9b76e3e8f23c1db2a0c9d78cc4dc", "score": "0.7113541", "text": "def insert(new_element)\n self.elements.push(new_element)\n self.heapify_from_tail\n end", "title": "" }, { "docid": "b0c798a1371c7cbff3b8fad653b7e1ff", "score": "0.70526356", "text": "def insert(item)\n # append the item at the end of the @heap list\n @heap.push(item)\n # percolate it up until the binary heap property is restored\n percolate_up(@heap.size - 1) \n end", "title": "" }, { "docid": "df739a2e0a227caa971771f774082993", "score": "0.7011773", "text": "def add(value)\n @heap_store.push(value)\n trickle_up(value, @heap_store.length - 1)\n end", "title": "" }, { "docid": "e9ec820ba86c2151b61f334e0d225af3", "score": "0.6968729", "text": "def push(x)\n @heap << x\n sift_up(@heap.length - 1)\n self\nend", "title": "" }, { "docid": "25af0129493c70c75a3f2968207dc326", "score": "0.6911109", "text": "def insert_heap(data)\r\n #if full, return false\r\n if @last == @SIZE - 1\r\n return false\r\n end\r\n\r\n #increment list size\r\n @last+=1\r\n\r\n #add data at the end of list\r\n @heap[@last] = data\r\n #reheap the heap\r\n self._reheap_up(@last)\r\n #return successful\r\n true\r\n end", "title": "" }, { "docid": "f0cf2f5b6b0f3ead0d62b80f5efe0774", "score": "0.6853476", "text": "def merge!(otherheap)\n raise ArgumentError, \"Trying to merge a heap with something not a heap\" unless otherheap.kind_of? Containers::Heap\n other_root = otherheap.instance_variable_get(\"@next\")\n if other_root\n @stored = @stored.merge(otherheap.instance_variable_get(\"@stored\")) { |key, a, b| (a << b).flatten }\n # Insert othernode's @next node to the left of current @next\n @next.left.right = other_root\n ol = other_root.left\n other_root.left = @next.left\n ol.right = @next\n @next.left = ol\n \n @next = other_root if @compare_fn[other_root.key, @next.key]\n end\n @size += otherheap.size\n end", "title": "" }, { "docid": "db26451ca946dccb6ff3be81ea10cc72", "score": "0.6852081", "text": "def push(key, value=key)\n raise ArgumentError, \"Heap keys must not be nil.\" unless key\n node = Node.new(key, value)\n @stored << node\n bubble_up!(size)\n end", "title": "" }, { "docid": "58d40e45725ea64bfb55d82c38c7811b", "score": "0.68240935", "text": "def push(val)\n @heap << val\n idx = @heap.length - 1\n up_heap(idx)\n end", "title": "" }, { "docid": "5240bda0fb273ee5ad64330e079ddfc3", "score": "0.68172294", "text": "def add(priority, element)\n @data.push PriorityQueueNode.new(priority,element)\n up_heap_bubbling length-1\n end", "title": "" }, { "docid": "07bfd77bf92a2ca78fe7f40b8fd110a0", "score": "0.6725096", "text": "def push(key, value=key)\n raise ArgumentError, \"Heap keys must not be nil.\" unless key\n node = Node.new(key, value)\n # Add new node to the left of the @next node\n if @next\n node.right = @next\n node.left = @next.left\n node.left.right = node\n @next.left = node\n if @compare_fn[key, @next.key]\n @next = node\n end\n else\n @next = node\n end\n @size += 1\n \n arr = []\n w = @next.right\n until w == @next do\n arr << w.value\n w = w.right\n end\n arr << @next.value\n @stored[key] ||= []\n @stored[key] << node\n value\n end", "title": "" }, { "docid": "fab3889eb7affda865f042309856c8ab", "score": "0.6710379", "text": "def <<(key)\n raise ArgumentError, \"Cannot insert nil in the queue\" if key.nil?\n\n i = @heap.length\n @heap << key\n while i > 1\n parent = i / 2\n if key < @heap[parent]\n @heap[i], @heap[parent] = @heap[parent], key\n i = parent\n else\n break\n end\n end\n self\n end", "title": "" }, { "docid": "bca2429ac311c7bd1fe3f94283aba812", "score": "0.6703006", "text": "def add_num(num)\n @min_heap << num\n @max_heap << @min_heap.pop\n\n if @min_heap.elements.size < @max_heap.elements.size\n @min_heap << @max_heap.pop\n end\n\n end", "title": "" }, { "docid": "85d5c3be95b49601459193501a6ba97d", "score": "0.6696478", "text": "def put(data)\n \n if (@nb >= @size)\n raise \"Heap full\"\n end\n \n p = @nb\n pp = parent(p)\n \n while ((p != 0) && ((data <=> @heap[pp]) < 0))\n @heap[p] = @heap[pp]\n \n p = pp\n pp = parent(p)\n end\n \n @heap[p] = data\n @nb = @nb + 1\n \n end", "title": "" }, { "docid": "7f67d5dd28ad691780f01c7eee87a8e5", "score": "0.6677136", "text": "def add(val)\n # O(logn), O(1)\n @heap.push(val)\n @heap.pop if @heap.size > @k\n\n @heap.min\n end", "title": "" }, { "docid": "098c0a52ea6d5db3db7081d80fafd48d", "score": "0.6624959", "text": "def add(e)\n\t\tif full?\n\t\t\traise IndexError.new(\"heap is full\")\n\t\tend\n\t\tn = @n\n\t\t@n = n + 1\n\t\tif n.zero?\n\t\t\t@m[0] = e\n\t\t\treturn\n\t\tend\n\t\ti = Util.sift_up(@m, n, e)\n\t\t@m[i] = e\n\t\treturn\n\tend", "title": "" }, { "docid": "10ff9f329b42d168e83c878d9e34a650", "score": "0.6522369", "text": "def insert(value)\n @q << value\n heapifyUp \n end", "title": "" }, { "docid": "c2f422925433633986d43f4cfe34b186", "score": "0.6495389", "text": "def insert(val)\n @store.push(val)\n heapify_up!\n self\n end", "title": "" }, { "docid": "68957639a516e8823b7a72fd66536853", "score": "0.64426684", "text": "def add_num(num)\n # O(logn), O(1)\n # add to small heap, by default\n @small.push(num)\n\n # check if all values in small heap lower than ones in large heap\n # if not, pop from small and add to large\n if (!@small.empty? && !@large.empty? && @small.max > @large.min)\n @large.push(@small.pop)\n end\n\n # check if size of both heaps are uneven (off by 2), diff is 1 is allowed\n # pop from larger size heap onto smaller sized heap\n if @small.size + 1 < @large.size\n @small.push(@large.pop)\n elsif @small.size > @large.size + 1\n @large.push(@small.pop)\n end\n end", "title": "" }, { "docid": "640f0ac216f62b1ee404bc65f42b876b", "score": "0.63979703", "text": "def push(object, priority) \n @heap.push(priority, object)\n end", "title": "" }, { "docid": "51623ca7ecb817c940df63409549cfe2", "score": "0.63765234", "text": "def insert(value)\n @weight = @weight+1\n if !@ip.empty? && !@ip.left.nil? && !@ip.right.nil?\n if !@ip.parent.nil?\n @ip = @ip.parent.next_right_sibling(@ip == @ip.parent.right) \n else\n @ip = @ip.left \n end\n end\n if empty?\n @value = value\n elsif @ip.left.nil?\n @ip.left = BinaryHeap.new(value,@ip)\n @ip.left.heapify_up\n elsif @ip.right.nil?\n @ip.right = BinaryHeap.new(value,@ip)\n @ip.right.heapify_up\n end\n self\n end", "title": "" }, { "docid": "9cdcd791be5351879ec81f7de25b1f6d", "score": "0.63751787", "text": "def _build_heap\r\n heap_last = @SIZE / 2 - 1\r\n\r\n heap_last.times do\r\n num = Random.rand(999) + 1\r\n if self.insert_heap(num)\r\n puts \"#{num} added to heap.\"\r\n else\r\n puts \"Unable to add #{num} to heap\"\r\n return false\r\n end\r\n end\r\n\r\n true\r\n end", "title": "" }, { "docid": "61b6d9823d981991b9972f3c57b5af73", "score": "0.63669544", "text": "def insert(key)\n @size += 1\n @heap[@size] = key\n swim(@size)\n end", "title": "" }, { "docid": "a5c79b96dc73abd01a8894f2e26e7282", "score": "0.6352829", "text": "def replace_heap_element(heap, obj, new_obj, priority, new_priority)\n remove_heap_element(heap, obj)\n heap.push(new_obj, new_priority)\nend", "title": "" }, { "docid": "93a487e59f24c280b1b4a920b5b2a9f3", "score": "0.63527185", "text": "def push(node)\n new_node = Node.new(node)\n new_node.next = @head\n @head = new_node\n end", "title": "" }, { "docid": "26aa351df705680bd98652b5bdb48601", "score": "0.62910247", "text": "def min_heap_insert(key)\n\t\t@heap.push(-1)\n\t\theap_incease_key(@heap.length-1, key)\n\tend", "title": "" }, { "docid": "d6517b1fe776dbd67f349a83129d63df", "score": "0.6243289", "text": "def add_num(num)\n if @left.empty?\n @left << num\n elsif @right.empty?\n if @left[0] > num\n @right << @left.pop\n @left << num\n else\n @right << num\n end\n else\n if num <= @left[0]\n heapify(@left, num)\n elsif num >= @right[0]\n heapify(@right, num)\n else\n if @left.length > @right.length\n heapify(@right, num)\n else\n heapify(@left, num)\n end\n end\n\n if @left.length > @right.length + 1\n left_top = delete_top(@left)\n heapify(@right, left_top)\n elsif @right.length > @left.length + 1\n right_top = delete_top(@right)\n heapify(@left, right_top)\n end\n end\n end", "title": "" }, { "docid": "f937e5d1379af534fbd1a626cabee4f3", "score": "0.62311995", "text": "def add(entry)\n heap.add(entry.run_at, entry)\n end", "title": "" }, { "docid": "dc1ef37a81bb37d1e91eb916c5928ad9", "score": "0.62265027", "text": "def add_node element\n node = Node.new(element)\n nodes << node\n edges[node] = edge_queue.shift\n if element.respond_to? :children\n element.size_of(:children).times do\n edge_queue << node\n end\n end\n end", "title": "" }, { "docid": "e06bea9b5096068710bd5ab1f3a62e16", "score": "0.6223977", "text": "def push(val)\n store << val\n self.class.heapify_up(store, self.count - 1, &prc)\n end", "title": "" }, { "docid": "29d736ff6918799e4a666f9bd0820edd", "score": "0.6196537", "text": "def << (value)\n\t\t@values << value\n\t\theap_up \n\tend", "title": "" }, { "docid": "b7faa0922cac8ac571f689d1ff87d522", "score": "0.6168708", "text": "def push new_data\n # 1 & 2: Allocate the Node & Put in the data\n new_node = Node.new(new_data)\n # 3. Make next of new Node as head\n new_node.next_node = @head\n # 4. Move the head to point to new Node\n @head = new_node\n end", "title": "" }, { "docid": "2b707d9aec3ae7817a57e66349b93958", "score": "0.61663204", "text": "def insert(insert_value)\n if left_child.nil?\n self.left_child = BinaryHeap.new(insert_value)\n elsif right_child.nil?\n self.right_child = BinaryHeap.new(insert_value)\n else\n left_count = left_nodes.count\n right_count = right_nodes.count\n lh = left_height\n rh = right_height\n\n if left_count == right_count\n left_child.insert(insert_value)\n elsif left_count == (right_count * 2 + 1)\n right_child.insert(insert_value)\n elsif lh == rh\n right_child.insert(insert_value)\n else\n left_child.insert(insert_value)\n end\n end\n\n if left_child && should_swap?(left_child.value)\n swap_values(left_child)\n end\n if right_child && should_swap?(right_child.value)\n swap_values(right_child)\n end\n nil\n end", "title": "" }, { "docid": "bc649c3e783b6912b00afd65e3f84239", "score": "0.6161748", "text": "def << node\n push(node)\n end", "title": "" }, { "docid": "12b4fb78eadea6dbe748e85016829f32", "score": "0.61571306", "text": "def pushNode(node)\n @nodeList.push(node) ;\n end", "title": "" }, { "docid": "9d4cae9ea41a557c168ee070daa35f70", "score": "0.6147484", "text": "def push(node)\n if @data.nil?\n @data = LinkedListNode.new(node.value)\n else\n @data = LinkedListNode.new(node.value, @data)\n end\n end", "title": "" }, { "docid": "88b1a0790bac6b6c71c3a406658dee97", "score": "0.6118308", "text": "def push(val)\n @store.push(val)\n BinaryMinHeap.heapify_up(@store, @store.length - 1, @store.length, &prc)\n end", "title": "" }, { "docid": "c4faef2e54dd79c2a029192ad3e73afb", "score": "0.6111193", "text": "def merge!(other_heap)\n return nil unless other_heap.is_a?(self.class)\n args = other_heap.to_a\n nodes = args.length\n node = 0\n while node < nodes do\n push( args[node] )\n node += 1\n end\n self\n end", "title": "" }, { "docid": "391fe8da549ca9abb26dbf51bb60a1e6", "score": "0.61110884", "text": "def add(node)\n @last_updated = Time.now.to_i\n if @nodes.include?(node)\n @nodes.delete(node)\n @nodes << node\n elsif @nodes.size < k_size\n @nodes << node\n else\n @replacement_cache << node\n return head\n end\n nil\n end", "title": "" }, { "docid": "4b10d5da51556fff11a3a693595ff46b", "score": "0.6106001", "text": "def push(element)\n @head = Node.new(element, @head)\n @size += 1\n end", "title": "" }, { "docid": "1ae66d674d2c134f756dca70d8262c32", "score": "0.6093541", "text": "def push(node)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "ad87b418d221690ade5073b4c5a1ff2a", "score": "0.6088682", "text": "def push(item)\n shift_down(0, @heap.push(item).size - 1)\n end", "title": "" }, { "docid": "ad87b418d221690ade5073b4c5a1ff2a", "score": "0.6088682", "text": "def push(item)\n shift_down(0, @heap.push(item).size - 1)\n end", "title": "" }, { "docid": "ad87b418d221690ade5073b4c5a1ff2a", "score": "0.6088682", "text": "def push(item)\n shift_down(0, @heap.push(item).size - 1)\n end", "title": "" }, { "docid": "23162b966ef0ed00edc05cbfa2bbd3ad", "score": "0.60612863", "text": "def append(node) \n @size = @size + 1\n @tail = @tail.append(node)\n @tail\n end", "title": "" }, { "docid": "bf3c02e7e11af91ab2d8eee56aeb826e", "score": "0.6059709", "text": "def push(item)\n shift_down(0, @heap.push(item).size - 1)\n end", "title": "" }, { "docid": "bf3c02e7e11af91ab2d8eee56aeb826e", "score": "0.6059709", "text": "def push(item)\n shift_down(0, @heap.push(item).size - 1)\n end", "title": "" }, { "docid": "03a6186de9547c6f65a2964feb14b8e3", "score": "0.60575444", "text": "def max_heap_insert(arr, key)\n arr.heap_size ||= arr.length\n arr.heap_size += 1\n arr[arr.heap_size-1] = -Float::INFINITY\n heap_increase_key(arr, arr.heap_size-1, key)\n end", "title": "" }, { "docid": "69713c21584ea66047704dd778619107", "score": "0.6056262", "text": "def insert(value)\r\n # create new node w value \r\n new_node = Node.new(value)\r\n \r\n # sets head to new node\r\n if @head == nil\r\n @head = new_node\r\n else \r\n new_node.next_node = @head\r\n @head = new_node\r\n end\r\n\r\n return\r\n\r\n # time O(1), space O(1)\r\n end", "title": "" }, { "docid": "fd9f699228a0cd43c5a3d25ba036bef5", "score": "0.60349536", "text": "def build_heap!\n head = (@store.length - 1) / 2\n while head >= 0 do # n / 2 => O(n)\n sift_down!(head) # O(log(n))\n head -= 1\n end\n self\n end", "title": "" }, { "docid": "8ef722d213e6b4858ff36a808a8875f6", "score": "0.6033755", "text": "def push(node)\r\n\t\tif @size.zero?\r\n\t\t\t@head = node\r\n\t\t\t@size += 1\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\ttemp = @head\r\n\t\tnode.next = @head\r\n\r\n\t\tif @size == 1\r\n\t\t\tnode.next.next = node\r\n\t\telse\r\n\t\t\twhile temp.next != @head\r\n\t\t\t\ttemp = temp.next\r\n\t\t\tend\r\n\t\t\ttemp.next = node\r\n end\r\n @head = node\r\n\t\t@size += 1\r\n\tend", "title": "" }, { "docid": "824f8af9b95424777a9c5e96b1dd07d6", "score": "0.6033231", "text": "def push(value)\n # IMPLEMENT ME!\n new_entry = LinkedListNode.new(value)\n \n if @data.nil?\n @data = LinkedListNode.new(value)\n else\n last_node = find_last_node(@data)\n last_node.next_node = new_entry\n end\n \n end", "title": "" }, { "docid": "1d24df198d300256848017729917dd1a", "score": "0.60314053", "text": "def add_node node\n GraphNode.new(node)\n @nodes.push(node)\n end", "title": "" }, { "docid": "7e10f7f9a7132cbd7ee0ec7b47cbee0a", "score": "0.6017407", "text": "def insert(obj)\n if @head.nil?\n @head = Node.new(nil, obj)\n else\n new_node = Node.new(@head, obj)\n @head = new_node\n end\n @size += 1\n\n self\n end", "title": "" }, { "docid": "a79e26bd5d85f5f21e8fed13941a2108", "score": "0.60084486", "text": "def heap; end", "title": "" }, { "docid": "34b1a75a78dc96ccbd920a3f176237e2", "score": "0.6000613", "text": "def push(node)\n return if @nodes.include?(node)\n\n @nodes << node\n\n take_ownership(node)\n end", "title": "" }, { "docid": "5ad72fb873efebe4c3b7c010398c8d3b", "score": "0.5998194", "text": "def push(new_data)\n new_node = Node.new(new_data) \n new_node.next = @head \n @head = new_node\n end", "title": "" }, { "docid": "7114e9839ce9e67e44b8cc201f839089", "score": "0.59873265", "text": "def add(data)\n new_node = Node.new(data)\n\n if @size == 0\n add_first_node(new_node)\n elsif @current_node == @tail_node\n new_node.prev_node = @head_node\n @head_node.next_node = new_node\n @tail_node = new_node\n @current_node = @tail_node\n else\n new_node.prev_node = @current_node\n new_node.next_node = @current_node.next_node\n @current_node.next_node = new_node\n @current_node = new_node\n end\n\n @size += 1\n\n end", "title": "" }, { "docid": "7917ff91b4943dfd8c4b6fb4966a0e47", "score": "0.5985763", "text": "def add_node(node)\n @children << node\n end", "title": "" }, { "docid": "2e8e95bbcbbb8f088b8a915618c014fa", "score": "0.5984539", "text": "def push(value) # next_node from previous call\n\t\t@node = LinkedListNode.new(value, @node)\n\tend", "title": "" }, { "docid": "26d5770c8a35f6432484565897c87774", "score": "0.5979043", "text": "def push(element)\n\t\t\t# Insert the item at the end of the heap:\n\t\t\t@contents.push(element)\n\t\t\t\n\t\t\t# Bubble it up into position:\n\t\t\tbubble_up(@contents.size - 1)\n\t\t\t\n\t\t\t# validate!\n\t\t\t\n\t\t\treturn self\n\t\tend", "title": "" }, { "docid": "6c0c6f975fd89d6af7f5c0cef7d0b110", "score": "0.59768695", "text": "def add(object)\n node = Node.new(object)\n @size == 0 ? @head = node : create(node)\n @size += 1\n return node\n end", "title": "" }, { "docid": "bfce66bae878505fa8eeebadef58bf29", "score": "0.5968581", "text": "def addChild(node)\n \t@children.push node\n end", "title": "" }, { "docid": "96fad02bde49fb56135ab7b1376556f0", "score": "0.59615546", "text": "def push(value)\r\n @head = Node.new(value, @head)\r\n end", "title": "" }, { "docid": "85a0e9383a47463861c515dad7cc22c2", "score": "0.59597945", "text": "def push(key, priority)\n return change_priority(key, priority) if @nodes[key]\n @nodes[key] = node = Node.new(key, priority)\n @min = node if !@min or priority < @min.priority\n if not @rootlist\n @rootlist = node\n node.left = node.right = node\n else\n node.left = @rootlist.left\n node.right = @rootlist\n @rootlist.left.right = node\n @rootlist.left = node\n end\n @length += 1\n self\n end", "title": "" }, { "docid": "4f88913986ca3be8b7849c28d9f5118f", "score": "0.5955868", "text": "def add(value, priority = nil)\n @tree = insert(@tree, Node.new(value, priority || generate_priority))\n @size += 1\n return value\n end", "title": "" }, { "docid": "aca96ce4a44670280bf441171c04d4e3", "score": "0.59545183", "text": "def []=(priority, elem)\n raise ArgumentError, 'Priority can not be < 0' if priority < 0\n index = @heap.size\n @heap << [priority, elem]\n cur_parent = parent index\n while index.nonzero? && @heap[cur_parent][0] > priority\n swap cur_parent, index\n index = cur_parent\n cur_parent = parent index\n end\n @heap\n end", "title": "" }, { "docid": "99f29305e59997346292b030864b1b90", "score": "0.5953819", "text": "def build_heap\n parent = (size / 2 - 1).floor\n\n while parent >= 0\n heapify(parent, size)\n parent -= 1\n end\n end", "title": "" }, { "docid": "64a32df99406bf4b6009ef534223d9db", "score": "0.59518427", "text": "def push_node(node)\r\n @head.next_node = node\r\n @head = node\r\n end", "title": "" }, { "docid": "807aa8b5ba2d73856e4bcf737b33c950", "score": "0.59494865", "text": "def addNode(node)\n @nodes[node.descriptor] = node\n @nodes_array[@nodes_array.count] = node\n node\n end", "title": "" }, { "docid": "be26e808c2dd9edd51e38262dc824b45", "score": "0.59439635", "text": "def add_node(node)\n @nodes[node.value] = node\n end", "title": "" }, { "docid": "d31f5e507f8b4a8332ddb521e7b1c05a", "score": "0.59342486", "text": "def add(value)\n\t\tnew_node = Node.new(value,@head)\n\t\t@head = new_node\n\tend", "title": "" }, { "docid": "6d35d2103a480299ac2708e37be68111", "score": "0.592786", "text": "def add(node)\n if node.value < value\n add_left(node)\n elsif node.value > value\n add_right(node)\n end\n end", "title": "" }, { "docid": "3ee6dd88c847afd6a3c080348c590de5", "score": "0.59262335", "text": "def add(elem)\n node = create_node(elem)\n if @head.nil?\n @head = node\n @tail = node\n else\n thead = @head\n while thead.next != nil\n thead = thead.next\n end\n thead.next = node\n @tail = node\n end\n end", "title": "" }, { "docid": "12ffc4811421b9c125e1efa4001a3eff", "score": "0.5925554", "text": "def add_node(node)\n @nodes << node\n end", "title": "" }, { "docid": "ee55cba5a30591eee59d916ff26d8040", "score": "0.5925234", "text": "def push(val)\n @store.push(val)\n self.class.heapify_up(@store, count - 1, &prc)\n end", "title": "" }, { "docid": "d3b18058c1762db38d73fc72596263f0", "score": "0.5921992", "text": "def push(node)\n node.next = head\n self.head = node\n self\n end", "title": "" } ]
f0ef998d9c9f680aff5c6d37098298bc
Confirms a loggedin user.
[ { "docid": "ca2afd935535d3d63c912463a50488aa", "score": "0.0", "text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\" #\n redirect_to login_url\n end\n end", "title": "" } ]
[ { "docid": "60995922afe92bcb4b96a5737d729af5", "score": "0.70087826", "text": "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "ee62bdd0ffd57efae1e656036f4ef512", "score": "0.6982988", "text": "def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end", "title": "" }, { "docid": "f2dad82c9cabeb0ee81fffcc635aaeaa", "score": "0.6919373", "text": "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "af4e7803254cfa9a19aef78482f553ed", "score": "0.688131", "text": "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "title": "" }, { "docid": "d4bd586c7b5570a0400d45096db1a31b", "score": "0.6845446", "text": "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end", "title": "" }, { "docid": "7348f3f074bc993ca88680d8c59d7ce8", "score": "0.68326277", "text": "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "2ee00e9a4072fb4679e3b2ddf9002f84", "score": "0.67944413", "text": "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "7a2b667422b5223e381d012bf6eae9bb", "score": "0.67929715", "text": "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "ec3af2e9f06314b79d2756e409ba78c5", "score": "0.6642435", "text": "def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end", "title": "" }, { "docid": "f9371c11f8cd080babf1eb546d7d01cb", "score": "0.6624581", "text": "def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "8fb7b9e4be48bae161a92480b8fb35d3", "score": "0.66114175", "text": "def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "40761ecaca98266f3ea0f503934108ce", "score": "0.66022736", "text": "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "title": "" }, { "docid": "571f97ea0657de1641ba4b3ba7691828", "score": "0.6589018", "text": "def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end", "title": "" }, { "docid": "64e5b227c6599bfebe1290ad50a0fd20", "score": "0.65539706", "text": "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "4513c5e6fb033c7429d557118e35e27f", "score": "0.65349805", "text": "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "title": "" }, { "docid": "06852b4c825cd1c32951b2dcb393c8f4", "score": "0.65303934", "text": "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "title": "" }, { "docid": "f0c98a5ef673978ddcc9f07bafb81659", "score": "0.6512816", "text": "def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end", "title": "" }, { "docid": "1ca9693a76cc73772e9adba14b1c6f37", "score": "0.650312", "text": "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "title": "" }, { "docid": "77af5aff39a9409c1e7b4e720dfdba37", "score": "0.64878744", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "title": "" }, { "docid": "975fe80c9fbeb7105f9d1f4d3520937d", "score": "0.6487622", "text": "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "title": "" }, { "docid": "eea198c13f6f41c57abd9d4a0c4877be", "score": "0.6480418", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "title": "" }, { "docid": "aa7bd76cbaf757a234773325675f2521", "score": "0.6479267", "text": "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "3c1a9eb7a43f83f916884ef8b171c199", "score": "0.64705276", "text": "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "title": "" }, { "docid": "03f0b926bfaecc7c847d5e99adc432b2", "score": "0.64680994", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "14ecdd7125ea9af854327c4a8a54afd4", "score": "0.64656436", "text": "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "title": "" }, { "docid": "91b64c2c86fae9175c719b4c9b87b418", "score": "0.6457351", "text": "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "title": "" }, { "docid": "9f0b8bc6fb328dd2466e50c69ee6a920", "score": "0.64541256", "text": "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "c4e6082fee3ef5b11e8842fa84732597", "score": "0.64485556", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "title": "" }, { "docid": "f189707f92c7f2a21ccfe5da00153e62", "score": "0.6445996", "text": "def confirm_user\n if session[:user_id]\n return true\n else\n flash[:notice] = \"please login\"\n redirect_to(:controller => 'manage', :action => 'login')\n return false\n end\n end", "title": "" }, { "docid": "ef15d92ab5d6cce09f7d03306d4ba91b", "score": "0.6437721", "text": "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "title": "" }, { "docid": "be85e08fbec5dd3e62097813bcff12db", "score": "0.64289176", "text": "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "title": "" }, { "docid": "c9f35afccde997d23e207ce371905de4", "score": "0.64260334", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "title": "" }, { "docid": "c7ab04de0e0f5abf44733fcd9dbf2aa2", "score": "0.6424799", "text": "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "title": "" }, { "docid": "33132e189b06c49aca0b5c72bd49d6cd", "score": "0.6417934", "text": "def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end", "title": "" }, { "docid": "416aff544bd2dd6d7d1fd9fc3f55cf2e", "score": "0.64177954", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "title": "" }, { "docid": "92c4433ca17704f550e6b0d1e706006b", "score": "0.64163303", "text": "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "title": "" }, { "docid": "1b5a7b5b3bdc1888232cdc668de16da4", "score": "0.6410097", "text": "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "title": "" }, { "docid": "becdfda50f4bdcd71b7e2463bab527cd", "score": "0.6401843", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "title": "" }, { "docid": "3320bd8303ab9a4dd79d3c7eccf3b134", "score": "0.63820904", "text": "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "title": "" }, { "docid": "041c181cba49207df4e3154d3a561dcf", "score": "0.63622755", "text": "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "title": "" }, { "docid": "cf08b3d4be28e21e73882e1ebead7aac", "score": "0.63595843", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) #checks if current_user == @user\n #current_user? defined in session helper\n end", "title": "" }, { "docid": "17cbf4141974a0407a35ae7d1c658829", "score": "0.6355515", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "633c174aec03151235a0dfa2d702cb1f", "score": "0.635374", "text": "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8fbe4f103d7504dc04825527db790f90", "score": "0.6351282", "text": "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end", "title": "" }, { "docid": "bcfc692c31fa32b034c9b970f66e91b2", "score": "0.6350864", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "title": "" }, { "docid": "79905d55d899e3cef8f8bfd312cbfde4", "score": "0.63502026", "text": "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "title": "" }, { "docid": "79905d55d899e3cef8f8bfd312cbfde4", "score": "0.63502026", "text": "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "title": "" }, { "docid": "79905d55d899e3cef8f8bfd312cbfde4", "score": "0.63502026", "text": "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "title": "" }, { "docid": "2e73ed831c9154ee82594ed41c8dc65e", "score": "0.6347271", "text": "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "26da69cb6a7901e016882ac3053d118f", "score": "0.63426447", "text": "def correct_user\n @user = User.find(params[:id])\n\n if @user != current_user\n redirect_to(root_path)\n else\n # nothing to do\n end\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "8ab1eccaac17c1066856d5de78d74ddf", "score": "0.6342538", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" }, { "docid": "05e6f68c10fa105ab20facbe55c95e04", "score": "0.63400817", "text": "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "title": "" }, { "docid": "7495d546e79d00235c8d661f168ed214", "score": "0.63345385", "text": "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "title": "" }, { "docid": "24c3f18b633716e0c7411ce0b28994eb", "score": "0.63329995", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.id == @user.id)\n end", "title": "" }, { "docid": "fe94ba47ab8b3872f12073ca66b6fb0d", "score": "0.6331134", "text": "def correct_user\n @user = User.find(params[:id])\n # current_user?() is a sessions_helper method. The user of the params hash has\n # to match the current user or will be redirected to root\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "722b0c9a7a81966b7237c681de7de365", "score": "0.6330873", "text": "def correct_user\n\t\t@user = User.find(params[ :id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "title": "" }, { "docid": "0b39c90a87cf8a71acec556af4d8c022", "score": "0.632984", "text": "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "a32c434fae7595b464acb6e6ff7910fa", "score": "0.6325074", "text": "def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end", "title": "" }, { "docid": "763fd29d6e3163391eedc11da9811eba", "score": "0.63200074", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) # current_user is method in sessions_helper.rb\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" }, { "docid": "c94803d0b4a63cad1e451402a41f25a6", "score": "0.63152605", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "title": "" } ]
575bec0fa25b4e45d2a50d9ebba1549e
[30, 60, 78, 98, 150] [29, 55, 68, 80, 100]
[ { "docid": "cc24f094eb6d9695b83acc54cfbba5c4", "score": "0.0", "text": "def median(user_ordinate)\n\t len = user_ordinate.length\n\t return (user_ordinate[(len - 1) / 2] + user_ordinate[len / 2]) / 2\n\tend", "title": "" } ]
[ { "docid": "245cb5d90df13e3c529aab5d3c4c8d21", "score": "0.6031285", "text": "def get_squares(arr)\n\tnew_arr = []\n\tarr.each { |index| new_arr << index if arr.include?(index * index) }\n\tnew_arr.sort\nend", "title": "" }, { "docid": "4984d3f11078df89f03de4dae60018b2", "score": "0.6021011", "text": "def projection y\n\ty.map{|item|[-1000, [1000, item].min].max}\nend", "title": "" }, { "docid": "f48b29c056b61563186ce928e07960b8", "score": "0.59266025", "text": "def scale_it\n\tsample = [[3,4,5],[5,12,13],[7,24,25], [8,15,17],[9,40,41]]\n\tholder = []\n\tsample.map do |scaler|\n\t\ti = 2\n\t\twhile i < 50\n\t\t\tif i == 2 || i%2 != 0 \n\t\t\t\tif [scaler[0]*i, scaler[1]*i, scaler[2]*i].reduce(:+) == 1000\n\t\t\t\t\treturn [scaler[0]*i, scaler[1]*i, scaler[2]*i].reduce(:*)\n\t\t\t\tend\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend\nend", "title": "" }, { "docid": "c72cf43b19e793a2ae1f3843ec0d18f0", "score": "0.5836499", "text": "def make_valley(arr)\n higher = []\n lower = []\n # arrange array in order from highest to lowest\n sorted = arr.sort.reverse\n length = arr.length\n # collect values at the indexes with odd numbers as well as those with even numbers\n odd = sorted.values_at(* sorted.each_index.select {|i| i.odd?})\n even = sorted.values_at(* sorted.each_index.select {|i| i.even?})\n\n # if the length of the array is odd, push the lowest number from the 'even' array into 'odd'\n if arr.length % 2 == 1\n low = even.pop\n odd.push(low)\n return even + odd.reverse\n else\n return even + odd.reverse\n end\nend", "title": "" }, { "docid": "05a06b91079d8b188c3abf350566870d", "score": "0.5820865", "text": "def _reduce_50(val, _values, result)\n result = val[2]\n result\nend", "title": "" }, { "docid": "c0acadcc5d3c26ab7e53f728f697f864", "score": "0.5806471", "text": "def range_summary(arr)\r\n start = 0\r\n ranges = []\r\n\r\n (1...arr.length).each do |i|\r\n if arr[i + 1] != arr[i] + 1\r\n ranges << [start, arr[i]]\r\n start = arr[i + 1]\r\n end\r\n end\r\n\r\n ranges\r\nend", "title": "" }, { "docid": "3b09668f644dbd586b4d8580deeaf550", "score": "0.5723865", "text": "def get_squares(numbers)\n #squared = numbers.map{|n| n*n} # => [625, 16, 81, 36, 2500, 256, 25]\n new = Array.new # => []\n numbers.each{|n| new<<n if numbers.include?(n*n) } # => [25, 4, 9, 6, 50, 16, 5]\n new.sort # => [4, 5]\nend # => :get_squares\n\nget_squares [25, 4, 9, 6, 50, 16, 5] # => [4, 5]\n", "title": "" }, { "docid": "7d9ff27e9bb9dbd8058fa7738e934804", "score": "0.572185", "text": "def get_squares(input)\n\tnew = input.select {|element| input.include?(element*element.to_i)}\n\treturn new.sort\nend", "title": "" }, { "docid": "e6a9771492da24399ca81fef9ff74711", "score": "0.5718709", "text": "def repeated_number_ranges(arr)\n \nend", "title": "" }, { "docid": "255570ee28a220b228590f692df7973d", "score": "0.5715207", "text": "def fit_to_board(arr)\n [ (arr[0] + 1), ((arr[1] * 2) - 1) ]\n end", "title": "" }, { "docid": "a83ac0102de3cbc44c45a537eed6f0fc", "score": "0.56991214", "text": "def get_ary val=99\r\n (1..val).inject([]){|x,y| x << y}\r\n end", "title": "" }, { "docid": "f4f0cb8a134c7129925b75dadb5726d7", "score": "0.5694063", "text": "def subdivide( points )\n new_points = []\n points.each_index do |index|\n next if index == (points.length - 1)\n min = points[index]\n max = points[index+1]\n new_points.push min\n mid = (min + max) / 2\n new_points.push mid\n end\n new_points.push points.last\n new_points\nend", "title": "" }, { "docid": "a75f98dbf53db9cf5216364bb92db794", "score": "0.56898576", "text": "def _reduce_96(val, _values, result)\n result = [val[0]]\n \n result\nend", "title": "" }, { "docid": "6fb0587c83da467becbb17f2f63e741c", "score": "0.5678807", "text": "def stockSpanRange( arr)\n _SR = Array.new(arr.length){0}\n _SR[0] = 1\n i = 1\n while (i < arr.length)\n _SR[i] = 1\n j = i - 1\n while ((j >= 0) && (arr[i] >= arr[j]))\n _SR[i] += 1\n j -= 1\n end\n i += 1\n end\n return _SR\nend", "title": "" }, { "docid": "9e1c4957fea4274a32bee11d23e5745f", "score": "0.5677344", "text": "def get_squares(numbers)\n\tnumbers.select {|n| numbers.include? n*n}.sort\nend", "title": "" }, { "docid": "8c678755aff5bcb77269b2a69ab34964", "score": "0.566434", "text": "def range_summary(array)\n # initiate an empty array, accumulator\n # iterate thru the given array looking for contiguity\n # add ints to chunk if contiguos, extract first and last when not contiguos\n\n result = Array.new\n array.each.with_index do |x, i|\n range = []\n if x + 1 == array[i + 1]\n range << x << array[i+1]\n else result << [range.first, range.last]\n # range = []\n end\n end\n\n result\nend", "title": "" }, { "docid": "544aacfe6ef6f923cb90ffbdf97fb7db", "score": "0.5658084", "text": "def solution(a)\n # write your code in Ruby 2.2\n\n min_avg_value = (a[0] + a[1])/ 2.0\n min_avg_position = 0\n\n (0..(a.length-2)).each do |i|\n # 2 elements average\n if(((a[i].to_i + a[i + 1].to_i)/ 2.0) < min_avg_value)\n min_avg_value = (a[i].to_i + a[i + 1].to_i)/ 2.0\n min_avg_position = i\n end\n\n # 3 elements average\n if(((a[i].to_i + a[i + 1].to_i + a[i + 2].to_i)/ 3.0) < min_avg_value)\n min_avg_value = (a[i].to_i + a[i + 1].to_i + a[i + 2].to_i)/ 3.0\n min_avg_position = i\n end\n end\n\n # last 2 elements\n if(((a[a.length - 1].to_i + a[a.length - 2].to_i)/ 2.0) < min_avg_value)\n min_avg_value = (a[a.length - 1].to_i + a[a.length - 2].to_i)/ 2.0\n min_avg_position = a.length - 2\n end\n\n min_avg_position\nend", "title": "" }, { "docid": "ae3de4286606a94032036abca8dfe8e3", "score": "0.56579185", "text": "def list_values(range_array)\n# Method to convert range array into array of values to be used:\n\tdx = (range_array[1]-range_array[0])/(range_array[2]-1.00)\n\treturn Array.new(range_array[2]) {|i| i*dx+range_array[0]}\nend", "title": "" }, { "docid": "f6c9b1943136287b717bbc2da2fa510b", "score": "0.56529915", "text": "def halvsies(arr)\n new_arr = []\n first_arr = []\n second_arr = []\n\n arr.each_with_index do |num, index|\n if index <= arr.size / 2 \n first_arr << num\n else\n second_arr << num\n end\n end\n new_arr.push(first_arr).push(second_arr)\nend", "title": "" }, { "docid": "ae411b96ae6dd9873d20b4816cdb6169", "score": "0.5634027", "text": "def get_squares (ary)\n\n\ta = ary.select {|n| n if ary.include?(n*n)}\n\n\ta.sort\n\nend", "title": "" }, { "docid": "a536b94ec97ea45ee4ef6067d7c014ca", "score": "0.5631107", "text": "def summary_ranges_2 nums\r\n nums.slice_when do |elt_before, elt_after|\r\n elt_before + 1 != elt_after\r\n end.map do |first, *, last|\r\n last ? \"#{first}->#{last}\" : \"#{first}\"\r\n end\r\nend", "title": "" }, { "docid": "a60c490f8e0cffca6690a541308ef0df", "score": "0.5626032", "text": "def lcs(list)\n subs_arr = []\n list.each_with_index do |ele_1, idx_1|\n list.each_with_index do |ele_2, idx_2|\n if idx_2 > idx_1 \n subs_arr << list[idx_1..idx_2]\n end\n end\n end\n max = subs_arr.shift\n subs_arr.each { |ele| max = ele if ele.sum > max.sum } \n max\nend", "title": "" }, { "docid": "285d2e49c760ed24f2673411b06f6a8c", "score": "0.5621307", "text": "def solve(arr)\n\n result = []\n\n arr.each do |i|\n if i < 38\n result << i\n else\n mg1 = i+1\n mg2 = i+2\n if mg1%5 == 0\n result << mg1\n elsif mg2%5 == 0\n result << mg2\n else\n result << i\n end\n end\n end\n\n result.each do |r|\n puts r\n end\n\nend", "title": "" }, { "docid": "42a5a991fdeb8587d1a838fe1b01bbe5", "score": "0.5619046", "text": "def get_squares(arr)\n\treturn arr.select{ |i| i > 0 && i == ( (i**(1.0/2)).to_i )**2 }.uniq.sort\nend", "title": "" }, { "docid": "df39e563498b1321cd90872364c18b6d", "score": "0.5604658", "text": "def sideparameterranges\n result = []\n indices = piecesideindices\n indices.pairs do |i1, i2|\n\tif i1 < 0\n\t indices << piecenumber\n\t i1 = 0\n\tend\n\tresult << (i1.to_f..i2.to_f)\n end\n # puts \"sideparameterranges result #{result.inspect}\"\n return result\n end", "title": "" }, { "docid": "b2357895568c78b2c411529e3df10dd7", "score": "0.558778", "text": "def convert_fracts2(arr)\n denominator = arr.reduce(1) {|den, pair| den.lcm(pair[1])}\n arr.map { |num, den| [num * (denominator / den), denominator] }\nend", "title": "" }, { "docid": "8980e5ab5a6efd7f54ede85aef2aff98", "score": "0.558289", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n\n result\nend", "title": "" }, { "docid": "8980e5ab5a6efd7f54ede85aef2aff98", "score": "0.558289", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n\n result\nend", "title": "" }, { "docid": "9c53c89f1d21ddd06317ae1791627034", "score": "0.55725", "text": "def halvsies(array)\n left = []\n right = []\n array.each_index do |index|\n if index < (array.size / 2.0).ceil\n left << array[index]\n else\n right << array[index]\n end\n end\n [left, right]\nend", "title": "" }, { "docid": "e0d3033f5ddadd73302f08b2e7b3ab93", "score": "0.5570184", "text": "def _reduce_480(val, _values, result)\n result = [val[0]]\n \n result\nend", "title": "" }, { "docid": "9af927911f629da51fdb3efe925ea401", "score": "0.5567346", "text": "def sum_of_range(array)\n # range = (highest - lowest) + 1\n # start with lowest number\n # add number to number + 1\n # do this range times\n array.sort!\n a = array.first # 1\n b = array.last # 4\n\n (a..b).inject { |sum, n| sum + n}\n\nend", "title": "" }, { "docid": "a998b4a2012bfd715b13dcbad28544e0", "score": "0.5561508", "text": "def _reduce_430(val, _values, result)\n result = [ val[0], val[1] ]\n \n result\nend", "title": "" }, { "docid": "b80eeb544f778048c18e86d4b68b8521", "score": "0.5556545", "text": "def absoluteValuesSumMinimization(a)\n a.sort\n a.count.even? ? a[(a.count/2)-1] : a[(a.count/2)]\nend", "title": "" }, { "docid": "0d05859abf20046accb75f419b2987b8", "score": "0.55565137", "text": "def sortByHeight(a)\n x = a.select { |i| i > 0 }.sort\n a.map { |i| i > 0 ? x.shift : -1 }\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.5553057", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "364e5c5baf34079a085b238fed4c867b", "score": "0.55527735", "text": "def halvsies(arr)\n arr1 = arr[0, (arr.size / 2.0).ceil]\n arr2 = arr[(arr.size / 2.0).ceil, arr.size - arr1.size]\n [arr1, arr2]\nend", "title": "" }, { "docid": "6240afc96c7c008198bb843c03bed52e", "score": "0.55495614", "text": "def summary_ranges(nums)\n nums.reduce([]) { |acc, x|\n if acc.empty? || acc.last.last + 1 != x\n acc << [x, x]\n else\n acc << [acc.pop.first, x]\n end\n }.map { |x|\n x.first == x.last ? x.first.to_s : \"#{x.first}->#{x.last}\"\n }\nend", "title": "" }, { "docid": "099d740195ec70cb512f51aaef86d59a", "score": "0.55429757", "text": "def get_squares(numbers)\n\tsquares = numbers.select { |n| numbers.include? n*n }.sort\n\treturn squares\nend", "title": "" }, { "docid": "64ca95b69130afdae4118c56f0ff3165", "score": "0.55422187", "text": "def less_than100(numbers)\n new_arr = []\n numbers.each do |number|\n if number < 100\n new_arr << number\n end\n end\n return new_arr\nend", "title": "" }, { "docid": "818379470d96fccd762168075724de4f", "score": "0.5540498", "text": "def max_2_prefer_short arr\n best_arr, best_sum = [], -1.0/0\n\n (0...arr.size).each do |i|\n (i...arr.size).each do |j|\n sum = arr[i..j].inject { |sum,x| sum+x }\n best_sum, best_arr = sum, arr[i..j] if sum > best_sum or\n (sum == best_sum and\n arr[i..j].size < best_arr.size)\n end\n end\n\n best_arr\nend", "title": "" }, { "docid": "9d3c64b59de616e26213f2a034ecd2e6", "score": "0.55373174", "text": "def repeated_number_ranges(arr)\n return array(arr)\nend", "title": "" }, { "docid": "a01ccca8ead54cb2855cf7abcc02bc60", "score": "0.55354583", "text": "def rod_cutting size\n (1..size).each do |i|\n @result[i] = @prices[i]\n\n (1..i/2).each do |j|\n @result[i] = [ @result[i], @result[j] + @result[i - j] ].max\n end\n end\n\n @result[size]\nend", "title": "" }, { "docid": "d9c8d4e04736517462206625c8418318", "score": "0.5532318", "text": "def halvsies(arr)\n first = arr.slice(0, (arr.size / 2.0).ceil)\n second = arr.slice(first.size..-1) # or to be consistent use start and length, i.e. `first.size, arr.size - first.size`\n\n [first, second]\nend", "title": "" }, { "docid": "1c5f36f6983342c55cffcf69ac446661", "score": "0.5528996", "text": "def make_container\n initial = (0..8).to_a.collect{|n| ((10*n)..(10*(n+1) - 1)).to_a }\n initial[0].delete(0); initial[-1].push(90)\n initial\nend", "title": "" }, { "docid": "76627cb9c1891d7bf95625a22251135f", "score": "0.5528522", "text": "def lcs1(arr)\n best_arr = [arr[0]]\n curr_arr = []\n arr.each do |ele|\n curr_arr = curr_arr.push(ele)\n if curr_arr.sum > best_arr.sum\n best_arr = curr_arr.dup\n end\n if curr_arr.sum < 0\n curr_arr = []\n end\n end\n return best_arr.sum\nend", "title": "" }, { "docid": "e1fb9f45108afcf3734924e574b65a1d", "score": "0.5527471", "text": "def lss(arr)\n subs = []\n \n\n (0...arr.length-1).each do |i|\n (i+1...arr.length).each do |j|\n subs << arr[i..j].sum\n end\n end\n subs.max\nend", "title": "" }, { "docid": "8a82ed9622cf5367b905dbe945e487c0", "score": "0.5521081", "text": "def _reduce_50(val, _values, result)\n result = val[0].to_i\n result\nend", "title": "" }, { "docid": "cb0c3cde3d84e5dd426dfa6e87b5cb1f", "score": "0.5497928", "text": "def stretch(list)\n result = []\n list.each do |integer|\n addend1 = integer / 2\n addend2 = integer - addend1\n result << addend1 << addend2\n end\n return result\nend", "title": "" }, { "docid": "ba63f6e070283bd7bd169ecdad9b98aa", "score": "0.5490329", "text": "def get_squares(numbers)\n array = numbers.select { |number| numbers.include? number * number }\n array.sort\nend", "title": "" }, { "docid": "31375251f9c7de4926d0bec97c9c19a3", "score": "0.54858816", "text": "def divide a\n a.each_slice( (a.size/2.0).round ).to_a\nend", "title": "" }, { "docid": "6dc0448e7243808fef0bf43b828cf322", "score": "0.5483816", "text": "def halvsies(arr)\n middle = (arr.size/2.0).ceil\n [arr[0...middle], arr[middle..arr.size]]\nend", "title": "" }, { "docid": "cc512b90fd526697569a7093516fef7c", "score": "0.54807454", "text": "def _reduce_125(val, _values, result)\n result = [ val[0] ]\n\n result\nend", "title": "" }, { "docid": "1c09815ed458a17117c66b2003e993f3", "score": "0.5479442", "text": "def get_squares(numbers)\n numbers.select { |n| numbers.include? n*n }.sort\nend", "title": "" }, { "docid": "59a3ddd1b315b03b6dd7625cdb96a83d", "score": "0.54792416", "text": "def next_greater_elements(nums)\n length = nums.length\n output = Array.new(nums.length, -1)\n stack = []\n # traverse array twice.\n Range.new(0, length * 2).each do |idx|\n circular_id = idx % length\n while stack.any? && nums[stack[-1]] < nums[circular_id]\n top = stack.pop\n output[top] = nums[circular_id]\n end\n stack.push circular_id\n end\n output\nend", "title": "" }, { "docid": "de29d15f79535b97a79dbf6586f433ad", "score": "0.5472403", "text": "def lcs(arr)\n result = []\n # n!\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n result << arr[i..j]\n end\n end\n # n\n sum = result.shift.reduce(:+)\n result.each do |arr|\n sum = arr.reduce(:+) if sum < arr.reduce(:+)\n end\n sum\nend", "title": "" }, { "docid": "a7446e1809cd3b996f738249b9be3e0d", "score": "0.5470241", "text": "def sorted_squares(a)\n a.map{|e| e * e}.sort\nend", "title": "" }, { "docid": "7383e62da38088a51dced6414ad78fce", "score": "0.54654515", "text": "def split(lista, pivot)\n [lista[0...pivot].sum, lista[pivot..lista.count].sum].max\nend", "title": "" }, { "docid": "f8d6f83f62af9a478013525c882dbe32", "score": "0.54649764", "text": "def lcs1(list)\n subs = []\n greatest_sum = 0\n\n list.each_with_index do |el1, idx1|\n list.each_with_index do |el2, idx2|\n next if idx1 >= idx2\n\n subs << list[idx1..idx2] unless list[idx1..idx2].empty?\n end\n end\n p subs\n subs.each do |slice|\n current_sum = slice.inject(:+)\n if current_sum > greatest_sum\n greatest_sum = current_sum\n end\n end\n\n greatest_sum\nend", "title": "" }, { "docid": "83786fb803b61b98f2adcc9b8dfd5d7a", "score": "0.5463462", "text": "def get_squares(numbers)\n numbers = numbers.to_a\n\n sq_array=[]\n numbers.each { |n| sq_array << n if numbers.include?(n**2)}\n\n return sq_array.sort\n\nend", "title": "" }, { "docid": "c49551f113306d2fe383d5f681ed164c", "score": "0.546322", "text": "def sub_one_hundred(array)\n new_array = []\n for el in array do\n if el < 100\n new_array.push(el)\n end\n end\n return new_array\nend", "title": "" }, { "docid": "eddcee9251dd7a31b240e0c650bc5fc7", "score": "0.54631436", "text": "def _reduce_552(val, _values, result)\n result = [ val[0], val[1] ]\n \n result\nend", "title": "" }, { "docid": "ddad2b82d4b72c6856200ef99efe4ba2", "score": "0.5461665", "text": "def stock_picker(a)\n\tmax = -1\n\tret = []\n\ta.length.times do |x|\n\t\tx.upto(a.length - 1) do |y|\n\t\t\tif a[y] - a[x] > max and y > x\n\t\t\t\tret = [x, y]\n\t\t\t\tmax = a[y] - a[x]\n\t\t\tend\n\t\tend\n\tend\n\n \tprint ret\nend", "title": "" }, { "docid": "99381b73be250fc4462fe7844950b127", "score": "0.5457393", "text": "def icecreamParlor(m, arr)\n arr.each.with_index do |element1, index1|\n arr.each.with_index do |element2, index2|\n if((element1 + element2) == m && (index1 != index2))\n return [index1+1, index2+1]\n end\n end\n end\n\nend", "title": "" }, { "docid": "68b63d97e2118b8f3a46d53f046903cc", "score": "0.5456732", "text": "def _reduce_125(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "68b63d97e2118b8f3a46d53f046903cc", "score": "0.5456732", "text": "def _reduce_125(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "68b63d97e2118b8f3a46d53f046903cc", "score": "0.5456732", "text": "def _reduce_125(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "68b63d97e2118b8f3a46d53f046903cc", "score": "0.5456732", "text": "def _reduce_125(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "a8e9023b9e888ab34db6a489003cb2bf", "score": "0.54552144", "text": "def ArrayAddition(arr)\n largest = arr.sort.last\n arr = arr.sort[0..-2]\n slices = []\n (2..(arr.size)).each do |num|\n slices << arr.combination(num).map{|item| item.inject(:+)}\n end\n slices.flatten.include?(largest)\nend", "title": "" }, { "docid": "bd4f0da77013be8660571334947dc582", "score": "0.54544425", "text": "def lcs_two(arr)\n current = arr.first\n max = arr.first\n arr[1...arr.length].each do |el|\n current = 0 if current < 0\n current += el\n max = current if current > max\n end\n max\nend", "title": "" }, { "docid": "d63540fabb9ead12757200f9be974341", "score": "0.5453445", "text": "def l_c_s(arr)\n collection = [] #O(n!)\n\n arr.each_with_index do |e, i|\n arr.each_with_index do |e2, i2|\n next if i > i2\n collection << arr[i..i2]\n end\n end\n max = collection.first.inject(:+)\n collection.each do |subarr| #O(n* n!)\n sum = subarr.inject(:+)\n max = sum if sum > max\n end\n max\nend", "title": "" }, { "docid": "3c811fe46647b914ddc8c93490fc80e4", "score": "0.543991", "text": "def get_squares(numbers)\n numbers.select {|x| numbers.include? x*x}.sort\nend", "title": "" }, { "docid": "cacfcee9f4f36db314894b97089ed377", "score": "0.5433207", "text": "def example2()\n\tarr = 1.upto($limit).each_with_index.map {|index| if (divisorSum(index) > index + 1) then index end}.compact\n\t#arr.each_with_index { |n,index| if(n.nil? == false) then printf \"index %d = %d\\n\",index, n end }\n\t#p divisorSum(16)\n\t#p arr\n\t#arr = arr.product(arr)\n\t#arr2 = {}\n\tarr.sort\n\tarr2 = []\n\ti = 0\n\twhile (i < arr.length)\n\t\tj = 0\n\t\twhile(j < arr.length)\n\t\t#if(arr[i] + arr[j] <= $limit and arr2[arr[i] + arr[j]].nil? == false) then\n\t\t#\tarr2.merge(i => arr[i] + arr[j])\n\t\t#end\n\t\tif(arr[i] + arr[j] <= $limit) then\n\t\t\tarr2.push(arr[i] + arr[j])\n\t\telse\n\t\t\tbreak\n\t\tend\n\t\tj = j +1\n\t\tend\n\t\ti = i + 1\n\tend\n\tarr2 = arr2.uniq!\n\tp arr2\n\t#p \"---------------------\"\n\t#arr = arr.map {|mylist| mylist.reduce(:+) }.uniq!\n\ttotal = 0\n\t1.upto($limit) do |index|\n\t\tif(arr.include?(index) == false) then\n\t\t\ttotal = total + index\n\t\t\t#p index\n\t\tend\n\tend\n\ttotal\nend", "title": "" }, { "docid": "ff48f3f717e22e1eb948112d416f7f3e", "score": "0.5429762", "text": "def range(arr)\n sorted = arr.sort\n return sorted.last - sorted.first\nend", "title": "" }, { "docid": "886107f5d8844a343f5bc716d914a63b", "score": "0.54243207", "text": "def sum_of_squares range\n range.collect{|i| i**2}.inject(:+)\nend", "title": "" }, { "docid": "73f39ebd1929381caccd364d7a5a86e1", "score": "0.54178095", "text": "def get_squares(nums)\n nums.select { |n| nums.include? n*n }.sort\nend", "title": "" }, { "docid": "3c72c2dc4be50dbd4898a7f8a0796260", "score": "0.54176503", "text": "def get_intervals()\n ans = []\n arr = @x.to_a.sort\n arr.each do |v|\n if ans.empty? || ans[-1][-1]+1 < v\n ans.push([v,v])\n else\n ans[-1][-1] = v\n end\n end\n return ans\n end", "title": "" }, { "docid": "5765a6f9b9da125e6820aac2ab06af15", "score": "0.5416012", "text": "def two_sum(nums, target)\n histo = {}\n nums.each_with_index do |num, index|\n counterpart = target - num\n if histo[counterpart] && histo[counterpart] != index\n return [index, histo[counterpart]]\n end\n histo[num] = index\n end\n []\nend", "title": "" }, { "docid": "b878baf9a0f37ef0d0967e160247e6ca", "score": "0.54133326", "text": "def stretch(array_of_integers)\n stretched_array = []\n array_of_integers.each do |integer|\n if integer %2 == 0\n stretched_array << integer/2\n stretched_array << integer/2\n else\n stretched_array << integer/2 + 1\n stretched_array << integer/2\n end\n end\n return stretched_array\nend", "title": "" }, { "docid": "1c02ca67465e5b5e7ab3079e6ffd78d3", "score": "0.54127675", "text": "def square_greaterthan_350(array)\n first_sq = []\n all_squares(array).each do |el|\n if el > 350\n first_sq << el\n else\n end\n end\n first_sq\n end", "title": "" }, { "docid": "95051e86e007781a3316dfcf58e94d47", "score": "0.5412368", "text": "def numbers_map()\n [0,3,7,2,9,4,8,6,5,1]\n end", "title": "" }, { "docid": "d574b4780168911e863078f6a3a013f2", "score": "0.54110396", "text": "def stocks(array)\n arr = []\n (0...array.length - 1).each do |buy_d|\n (buy_d + 1..array.length - 1).each do |sell_d|\n buy_price = array[buy_d]\n sell_price = array[sell_d]\n if ((sell_price.to_f - buy_price.to_f) / buy_price.to_f) >= 0.2\n arr << [buy_d, sell_d]\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "71665bc9ddd5947ccdf7e3d18f28e7a3", "score": "0.54073685", "text": "def sum_over_50(arr)\n arr.reject{|num| num <= 50}.inject(0,&:+)\n end", "title": "" }, { "docid": "bc401ccc8310ff9c770045cc610afabd", "score": "0.5405137", "text": "def second_great_low(arr)\n \"#{arr.uniq.min(2).last} #{arr.uniq.max(2).last}\"\nend", "title": "" }, { "docid": "d22dcf2280b912bb0c8bc5f01b7da765", "score": "0.540312", "text": "def find_pair(array,sum)\n values = []\n array.each_with_index do |element,index|\n values.push(\"#{sum - element},#{element}\") if array.slice(index+1,array.length).include?(sum - element)\n end\n values\nend", "title": "" }, { "docid": "11788dc260ae8656ed58b746bf9363b1", "score": "0.54027456", "text": "def get_squares(arr)\n results = []\n arr.each {|x| results << x if arr.include?(x*x)}\n results.sort\nend", "title": "" }, { "docid": "f7a240af5bdd7dd38f5409635c1e0eb3", "score": "0.53987134", "text": "def convertFracts(lst)\r\n\td = lst.reduce(1) {|x,y| x.lcm(y[1]) }\r\n\tlst.map {|x| [d/x[1]*x[0],d] }\r\nend", "title": "" }, { "docid": "96d9edc2ba3809c772a76f1860fe1008", "score": "0.53978217", "text": "def get_sum(a,b)\n\n #if statement - convert to arrays with full range of numbers in each (a to b) if a is bigger and (b to a) if vice versa \n if b < a\n new_array = (b..a).to_a\n else\n new_array = (a..b).to_a\n end\n\n result = new_array.sum\n\nend", "title": "" }, { "docid": "9eff65814391c7285afc2f2f87a89d08", "score": "0.53957736", "text": "def sub_sum_1(list) # time complexity is O(n^3)\n sub_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n sub_arr << list[i..j]\n end\n end\n sub_arr.inject { |arr1, arr2| arr2.sum > arr1.sum ? arr1 = arr2 : arr1 }.sum\nend", "title": "" }, { "docid": "00492267ad2757b556e3851edc7ec5a1", "score": "0.5395423", "text": "def corgi_golden_age(arr)\n\tstart = 0\n\t\n\tdistance = 0\n\tbest = 0\n\n\twhile distance < arr.length\n\t\tstart = 0 #ADDED\n\t\tfinish = distance + start# ADDED\n\t\twhile finish < arr.length\n\t\t\tsum = 0\n\t\t\tarr[start..finish].each {|e| sum += e}\n\t\t\tif sum > best\n\t\t\t\t#puts sum <- TEST POINT\n\t\t\t\tbest = sum\n\t\t\t\tbest_start = start\n\t\t\t\tbest_finish = finish\n\t\t\tend\n\t\t\tstart += 1\n\t\t\tfinish = distance + start\n\t\tend\n\t\tdistance += 1\n\tend\n\treturn [best_start, best_finish]\nend", "title": "" }, { "docid": "8e87401bef7a585f6aad855e1a534e21", "score": "0.5393679", "text": "def halvsies(arr)\n len = arr.length\n# mid = len.odd? ? (len / 2) + 1 : len / 2\n mid = (len / 2.0).ceil\n first_arr = arr.slice(0, mid)\n second_arr = arr.slice(mid, len - first_arr.size)\n\n [first_arr, second_arr]\nend", "title": "" }, { "docid": "c41477820b404aaa388019250dc19b5d", "score": "0.53928995", "text": "def stock_picker array\r\n\tprofit = 0\r\n\tmax = 0\r\n\tmin = 0\r\n\t(0..array.size).each do |i|\r\n\t\tarray[i..-1].each do |j|\r\n\t\t\ttemp = j - array[i]\r\n\t\t\tif temp > profit\r\n\t\t\t\tprofit = temp\r\n\t\t\t\tmin = i\r\n\t\t\t\tmax = array.find_index(j)\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tp [min, max]\r\nend", "title": "" }, { "docid": "c67548d37343e1c3863dffb35869487d", "score": "0.5390799", "text": "def kadane(x)\n max_sum = -1000000000 # -Infinite\n max_start_index = 0\n max_end_index = 0\n current_max_sum = 0\n current_start_index = 1\n\n (0..(x.length-1)).each do |current_end_index|\n current_max_sum += x[current_end_index]\n if current_max_sum > max_sum\n max_sum = current_max_sum\n max_start_index = current_start_index\n max_end_index = current_end_index\n end\n\n if current_max_sum < 0\n current_max_sum = 0\n current_start_index = current_end_index + 1\n end\n end\n\n return [max_sum, max_start_index, max_end_index]\nend", "title": "" }, { "docid": "10744c9259954c6bedde02579e6b6692", "score": "0.53891957", "text": "def v2(list)\n tally = list[0]\n other_tally = 0\n list.each do |el|\n if other_tally + el >= 0\n other_tally += el\n else\n other_tally = 0\n end\n if tally < other_tally\n tally = other_tally\n end\n end\n tally\nend", "title": "" }, { "docid": "f17fe4b1a1ea89dad5a2c0676cc8cc39", "score": "0.53837377", "text": "def solution_space\n space = []\n (0..333).to_a.each do |a|\n (1..500).to_a.each do |b|\n c = 1000 - a - b\n possible_solution = [a, b, c]\n if (a < b) && (b < c)\n space << possible_solution\n end\n end\n end\n return space\nend", "title": "" } ]
1c63a99f8ade8b67adf02b75d3dc3a9f
Check for previous execution (looks for outputs folder/s existence)
[ { "docid": "3b406111e73192ec0ec2a6143bdf2afa", "score": "0.709408", "text": "def check_previous_execution(output_folders,force_execution)\n\t# test each folder existence\n\toutput_folders.each do |folder|\n\t\tif Dir.exist?(folder)\n\t\t\tmsg = \"Output folder #{folder} already exists. \"\n\t\t\tif force_execution\n\t\t\t\tmsg << \"Force execution parameter is set to true. Removing #{folder}\"\n\t\t\t\tSTDERR.puts \"WARNING. \" + msg\n\t\t\t\tFileUtils.rm_rf(folder)\n\t\t\telse\n\t\t\t\tmsg << \"To retry, remove it or add --force parameter to the command line.\"\n\t\t\t\tSTDERR.puts \"ERROR. \" + msg\n\t\t\t\texit(-1)\n\t\t\tend\n\t\tend\n\tend\n\nend", "title": "" } ]
[ { "docid": "a3a9abebafb32efc19cf6ccf30816d9c", "score": "0.6279552", "text": "def setup_output\n raise \"Please blow away output from previous run of this tool at: #{output_path}\" if Dir.exist?(output_path)\n shell_command(\"mkdir #{output_path}\")\n shell_command(\"mkdir #{temp_path}\")\n end", "title": "" }, { "docid": "be75e791c523738c1148439938c6daab", "score": "0.6099864", "text": "def extractor_has_no_output_flag(execmd, basedir, file, odir, idx, ac)\n FileUtils.mkdir_p(odir)\n rfile = File.absolute_path(file)\n absodir = File.absolute_path(File.join(basedir, odir))\n relfile = Pathname.new(rfile).relative_path_from(absodir).to_s\n #relfile = Pathname.new(absodir).relative_path_from(rfile).to_s\n relfile =File.join(\"..\", file)\n #p [basedir, file, rfile, absodir, relfile]\n #exit\n begin\n Dir.chdir(odir) do\n $stderr.printf(\"rfile: %p\\n\", rfile)\n realcmd = execmd.map{|v|\n if v == \"%\" then\n relfile\n else\n v\n end\n }\n return shsystem(realcmd, idx, ac)\n end\n ensure\n if File.empty?(odir) then\n begin\n Dir.rmdir(odir)\n rescue\n end\n end\n end\n end", "title": "" }, { "docid": "33b8f910dccf4972ba9a0bc34d3de907", "score": "0.60849863", "text": "def build_and_check_output_directory\n directory = @arguments[:output_directory]\n\n if directory && Dir.exist?(directory)\n directory[-1] == '/' ? directory : \"#{directory}/\"\n else\n DEFAULT_DIRECTORY\n end\n end", "title": "" }, { "docid": "917ac869b2b75ae10af68507b7b0079c", "score": "0.5972459", "text": "def finalise_results_directory\n copy_file(executed_script_path, \"#{results_path}/executed_script.sh\")\n end", "title": "" }, { "docid": "43504578915c6403626428da85928dc5", "score": "0.5914126", "text": "def keep_outputs?\n ENV[\"KEEP_OUTPUTS\"] == \"true\"\n end", "title": "" }, { "docid": "254ca793478237c0b939dc4e2535779d", "score": "0.59087723", "text": "def compile_output_exists?(file)\n if Dir[\"#{file}\"].empty?\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "c0f1e2ce33b688df41b242fa63f8e5b4", "score": "0.58783567", "text": "def pre_output\n @did_tests_fail = tests_failed?\n end", "title": "" }, { "docid": "9338f05b5132e4ab69afb7fcecc415c8", "score": "0.58533764", "text": "def ensure_output_dir!\n FileUtils.mkdir_p(output_dir) unless FileTest.exist?(output_dir)\n end", "title": "" }, { "docid": "2bbfe33b2a4881d903643cbbc69336c1", "score": "0.5843934", "text": "def full_filename_set_prev_run_task_has_run\n env_prefix = Rails.env.production? ? '' : \"#{Rails.env}_\"\n File.join(Rails.configuration.paths['log'].absolute_current, \"#{env_prefix}#{SET_PREV_ALREADY_RUN_FN}\")\n end", "title": "" }, { "docid": "a70924d7ea857b6b04e1066ffee2f635", "score": "0.5784239", "text": "def check_and_report_output(file)\n if compile_output_exists?(file)\n puts \"Successfully compiled #{file}.\"\n else\n puts \"Failed to compiled #{file}.\"\n end\nend", "title": "" }, { "docid": "2b0e8e75395ce1c32377f71f50137ea6", "score": "0.57600796", "text": "def prepare_output_path output_path\n unless File.exists?(output_path)\n Dir.mkdir(output_path)\n end\n output_path\n end", "title": "" }, { "docid": "60dedd8b7ccd12e9ce8f04735455b0f5", "score": "0.57488745", "text": "def check_files(cli)\n cli.say 'Looking for outdated files in results'\n n, k = cli.load_project.dataset_names.size, 0\n cli.load_project.each_dataset do |d|\n cli.advance('Datasets:', k += 1, n, false)\n d.each_result do |r_k, r|\n ok = true\n r.each_file do |_f_sym, _f_rel, f_abs|\n unless File.exist? f_abs\n ok = false\n break\n end\n end\n unless ok\n cli.say \" > Registering again #{d.name}:#{r_k} \"\n d.add_result(r_k, true, force: true)\n sr = d.result(:stats) and sr.remove!\n end\n end\n end\n cli.say\n end", "title": "" }, { "docid": "60dedd8b7ccd12e9ce8f04735455b0f5", "score": "0.57488745", "text": "def check_files(cli)\n cli.say 'Looking for outdated files in results'\n n, k = cli.load_project.dataset_names.size, 0\n cli.load_project.each_dataset do |d|\n cli.advance('Datasets:', k += 1, n, false)\n d.each_result do |r_k, r|\n ok = true\n r.each_file do |_f_sym, _f_rel, f_abs|\n unless File.exist? f_abs\n ok = false\n break\n end\n end\n unless ok\n cli.say \" > Registering again #{d.name}:#{r_k} \"\n d.add_result(r_k, true, force: true)\n sr = d.result(:stats) and sr.remove!\n end\n end\n end\n cli.say\n end", "title": "" }, { "docid": "55f9a3c90b1799bacef7d83dbbc1f774", "score": "0.57411283", "text": "def validateOutputLocation(outputDirectory)\n @outDir = outputDirectory.dup\n @outDir.strip!\n\n if !File::exist?(@outDir) || !File::writable?(@outDir)\n raise \"Error: Specified output directory \" + @outDir + \" does not exist or is not writable\"\n end\n end", "title": "" }, { "docid": "1fa875544b8abec19c22932e4a4d5ed1", "score": "0.5687462", "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": "bac107da6c7be574dedc6cfd428f4aa4", "score": "0.5643232", "text": "def create_base_output_path_if_missing()\n output_path = ENV.include?(\"output_path\") ? ENV[\"output_path\"] : LOCALCOPY_DIR\n puts \"output_path: #{output_path}\"\n # Create the base output path, if missing:\n FileUtils.mkdir_p( output_path ) if !File.directory?( output_path )\n output_path\n end", "title": "" }, { "docid": "e67f2c0496fa6b9cf956517d688558e0", "score": "0.5638787", "text": "def reset\n #if File.directory?(output)\n File.utime(0,0,output) unless $NOOP\n puts \"Marked #{output} as out-of-date\"\n #end\n end", "title": "" }, { "docid": "e02ed8044c14c2bc18199edfcf4010a1", "score": "0.5617739", "text": "def has_output?\n return !@outputs.empty?\n end", "title": "" }, { "docid": "b75352d7ff45726b643ad94bca41e916", "score": "0.5616855", "text": "def reset\n if File.directory?(output)\n File.utime(0,0,output)\n report \"reset #{output}\" #unless dryrun?\n end\n end", "title": "" }, { "docid": "cd62ec5229be1d6ff114cc30803ed081", "score": "0.56165123", "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": "79f3b6e2a78bfcbcf24e1d8fdf0f697b", "score": "0.55997294", "text": "def cleanOutput\r\n\tif(!File.exists?(@outputDir))\r\n\t\tFileUtils.mkdir(@outputDir)\r\n\t\treturn\r\n\tend\r\n\r\n\tif(File.directory?(@outputDir))\r\n\t\tFileUtils.rm_r(@outputDir)\r\n\t\tFileUtils.mkdir(@outputDir)\r\n\tend\r\n\r\n\t\r\n end", "title": "" }, { "docid": "79f3b6e2a78bfcbcf24e1d8fdf0f697b", "score": "0.55997294", "text": "def cleanOutput\r\n\tif(!File.exists?(@outputDir))\r\n\t\tFileUtils.mkdir(@outputDir)\r\n\t\treturn\r\n\tend\r\n\r\n\tif(File.directory?(@outputDir))\r\n\t\tFileUtils.rm_r(@outputDir)\r\n\t\tFileUtils.mkdir(@outputDir)\r\n\tend\r\n\r\n\t\r\n end", "title": "" }, { "docid": "45f8946ff34d46f3d518a58066da6fa8", "score": "0.5597938", "text": "def check_continue\n @continue_enabled = (Dir.glob('Save*.rvdata').size > 0)\n end", "title": "" }, { "docid": "27994858d6a77b36176e8ca1461855c5", "score": "0.5595203", "text": "def clear_output\n FileUtils.remove_dir \"output\" if File.exist? \"output\"\n FileUtils.mkdir \"output\"\n end", "title": "" }, { "docid": "44868c15afddb0e26048c79e62ac26a2", "score": "0.55694187", "text": "def temporary_output_path\n Gym.cache[:temporary_output_path] ||= Dir.mktmpdir('gym_output')\n end", "title": "" }, { "docid": "62946fba8ce6a19c51b78144142678d8", "score": "0.5568803", "text": "def set_run_script_to_always_run_when_no_input_or_output_files_exist(project:)\n project.targets.each do |target|\n run_script_build_phases = target.build_phases.filter { |phase| phase.is_a?(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) }\n cocoapods_run_script_build_phases = run_script_build_phases.filter { |phase| phase.name.start_with?(\"[CP\") }\n cocoapods_run_script_build_phases.each do |run_script|\n next unless (run_script.input_paths || []).empty? && (run_script.output_paths || []).empty?\n run_script.always_out_of_date = \"1\"\n end\n end\n project.save\nend", "title": "" }, { "docid": "e6405eb60441909918b8571f6b02563f", "score": "0.55548733", "text": "def remove_output_files\n # prevent failures when bucket doesn't exist, or if this is running in a cleanup job after a study is destroyed\n # these are mostly for protection in CI when calling study.destroy_and_remove_workspace\n # in production, DeleteQueueJob will handle all necessary cleanup\n return true if study.nil? || study.detached || study.queued_for_deletion\n\n identifier = \"#{study.accession}:#{annotation_identifier}\"\n bucket_files.each do |filepath|\n remote = ApplicationController.firecloud_client.get_workspace_file(study.bucket_id, filepath)\n if remote.present?\n Rails.logger.info \"Removing DE output #{identifier} at #{filepath}\"\n remote.delete\n end\n end\n\n if is_author_de\n filepath = manifest_bucket_path\n remote = ApplicationController.firecloud_client.get_workspace_file(study.bucket_id, filepath)\n Rails.logger.info \"Removing manifest for #{identifier} at #{filepath}\"\n remote.delete if remote.present?\n end\n end", "title": "" }, { "docid": "77e57f32912b8964e652e36f56885a87", "score": "0.5548575", "text": "def move_to_output_location(output_location)\n FileUtils.mkdir_p(output_location) unless File.directory?(output_location)\n Dir.chdir output_location\nend", "title": "" }, { "docid": "33955e26ec33beb1452b209dcfe6f167", "score": "0.5524359", "text": "def focused_check(arguments, folder)\n copy_files(folder)\n executed = launch_binary(arguments, folder)\n run_post_execution_actions(folder)\n check_with_folder(folder) if executed\nend", "title": "" }, { "docid": "b92edff735e958ebbe50bb4afc13fc4e", "score": "0.55098766", "text": "def setup_results_dir\n FileUtils.mkdir_p(results_dir) unless results_dir.exist?\n latest_link = results_dir.parent.join(\"latest\")\n FileUtils.rm_f(latest_link)\n FileUtils.ln_sf(results_dir, latest_link)\n end", "title": "" }, { "docid": "82e22979715b00868dbe39588a90b3fa", "score": "0.5506494", "text": "def check_setup(input_directory = @input_directory, output_directory = @output_directory)\n # Check Input Directory\n raise(IOError, \"#{input_directory}: not found.\") unless File.directory?(input_directory)\n\n # Check Gradient Tensor Files\n ensure_file_exists @config[:bvectors_file], @config[:bvalues_file] \n \n unless @config[:dry_run]\n # Check Working Input Directory\n if @config[:force_sandbox]\n path = Pathname.new(input_directory)\n # @working_input_directory = path.sandbox(input_directory)\n @working_input_directory = path.prep_mise(input_directory + '/', Dir.mktmpdir + '/')\n @working_input_directory = File.join(@working_input_directory, File.basename(input_directory))\n else\n @working_input_directory = input_directory\n end\n \n # Check Output Directory and force cleanup if necessary.\n colliding_files = Dir.glob(File.join(output_directory, @file_prefix) + '*')\n puts colliding_files\n if File.directory?(output_directory) && colliding_files.empty? == false\n if @config[:force_overwrite] then colliding_files.each {|file| puts \"Removing #{file}...\"; File.delete(file) }\n else raise(IOError, \"#{output_directory} already exists. Set force_overwite in your spec file to overwrite the directory.\") \n end\n end\n FileUtils.mkdir_p(output_directory)\n else\n # Use the real input directory if the working directory was not assigned \n # (ie during dry run)\n @working_input_directory = input_directory\n end\n \n # Setup Logging\n logfile = File.join(output_directory, \"#{File.basename(input_directory)}_#{today}.log\")\n if File.writable?(output_directory) && ! @config[:dry_run]\n $LOG = Logger.new(logfile)\n else\n $LOG = Logger.new(STDOUT)\n end\n \n # Switch CWD (default output location for rotbvecs script)\n @cwd = Dir.pwd\n Dir.chdir(output_directory) unless @config[:dry_run]\n end", "title": "" }, { "docid": "8a5e794d84da3e22b347e2ce19f084c3", "score": "0.5499443", "text": "def output_folder\n folder1 = File.join(Dir.pwd, 'maze_output')\n folder2 = @scenario.failed? ? 'failed' : 'passed'\n folder3 = Maze::Helper.to_friendly_filename(@scenario.name)\n\n File.join(folder1, folder2, folder3)\n end", "title": "" }, { "docid": "cc774b7edf8509e3b2a68ef838704c4c", "score": "0.54784024", "text": "def step_file_missing\n puts 'Step file missing: please run --generate first!'\n .colorize(:light_red)\n false\n end", "title": "" }, { "docid": "f0fd5f641fbafa74b253dec7ade0d3b5", "score": "0.5476797", "text": "def path_expects_output\n unless @path_expects_output\n basename = File.basename(self.path_file)[/(.*)@/,1] + '.txt'\n @path_expects_output = File.join( self.dir_expects, basename )\n unless File.exist?(@path_expects_output)\n SHARED_LOGGER.warn(\"The expectations file #{@path_expects_output} doesn’t seem to exist.\")\n end\n end\n\n @path_expects_output\n end", "title": "" }, { "docid": "0d9bc0f9de6f06ce0e0179e44a8c46c1", "score": "0.54628444", "text": "def reset\n FileUtils.rm_rf(output_dir) if File.directory?(output_dir)\n FileUtils.mkdir(output_dir) unless File.directory?(output_dir)\n Laze.debug \"Emptied output directory #{output_dir}\"\n end", "title": "" }, { "docid": "69047051fc59e657bf57839def3f53a7", "score": "0.54583454", "text": "def stale_files_check\n # The ctime will always be reflective of when the file was installed, where mtime is not being\n # set when the file is extracted from a package. By using ctime to sort the files, the newest\n # file is always the file to keep, and it's name is excluded from the output to the user.\n sprocket_files = Dir.glob(\"#{base_path}/embedded/service/gitlab-rails/public/assets/.sprockets-manifest*\").sort_by { |f| File.ctime(f) }\n return unless sprocket_files.size > 1\n\n puts \"WARNING:\"\n puts \"GitLab discovered stale file(s) from a previous install that need to be cleaned up.\"\n puts \"The following files need to be removed:\"\n puts \"\\n\"\n puts sprocket_files.take(sprocket_files.size - 1)\n puts \"\\n\"\nend", "title": "" }, { "docid": "633d3dee47c74a5d5a159b9dac19ab11", "score": "0.545709", "text": "def check_for_web_page_overwrite\n if File.exist?(HTML_OUT_FNAME)\n STDERR.puts <<-OVERWRITE_EOM\n\n WARNING: This program will create the file '#{HTML_OUT_FNAME}',\n however this file already exists in this directory!\n\n 1) Please check that you are running this program in the right\n directory.\n\n 2) Otherwise, please move, rename or delete the existing file\n '#{HTML_OUT_FNAME}' before running this program again.\n\n Program now ending.\n\n OVERWRITE_EOM\n exit 2\n end\nend", "title": "" }, { "docid": "a5bf1acccf5e0ee8cbec7699e7854f15", "score": "0.5442575", "text": "def changed?\n if exist?\n File.read(output) != result\n else\n true\n end\n end", "title": "" }, { "docid": "a5bf1acccf5e0ee8cbec7699e7854f15", "score": "0.5442575", "text": "def changed?\n if exist?\n File.read(output) != result\n else\n true\n end\n end", "title": "" }, { "docid": "62c8e31771977e48a3e77dd2ba571639", "score": "0.5433894", "text": "def setup_script_execution\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__TestScript*')).should be_empty\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '[0-9]*')).should be_empty\n AgentConfig.cache_dir = File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, 'cache')\n end", "title": "" }, { "docid": "934e9ddf1b79b3d06cfb55fea23b20bb", "score": "0.5430142", "text": "def pre_process_minitest(orig_results_dir)\n puts \"Current directory is #{@base_dir}\"\n puts \"Pre-processed tests run data in #{orig_results_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n # There is a bunch of moving that needs to happen with coverage/minitest...\n FileUtils.rm_rf \"#{orig_results_dir}/coverage\" if Dir.exist? \"#{orig_results_dir}/coverage\"\n FileUtils.rm_rf \"#{@base_dir}/coverage\" if Dir.exist? \"#{@base_dir}/coverage\"\n FileUtils.rm_rf \"#{test_results_dir}/coverage\" if Dir.exist? \"#{test_results_dir}/coverage\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/minitest\" if Dir.exist? \"#{orig_results_dir}/minitest\"\n FileUtils.rm_rf \"#{@base_dir}/minitest\" if Dir.exist? \"#{@base_dir}/minitest\"\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n FileUtils.rm_rf \"#{orig_results_dir}/test\" if Dir.exist? \"#{orig_results_dir}/test\"\n FileUtils.rm_rf \"#{@base_dir}/test\" if Dir.exist? \"#{@base_dir}/test\"\n # remove the test directory if it is empty (size == 2 for . and ..)\n if Dir.exist?(\"#{test_results_dir}/test\") && Dir.entries(\"#{test_results_dir}/test\").size == 2\n FileUtils.rm_rf \"#{test_results_dir}/test\"\n end\n FileUtils.rm_rf \"#{test_results_dir}/minitest\" if Dir.exist? \"#{test_results_dir}/minitest\"\n\n # Create the test_results directory to store all the results\n return test_results_dir\n end", "title": "" }, { "docid": "acc554f2816957a261fbe14f9ccae2e0", "score": "0.5425656", "text": "def check_start(cli)\n cli.say 'Looking for legacy .start files lingering'\n cli.load_project.each_dataset do |d|\n d.each_result do |r_k, r|\n if File.exist? r.path(:start)\n cli.say \" > Registering again #{d.name}:#{r_k}\"\n r.save\n end\n end\n end\n end", "title": "" }, { "docid": "acc554f2816957a261fbe14f9ccae2e0", "score": "0.5425656", "text": "def check_start(cli)\n cli.say 'Looking for legacy .start files lingering'\n cli.load_project.each_dataset do |d|\n d.each_result do |r_k, r|\n if File.exist? r.path(:start)\n cli.say \" > Registering again #{d.name}:#{r_k}\"\n r.save\n end\n end\n end\n end", "title": "" }, { "docid": "19e4616231e46aca6b223b1bbef532b2", "score": "0.5424537", "text": "def check_if_update_to_existing_export(export_directory)\n File.exist?(\"#{export_directory}/hts-cache/doit.log\")\n end", "title": "" }, { "docid": "5ede7d1188d4d45e64ab70d8b96ab852", "score": "0.5417808", "text": "def do_exit\n super \"The source directory does not exist.\"\n end", "title": "" }, { "docid": "ff508461bc3f59b14197af0beb2d6be3", "score": "0.53947604", "text": "def only_run_failed()\n @include = Array(last_failures)\n @forced_need = true\n end", "title": "" }, { "docid": "2833b2c1745e91f2ee8a31a6c013d604", "score": "0.5389133", "text": "def check_environment\n FileUtils.mkdir_p WORK_DIR unless File.exists? WORK_DIR\n unless viable?\n recover, whitelisted_dirs, blacklisted_dirs = initialize_or_recover_system\n case recover\n when 0\n FileUtils.mkdir_p SYC_DIR unless File.exists? SYC_DIR\n File.write(ID, \"0\")\n when 1\n # Backup ARGV content\n args = []\n ARGV.each {|arg| args << arg} unless ARGV.empty?\n ARGV.clear\n reindex_tasks(whitelisted_dirs, blacklisted_dirs)\n puts \"Successfully recovered syc-task\"\n puts \"-> A log file of re-indexed tasks can be found at\\n\"+\n \"#{RIDX_LOG}\" if File.exists? RIDX_LOG\n print \"Press any key to continue \"\n gets\n # Restore ARGV content\n args.each {|arg| ARGV << arg} unless args.empty?\n when 2\n puts \"o.k. - don't do nothing\"\n exit -1\n end\n end\n end", "title": "" }, { "docid": "f30d0cb33dbd50daafcabaf5ccfaac6c", "score": "0.5383742", "text": "def save_firstrun\n unless File.exist?(@paths[:first])\n # It's a first-run if the current log is the oldest in the directory.\n # This is a heuristic; in first run, there may be additional chef timer\n # runs queued up, which means we have initial logs from chefctl.rb. So\n # we check if our current log has the oldest timestamp in the filename.\n #\n # The glob here depends on our log date formatting above in\n # Chefctl::Lib.get_timestamp\n oldest_log = Dir.glob(File.join(@paths[:logdir], 'chef.2*')).min\n if @paths[:out] == oldest_log\n Chefctl.logger.debug(\"Copying first-run log to #{@paths[:first]}\")\n # Copy, don't symlink so it's not deleted later as more chef runs\n # happen.\n FileUtils.cp(@paths[:out], @paths[:first])\n else\n Chefctl.logger.debug(\"No first-run log at #{@paths[:first]}, but \" +\n \"the current log (#{@paths[:out]}) isn't the oldest log \" +\n \"(#{oldest_log}), so we're not copying to #{@paths[:first]}.\")\n end\n end\n end", "title": "" }, { "docid": "1eb20144a13a09fc59fd1fbb89dce9ee", "score": "0.5382889", "text": "def clear_last_run(root_dir)\n Pathname.new(root_dir).children.select { |c| c.directory? }.collect { |p| p.to_s }.each do |dir|\n next unless dir.include?(\"_tests_\")\n puts \"Deleting directory from previous run #{dir}\"\n FileUtils.remove_dir(dir)\n end\n end", "title": "" }, { "docid": "9d74fe87e188dfa454581d55e57d5772", "score": "0.53800106", "text": "def passed?\n run! unless @result\n @passed = if File.exists? file\n @result.exitstatus == 0\n else\n true\n end\n end", "title": "" }, { "docid": "d0d7181cf9786f6e1b964f51be19446f", "score": "0.5373169", "text": "def write_output_resources\n @outputs.flatten.compact.each do |output|\n path = File.join(@working_directory, output.name)\n FileCache.put(path, output.uri)\n end\n end", "title": "" }, { "docid": "54a72e5ae44783bd7112d3167f545c07", "score": "0.5371834", "text": "def ran?\n !output.nil?\n end", "title": "" }, { "docid": "737d5ef2c144d89e711983b7f7e42468", "score": "0.53718185", "text": "def check_continue()\n if $imported[\"IEX_Scene_File\"]\n @continue_enabled = (Dir.glob(\"#{IEX::Saving_Scene::Save_Data_Name}*.rvdata\").size > 0)\n else\n @continue_enabled = (Dir.glob('Save*.rvdata').size > 0)\n end\n end", "title": "" }, { "docid": "42fbae1d6e5970893ad9efb0334746a9", "score": "0.5371053", "text": "def pre_run(_output); end", "title": "" }, { "docid": "986e8d5eb384399883bfcc58299ee5f2", "score": "0.5364123", "text": "def reset\n if File.directory?(output)\n File.utime(0,0,output) unless $NOOP\n puts \"marked #{output}\"\n end\n end", "title": "" }, { "docid": "cc1e8f1b96ed24bb256f4187be78698b", "score": "0.53633845", "text": "def stop_folders_changed?\n # If nil, this means that this is the first run and nothing has changed since initialising the rails env\n return false if @last_init_time.nil?\n\n TestConsole::Config.stop_folders.each do |p|\n path = File.join(TestConsole::Config.app_root, p, '**', '*.{rb,yml}')\n Dir.glob(path).each do |f|\n if file_changed? f, @last_init_time\n TestConsole.error \"#{f} has been changed.\\nYou will need to restart the console to reload the environment\"\n return true\n end\n end\n end\n\n return false\n\n end", "title": "" }, { "docid": "7e18f867c1cad47934c65402f62e6133", "score": "0.53610957", "text": "def verify_all_files_exist\n will_quit = false\n @items.each{|item|\n item.filenames.each{|fname|\n fpath = \"#{@bitstream_source_dir}/#{fname}\"\n unless File.file?(fpath)\n STDERR.puts \"ERROR: File '#{fpath}' not found.\"\n will_quit = true\n end\n }\n }\n exit 6 if will_quit\n end", "title": "" }, { "docid": "28c0bd73d229e598a5d329b3807c6780", "score": "0.53388095", "text": "def on_test_run_started(_event)\n lifecycle.clean_results_dir\n end", "title": "" }, { "docid": "28c0bd73d229e598a5d329b3807c6780", "score": "0.53388095", "text": "def on_test_run_started(_event)\n lifecycle.clean_results_dir\n end", "title": "" }, { "docid": "9c9ab5436f6c527f853ab1995f1f074c", "score": "0.5333998", "text": "def make_optional_output_directories\n @hiera_output_path = make_optional_output_directory(@hiera_output_path)\n @hocon_output_path = make_optional_output_directory(@hocon_output_path)\n end", "title": "" }, { "docid": "192431c7c2b2e7d8c3b1e76412455799", "score": "0.5324273", "text": "def has_been_run?\n res = true\n res = false if self.experiments.size == 0\n\n self.experiments.each do |experiment|\n res &&= experiment.has_been_run?\n return res unless res\n end\n\n res\n end", "title": "" }, { "docid": "192431c7c2b2e7d8c3b1e76412455799", "score": "0.5324273", "text": "def has_been_run?\n res = true\n res = false if self.experiments.size == 0\n\n self.experiments.each do |experiment|\n res &&= experiment.has_been_run?\n return res unless res\n end\n\n res\n end", "title": "" }, { "docid": "1f24df71117ccb188a50b68fc04eae18", "score": "0.5314029", "text": "def fresh?\n if cached_timestamp_path.exist? && output_path.exist?\n cached_timestamp_path.read == current_source_timestamp\n else\n false\n end\n end", "title": "" }, { "docid": "92256702e95986ff0fa5e124fe630015", "score": "0.5305415", "text": "def output_dir?\n File.extname(options[:output]).empty?\n end", "title": "" }, { "docid": "26549755bc9c078748b6ca18025245de", "score": "0.53045464", "text": "def needs_restarting?\n File.exist?(NEEDS_RESTARTING)\n end", "title": "" }, { "docid": "0cb3da7f28584b1a58005673fd76e2b9", "score": "0.5303006", "text": "def do_exit\n super \"The link report, manifest file, or source directory does not exist.\"\n end", "title": "" }, { "docid": "de2857e9353d83b57354cf61b076f933", "score": "0.5302943", "text": "def run\n puts Time.now.to_s+\" WhoIsChecker ...START\"\n if (!inputFolder.nil? && !outputFolder.nil?)\n # check path specified are folders\n if (File.directory?(inputFolder) && File.directory?(outputFolder))\n inputDir = Dir.new(inputFolder)\n outputDir = Dir.new(outputFolder)\n filesInInputDir = inputDir.entries\n # for each input file\n Dir.foreach(inputFolder){ |inputFile| \n puts inputFile \n # ends with .csv and outfile file does not exists\n if(inputFile[/.csv$/] && !File.exist?(outputFolder+inputFile))\n # parse each input file and generate the outputfile\n #convertToCommaSeperated(inputFolder+inputFile)\n runFile(inputFolder+inputFile,outputFolder+inputFile)\n else\n puts \"Either the input file is not in csv format or its already parsed and is in output folder. Hencing skipping file - \"+inputFile\n end\n \n }\n\n else\n puts \"input or output folder does not exceed. Cannot proceed further\"\n end\n else\n puts \"input folder=\"+inputFolder+\"outputFolder=\"+outputFolder+\". Cannot proceed further\"\n end\n puts Time.now.to_s+\" WhoIsChecker ... END\"\n end", "title": "" }, { "docid": "3b242f643a8f0f3eeae05bb8e7c85325", "score": "0.5301908", "text": "def process_directory\n \n # Clear the cache\n # EGH removed the two lines below because code module need the cache\n # to last, e.g. if it contains references to other files\n #@runner.cache[:runs]||={}\n #@runner.cache[:runs][@id] = {}\n logf(:process_directory)\n raise CRFatal.new(\"Something has gone horribly wrong: runner.class is #{@runner.class} instead of CodeRunner\") unless @runner.class.to_s == \"CodeRunner\"\n\n begin\n @code_runner_version = Version.new(File.read('.code_runner_version.txt'))\n File.read('code_runner_info.rb')\n rescue Errno::ENOENT # version may be less than 0.5.1 when .code_runner_version.txt was introduced\n @code_runner_version = Version.new('0.5.0')\n end\n \n @directory = Dir.pwd\n @relative_directory = File.expand_path(Dir.pwd).sub(File.expand_path(@runner.root_folder) + '/', '')\n# p @directory\n @readme = nil\n \n #if @code_runner_version < Version.new('0.5.1')\n #begin\n #update_from_version_0_5_0_and_lower\n #rescue Errno::ENOENT => err # No code runner files were found\n #unless @runner.heuristic_analysis\n #puts err\n #raise CRFatal.new(\"No code runner files found: suggest using heuristic analysis (flag -H if you are using the code_runner script)\")\n #end\n #unless @runner.current_request == :traverse_directories\n #@runner.requests.push :traverse_directories unless @runner.requests.include? :traverse_directories\n #raise CRMild.new(\"can't begin heuristic analysis until there has been a sweep over all directories\") # this will get rescued\n #end\n #@runner.increment_max_id \n #@id = @runner.max_id\n #@job_no = -1\n #run_heuristic_analysis\n #end\n #end\n begin\n read_info\n rescue Errno::ENOENT => err # No code runner files were found\n unless @runner.heuristic_analysis\n puts err\n raise CRFatal.new(\"No code runner files found: suggest using heuristic analysis (flag -H if you are using the code_runner script)\")\n end\n unless @runner.current_request == :traverse_directories\n @runner.requests.push :traverse_directories unless @runner.requests.include? :traverse_directories\n raise CRMild.new(\"can't begin heuristic analysis until there has been a sweep over all directories\") # this will get rescued\n end\n @runner.increment_max_id \n @id = @runner.max_id\n @job_no = -1\n run_heuristic_analysis\n end\n \n \n @cr_has_read_results = false\n if FileTest.exist? 'code_runner_results.rb'\n begin\n read_results\n @cr_has_read_results = true\n rescue NoMethodError, SyntaxError => err\n puts err\n puts 'Results file possibly corrupted for ' + @run_name\n end \n end\n\n @running = (@@current_status =~ Regexp.new(@job_no.to_s)) ? true : false \n if @running and methods.include? :get_run_status\n @status = get_run_status(@job_no, @@current_status) rescue :Unknown\n else\n @status ||= :Unknown\n end\n #logi '@@current_status', @@current_status, '@job_no', @job_no\n #logi '@running', @running\n if not @cr_has_read_results or @running or not [:Complete, :Failed].include? @status or @runner.recalc_all or @runner.reprocess_all\n process_directory_code_specific \n end \n \n # Sometimes the run can be completed and still in the queue, in\n # which case process_directory_code_specific may set @status==:Complete\n # or @status==:Failed even though @running = true. Here we update\n # @running if this is the case. This will have no effect on any subsequent\n # update as CodeRunner does not use @running as a criterion for deciding\n # whether or not to recheck a run and call process_directory again.\n @running = false if [:Complete, :Failed].include? @status\n \n raise CRFatal.new(\"status must be one of #{PERMITTED_STATI.inspect}\") unless PERMITTED_STATI.include? @status\n @max = {}\n write_results\n @component_runs = []\n generate_component_runs\n save\n commit_results if @runner.is_in_repo? and not @running\n return self\nend", "title": "" }, { "docid": "bcbc13ebc15ffc23abd0601f6f587d1b", "score": "0.52967614", "text": "def validate_result_files(results_glob, ignore)\n return unless Dir.glob(results_glob).empty?\n\n log(\"Glob '#{results_glob}' did not match any files!\", ignore ? :yellow : :red)\n exit(ignore ? 0 : 1)\n end", "title": "" }, { "docid": "ac3e222c5c8527fbeb62c61322eab482", "score": "0.52932835", "text": "def create_output_folder!\n @logger.info \"remove and create the output folder\"\n FileUtils.rm_rf \"#{@options[:output]}\"\n FileUtils.mkdir_p @options[:output]\n end", "title": "" }, { "docid": "9ced1a317db1c537682fdc347b7a1234", "score": "0.52904904", "text": "def filter_file_through_status_output(file_name,output)\n #need to search for both filename and whether dircetory added\n if output.include?(file_name)\n true\n else\n file_parts = file_name.split('/')\n file_parts.pop\n while not file_parts.empty? do\n return true if output.include?(file_parts.join('/')+'/')\n file_parts.pop\n end\n false\n end\n end", "title": "" }, { "docid": "8703b4b6cfe014d35be49d86b6857cd7", "score": "0.52881473", "text": "def output_error_instructions\n puts <<~DOC\n If you get an error when starting your Rails app\n\n ** ERROR: directory is already being watched! **\n\n Directory: bpmn/java_app/src/main/resources\n is already being watched through: bpmn/diagrams\n\n MORE INFO: https://github.com/guard/listen/wiki/Duplicate-directory-errors\n\n It is because ActionMailer preview causes test/mailers/previews to get added to the Rails EventedFileChecker\n by default. RSpec is supposed to override it, but it is not overridden properly for EventedFileChecker and/or\n you don't have spec/mailers/preview existing. If that directory does not exist it goes to the first common\n directory that exists which is your Rails root folder.\n\n So EventedFileChecker is listening to your entire Rails folder. Not a big problem, but it causes a problem\n for our created symlink.\n\n So add:\n\n config.action_mailer.show_previews = false\n\n to your development.rb file to solve Listen errors about a symlink. Unless you are using ActionMailer\n previews in which case you should have the directory created already.\n DOC\n end", "title": "" }, { "docid": "ec521b7c0736652b2d7d0f15becbf31c", "score": "0.52871984", "text": "def collect_output?\n collect_output == true\n end", "title": "" }, { "docid": "6693b558dc6c415d0313b27a2a8abe07", "score": "0.5284846", "text": "def no_scripts\n if !File.directory?(\"#{XT_CONFIG::COMPILE_FROM}\")\n msgbox \"Cannot find \\\"#{XT_CONFIG::COMPILE_FROM}\\\"\"\n return true\n end\n false\n end", "title": "" }, { "docid": "e672253561440b7a5671faab061836a6", "score": "0.52836776", "text": "def pre_process_style\n puts \"Current directory is #{@base_dir}\"\n puts \"Test results will be stored in: #{test_results_dir}\"\n\n FileUtils.rm_rf \"#{test_results_dir}/openstudio_style\" if Dir.exist? \"#{test_results_dir}/openstudio_style\"\n FileUtils.rm_rf \"#{@base_dir}/openstudio_style\" if Dir.exist? \"#{@base_dir}/openstudio_style\"\n\n # Call the test_results dir to create the directory and return it as a string.\n return test_results_dir\n end", "title": "" }, { "docid": "c802538192a2c42266636685a9d76c1e", "score": "0.5281728", "text": "def approve\n setup\n\n output_files.each {|file|\n if not check_output_for(file)\n puts \"Updating file: #{file}\"\n File.new(File.join(@output, file), \"w\").write(output_for(file)) \n end\n }\n\n clean\n end", "title": "" }, { "docid": "84f435a661a000dde241904307098154", "score": "0.527303", "text": "def recheck\n depends :init, :compile\n\n if config_source['testrun'].nil?\n latest_record = TestRunRecord.latest_record(@build_results.build_dir, @module_set)\n descrip = \"The latest test run\"\n else\n latest_record = named_testrun_record(config_source['testrun'])\n descrip = \"The specified test run\"\n end\n\n failed_test_classnames = latest_record.failed_test_classnames\n\n puts \"\"\n if failed_test_classnames.empty?\n puts \"%s, in '%s', passed. There is nothing to recheck.\" % [ descrip, latest_record.directory_description ]\n else\n puts \"%s, in '%s', failed %d tests. Re-running the following tests:\" % [ descrip, latest_record.directory_description, failed_test_classnames.length ]\n\n patterns = [ ]\n failed_test_classnames.each do |classname|\n puts \" %s\" % classname\n components = classname.split(/\\./)\n patterns << FilePath.new(*components).to_s\n end\n\n puts \"\"\n\n run_tests(FixedPatternSetTestSet.new(config_source, @module_groups, patterns))\n end\n end", "title": "" }, { "docid": "55f959d29ae9894fe49b5777c15726fc", "score": "0.5262727", "text": "def next_run_configuration_exists\n @next_run_configuration_exists\n end", "title": "" }, { "docid": "55f959d29ae9894fe49b5777c15726fc", "score": "0.5262105", "text": "def next_run_configuration_exists\n @next_run_configuration_exists\n end", "title": "" }, { "docid": "6155662e8b08bfedeecfeebfd6f24f5d", "score": "0.5259386", "text": "def path_result_output\n unless @path_result_output\n basename = File.basename(self.path_file)[/(.*)@/,1] + '.txt'\n @path_result_output = File.join( self.dir_results, basename )\n end\n\n @path_result_output\n end", "title": "" }, { "docid": "7d16c4a0eb9859a3f4e06dba84cee523", "score": "0.5248132", "text": "def final_scripts(vm, no_finish: false)\n if no_finish\n []\n else\n Dir[vm.fs[:vhome] + '/scripts/at_exit/*.vsh']\n end\nend", "title": "" }, { "docid": "536fcd7b6fbafddb2d47cb10569b2396", "score": "0.52423346", "text": "def output_path(filename) \n out_path = File.join(File.dirname(__FILE__), '..', 'test_output') \n begin\n FileUtils.mkdir(out_path)\n rescue SystemCallError\n # ignore the error if the directory already exists\n end\n return File.join(out_path, filename)\n end", "title": "" }, { "docid": "66e32796326cd27b016a484bb342dedc", "score": "0.52361506", "text": "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "title": "" }, { "docid": "66e32796326cd27b016a484bb342dedc", "score": "0.52361506", "text": "def stop_it\n puts \"Sorry, this file already exists. Check for typos!\"\n exit\nend", "title": "" }, { "docid": "8d3bc3c63f94d1de99df0124c6e7a288", "score": "0.5236079", "text": "def exit_without_save_steps\n []\n end", "title": "" }, { "docid": "1acdf2bb8aa855d59e42df6e9adb089b", "score": "0.52310264", "text": "def create_output_directory\n FileUtils.mkdir_p(output) unless File.exists?(output)\n end", "title": "" }, { "docid": "371c4f620e1cbe8b6c62808b3fb38475", "score": "0.5228538", "text": "def was_not_already_completed\n return if errors.present?\n\n @was_not_already_completed = !self.completed if @was_not_already_completed.nil?\n\n unless @was_not_already_completed\n errors.add :file, 'already exists. Duplicate files can not be added'\n return\n end\n @was_not_already_completed\n end", "title": "" }, { "docid": "7a2a31ae64a26df426ad7ca73f75521f", "score": "0.52210116", "text": "def test_dest_dir_missing\n stub_puts\n\n tested.generate\n\n assert Dir.exist? @out_dir\n end", "title": "" }, { "docid": "fda5e4c631414c2595417d6f4b517d0c", "score": "0.52204865", "text": "def test_chdir_first\n with_fixture 'writefile' do\n # Control test; make sure the writefile script works as expected under default options\n assert system(\"ruby\", ocra, \"writefile.rb\", *(DefaultArgs))\n pristine_env \"writefile.exe\" do\n assert !File.exist?(\"output.txt\")\n assert system(\"writefile.exe\")\n assert File.exist?(\"output.txt\")\n end\n\n assert system(\"ruby\", ocra, \"writefile.rb\", *(DefaultArgs + [\"--chdir-first\"]))\n pristine_env \"writefile.exe\" do\n assert !File.exist?(\"output.txt\")\n assert system(\"writefile.exe\")\n # If the script ran in its inst directory, then our working dir still shouldn't have any output.txt\n assert !File.exist?(\"output.txt\")\n end\n end\n end", "title": "" }, { "docid": "bfd39ec08ee5792f156acace31902dc8", "score": "0.5213836", "text": "def abort_if_current(date)\n return false unless File.exist?(File.join(@dir, \"#{date.to_s}.xml\"))\n\n puts \"\\n\\n\\tThe most recent data already exists in #{@dir}. Exiting ...\\n\\n\"\n true\n end", "title": "" }, { "docid": "cb6c4b9939edbc383e8f283e0e0c8c68", "score": "0.5212792", "text": "def store_command_output(r_out, r_err, directory)\n # Create the output directory\n FileUtils.mkdir_p(directory)\n\n begin\n # Open the output files and read from the process\n f_out = File.open(File.join(options.output, 'stdout'), 'w')\n f_err = File.open(File.join(options.output, 'stderr'), 'w')\n\n read_all_output(r_out, r_err, f_out, f_err)\n ensure\n f_out.close\n f_err.close\n end\n end", "title": "" }, { "docid": "ba93ec4233257ebcbd9c6e1cd4ecbb78", "score": "0.5207842", "text": "def execute\n if(@hasExecuted==false and (not File::directory?(@newPath)))\n FileUtils.cp_r(@ogPath, @newPath)\n @hasExecuted=true\n end\n end", "title": "" }, { "docid": "2581b1d3ceaee8af7f8644bef973b8e8", "score": "0.52053773", "text": "def setup\n output_dir = File.expand_path(OUTPUT_DIR)\n FileUtils.mkdir_p(output_dir)\n\n working_dir = File.expand_path(WORKING_DIR)\n FileUtils.mkdir_p(working_dir)\n\n true\nend", "title": "" }, { "docid": "4d83787f0c3ffd0dde27d710b9c83a8c", "score": "0.52040917", "text": "def clean_old_output()\n deletable_filenames = []\n wd = FileUtils.pwd()\n all_filenames = ['/public/output/*'].collect!{|e| Dir.glob(wd + e)}.flatten.compact\n# DEBUG\n# logger.debug \"\\r\\n=== Cleaning old output files:\"\n# logger.debug \"Found #{all_filenames.size} files (either new or old). Checking last access times...\"\n\n all_filenames.each { |filename| # For each filename found, check if it is old enough to be removed:\n last_access_time = File.open(filename).atime\n dt = DateTime.new( last_access_time.year, last_access_time.month, last_access_time.day, last_access_time.hour, last_access_time.min, last_access_time.sec )\n diff = DateTime.now - dt\n min = (diff.to_f * 24 * 60) # Convert the difference from nanoseconds to minutes\n if ( min > 2 ) # (Streaming files in output/* should take less than 2 mins)\n# DEBUG\n# logger.debug \"'#{filename}': is #{min} minutes older, adding to the list of deletable files.\"\n deletable_filenames << filename\n else\n# DEBUG\n# logger.debug \"'#{filename}': is just #{min} minutes older, skipping.\"\n end\n }\n# DEBUG\n# logger.debug \"Found #{deletable_filenames.size} old files. Erasing them...\"\n # Kill'em all:\n FileUtils.rm_f( deletable_filenames )\n end", "title": "" }, { "docid": "2364a50d5a82d7c529cdc608596aa074", "score": "0.5203814", "text": "def traverse_directories # :doc:\n\t\tstring = \"\"\n\t\t#ep 'traversing', Dir.pwd\n\t\tif FileTest.exist?(\"code_runner_info.rb\") or FileTest.exist?(\"CODE_RUNNER_INPUTS\") or FileTest.exist?(\"README\") or @heuristic_analysis and (Dir.entries(Dir.pwd).find{|file| not [\".\",\"..\",\"data.txt\"].include? file and File.file? file} and not Dir.entries(Dir.pwd).include? '.CODE_RUNNER_IGNORE_THIS_DIRECTORY') \n\t\t#i.e. if there are some files in this directory (not just directories)\n\t\t\teprint '.' if @write_status_dots\n\t\t\tbegin\n\n\t\t\t\traise CRMild.new(\"must recalc all\") if @recalc_all or @reprocess_all #must recalculate the run results, not load them if @@recalc_all\n\t\t\t\trun = @run_class.load(Dir.pwd, self) #NB this doesn't always return an object of class run_class - since the run may actually be from a different code\n\t\t\t\traise CRMild.new(\"not complete: must recalc\") unless run.status == :Complete or run.status == :Failed\n\t\t\t\traise CRMild.new(\"Not the right directory, must recalc\") unless run.directory == Dir.pwd\n\t\t\trescue ArgumentError, CRMild => err \n\t\t\t\tif err.class == ArgumentError\n\t\t\t\t\tunless err.message =~ /marshal data too short/\n\t\t\t\t\t\t#puts err\n\t\t\t\t\t\t#puts err.backtrace\n\t\t\t\t\t\traise err\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tlog(err)\n# \t\t\t\tputs err.class\n\t\t\t\tbegin\n\t\t\t\t\t#interrupted = false; \n\t\t\t\t\t#old_trap2 = trap(2){}\n\t\t\t\t\t#old_trap2 = trap(2){eputs \"Interrupt acknowledged...#{Dir.pwd} finishing folder analyis. Interrupt again to override (may cause file corruption).\"; interrupted = true}\n\n\t\t\t\t\t# Here we make sure we are creating a run object of the right class for this folder\n\t\t\t\t\tif FileTest.exist?('code_runner_info.rb') and File.read('code_runner_info.rb') =~ /Classname:.*?(?<class>[A-Z][\\w:]+)/\n\t\t\t\t\t\tclassname = $~[:class]\n\t\t\t\t\t\tbegin \n\t\t\t\t\t\t\trun_cls = Object.recursive_const_get(classname)\n\t\t\t\t\t\trescue NameError=>err\n\t\t\t\t\t\t\tep err, err.message\n\t\t\t\t\t\t\tself.class.repair_marshal_run_class_not_found_error(StandardError.new(classname))\n\t\t\t\t\t\t\trun_cls = Object.recursive_const_get(classname)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\trun_cls = @run_class\n\t\t\t\t\tend\n\n\t\t\t\t \trun = run_cls.new(self).process_directory #NB this doesn't always return an object of class run_class - since the run may actually be from a different code\n\t\t\t\t\t#trap(2, old_trap2)\n\t\t\t\t\t#(eputs \"Calling old interrupt #{Dir.pwd}\"; Process.kill(2, 0)) if interrupted\n\t\t\t\trescue => err\n\t\t\t\t\tlog(err)\n\t\t\t\t\tunless @heuristic_analysis and (err.class == CRMild or err.class == CRError)\n# \t\t\t\t\t\tputs Dir.pwd\n\t\t\t\t\t\tlogd\n\t\t\t\t\t\teputs Dir.pwd\n\t\t\t\t\t\teputs err.class\n\t\t\t\t\t\teputs err\n# \t\t\t\t\t\teputs err.backtrace\n\t\t\t\t\t\teputs \"----Only allowed to fail processing a directory if a heuristic analysis is being run\"\n\t\t\t\t\t\traise err\n\t\t\t\t\tend\n# \t\t\t\t\tputs err.class\n\t\t\t\t\trun = nil\n# \t\t\t\t\tputs @requests\n\t\t\t\tend\n\t\t\tend\n\t\t\tcheck = false\n\t\t\tif run\n# \t\t\t\tputs run.id, @run_list[run.id]; gets\n# \t\t\t\traise CRFatal.new(\"\\n\\n-----Duplicate run ids: #{run.directory} and #{@run_list[run.id].directory}----\") if @run_list[run.id]\n\t\t\t\tif @run_list[run.id] \n\t\t\t\t\tcheck = true\n\t\t\t\t\t\traise <<EOF \nDuplicate run ids:\nNew: #{run.run_name} #{run.status} in #{run.directory}\nOld: #{@run_list[run.id].run_name} #{@run_list[run.id].status} in #{@run_list[run.id].directory}\nEOF\n\t\t\t\t\tchoice = Feedback.get_choice(\"Which do you want to keep, new or old? (The other folder will be deleted. Press Ctrl+C to cancel and sort the problem out manually)\", [\"New\", \"Old\"])\n\t\t\t\t\tcase choice\n\t\t\t\t\twhen /New/\n\t\t\t\t\t\traise \"Aborting... this function has not been fully tested\"\n\t\t\t\t\t\tFileUtils.rm_r(@run_list[run.id].directory)\n\t\t\t\t\twhen /Old/\n\t\t\t\t\t\traise \"Aborting... this function has not been fully tested\"\n\t\t\t\t\t\tFileUtils.rm_r(run.directory)\n\t\t\t\t\t\trun = nil\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif run\n\t\t\t\t(puts \"you shouldn't see this if you chose old\"; gets) if check\n\t\t\t\trun.save\n\t\t\t\t@run_list[run.id] = run\n\t\t\t\t@ids.push run.id\t\t\n\t\t\t\t@ids = @ids.uniq.sort\n\t\t\t\t@max_id = @max_id>run.id ? @max_id : run.id\n\t\t\tend\n\t\t\tif @heuristic_analysis\n\t\t\t\tDir.foreach(Dir.pwd)do |directory|\n\t\t\t\t\tnext if [\".\",\"..\"].include? directory or File.file? directory or directory =~ /\\.rb/ or @run_class.rcp.excluded_sub_folders.include? directory \n\t\t# \t\t\tbegin\t\t\t\n\t\t\t\t\t\tDir.chdir(directory) do \t\n\t\t\t\t\t\t\ttraverse_directories\n\t\t\t\t\t\tend\t\n\t\t# \t\t\trescue Errno::ENOENT\n\t\t# \t\t\t\tlog Dir.entries\n\t\t# \t\t\t\tputs directory + \" was not a directory\"\n\t\t# \t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\telse\n\t\t\tDir.foreach(Dir.pwd)do |directory|\n\t\t\t\tnext if [\".\",\"..\"].include? directory or File.file? directory or directory =~ /\\.rb/ or @run_class.rcp.excluded_sub_folders.include? directory \n\t# \t\t\tbegin\t\t\t\n\t\t\t\t\tDir.chdir(directory) do \t\n\t\t\t\t\t\ttraverse_directories\n\t\t\t\t\tend\t\n\t# \t\t\trescue Errno::ENOENT\n\t# \t\t\t\tlog Dir.entries\n\t# \t\t\t\tputs directory + \" was not a directory\"\n\t# \t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "0431b32fbf73109f5d94fec393db1a65", "score": "0.520294", "text": "def clean_up\n if @config.rg_no_rg == FALSE \n cleaner_script = File.dirname(__FILE__) + \"/../helpers/clean_sea_dir.sh rm_dups\"\n else\n cleaner_script = File.dirname(__FILE__) + \"/../helpers/clean_sea_dir.sh dups\"\n end\n end", "title": "" }, { "docid": "883464c278bfe9b67161412f355cdb7c", "score": "0.5200171", "text": "def make_output_available(output_name, outputs, source_stack)\n bubble_path = outputs[output_name].root_path - root_path\n drip_path = root_path - outputs[output_name].root_path\n bubble_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.outputs._set(output_name)._set(\n :value, base_sparkle.compile._stack_output(\n ref_sparkle.name, output_name\n )\n )\n end\n if bubble_path.empty?\n if drip_path.size == 1\n parent = drip_path.first.parent\n if parent && !parent.compile.parameters._set(output_name).nil?\n return compile.parameter!(output_name)\n end\n end\n raise ArgumentError.new \"Failed to detect available bubbling path for output `#{output_name}`. \" <<\n \"This may be due to a circular dependency! \" <<\n \"(Output Path: #{outputs[output_name].root_path.map(&:name).join(\" > \")} \" <<\n \"Requester Path: #{root_path.map(&:name).join(\" > \")})\"\n end\n result = source_stack.compile._stack_output(bubble_path.first.name, output_name)\n if drip_path.size > 1\n parent = drip_path.first.parent\n drip_path.unshift(parent) if parent\n drip_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.value._set(output_name, result)\n ref_sparkle.compile.parameters._set(output_name).type \"string\" # TODO: <<<<------ type check and prop\n result = compile._parameter(output_name)\n end\n end\n result\n end", "title": "" }, { "docid": "883464c278bfe9b67161412f355cdb7c", "score": "0.5200171", "text": "def make_output_available(output_name, outputs, source_stack)\n bubble_path = outputs[output_name].root_path - root_path\n drip_path = root_path - outputs[output_name].root_path\n bubble_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.outputs._set(output_name)._set(\n :value, base_sparkle.compile._stack_output(\n ref_sparkle.name, output_name\n )\n )\n end\n if bubble_path.empty?\n if drip_path.size == 1\n parent = drip_path.first.parent\n if parent && !parent.compile.parameters._set(output_name).nil?\n return compile.parameter!(output_name)\n end\n end\n raise ArgumentError.new \"Failed to detect available bubbling path for output `#{output_name}`. \" <<\n \"This may be due to a circular dependency! \" <<\n \"(Output Path: #{outputs[output_name].root_path.map(&:name).join(\" > \")} \" <<\n \"Requester Path: #{root_path.map(&:name).join(\" > \")})\"\n end\n result = source_stack.compile._stack_output(bubble_path.first.name, output_name)\n if drip_path.size > 1\n parent = drip_path.first.parent\n drip_path.unshift(parent) if parent\n drip_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.value._set(output_name, result)\n ref_sparkle.compile.parameters._set(output_name).type \"string\" # TODO: <<<<------ type check and prop\n result = compile._parameter(output_name)\n end\n end\n result\n end", "title": "" }, { "docid": "d235b7631d2a31011fe5eb9b3721da9a", "score": "0.5192029", "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": "833dff4d7d039ea2cb4702a6c11e7362", "score": "0.51901454", "text": "def test_any_directory_not_matching_current_cache_file_format_is_cleaned_up\n setup_repos('one_add', :use_cached_source_browser_files => false)\n FileUtils.mkdir_p(File.join(@source_browser.cache_path, '0'))\n FileUtils.mkdir_p(File.join(@source_browser.cache_path, '1'))\n FileUtils.mkdir_p(File.join(@source_browser.cache_path, '1.7'))\n FileUtils.mkdir_p(File.join(@source_browser.cache_path, 'abc'))\n @repos.next_revisions(nil, 1)\n assert !File.exist?(File.join(@source_browser.cache_path, '0'))\n assert !File.exist?(File.join(@source_browser.cache_path, '1'))\n assert !File.exist?(File.join(@source_browser.cache_path, '1.7'))\n assert !File.exist?(File.join(@source_browser.cache_path, 'abc'))\n assert File.exist?(File.join(@source_browser.cache_path, '2'))\n end", "title": "" } ]
2b45565080b1b8e5e788fc916cc7e57f
Accepts JS file Returns gzipped JS file
[ { "docid": "8e793f21ca8c3e782a334f21b252a260", "score": "0.6522645", "text": "def gzip(file)\n Zlib::Deflate.deflate(file)\n end", "title": "" } ]
[ { "docid": "f416512a7e2682c4825d2ab5f01a6797", "score": "0.71261996", "text": "def js_compressor; end", "title": "" }, { "docid": "f416512a7e2682c4825d2ab5f01a6797", "score": "0.71261996", "text": "def js_compressor; end", "title": "" }, { "docid": "6a2d1702e5e5466a0176c9974e80ad89", "score": "0.7071134", "text": "def compress_js(source)\n tmp_path = \"#{RAILS_ROOT}/tmp/#{@target}_packaged_uncompressed.js\"\n File.open(tmp_path, \"w\") {|f| f.write(source) }\n result = `java -jar \"#{YUI_COMPRESSOR_PATH}/build/yuicompressor-2.4.2.jar\" --type js \"#{tmp_path}\"`\n File.delete(tmp_path) if File.exists?(tmp_path)\n result\n end", "title": "" }, { "docid": "d659ed66707fa4126802628a5f7eb447", "score": "0.6928988", "text": "def compress_js(uncompressed)\n # if uncompressed.is_a?(File) && uncompressed.closed?\n # puts \"uncompressed is a file\"\n # uncompressed = File.read(uncompressed.path)\n # end\n if options[:compressor] == 'yui'\n begin\n require \"yui/compressor\"\n rescue LoadError\n raise \"You must install the yui compressor gem to use the compressor\\ngem install yui-compressor\"\n end\n compressor = ::YUI::JavaScriptCompressor.new\n else\n begin\n require 'closure-compiler'\n rescue LoadError\n raise \"You must install the closure compiler gem to use the compressor\\ngem install closure-compiler\"\n end\n compressor = ::Closure::Compiler.new\n end\n compressor.compress(uncompressed)\n end", "title": "" }, { "docid": "2a49cd88772aaa3e1a6ad247657f8622", "score": "0.6741538", "text": "def compress_js_in_zip(zf)\n \n path = File.expand_path(File.join(Dir.tmpdir,\"#{rand($$)}\"))\n \n files = []\n \n Zip::ZipFile.foreach(zf) do |z|\n if z.name =~ /\\.(js|css)$/\n files << z\n end\n end\n \n Zip::ZipFile.open(zf) do |z|\n files.each do |f|\n js = z.read(f)\n type = (f.name =~ /\\.js$/) ? :js : :css\n jsout = compress_and_mangle(f.name,js,type)\n FileUtils.rm_rf path if File.exists? path\n jf = File.open(path,'w+')\n jf.write jsout\n jf.close\n z.get_output_stream(f.name) {|zf| zf.write jsout }\n if type == :js\n z.get_output_stream(f.name.gsub('.js','_debug.js')) { |zf| zf.puts js }\n else\n z.get_output_stream(f.name.gsub('.css','_debug.css')) { |zf| zf.puts js }\n end\n end\n end\n \n FileUtils.rm_rf path\nend", "title": "" }, { "docid": "bae2c99ea159f0a3272520405bd9045c", "score": "0.6654162", "text": "def gzip?; end", "title": "" }, { "docid": "bae2c99ea159f0a3272520405bd9045c", "score": "0.6654162", "text": "def gzip?; end", "title": "" }, { "docid": "9d92d2025ed5b9129e041c1867cbe97e", "score": "0.663109", "text": "def compress_js_minjs(content)\n require 'minjs'\n Minjs::Compressor::Compressor.new(:debug => false).compress(content).to_js\n end", "title": "" }, { "docid": "07e05c5cab5ef98fdc21343dceadf22d", "score": "0.6494171", "text": "def compress_javascript(file_name)\n say \" -Compressing #{file_name} with yuicompressor\", :yellow\n\n compressor = 'yuicompressor'\n if `which yuicompressor`.empty?\n compressor = 'yui-compressor'\n if `which yui-compressor`.empty?\n say \"ERROR: you don't have a yuicompressor installed\", :red\n say \" Are you sure yuicompressor is installed on your system? Mac users, run this in console:\", :red\n say \" $ brew install yuicompressor\", :red\n say \" Ubuntu users: $sudo apt-get -y install yui-compressor\", :red\n end\n end\n cmd = \"#{compressor} #{file_name} -o #{file_name}\"\n system(cmd)\n unless $?.exitstatus == 0\n say \" ERROR: #{cmd}\", :red\n end\n end", "title": "" }, { "docid": "d6a70277c42bbd0883ab0dd03de3ce06", "score": "0.6493403", "text": "def compress_js(uncompressed)\n if options[:compressor] == 'yui'\n begin\n require \"yui/compressor\"\n rescue LoadError\n raise \"You must install the yui compressor gem to use the compressor\\ngem install yui-compressor\"\n end\n compressor = ::YUI::JavaScriptCompressor.new\n else\n begin\n require 'closure-compiler'\n rescue LoadError\n raise \"You must install the closure compiler gem to use the compressor\\ngem install closure-compiler\"\n end\n compressor = ::Closure::Compiler.new\n end\n begin\n compressor.compress(uncompressed)\n rescue Exception => e\n logger.error e.message\n end\n end", "title": "" }, { "docid": "f2c9c29b4039ddc2a150dece74acac8b", "score": "0.6473065", "text": "def build_javascript(dst_path)\n yui_root = File.expand_path(File.join(LIBPATH, '..', 'vendor', 'yui-compressor'))\n jar_path = File.join(yui_root, 'yuicompressor-2.4.2.jar')\n FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...\n filecompress = \"java -jar \" + jar_path + \" --charset utf-8 --line-break 80 \" + entry.source_path + \" -o \" + dst_path\n SC.logger.info 'Compressing with YUI .... '+ dst_path\n SC.logger.debug `#{filecompress}`\n \n if $?.exitstatus != 0\n SC.logger.fatal(\"!!!!YUI compressor failed, please check that your js code is valid and doesn't contain reserved statements like debugger;\")\n SC.logger.fatal(\"!!!!Failed compressing ... \"+ dst_path)\n end\n \n end", "title": "" }, { "docid": "2ac33f6546659b61d9fc3a83cf7d2f98", "score": "0.6445282", "text": "def gzip?(filename) # :nodoc:\n machined.config.gzip_assets && filename =~ /\\.(css|js)$/\n end", "title": "" }, { "docid": "ea18c625ca8c86db0e286284410d1c8f", "score": "0.6405652", "text": "def product_js_file\n File.unlink file_js_path if File.exists? file_js_path\n File.open(file_js_path, 'wb') { |f| f.write code_js_file }\n end", "title": "" }, { "docid": "a3f6085ee97badf73e2c2746d81a966e", "score": "0.6338343", "text": "def compress_js_uglifier(content)\n begin\n require 'uglifier'\n rescue => e\n # :nocov:\n raise CompressorNotFound, \"#{e.class}: #{e.message}\", e.backtrace\n # :nocov:\n end\n\n Uglifier.compile(content)\n end", "title": "" }, { "docid": "0375ab976ab2b06666a1ce58e204cf17", "score": "0.63293606", "text": "def uglify_js(js)\n require 'uglifier'\n\tcompressed_js = Uglifier.compile(js)\n\n LOGGER.debug \"uglifier: \" + js.length.to_s + ' => ' + compressed_js.length.to_s\n return compressed_js\nend", "title": "" }, { "docid": "a79a01f9b1fdeb95766fc3ff3d530264", "score": "0.63277334", "text": "def compress_js_yui(content)\n compress_yui(content, :compress_js)\n end", "title": "" }, { "docid": "18b5db075612ac59b24014194d88e5a6", "score": "0.63031024", "text": "def pack_javascripts(package)\n @compressor.compress_js(package_for(package, :js)[:paths])\n end", "title": "" }, { "docid": "00ddf83e2ee3a3f3d067af1c28795904", "score": "0.6291704", "text": "def compress_js_closure(content)\n require 'closure-compiler'\n\n begin\n ::Closure::Compiler.new.compile(content)\n rescue ::Closure::Error => e\n raise CompressorNotFound, \"#{e.class}: #{e.message}\", e.backtrace\n end\n end", "title": "" }, { "docid": "8c321edb09652c27babf54034759ed50", "score": "0.6272761", "text": "def gzip(str); end", "title": "" }, { "docid": "8c321edb09652c27babf54034759ed50", "score": "0.6272761", "text": "def gzip(str); end", "title": "" }, { "docid": "02e6a35a5496fb2f78e197aeb63be628", "score": "0.62036645", "text": "def enable_gzip!\n directory '/' do\n add_output_filter_by_type! :DEFLATE, 'text/html', 'text/plain', 'text/css', 'text/javascript', 'application/javascript'\n browser_match! '^Mozilla/4', \"gzip-only-text/html\"\n browser_match! '^Mozilla/4\\.0[678]', \"no-gzip\"\n browser_match! '\\bMSIE', '!no-gzip', '!gzip-only-text/html'\n end\n end", "title": "" }, { "docid": "5972cfecbbfc8ddeafbde41dd337630c", "score": "0.61921245", "text": "def gzip(source)\n sh 'gzip -f', data: source\n end", "title": "" }, { "docid": "eddfe5c03adead9c900fc65b50216e1e", "score": "0.6178072", "text": "def javascript_include_compressed(compressed_file_name, *javascripts)\n javascripts.map! { |javascript| path_without_asset_id(javascript_path(javascript)) }\n include_compressed(path_without_asset_id(javascript_path(compressed_file_name)), *javascripts) { |sources| javascript_include_tag(*sources) }\n end", "title": "" }, { "docid": "eddfe5c03adead9c900fc65b50216e1e", "score": "0.6178072", "text": "def javascript_include_compressed(compressed_file_name, *javascripts)\n javascripts.map! { |javascript| path_without_asset_id(javascript_path(javascript)) }\n include_compressed(path_without_asset_id(javascript_path(compressed_file_name)), *javascripts) { |sources| javascript_include_tag(*sources) }\n end", "title": "" }, { "docid": "f8acd3766b052dd32c526571eaddf371", "score": "0.6153512", "text": "def js(f)\n File.read(File.join('public/js', \"#{f.to_s}\"))\nend", "title": "" }, { "docid": "0998aa54e7c11235ee15d6b37144dcd4", "score": "0.61510664", "text": "def compressed\n require 'jsmin'\n @compressed ||= JSMin.minify(combined).strip\n end", "title": "" }, { "docid": "0998aa54e7c11235ee15d6b37144dcd4", "score": "0.61510664", "text": "def compressed\n require 'jsmin'\n @compressed ||= JSMin.minify(combined).strip\n end", "title": "" }, { "docid": "16a270b6f8f67b002c39507dfc688240", "score": "0.61508816", "text": "def compress_js(stream_or_string, options={}, &block)\n compress(stream_or_string, options.merge(:type => 'js'), &block)\n end", "title": "" }, { "docid": "4fe28a1febca1b9003e33a9fd32e013a", "score": "0.6140546", "text": "def script_content filename, options = {}\n options[:bundle] = options.fetch :bundle, true\n options[:minify] = options.fetch :minify, false\n options[:gzip] = options.fetch :gzip, false\n script_processor.content filename, options\n end", "title": "" }, { "docid": "7a9509302d9dbf056a7f97f17b350e96", "score": "0.61384755", "text": "def gz_file(path, opts = {})\n contents = Ratistics::Load.gz_contents(path)\n return data(contents, opts)\n end", "title": "" }, { "docid": "76edde2ff1a2da0fca85bb5357c4d3fc", "score": "0.6121934", "text": "def compressed; end", "title": "" }, { "docid": "a8ef4498b3e1249ab24f1d759d3c06d5", "score": "0.610886", "text": "def javascripts(*files)\n options = (files.last.is_a? Hash) ? files.pop : {}\n \n options[:language] = 'javascript'\n options[:type] = 'text/javascript'\n \n src_files = @staticmatic.src_file_paths('js','coffee')\n output = \"\"\n\n files.each do |path|\n if path.to_s.match %r{^https?://}\n output << format_output(:script,path,options)\n else\n idx = src_files.index do |src|\n %w{coffee js}.map {|t| src.match /#{path.to_s}\\.#{t}$/ }.any?\n end\n output << format_output(:script,src_files[idx],options) unless idx.nil?\n end\n end\n output\n end", "title": "" }, { "docid": "46d9dc5b06c9d28ba0147bedffd6fddc", "score": "0.6075762", "text": "def gzipped(file)\n file.gsub(\".csv\", \".gz\")\n end", "title": "" }, { "docid": "349c4a071b9dadeb41627552503c90ae", "score": "0.6074371", "text": "def compress_js(stream_or_string, options={}, &block)\n compress(stream_or_string, options.merge(:type => 'js'), &block)\n end", "title": "" }, { "docid": "29809ba18e03f9fc5d8fcd9a327a5386", "score": "0.6067522", "text": "def javascript_tag(script)\n if script.include?(';')\n \"<script>\\n#{script}\\n</script>\"\n else\n cache_busting_string = \"\"\n=begin\n file_path = \"#{settings.public_path}#{expand_javascript_path(script)}\"\n f = File.open(file_path)\n mtime_string = File.mtime(f).to_time.to_i.to_s\n cache_busting_string = \"?\" + mtime_string[-5..-1] # get the last 5 chars of the string\n rescue StandardError => e\n=end\n \"<script src='#{expand_javascript_path(script)}#{cache_busting_string}'></script>\"\n end\n end", "title": "" }, { "docid": "93ecc82a99f276c4288ee619f7e97422", "score": "0.6065185", "text": "def minify_js(files, dest_file)\r\n\r\n puts \"Minifying files into #{dest_file}\"\r\n\r\n secretary = Sprockets::Secretary.new(\r\n :source_files => files\r\n )\r\n\r\n # Generate a Sprockets::Concatenation object from the source files\r\n concatenation = secretary.concatenation\r\n # Write the concatenation to disk\r\n concatenation.save_to(dest_file)\r\n\r\n # Minify files using YUI compressor\r\n minification = `java -jar yuicompressor-2.4.2.jar --nomunge --charset utf-8 #{dest_file}`\r\n min_js = File.new(dest_file, \"w\")\r\n min_js.write(minification)\r\n min_js.close\r\nend", "title": "" }, { "docid": "cb3a0e6d1155d3b7f1876a387b2d9766", "score": "0.6047772", "text": "def compressed?; end", "title": "" }, { "docid": "43d4177d8b7848e826f332b2b747a224", "score": "0.6019416", "text": "def js_compressor\n if defined? @js_compressor\n @js_compressor\n end\n end", "title": "" }, { "docid": "afcc87cdeb90416e5a038dc61dfea979", "score": "0.6011234", "text": "def javascript(file='main')\n unless_login do\n src = \"/static/javascript/#{file}.js\" unless file.match /^http:\\/\\//\n src = file unless src\n '<script type=\"text/javascript\" src=\"' + src + '\"></script>'\n end\n end", "title": "" }, { "docid": "e094cae67ed9d720388938bb5aed2827", "score": "0.6010205", "text": "def gzip\n traverse_and_gzip\n end", "title": "" }, { "docid": "b9169edb2488cd4e6e83832a2641452c", "score": "0.6008598", "text": "def gzip(filename)\n Zlib::GzipWriter.open \"#{filename}.gz\" do |io|\n io.write Gem.read_binary(filename)\n end\n end", "title": "" }, { "docid": "041c6e93385910c22b4a8d66e5f3a64e", "score": "0.60023576", "text": "def compress_js(paths)\n if (jst_paths = paths.grep(Jammit.template_extension_matcher)).empty?\n js = concatenate(paths)\n else\n js = concatenate(paths - jst_paths) + compile_jst(jst_paths)\n end\n Jammit.compress_assets ? @js_compressor.compress(js) : js\n end", "title": "" }, { "docid": "06b048854f43dfa932fdd506e3803863", "score": "0.5977482", "text": "def js_compressor=(compressor); end", "title": "" }, { "docid": "06b048854f43dfa932fdd506e3803863", "score": "0.5977482", "text": "def js_compressor=(compressor); end", "title": "" }, { "docid": "51faff4b6ca10cc5f6fe1dbc4acb0653", "score": "0.5975358", "text": "def js(filepath)\n %{<script type=\"text/javascript\" src=\"#{File.join \"js\", filepath}\"></script>}\n end", "title": "" }, { "docid": "c763ddc20a8e14974c0fb8ec758d4074", "score": "0.59657127", "text": "def gzip(file)\n puts \"gzip: #{file}\" if $VERBOSE\n\n Zlib::GzipWriter.open(\"#{file}.gz\") do |gz|\n gz.write File.read(file)\n end\n FileUtils.rm(file)\n return \"#{file}.gz\"\n end", "title": "" }, { "docid": "e6da339d667a813dccd6cb7c86588f48", "score": "0.5959454", "text": "def embed_js(args)\n\t\tfile_path = args[\"file\"]\n\t\tfile_path = \"#{ConfigManager.get(\"presto_root\")}/#{file_path}\"\n\t\tjs_code = \"\"\n\t\tif File.exists?(file_path)\n\t\t\tjs_code = File.read(file_path)\n\t\t\tjs_code = AnjiManager.parse(js_code, args)\n\t\t\t#js_code.gsub!(/^\\s*\\/\\/.*$/, \"\")\n\t\t\t#js_code.gsub!(/\\s*\\/\\/.*$/, \"\")\n\t\t\t#js_code.gsub!(/\\/*.*?\\//, \"\")\n\t\t\t#js_code.gsub!(/^\\s*(?=[^\\s])/, \"\")\n\t\t\t#js_code.gsub!(/^(?<=[^\\s])\\s*/, \"\")\n\t\telse\n\t\t\t@@LOGGER.warn(\"Could not find JS file #{file_path}\")\n\t\tend\n\t\treturn \"<script>#{js_code}</script>\"\n\tend", "title": "" }, { "docid": "043f3cd7a56082ec5ab44f3c4ce57fc9", "score": "0.59540117", "text": "def handle_gz (file_path)\n if file_path =~ /\\.gz$/ then\n return Zlib::GzipReader.open(file_path);\n end\n return File.new(file_path);\nend", "title": "" }, { "docid": "a6b2c68adc15fb41c965f4bd3be2dc71", "score": "0.5951887", "text": "def compress(source = '', length = 5000)\n source = source.respond_to?(:read) ? source.read : source.to_s\n \n js = []\n js << \"var result = '';\"\n js << \"var length = #{length};\"\n js << \"var source = #{MultiJson.dump(source)};\"\n js << \"result = YAHOO.compressor.cssmin(source, length);\" \n js << \"return result;\"\n \n @context.exec js.join(\"\\n\")\n end", "title": "" }, { "docid": "2adc76d4c1956c78bac55d7bd97f8643", "score": "0.5943531", "text": "def build_javascript(dst_path)\n a = Regexp.new('^'+MANIFEST.build_root)\n if dst_path =~ a\n # $to_minify << dst_path\n FileUtils.mkdir_p(File.dirname(dst_path))\n FileUtils.copy(entry.source_path, dst_path)\n else\n FileUtils.mkdir_p(File.dirname(dst_path)) # make sure loc exists...\n filecompress = \"java -Xmx128m -jar \\\"\" + SC.yui_jar + \"\\\" --js \\\"\" + entry.source_path + \"\\\" --js_output_file \\\"\" + dst_path + \"\\\" 2>&1\"\n SC.logger.info 'Compiling with YUI: '+ filecompress + \"...\"\n\n output = `#{filecompress}` # It'd be nice to just read STDERR, but\n # I can't find a reasonable, commonly-\n # installed, works-on-all-OSes solution.\n if $?.exitstatus != 0\n _report_error(output, entry.filename, entry.source_path)\n SC.logger.fatal(\"!!!!YUI compiler failed, please check that your js code is valid\")\n SC.logger.fatal(\"!!!!Failed compiling ... \"+ dst_path)\n end\n end\n end", "title": "" }, { "docid": "62377d78583dbcd28f69c975ce3f411c", "score": "0.5939297", "text": "def compress!(to = nil)\n to = options[:compressed_path] if to.nil? && options[:compressed_path]\n io_for_path(to) do |io|\n logger.info \"Compressing to #{to}\"\n io << compress_js(bundle!(false))\n end\n end", "title": "" }, { "docid": "11e042aeae889f9a3b08d9229eaaa5e9", "score": "0.59262025", "text": "def compressed_path; end", "title": "" }, { "docid": "11e042aeae889f9a3b08d9229eaaa5e9", "score": "0.59262025", "text": "def compressed_path; end", "title": "" }, { "docid": "11e042aeae889f9a3b08d9229eaaa5e9", "score": "0.59262025", "text": "def compressed_path; end", "title": "" }, { "docid": "11e042aeae889f9a3b08d9229eaaa5e9", "score": "0.59262025", "text": "def compressed_path; end", "title": "" }, { "docid": "dc680ab85ed589688bba91ebaf5de1eb", "score": "0.5923171", "text": "def gzipped?\n # mime types returned for GZips have looked like:\n # \"application/x-gzip; charset=binary\" on macOS\n # \"application/gzip; charset=binary\" on Ubuntu\n # This regex settled on after tinkering in Rubular.\n # ref: https://rubular.com/r/bNfFNbNYqqFof4\n #\n # It's possible the implementation for this detection will need\n # to change. Please feel empowered, dear readers of the future.\n Utils::FileFormat.get_mime_type(file_path: @source.path).match? %r{application\\/x?-?gzip}\n end", "title": "" }, { "docid": "76da710da433ba82d9461e84fcd65f2a", "score": "0.5914946", "text": "def js_cache_bust(file_name)\n file_name.gsub!('.js','.min.js') if ENV['JEKYLL_ENV'] == 'production'\n CacheDigester.new(file_name: file_name, directory: '_assets/javascripts').digest!\n end", "title": "" }, { "docid": "c05e46bb551d7ef6872d886680d312c7", "score": "0.59041494", "text": "def uglify(content, file, path)\n if File.extname(path) == '.js'\n min = path.gsub(/\\.[^.]+$/, '.min.js')\n begin\n if options[:force_utf8]\n content.encoding\n content.force_encoding 'utf-8'\n end\n uglify = Uglifier.new(options[:uglifier_options]).compile(content)\n save(uglify, min)\n rescue Exception => e\n # Get a readable message\n message = e.message.split(/[\\n\\r]/).first\n lines = error_lines(content, message)\n @formatter.error(\"Uglifier - #{message}\")\n if lines\n @formatter.error(\"Surrounding lines:\")\n puts lines\n end\n return nil\n end\n\n # If it's specified to keep a copy of the original\n if options[:copy]\n save(content, path)\n end\n else\n save(content, path)\n end\n end", "title": "" }, { "docid": "7c890a4e0c61a1cfaa815b8ec74b024c", "score": "0.58865404", "text": "def compress(source, target, opts={})\n handling Exception, source do\n case fmt = source.match(/\\.[^\\.]+$/).to_s\n when '.js'\n needs 'uglifier', 'to compress javascript'\n write_file target, Uglifier.new(opts).compile(File.read(source))\n else raise \"Does not know how to compress #{fmt} files.\"\n end\n end\n end", "title": "" }, { "docid": "0e17c0a6699e1a19a8896cebdb7909bc", "score": "0.5877805", "text": "def run(content, params={})\n require \"yui/compressor\"\n compressor = ::YUI::JavaScriptCompressor.new(params)\n compressor.compress(content)\n end", "title": "" }, { "docid": "f7c2a86bf33a1cba8206af6f8101b2d8", "score": "0.58742326", "text": "def get_data(filename)\n Zlib::GzipReader.open(filename)\nend", "title": "" }, { "docid": "cd09d42f68e8f475c9c519e0fcfdcb26", "score": "0.58680433", "text": "def gzip_code(eof = nil)\n # Compress using the Gzip algorithm\n compressed_stream = Rex::Text.gzip(code)\n\n # Base64 encode the compressed file contents\n encoded_stream = Rex::Text.encode_base64(compressed_stream)\n\n # Build the powershell expression\n # Create and execute script lock fed by the IO.StreamReader\n psh_expression = '&([scriptblock]::create((New-Object System.IO.StreamReader('\n # Feed StreamREader from a GzipStream\n psh_expression << 'New-Object System.IO.Compression.GzipStream('\n # GzipStream operates on the Memory Stream\n psh_expression << '(New-Object System.IO.MemoryStream(,'\n # MemoryStream consists of base64 encoded compressed data\n psh_expression << \"[System.Convert]::FromBase64String(#{Obfu.scate_string_literal(encoded_stream, threshold: 0.01)})))\"\n # Set the GzipStream to decompress its MemoryStream contents\n psh_expression << ',[System.IO.Compression.CompressionMode]::Decompress)'\n # Read the decoded, decompressed result into scriptblock contents\n psh_expression << ')).ReadToEnd()))'\n\n # If eof is set, add a marker to signify end of code output\n # if (eof && eof.length == 8) then psh_expression += \"'#{eof}'\" end\n psh_expression << \"echo '#{eof}';\" if eof\n\n @code = psh_expression\n end", "title": "" }, { "docid": "0b4a4e07f601358b6a324bde60e6a21e", "score": "0.5841568", "text": "def do_compression\n puts \"Doing Compression\"\n Dir[File.join(@tmp_dir,\"chrome/content/*.js\")].each do |filename|\n #`java -jar #{YUI_COMPRESSOR} #{filename} > #{File.join(@sandbox_dir,'chrome/content',File.basename(filename))}`\n `cp #{filename} #{File.join(@sandbox_dir,'chrome/content',File.basename(filename))}`\n end\n puts \"Done Compression\"\n end", "title": "" }, { "docid": "e8279e2d42579923136a31a18d0d11d2", "score": "0.5838464", "text": "def minify(input_file, output_file)\n #require 'uglifier'\n require 'tempfile'\n\n puts \"Minifying #{input_file} to #{output_file}.\"\n Tempfile.open('jquery-raty') do |temp|\n sh 'closure', input_file.to_s, temp.path\n temp.rewind\n File.open(output_file, 'wb') do |out|\n out.puts \"/* Minified by Google Closure */\"\n out.write(temp.read)\n end\n end\nend", "title": "" }, { "docid": "2c948109c1d4395675e916aa2aa86b52", "score": "0.5832312", "text": "def generate_cache_file(path, javascript)\n command = path.sub(/^.*\\//,'').sub(/\\.js$/,'')\n\n tmp_path = \"public/#{rand.to_s}.js\"\n output_path = \"public/#{command}.js\"\n\n F.open(tmp_path,'w') do |file|\n file.puts javascript\n end\n\n `java -jar yuicompressor-2.4.2.jar #{tmp_path} -o #{output_path} --line-break 0`\n\n F.delete(tmp_path)\n\n return output_path\n end", "title": "" }, { "docid": "b42f0bb0cc712793a85ab4d59a02eab7", "score": "0.5831879", "text": "def assemble(filename = nil, minify = true)\n fname = filename || \"tmp.min.js\"\n FileUtils.mkdir_p(File.dirname(fname))\n\n # Merge files\n merger = Juicer::Merger::JavaScriptMerger.new(scripts)\n merger.save(fname)\n\n # Minify\n if minify\n begin\n path = File.join(Juicer.home, \"lib/yui_compressor/bin\")\n minifyer = Juicer::Minifyer::YuiCompressor.new(:bin_path => path)\n minifyer.save(fname, fname)\n rescue Exception => e\n puts e.message\n exit\n end\n end\n\n # TMP: Correct YUIC mistake on regexes\n contents = File.read(fname)\n\n File.open(fname, 'w') do |file|\n contents.gsub!(/\\(\\^\\|\\\\s\\)/, \"(^|\\\\\\\\\\\\s)\")\n contents.gsub!(/\\(\\\\s\\|\\$\\)/, \"(\\\\\\\\\\\\s|$)\")\n\n license = <<EOF\n/**\n * TERMS OF USE - Validatious 2.0\n * Open source under the BSD License.\n * Copyright 2008-2009 Christian Johansen.\n * All rights reserved.\n */\nEOF\n\n file.puts license + contents\n end\n\n # Print confirmation\n if $verbose\n size = File::Stat.new(fname).size / 1024.0\n puts \"Produced #{fname}, #{sprintf '%.2f' % size} kB\"\n end\n\n # Delete file if temporary\n File.delete(fname) if filename.nil?\n contents\n end", "title": "" }, { "docid": "2ff0fe5bf47cc817da3428b475465ca5", "score": "0.58124024", "text": "def js_source(&logger)\n @js_source ||= begin\n logger ||= @logger\n\n js = ''\n js_libs.each do |libfile|\n absfile = File.expand_path(libfile, js_dir)\n logv(logger) {\"Loading JS file: #{absfile}\"}\n js << IO.read(absfile, external_encoding: Encoding::UTF_8) << \"\\n\"\n end\n logv(logger) {\"Loading KaTeX JS file: #{katex_js}\"}\n js << IO.read(katex_js, external_encoding: Encoding::UTF_8) << \"\\n\"\n\n js_katex_opts = \"var katex_opts = #{katex_opts.to_json}\"\n logv(logger) {\"JS eval: #{js_katex_opts}\"}\n js << js_katex_opts << \"\\n\"\n end\n end", "title": "" }, { "docid": "c443d44a917559776f47c0fa099e20e2", "score": "0.5796736", "text": "def compress\n files=@input_files=collect_filepaths\n \n # This will consist of only an entry (the concatenated file body)\n # when compressing javascript or css files \n\n files=[concatenate_files] if @concatenate_input\n cmd= (@commands.empty?)? nil : @commands[ @default_command ]\n\n files.each do |path|\n output_path=process(path,cmd)\n size_check(path,output_path) unless %w(.css .js).include?( File.extname(output_path)) \n end\n \n # summarise compression stats\n print_summary unless ['.css','.js' ].include?(@input_file_extensions)\n end", "title": "" }, { "docid": "74125edb003e30b85a211d378e4dcec4", "score": "0.5793165", "text": "def javascript_include_tag(*args)\n srcs, options = handle_srcs_options(args)\n options[:type] ||= \"text/javascript\"\n timestamp = options.delete(:timestamp)\n Array(srcs).collect do |src|\n #TODO: write sinatra helper to auto set env with Sinatra::Application.environment.to_s\n options[:src] = build_src_href(src, :default_path => \"javascripts\", :extension => \".js\", :timestamp => timestamp)\n tag(:script, options) { '' }\n end.join(\"\\n\")\n end", "title": "" }, { "docid": "b09189658a513bb548b25720c7f31af4", "score": "0.5775952", "text": "def compress_script(script_in, eof = nil)\n\n # Compress using the Deflate algorithm\n compressed_stream = ::Zlib::Deflate.deflate(script_in,\n ::Zlib::BEST_COMPRESSION)\n\n # Base64 encode the compressed file contents\n encoded_stream = Rex::Text.encode_base64(compressed_stream)\n\n # Build the powershell expression\n # Decode base64 encoded command and create a stream object\n psh_expression = \"$stream = New-Object IO.MemoryStream(,\"\n psh_expression += \"$([Convert]::FromBase64String('#{encoded_stream}')));\"\n # Read & delete the first two bytes due to incompatibility with MS\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n # Uncompress and invoke the expression (execute)\n psh_expression += \"$(Invoke-Expression $(New-Object IO.StreamReader(\"\n psh_expression += \"$(New-Object IO.Compression.DeflateStream(\"\n psh_expression += \"$stream,\"\n psh_expression += \"[IO.Compression.CompressionMode]::Decompress)),\"\n psh_expression += \"[Text.Encoding]::ASCII)).ReadToEnd());\"\n\n # If eof is set, add a marker to signify end of script output\n if (eof && eof.length == 8) then psh_expression += \"'#{eof}'\" end\n\n # Convert expression to unicode\n unicode_expression = Rex::Text.to_unicode(psh_expression)\n\n # Base64 encode the unicode expression\n encoded_expression = Rex::Text.encode_base64(unicode_expression)\n\n return encoded_expression\n end", "title": "" }, { "docid": "b09189658a513bb548b25720c7f31af4", "score": "0.5775952", "text": "def compress_script(script_in, eof = nil)\n\n # Compress using the Deflate algorithm\n compressed_stream = ::Zlib::Deflate.deflate(script_in,\n ::Zlib::BEST_COMPRESSION)\n\n # Base64 encode the compressed file contents\n encoded_stream = Rex::Text.encode_base64(compressed_stream)\n\n # Build the powershell expression\n # Decode base64 encoded command and create a stream object\n psh_expression = \"$stream = New-Object IO.MemoryStream(,\"\n psh_expression += \"$([Convert]::FromBase64String('#{encoded_stream}')));\"\n # Read & delete the first two bytes due to incompatibility with MS\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n # Uncompress and invoke the expression (execute)\n psh_expression += \"$(Invoke-Expression $(New-Object IO.StreamReader(\"\n psh_expression += \"$(New-Object IO.Compression.DeflateStream(\"\n psh_expression += \"$stream,\"\n psh_expression += \"[IO.Compression.CompressionMode]::Decompress)),\"\n psh_expression += \"[Text.Encoding]::ASCII)).ReadToEnd());\"\n\n # If eof is set, add a marker to signify end of script output\n if (eof && eof.length == 8) then psh_expression += \"'#{eof}'\" end\n\n # Convert expression to unicode\n unicode_expression = Rex::Text.to_unicode(psh_expression)\n\n # Base64 encode the unicode expression\n encoded_expression = Rex::Text.encode_base64(unicode_expression)\n\n return encoded_expression\n end", "title": "" }, { "docid": "9dfdaff9fac6db8e037506b10c287ded", "score": "0.5774436", "text": "def javascript_include_tag(file_name)\n path_prefix = development? ? '/assets/' : '/js/'\n suffix = development? ? '' : \"-#{OctoFeed::VERSION}.min\"\n %(<script src=\"#{path_prefix}#{file_name}#{suffix}.js\"></script>)\nend", "title": "" }, { "docid": "3e531bad41513581b79467e03fd3d922", "score": "0.5770381", "text": "def new_package_js\n text = \"\"\n IO.readlines(\"package.js\").each do |line|\n if %r{// FILES}.match(line)\n $skipping = true\n text << line\n elsif %r{// END FILES}.match(line)\n $skipping = false\n text << files_to_add << \"\\n\" << line\n elsif !$skipping\n text << line\n end\n end\n text\nend", "title": "" }, { "docid": "83acf63658aa39fef289cb6f5e7f0936", "score": "0.5766958", "text": "def read_gzip\n content = nil\n\n Zlib::GzipReader.open(path) do |gz|\n content = gz.read\n gz.close\n end\n\n content\n end", "title": "" }, { "docid": "630045a63f78106e8ab34fe55116e73c", "score": "0.5755182", "text": "def setup_production_asset_compression\n return nil if options[:skip_javascript]\n\n # The compression-webpack-plugin package is included in @rails/webpacker.\n # => But this lets us easily access it from our webpacker config\n add_package('compression-webpack-plugin brotli-webpack-plugin @gfx/zopfli')\n webpack_plugins_str = <<~BROTLI\n // Compress the heck out of any static assets included by webpacker (using Brotlie)\n environment.plugins.append('BrotliCompression',\n new CompressionPlugin({\n filename: '[path].br[query]',\n algorithm: 'brotliCompress',\n test: /\\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/,\n compressionOptions: {\n level: 11\n },\n cache: true,\n threshold: 10240,\n minRatio: 0.8,\n deleteOriginalAssets: false,\n })\n )\n\n // Override default compression with Zopfli compression\n environment.plugins.append('Compression',\n new CompressionPlugin({\n filename: '[path].gz[query]',\n algorithm(input, compressionOptions, callback) {\n return zopfli.gzip(input, compressionOptions, callback);\n },\n cache: true,\n threshold: 8192,\n test: /\\.(js|css|html|json|ico|svg|eot|otf|ttf|map)$/,\n }),\n )\n BROTLI\n\n include_plugins_str = <<~PLUGINS\n const CompressionPlugin = require('compression-webpack-plugin'); // General webpacker library containing compression methods\n const zopfli = require('@gfx/zopfli'); // Zopfli is used to increase gzip compression ratio for gzip\n PLUGINS\n\n inject_into_file('config/webpack/production.js', \"#{include_plugins_str}\\n\\n#{webpack_plugins_str}\", after: \"const environment = require('./environment')\\n\")\n end", "title": "" }, { "docid": "537bec64af437e0211355b321860ff35", "score": "0.574966", "text": "def name_to_jsfile(name) \n \"/js/#{name}.js\"\n end", "title": "" }, { "docid": "388f55c3981a85dfc1987db18e0ea682", "score": "0.57482797", "text": "def gzip=(gzip); end", "title": "" }, { "docid": "388f55c3981a85dfc1987db18e0ea682", "score": "0.57482797", "text": "def gzip=(gzip); end", "title": "" }, { "docid": "1bd15d401eef27d7bbc73d31a8c94850", "score": "0.5737715", "text": "def gzip?(file)\n unless File.gzip?(file)\n return nil.status(:not_rtar_archive)\n end\n return true\n end", "title": "" }, { "docid": "8b91d73d0c312ebaed7ea13072f553f7", "score": "0.5730336", "text": "def gzip?\n path.extname == '.gz'\n end", "title": "" }, { "docid": "8b91d73d0c312ebaed7ea13072f553f7", "score": "0.5730336", "text": "def gzip?\n path.extname == '.gz'\n end", "title": "" }, { "docid": "aadd65c7cb50870785f0aff624257d22", "score": "0.57295424", "text": "def compress_script(script_in, eof = nil)\n\n # Compress using the Deflate algorithm\n compressed_stream = ::Zlib::Deflate.deflate(script_in,\n ::Zlib::BEST_COMPRESSION)\n\n # Base64 encode the compressed file contents\n encoded_stream = Rex::Text.encode_base64(compressed_stream)\n\n # Build the powershell expression\n # Decode base64 encoded command and create a stream object\n psh_expression = \"$stream = New-Object IO.MemoryStream(,\"\n psh_expression += \"$([Convert]::FromBase64String('#{encoded_stream}')));\"\n # Read & delete the first two bytes due to incompatibility with MS\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n psh_expression += \"$stream.ReadByte()|Out-Null;\"\n # Uncompress and invoke the expression (execute)\n psh_expression += \"$(Invoke-Expression $(New-Object IO.StreamReader(\"\n psh_expression += \"$(New-Object IO.Compression.DeflateStream(\"\n psh_expression += \"$stream,\"\n psh_expression += \"[IO.Compression.CompressionMode]::Decompress)),\"\n psh_expression += \"[Text.Encoding]::ASCII)).ReadToEnd());\"\n\n return psh_expression\n end", "title": "" }, { "docid": "37316e1637d13ffcc4cfd8d47094c3ee", "score": "0.57279605", "text": "def compression; end", "title": "" }, { "docid": "37316e1637d13ffcc4cfd8d47094c3ee", "score": "0.57279605", "text": "def compression; end", "title": "" }, { "docid": "4df7196d2224afceb571127b8f917997", "score": "0.572191", "text": "def javascript\n dir = asset_path(:javascripts)\n script = params[:id].split(',').collect{ |id| File.read(\"#{dir}/#{id}.js\") }.join(\"\\n\")\n \n respond_to do |type|\n type.js {render :text => script}\n end\n end", "title": "" }, { "docid": "4bb152bb28362bbf594413c8dc8d92fe", "score": "0.5695939", "text": "def create_js_files()\nend", "title": "" }, { "docid": "cf103f76f417b2bc15aeb8a4fa17742d", "score": "0.5691266", "text": "def compress(filename)\n # Your Code Goes Here\n #\nend", "title": "" }, { "docid": "2b8e2f0ec7386f4deafddb4a872d6dfa", "score": "0.56896925", "text": "def compresssed_file(filename)\n DumperUtils.compress_file(filename)\n end", "title": "" }, { "docid": "96768c3ed0ce17782967ce588563a57c", "score": "0.5688162", "text": "def generate_scriptfile\n\n script = File.read(\"repl.js.erb\")\n result = ERB.new(script).result(binding)\n\n File.write(instruments_script, result)\nend", "title": "" }, { "docid": "757e288a047201c91bca92aed72eb775", "score": "0.568393", "text": "def minify_js(*files_in_and_out)\n files_in_and_out.each do |file_in_and_out|\n if file_in_and_out.is_a? String\n file_in = \"#{ROOT_PATH}#{file_in_and_out}\"\n file_out = \"#{ROOT_PATH}#{file_in_and_out}.tmp\"\n else\n file_in = \"#{ROOT_PATH}#{file_in_and_out[0]}\"\n file_out = \"#{ROOT_PATH}#{file_in_and_out[1]}\"\n end\n\n system \"java -jar #{ROOT_PATH}framework/scripts/libs/yuicompressor-2.4.6.jar --type js #{file_in} -o #{file_out}\"\n\n if file_in_and_out.is_a? String\n FileUtils.rm file_in\n FileUtils.mv file_out, file_in\n end \n end\nend", "title": "" }, { "docid": "bc38f53332d6d78f25deb8cc834f4eab", "score": "0.56801033", "text": "def minify_build_js()\n puts 'Minifying JS...'\n %x[closure --js #{BUILD_JS} --js_output_file #{BUILD_JS}.tmp]\n %x[mv #{BUILD_JS}.tmp #{BUILD_JS}]\nend", "title": "" }, { "docid": "6c9a3612c7407c985b7b6ca3c0e3eb66", "score": "0.56782895", "text": "def minify(content)\n Rainpress.compress(content)\n end", "title": "" }, { "docid": "67c530df6b1d7aeea3f4f5c2d2c044da", "score": "0.56740695", "text": "def skip_gzip?; end", "title": "" }, { "docid": "67c530df6b1d7aeea3f4f5c2d2c044da", "score": "0.56740695", "text": "def skip_gzip?; end", "title": "" }, { "docid": "d02373b3cba4ed47753de85f332e80ae", "score": "0.56719613", "text": "def js(src)\n script :src => src\n end", "title": "" }, { "docid": "f58c2d871547c64058e078339e704ccd", "score": "0.5669585", "text": "def compress_js(paths)\n js = concatenate(paths)\n @options[:disabled] ? js : @js_compressor.compress(js)\n end", "title": "" }, { "docid": "d91022f58cee84d43e94ffd309f89c59", "score": "0.5665891", "text": "def gzip\n @assets.map! do |asset|\n gzip_content = Zlib::Deflate.deflate(asset.content)\n [\n asset,\n JAPR::Asset.new(gzip_content, \"#{asset.filename}.gz\", asset.dirname)\n ]\n end.flatten!\n end", "title": "" }, { "docid": "d91022f58cee84d43e94ffd309f89c59", "score": "0.5665891", "text": "def gzip\n @assets.map! do |asset|\n gzip_content = Zlib::Deflate.deflate(asset.content)\n [\n asset,\n JAPR::Asset.new(gzip_content, \"#{asset.filename}.gz\", asset.dirname)\n ]\n end.flatten!\n end", "title": "" }, { "docid": "a8bc6f119d19d01001bf6ae4e704f29c", "score": "0.56614935", "text": "def index\n @planospagamentos = Planospagamento.all\n respond_to do |format|\n format.html\n format.json\n format.gzip{\n compressed = gzip(@planospagamentos.to_json)\n send_data(\n compressed,\n :filename => \"planospagamentos.gzip\",\n :type => 'application/gzip', \n :stream => true, \n :x_sendfile=>true,\n :url_based_filename => true \n ) \n flash[:notice] = \"The file has been downloaded\"\n }\n end\n end", "title": "" }, { "docid": "117619aaf5d2cda3c3ba912b6428884f", "score": "0.5652194", "text": "def write_package_js(text)\n File.open \"package.js\", \"w\" do |f| \n f.write text\n end\nend", "title": "" } ]
04739b7016b488732cc1b9774d253cf0
get search results from the solr index
[ { "docid": "5c47aecdef79f3cb277d1c51ca5b4246", "score": "0.0", "text": "def flags\n @flags ||= Array.wrap(Flag.where(:published => true))\n end", "title": "" } ]
[ { "docid": "564467193cc71115ee7e2e2309c78466", "score": "0.8101511", "text": "def results\n @solr_data[:docs]\n end", "title": "" }, { "docid": "dd1cdf0da8f39fce189a06ffbeedf4bc", "score": "0.80029374", "text": "def results\n @solr_data[:docs]\n end", "title": "" }, { "docid": "243233c158fcddd9d630ea0b05afd87a", "score": "0.7919579", "text": "def get_search_results(extra_controller_params={})\n Blacklight.solr.find self.solr_search_params(extra_controller_params)\n end", "title": "" }, { "docid": "e06a83918d0a4229def7d003a26782ef", "score": "0.7751018", "text": "def search\n @hits = []\n\n if params[:query]\n search = DesignMethod.solr_search do\n fulltext params[:query] do\n highlight\n minimum_match 0\n end\n end\n store_location\n @hits = search.hits\n @results = search.results\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "title": "" }, { "docid": "87e418caa92f87b3073f5b5a722f3b1d", "score": "0.758733", "text": "def search\n query = params[:q]\n works = ActiveFedora::SolrService.query(query, fq: @fq, fl: @fl, df: @df, rows: @max_rows) \n format_solr_keys(works)\n render(json: works)\n end", "title": "" }, { "docid": "04f33c79334d1d51d5178dd31448ab4f", "score": "0.74692833", "text": "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end", "title": "" }, { "docid": "3142b587e01c716d685626614c942191", "score": "0.73044896", "text": "def index\n @results = {}\n\n if TeSS::Config.solr_enabled\n SEARCH_MODELS.each do |model_name|\n model = model_name.constantize\n @results[model_name.underscore.pluralize.to_sym] = Sunspot.search(model) do\n fulltext search_params\n\n with('end').greater_than(Time.zone.now) if model_name == 'Event'\n\n\n # Hide failing records\n if model.method_defined?(:link_monitor)\n unless current_user && current_user.is_admin?\n without(:failing, true)\n end\n end\n\n if model.attribute_method?(:user_requires_approval?)\n # TODO: Fix this duplication!\n # Hide shadowbanned users' events, except from other shadowbanned users and administrators\n unless current_user && (current_user.shadowbanned? || current_user.is_admin?)\n without(:shadowbanned, true)\n end\n\n # Hide unverified users' things, except from curators and admins\n unless current_user && (current_user.is_curator? || current_user.is_admin?)\n without(:unverified, true)\n end\n end\n end\n end\n \n end\n\n @results.reject! { |_, result| result.total < 1 }\n end", "title": "" }, { "docid": "5a58989787a9c5ac260323db94e0ffcc", "score": "0.729366", "text": "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "title": "" }, { "docid": "553284e9fa18e352920c6df4a1ebdf9b", "score": "0.7283551", "text": "def results\n index.results\n end", "title": "" }, { "docid": "ed69dcaab94c4640b8a5fbe892a73f5e", "score": "0.7219082", "text": "def get_search_results(user_params = params || {}, extra_controller_params = {})\n\n # In later versions of Rails, the #benchmark method can do timing\n # better for us. \n bench_start = Time.now\n \n solr_response = find(self.solr_search_params(user_params).merge(extra_controller_params)) \n document_list = solr_response.docs.collect {|doc| SolrDocument.new(doc, solr_response)} \n Rails.logger.debug(\"Solr fetch: #{self.class}#get_search_results (#{'%.1f' % ((Time.now.to_f - bench_start.to_f)*1000)}ms)\")\n \n return [solr_response, document_list]\n end", "title": "" }, { "docid": "64143fa8ed25e24a4342702a06782354", "score": "0.7210361", "text": "def index\n get_results\n end", "title": "" }, { "docid": "27a6c79b095fc143ddd7cfaf7ca7bdf9", "score": "0.71731377", "text": "def solr\n @solr_fields = get_solr_fields\n @solr_info = get_solr_information\n end", "title": "" }, { "docid": "88841988edc668d0eef395cee563fc3d", "score": "0.7146327", "text": "def search_result\n\t\t@questions = Question.search(params[:search]).for_index_set.page(params[:page]).per(10).order(:id)\n\tend", "title": "" }, { "docid": "f9854228c81bad705e93e69060bd03c9", "score": "0.71370363", "text": "def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end", "title": "" }, { "docid": "98a704715ff5e66e5b6dc87e3f284833", "score": "0.70636505", "text": "def action_documents\n # Code borrowed from [blacklight]/app/services/blacklight/search_service.rb\n solr_response = search_service.repository.find params[:id]\n # Not sure if we need to set @documents in this context (d.croney)\n @documents = solr_response.documents\n [solr_response, solr_response.documents]\n end", "title": "" }, { "docid": "63a4e9140092812b3a0bdef093809d21", "score": "0.7052389", "text": "def get_search_results\n\t\twait_until_page_loads\n\t\t@se.find_elements(@locs[:results_item])\n\tend", "title": "" }, { "docid": "40b547edacf9c2477363ee94ee69932a", "score": "0.7009866", "text": "def search\n @page_title = t('titles.search_results')\n @query = params[:query]\n query = @query.to_s.gsub(/[\\/\\\\]/, \" \")\n ferret_results = ThinkingSphinx.search(\n Riddle.escape(query),\n page: params[:page],\n per_page: 10\n )\n # Probably not the best way to do this, strip out Products from the\n # search results unless the status is set to 'show_on_website'. It\n # would be better to filter these out during the ActsAsFerret.find\n # above, but since this is a multi-model search, there doesn't seem\n # to be a way to do SQL filtering on just one of the models being\n # searched.\n @results = []\n ferret_results.each do |r|\n unless (r.is_a?(Product) && !r.show_on_website?(website)) ||\n (r.has_attribute?(:brand_id) && r.brand_id != website.brand_id) ||\n (r.respond_to?(:belongs_to_this_brand?) && !r.belongs_to_this_brand?(website)) ||\n (r.is_a?(Artist) && !r.belongs_to_this_brand?(website))\n @results << r\n end\n end\n render_template\n end", "title": "" }, { "docid": "649c22229d253c14b2c202344e905632", "score": "0.6996344", "text": "def index\n @response, @documents = get_solr_response_for_field_values(\"id\",session[:folder_document_ids] || [])\n end", "title": "" }, { "docid": "6fc3336913fb5b101ac2f03ee32d497a", "score": "0.69598955", "text": "def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end", "title": "" }, { "docid": "78404dfc24c6f68daf4f1510ec542758", "score": "0.6953373", "text": "def response\n @solr_response\n end", "title": "" }, { "docid": "7d68b771aac2fc2eb037344c288706be", "score": "0.6928462", "text": "def index\n @searcheds = Searched.all\n end", "title": "" }, { "docid": "c75b42f54d8d455ead9532cde50f302d", "score": "0.69243413", "text": "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "title": "" }, { "docid": "801c39290024af36fa31505d95ec3003", "score": "0.6917739", "text": "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "title": "" }, { "docid": "5f7e06ee7b9bdb67c452d52e6efa70f0", "score": "0.6917111", "text": "def search_results\n # Sunspot search\n @search = Program.search do\n fulltext params[:search] if params[:search].present?\n facet(:program_subjects)\n with(:program_subjects, params[:subject]) if params[:subject].present?\n end\n @programs = @search.results\n end", "title": "" }, { "docid": "68206d18e4c0908a6b975999f11dcd83", "score": "0.69161534", "text": "def index\n @search = Slisting.search(params[:q])\n @slistings = @search.result\n end", "title": "" }, { "docid": "b7919a5c3e72c3db5145298d2618dabb", "score": "0.691329", "text": "def index\n @config_vars = ENVIRONMENT_VARIABLES_TO_PRINT\n @corpus_size = RLetters::Solr::CorpusStats.new.size\n @ping = RLetters::Solr::Connection.ping\n @solr_info = RLetters::Solr::Connection.info\n end", "title": "" }, { "docid": "85d51c1b97c64b2e7ba3e2de80822c8e", "score": "0.690117", "text": "def index\n\n @searches = Search.all\n end", "title": "" }, { "docid": "37aec0948db2d9d1a553548d27ea2d58", "score": "0.68849003", "text": "def index\n @searches = Search.all\n end", "title": "" }, { "docid": "37aec0948db2d9d1a553548d27ea2d58", "score": "0.68849003", "text": "def index\n @searches = Search.all\n end", "title": "" }, { "docid": "37aec0948db2d9d1a553548d27ea2d58", "score": "0.68849003", "text": "def index\n @searches = Search.all\n end", "title": "" }, { "docid": "37aec0948db2d9d1a553548d27ea2d58", "score": "0.68849003", "text": "def index\n @searches = Search.all\n end", "title": "" }, { "docid": "37aec0948db2d9d1a553548d27ea2d58", "score": "0.68849003", "text": "def index\n @searches = Search.all\n end", "title": "" }, { "docid": "46d28b3b6ab08990c75406d1d01f2d58", "score": "0.6869178", "text": "def index\n query = search_params[\"search\"]\n if query\n @documents = Document.search(query)\n else\n @documents = Document.all\n end\n end", "title": "" }, { "docid": "aedf4583b861059c73e6e9d1e9fb79a6", "score": "0.68440896", "text": "def search_for_item\n search_service.fetch(params[:solr_document_id])\n end", "title": "" }, { "docid": "7e2040451bbac883922b09a0326ee499", "score": "0.68278635", "text": "def init_results_for_search\n # try to find asqs and tags that match search string\n search_string = params[:search].downcase\n @title = \"Search for \\\"#{params[:search]}\\\"\"\n @matched_names = search_asqs_by_column('name', search_string)\n @matched_queries = search_asqs_by_column('query', search_string)\n @matched_tags = Asq.tagged_with(search_string.split(' '), wild: true)\n @matched_creator = Asq.where(created_by: search_string)\n @matched_modifier = Asq.where(modified_by: search_string)\n sort_matched_arrays\n redirect_if_single_result\n end", "title": "" }, { "docid": "0460d4a33e186185eb85c69522ab3f6a", "score": "0.6825461", "text": "def index\n @search = Staff.search(params[:q])\n @staffs = @search.result\n end", "title": "" }, { "docid": "6490e79fed132031024ee9099423aef6", "score": "0.68018484", "text": "def index\n\n start_date = DateTime.new(2015,01,1)\n end_date = DateTime.new(2015,02,28)\n if params[:search]\n @students = Student.index_search(params[:search]).order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n else\n @students = Student.order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n end\n # if params[:search]\n # @query = Student.solr_search do\n # fulltext params[:search]\n # end\n # @students = @query.results\n # else\n # @students = Student.all\n # @students = Student.paginate(:page => params[:page], :per_page => 4)\n # end\n end", "title": "" }, { "docid": "7c2e1261610064a5e9e102ab618091e9", "score": "0.68015885", "text": "def search\n engine = BentoSearch.get_engine(params[:engine_id])\n # put it in an iVar mainly for testing purposes.\n @engine = engine\n\n\n unless engine.configuration.allow_routable_results == true\n raise AccessDenied.new(\"engine needs to be registered with :allow_routable_results => true\")\n end\n\n @results = engine.search safe_search_args(engine, params)\n # template name of a partial with 'yield' to use to wrap the results\n @partial_wrapper = @results.display_configuration.lookup!(\"ajax.wrapper_template\")\n\n # partial HTML results\n render \"bento_search/search/search\", :layout => false\n\n end", "title": "" }, { "docid": "0fa4907ec705a42fc5dc330120121103", "score": "0.67868215", "text": "def index\n @docs = SearchController.search(params[:query]) if params[:query].present?\n end", "title": "" }, { "docid": "255497fffa51225720529137294bc53d", "score": "0.6773997", "text": "def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end", "title": "" }, { "docid": "b69c0f3a2fd603550120454f2807f59f", "score": "0.6763556", "text": "def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end", "title": "" }, { "docid": "2fcb31453760f670fd5a7ff423d45317", "score": "0.6744151", "text": "def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = Supplier.ransack(params[:q]) \n @query.num_doc_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @suppliers = @results \n end", "title": "" }, { "docid": "041b8bf276d3264fea06784a175ce579", "score": "0.67398965", "text": "def action_documents\n @bookmarks = token_or_current_or_guest_user.bookmarks\n bookmark_ids = @bookmarks.collect { |b| b.document_id.to_s }\n query_params = {\n q: bookmarks_query(bookmark_ids),\n defType: 'lucene',\n rows: bookmark_ids.count\n }\n solr_response = search_service.repository.search(query_params)\n [solr_response, solr_response.documents]\n end", "title": "" }, { "docid": "b5b8866e5c214accf720e768f8017e9d", "score": "0.67392063", "text": "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end", "title": "" }, { "docid": "927db3b2778318f8659282184e9e6297", "score": "0.6725801", "text": "def index\n if can?(:read, Part)\n @parts = Part.ransack(params[:q])\n @searched = false\n @search_results = []\n if params[:q]\n @search_results = @parts.result(:distinct => true)\n @searched = true\n end\n render_template\n else\n redirect_to root_path\n end\n end", "title": "" }, { "docid": "0573996422319274e9e8e970edd56930", "score": "0.6716896", "text": "def index\n @searchterms = Searchterm.all\n end", "title": "" }, { "docid": "bfd915162350996220f4d3b49abc51b5", "score": "0.6716782", "text": "def index\n @q = FoundItem.ransack(params[:q])\n @found_items = @q.result\n end", "title": "" }, { "docid": "e91f15feb1da4fab04c0b75a2373ba0d", "score": "0.6711628", "text": "def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end", "title": "" }, { "docid": "c21a02efdac7f10bdc47eb305f8a5921", "score": "0.67080224", "text": "def index\n search_query = params[:search]\n if search_query.blank? || search_query.nil?\n @recipes = Recipe.all\n else\n @recipes = Array.new\n\n @search = Sunspot.search Recipe, Tag, Ingredient do\n fulltext search_query\n end\n\n @search.results.each do |result|\n if result.is_a?(Tag)\n @recipe_tags = RecipeTag.select { |rt| rt.tag_id == result.id}\n\n @recipe_tags.each do |tag|\n Recipe.select { |rc| rc.id == tag.recipe_id }.each do |recipe|\n @recipes << recipe\n end\n end\n elsif result.is_a?(Ingredient)\n @measurements = Measurement.select { |m| m.ingredient_id == result.id }\n\n @measurements.each do |measurement|\n Recipe.select { |r| r.id == measurement.recipe_id }.each do |recipe|\n @recipes << recipe\n end\n end\n elsif result.is_a?(Recipe)\n @recipes << result\n end\n end\n end\n end", "title": "" }, { "docid": "f77974a1e9cc76571ad144165a65b15d", "score": "0.6707383", "text": "def index\n @extra_controller_params ||= {}\n enforce_search_permissions\n @response = get_search_results( @extra_controller_params )\n @filters = params[:f] || []\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n end\n rescue RSolr::RequestError\n logger.error(\"Unparseable search error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, I don't understand your search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n rescue \n logger.error(\"Unknown error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, you've encountered an error. Try a different search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n end", "title": "" }, { "docid": "0c7573005acf4852df757a8b7fc7ee1a", "score": "0.6703896", "text": "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "title": "" }, { "docid": "77e6a9c38565856747184527af0ca924", "score": "0.6680563", "text": "def index\n page = params[:page] || 1\n page = page.to_i\n per_page = params[:per_page] || 25\n per_page = per_page.to_i\n @results = {}\n\n search = params[:searchterm]\n if search && search.empty?\n search = nil\n end\n\n if search\n page = 1\n per_page = 50\n @stats = SearchEngine.search(Stat, search)\n total = @stats.count\n @stats = Kaminari.paginate_array(@stats).page(page).per(per_page)\n \n @searchterm = search\n else\n @stats = Stat.desc(:id).page(page).per(per_page)\n total = Stat.count\n end\n \n @results[:first] = (page-1) * per_page + 1\n @results[:last ] = [total, page * per_page].min\n @results[:total] = total\n end", "title": "" }, { "docid": "2b075243032eba2cb8987dd2f3ca9eca", "score": "0.66801435", "text": "def mlt_results_for_show\n return unless controller_name == 'catalog'\n\n mlt_search_service = search_service_class.new(config: blacklight_config,\n user_params: { mlt_id: params[:id], rows: 4 },\n search_builder_class: CommonwealthMltSearchBuilder)\n _mlt_response, @mlt_document_list = mlt_search_service.search_results\n end", "title": "" }, { "docid": "02743ac985b9e306b758b54794f30019", "score": "0.6680143", "text": "def search\n @search = Sunspot.search(Job) do\n keywords(params[:searchterm])\n end\n end", "title": "" }, { "docid": "6de8bd7be6717b13fb82c83110c13862", "score": "0.6670103", "text": "def index\n @search = Staff.ransack(params[:q])\n\n all_results = @search.result.order(\"last_name ASC, first_name ASC\")\n\n # bucket = get_bucket\n @results = all_results.map do |staff|\n if staff.nickname.present?\n name = \"#{staff.nickname} (#{staff.first_name}) #{staff.last_name}\"\n else\n name = \"#{staff.first_name} #{staff.last_name}\"\n end\n\n {\n :name => name,\n :image_url => staff.avatar.url,\n :link => staff_path(staff.id)\n }\n end\n end", "title": "" }, { "docid": "403a6ffae543b58d1ffc6846dcc2a5a0", "score": "0.6665767", "text": "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "title": "" }, { "docid": "f1a68d9efff862e598a212166b8923d0", "score": "0.6646424", "text": "def results\n documents\n end", "title": "" }, { "docid": "78c0778eab54cc9fb748209ff58dfa7c", "score": "0.66436327", "text": "def get_opensearch_response(field=nil, extra_controller_params={})\n solr_params = solr_opensearch_params(extra_controller_params)\n response = Blacklight.solr.find(solr_params)\n a = [solr_params[:q]]\n a << response.docs.map {|doc| doc[solr_params[:fl]].to_s }\n end", "title": "" }, { "docid": "7ad54d43a016b622d52a700c7e3bc505", "score": "0.6634543", "text": "def index\n @searches = searches_from_history\n end", "title": "" }, { "docid": "ee095bf91f2ab92393964c7656fef73d", "score": "0.6631382", "text": "def search\n\n end", "title": "" }, { "docid": "4e87299aed9dcab5bf0cb68d87f76635", "score": "0.6626718", "text": "def index\n @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\n end", "title": "" }, { "docid": "c276364b98fc0984be3971796e943214", "score": "0.6625344", "text": "def query_for_index(query, index)\n search_url = \"http://ajax.googleapis.com/ajax/services/search/#{index}?v=1.0&q=#{URI.escape(query)}\"\n @res[search_url] = ''\n \n @multi.add(Curl::Easy.new(search_url) do|cfg|\n cfg.headers['Referer'] = @referer\n cfg.on_body{|data| @res[cfg.url] << data; data.size }\n cfg.on_success {|easy| yield(JSON.parse(@res[easy.url])) }\n end)\n end", "title": "" }, { "docid": "6633ffc614f976a99d6c80e07b50d465", "score": "0.66207206", "text": "def do_local_indexing(solr_doc); end", "title": "" }, { "docid": "ac403297484f2326ea6fe6e8f136fa8e", "score": "0.66117114", "text": "def index\n __log_activity(anonymous: true)\n __debug_route\n err = nil\n prm = paginator.initial_parameters\n playback = prm.delete(:search_call)\n s_params = (playback || prm).except(*Paginator::NON_SEARCH_KEYS)\n q_params = s_params.extract!(*search_query_keys).compact_blank!\n if q_params.blank?\n if s_params.present?\n redirect_to prm.merge!(q: SearchTerm::NULL_SEARCH)\n else\n render 'search/advanced'\n end\n return\n end\n prm = prm.slice(*Paginator::NON_SEARCH_KEYS).merge!(s_params, q_params)\n titles = title_results?\n @list = index_search(titles: titles, save: !playback, **prm)\n err = @list.exec_report if @list.error?\n # noinspection RubyMismatchedArgumentType\n paginator.finalize(@list, as: (titles ? :titles : :records), **prm)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values(item: :record) }\n end\n rescue => error\n err = error\n ensure\n failure_status(err)\n end", "title": "" }, { "docid": "25296a534208d9764ac7f287876a47fc", "score": "0.66085", "text": "def search_results\n @results = User.search(params[:search])\n end", "title": "" }, { "docid": "38fe547a94fe6f2b4278c3d480426c9a", "score": "0.65994734", "text": "def do_search(results, term, options)\n wait\n \n esearch_url = expand_uri(@uri_template, options.merge({:term => term}))\n doc = Nokogiri::XML( open esearch_url )\n\n results.count = doc.xpath('/eSearchResult/Count').first.content.to_i\n \n doc.xpath('/eSearchResult/IdList/Id').each {|n| results.pmids << n.content.to_i}\n \n doc.xpath('/eSearchResult/TranslationStack/TermSet/Term').each do |n|\n if n.content =~ /\"(.*)\"\\[MeSH Terms\\]/\n results.exploded_mesh_terms << $1\n end\n end\n \n doc.xpath('/eSearchResult/ErrorList/PhraseNotFound').each {|n| results.phrases_not_found << n.content }\n\n results\n end", "title": "" }, { "docid": "54dff789a6c35f824eb5cad8d52ac8b8", "score": "0.6596015", "text": "def index\n @search = WordRoot.ransack(params[:q])\n @word_roots = @search.result.paginate(:page => params[:page], per_page: 20)\n end", "title": "" }, { "docid": "819e01a3ee6c6ac726d16ef28b29a4f3", "score": "0.65885717", "text": "def search(args = {})\n search_args = {}\n search_args[:body] = self::ElasticsearchQuery.new(args).to_hash\n search_args[:index] = configuration.index\n search_args[:type] = type\n\n result = client.search search_args\n ids = result[\"hits\"][\"hits\"].map {|item| item[\"_source\"][\"id\"] } # use to get the records and sort them in that order\n result_list = includes(:translations, [:master => [:prices, :images]]).where(id: ids).index_by(&:id).slice(*ids).values\n\n # Convert all facets to facet objects\n facet_list = result[\"facets\"].map do |tuple|\n name = tuple[0]\n hash = tuple[1]\n type = hash[\"_type\"]\n body = hash.except!(\"_type\")\n Spree::Search::Elasticsearch::Facet.new(name: name, search_name: name, type: type, body: body)\n end\n\n ResultList.new(\n results: result_list,\n from: Integer(args.fetch(:from, 0)),\n total: result[\"hits\"][\"total\"],\n facets: facet_list\n )\n end", "title": "" }, { "docid": "64893f9cf67a4a4caa1cd0b7b78b18de", "score": "0.65764153", "text": "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "title": "" }, { "docid": "c5eb144982851885df84c768abee928b", "score": "0.6575191", "text": "def index\n @search = Sleuth.ransack(params[:q])\n @sleuths = @search.result\n @sleuthz= @sleuths.paginate(:page => params[:page],:per_page => 1000).order('qval ASC')\n @sleuthqval= @sleuthz\n end", "title": "" }, { "docid": "d8da82a127c9ad08e24b456afd01c19a", "score": "0.6571936", "text": "def index\n @response = get_search_results\n @filters = params[:f] || []\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n end\n rescue RSolr::RequestError\n logger.error(\"Unparseable search error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, I don't understand your search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n rescue \n logger.error(\"Unknown error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, you've encountered an error. Try a different search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n end", "title": "" }, { "docid": "bda0c6f189b77feb4075702d20483ea4", "score": "0.65658355", "text": "def query_result(**args)\n solr_service.query_result(build, **args)\n end", "title": "" }, { "docid": "e982994df631040c5dca1871e6d65bc8", "score": "0.65640706", "text": "def index\n @solr = Solr.instance.connect\n callback = params.delete('callback') || 'callback'\n rows = [params.delete('rows').to_i, 100].min\n data = begin\n @solr.get('select', params: params.except(:action, :format, :controller).merge(rows: rows))\n rescue => e\n # RSolr dictates that responses be ruby data structures,\n # but the eval still scares me.\n eval(e.response[:body])\n end\n json = JSON.pretty_generate(data)\n respond_to do |format|\n format.js do\n render text: \"#{callback}(#{json});\",\n status: data['error'] ? 500 : 200\n end\n format.json do\n render text: json,\n status: data['error'] ? 500 : 200\n end\n format.xml do\n render text: data.to_xml,\n status: data['error'] ? 500 : 200\n end\n end\n end", "title": "" }, { "docid": "176dc9503a903152b508025aa0fa57c9", "score": "0.65613425", "text": "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "title": "" }, { "docid": "77e2e4873dd48385827b489ff8129ade", "score": "0.65601695", "text": "def get_search_results(search_id:, from_index:, to_index:)\n {\n method: \"DOM.getSearchResults\",\n params: { searchId: search_id, fromIndex: from_index, toIndex: to_index }.compact\n }\n end", "title": "" }, { "docid": "9564252493e91b8fee7cd069d5cb5437", "score": "0.6555212", "text": "def index\n params.delete(:q_ws)\n\n (@response, @document_list) = search_results(params, search_params_logic)\n\n if params[:view].present? && params[:view].include?('timeline')\n @timeline_data = timeline_data\n end\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.json do\n render json: render_search_results_as_json\n end\n\n additional_response_formats(format)\n document_export_formats(format)\n end\n end", "title": "" }, { "docid": "56df47e24b86d9f909df22a047a1d5bc", "score": "0.6554896", "text": "def execute\n reset\n params = @query.to_params\n @solr_result = @connection.request(\"/#{request_handler}\", params, {:header => {'Content-Type' => 'application/x-www-form-urlencoded'}})\n self\n end", "title": "" }, { "docid": "9883e24196b84d13d6d670ac2a540c71", "score": "0.65455186", "text": "def index\n\t\t# Creation of the search object and search do\n if params[:filter]\n params[:by] = \"#{params[:filter][:field]}-#{params[:filter][:way]}\"\n params[:per_page] = \"#{params[:filter][:limit]}\".to_i\n end\n\t\t@search = Search.new(setting_searching_params(:from_params => params))#.advance_search_fields\n\t\t@paginated_objects = @current_objects = @search.do_search\n\t\t# Definition of the template to use to retrieve information\n\t\tif @search.category == 'user' || @search.category == 'workspace'\n\t\t\t@templatee = \"#{@search.category.pluralize}/index\"\n\t\telse\n \t@templatee = \"generic_for_items/index\"\n\t\tend\n\t\t@ajax_url = request.path\n\t\t# Management of the response depending of the request type\n\t\tif !request.xhr?\n\t\t\trespond_to do |format|\n\t \t\t\tformat.html { render :template => \"admin/searches/index.html.erb\" }\n\t\t\t\tformat.xml { render :xml => @paginated_objects }\n\t\t\t\tformat.json { render :json => @paginated_objects }\n\t\t\t\tformat.atom { render :template => \"#{@templatee}.atom.builder\", :layout => false }\n\t\t\tend\n\t\telse\n @no_div = true\n\t\t\trender :partial => @templatee, :layout => false\n\t\tend\n end", "title": "" }, { "docid": "9661fad2d6b9e3a83ffadabe7ff04bab", "score": "0.6539549", "text": "def index\n\t @search = Vehicle.search do\n\t\t\tfulltext params[:search]\n\t\t end\n\t\t@vehicles = @search.results\n\tend", "title": "" }, { "docid": "2acbee8a81b316bf03864e6709fafc68", "score": "0.6537581", "text": "def index\n\n # search query\n if params[:q].nil?\n @shops = Shop.all\n else\n @shops = Shop.search_with_elasticsearch(params[:q]).records\n end\n\n if params[:filter].present?\n if params[:filter] == 'name'\n @shops = @shops.order('title ASC')\n elsif params[:filter] == 'date'\n @shops = @shops.order('updated_at DESC')\n elsif params[:filter] == 'location'\n define_location\n @shops = @shops.near([@latitude, @longitude], 8_000_000, order: 'distance')\n end\n else\n @shops = @shops.order('updated_at DESC')\n end\n\n @shops = @shops.page(params[:page]).per(20)\n\n end", "title": "" }, { "docid": "5f6be3bf2715fab5f2dcbef41a1a4bb9", "score": "0.6535203", "text": "def index\n @search = Search.new(:site_sku, params[:search], :per_page =>100 )\n @search.order = 'updated_at DESC'\n @site_skus = @search.run\n @skus = Sku.all\n end", "title": "" }, { "docid": "c675a602967a6097dec6be47ce961d6a", "score": "0.6534392", "text": "def search(args = {})\n query = self::Query.new(args)\n args[:body] = query.to_hash\n\n args[:index] = configuration.index\n args[:type] = type\n\n result = client.search args\n\n result_list = result[\"hits\"][\"hits\"].map do |item|\n model = new(item[\"_source\"])\n model.id = item[\"_id\"]\n model.version = item[\"_version\"]\n model\n end\n\n ResultList.new(result_list, Integer(args.fetch(:from, 0)), result[\"hits\"][\"total\"])\n end", "title": "" }, { "docid": "50e52c74f76ebb09d0a4329c84e465c9", "score": "0.6530622", "text": "def index\n if params[:q].present?\n @results = Page.search(query: { fuzzy: { content: { value: params[:q] } } }, highlight: { fields: { content: {} } })\n @has_highlights = true\n else\n @results = Page.search('*')\n end\n @pages = @results.records\n end", "title": "" }, { "docid": "34eae1d99d8d77626ad7cfca135092f2", "score": "0.652856", "text": "def index\n @results = Result.all\n end", "title": "" }, { "docid": "34eae1d99d8d77626ad7cfca135092f2", "score": "0.652856", "text": "def index\n @results = Result.all\n end", "title": "" }, { "docid": "e9f5c35b1cacc5467637f6c741f24f46", "score": "0.6526559", "text": "def search params = {}\n send_and_receive blacklight_config.solr_path, params.reverse_merge(qt: blacklight_config.qt)\n end", "title": "" }, { "docid": "f2c71068438de8ba4a4c73ca66705b7c", "score": "0.6526113", "text": "def names\n\t\tquery_params = QueryFormat.names_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t@results = solr.names(query)\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results }}\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n end", "title": "" }, { "docid": "8b40e5b783a29c81ee6de7f92f84c18c", "score": "0.65182287", "text": "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "title": "" }, { "docid": "22290ea592103f49c9097cc04fa5e6e9", "score": "0.65147746", "text": "def build_results(solr_docs)\n results = Nokogiri::XML::Builder.new do |xml|\n xml.documents( :total => solr_docs[\"response\"][\"numFound\"], :\"page-size\" => solr_docs[\"page_size\"], :\"page-number\" => solr_docs[\"page\"] ) { \n solr_docs[\"response\"][\"docs\"].each do |doc| \n xml.document(:created => check_solr_field(doc[\"fgs_createdDate_date\"]), :\"last-modified\" => check_solr_field(doc[\"fgs_lastModifiedDate_date\"]), :name => doc[\"id\"] ) {\n xml.details {\n solr_docs[\"queries\"].each do |q| \n xml.detail_ check_solr_field(doc[q])\n end\n }\n }\n end\n }\n end\n return results.to_xml\n end", "title": "" }, { "docid": "bfcde51d336f63ced24e0b690f2929a4", "score": "0.6511873", "text": "def index\n @search = Scomp.search(params[:q])\n @scomps = @search.result\n end", "title": "" }, { "docid": "05ee0557c4ae0c44b19fb268a7c9295e", "score": "0.6511312", "text": "def autocomplete\n\t\tquery_params = QueryFormat.autocomplete_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tquery['field'] = \"content_auto\" if query['field'].blank?\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\tmax = query['max'].to_i\n\t\t\tquery.delete('max')\n\t\t\twords = solr.auto_complete(query)\n\t\t\twords.sort! { |a,b| b[:count] <=> a[:count] }\n\t\t\twords = words[0..(max-1)]\n\t\t\t@results = words.map { |word|\n\t\t\t\t{ :item => word[:name], :occurrences => word[:count] }\n\t\t\t}\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { results: @results } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend", "title": "" }, { "docid": "8ebcf03a65bb2984f9fadc9722eb8c2b", "score": "0.65068966", "text": "def search \n\n end", "title": "" }, { "docid": "fe2a2c932e75956b2215de3bab37c90d", "score": "0.6505358", "text": "def index\n @user_searches = UserSearch.all\n end", "title": "" }, { "docid": "f5d3c2f58f80244376b98bf19ae83a20", "score": "0.64959073", "text": "def index\n @hp_searches = HpSearch.all\n end", "title": "" }, { "docid": "3a90df9a3bcfa60273fed2185ecc3abb", "score": "0.6492968", "text": "def get_all_items(solr_params)\n solr_params['rows'] = 1000000\n end", "title": "" }, { "docid": "c01d2b52ddd9e5b16c8c548260cd180f", "score": "0.64924693", "text": "def search\n @query = params[:keywords].nil? ? \"\" : params[:keywords]\n\n # prepare filters\n filters = apply_filters\n\n # do the search itself\n ultrasphinx_search(filters)\n params[:filter] = false;\n\n respond_to do |format|\n format.html { render :partial => 'dt/projects/search_results', :layout => 'layouts/dt_application'}\n end\n end", "title": "" }, { "docid": "b7e675d2af221caf6fbac0f52c1933a0", "score": "0.6486125", "text": "def index \n @documents = Document.catalogs_search( @catalog.documents , params[:query]).order('title asc').page(params[:page]).per(24) \n end", "title": "" }, { "docid": "e1d56e314553d41ac2bce6bfd292fbc1", "score": "0.64859635", "text": "def index\n @results = Result.all\n end", "title": "" }, { "docid": "7b0f4484595e8840c6730ace21b217b5", "score": "0.6484839", "text": "def index\n from_param = (params[:p].to_i * 10)\n @recipes = RecipeApi.search(params[:query], from_param )\n end", "title": "" }, { "docid": "a4e37947ffddb76d5abfbff1833f172a", "score": "0.64827794", "text": "def search(query); end", "title": "" }, { "docid": "def6f24d8865f00120676e713b3ef52a", "score": "0.6482509", "text": "def search_for(keywords, options = {})\n solr_server.find(keywords, options.merge(:results => PublicEarth::Search::CollectionResults))\n end", "title": "" } ]
45805f3957dc8efc4f8485e1281cfa32
Display the Blog Posts tab of the Admin page.
[ { "docid": "85f645fac0348610560cf0f63322955e", "score": "0.0", "text": "def blog_posts\n @page = 'blog_posts'\n respond_to do |format|\n format.html {\n @blog_posts = BlogPost.find(:all)\n }\n format.json { \n blog_posts = BlogPost.find(:all) do\n if contains_search(params)\n user_id =~ \"%#{params[:user_id]}%\" if params[:user_id].present?\n title =~ \"%#{params[:title]}%\" if params[:title].present? \n parent_id =~ \"%#{params[:parent_id]}%\" if params[:parent_id].present? \n published =~ \"%#{params[:published]}%\" if params[:published].present? \n featured =~ \"%#{params[:featured]}%\" if params[:featured].present? \n end\n paginate :page => params[:page], :per_page => params[:rows] \n order_by \"#{params[:sidx]} #{params[:sord]}\"\n end\n render :json => blog_posts.to_jqgrid_json([:id, :user_id, \n :title, :parent_id, \n :published, :featured ], \n params[:page], params[:rows], \n blog_posts.total_entries) }\n end\n end", "title": "" } ]
[ { "docid": "45113a524be2dfd8309b877f52773a32", "score": "0.74352455", "text": "def index\n @admin_blogs = Blog.all\n @page_title = \"Blog Posts\"\n end", "title": "" }, { "docid": "ff62d6a8438a800804ed6bf50d41687f", "score": "0.73288673", "text": "def admin_index\n return if !user_is_allowed('posts', 'view')\n \n @gen = Caboose::PageBarGenerator.new(params, {\n 'site_id' => @site.id,\n 'name' => ''\n },{\n 'model' => 'Caboose::Post',\n 'sort' => 'created_at DESC',\n 'desc' => false,\n 'base_url' => '/admin/posts'\n })\n @posts = @gen.items \n render :layout => 'caboose/admin'\n end", "title": "" }, { "docid": "258e2d126c755ae96e374e87991fd249", "score": "0.7283247", "text": "def show\n @blog_post_presenter = Admin::BlogPostPresenter.new @blog_post\n\n breadcrumbs_for :show\n end", "title": "" }, { "docid": "edd59c3f790e5fb3f0b0d2d22bf39b79", "score": "0.6712639", "text": "def index\n set_meta_tags site: meta_title(\"Posts\")\n add_breadcrumb 'Home', posts_url\n @posts = current_user.posts\n end", "title": "" }, { "docid": "270f42b78e15a0738765314eaf79f90b", "score": "0.66372293", "text": "def admin_index\n return if !user_is_allowed('posts', 'view')\n render :layout => 'caboose/admin' \n end", "title": "" }, { "docid": "64b96a6cbdd4e58f1a63d80cdf6e855f", "score": "0.6610113", "text": "def show\n @page_title = @admin_blog.title\n end", "title": "" }, { "docid": "3fc811821f724e01aa6c0c5fd07ccd85", "score": "0.65967363", "text": "def index\n @admin_blogs = Admin::Blog.page(params[:page])\n end", "title": "" }, { "docid": "184472748542b4c4200cb9abe396e675", "score": "0.6531123", "text": "def index\n @posts = Post.special_blogs\n @page_title = \"My Portfolio Blog\"\n end", "title": "" }, { "docid": "30b0e2081f5decedc4c8c67d8698cda2", "score": "0.65052885", "text": "def show\n add_breadcrumb I18n.t('integral.breadcrumbs.blog'), integral.posts_url\n add_breadcrumb @resource.title, nil\n\n @meta_data = {\n page_title: @resource.title,\n page_description: @resource.description,\n open_graph: {\n image: @resource.preview_image_url(size: :large)\n }\n }\n template = 'default' # TODO: Implement post templates\n render \"integral/posts/templates/#{template}\"\n end", "title": "" }, { "docid": "0341fe54afd999b9a1afaba498f8527a", "score": "0.6437617", "text": "def index\n @posts = Post.all\n render layout: 'admin'\n end", "title": "" }, { "docid": "76eb60de6ad99de5bf45a29e24fdb2a7", "score": "0.64334524", "text": "def edit\n @current_tab = 'blog'\n @post = @service.posts.find(params[:id])\n @page_title = \"Blog :: Editando: #{@post.title}\"\n end", "title": "" }, { "docid": "cf21e07e730264b04a71fc5a353cb565", "score": "0.641587", "text": "def display(posts)\n\t\tposts.each do | post |\n\t\t\tpost.display_post\n\t\tend\n\t\t#print the pagination\n\t\tpagination_section\n\tend", "title": "" }, { "docid": "9c9c7d9b3de053efa8ba2045efdb1bba", "score": "0.63947934", "text": "def index\n \t@blog_posts = BlogPost.all\n end", "title": "" }, { "docid": "64ca21af0f4fc5cf162297e4299912b5", "score": "0.6393345", "text": "def set_admin_blog_post\n @page = Page.find(params[:page_id])\n @admin_blog_post = Admin::BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "15979e6e46a0ec6d59185935d7e12851", "score": "0.63883823", "text": "def index\n @posts = @user.descriptions.all\n render :layout => \"blog_index\"\n end", "title": "" }, { "docid": "2b96c6d13854aac492169508c28010b8", "score": "0.63742775", "text": "def index\n @blog_posts = BlogPost.all\n end", "title": "" }, { "docid": "2b96c6d13854aac492169508c28010b8", "score": "0.63742775", "text": "def index\n @blog_posts = BlogPost.all\n end", "title": "" }, { "docid": "2b96c6d13854aac492169508c28010b8", "score": "0.63742775", "text": "def index\n @blog_posts = BlogPost.all\n end", "title": "" }, { "docid": "447e422bdce2833a3b2f6b94696d275f", "score": "0.6343824", "text": "def publish_front_page\n\t\t@blog.each do |post|\n\t\t\tputs \"#{post.title}\"\n\t\t\tputs \"**************\"\n\t\t\tputs \"#{post.text}\"\n\t\t\tputs \"----------------\"\n\t\tend\n\tend", "title": "" }, { "docid": "a0b4af8175182ff5618c09171dba7cb5", "score": "0.6316737", "text": "def index\n @blogposts = Blogpost.all\n end", "title": "" }, { "docid": "a000c3bcf5eba33d2479584b711935f9", "score": "0.6304068", "text": "def admin_page\n @posts = Post.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 20)\n end", "title": "" }, { "docid": "74cfcedde6afbffb8fe922fe8d0d7b7b", "score": "0.630145", "text": "def index\n search = params[:search].present? ? params[:search] : nil\n @blog_posts = if search\n current_admin_user.blog_posts.search(params[:search])\n else\n current_admin_user.blog_posts\n end\n\n end", "title": "" }, { "docid": "1cbd5b883ea6296a0b6334c8562a7c87", "score": "0.6301181", "text": "def set_admin_blog\n @admin_blog = Admin::Blog.find(params[:id])\n end", "title": "" }, { "docid": "9fcf6c4f8605aeec77388307271cdea8", "score": "0.6273963", "text": "def show\n # expires_in 5.minutes\n @theme_posts = BlogPost.published?.by_category('Theme').order(:road_map_order)\n @app_posts = BlogPost.published?.by_category('App').order(:road_map_order)\n @js_posts = BlogPost.published?.by_category('JSSDK').order(:road_map_order)\n end", "title": "" }, { "docid": "081956d6122a838a0bc768fecd057ffd", "score": "0.62705326", "text": "def show\n @admin_post = Post.find(params[:id])\n end", "title": "" }, { "docid": "8c1e05d387c9026e3e0f1b1494dd7263", "score": "0.62694174", "text": "def index\n\t\tif params.has_key?(:page)\n\t\t\t@page = params[:page]\n\t\t\tsession[:pagination_page] = @page\n\t\t\tsession[:pagination_controller] = controller_name\n\t\telse\n\t\t\tif session.has_key?(:pagination_page)\n\t\t\t\tif (session[:pagination_controller] == controller_name)\n\t\t\t\t\t@page = session[:pagination_page]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tif params.has_key?(:per_page)\n\t\t\tWillPaginate.per_page = (params[:per_page] == t(:all)) ? Admin::BlogEntry.count : params[:per_page]\n\t\telse\n\t\t\tif (!defined? WillPaginate.per_page)\n\t\t\t\tWillPaginate.per_page = Constants::PAGINATION_PER_PAGE_AMOUNTS.first\n\t\t\tend\n\t\tend\n\n\t\t@admin_blog_entries = Admin::BlogEntry.paginate(:page => @page, :per_page => WillPaginate.per_page).order(:publish_at => :desc)\n\tend", "title": "" }, { "docid": "7a4043245374de5c4c6423ea190cebb7", "score": "0.62435377", "text": "def index\n @posts_grid = initialize_grid(Post)\n ## 面包屑导航\n add_breadcrumb I18n.t('view.action.list'), :back_posts_path\n end", "title": "" }, { "docid": "378e9e65b75d1612b5d8a2ecad8596e7", "score": "0.6235388", "text": "def index\n # create object of blog to access blog in home page\n @blogs = Blog.all\n end", "title": "" }, { "docid": "561881a73581fa97162ba59d8be470fd", "score": "0.62304986", "text": "def show\n @post = Blog.find(params[:id])\n end", "title": "" }, { "docid": "718bf1a5e6d02ee7f11e5704645ba52c", "score": "0.62276036", "text": "def set_admin_blog\n @admin_blog = Blog.friendly.find(params[:id])\n end", "title": "" }, { "docid": "258450882324bb4578d88a09519cf59a", "score": "0.62238455", "text": "def new\n @current_tab = 'blog'\n @page_title = \"Blog :: Novo\"\n @post = @service.posts.build\n end", "title": "" }, { "docid": "df51c3911da0d8fcaf5f0200f2875fde", "score": "0.62145466", "text": "def show\n @blogs = Blog.all\n end", "title": "" }, { "docid": "6b91d16a68126e4f5dceabd8cf646f2a", "score": "0.6213151", "text": "def show\n @side_bar_posts = BlogPost.limit(3).order(\"RANDOM()\").where.not(id: @blog_post.id)\n @title = @blog_post.title\n add_breadcrumb @blog_post.title.upcase, @blog_post.slug\n @blog_post = BlogPost.friendly.find(params[:id])\n end", "title": "" }, { "docid": "c66c859464e3962c27523c4df1eaef22", "score": "0.6203948", "text": "def list\n # get all the current posts (set number in preferences)\n @posts = Post.find_current\n # set the page title\n $page_title = Preference.get_setting('SLOGAN')\n render :template => 'index'\n end", "title": "" }, { "docid": "86b57ebf2bd04f42bce0a327f36b1d13", "score": "0.61922985", "text": "def index\n list_all_posts\n end", "title": "" }, { "docid": "a5999f1e08432bf51b6e46c8d7125007", "score": "0.6183314", "text": "def index\n @public_blogs = PublicBlog.all\n @blog = BlogPanel.all\n end", "title": "" }, { "docid": "ae0e1ced453cb7373988e5e0a66043f6", "score": "0.61663747", "text": "def show\n #Ash: :show Calls the set_blog method due to the before_action on top.\n #So do methods :edit, :update, :destroy\n #Things to try:\n #@blog = Blog.find(params[:id])\n #@blog = Blog.find(2)\n\n @page_title = \"Blog Page | \" + @blog.title #remember, @blog is set in :set_blog methid called via before_action\n end", "title": "" }, { "docid": "8bd78442c6c05ddb862cd7438ff39d44", "score": "0.6161177", "text": "def show\n @blog_post = BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "8bd78442c6c05ddb862cd7438ff39d44", "score": "0.6161177", "text": "def show\n @blog_post = BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "8bd78442c6c05ddb862cd7438ff39d44", "score": "0.6161177", "text": "def show\n @blog_post = BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "8bd78442c6c05ddb862cd7438ff39d44", "score": "0.6161177", "text": "def show\n @blog_post = BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "8bd78442c6c05ddb862cd7438ff39d44", "score": "0.6161177", "text": "def show\n @blog_post = BlogPost.find(params[:id])\n end", "title": "" }, { "docid": "a35c0a2121c2c62ef540bd77a93cfcd1", "score": "0.6130476", "text": "def index\n @post_admins = PostAdmin.all\n end", "title": "" }, { "docid": "1d01d74df15327bbe0a2a9f35fc3be0c", "score": "0.61302215", "text": "def set_blog_post\n @blog_post = current_admin_user.blog_posts.friendly.find(params[:id]) # hlada medzi postami, ktore maju admin_user_id = 1 taky, ktory ma friendly_id napr \"hej\"\n end", "title": "" }, { "docid": "9e1f8dd3634e26c7ce5e45114332e58a", "score": "0.61225176", "text": "def blog_post(options={})\n post(path_with_blog_host('post'), options)\n end", "title": "" }, { "docid": "e11fab6c68e2db352ec47672601dc852", "score": "0.61216795", "text": "def show\n begin\n @active_page = \"blogs\"\n respond_with(@blog)\n rescue Exception => e\n log_error(e, \"Error occured in Show action of BlogsController\")\n flash_error(t('blogs.show_page_load_error'))\n end\n end", "title": "" }, { "docid": "b719b62137383e8f17d3c23fc7e4c1d6", "score": "0.61147684", "text": "def show\n @page_title = @blog_post.title\n BlogPost.update_counters(@blog_post.id, views: 1)\n @archives = BlogPost.archives_list\n @popular_blogs = BlogPost.includes(:attachment, :pdf_attachment).last_three_month.views_ordered.published_ordered.first(\"6\")\n @next_blog, @previous_blog = @blog_post.next_and_previous_blogs\n\n prepare_meta_tags(@blog_post.blog_seo_options)\n end", "title": "" }, { "docid": "ed4c4c10c5ec0535d8117b4320e358e2", "score": "0.6107533", "text": "def index\n @admin_posts = Admin::Post.includes(:user).order(\"created_at DESC\").page(params[:page])\n @admin_posts = display_options(@admin_posts, params[:display_options])\n end", "title": "" }, { "docid": "4358766775d20b3472d7b74df8abfc83", "score": "0.6105896", "text": "def home_link\n link_to 'Back to posts list', blog_posts_path\n end", "title": "" }, { "docid": "eac72230d21335ad8cd51a026a8056d5", "score": "0.60983014", "text": "def index\n @microblogposts = Microblogpost.all\n end", "title": "" }, { "docid": "6afebe2a5d5fc715c8050f143164cdb9", "score": "0.6081774", "text": "def index\n @blogposts = Blogpost.all.select(&:publish_date).sort_by(&:publish_date).reverse!\n @sidebar = 'sidebar-blog-background'\n render(:layout => \"layouts/application\")\n #Action specific layout\n end", "title": "" }, { "docid": "8929b385dace9c01528f6d72d9980305", "score": "0.6080322", "text": "def index\n @admin_blogs = Blog.all.order('created_at asc')\n end", "title": "" }, { "docid": "537288b8383363d174cb0d346c63fd09", "score": "0.6076604", "text": "def show\n @blog_posts = @blog_tag.posts.all.page(params[:page])\n end", "title": "" }, { "docid": "0d974e68b1faa607713396de0bf692fb", "score": "0.6076237", "text": "def index\n\t @posts = list_posts\n end", "title": "" }, { "docid": "27799e5965f04ed5aed374a0781269f2", "score": "0.6073725", "text": "def index\n @blog_posts = Blog_Post__c.all\n end", "title": "" }, { "docid": "550cbbed554b828a321f20843c8863e6", "score": "0.6065049", "text": "def show\n @blog = Blog.find(params[:id])\n end", "title": "" }, { "docid": "6e921ab1eccb2447ac90cdcd7eacf6e4", "score": "0.60510767", "text": "def create\n @admin_blog_module = Admin::BlogModule.find(params[:blog_module_id])\n @admin_blog_post = @admin_blog_module.posts.new(admin_blog_post_params)\n if @admin_blog_post.save\n redirect_to admin_page_path(@admin_blog_module.page)\n else\n render :new\n end\n end", "title": "" }, { "docid": "69f452a295ac9d11c76b2f9590f477ad", "score": "0.6047994", "text": "def index\n add_breadcrumb I18n.t('integral.breadcrumbs.blog'), nil\n\n @latest_post = Integral::Post.published.where(locale: I18n.locale).order('published_at DESC').first&.decorate\n @posts = Integral::Post.published.where(locale: I18n.locale).includes(:image, :user).order('published_at DESC').paginate(page: params[:page])\n @posts = @posts.where.not(id: @latest_post.id) if @latest_post\n\n page_title = t('integral.posts.index.title')\n page_description = t('integral.posts.index.description')\n if params[:page].present?\n page_title += \" - Page #{params[:page]}\"\n page_description += \" - Page #{params[:page]}\"\n end\n\n @meta_data = {\n page_title: page_title,\n page_description: page_description\n }\n end", "title": "" }, { "docid": "35492e9b557d77b31505a59c14fcc5cf", "score": "0.6047788", "text": "def new\n\t\t@blog_post = @blog.blog_posts.build\n\t\t# Show the HTML form to fill in details of the BlogPost\n\t\t# By convention, rails framework looks for a file called new.html.erb\n\t\t# in app/views/blog_posts folder. This can be overridden.\n\tend", "title": "" }, { "docid": "4e3b8d0f0f76e044dfaa7bc36ae91f65", "score": "0.6035704", "text": "def is_admin_blog\n super\n end", "title": "" }, { "docid": "a0df682f57c1f48ac9fca9b425f34392", "score": "0.60244036", "text": "def index\n @quote_posts = QuotePost.all\n render layout: 'admin'\n end", "title": "" }, { "docid": "4f4ec11b5afac734fc41f5cbbe4e1fd5", "score": "0.6022634", "text": "def puts_blog\n puts @@all_blog_posts\n end", "title": "" }, { "docid": "8a9c02aa72f747a27acc89f19cc449a4", "score": "0.6014735", "text": "def set_admin_blog\n @blog = Blog.find_by_slug(params[:id])\n end", "title": "" }, { "docid": "1d88e8a8a88aa420fb7a2226c58c458d", "score": "0.6004008", "text": "def index\n @admin_posts = AdminPost.all.order('created_at DESC').paginate(page: params[:page], per_page: 10)\n end", "title": "" }, { "docid": "5cd5d6e9103bd5f70b09fa87e72196d9", "score": "0.600084", "text": "def adminblog\n @page = 'home'\n @id = Integer(params[:id])\n @blogitem = @blogitems[@id]\n\n \n end", "title": "" }, { "docid": "2b17cf153dadda4707aafde305374bd2", "score": "0.59969777", "text": "def set_admin_blog\n @admin_blog = Blog.find(params[:id])\n end", "title": "" }, { "docid": "15f282ede82dda60e489f1764a0bd28b", "score": "0.59935695", "text": "def index\n # TODO: implement listing all posts\n @view.display(Post.all)\n end", "title": "" }, { "docid": "419f17bf04eb8189bf24205ccf9ecfb6", "score": "0.5991502", "text": "def blog\n @title= (Spree::CmsPage.find_by_default_string \"blog\").title rescue \"Blog\"\n end", "title": "" }, { "docid": "be7ecb9e52fbaed686b97bfa25344c65", "score": "0.5991341", "text": "def show\n @blogpost = get_blogpost\n @full_length = true\n end", "title": "" }, { "docid": "d83c4403f985c7469c879df3ddae3f6b", "score": "0.598961", "text": "def index\n @blog = Post.all.paginate(page: params[:page], per_page: 10)\n end", "title": "" }, { "docid": "d828dbc4c6d61ce0dd0c4dbe0bf9e4de", "score": "0.5987996", "text": "def index\n @options = %w(Publish Delete Delete\\ All Publish\\ All)\n if user_signed_in?\n if current_user.is_admin? || current_user.is_editor?\n @blogs = Blog.all\n else\n @blogs = current_user.blogs\n end\n else\n @blogs = Blog.where(:status=>'published')\n end\n end", "title": "" }, { "docid": "cc628f972019efb41f10937ddf42b5d4", "score": "0.59861416", "text": "def author_show\n @author = Author.find(params[:id])\n $admin_page_title = 'Showing posts by \"' + @author.name + '\"'\n render :template => 'admin/authors/author_show'\n end", "title": "" }, { "docid": "c2d2c2088b458ceb9909d1197881b2ee", "score": "0.59812987", "text": "def show\n @user = User.first\n @blogger = Blogger.new\n @bloggers = Blogger.all\n @entries = Entry.page(params[:page]).per_page(10).order('published DESC')\n end", "title": "" }, { "docid": "332d3a7bf8b4a6a50b202ac003f9cd16", "score": "0.5969724", "text": "def show\n\t\t@blog_post = BlogPost.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @blog_post }\n\t\tend\n\tend", "title": "" }, { "docid": "5ae885f6c298e0cc24f4dc5b89c53dc5", "score": "0.5958494", "text": "def index\n @blogs = Blog.all\n @page_title = \"My Portfolio Blog\"\n end", "title": "" }, { "docid": "2234db5230bc051e2b29369064ae8f4a", "score": "0.5943861", "text": "def show\n @current_tab = 'blog'\n\n @post = if current_user\n @service.posts.ordered.with_service.find_by_slug(params[:id]) || @service.posts.ordered.with_service.find(params[:id])\n else\n @service.posts.published.ordered.with_service.find_by_slug(params[:id]) || @service.posts.published.ordered.with_service.find(params[:id])\n end\n\n respond_to do |format|\n format.html do\n @post_context = @post.context\n @page_title = \"Blog :: #{@post.title}\"\n render :action => :show\n end\n format.json do\n render :json => @post.to_json(:include => :service)\n end\n end\n end", "title": "" }, { "docid": "d8d7bac4db18b51672419493eb4b02f4", "score": "0.593566", "text": "def blog\n @container = Container.where(:name => \"Blog\").first\n @posts = Post.where(:is_public => 1).page(params[:page])\n @posts= @posts.order(\"created_at DESC\")\n \n @contact = Contact.new\n render :template => \"frontends/blog\", :layout => \"layouts/frontends/blog\"\n end", "title": "" }, { "docid": "5da137da00e1dfb648ee38ac471b9975", "score": "0.5932469", "text": "def show\n # Fetch from db by url id\n @blog = Blog.find(params[:id])\n @user = @blog.user\n @posts = @blog.posts.paginate(page: params[:page], per_page: 3)\n end", "title": "" }, { "docid": "89872a83332f5e6d2ff4a69c3464b671", "score": "0.5932294", "text": "def index\n @blogs = Blog.all\n #Ash: If you wanted to display only 1 blog out of all the blogs in the DB, you'd do Blog.limit(1)\n\n @page_title = \"Blogs Page | My Portfolio Blog\"\n #@page title is accessed in (utilized by) application.html.erb\n end", "title": "" }, { "docid": "b15137a795af97ce0662395d8a56fb8c", "score": "0.59273696", "text": "def show\n if !current_user\n redirect_to '/blog'\n end\n end", "title": "" }, { "docid": "0f5ff52eb388c95a510b86809c5cefb7", "score": "0.59269494", "text": "def index\n @blogs = Blog.page(params[:page]).per(5)\n @page_title = \"Blog Section\"\n #@blogs = Blog.limit(1) would only show us Blog #1 or localhos,t:3000/blogs/1\n end", "title": "" }, { "docid": "d51f20ce9dc5f4de85686194872d21c4", "score": "0.5925809", "text": "def show\n @user = current_user\n @blogpost = Blogpost.find(params[:id])\n end", "title": "" }, { "docid": "ccabccf44b7bf3907e39e25f5eff573f", "score": "0.5923638", "text": "def admin_nav_link\n if controller_class == \"posts\"\n link_to \"New Post\", new_post_path\n else\n link_to \"Add Comic\", new_comic_path\n end\n end", "title": "" }, { "docid": "a846cabbc2f6f338221c01383ca2e71c", "score": "0.59222996", "text": "def index\n @le_blogs = LeBlog.all\n end", "title": "" }, { "docid": "8b957afc861fa449df189486e66a9781", "score": "0.59153557", "text": "def set_admin_blog_entry\n\t\t@admin_blog_entry = Admin::BlogEntry.find(params[:id])\n\tend", "title": "" }, { "docid": "5edf92390d069fa8c1b442dce0751c14", "score": "0.59111136", "text": "def get_blog_posts\n\n\t\treturn @blog_posts\n\n\tend", "title": "" }, { "docid": "6f3da72ae2baea657feb4bb7120720bc", "score": "0.5908838", "text": "def display_post\n puts \"--------------------\"\n puts \"Title: #{@page.title}\"\n puts \"URL: #{@page.url}\"\n puts \"Item ID: #{@page.item_id}\"\n puts \"Posted by #{@page.poster}. #{@page.points} points, #{@page.comments.length} comments.\"\n puts \"--------------------\"\n end", "title": "" }, { "docid": "f1b4645bbfe9f41ef3e8661599ae486e", "score": "0.5908539", "text": "def index\n posts = Post.all\n @view.display_all(posts)\n # TODO: implement listing all posts\n end", "title": "" }, { "docid": "9ce084d4b9c946187802b7baf6e9e032", "score": "0.5907357", "text": "def set_post_admin\n @post_admin = PostAdmin.find(params[:id])\n end", "title": "" }, { "docid": "dfc1deb9a9b61d08d426bf6437e26a5d", "score": "0.5877444", "text": "def show\n @user_posts = @user.blogs.paginate(page: params[:page], :per_page => 3)\n @page_title = \"#{@user.username}'s Profile\"\n end", "title": "" }, { "docid": "73e91b90c798435041fc19eca97d8fff", "score": "0.58743936", "text": "def show\n set_markdown_renderer\n render :layout => 'posts'\n end", "title": "" }, { "docid": "a8102fbd06cf55ff57924b2dd1daa322", "score": "0.58680576", "text": "def index\n # TODO: implement listing all posts\n\n # Get all posts instances from DB\n posts = Post.all\n # Send instances to view and print them as list\n @view.display_all(posts)\n end", "title": "" }, { "docid": "4a6d642860323ee7c8813ff830248829", "score": "0.5865759", "text": "def show\n @blog_post = Blog::Post.find(params[:id])\n @top_posts = Blog::Post.last(5)\n end", "title": "" }, { "docid": "f342d0f1b8b66de0a149cf191417df31", "score": "0.5865713", "text": "def index\n @posts = \n if current_user.is_admin\n Post.all\n else\n current_user.posts\n end\n end", "title": "" }, { "docid": "192d899698ce580d091d92d3b9bd0dc7", "score": "0.5854709", "text": "def index\n @blog = Blog.all\n end", "title": "" }, { "docid": "1c9284233a0068776250836c4b7bc063", "score": "0.5842849", "text": "def index\n @post_blogs = PostBlog.all\n #@post_blogs = PostBlog.joins(:users)\n end", "title": "" }, { "docid": "535cd7722cb53680ee800c6475f78ffe", "score": "0.58337575", "text": "def index\n @blog_entries = Blog::Entry.all\n end", "title": "" }, { "docid": "0f1aad9c5985934931cb01dfc8b032df", "score": "0.5825435", "text": "def show\n @blog = Blog.find(params[:id])\n end", "title": "" }, { "docid": "156f20348ba929953d3071ac0adfbb76", "score": "0.5824817", "text": "def index\n # TODO: implement listing all posts\n # call class method all\n posts = Post.all\n @view.display_all_posts(posts)\n end", "title": "" }, { "docid": "4da62055f3a7a026625c5b9ad0404f98", "score": "0.58226866", "text": "def get_blog_posts\n\t\treturn @blog_posts\n\tend", "title": "" }, { "docid": "2c755a48a25d3b8ede811fb25465edf0", "score": "0.58221644", "text": "def show\n @posts = @board.main_posts\n @location = \"main\"\n render layout: 'main_board'\n end", "title": "" } ]
eecda3435a78faaab38e2fab3046f676
=begin def good_practices game_hash.each do |location, team_data| are you ABSOLUTELY SURE what 'location' and 'team data' are? use binding.pry to find out! binding.pry team_data.each do |attribute, data| are you ABSOLUTELY SURE what 'attribute' and 'team data' are? use binding.pry to find out! binding.pry what is 'data' at each loop through out .each block? when will the following line of code work and when will it break? data.each do |data_item| binding.pry end end end end good_practices =end
[ { "docid": "9c6e4473ad64db689234b4236792856b", "score": "0.5885203", "text": "def num_points_scored(player_name)\n total_scored = 0\n\n game_hash.each do |location, team_data| #home, away\n# binding.pry\n team_data.each do |attribute, data| #team_name, colors, players\n# binding.pry\n if attribute == :players\n data.each do |player, stats| #each player\n# binding.pry\n if player == player_name\n stats.each do |key, value| #each stat category\n# binding.pry\n if key == :points\n total_scored += value\n\n# binding.pry\n end\n end\n end\n end\n end\n end\n end\n total_scored\nend", "title": "" } ]
[ { "docid": "1f6be10cdfeab3d531e34eeb0d823fb7", "score": "0.8797951", "text": "def good_practices\n game_hash.each do |location, team_data|\n #are you ABSOLUTELY SURE what 'location' and 'team data' are? use binding.pry to find out!\n #binding.pry\n team_data.each do |attribute, data|\n #are you ABSOLUTELY SURE what 'attribute' and 'team data' are? use binding.pry to find out!\n #binding.pry\n\n #what is 'data' at each loop through out .each block? when will the following line of code work and when will it break?\n if attribute == :players\n data.each do |data_item|\n #binding.pry\n end\n end\n end\n end\nend", "title": "" }, { "docid": "c7e99b0b3f400f643a41b2554dd8cf35", "score": "0.64461887", "text": "def team_names\n team_names_array = []\n game_hash.each do |home_away, value|\n value.each do |team_atts, inner_value|\n # binding.pry\n if team_atts == :team_name\n team_names_array.push(inner_value)\n end \n end\n end\n team_names_array\nend", "title": "" }, { "docid": "c608c43c9b203fb9d79046da594decdc", "score": "0.6279035", "text": "def num_points_scored(players_name)\n\ngame_hash.each do #1\n |team,data|\n #binding.pry\ndata.each do #2\n |general,info|\n if general == :players #3\n #binding.pry\n info.each do #4\n |players,stats|\n #binding.pry\n if players == players_name #5\n #binding.pry\n stats.each do\n |k,y|\n #binding.pry\n if k ==:points\n return y\n end\n end\n\n end#5\n end#4\n end #3\n end #2\nend #1\nend", "title": "" }, { "docid": "c70efb139ff6232da0ee97d0ab0b1432", "score": "0.61187154", "text": "def player_numbers(team) # understand the questions wrong. try to pull our a simgle player's jersey.\n\n jersey_numbers = []\n\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n# binding.pry\n if data == team # do not use attribute. the data is the value of the team name.\n\n game_hash[location][:players].each do |player_name, player_data|\n jersey_numbers << game_hash[location][:players][player_name][:number]\n end\n end\n end\n end\n\n jersey_numbers\nend", "title": "" }, { "docid": "ab5ff19de7e28eaafd1bdfa69f8763ff", "score": "0.61135834", "text": "def team_names#didit!\ngame_hash.map do |location, team_data|\nteam_data[:team_name]\nend\nend", "title": "" }, { "docid": "5d7fb6b52fd24930e3435f7723116a06", "score": "0.6010042", "text": "def team_colors(team_names)\ngame_hash.collect do |team,data|\n #binding.pry\n data.each do |general,stats|\n #binding.pry\n if stats.include?(team_names) #this works\n data.each do |general_X1,stats_X2|\n if general_X1 == :colors\n y = stats_X2\n #binding.pry\n return stats_X2\n end\n end\n end\n end\n end\nend", "title": "" }, { "docid": "980bb0d42cfb1a0707098a409eb57096", "score": "0.59506214", "text": "def get_team_info(team_info)\n team_info.each do |team|\n puts \"#{team[:home_team]} #{team[:away_team]} #{team[:home_score]} #{team[:away_score]}\"\n end\nend", "title": "" }, { "docid": "d31b6e88c8937f765b9451af752b794c", "score": "0.5937267", "text": "def all_supplies_in_holidays(holiday_hash)\n holiday_hash.each do |season, holiday_names|\n puts \"#{season.capitalize}:\"\n holiday_names.each do |holiday_name, supply_arrays|\n #binding.pry\n puts \" #{holiday_name.to_s.split('_').collect do |word|\n word.capitalize\n end.join(' ')}: #{supply_arrays.join(\", \")}\"\n\n\n #supply_arrays.each do |supply_array, supplies|\n #binding.pry\n #puts <<~HEREDOC\n #{}\"#{season.capitalize}:\"\n # \"#{holiday_name.capitalize}: #{supplies}\"\n #HEREDOC\n #end\n end\n end\nend", "title": "" }, { "docid": "44f476383a907b4a2f14aa5d256b7012", "score": "0.592426", "text": "def each_data; end", "title": "" }, { "docid": "323d1b4dd405a22b9b20cd568889ae0d", "score": "0.58997005", "text": "def iterator(hash)\n hash.each do |key, value|#take this block info below (key and key)\n hash[key].breakfast_sammy(\"x\", \"y\") #give arguments(as strings)\n hash[key].chomper(\"food\") #this method can call the methods from the class above because the info for this is snuck in with the hash when we pass it through\n end \nend", "title": "" }, { "docid": "644c9f5cbd26abdce442cbe57702a2f3", "score": "0.583115", "text": "def each_hash; end", "title": "" }, { "docid": "8e2b06f71eca57ec2cf8b8173f1cdfa3", "score": "0.58179533", "text": "def num_harness(party)\n puts \"HARNESSES:\"\n # i=0\n red_harness = 0\n blue_harness = 0\n kids_hash.values.each do |parties|\n # binding.pry\n next unless parties.is_a?(Hash)\n if parties[:party_number] == (party)\n parties[:attendance].each do |kid|\n if kid[:harness] == \"red\"\n red_harness +=1\n else\n blue_harness +=1\n end\n end\n end\n end\n puts \"For party #{party}, we will need #{red_harness} red harnesses and #{blue_harness} blue harnesses.\"\n # i+=1\n # red_harness = 0\n # blue_harness = 0\n\nend", "title": "" }, { "docid": "06fc68b1b8f56f69a091c74c8686e922", "score": "0.5777354", "text": "def game_hash \n\ngame_hash =\t{\n\thome: {\n\t\tteam_name: \"\",\n\t\tcolors: [], \t\t\t#array of strings\n\t\tplayers: {\n\t\t\tplayer_name {\n\t\t\tnumber:\n\t\t\tshoe:\n\t\t\tpoints:\n\t\t\trebounds:\n\t\t\tassists:\n\t\t\tsteals:\n\t\t\tblocks:\n\t\t\tslam_dunks:\n\t\t\t}\n\t\t}\n\t}, \n\n\taway: {\n\t\tteam_name: \"\",\n\t\tcolors: [], \t\t#array of strings\n\t\tplayers: {\n\t\t\tplayer_name {\n\t\t\tnumber:\n\t\t\tshoe:\n\t\t\tpoints:\n\t\t\trebounds:\n\t\t\tassists:\n\t\t\tsteals:\n\t\t\tblocks:\n\t\t\tslam_dunks:\n\t\t\t}\n\t\t}\n\n\t}\n}\n\n\n\nend", "title": "" }, { "docid": "99176e28101b0403ea18d31aa617fedc", "score": "0.57287645", "text": "def team_colors(team)\n\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if data == team\n return game_hash[location][:colors] # need return, otherwise iternation will return the whole hash.\n end\n end\n end\nend", "title": "" }, { "docid": "732534f1ec3adbf37d46b0fa8f3cda53", "score": "0.57270837", "text": "def kids_shoes(party)\n puts \"SHOES:\"\n shoe_list = []\n i = 0\n # binding.pry\n kids_hash.values.each do |parties|\n next unless parties.is_a?(Hash)\n if parties[:party_number] == (party)\n # binding.pry\n parties[:attendance].each do |kid|\n # binding.pry\n name = kid[:name]\n shoes = kid[:shoe_size]\n shoe_list << \"#{name} with size #{shoes} shoes.\"\n # binding.pry\n i+=1\n end\n end\n end\n # binding.pry\n puts \"For party #{party}, we need shoes for #{i} kids:\"\n puts shoe_list\nend", "title": "" }, { "docid": "a6ba487bb76620159e1c6422150a8885", "score": "0.56759906", "text": "def team_colors(team)\n game_hash.each do |location, team_data|\n # binding.pry\n if team_data[:team_name] == team\n return team_data[:colors]\n end\n end\nend", "title": "" }, { "docid": "dde5c278cd8f9fe7cd26a95946021e6c", "score": "0.56634766", "text": "def wavers(party)\nputs \"WAVERS:\"\ndoes_waver = [\"Everyone is good to go.\"]\nno_waver =[]\nkids_hash.values.each do |parties|\n next unless parties.is_a?(Hash)\n if parties[:party_number] == (party)\n # binding.pry\n parties[:attendance].each do |kid|\n # binding.pry\n if kid[:wavers] == \"no\"\n # binding.pry\n no_waver << \"#{kid[:name]} still needs a waver.\"\n does_waver = []\n end\n end\n end\n end\n does_waver << no_waver\n puts does_waver.join(\"\\n\")\nend", "title": "" }, { "docid": "2a1312127052c5e9820a6c7ed6c52724", "score": "0.5649259", "text": "def team_names\n game_hash.map do |location, team_data|\n #go through data, access value from :team_name keys\n team_data[:team_name]\n end\nend", "title": "" }, { "docid": "176d6f1cbfb429b987afeebe10d4e561", "score": "0.56485885", "text": "def team_names(hash)\n hash.each do |location, team_info|\n team_info.each do |team_id, name|\n p name if team_id == :team_name\n end\n end\nend", "title": "" }, { "docid": "f30d1596f949f7c48d9359d86e96668a", "score": "0.56445366", "text": "def team_colors(team_name) \n game_hash.each do |attribute, values|\n \n result = values.values\n \n x = result[0].to_s\n y = result[1].to_s\n\n hash = [x => y]\n\n hash.each do |u|\n puts u[team_name]\n end \n end \n end", "title": "" }, { "docid": "287e547dd4ec6f7ac9bb7f53fca3b2fb", "score": "0.563988", "text": "def olympics(olympics_hash)\n olympics_hash.each do |year, place|\n puts \"The #{year} summer olympics took place in #{place}.\"\n end\nend", "title": "" }, { "docid": "204a5885b7c54c27a4619af475e21ef3", "score": "0.5612927", "text": "def iterate\nputs \"Iterate\"\n{:first=>\"test\",:second=>\"this\",:third=>\"feature\"}.each {|key,value| puts \"Key: #{key} Value: #{value}\"}\nend", "title": "" }, { "docid": "5815c11d943a62d8a1c5cd344e520fa2", "score": "0.55909646", "text": "def num_points_scored(name)\n game_hash.each do |location, team_hash|\n \n #the below is actually iterating through the keys of the hash containing the team info, because the value of game_hash is....another hash\n team_hash.each do |key, vals|\n if key == :players # this makes sure I'm only iterating through the right pair to begin with\n return vals[name][:points] if vals[name] # the return keyword ensures it will pop out of the method once the answer has been found \n end\n end\n end\nend", "title": "" }, { "docid": "1a0436bd0675b678f20d536632727102", "score": "0.556502", "text": "def game_hash\n # puts \"pry #3\"\n # binding.pry\n\n {\n home: {\n team_name: \"Brooklyn Nets\",\n colors: [\"Black\", \"White\"],\n players: [\n {\n player_name: \"Alan Anderson\",\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n }, {\n player_name: \"Reggie Evans\",\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n }, {\n player_name: \"Brook Lopez\",\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n }, {\n player_name: \"Mason Plumlee\",\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 12,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n }, {\n player_name: \"Jason Terry\",\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n ]\n },\n away: {\n team_name: \"Charlotte Hornets\",\n colors: [\"Turquoise\", \"Purple\"],\n players: [\n {\n player_name: \"Jeff Adrien\",\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n }, {\n player_name: \"Bismak Biyombo\",\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 7,\n blocks: 15,\n slam_dunks: 10\n }, {\n player_name: \"DeSagna Diop\",\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n }, {\n player_name: \"Ben Gordon\",\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n }, {\n player_name: \"Brendan Haywood\",\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 22,\n blocks: 5,\n slam_dunks: 12\n }\n ]\n }\n }\nend", "title": "" }, { "docid": "f5184ffae49768742e9edc2390b7380e", "score": "0.55592", "text": "def bitmaker(cohort)\n cohort.each do |k, v|\n puts \"This is #{k} and #{v} students\"\n end\nend", "title": "" }, { "docid": "698633b8e3643dff6c27ccb635a703c3", "score": "0.5550355", "text": "def game_hash \n bball_game_hash = {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\", \"White\"],\n :players => [\n { :player_name => \"Alan Anderson\",\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n { :player_name => \"Reggie Evans\",\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n { :player_name => \"Brook Lopez\",\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n { :player_name => \"Mason Plumlee\",\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 11,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n { :player_name => \"Jason Terry\",\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n ]\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => [\n { :player_name => \"Jeff Adrien\",\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n { :player_name => \"Bismack Biyombo\",\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 22,\n :blocks => 15,\n :slam_dunks => 10\n },\n { :player_name => \"DeSagna Diop\",\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n { :player_name => \"Ben Gordon\",\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n },\n { :player_name => \"Kemba Walker\",\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 7,\n :blocks => 5,\n :slam_dunks => 12\n }\n ]\n }\n }\nbball_game_hash\nend", "title": "" }, { "docid": "5dbd496e8481d5ae5acd65e1b245d86c", "score": "0.5547341", "text": "def game_hash\ngame_hash = {\n :home => {\n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\",\"White\"],\n :players => {\n \"Alan Anderson\" => {:number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {:number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {:number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \"Mason Plumlee\" => {:number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n },\n \"Jason Terry\" => {:number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n } },},\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\" => {:number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2, \n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismak Biyombo\" => {:number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7, \n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" => {:number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4, \n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" => {:number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1, \n :blocks => 1,\n :slam_dunks => 0\n },\n \"Brendan Haywood\" => {:number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22, \n :blocks => 5,\n :slam_dunks => 12\n },},}}\nend", "title": "" }, { "docid": "1d762e6aa9d7ec281fd1822ec8fe3a81", "score": "0.55451125", "text": "def print_all(hash_name)\n # iterates over each pair key, value of the hash\n puts \"Here is the current list of department and city:\"\n hash_name.each do |department, city|\n puts \"The main city for the department #{department} is #{city}\"\n end\nend", "title": "" }, { "docid": "dd6842dd6614e041e2783558a51ff589", "score": "0.5533724", "text": "def game_hash\nh_a_teams = {\n\n :home =>{:team_name =>\"Brooklyn Nets\",\n :colors =>['Black','White'],\n :players => [\n\n {:player_name =>\"Alan Anderson\",\n :number =>0,\n :shoe =>16,\n :points =>22,\n :rebounds =>12,\n :assists =>12,\n :steals =>3,\n :blocks =>1,\n :slam_dunks =>1},\n\n {:player_name =>\"Reggie Evans\",\n :number =>30,\n :shoe =>14,\n :points =>12,\n :rebounds =>12,\n :assists =>12,\n :steals =>12,\n :blocks =>12,\n :slam_dunks =>7},\n\n {:player_name =>\"Brook Lopez\",\n :number =>11,\n :shoe =>17,\n :points =>17,\n :rebounds =>19,\n :assists =>10,\n :steals =>3,\n :blocks =>1,\n :slam_dunks =>15},\n\n {:player_name =>\"Mason Plumlee\",\n :number =>1,\n :shoe =>19,\n :points =>26,\n :rebounds =>11,\n :assists =>6,\n :steals =>3,\n :blocks =>8,\n :slam_dunks =>5},\n\n {:player_name =>\"Jason Terry\",\n :number =>31,\n :shoe =>15,\n :points =>19,\n :rebounds =>2,\n :assists =>2,\n :steals =>4,\n :blocks =>11,\n :slam_dunks =>1}\n ]},\n\n\n\n\n :away =>{:team_name =>\"Charlotte Hornets\",\n :colors =>['Turquoise','Purple'],\n :players =>[{\n\n :player_name =>\"Jeff Adrien\",\n :number =>4,\n :shoe =>18,\n :points =>10,\n :rebounds =>1,\n :assists =>1,\n :steals =>2,\n :blocks =>7,\n :slam_dunks =>2},\n\n {:player_name =>\"Bismack Biyombo\",\n :number =>0,\n :shoe =>16,\n :points =>12,\n :rebounds =>4,\n :assists =>7,\n :steals =>22,\n :blocks =>15,\n :slam_dunks =>10},\n\n {:player_name =>\"DeSagna Diop\",\n :number =>2,\n :shoe =>14,\n :points =>24,\n :rebounds =>12,\n :assists =>12,\n :steals =>4,\n :blocks =>5,\n :slam_dunks =>5},\n\n {:player_name =>\"Ben Gordon\",\n :number =>8,\n :shoe =>15,\n :points =>33,\n :rebounds =>3,\n :assists =>2,\n :steals =>1,\n :blocks =>1,\n :slam_dunks =>0},\n\n {:player_name =>\"Kemba Walker\",\n :number =>33,\n :shoe =>15,\n :points =>6,\n :rebounds =>12,\n :assists =>12,\n :steals =>7,\n :blocks =>5,\n :slam_dunks =>12}\n ]\n }\n }\n\nend", "title": "" }, { "docid": "ff245abca733f0e10fcab956718a79b2", "score": "0.5533642", "text": "def game_hash\n game_hash =\n {\n :home => {\n :team_name => \"Brooklyn Nets\", \n :colors => [\"Black\", \"White\"], \n :players => {\n \"Alan Anderson\" => {\n :number => 0, \n :shoe => 16, \n :points => 22, \n :rebounds => 12, \n :assists => 12, \n :steals => 3, \n :blocks => 1, \n :slam_dunks => 1}, \n \"Reggie Evans\" => {\n :number => 30, \n :shoe => 14, \n :points => 12, \n :rebounds => 12, \n :assists => 12, \n :steals => 12, \n :blocks => 12, \n :slam_dunks => 7}, \n \"Brook Lopez\" => {\n :number => 11, \n :shoe => 17, \n :points => 17, \n :rebounds => 19, \n :assists => 10, \n :steals => 3, \n :blocks => 1, \n :slam_dunks => 15 }, \n \"Mason Plumlee\" => {\n :number => 1, \n :shoe => 19, \n :points => 26, \n :rebounds => 12, \n :assists => 6, \n :steals => 3, \n :blocks => 8, \n :slam_dunks => 5 }, \n \"Jason Terry\" => {\n :number => 31, \n :shoe => 15, \n :points => 19, \n :rebounds => 2, \n :assists => 2, \n :steals => 4, \n :blocks => 11, \n :slam_dunks => 1 },\n \n }\n \n },\n\n :away => {\n :team_name => \"Charlotte Hornets\", \n :colors => [\"Turquoise\", \"Purple\"], \n :players => {\n \"Jeff Adrien\" => {\n :number => 4, \n :shoe => 18, \n :points => 10, \n :rebounds => 1, \n :assists => 1, \n :steals => 2, \n :blocks => 7, \n :slam_dunks => 2}, \n \"Bismak Biyombo\" => {\n :number => 0, \n :shoe => 16, \n :points => 12, \n :rebounds => 4, \n :assists => 7, \n :steals => 7, \n :blocks => 15, \n :slam_dunks => 10 }, \n \"DeSagna Diop\" => {\n :number => 2, \n :shoe => 14, \n :points => 24, \n :rebounds => 12, \n :assists => 12, \n :steals => 4, \n :blocks => 5, \n :slam_dunks => 5 }, \n \"Ben Gordon\" => {\n :number => 8, \n :shoe => 15, \n :points => 33, \n :rebounds => 3, \n :assists => 2, \n :steals => 1, \n :blocks => 1, \n :slam_dunks => 0 }, \n \"Brendan Haywood\" => {\n :number => 33, \n :shoe => 15, \n :points => 6, \n :rebounds => 12, \n :assists => 12, \n :steals => 22, \n :blocks => 5, \n :slam_dunks => 12 },\n \n }\n \n }\n \n}end", "title": "" }, { "docid": "05584a566c1db78825452591a8bd9022", "score": "0.55319357", "text": "def hopper\n\tprogrammer_hash = \n \t\t{\n :grace_hopper => {\n :known_for => \"COBOL\",\n :languages => [\"COBOL\", \"FORTRAN\"]\n },\n :alan_kay => {\n :known_for => \"Object Orientation\",\n :languages => [\"Smalltalk\", \"LISP\"] \n },\n :dennis_ritchie => {\n :known_for => \"Unix\",\n :languages => [\"C\"]\n }\n }\n\nprogrammer_hash[:grace_hopper] #retrurning the value of :grace_hopper\n\n#binding.pry \n\nend", "title": "" }, { "docid": "c70888584fa9c7d02fb736cb4b51bd3a", "score": "0.55280036", "text": "def happy_birthday(birthday_kids)\n #Here we are using #each to iterate over each pair of kids name/age.\n #We are yielding the key/value pair to the block of code between the do/end keywords\n #by assigning the variables kids_name and age in between the pipes, | |,\n #to be the placeholders for each key/value pair.\n birthday_kids.each do |kids_name, age|\n #Then, we can use those variable names in our string interpolation to\n #puts out the actual values they point to at each step of the iteration.\n puts \"Happy Birthday #{kids_name}! You are now #{age} years old!\"\n end\nend", "title": "" }, { "docid": "8b6833a9d545be2e5fb1b535668e2c3c", "score": "0.5525497", "text": "def player_stats(name) #takes argument of player name and returns hash of players stats\r\n hash = game_hash\r\n hash.each do |teams_playing, data|\r\n data[:players].each do |player_name, player_data|\r\n if player_name == name\r\n puts \"#{name}, his stats are #{player_data}\"\r\n \r\n end \r\n end \r\n end \r\nend", "title": "" }, { "docid": "d5572c3fbb9fd2e05754e9007957ca87", "score": "0.55189204", "text": "def hash_block(data)\n \n end", "title": "" }, { "docid": "1812e9f328464fb2c94403594c131137", "score": "0.55172306", "text": "def iterate_through_hash\n summer_olympics = {\n :Sydney => \"2000\",\n :Athens => \"2004\",\n :Beijing => \"2008\",\n :London => \"2012\"\n }\n summer_olympics[:Atlanta] = \"1996\"\n\n summer_olympics.each do |place, year|\n puts \"The #{place} summer olympics took place in #{year}.\"\n end\n # Implement this method so that it iterates over the hash created in add_a_key_value_pair\nputs summer_olympics # and puts each key value pair within the phrase \"The _____ summer olympics took place in _____.\"\nend", "title": "" }, { "docid": "73a5ae49a6f3ecdef94b9f886b60146f", "score": "0.5517201", "text": "def game_hash\nhash = {\n :home => {\n :team_name =>\"Brooklyn Nets\",\n :colors => [ \"Black\", \"White\"],\n :players => { \"Alan Anderson\" =>\n {\n :number =>0,\n :shoe =>16,\n :points =>22,\n :rebounds =>12,\n :assists=>12,\n :steals=>3,\n :blocks=>1,\n :slam_dunks=>1},\n \"Reggie Evans\"=>{\n :number =>30,\n :shoe =>14,\n :points =>12,\n :rebounds =>12,\n :assists=>12,\n :steals=>12,\n :blocks=>12,\n :slam_dunks=>7},\n \"Brook Lopez\"=>{\n :number =>11,\n :shoe =>17,\n :points =>17,\n :rebounds =>19,\n :assists=>10,\n :steals=>3,\n :blocks=>1,\n :slam_dunks=>15},\n \"Jason Terry\"=>{\n :number =>31,\n :shoe =>15,\n :points =>19,\n :rebounds =>2,\n :assists=>2,\n :steals=>4,\n :blocks=>11,\n :slam_dunks=>1},\n \"Mason Plumlee\"=>{:number =>1,\n :shoe =>19,\n :points =>26,\n :rebounds =>12,\n :assists=>6,\n :steals=>3,\n :blocks=>8,\n :slam_dunks=>5 }\n }\n },\n :away => {\n :team_name => \"Charlotte Hornets\",\n :colors => [\"Turquoise\", \"Purple\"],\n :players => {\n \"Jeff Adrien\"=> {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists=>1,\n :steals=> 2,\n :blocks=>7,\n :slam_dunks=>2 },\n \"Bismak Biyombo\"=>{\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds =>4,\n :assists=>7,\n :steals=>7,\n :blocks=>15,\n :slam_dunks=>10},\n \"DeSagna Diop\"=>{\n :number =>2,\n :shoe => 14,\n :points =>24,\n :rebounds =>12,\n :assists=>12,\n :steals=>4,\n :blocks=>5,\n :slam_dunks=>5},\n \"Ben Gordon\" =>{\n :number =>8,\n :shoe =>15,\n :points =>33,\n :rebounds =>3,\n :assists=>2,\n :steals=>1,\n :blocks=>1,\n :slam_dunks=>0},\n \"Brendan Haywood\" =>{\n :number =>33,\n :shoe =>15,\n :points =>6,\n :rebounds =>12,\n :assists=>12,\n :steals=>22,\n :blocks=>5,\n :slam_dunks=>12}\n}\n }\n}\nend", "title": "" }, { "docid": "d48b1ea0269eff7cc102f883d67eb84e", "score": "0.5499341", "text": "def team_colors(x) # much shorter and improved\n game_hash.each do |location, info| # itterate through the hash to get the info\n if info[:team_name] == x # if our argument is == to the team name then we use that block\n return info[:colors] # using that block we return the colors\n end\n end\nend", "title": "" }, { "docid": "4b050ae46cec2a37c6d9e58c78bba693", "score": "0.54801524", "text": "def each_choice_in_map\n @ballot_style_map.each do\n |precinct_code, precinct_map |\n contest_list = precinct_map[:coords]\n contest_list.each do \n |contest|\n contest_name = contest[:contest]\n contest[:choices].each do\n |addr, choicename|\n yield contest_name, choicename\n end\n end\n end\n end", "title": "" }, { "docid": "b26808345e58543ab4e3045c02c9153b", "score": "0.54760575", "text": "def player_stats(player_name)\n game_hash.each{|home_or_away,team_properties|\n game_hash[home_or_away][:players].each{|player|\n #binding.pry\n if player[:player_name] === player_name\n return player\n end\n}\n}\nend", "title": "" }, { "docid": "feabf2f81c24b65161ae37c2c6545a4d", "score": "0.54703647", "text": "def each\n \n end", "title": "" }, { "docid": "580d76c7445a448b390878649dd88d09", "score": "0.54696137", "text": "def each_pair; end", "title": "" }, { "docid": "580d76c7445a448b390878649dd88d09", "score": "0.54696137", "text": "def each_pair; end", "title": "" }, { "docid": "580d76c7445a448b390878649dd88d09", "score": "0.54696137", "text": "def each_pair; end", "title": "" }, { "docid": "580d76c7445a448b390878649dd88d09", "score": "0.54696137", "text": "def each_pair; end", "title": "" }, { "docid": "580d76c7445a448b390878649dd88d09", "score": "0.54696137", "text": "def each_pair; end", "title": "" }, { "docid": "58c8773f4f554ea4fb0008f04d3595d4", "score": "0.5465815", "text": "def player_numbers (team_name_parameter)\n \n player_numbers_array = []\n \n game_hash.each do |side, data|\n \n if data[:team_name] == team_name_parameter\n\n data.each do |players, stats|\n if players == :players\n \n stats.each do |player_number, stat_list|\n \n stat_list.each do |specific_stat, specific_stat_value|\n \n if specific_stat == :number\n # binding.pry\n player_numbers_array << specific_stat_value\n end\n end \n end \n end #end if \n end #end data.each\n end\n end #end game_hash each \n player_numbers_array\nend", "title": "" }, { "docid": "eec9376688891da71de5ad63119f9c12", "score": "0.54610074", "text": "def show_vertical(my_hash)\n my_hash.each do |cohort, students|\n puts \"#{cohort}: #{students} people \\n\"\n end\nend", "title": "" }, { "docid": "60e7ab995b9d3f4134a1f07e3161b62e", "score": "0.5451165", "text": "def game_hash\n\n\n game_hash = {\n\n\n :home => {\n\n\n :team_name => 'Brooklyn Nets',\n :colors => ['black', 'white'],\n :players => [\n {player_name: 'Alan Anderson', number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, blocks: 1, slam_dunks: 1},\n {player_name: 'Reggie Evans', number: 30, shoe: 14, points: 12, rebounds: 12, assists: 12, steals: 12, blocks: 12, slam_dunks: 7},\n {player_name: 'Brook Lopez', number: 11, shoe: 17, points: 17, rebounds: 19, assists: 10, steals: 3, blocks: 1, slam_dunks: 15},\n {player_name: 'Mason Plumlee', number: 1, shoe: 19, points: 26, rebounds: 12, assists: 6, steals: 3, blocks: 8, slam_dunks: 5},\n {player_name: 'Jason Terry', number: 31, shoe: 15, points: 19, rebounds: 2, assists: 2, steals: 4, blocks: 11, slam_dunks: 1}\n ]\n },\n :away => {\n :team_name => 'Charlotte Hornets',\n :colors => ['turquoise', 'purple'],\n :players => [\n {player_name: 'Jeff Adrien', number: 4, shoe: 18, points: 10, rebounds: 1, assists: 1, steals: 2, blocks: 7, slam_dunks: 2},\n {player_name: 'Bismak Biyombo', number: 0, shoe: 16, points: 12, rebounds: 4, assists: 7, steals: 7, blocks: 15, slam_dunks: 10},\n {player_name: 'DeSagna Diop', number: 2, shoe: 14, points: 24, rebounds: 12, assists: 12, steals: 4, blocks: 5, slam_dunks: 5},\n {player_name: 'Ben Gordon', number: 8, shoe: 15, points: 33, rebounds: 3, assists: 2, steals: 1, blocks: 1, slam_dunks: 0},\n {player_name: 'Brendan Haywood', number: 33, shoe: 15, points: 6, rebounds: 12, assists: 12, steals: 22, blocks: 5, slam_dunks: 12}\n ]\n }\n }\nend", "title": "" }, { "docid": "45a50483db573353b05d56ef2e8b44b1", "score": "0.5450224", "text": "def team_names\n team_names = []\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute == :team_name\n team_names << data\n end\n end\n end\n team_names\nend", "title": "" }, { "docid": "8f80a6ef60e5594fea31b48ab7800d9c", "score": "0.54470307", "text": "def multiple_loop_variables\n weapons = {\n 'rifle' => {\n 'heavy' => 'fn fal',\n 'medium' => 'm16',\n 'light' => 'm4',\n }\n }\n\n def iterate_rifle_name(weapons:)\n weapons.each do |cate, sub_cates|\n sub_cates.each do |sub_cate, rifle_name|\n puts rifle_name\n end\n end\n end\n\n iterate_rifle_name(weapons: weapons)\n\nend", "title": "" }, { "docid": "d0fdfee23ad62b0276d711fbde481549", "score": "0.54415673", "text": "def winning_team\n home_team = 0\n away_team = 0\n\n game_hash.each do |location, team_data|\n #sum home team points\n if location == :home\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do |name, stats|\n home_team += stats[:points]\n end\n end\n end\n end\n end\n #sum away team points\n if location == :away\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do |name, stats|\n away_team += stats[:points]\n end\n end\n end\n end\n end\n end\n\n if home_team > away_team\n return game_hash[:home][:team_name]\n else\n return game_hash[:away][:team_name]\n end\n\nend", "title": "" }, { "docid": "d86ff21cf35b6092c2754e2ef862db80", "score": "0.5438509", "text": "def \n \n game_hash\n {\n\n\n home: \n {\n\n team_name: \"Brooklyn Nets\",\n colors: [ \"Black\", \"White\" ],\n players: \n [\n\n {\n player_name: \"Alan Anderson\",\n number: 0,\n shoe: 16,\n points: 22,\n rebounds: 12,\n assists: 12,\n steals: 3,\n blocks: 1,\n slam_dunks: 1\n },\n {\n player_name: \"Reggie Evans\",\n number: 30,\n shoe: 14,\n points: 12,\n rebounds: 12,\n assists: 12,\n steals: 12,\n blocks: 12,\n slam_dunks: 7\n },\n {\n player_name: \"Brook Lopez\",\n number: 11,\n shoe: 17,\n points: 17,\n rebounds: 19,\n assists: 10,\n steals: 3,\n blocks: 1,\n slam_dunks: 15\n },\n {\n player_name: \"Mason Plumlee\",\n number: 1,\n shoe: 19,\n points: 26,\n rebounds: 11,\n assists: 6,\n steals: 3,\n blocks: 8,\n slam_dunks: 5\n },\n {\n player_name: \"Jason Terry\",\n number: 31,\n shoe: 15,\n points: 19,\n rebounds: 2,\n assists: 2,\n steals: 4,\n blocks: 11,\n slam_dunks: 1\n }\n\n ]\n\n },\n\n\n away: \n {\n\n team_name: \"Charlotte Hornets\",\n colors: [ \"Turquoise\", \"Purple\" ],\n players: \n [\n\n {\n player_name: \"Jeff Adrien\",\n number: 4,\n shoe: 18,\n points: 10,\n rebounds: 1,\n assists: 1,\n steals: 2,\n blocks: 7,\n slam_dunks: 2\n },\n {\n player_name: \"Bismack Biyombo\",\n number: 0,\n shoe: 16,\n points: 12,\n rebounds: 4,\n assists: 7,\n steals: 22,\n blocks: 15,\n slam_dunks: 10\n },\n {\n player_name: \"DeSagna Diop\",\n number: 2,\n shoe: 14,\n points: 24,\n rebounds: 12,\n assists: 12,\n steals: 4,\n blocks: 5,\n slam_dunks: 5\n },\n {\n player_name: \"Ben Gordon\",\n number: 8,\n shoe: 15,\n points: 33,\n rebounds: 3,\n assists: 2,\n steals: 1,\n blocks: 1,\n slam_dunks: 0\n },\n {\n player_name: \"Kemba Walker\",\n number: 33,\n shoe: 15,\n points: 6,\n rebounds: 12,\n assists: 12,\n steals: 7,\n blocks: 5,\n slam_dunks: 12\n }\n\n ]\n\n }\n\n\n }\nend", "title": "" }, { "docid": "b548c0d641da320d593a448820ec7f12", "score": "0.5437575", "text": "def display_hash(students)\n students.each do |cohort, number|\n puts \"#{cohort}: #{number}\"\n end\nend", "title": "" }, { "docid": "05b582c8b768fb5c453c10cda016c6ca", "score": "0.5437183", "text": "def each_hash(&blk)\r\n each_result false, &blk\r\n end", "title": "" }, { "docid": "0ca0ba06e2bd899d523552c7e5e4051c", "score": "0.54370844", "text": "def display_all(bakery)\n bakery.each do |key, value|\n key.each do |key, value|\n puts key.price\n puts key.description\n end\n end\nend", "title": "" }, { "docid": "9f68ff3a915e187e2cb8df1f69f8f170", "score": "0.54366744", "text": "def team_info(player_name='')\n players_and_stats = []\n all_stats_array=[]\n game_hash.each do |team, team_details|\n yield team_details if block_given? # This will yield team_details hash for calling methods that need team info.\n if team_details.is_a?(Hash)\n team_details.each do |team_identifier_name, team_identifier_value|\n if team_identifier_value.is_a?(Hash)\n team_identifier_value.each do |stats_name,stats_value|\n players_and_stats << [stats_name,stats_value]\n end\n end\n end\n end\n end\n\n\n if player_name.empty?\n players_and_stats.each_with_index do |ele, i|\n all_stats_array << players_and_stats[i][1] #This will return an array of hashes of all players\n end\n return all_stats_array\n else\n players_and_stats.each_with_index do |ele|\n return ele.last if ele.first == player_name ##this will return a hash of statistics for a given player\n end\n\n end\n\nend", "title": "" }, { "docid": "704fb2c22a8538bab759b4069ebf5bfa", "score": "0.5432482", "text": "def _each\n end", "title": "" }, { "docid": "ca85d8c1690499532fb1726b40e68d2c", "score": "0.54236805", "text": "def game_hash\ngame_hash = {\n :home => { \n :team_name => \"Brooklyn Nets\",\n :colors => [\"Black\",\"White\"],\n :players => { \n \"Alan Anderson\" => {\n :number => 0,\n :shoe => 16,\n :points => 22,\n :rebounds => 12,\n :assists => 12,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 1\n },\n \"Reggie Evans\" => {\n :number => 30,\n :shoe => 14,\n :points => 12,\n :rebounds => 12,\n :assists => 12,\n :steals => 12,\n :blocks => 12,\n :slam_dunks => 7\n },\n \"Brook Lopez\" => {\n :number => 11,\n :shoe => 17,\n :points => 17,\n :rebounds => 19,\n :assists => 10,\n :steals => 3,\n :blocks => 1,\n :slam_dunks => 15\n },\n \"Mason Plumlee\" => {\n :number => 1,\n :shoe => 19,\n :points => 26,\n :rebounds => 12,\n :assists => 6,\n :steals => 3,\n :blocks => 8,\n :slam_dunks => 5\n }, \n \"Jason Terry\" => {\n :number => 31,\n :shoe => 15,\n :points => 19,\n :rebounds => 2,\n :assists => 2,\n :steals => 4,\n :blocks => 11,\n :slam_dunks => 1\n }\n } \n },\n:away => { \n:team_name => \"Charlotte Hornets\",\n:colors => [\"Turquoise\",\"Purple\"],\n:players => { \n \"Jeff Adrien\" => {\n :number => 4,\n :shoe => 18,\n :points => 10,\n :rebounds => 1,\n :assists => 1,\n :steals => 2,\n :blocks => 7,\n :slam_dunks => 2\n },\n \"Bismak Biyombo\" => {\n :number => 0,\n :shoe => 16,\n :points => 12,\n :rebounds => 4,\n :assists => 7,\n :steals => 7,\n :blocks => 15,\n :slam_dunks => 10\n },\n \"DeSagna Diop\" => {\n :number => 2,\n :shoe => 14,\n :points => 24,\n :rebounds => 12,\n :assists => 12,\n :steals => 4,\n :blocks => 5,\n :slam_dunks => 5\n },\n \"Ben Gordon\" => {\n :number => 8,\n :shoe => 15,\n :points => 33,\n :rebounds => 3,\n :assists => 2,\n :steals => 1,\n :blocks => 1,\n :slam_dunks => 0\n }, \n \"Brendan Haywood\" => {\n :number => 33,\n :shoe => 15,\n :points => 6,\n :rebounds => 12,\n :assists => 12,\n :steals => 22,\n :blocks => 5,\n :slam_dunks => 12\n }\n }\n } \n}\ngame_hash\nend", "title": "" }, { "docid": "0efce91e3655813d1b00d1e2542cebfe", "score": "0.5422719", "text": "def team_colors(name_of_team)\ncolors = nil\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if data == name_of_team\n colors = game_hash[location][:colors]\n end\n end\n end\ncolors\nend", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54224354", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" }, { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.54217136", "text": "def each; end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "416a611d5ca07fb6a4d558550c826848", "score": "0.0", "text": "def set_user\n @user = ::User.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": "" } ]
cf25cf4b40737a9654ec807f453e7f05
human readable description of modeling approach
[ { "docid": "f3668ce1a922f36219e3f2058731a19c", "score": "0.0", "text": "def modeler_description\n return 'Adds either: (1) hot water boiler and electric chiller with variable-speed pumps to two plant loops, along with coil heating/cooling water objects on zone hvac four pipe fan coil objects, or (2) an electric chiller with variable-speed pump to a single plant loop, along with coil cooling water objects on cooling-only zone hvac four pipe fan coil objects.'\n end", "title": "" } ]
[ { "docid": "400f38055c710e3f9ca3606b0d0e6dcf", "score": "0.7710149", "text": "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end", "title": "" }, { "docid": "7f312e0afd1fe5a95907a214078a6c88", "score": "0.76145315", "text": "def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end", "title": "" }, { "docid": "73a921b8d8984ae4463926863b08a924", "score": "0.75934714", "text": "def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end", "title": "" }, { "docid": "9c6727eeee2b2afddef3c4d17c5cbf78", "score": "0.74018747", "text": "def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end", "title": "" }, { "docid": "f01122d07f09801609d94efaae23b0a0", "score": "0.7299891", "text": "def modeler_description\n return 'This model replaces the existing HVAC system with a VRF + DOAS system.'\n end", "title": "" }, { "docid": "522b5394fa9d953fced8ea8f73277958", "score": "0.7296635", "text": "def modeler_description\n return \"This uses the OpenStudio::Model::Space::fromFloorPrint method, and is very much like the Create Spaaces From Diagram tool in the OpenStudio SketchUp plugin, but lets you draw teh diagram in the tool of your choice, and then imports it into the OpenStudio application via a measure.\"\n end", "title": "" }, { "docid": "b99429c015cc16881a7c502543f9e0c7", "score": "0.727943", "text": "def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end", "title": "" }, { "docid": "7246591cf999dd41ac536bf016938964", "score": "0.71912926", "text": "def modeler_description\r\n return \"objective function\"\r\n end", "title": "" }, { "docid": "7246591cf999dd41ac536bf016938964", "score": "0.71912926", "text": "def modeler_description\r\n return \"objective function\"\r\n end", "title": "" }, { "docid": "4e7eacaa68bc136fe9720a77ef514528", "score": "0.7191264", "text": "def modeler_description\n return \"Any generators and electric load center distribution objects are removed. An electric load center distribution object is added with a track schedule equal to the hourly output from SAM. A micro turbine generator object is add to the electric load center distribution object. The fuel used to make the electricity is zeroed out.\"\n end", "title": "" }, { "docid": "68dcc35edf967c3065cfe48648de572b", "score": "0.7100944", "text": "def modeler_description\r\n return \"For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.\"\r\n end", "title": "" }, { "docid": "ed14dc56ce9c6f70441f22a15783feea", "score": "0.70977926", "text": "def modeler_description\n return 'Modify the cooling setpoint of the HVAC system during a DR event'\n end", "title": "" }, { "docid": "bee1422cd8c90ea57c4c46b94850cbb0", "score": "0.70629936", "text": "def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end", "title": "" }, { "docid": "c5bfca5957e2b8f7092e1a2a3ff349d3", "score": "0.7045383", "text": "def modeler_description\n return \"When have existing OSM wanted to be able to grab geometry from model vs. trying to enter on website. This is useful when there is no built structures yet to use as reference on the website.\"\n end", "title": "" }, { "docid": "69fd9c0e8fd602c3475b22c26dd636c2", "score": "0.7044268", "text": "def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end", "title": "" }, { "docid": "a603dec3777ad9e8b21cef3ff4238520", "score": "0.70413125", "text": "def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end", "title": "" }, { "docid": "2af92d183df29404811fd714bb59e1a4", "score": "0.7040473", "text": "def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end", "title": "" }, { "docid": "5c2c7c69cd9f02edf29ebf22a35bb15d", "score": "0.7032938", "text": "def description()\n\t\tself.namespaced_class(:ModelDescriptor).goal(self)\n\tend", "title": "" }, { "docid": "bec8b5f3d986778620c8c8140f942a18", "score": "0.70267737", "text": "def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end", "title": "" }, { "docid": "8daf1fc01a3aaf7bcc47d548a06eac79", "score": "0.70182866", "text": "def modeler_description\n return 'Not sure how I will handle arguments. Maybe lump together all spaces on same sotry that have the same multilier value. This will have variable number of arguments basd on the model pased in. Alternative is to either only allo w one group to be chosen at at time, or allow a comlex string that describes everything. Also need to see how to define shirting. There is an offset but it may be above and below and may not be equal. In Some cases a mid floor is halfway betwen floors which makes just copying the base surfaces as shading multiple times probemeatic, since there is overlap. It coudl be nice to stretch one surface over many stories. If I check for vertial adn orthogonal surface that may work fine. '\n end", "title": "" }, { "docid": "8fc80dc70bd5dd6a922dc429d65b147b", "score": "0.69875926", "text": "def modeler_description\n return \"It does not even send anything related to the model. It just sends a simple pagkage at the end of every run, just to test if things really work.\"\n end", "title": "" }, { "docid": "acdb7236d2be1aaddf3cbea12a6a6d1f", "score": "0.6980763", "text": "def modeler_description\n return ['Adds', 'the', 'properties', 'for', 'the', 'MoisturePenetrationDepthConductionTransferFunction', 'or', 'effective', 'moisture', 'penetration', 'depth', '(EMPD)', 'Heat', 'Balance', 'Model', 'with', 'inputs', 'for', 'penetration', 'depths.', \"\\n\\n\", 'Leaving', 'Change', 'heat', 'balance', 'algorithm?', 'blank', 'will', 'use', 'the', 'current', 'OpenStudio', 'heat', 'balance', 'algorithm', 'setting.', \"\\n\\n\", 'At', 'least', '1', 'interior', 'material', 'needs', 'to', 'have', 'moisture', 'penetration', 'depth', 'properties', 'set', 'to', 'use', 'the', 'EMPD', 'heat', 'balance', 'algorithm.'].join(' ')\n end", "title": "" }, { "docid": "bfda812b698673676665236711cd9643", "score": "0.69496983", "text": "def modeler_description\n return \"Change water heater efficiency and fuel type.\"\n end", "title": "" }, { "docid": "9b9ba7d80185da951e8615d71111f073", "score": "0.69420075", "text": "def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end", "title": "" }, { "docid": "d5c16aaf2f5bfc6e4acbb31c2a852346", "score": "0.6936087", "text": "def modeler_description\n return 'For each model, find every DX cooling and heating coil and increase the COP to 6. Since very little information about this technology is available, do not change performance curves or upper/lower operating temperature limits.'\n end", "title": "" }, { "docid": "f7ddc2443ea08a8d1d38fe620c299547", "score": "0.6927004", "text": "def modeler_description\n return \"This measure will replicate the functionality described in the EnergyPlus Energy Management System Application Guide, Example 2., based on user input.\"\n end", "title": "" }, { "docid": "b7682ae0ad9cfe97eab7e76768b79899", "score": "0.6908837", "text": "def modeler_description\n return 'This measure assigns load and flow information to a selected plant loop load profile.'\n end", "title": "" }, { "docid": "0080d1426a2bfa302a931a7a8941e201", "score": "0.6901907", "text": "def modeler_description\n return \"This is intended to run on an empty model. It will create the proper model associate it with the proper weather file, and add in necessary output requests. Internally to the measure the test case argument will be mapped to the proper inputs needed to assemble the model. The measure will make some objects on the fly, other objects will be pulled from existing data resources. This measure creates cases described all of section 5.3.\"\n end", "title": "" }, { "docid": "ccf523ba8f665b7a5372c58723d97ecc", "score": "0.6893215", "text": "def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end", "title": "" }, { "docid": "3e09cb04332f28f842898a8f9061fef5", "score": "0.6888214", "text": "def modeler_description\n 'For the most part consumption data comes from the tabular EnergyPlus results, however there are a few requests added for time series results. Space type and loop details come from the OpenStudio model. The code for this is modular, making it easy to use as a template for your own custom reports. The structure of the report uses bootstrap, and the graphs use dimple js.'\n end", "title": "" }, { "docid": "b30784936dec662fc4eed14fb95c1827", "score": "0.68663764", "text": "def modeler_description\n return 'Adds typical refrigeration equipment to a building'\n end", "title": "" }, { "docid": "fdd241b79e2090d136330499e773b438", "score": "0.6865241", "text": "def modeler_description\r\n return \"\"\r\n end", "title": "" }, { "docid": "62ec89d63405f5f793f2a04ccb2db899", "score": "0.68641704", "text": "def modeler_description\n return \"E+ RESNET\"\n end", "title": "" }, { "docid": "11ba029aac23f629b4d6d19d9f7aac73", "score": "0.68588334", "text": "def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as warning messages in the measure's output on the PAT run tab.\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "5b19a7efb17fa8b2806ecd0d2ed79e58", "score": "0.6852012", "text": "def modeler_description\n return \"\"\n end", "title": "" }, { "docid": "a2a9e4bf2782b2ed75b2e6d012881153", "score": "0.6833133", "text": "def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end", "title": "" }, { "docid": "068349f87aff63ba1c5e63a2756b9da1", "score": "0.68219167", "text": "def modeler_description\n return \"Reads the model and sql file to pull out the necessary information and run the model checks. The check results show up as Warning messages in the measure's output on the PAT run tab.\"\n end", "title": "" }, { "docid": "79e8ac0833508634d043f71077d1a8ff", "score": "0.68055475", "text": "def modeler_description\n return 'The goal of this measure is to create a single space type that represents the loads and schedules of a collection of space types in a model. When possible the measure will create mulitple load instances of a specific type in the resulting blended space type. This allows the original schedules to be used, and can allow for down stream EE measures on specific internal loads. Design Ventilation Outdoor Air objects will have to be merged into a single object. Will try to maintain the load design type (power, per area, per person) when possible. Need to account for zone multipliers when createding blended internal loads. Also address what happens to daylighting control objets. Original space types will be left in the model, some may still be assigned to spaces not included in the building area.'\n end", "title": "" }, { "docid": "4918dc4b2374675a58bc31fde2d28895", "score": "0.6791062", "text": "def modeler_description\n 'It will be used for calibration maximum flow rate, efficiency, pressure rise and motor efficiency. User can choose between a SINGLE Fan or ALL the Fans.'\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "a42c5217877c7d6f2b877545976f4891", "score": "0.67879057", "text": "def modeler_description\n return ''\n end", "title": "" }, { "docid": "f7d67a6e86175d5af88be163cf4c1c58", "score": "0.67796487", "text": "def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end", "title": "" }, { "docid": "c6f1555d243ae8086cc6c897ce571ade", "score": "0.6773994", "text": "def modeler_description\n 'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'\n end", "title": "" }, { "docid": "88a89d1fd265368c9b9f2cb13e85df3f", "score": "0.6751447", "text": "def modeler_description\n return \"It will be used for calibration of inlet water temperatures, inlet and outlet air temperatures and design flowrates. User can choose between a SINGLE coil or ALL the Coils.\"\n end", "title": "" }, { "docid": "d0f49418f483eb1495f71385dd5d89cc", "score": "0.67244256", "text": "def modeler_description\n return 'Find the exterior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high). Find the desing level and multiplier for each category of the exterior lighting definition. Apply the lighting upgrades by reducing the design level associated with each outdoor lighting category by a percent (depends on starting and target efficiency levels).'\n end", "title": "" }, { "docid": "3912e31349c1a22ecded225c6fa9f556", "score": "0.6720888", "text": "def modeler_description\n return 'Change UrbanOpt Scenario CSV'\n end", "title": "" }, { "docid": "ce6393816e6e49119c91bd5f60f2d849", "score": "0.6716974", "text": "def modeler_description\n return 'Calculate thermal capacitance and UA for surfaces, furniture, and spaces.'\n end", "title": "" }, { "docid": "0ebc7a0473f975ac96047a8523aa589a", "score": "0.6708703", "text": "def modeler_description\n return 'Reports resilience metric(s) of interest.'\n end", "title": "" }, { "docid": "35a95612914914d3b76dbd84359e9f26", "score": "0.67021894", "text": "def modeler_description\n return \"The default space types in the measure inputs are automatically filled by the spaces' standard space types. User can overwrite the default assumptions in the library.csv file in the measure's resources folder.\"\n end", "title": "" }, { "docid": "ffeae427b57d61e407a789378fcf408f", "score": "0.668961", "text": "def modeler_description\n return 'Find the interior lighting template for the building, and assume the existing efficiency level in the model (low, medium, high, very high). Find the LPD and LPD fractions for each space type. Apply the lighting upgrades by reducing the LPD associated with compact lighting by a percent (depends on starting and target efficiency levels).'\n end", "title": "" }, { "docid": "ceabb8304af0e3980294f4a7d9d40af5", "score": "0.66878057", "text": "def modeler_description\n 'Run a simulation to autosize HVAC equipment and then apply these autosized values back to the model.'\n end", "title": "" }, { "docid": "df3d92b7417067915b5e3d085fd2aced", "score": "0.6672712", "text": "def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end", "title": "" }, { "docid": "5a5ec0f0a9197a86ad937e538e14436d", "score": "0.6662903", "text": "def modeler_description\n return 'This method calculates the annualized coefficient of performance (Btu out / Btu in) of equipment in the model from the annual simulation. This is used in Scout as the equipment efficiency for the technology competition categories.'\n end", "title": "" }, { "docid": "0db993c9034a72a5d046523d20dd6277", "score": "0.6649447", "text": "def modeler_description\n return 'This will only impact schedule rulesets. It will use methods in openstudio-standards to infer hours of operation, develop a parametric formula for all of the ruleset schedules, alter the hours of operation inputs to that formula and then re-apply the schedules. Input is expose to set ramp frequency of the resulting schedules. If inputs are such that no changes are requested, bypass the measure with NA so that it will not be parameterized. An advanced option for this measure would be bool to use hours of operation from OSM schedule ruleset hours of operation instead of inferring from standards. This should allow different parts of the building to have different hours of operation in the seed model.'\n end", "title": "" }, { "docid": "8d354ea87ad757507969d2ea283a16ab", "score": "0.6643762", "text": "def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end", "title": "" }, { "docid": "f9424221c5ee8eb22272cfdba341aba5", "score": "0.6634445", "text": "def modeler_description\n return \"Any supply components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. Any existing air/plant loops are also removed. A heating DX coil, cooling DX coil, electric supplemental heating coil, and an on/off supply fan are added to a unitary air loop. The unitary air loop is added to the supply inlet node of the air loop. This air loop is added to a branch for the living zone. A diffuser is added to the branch for the living zone as well as for the finished basement if it exists.\"\n end", "title": "" }, { "docid": "e31065e3431a2e39927fb8a296502276", "score": "0.66330194", "text": "def modeler_description\r\n return 'modify simulation timestep'\r\n end", "title": "" }, { "docid": "96fa7357e811f4fb78a49c8c0ec7ac90", "score": "0.662195", "text": "def modeler_description\n return 'Will add the necessary UtilityCost objects and associated schedule into the model.'\n end", "title": "" }, { "docid": "df2f64a684f18d001fc34d61fc1bc5f1", "score": "0.6616422", "text": "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "title": "" }, { "docid": "df2f64a684f18d001fc34d61fc1bc5f1", "score": "0.6616422", "text": "def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end", "title": "" }, { "docid": "8da79fd24ed7ea32498c5ed5f7c0ae40", "score": "0.66100585", "text": "def modeler_description\n return 'Passes in all arguments from the options lookup, processes them, and then registers values to the runner to be used by other measures.'\n end", "title": "" }, { "docid": "218d029bf02d38437978f228c30a7070", "score": "0.659982", "text": "def modeler_description\n return 'Daylighting controls will physically add in daylighting controls to spaces in the building, while occupancy control will reduce lighting schedules by 10%.'\n end", "title": "" }, { "docid": "37bdcf2b28b7d0afcb163db1290264f6", "score": "0.6589568", "text": "def modeler_description\n return 'This measure is used to calibrate the BRICR baseline model.'\n end", "title": "" }, { "docid": "ab3227eaf817672fb985b8ab00aea954", "score": "0.6588373", "text": "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end", "title": "" }, { "docid": "1b36d781efe626116d4f78c5e871d035", "score": "0.65865505", "text": "def modeler_description\n return \"This EEM adds EMS logic to the model that actuates the infiltration, HVAC operation, cooling set point, and heating set point schedules. The measure first identifies the schedule HVAC stopping point by day of week (Saturday, Sunday, and Weekdays). Early HVAC system shutoff is determined entirely by the outdoor air temperature (OAT). If the OAT is less than or equal to 2C or greater than or equal to 18C, then no action is taken. The HVAC system is shut off one hour early when the OAT is between 12C and 18C. The HVAC system shut off time varies linearly with OAT from one hour to zero hours between 12C and 2C, and between 18C and 28C. AvailabilityManager:OptimumStart objects are inserted for each HVAC system in the model and use the AdaptiveASHRAE algorithm to dynamically adjust HVAC startup time each day.\"\n end", "title": "" }, { "docid": "b1da8a1067b5014deeac0062a69fa209", "score": "0.6584234", "text": "def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end", "title": "" }, { "docid": "79fff487191030c1aac1e4918ec3204a", "score": "0.65638506", "text": "def modeler_description\n return \"This measure takes the user selected standards space type and sets the interior lighting and equipment load definitions subcategory to match the space type name. \"\n end", "title": "" }, { "docid": "0a5ce0daea86fe56be06da7e1297bc81", "score": "0.6560483", "text": "def modeler_description\n return 'Will add the necessary UtilityCost objects into the model.'\n end", "title": "" }, { "docid": "2acc9b9e1cb4f597ae22ad9990651eb0", "score": "0.6554784", "text": "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to override specified thermostat control logic and set alternate modes of operation. This EMS measure sets a specific (user defined) indoor VRF terminal unit to operate at a specific (user-defined) part load ratio, constrained by operate minimum and maximum outdoor temperature limits of the paired condenser unit. The main input objects that implement this example are the variable refrigerant flow actuators that control the VRF system and specific terminal unit. Note that the terminal unit PLR can be controlled without controlling the mode of the VRF condenser, however, the specific terminal unit will operate in whatever mode the existing operation control scheme chooses. This example program simply “sets” the operating mode and PLR, other more complex control algorithms can be developed by the user as needed\"\n end", "title": "" }, { "docid": "5faf67a03258c258845a9f93f8e14f85", "score": "0.65097153", "text": "def modeler_description\n return 'This measure swaps old cases with 2017 code compliant cases and more efficient ones.'\n end", "title": "" }, { "docid": "6ab21339ebb9fe4aa227f16f01668ac1", "score": "0.64903986", "text": "def modeler_description\n return \"The example demonstrates the use of a thermostat schedule object as and EMS actuator object. The EMS program alters the scheduled values as a function of hour of day and day of week.\"\n end", "title": "" }, { "docid": "8690dd258ff77e1a4dcdd03ff17a0e0c", "score": "0.64771026", "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": "9c6cadee09eccfd55beca56062be6a79", "score": "0.6466807", "text": "def modeler_description\n return \"The measure loops through the AirLoops associated with the model, and determines an occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent. The resulting occupancy schedule is applied to the airloop attribute for the availability schedule. The measure then loops through all thermal zones, examining if there are zone equipment objects attached. If there are one or more zone equipment object attached to the zone, a thermal zone occupancy weighted schedule with values of 1 or 0 based on the percent of peak occupancy at the timestep being above or below a set threshold value of 5 percent is generated. The schedule is then assigned to the availability schedule of the associated zone equipment. To prevent energy use by any corresponding plant loops, the pump control type attribute of Constant or Variable speed pump objects in the model are set to intermittent. The measure them adds heating and cooling unmet hours and Simplified ASHRAE Standard 55 warning reporting variable to each thermal zone. \"\n end", "title": "" }, { "docid": "a45ea088b9699915ad568190c06b5a1e", "score": "0.6462787", "text": "def modeler_description\r\n return \"This measure loops through the existing airloops, looking for loops that have a constant speed fan. (Note that if an object such as an AirloopHVAC:UnitarySystem is present in the model, that the measure will NOT identify that loop as either constant- or variable-speed, since the fan is located inside the UnitarySystem object.) The user can designate which constant-speed airloop they'd like to apply the measure to, or opt to apply the measure to all airloops. The measure then replaces the supply components on the airloop with an AirloopHVAC:UnitarySystem object. Any DX coils added to the UnitarySystem object are of the type CoilCoolingDXMultiSpeed / CoilHeatingDXMultiSpeed, with the number of stages set to either two or four, depending on user input. If the user opts for a gas furnace, an 80% efficient CoilHeatingGas object is added. Fan properties (pressure rise and total efficiency) are transferred automatically from the existing (but deleted) constant speed fan to the new variable-speed fan. Currently, this measure is only applicable to the Standalone Retail DOE Prototype building model, but it has been structured to facilitate expansion to other models with a minimum of effort.\"\r\n end", "title": "" }, { "docid": "fd506e6a6c05a9af318c1f5f82f3cee7", "score": "0.6450267", "text": "def modeler_description\n return \"The measure loops through the heating and cooling thermostat schedules associated each thermal zone. The existing heating and cooling schedules are cloned, and the all run period profiles are then modified by adding a +1.5 deg F shift to the all values of the cooling thermostat schedule and a -1.5 degree F shift to all values of the heating thermostat schedule. Design Day profiles are not modified. The modified thermostat schedules are then assigned to the thermal zone. For each Thermal Zone, ASHRAE 55 Thermal Comfort Warnings is also enabled. Zone Thermal Comfort ASHRAE 55 Adaptive Model 90% Acceptability Status output variables is also added to the model.\"\n end", "title": "" }, { "docid": "f3c404c28d04e68e99296a5c6f4c2cab", "score": "0.6443914", "text": "def modeler_description\r\n return \"The Measure adds a Schedule Availability Manager to the Selected Plant Loop\"\r\n end", "title": "" }, { "docid": "753c6e7d4eeb6d3249c281ad43d8d90b", "score": "0.64391804", "text": "def modeler_description\n return 'Converts the OpenStudio model to vA3C JSON format and renders using Three.js, simulation data is applied to surfaces of the model'\n end", "title": "" }, { "docid": "2c98130ced9db76a7b0efdaa8cea9bc5", "score": "0.6431919", "text": "def modeler_description\n return 'This energy efficiency measure (EEM) replaces all cooling tower objects in a model of the following types: (OS:CoolingTowerPerformanceCoolTools, OS:CoolingTowerPerformanceYorkCalc, OS:CoolingTowerSingleSpeed, OS:CoolingTowerTwoSpeed, or OS:CoolingTowerVariableSpeed) with a new OS:CoolingTower:VariableSpeed object. If an existing cooling tower is already configured for variable speed, the measure will inform the user. When replacing an existing tower object, the following values from the existing tower configuration will be reused: Design Inlet Air Wet Bulb Temp, Design Approach Temperature, Design Range Temperature, Design Water Flow Rate, Design Air Flow Rate, Design Fan Power, Fraction of Tower Capacity in the Free Convection Regime, Basin Heater Capacity, Basin Heater Setpoint Temperature, Basin Heater Operating Schedule, Number of Cells, Cell Control, Cell Minimum and Maximum Water Flow Rate Fractions and Sizing Factor. A performance curve relating fan power to tower airflow rates is used. The curve assumes the fan power ratio is directly proportional to the air flow rate ratio cubed. A Minimum Air Flow Rate Ratio of 20% will be set. To model minimal but realistic water consumption, the Evaporation Loss Mode for new Tower objects will be set to ?Saturated Exit? and Drift Loss Percent will be set to a value of 0.05% of the Design Water Flow. Blowdown water usage will be based on maintaining a Concentration Ratio of 3.0.'\n end", "title": "" }, { "docid": "e9fbfac1e1418479ae1de8d4843276a8", "score": "0.6429849", "text": "def make_and_model; end", "title": "" }, { "docid": "7fae81cdf619946747ec8a2fa9a1b20f", "score": "0.6426015", "text": "def modeler_description\n return 'Replaces exterior window constructions with a different construction from the model.'\n end", "title": "" }, { "docid": "8b8eb3b19c1823e6c56184ca8a3150cc", "score": "0.6422519", "text": "def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to investigate dynamic envelope technologies such as emulating thermochromic window performance using EMS actuators and control types. This measure will replace the construction description of a user-selected window based on the outside surface temperature of that window, evaluated at each timestep\"\n end", "title": "" }, { "docid": "496424f4db74d661522773544272d6c3", "score": "0.6421918", "text": "def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end", "title": "" }, { "docid": "72c2a2e51f3984ce3333544f17b83e8f", "score": "0.64181775", "text": "def modeler_description\n return \"This measure adds active or passive chilled beam units to selected conditioned thermal zones. In addition the user can select an existing air loop to serve active beams, or create a new Dual Wheel DOAS. Users can also select an existing chilled water loop to provide chilled water to beams, or create a new high temperature chiller water loop. Users are highly encouraged to review and modify the control strategies that this measure creates, such that it reflects their modeling scenario of interest.\"\n end", "title": "" }, { "docid": "d9c63fccfbb1758c93633611e9921896", "score": "0.6415888", "text": "def modeler_description\n return \"The difference between actual spaces and effective spaces takes into account the zone multipliers. The goal was to get average floor area assuming that each space represents a room vs. a collection of rooms. This was used to help determine average space sizes of different space types from the prototype buildings. In some cases I had to manaually adjust for where a space didn't map to a single room.\"\n end", "title": "" }, { "docid": "ab796a64b7d81b38294a9fb6e370e1e0", "score": "0.6409096", "text": "def modeler_description\n return \"Any heating components or baseboard convective electrics/waters are removed from any existing air/plant loops or zones. A boiler along with constant speed pump and water baseboard coils are added to a hot water plant loop.\"\n end", "title": "" }, { "docid": "9e22a72806f051c465374596ab87959f", "score": "0.64074343", "text": "def modeler_description\n return 'Thermal zones will be named after the spac with a prefix added'\n end", "title": "" }, { "docid": "65cc59cfefcfe68d1ae4432d7db406bb", "score": "0.64067763", "text": "def inspect\n \"#<#{self.class.name} @model=#{model.name} @relation_name=#{relation_name} @repository=#{self.class.repository}>\"\n end", "title": "" }, { "docid": "777dbd3fa2ffd83e472235953389b011", "score": "0.6405944", "text": "def inspect\n \"#<#{self.class.name} @model=#{model.inspect} @name=#{name.inspect}>\"\n end", "title": "" }, { "docid": "383f1d7b447f63ab24ae2774c5dce88d", "score": "0.64003026", "text": "def modeler_description\n return \"Reduces runtime fraction of lights by user-specified amount during the user-specified time period (typically daytime). This is an attempt to represent the impact of using the light collected on the roof instead of electric lighting. This modeling approach does not capture the impact of using a PV cell to turn the IR spectrum of the captured light into electricity.\"\n end", "title": "" }, { "docid": "bdccb63634d5175728472b8670b809cd", "score": "0.6370144", "text": "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "title": "" } ]
46aa8fbb5e9b767d9048f2949ed75a37
Show an upgrade alert to the user
[ { "docid": "d70baa36c9626d06eaea1befdbd6a936", "score": "0.0", "text": "def alert(title, text, more_info_url, culprits)\n if Config::CONFIG['host_os'].downcase =~ /mswin|windows|mingw/\n basic_alert(title, text, more_info_url, culprits)\n else\n color_alert(title, text, more_info_url, culprits)\n end\n end", "title": "" } ]
[ { "docid": "3ca1495da7e69032a3d642c7fd72f1b3", "score": "0.6473436", "text": "def user_upgrades_enabled?\n true\n end", "title": "" }, { "docid": "af89cf732fa42ae305c2ff8243aa84b1", "score": "0.63914096", "text": "def upgrade\n\t\t# todo: add if statement to confirmed if transaction is complete.\n\t\t# to do that, we need to pass some argv from upgrade_pay to upgrade\n\t\tredirect_to action: 'home'\n\tend", "title": "" }, { "docid": "9e80181c45e2100db2b921821311f3db", "score": "0.61693484", "text": "def confirm_change_upgrade_rule\n if alert_present?\n alert_accept\n Log.debug \"alert show up when add/change upgrade rules\"\n admin_password_input.set(QA_ENV['bus_password'])\n admin_password_confirm_btn.click\n end\n end", "title": "" }, { "docid": "c94c565a2a56e0de52edb36377760268", "score": "0.61292183", "text": "def click_upgrade\n get_upgrade_element.click if is_upgrade_present?\n end", "title": "" }, { "docid": "485219d0fb36e6a8d591b8b7a7c99088", "score": "0.60152096", "text": "def can_upgrade_by; 0; end", "title": "" }, { "docid": "099d11df1f8038b71e268fbb379fdc91", "score": "0.60063344", "text": "def send_upgrade_trial\n if !SETTINGS['saas_registration_mode']\n redirect_to root_path\n return\n end\n if params[:email].blank? || params[:password].blank? || params[:purchase_id].blank?\n redirect_to user_request_upgrade_trial_path, { flash: { alert: t('flash.upgrade_trial.missing_fields') } }\n return\n end\n user = User.active.confirmed.where(:email => params[:email]).first\n if !user || !user.trial? || !user.valid_password?(params[:password])\n redirect_to user_request_upgrade_trial_path, { flash: { alert: t('flash.upgrade_trial.wrong_login_or_not_trial') } }\n return\n end\n purchase = Purchase.find_by_token(params[:purchase_id])\n if !purchase || purchase.users.count >= purchase.accounts_number\n redirect_to user_request_upgrade_trial_path, { flash: { alert: t('flash.upgrade_trial.purchase_token_not_valid') } }\n return\n end\n user.purchase_id = purchase.id\n user.location_id = purchase.location_id if purchase.location && purchase.location.sti_type.downcase == LAST_LOCATION\n if !user.save\n redirect_to user_request_upgrade_trial_path, { flash: { alert: t('flash.upgrade_trial.generic_error') } }\n return\n end\n Notification.send_to(\n user.id,\n I18n.t('notifications.account.upgraded.title'),\n I18n.t('notifications.account.upgraded.message', :expiration_date => TimeConvert.to_string(purchase.expiration_date)),\n ''\n )\n end", "title": "" }, { "docid": "9c068f91389eee9a6fb976e75ac61059", "score": "0.5943235", "text": "def action_upgrade\n # Could be uninstalled or have no candidate\n if @current_resource.version.nil? || candidate_version.nil? \n super\n # Ensure the candidate is newer\n elsif RPMVersion.parse(candidate_version) > RPMVersion.parse(@current_resource.version)\n super\n else\n Chef::Log.debug(\"#{@new_resource} is at the latest version - nothing to do\")\n end\n end", "title": "" }, { "docid": "cc2634731f7938b33808810e01862013", "score": "0.59147614", "text": "def action_upgrade\n notifying_block do\n install_scl_utils\n install_scl_repo_package\n flush_yum_cache\n install_scl_package(:upgrade)\n install_scl_devel_package(:upgrade) if new_resource.dev_package\n end\n end", "title": "" }, { "docid": "1589771bfd647a3f1b992f8489e7f13c", "score": "0.59044105", "text": "def check_for_updated\n call_rake(\"packages:check_for_updates\")\n flash[:notice] = \"Checking for updates now\"\n redirect_to :back\n end", "title": "" }, { "docid": "eae781f3b4c9cbb06eb4493b9bd2723b", "score": "0.5901204", "text": "def alert; end", "title": "" }, { "docid": "eae781f3b4c9cbb06eb4493b9bd2723b", "score": "0.5901204", "text": "def alert; end", "title": "" }, { "docid": "f40f83761a4ea4c9c8b0e9d7d69aecd8", "score": "0.5889286", "text": "def messages\n version = params[:version]\n gem_version = Rails.application.config.versions[:gem]\n if Gem::Version.new(gem_version) > Gem::Version.new(version)\n render plain: \"Unipept gem #{gem_version} is released!. Run 'gem update unipept' to update.\"\n else\n render plain: ''\n end\n end", "title": "" }, { "docid": "8bb453925bd45ac11176ab14e579ab19", "score": "0.5882784", "text": "def show\n @upgrade = Upgrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @upgrade }\n end\n end", "title": "" }, { "docid": "34c52ae6bbeddf5a7dd1ba3b9b691e2b", "score": "0.58811706", "text": "def update\n respond_to do |format|\n if @upgrade.update(upgrade_params)\n format.html { redirect_to redirect_panel_path, notice: 'Upgrade was successfully updated.' }\n format.json { render :show, status: :ok, location: @upgrade }\n else\n format.html { render :edit }\n format.json { render json: @upgrade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0183e6659f00a35e3733ea4c51dc14b2", "score": "0.5861486", "text": "def displayWelcomeMessage\n Alert.show_popup \"Welcome XYZ to testing\"\n end", "title": "" }, { "docid": "2b33497a6cf03a1adda4258be87d9252", "score": "0.5857357", "text": "def system_notice\n flash.now[:alert] = \"The Virtual Microscopy system will be offline for scheduled maintenance on \n Friday, May 9 from approximately 1:00pm-1:45pm CDT.\"\n end", "title": "" }, { "docid": "ca511f94741eac650286dd8c80851b80", "score": "0.5856939", "text": "def check_update\n response = request(:get, '/devmgr/v2/upgrade')\n version_details = JSON.parse(response.body)\n installed_version = version_details['currentVersions'][0]['version']\n update_version = if !version_details['stagedVersions']\n version_details['stagedVersions'][0]['version']\n else\n installed_version\n end\n return true if installed_version != update_version\n end", "title": "" }, { "docid": "d660b09e672e622e3efd952541c91709", "score": "0.58490413", "text": "def status_change_alert\n end", "title": "" }, { "docid": "1b840b26af8e297d5a095cc8ff518482", "score": "0.58449376", "text": "def upgrade?\n self[:upgrade] == 1\n end", "title": "" }, { "docid": "072ccedc6ed7534a6618dd0bac426506", "score": "0.58393914", "text": "def display_server_downtime_message\n Rails.application.display('Server maintenance. Rently will be back in a bit!')\n end", "title": "" }, { "docid": "a6005f723834d7ce22b79dfa6b9fb488", "score": "0.5829416", "text": "def logged_upgrade_trial\n if !current_user.trial?\n redirect_to my_profile_path\n return\n end\n user = current_user\n purchase = Purchase.find_by_token(params[:purchase_id])\n if !purchase || purchase.users.count >= purchase.accounts_number\n @error = t('users.trial.errors.code_not_valid')\n render 'trial'\n return\n end\n user.purchase_id = purchase.id\n user.location_id = purchase.location_id if purchase.location && purchase.location.sti_type.downcase == LAST_LOCATION\n if !user.save\n @error = t('users.trial.errors.problem_saving')\n render 'trial'\n return\n end\n Notification.send_to(\n user.id,\n I18n.t('notifications.account.upgraded.title'),\n I18n.t('notifications.account.upgraded.message', :expiration_date => TimeConvert.to_string(purchase.expiration_date)),\n ''\n )\n redirect_to dashboard_path, { flash: { notice: t('users.trial.successful_upgrade') } }\n end", "title": "" }, { "docid": "10274e7f41997349e26cef8a0e821eac", "score": "0.5808112", "text": "def sample_menu_on_upgrade(plugin)\n end", "title": "" }, { "docid": "a60d65f3b308d3bf40f4fdec605e2580", "score": "0.5795381", "text": "def request_upgrade_trial\n if !SETTINGS['saas_registration_mode']\n redirect_to root_path\n return\n end\n end", "title": "" }, { "docid": "459d3c0e9d7743cdc9020addfab80ed5", "score": "0.57922685", "text": "def action_install\n notifying_block do\n # This will run an upgrade on the first install.\n install_archive\n end\n end", "title": "" }, { "docid": "9a78d68ee46a21b4900cc3d092ac21f5", "score": "0.57918084", "text": "def alert(message)\n @logger.warn(\"Deprecation: #{message}\")\n end", "title": "" }, { "docid": "bc6c76c987de79fea2f4ab7e697c763a", "score": "0.5790522", "text": "def ext_alert(title, message)\n call \"Ext.Msg.alert\", title, message\n end", "title": "" }, { "docid": "ee9268c5db32042e2b6c48870375638d", "score": "0.5782268", "text": "def flash_everything_up_to_date\n {\n text: \"Everything is up to date.\",\n type: \"success\"\n }\n end", "title": "" }, { "docid": "5f1cbafe5705af3a8d24ad1db0264415", "score": "0.5766381", "text": "def upgrade\n render :layout => nil\n end", "title": "" }, { "docid": "04d2a26833542fbc140b38c666cabfd0", "score": "0.5760247", "text": "def show_alert!\n if !self.show_welcome? and self.show_alert?\n self.update_attribute(:show_alert, false)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "04d2a26833542fbc140b38c666cabfd0", "score": "0.5760247", "text": "def show_alert!\n if !self.show_welcome? and self.show_alert?\n self.update_attribute(:show_alert, false)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "477da31341734b76f25b9602ed419967", "score": "0.57599944", "text": "def act_as_admin\n act_as_link.click\n alert_accept if alert_present?\n end", "title": "" }, { "docid": "6455cbe8d513d87ec28d6ba43bbcc984", "score": "0.5723729", "text": "def on_about\n # TODO: Make version dynamic somehow.\n msg = sprintf(\"Welcome to #{Environment.app_name}, version 0.1\")\n\n # create a simple message dialog with OK button\n about_dlg = Wx::MessageDialog.new( self, msg, \"About #{Environment.app_name}\",\n Wx::OK|Wx::ICON_INFORMATION )\n about_dlg.show_modal\n end", "title": "" }, { "docid": "3db6af23a222ec3fc817e2c1bf9317fb", "score": "0.57217044", "text": "def show_version_if_needed\n if @options[:show_version]\n show_version\n exit RETURN_OK\n end\n end", "title": "" }, { "docid": "c37b721de594050aee79aa871c390b87", "score": "0.57190436", "text": "def upgrade_eligibility\n return @upgrade_eligibility\n end", "title": "" }, { "docid": "7945127d8e9bf3f0e12047c1a7a08fb5", "score": "0.5672839", "text": "def email_alerts_send_on_update\n return true unless FedenaPlugin.can_access_plugin?('fedena_email_alert')\n if @alert_processor\n @alert_processor.send_alerts\n end\n end", "title": "" }, { "docid": "7c2bb5f2f2f70ac5bb2f57803d07bac4", "score": "0.5667566", "text": "def needs_alert?\n false\n end", "title": "" }, { "docid": "75d363fb16fef6e86a8a9e31c06cef57", "score": "0.56648767", "text": "def is_upgrade_present?\n get_upgrade_element.present?\n end", "title": "" }, { "docid": "bca7931c2e10d44629c1a2ce2b3d9e67", "score": "0.56629413", "text": "def alert(message)\n call 'alert', message\n end", "title": "" }, { "docid": "e8eb7c73e4b6f0ba09b3aea128f8b4fb", "score": "0.5658912", "text": "def my_plugin_on_upgrade(plugin)\n end", "title": "" }, { "docid": "af6c9557632fb4b07fe5dc200da94f94", "score": "0.56503713", "text": "def action_upgrade\n cmd = Mixlib::ShellOut.new \"#{new_resource.schematool_path} -dbType mysql \"\\\n \"-userName #{new_resource.dbadmin_username} -passWord #{new_resource.dbadmin_password} \"\\\n '-upgradeSchema'\n cmd.run_command\n\n if cmd.stdout =~ /Starting upgrade metastore schema from version.*\\nUpgrade script/\n new_resource.updated_by_last_action true\n elsif cmd.stdout =~ /No schema upgrade required from version.*/\n new_resource.updated_by_last_action false\n else\n error_details = cmd.format_for_exception.gsub(/passWord \\w+/, 'passWord <scrubbed>')\n raise UpgradeError, 'Unexpected error when running upgrade' + \"\\n\" + error_details\n end\n end", "title": "" }, { "docid": "11bf9f37805bd1126c702b795fb78040", "score": "0.56441474", "text": "def show\n @upgrade = Upgrade.find(params[:id])\n prepFormVariables\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @upgrade }\n end\n end", "title": "" }, { "docid": "2ac1fc912038385f58cbc5504ad4b7f6", "score": "0.56358427", "text": "def alert(message)\n call 'alert', message\n end", "title": "" }, { "docid": "542794fd606e14ba56ccd9861c6751ad", "score": "0.56349987", "text": "def action_upgrade\n converge_by 'Upgrading MSYS2 packages' do\n # The first time bash is run it sets up a bunch of user files and\n # support configs. Force this run before we do anything important.\n msys_shell_out!('exit')\n # Grab the latest definitions. Should this always run from action_install?\n msys_shell_out!(%w{pacman --sync --refresh --noconfirm})\n # Pass --sysupgrade twice to allow downgrades.\n msys_shell_out!(%w{pacman --sync --sysupgrade --sysupgrade --noconfirm})\n end\n end", "title": "" }, { "docid": "936086538432e8e4acd3120e329fc42a", "score": "0.5628145", "text": "def displayAlert\n Alert.show_popup(\"Displaying alert in callback\")\n end", "title": "" }, { "docid": "202af165d1ed1fa4ab14baccee755c88", "score": "0.56276", "text": "def update\n @upgrade = Upgrade.find(params[:id])\n\n respond_to do |format|\n if @upgrade.update_attributes(params[:upgrade])\n format.html { redirect_to(@upgrade, :notice => 'Upgrade was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @upgrade.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a40faa476772691d3f7379caa7971c9c", "score": "0.55839235", "text": "def auto_alert?\n return false\n end", "title": "" }, { "docid": "48a483ce1120d90dc20964ecb60354c0", "score": "0.55767804", "text": "def upgrade_frontend(name, hostname)\n ChatClient.log \"Upgrading <b>#{name}</b> (#{hostname})...\"\n command = 'sudo /opt/chef/bin/chef-client'\n log_path = aws_dir \"deploy-#{name}.log\"\n begin\n RakeUtils.system \"ssh -i ~/.ssh/deploy-id_rsa #{hostname} '#{command} 2>&1' >> #{log_path}\"\n ChatClient.log \"Upgraded <b>#{name}</b> (#{hostname}).\"\n true\n rescue RuntimeError\n ChatClient.log \"<b>#{name}</b> (#{hostname}) failed to upgrade.\", color: 'red'\n ChatClient.log \"/quote #{File.read(log_path)}\"\n false\n end\nend", "title": "" }, { "docid": "83e4b7ca28e7ba0ae85e83fb00aff97f", "score": "0.5571059", "text": "def alert(message)\n call \"alert\", message\n end", "title": "" }, { "docid": "202136e37e41b7476322dc4fbcce1540", "score": "0.55630255", "text": "def prompt_for_major_update\n print format(\n MAJOR_VERSION_UPDATE_WARNING_FMT,\n gem_name: @gem.name,\n installed_version: @gem.installed_version,\n newest_version: @gem.newest_version\n )\n if @options[:assume_yes_for_major_version_update]\n print \"assuming yes\\n\"\n else\n unless STDIN.gets.chomp.casecmp('y').zero?\n raise ::SystemExit.new(true, 'No update performed')\n end\n end\n end", "title": "" }, { "docid": "bcdab1e45ec80394606242c760b21bf6", "score": "0.5561894", "text": "def set_alert\n\n \tend", "title": "" }, { "docid": "68cab7e8c023cb56560cef273b9bc86e", "score": "0.5561071", "text": "def alert\n string_command \"getAlert\"\n end", "title": "" }, { "docid": "f5fe27bc4ef3c3e05d28c0e15ca30031", "score": "0.55543494", "text": "def cama_subscriber_on_upgrade(plugin)\n end", "title": "" }, { "docid": "329d8cf80a320ac9b3ed0424687a9116", "score": "0.55454326", "text": "def show\n flash[:notice] = \"Sorry, that page is not available.\"\n redirect_to alerts_path\n end", "title": "" }, { "docid": "d59c984bbcc85616ba13ffc1fa94ff5d", "score": "0.55427516", "text": "def alert\n UserMailer.alert\n end", "title": "" }, { "docid": "705e8db887ec8679aa07d52c0e03d583", "score": "0.5529298", "text": "def alert!\n self.priority = :alert\n end", "title": "" }, { "docid": "2443d43318161fe7485b436dd2c90df4", "score": "0.55114335", "text": "def yield_installation_error_warning(path_to_installer)\n @env.ui.warn I18n.t(\"vagrant_vbguest.install_error\",\n :installer_version => installer_version(path_to_installer) || I18n.t(\"vagrant_vbguest.unknown\"))\n end", "title": "" }, { "docid": "c6cf9d03546e6c029648093671a6b5e2", "score": "0.5502547", "text": "def show\n self.alertView = App.alert( title,\n message: message,\n cancel_button_title: [cancelButtonTitle, confirmButtonTitle],\n on_click: method(:alertButtonWasTouched) )\n self\n end", "title": "" }, { "docid": "e789e4eecc9d911e23a2b1f2b580f42c", "score": "0.549861", "text": "def upgrade_code\n return @upgrade_code\n end", "title": "" }, { "docid": "9dfb73472e78dd33cb4ccb0d910a5c0d", "score": "0.54944694", "text": "def ecc_on_upgrade(plugin)\n end", "title": "" }, { "docid": "aa14716bcf16bd3928c0ee480a84d9bf", "score": "0.5490887", "text": "def ask_update(msg: '')\n name = 'one_gadget'\n cmd = OneGadget::Helper.colorize(\"gem update #{name} && gem cleanup #{name}\")\n OneGadget::Logger.info(\"#{msg}\\nUpdate with: $ #{cmd}\\n\")\n end", "title": "" }, { "docid": "018ecd696c7661d5806669dd4148fc4c", "score": "0.5487338", "text": "def icingaweb_db_check_for_update\n puts \"Your icinga DB probably needs an update.\" \n puts \"This is not implemeted at the Moment, please\"\n puts \"update your database manualy.\"\n puts\n debug_message\n\n exit -1\nend", "title": "" }, { "docid": "57b149042bd55d434915c1feedbd6b78", "score": "0.5486854", "text": "def create\n @upgrade = Upgrade.new(upgrade_params)\n if @upgrade.save\n flash[:success] = \"Potenziamento aggiunto\"\n # redirect to upgrades index\n redirect_to upgrades_path(product_id: @upgrade.product.id)\n else\n # if validataion fails redirect to the new upgrade form\n render 'new'\n end\n end", "title": "" }, { "docid": "edaa0ec4e9fe701ac762964c909e123f", "score": "0.5469752", "text": "def job_vacancy_on_upgrade(plugin)\n end", "title": "" }, { "docid": "24b87d877465c75cf64a3a674fab01a5", "score": "0.54681176", "text": "def alert_log_message\n \"check generated an alert\"\n end", "title": "" }, { "docid": "e986182e0d8b67a1b71efb93137922f0", "score": "0.54647917", "text": "def upgrade\n # TODO: Check that check_command really checks the correct command with `echo $?`\n %w(update upgrade autoremove autoclean).map do |command|\n Command.new(\"#{APTGET_QUIET} #{command}\", check_command('echo $?', '0'))\n end\n end", "title": "" }, { "docid": "bbad359c7032efd4a6d0f2edc07c4704", "score": "0.5461664", "text": "def warn_restart!\n highline.say \"<%= color( 'You have changed the Flex SDK version. Please run `fvm-restart` to re-set $FLEX_HOME.', RED )%>\"\n end", "title": "" }, { "docid": "0173cacedb065f09a59bf0e5cf801573", "score": "0.5459942", "text": "def web_proxy_update\n update_status = check_update\n return false if update_status.nil?\n\n response = request(:post, '/devmgr/v2/upgrade/download')\n status(response, 200, [200], 'Failed to download the latest version')\n response = request(:post, '/devmgr/v2/upgrade/reload')\n status(response, 200, [200], 'Failed to install latest version')\n end", "title": "" }, { "docid": "96e9a338e38265c2202f1cab5c870a20", "score": "0.5457347", "text": "def check_for_update(component=:vp)\n\t\tupdated=false\n\t\tbegin\n\t\tself.log \"Checking for newer version of #{UPDATE_INFO[component][:fn]}....\"\n\t\t\tcurrent_version = Net::HTTP.get_response(UPDATE_INFO[component][:curr_version]).body.to_f\n\t\t\tif current_version==0.0\n\t\t\t\tself.log \"Error: Unable to fetch number of current version\"\n\t\t\t\t# we check != rather than > bc w cvs versions, 1.2 comes before 1.11\n\t\t\t\t# assumption is that the webpage will always have the version we want\n\t\t\t\t# to run\n\t\t\telsif current_version!=UPDATE_INFO[component][:version]\n\t\t\t\tself.log \"Upgrading from #{UPDATE_INFO[component][:version]} to #{current_version}\"\n\t\t\t\tcode = Net::HTTP.get_response(UPDATE_INFO[component][:curr_source]).body\n\t\t\t\tself.log \"Preparing to write version #{current_version}\"\n\t\t\t\tFile.open(UPDATE_INFO[component][:fn], File::CREAT|File::TRUNC|File::WRONLY, 0755){|f|\n\t\t\t\t\tf.puts code\n\t\t\t\t}\n\t\t\t\tself.log \"Wrote version #{current_version}\"\n\t\t\t\tload(UPDATE_INFO[component][:fn])\n load(UPDATE_INFO[:vp_config][:fn])\n\t\t\t\tupdated=true\n\t\t\t\tUPDATE_INFO[component][:version]=current_version\n\t\t\t\tself.log \"Upgraded to version #{UPDATE_INFO[component][:version]}\"\n\t\t\t\t\t# sleep 10 to give this one a chance to shut down - only\n\t\t\t\t\t# one can run at a time\n\t\t\t\t\t# Kernel::system(\"sudo /usr/sbin/atd; echo \\\"sleep 10; ./vantage_point.rb 1>> #{$LOG_FILE} 2>&1 \\\"|at now\")\n\t\t\t\t\t# self.log \"Shutting down for upgrade to version #{current_version}\"\n\t\t\t\t\t# sleep 2\n\t\t\t\t\t# self.shutdown($UPGRADE_RESTART)\n\t\t\telse\n\t\t\t\tself.log \"No upgrade available from #{UPDATE_INFO[component][:version]}\"\n\t\t\tend\n\t\trescue\n\t\t\tself.log \"Unable to check for update: #{$!.class}: #{$!.to_s}\\n#{$!.backtrace.join(\"\\n\")}\"\n\t\tend\n\t\treturn updated\n\tend", "title": "" }, { "docid": "6abde69576da56024e7417a2331b0fd8", "score": "0.5455928", "text": "def alert msg\n document.get_default_view.alert(msg)\n end", "title": "" }, { "docid": "c48aeb710875fabc7ad9e0e5c589e6e0", "score": "0.54444873", "text": "def show\n render :text=>\"update not supported\", :status=>500\n end", "title": "" }, { "docid": "386df317631c3ce66182c5d693b69f92", "score": "0.54351413", "text": "def install_message\n puts ' --------------------------------------------------------------------'\n puts ' Integral has successfully installed! '\n puts\n puts \" The admin backend is located at /#{Integral.backend_namespace}.\"\n puts\n puts \" User email : #{Integral::User.first.email}\"\n puts ' User password : password'\n puts ' --------------------------------------------------------------------'\n end", "title": "" }, { "docid": "0f96d0c1f97b4275c23bbf6298762c41", "score": "0.5432275", "text": "def send_changed_response_alert\n\t\tif self.change_detected?\n\t\t\t# Send alert!\n\t\tend\n\tend", "title": "" }, { "docid": "6dfa1bae473ef2d0b6d0570f4f102541", "score": "0.54221606", "text": "def do_update_check(render_msg = true)\n # grab the updates xml file\n server_version_info = Net::HTTP.get(URI.parse('http://' + SL_CONFIG[:UPDATES_URL])) rescue ''\n # check the server's response code\n server_response = Net::HTTP.get_response(URI.parse('http://' + SL_CONFIG[:UPDATES_URL])).value rescue 0\n if server_version_info == '' or server_response == 0\n # couldn't get update info from the server--return error msg if necessary\n if render_msg\n render :text => '<p><b>Error:</b> Couldn\\'t reach server. Please try again later.</p>'\n return\n else\n return false\n end\n end\n # break it in two\n server_version_info = server_version_info.split(\"\\n\")\n # get the version number\n server_version = server_version_info[0].gsub(/\\<(\\/*)version\\>/, '').strip\n if server_version != '' and server_version > SL_CONFIG[:VERSION]\n # different version on server\n output = \"<p><b>Update found!</b> Version #{server_version} is now available: <a href=\\\"http://simplelog.net\\\" title=\\\"Visit the SimpleLog website\\\" target=\\\"_blank\\\">Visit the SimpleLog website</a> to download.</p>\"\n # grab the change details\n version_details = server_version_info[1].gsub(/\\<(\\/*)changes\\>/, '').strip.split('|')\n output += '<p><b>Changes in this version:</b></p>'\n output += '<ul>'\n for d in version_details\n # write out the change details\n output += \"<li>#{d}</li>\"\n end\n output += '</ul>'\n update_checker_info(true, server_version)\n else\n # no new version available\n output = \"<p><b>Hooray!</b> You're running the newest version of SimpleLog.</p>\"\n update_checker_info(false)\n end\n # let's return our output now, if necessary\n if render_msg\n render :text => output\n return\n else\n return true\n end\n rescue\n # an error of some sort, return error or false\n if render_msg\n render :text => 'Error!'\n return\n else\n return false\n end\n end", "title": "" }, { "docid": "126a32537cfb279562c67f47d8247aa5", "score": "0.5417354", "text": "def upgradenow(opts=\"\")\n sendreceive(\"upgradenow #{opts}\", :timeout=>120)\n end", "title": "" }, { "docid": "5b2e6e646427777ad00f4cc98d53eb4d", "score": "0.54165155", "text": "def enter_upgrades\n @upgrade_specs = get_entries(Hash.new, UPGRADE_ASPECTS, \"enter upgrade\")\n end", "title": "" }, { "docid": "41231614dbe47d337d60ae1febc9a215", "score": "0.5412239", "text": "def postinstall_display\n ret = @vm.postinstall_display\n render plain: ret[:message], status: ret[:status]\n end", "title": "" }, { "docid": "ec3ed7ffd24056ab563cab6bbd26e698", "score": "0.54080963", "text": "def alert(name, message, url)\n Alert.alert(self, name, message, url)\n end", "title": "" }, { "docid": "dcbd141b57ba5f7c4fb8c0ac551a3edc", "score": "0.5405179", "text": "def chrono_upgrade_warning\n upgrade = chrono_tables_needing_upgrade.map do |table, desc|\n \"#{table} - priority: #{desc[:priority]}\"\n end.join('; ')\n\n return if upgrade.empty?\n\n logger.warn \"ChronoModel: There are tables needing a structure upgrade, and ChronoModel structures need to be recreated.\"\n logger.warn \"ChronoModel: Please run ChronoModel.upgrade! to attempt the upgrade. If you have dependant database objects\"\n logger.warn \"ChronoModel: the upgrade will fail and you have to drop the dependent objects, run .upgrade! and create them\"\n logger.warn \"ChronoModel: again. Sorry. Some features or the whole library may not work correctly until upgrade is complete.\"\n logger.warn \"ChronoModel: Tables pending upgrade: #{upgrade}\"\n end", "title": "" }, { "docid": "219d065a999e45cde50662f63b10ded9", "score": "0.5404838", "text": "def upgrade\n authorize! :upgrade, User\n @user = User.find(params[:id])\n @user.update(admin: true)\n respond_to do |format|\n format.html { redirect_to users_url,\n notice: 'User was successfully upgraded' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e47f2ecb77d9611284efdc02de27261e", "score": "0.5394731", "text": "def upgrades\n respond_to do |format|\n format.js do\n render :update do |page|\n update_account_settings_layout(page, \"account_settings/upgrades\")\n end\n end\n end\n end", "title": "" }, { "docid": "481403707ec02cc7493d276357c9dc44", "score": "0.5391237", "text": "def visit_upgrade upgrade\n @price += upgrade.price\n end", "title": "" }, { "docid": "b1ce48cf1fcbc60d453cda6d71140c3d", "score": "0.53891516", "text": "def upgrade_eligibility=(value)\n @upgrade_eligibility = value\n end", "title": "" }, { "docid": "17d0b45f4106e5a1ed14a729ed2dc2a3", "score": "0.53836757", "text": "def set_upgrade\n @upgrade = Upgrade.find(params[:id])\n end", "title": "" }, { "docid": "501c38b2a641a30cdeda0e119d3d7fa5", "score": "0.53834337", "text": "def upgraded?\n paid?\n end", "title": "" }, { "docid": "17d0b45f4106e5a1ed14a729ed2dc2a3", "score": "0.5382792", "text": "def set_upgrade\n @upgrade = Upgrade.find(params[:id])\n end", "title": "" }, { "docid": "65f6134fa32610e840314d1be52f1815", "score": "0.5377419", "text": "def update\n respond_to do |format|\n if @element_upgrade.update(element_upgrade_params)\n format.html { redirect_to @element_upgrade, notice: 'Element upgrade was successfully updated.' }\n format.json { render :show, status: :ok, location: @element_upgrade }\n else\n format.html { render :edit }\n format.json { render json: @element_upgrade.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d906849d7c916d8b63877b97ca29c81f", "score": "0.5372269", "text": "def upgrade\n install\n end", "title": "" }, { "docid": "0d8d56978b208fb938efe75d5d0e513f", "score": "0.5372098", "text": "def yield_rebuild_warning\n @vm.ui.warn I18n.t(\"vagrant.plugins.vbguest.rebuild#{@options[:force] ? '_forced' : ''}\",\n :guest_version => guest_version(true),\n :host_version => host_version)\n end", "title": "" }, { "docid": "95776bce65ba1a1988374d15bbf6a5b9", "score": "0.5364598", "text": "def update\n render text: \"Not supported\", status: 501\n end", "title": "" }, { "docid": "afbeb5b1a08b7d6a8a9a7f57f21fb300", "score": "0.5351907", "text": "def alert_content\n \"Remember to take out your garbage!\"\n end", "title": "" }, { "docid": "e3760ef793e2d60cdfc7888dd3fdbf39", "score": "0.5351903", "text": "def upgrade\n if request.post?\n @user = User.find(session[:user_id])\n @user.telephone = params[:telephone]\n @user.update\n @req = UpgradeRequest.new\n @req.user_id = session[:user_id]\n if @req.save\n flash[:notice] = Resource.get(\"upgrade_req_recieved\") \n else\n return\n end\n redirect_to :action => 'index'\n end\n end", "title": "" }, { "docid": "b4293148eeeac376018e3c6c81c8d633", "score": "0.53504676", "text": "def new\n @upgrade = Upgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upgrade }\n end\n end", "title": "" }, { "docid": "9566960202532059e43d362eb8410257", "score": "0.5339573", "text": "def alert\n user_id = User.first.id\n UserMailer.alert(user_id)\n end", "title": "" }, { "docid": "cee37c41bac020b9c99ae035043b75a1", "score": "0.5336052", "text": "def update\n @upgrade = Upgrade.find(params[:id])\n if @upgrade.update_attributes(upgrade_params)\n flash[:success] = \"Potenziamento modificato con successo\"\n # redirect to upgrades index for the selected product\n redirect_to upgrades_path(product_id: @upgrade.product.id)\n else\n # if validataion fails redirect to the edit upgrade form\n render 'edit'\n end\n end", "title": "" }, { "docid": "0a7a79f61478d80cc94672cd6f61b6ea", "score": "0.5329647", "text": "def upgrade_mode\n if progress[:selected_upgrade_mode]\n progress[:selected_upgrade_mode]\n else\n progress[:suggested_upgrade_mode]\n end\n end", "title": "" }, { "docid": "b45843a36e0623f39fb0f33d1ca7bf65", "score": "0.5323141", "text": "def camaleon_mandrill_on_upgrade(plugin)\n end", "title": "" }, { "docid": "ceee4a8f6c9f61e8007b34cb0b5b1724", "score": "0.5322089", "text": "def upgrade_proc\n\t\t\t\tself.method :on_upgrade\n\t\t\tend", "title": "" }, { "docid": "772ebce5e8342ea070604d7c0c034623", "score": "0.5317361", "text": "def accounts_not_available\n flash[:warning] = I18n.t(:user_system_down)\n redirect_to root_url\n end", "title": "" }, { "docid": "5639b3cc3c23bc91faab921f0ce8cb55", "score": "0.5317325", "text": "def update_plugin(name)\n notify \"Plugin #{name} is already installed\"\n end", "title": "" }, { "docid": "b1ccb67752f73bcb8387db90ce8c994c", "score": "0.53081375", "text": "def perform_update!\n prompt_for_root_password!\n \n ##\n # If no web server is specified, it'll prompt the user to\n # select one of the available (NginX or Apache)\n if webserver.nil?\n @webserver = webserver?\n end\n \n ##\n # Check if RubyGems (RVM + Ruby) has been installed\n Spinner.return :message => \"Checking if RubyGems is installed..\" do\n @rubygems_installed = e.installed?('gem')\n if not @rubygems_installed\n r(\"Couldn't find RubyGems.\")\n else\n g(\"Done!\")\n end\n end\n \n if not @rubygems_installed\n error \"Install RVM (Ruby Version Manager) and at least one Ruby version.\"\n error \"To do this, run: #{y(\"heavenly rvm install for #{e.name}\")}.\"\n exit\n end\n \n ##\n # Check if Phusion Passenger is installed\n Spinner.return :message => \"Checking if Phusion Passenger is installed..\" do\n @passenger_installed = e.installed?(\"passenger\")\n if not @passenger_installed\n @ruby_version = e.execute_as_root(\"ruby -v\").chomp\n r(\"Couldn't find Phusion Passenger\")\n else\n g(\"Found!\")\n end\n end\n \n if not @passenger_installed\n error \"Passenger has not been installed for #{y(@ruby_version)}\"\n error \"If you want to install Passenger, please run the following command:\"\n error y(\"heavenly passenger install for #{e.name}\")\n exit\n end\n \n ##\n # Check if a newer version of Phusion Passenger Gem is available\n Spinner.return :message => \"Checking if there's a newer (stable) Phusion Passenger available..\" do\n @latest_passenger_version = GitPusshuTen::Gem.new(:passenger).latest_version\n @current_passenger_version = e.execute_as_root(\"passenger-config --version\").chomp.strip\n if @latest_passenger_version > @current_passenger_version\n @new_passenger_version_available = true\n y(\"There appears to be a newer version of Phusion Passenger available!\")\n else\n g(\"Your Phusion Passenger is #{@current_passenger_version}. This is the latest version.\")\n end\n end\n \n exit unless @new_passenger_version_available\n \n message \"Phusion Passenger #{y(@latest_passenger_version)} is out!\"\n message \"You are currently using version #{y(@current_passenger_version)}.\\n\\n\"\n message \"Would you like to update Phusion Passenger?\"\n message \"This will update the #{y('Phusion Passenger Gem')} as well as #{y(webserver)} and #{y(\"Phusion Passenger's #{webserver} Module\")}.\"\n \n ##\n # Prompt user for confirmation for the update\n if yes?\n \n ##\n # Search for NginX installation directory by finding the configuration file\n if nginx?\n find_nginx_conf!\n \n if not @nginx_conf\n error \"Could not find the NginX configuration file in #{y('/etc/nginx')} or #{y('/etc/nginx/conf')}.\"\n exit \n end\n end\n \n ##\n # Ensures the Apache2 configuration file exists\n if apache?\n find_apache2_conf!\n \n if not @apache2_conf\n error \"Could not find the Apache2 configuration file in #{y('/etc/apache2')}.\"\n exit\n end\n end\n \n ##\n # Installation directory has been found\n message \"#{y(webserver)} installation found in #{y(@nginx_conf || @apache2_conf)}.\"\n \n ##\n # Invoke the installation command to install NginX\n @updating = true\n perform_install!\n \n ##\n # Update the webserver configuration file\n message \"The #{y(webserver)} configuration file needs to be updated with the new #{y('Passenger')} version.\"\n message \"Invoking #{y(\"heavenly #{webserver.downcase} update-configuration for #{e.name}\")} for you..\\n\\n\\n\"\n GitPusshuTen::Initializer.new([webserver.downcase, 'update-configuration', 'for', \"#{e.name}\"])\n end\n end", "title": "" }, { "docid": "6fa2b66fa1604349dd96f74c3809df21", "score": "0.53039116", "text": "def showErrorVersion()\n\t\td = Gtk::MessageDialog.new(\n\t\t\t:parent => Gtk::Window.new,\n\t\t\t:type => Gtk::MessageType::ERROR,\n\t\t\t:buttons => Gtk::ButtonsType::OK_CANCEL,\n\t\t\t:message => self.versionErrorMessage\n\t\t)\n\t\tresponse = d.run\n\t\td.destroy\n\t\tif response == Gtk::ResponseType::OK then\n\t\t\t# we continue the game, but this is dangerous\n\t\telse\n\t\t\t# we stop here\n\t\t\tself.action_quit_cb\n\t\tend\n\t\treturn self\n\tend", "title": "" } ]
f1cb2e8a1b905dbb1ada91411270bf2c
FalseFailure Passed if object is +false+.
[ { "docid": "caefaef6fcf03ec0c2369afc831b6b56", "score": "0.6230202", "text": "def assert_false(exp, msg=nil)\n FalseFailure.assert(exp, :message=>msg, :backtrace=>caller)\n end", "title": "" } ]
[ { "docid": "a5d5c133b8135a661d7d14381f5906e6", "score": "0.71424407", "text": "def wont_be_false(msg=nil)\n FalseAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "24d71b0e4670177063e74de40cfffc1e", "score": "0.71210194", "text": "def failure?\n false\n end", "title": "" }, { "docid": "10da0adca1864d94c40a94e71baf9c93", "score": "0.70908755", "text": "def void_false(*args)\n return false\n end", "title": "" }, { "docid": "ab33e334c0cd6fd641737b17fd8c5e33", "score": "0.6946842", "text": "def conditionally_false\n\t\t!self\n\tend", "title": "" }, { "docid": "7b31e8205666e925b991e2aa312f8fb2", "score": "0.6924343", "text": "def failed?\n not @ok\n end", "title": "" }, { "docid": "c680f279e92cc5f69aecbeeb05240996", "score": "0.6867877", "text": "def false!(err=\"not false\")\n if Exception === err\n fail err\n else\n fail Assertion.new(err.to_s, :backtrace=>caller)\n end\n end", "title": "" }, { "docid": "960240529831bdab9e520a655a1871a5", "score": "0.6860688", "text": "def failed?\n @passed == false\n end", "title": "" }, { "docid": "baf237524ca4a450e4a9f66cf32a1acf", "score": "0.6830277", "text": "def must_be_false(msg=nil)\n FalseAssay.assert!(self, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "df41a870208c9e66581fb08382ec8a7d", "score": "0.6768788", "text": "def false!(msg=nil)\n true\n end", "title": "" }, { "docid": "c28626ea89e48e40248fc894931537d7", "score": "0.67471325", "text": "def failure\n !success\n end", "title": "" }, { "docid": "29a8ad6841a7adbf4200964458fb52d6", "score": "0.6733679", "text": "def to_bool() false end", "title": "" }, { "docid": "0fc1a45deed494db095c589b4f0ca608", "score": "0.67291945", "text": "def false \n \"false\" \n end", "title": "" }, { "docid": "39c88f6da3333048ece4c315af061c67", "score": "0.6697269", "text": "def plain_old_ruby_object\n\t\treturn false\n\tend", "title": "" }, { "docid": "204df0991468ee4e2e94590330ef5b0a", "score": "0.6671826", "text": "def assert_not_true(obj, opts)\n opts[:backtrace] ||= caller\n IsTrueFailure.assert!(obj, opts)\n end", "title": "" }, { "docid": "7390614f708fb8d69a70d8369340263f", "score": "0.66611946", "text": "def failure?\n !success?\n end", "title": "" }, { "docid": "7390614f708fb8d69a70d8369340263f", "score": "0.66611946", "text": "def failure?\n !success?\n end", "title": "" }, { "docid": "7390614f708fb8d69a70d8369340263f", "score": "0.66611946", "text": "def failure?\n !success?\n end", "title": "" }, { "docid": "3ad7a7826abbe836b51407575a2b45b1", "score": "0.6653281", "text": "def fail!\n @success = false\n end", "title": "" }, { "docid": "3ad7a7826abbe836b51407575a2b45b1", "score": "0.6653281", "text": "def fail!\n @success = false\n end", "title": "" }, { "docid": "b986c9b600c4d850898af2fc44d82123", "score": "0.66397387", "text": "def failure?\n !successful?\n end", "title": "" }, { "docid": "dae727967200f3832c2426233e22bad1", "score": "0.6615199", "text": "def assert_false( actual, msg = nil )\n msg = message(msg) { \"should be false (instance of FalseClass), not <#{mu_pp(actual)}>\" }\n assert actual == false, msg\n end", "title": "" }, { "docid": "c1a2c577201f65d5388ab5b1764ab546", "score": "0.66149783", "text": "def literal_false\n BOOL_FALSE\n end", "title": "" }, { "docid": "cd62fd965c2547f6f2a60ebd701827f8", "score": "0.6587961", "text": "def failure?\n !success?\n end", "title": "" }, { "docid": "cd62fd965c2547f6f2a60ebd701827f8", "score": "0.6587961", "text": "def failure?\n !success?\n end", "title": "" }, { "docid": "f198fba8c0059f0f61c4cedcd5d3a11c", "score": "0.65870756", "text": "def dumb?\n false\n end", "title": "" }, { "docid": "479c0ba964666f158fa581a99004fdf8", "score": "0.65624154", "text": "def failure?\n !successful?\n end", "title": "" }, { "docid": "70714161f180fbe4be15911ece55aabc", "score": "0.6556775", "text": "def something_should_fail?\n @should_fail\n end", "title": "" }, { "docid": "e552c628de1a1736e32cc6ac7c52f9ff", "score": "0.65557146", "text": "def fail!\n @success = false\n end", "title": "" }, { "docid": "96b61510c3762750ec19ba4841cb6aa7", "score": "0.65513676", "text": "def refute_false(exp, msg=nil)\n FalseFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "ce575d03032b6c2578040cc71fa55202", "score": "0.6545172", "text": "def expected?\n false\n end", "title": "" }, { "docid": "8ba4cc26e8517afddbc9738ee86b12af", "score": "0.653479", "text": "def not\n\t\tself.test != true\n\tend", "title": "" }, { "docid": "3d077a10b43303baea0b9eb2455d1522", "score": "0.65268105", "text": "def assert_not_true(obj, opts)\n msg = opts[:message] || \"Expected #{exp} NOT to be true\"\n call = opts[:backtrace] || caller\n fail Assertion.new(msg, call) if TrueClass === act\n end", "title": "" }, { "docid": "895007ef596f74ba02839653896cbcc9", "score": "0.65038043", "text": "def assert_false(thing, message = '')\n assert thing == false, message\n end", "title": "" }, { "docid": "c66fbe99776cd887f308eff13893a46c", "score": "0.6477821", "text": "def failure_has_not_occurred!\r\n @failure_has_occurred = false\r\n end", "title": "" }, { "docid": "ba193e7ee76e057f18d3955d5633a6c7", "score": "0.6471359", "text": "def negative_test\r\n @negative = true\r\n end", "title": "" }, { "docid": "e474e20b740e4425ca9be25dd0ff440d", "score": "0.64292336", "text": "def something_should_fail!\n @should_fail = true\n end", "title": "" }, { "docid": "eb43dccfe92b0610e4f9636bdb15d827", "score": "0.64090174", "text": "def failure?(value)\n value.is_a?(Exception) || value == false\n end", "title": "" }, { "docid": "2ba7711f468b275a3a67676e2834a356", "score": "0.6386776", "text": "def failure?\n !error?\n end", "title": "" }, { "docid": "806833c9f8bcb12e1511de66b85e9402", "score": "0.63802433", "text": "def test?\n false\n end", "title": "" }, { "docid": "c8a2e2cef88aaf544aebf9bf448a414d", "score": "0.63685584", "text": "def assertFalseTest value\n assertFalse value\n end", "title": "" }, { "docid": "20661ce13547195eb333ff686820c4f5", "score": "0.635562", "text": "def failed?\n\t\tnot @failure.nil?\n\tend", "title": "" }, { "docid": "8e367fdce59f3e94629ccbf6f936a9af", "score": "0.6330089", "text": "def bad?\n !good?\n end", "title": "" }, { "docid": "e6068ed8a371cd1cdde0c809a4f88499", "score": "0.63236904", "text": "def result?\n false\n end", "title": "" }, { "docid": "1d65f94e79b80d196fa3f6045c3df596", "score": "0.6319156", "text": "def failed?\n !success?\n end", "title": "" }, { "docid": "72bf29c9f24f4c50963495f8779337b0", "score": "0.63177747", "text": "def false?\n value.nil? || value == false\n end", "title": "" }, { "docid": "2f08af8665ad239d9c0229ab4be10e5f", "score": "0.6315893", "text": "def passed?\n !failed?\n end", "title": "" }, { "docid": "fc359e1589b87a7c0f06dc13dd0a4584", "score": "0.6296461", "text": "def assertFalse value, message = nil\n __assert (false == value), ASSERT_FALSE_ERROR, message, {:value=>value}\n end", "title": "" }, { "docid": "43ef532365d4d256bb8233995b5ff429", "score": "0.6290385", "text": "def passed?\n !failed?\n end", "title": "" }, { "docid": "68e1f168e264676a71149078d0c6757d", "score": "0.6279272", "text": "def main_example_FAIL()\n object_example = Object_example.new()\n if object_example.test_FAIL() == 1\n return 1\n end\nend", "title": "" }, { "docid": "22a771956c5e61ecc193e71718bc8e93", "score": "0.6278068", "text": "def true?\n !false?\n end", "title": "" }, { "docid": "8fa6e1556793b830baac2e257056823a", "score": "0.6274691", "text": "def no? ; false ; end", "title": "" }, { "docid": "38f9e9bee99bb23ffb4e253f34fc238e", "score": "0.6263717", "text": "def failed?\n true\n end", "title": "" }, { "docid": "81b49896541b4d8296176cb546e2b840", "score": "0.6253109", "text": "def failed!\n @success = false\n end", "title": "" }, { "docid": "f018e8bdaad2cde0aa181e277c53d035", "score": "0.6233", "text": "def false?(param)\n !true?(param)\n end", "title": "" }, { "docid": "4bfb95e20aab607c56d9bf023b68d88c", "score": "0.6229862", "text": "def wont_be_true(msg=nil)\n TrueAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "e5f7574c9829dd682ee9defe0f5450a4", "score": "0.6221614", "text": "def failure?\n @status == FAILURE_FLAG\n end", "title": "" }, { "docid": "43b1e3f252e15b9f3cb6f17ac6c79000", "score": "0.62097967", "text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n \n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end", "title": "" }, { "docid": "e426a97a96c23134bd5e35efc0eb8895", "score": "0.6207121", "text": "def success?\n false\n end", "title": "" }, { "docid": "e426a97a96c23134bd5e35efc0eb8895", "score": "0.6207121", "text": "def success?\n false\n end", "title": "" }, { "docid": "7c432cb9bcd86db779283ca90d9c3ce8", "score": "0.6193565", "text": "def false!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n\n type = FALSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 194:9: 'false'\n match( \"false\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 73 )\n\n end", "title": "" }, { "docid": "809a6c1155a35246cbce0af91dbeab7d", "score": "0.61897504", "text": "def assert_not(object, message = nil)\n message ||= \"Expected #{mu_pp(object)} to be nil or false\"\n assert !object, message\n end", "title": "" }, { "docid": "bab680e833c32ba86dcd4e23726984b4", "score": "0.6172948", "text": "def refute_false(exp, msg=nil)\n FalseAssay.refute!(exp, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "7b79a6d5bf7a274e287aba6449e42ef2", "score": "0.61722106", "text": "def assert_false(boolean, message = nil)\n message = build_message message, '<?> is not false or nil.', boolean\n\n clean_backtrace do\n assert_block message do\n not boolean\n end\n end\n end", "title": "" }, { "docid": "fb25728844d833882de5ff1b84305494", "score": "0.61672986", "text": "def failed?\n self == Failed\n end", "title": "" }, { "docid": "1dafdde9dea9cda3ecc90b144891ece2", "score": "0.6128805", "text": "def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend", "title": "" }, { "docid": "aff45ff16806f5b5b9ec3512cab356d1", "score": "0.6121618", "text": "def destructible?\n false\n end", "title": "" }, { "docid": "78c88102b7c03e9d1101d372d3771005", "score": "0.6115355", "text": "def on_false(node)\n :false\n end", "title": "" }, { "docid": "2fc3228cb42c7e82e9eb934ad08b7598", "score": "0.6115169", "text": "def false!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n\n type = FALSE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 319:9: 'false'\n match( \"false\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end", "title": "" }, { "docid": "74e4be1a84fc6085272c1e7f849f860b", "score": "0.6112763", "text": "def success?\n not failure_occurred\n end", "title": "" }, { "docid": "74e4be1a84fc6085272c1e7f849f860b", "score": "0.6112763", "text": "def success?\n not failure_occurred\n end", "title": "" }, { "docid": "711f3f31e977727c7f30c5a29740eac6", "score": "0.6110716", "text": "def failed?\n failed\n end", "title": "" }, { "docid": "88713764ddcbaaac3609b251e81bd541", "score": "0.6106432", "text": "def ok?\n @ok\n end", "title": "" }, { "docid": "ed9016c7ff21fcb6c264d46da685ac86", "score": "0.6093478", "text": "def assertFalseFailTest value\n rescue_assertion /#{ASSERT_FALSE_ERROR}/ do\n assertFalse value\n end\n end", "title": "" }, { "docid": "34549a7b06b4a9a39e3340f42f8d3706", "score": "0.6084342", "text": "def negative?() @positive==false end", "title": "" }, { "docid": "0c975f570c640be24375f172818745e3", "score": "0.6081256", "text": "def negative?; end", "title": "" }, { "docid": "44271ea0822d0c4b05f35e765e2d75b5", "score": "0.6080332", "text": "def to_bool\n !!self\n end", "title": "" }, { "docid": "b40743d876324f6b2a0ae365da76d939", "score": "0.6079395", "text": "def be_true\n BeTrue.new\nend", "title": "" }, { "docid": "0200ebf46619d6eafc90e86addb41ef4", "score": "0.6070341", "text": "def false_true\n alternatives false, true\n end", "title": "" }, { "docid": "4c3e2ec4fd622c15966e98d4a10920ae", "score": "0.60677606", "text": "def literal_false\n 'false'\n end", "title": "" }, { "docid": "72835a508adf70e6e52c78e7f5d7db63", "score": "0.6057596", "text": "def check_falsey(v, qmethod, bmethod, *args)\n assert_rational_and_equal 0, v.__send__(*([qmethod] + args))\n assert_instance_of FalseClass, v.__send__(*([bmethod] + args))\n end", "title": "" }, { "docid": "585ebb832439e7f87eee1b18ff3589ab", "score": "0.60551935", "text": "def success?()\n result != false\n end", "title": "" }, { "docid": "3e27251700239a287a24ae34e0544a50", "score": "0.6054953", "text": "def to_bool; self; end", "title": "" }, { "docid": "3e27251700239a287a24ae34e0544a50", "score": "0.6054953", "text": "def to_bool; self; end", "title": "" }, { "docid": "65b55fc44fa469b145dd8d2a9e63ce33", "score": "0.60528183", "text": "def test_refute\r\n a = false\r\n refute a\r\n end", "title": "" }, { "docid": "e768acb68388a5d6884cfb2cd75d93c8", "score": "0.6044061", "text": "def assert_not_true(exp, msg=nil)\n TrueFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end", "title": "" }, { "docid": "e04b27d3ebc9051f707ad42b0ad08ffb", "score": "0.60439277", "text": "def value_if_false\n return @value_if_false\n end", "title": "" }, { "docid": "4412d95d8706f1ed3bc06cef6a597762", "score": "0.60431194", "text": "def new?\n !@object\n end", "title": "" }, { "docid": "4412d95d8706f1ed3bc06cef6a597762", "score": "0.60431194", "text": "def new?\n !@object\n end", "title": "" }, { "docid": "1012ec003627f05f863bd99b1e9892ec", "score": "0.60260516", "text": "def test_run_nothing_raised_if_false\n assert_nothing_raised(RuntimeError) { Execute.run('false') }\n end", "title": "" }, { "docid": "24fbf07c8bbf649db0b09f763d1341a2", "score": "0.6010262", "text": "def flexmock_test_has_failed? # :nodoc:\n passed? == false\n end", "title": "" }, { "docid": "3fa62005109f8d6a9fe700626139f220", "score": "0.6006392", "text": "def test_falsevals\n exec = nil\n assert_nothing_raised do\n exec = Puppet::Type.type(:exec).new(\n :command => \"/bin/touch yayness\"\n )\n end\n\n Puppet::Type.type(:exec).checks.each do |check|\n klass = Puppet::Type.type(:exec).paramclass(check)\n next if klass.value_collection.values.include? :false\n assert_raise(Puppet::Error, \"Check '#{check}' did not fail on false\") do\n exec[check] = false\n end\n end\n end", "title": "" }, { "docid": "35523b632df9fbe4ac6e9230c73a5f7e", "score": "0.60042393", "text": "def broken?\n ! not_broken?\n end", "title": "" }, { "docid": "01273c56aa44eb6f96dacb0e50a7abd5", "score": "0.6000946", "text": "def fail!\n @failed = true\n end", "title": "" }, { "docid": "22785d625e62d9e37f89beff61c9f658", "score": "0.5996292", "text": "def true?(obj)\n if obj.nil?\n raise \"Object is nil. Not a valid boolean value\"\n end\n obj.to_s.downcase == \"true\"\nend", "title": "" }, { "docid": "8c103dac9e43b6743e9b6d6ace26c062", "score": "0.5994376", "text": "def assert_not(object, message = nil)\n message ||= \"Expected #{mu_pp(object)} to be nil or false\"\n assert !object, message\nend", "title": "" }, { "docid": "e0caf179ee0d97a2d47958c6d798ee9f", "score": "0.5991807", "text": "def assert_false(statement, message='')\n assert(statement == false || statement == nil, message)\n end", "title": "" }, { "docid": "18afa0fd7a9e6a2ed5c7eee3119e4478", "score": "0.59814584", "text": "def _false\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"false\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_utfw)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_false unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "6df6a0adda880756109bd3ba798bde9c", "score": "0.59799093", "text": "def primitive?\n false\n end", "title": "" }, { "docid": "b825c6c716c451a47fb0152c020475dd", "score": "0.59760666", "text": "def no? ; true ; end", "title": "" }, { "docid": "01a69e5558eb46f9d9abad0b2662761a", "score": "0.59720075", "text": "def lost? # ruby style/convention says methods that return booleans should end w/ \"?\", so can't just use attr_reader/attr_writer/attr_accessor\n @lost\n end", "title": "" } ]
66c29d722d454962dc3b396d8b58be05
Need Skills For New Profile
[ { "docid": "87c65d6c498dff21a6cbad47f55f4e3f", "score": "0.57037777", "text": "def create_row_need_skill\n @need_skill = NeedSkill.new\n\n @need_skill.user_id = current_user.id\n @need_skill.skill_id = params[:full_skill_name]\n @need_skill.skill_category = Skill.find_by(id: params[:full_skill_name]).skill_category\n @need_skill.skill_subcategory = Skill.find_by(id: params[:full_skill_name]).skill_subcategory\n @need_skill.skill_description = Skill.find_by(id: params[:full_skill_name]).skill_description\n\n save_status = @need_skill.save\n\n if save_status == true\n #redirect_to(\"/have_skills\", :notice => \"Have skill created successfully.\")\n #render(\"profiles/new_profile.html.erb\")\n new_profile\n else\n #render(\"have_skills_templates/new_form.html.erb\")\n new_profile\n #render(\"profiles/new_profile.html.erb\")\n\n end\n end", "title": "" } ]
[ { "docid": "5e4f915d74a053e2036d5c0c31074aee", "score": "0.6431104", "text": "def own\n @profile = current_user.profile\n @interests = current_user.interests\n @teams = current_user.teams\n if @profile.not_modified?\n flash[:alert] = \"You have yet to create your profile. Please create one!\"\n redirect_to myprofile_edit_path\n end\n end", "title": "" }, { "docid": "72ed2a9352d00d423d71830c3ec8a89c", "score": "0.63686126", "text": "def profile_required\n @profile_required\n end", "title": "" }, { "docid": "1c9d067366a65b5a44e1997510b6a26f", "score": "0.6283138", "text": "def create\n @profile = current_user.build_profile(params[:profile]) \n\n respond_to do |format|\n if @profile.save\n if @profile.terms_agreed != true \n \n format.html { render :action => \"update\" }\n \n end\n flash[:notice] = 'Profile was successfully created.'\n format.html { redirect_to(@profile) }\n \n else\n format.html { render :action => \"new\" }\n \n end\n end\n end", "title": "" }, { "docid": "b6a8164fffcda05d6c95773fd13254ef", "score": "0.6169254", "text": "def profile?\n true\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "f281a4753162ac3b8b3877653870c16e", "score": "0.6088937", "text": "def profile\n end", "title": "" }, { "docid": "76dea38aa5ce366d7d36d5ec2e7f8e4c", "score": "0.6008399", "text": "def edit\n\n # remind that skype username is required to use the roulette\n if current_user.skype.blank?\n flash.now[:notice] = \"<strong>Notice</strong> To use the roulette your must enter your skype username\".html_safe\n end\n\n # check if profile is complete according to compeleted boolean \n # (STILL NEED TO DECIDE ON BEST WAY TO DO THIS)\n if current_user.completed?\n flash.now[:notice] = \"<strong>Notice</strong> Complete the rest of your profile\".html_safe\n end\n\n end", "title": "" }, { "docid": "ab27664dfbdb1bef30a912b1ce965374", "score": "0.5960971", "text": "def profile\n\n end", "title": "" }, { "docid": "ddf80fbf65996a8cf99cf51fae7a29fe", "score": "0.5925043", "text": "def set_skills_to_profile\n @skills_to_profile = SkillsToProfile.find(params[:id])\n end", "title": "" }, { "docid": "abc25818d0df65d940cfd44e629c438c", "score": "0.5914238", "text": "def require_profile\n @user = current_user\n if @user.profile == nil\n flash[:error] = \"You must have a profile to view this section\"\n redirect_to new_profile_path\n end\n end", "title": "" }, { "docid": "d4e170da8d07d573b1ccbb2bf6691bfc", "score": "0.5910414", "text": "def custom_skills\n end", "title": "" }, { "docid": "e5237c4929ddca3703649c2c9f067cb9", "score": "0.5897694", "text": "def profile\n\tend", "title": "" }, { "docid": "e5237c4929ddca3703649c2c9f067cb9", "score": "0.5897694", "text": "def profile\n\tend", "title": "" }, { "docid": "f92943f6e338bcd52765d6307fd4429b", "score": "0.58915585", "text": "def pick_skill; end", "title": "" }, { "docid": "9b83b0ddd774505ae8d4e6fb7e6764ef", "score": "0.58783597", "text": "def update_profile?\n not is_profile_ok?\n end", "title": "" }, { "docid": "e79fdad9bfd5d4064b54f88b0d1fee25", "score": "0.5839127", "text": "def check_user_profile\n if current_user && current_user.profile.nil?\n redirect_to new_user_profile_path(current_user) ,notice: \"#{flash[:notice]} #{t(:profile_notice)}.\"\n end\n end", "title": "" }, { "docid": "c2b84837318452a1c9566a6a460f9f95", "score": "0.583506", "text": "def profile_disabled?\n is_profile_owner? && !passed_profile_steps?\n end", "title": "" }, { "docid": "a42bd3c091905e796ff318cf3c32408b", "score": "0.58303803", "text": "def save_skills_profile(flags = {})\n \n profile_type = entity_id = entity_type = nil\n \n if flags[:job_seeker_id]\n entity_id = flags[:job_seeker_id]\n entity_type = ENTITY_TYPES[:job_seeker]\n profile_type = FS_PROFILE_TYPES[:user_profile]\n \n elsif flags[:job_id]\n entity_id = flags[:job_id]\n entity_type = ENTITY_TYPES[:job]\n profile_type = FS_PROFILE_TYPES[:user_profile]\n \n end\n \n current_skills_profile = Fs2SkillsProfile.find_by_entity_id(entity_id)\n delete_fs_profile_by_fs_profile_id(current_skills_profile.id) if current_skills_profile\n \n begin\n \n # Create a new skills_profile object\n @skills_profile = Fs2SkillsProfile.new({\n :entity_id => entity_id,\n :entity_type => entity_type,\n :profile_type => profile_type\n })\n raise 'ERROR' if !@skills_profile.valid?\n \n @skills_profile.save(false)\n \n # -----------------------\n # 2. Set the 'skills_profile' id in the entire 5skills data structure\n # -----------------------\n if @skills\n @skills.each do |skill|\n if skill\n skill.skills_profile_id = @skills_profile.id\n \n skill.skill_details.each do |skill_details|\n skill_details.skills_profile_id = @skills_profile.id\n end\n \n skill.save(false)\n end\n end\n end\n \n # -----------------------\n # 3. Set the 'skills_profile' id in the 'additional_requirements' objects \n # -----------------------\n if @additional_requirements\n @additional_requirements.each do |additional_requirement|\n additional_requirement.skills_profile_id = @skills_profile.id\n \n additional_requirement.save(false)\n end\n end\n \n rescue Exception => exc\n \n flash[:error] = 'Errors were found in the fields below, please check the messages next to each field'\n \n puts \" XXX: \" + exc.message\n \n end # rescue\n\n @skills_profile\n end", "title": "" }, { "docid": "7a6de54607017f7c1527ef96883e25ea", "score": "0.5813402", "text": "def test_decision_with_blank_profile_name\n login_as 'quentin'\n \n assert_no_difference users(:quentin).profiles, :count do\n post_without_ssl :decision, :\"yes.y\" => true, :trust_profile => -1, :profile_name => '', :query => create_checkid_query_string\n assert_trust_request\n end\n end", "title": "" }, { "docid": "48a1945c5593461ecdf2329ab52fca7f", "score": "0.578502", "text": "def passed_profile_steps?\n [profile_name, slug, cost].all?(&:present?)\n end", "title": "" }, { "docid": "e1d765a4ceb9f80a586da0dbc27cbb5b", "score": "0.5784743", "text": "def require_profile\n error! :missing_profile if current_profile.nil?\n end", "title": "" }, { "docid": "5c0fd164fc13718357ff4c51b5e0114f", "score": "0.5783199", "text": "def profile_created?\n if current_user\n if current_user.presenter\n if !current_user.presenter.presenter_profile\n flash[:info] = \"Before you can do this, you must create your profile\"\n redirect_to new_presenter_profile_path(current_user.presenter)\n end\n end\n end\n end", "title": "" }, { "docid": "c34747e414bcb4edcbfdfbffdaf95ae8", "score": "0.574988", "text": "def current_user_can_list_profiles\n bounce_user unless User.can_list_users? current_user\n end", "title": "" }, { "docid": "d9efb630f2a34c8ae2bd6e109c6ccd2c", "score": "0.5746338", "text": "def create\n @profile = Profile.new(profile_params)\n @profile.status = 'ACTIVE'\n\n # puts \"FullName: #{@profile.full_name}\"\n # puts \"Individual Client: #{@profile.individual_client?}\"\n\n if @profile.individual_client? || @profile.corporate_client?\n @profile.account = Account.new(name: @profile.full_name)\n # puts \"Creating Account for #{@profile.full_name}. Accont name: [#{@profile.account.name}]\"\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n index_load\n format.html { render 'index' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fad7043f2db17097d7e52b5a780861f3", "score": "0.57404655", "text": "def skill_can_use?(skill_id)\n return super\n end", "title": "" }, { "docid": "b5e22626dc404e40721c43d371434240", "score": "0.5737508", "text": "def get_profile_skills\n profile_skills = find_elements PROFILE_SKILLS_LOCATOR\n get_skills profile_skills\n end", "title": "" }, { "docid": "16b9f552a7b325fde7138c344a714ae8", "score": "0.5715798", "text": "def profile; end", "title": "" }, { "docid": "16b9f552a7b325fde7138c344a714ae8", "score": "0.5715798", "text": "def profile; end", "title": "" }, { "docid": "16b9f552a7b325fde7138c344a714ae8", "score": "0.5715798", "text": "def profile; end", "title": "" }, { "docid": "16b9f552a7b325fde7138c344a714ae8", "score": "0.5715798", "text": "def profile; end", "title": "" }, { "docid": "adec4514c07e9668a15a464404c9b1fc", "score": "0.5713183", "text": "def profile_except_wizard_completion_count\n [self.bio, self.custom_url, self.school_id, self.majors, self.gpa, self.gender, self.extracurriculars].reject { |member| member.blank? }.count\n end", "title": "" }, { "docid": "b776e54703e48f45973ee3af1fc4acef", "score": "0.5709056", "text": "def flying_skills\n end", "title": "" }, { "docid": "59cce9ca6487969582cb91bcc8be05f4", "score": "0.570742", "text": "def new\n unless current_user.profile\n @profile = Profile.new(:user_id => current_user.id)\n else\n error(\"Profile not created, maximum number of profiles per user exceeded\", \n \"not created, maximum number of profiles per user exceeded\")\n end\n end", "title": "" }, { "docid": "9f6c539d4509382b7b7eee45daa51f0c", "score": "0.5704667", "text": "def performed?\n create_profile\n response.success?\n end", "title": "" }, { "docid": "bc50cef3dbd133f6adcedadf01dcbb7f", "score": "0.56969124", "text": "def policy_sim_add\n @edit = session[:edit]\n @explorer = @edit[:explorer]\n # Profile was selected\n if params[:profile_id] != \"<select>\"\n prof = MiqPolicySet.find(params[:profile_id]) # Go thru all the profiles\n session[:policies][prof.id] = prof.description # Add it to the list\n end\n policy_sim_build_screen\n replace_main_div(:partial => \"layouts/policy_sim\")\n end", "title": "" }, { "docid": "6961c5c01ecbe50d0e70f98db889e40f", "score": "0.5695537", "text": "def show\n @professional_skill = current_profile.professional_skills.find(params[:id])\n end", "title": "" }, { "docid": "2f260f505f8e3c91afca92a06cd4bc56", "score": "0.56953084", "text": "def create\n authorize(Profile)\n @profile = Profile.new(profile_params)\n @profile.save!\n # @profile.user.role = Role.find(:role_id)\n if @profile.uploaded_image.attached? == false\n set_default_profile_image(@profile)\n end\n\n if @profile.background_image.attached? == false\n set_default_background_image(@profile)\n end\n \n if @profile\n redirect_to new_languageskill_path(:profile_id => @profile.id)\n end\n end", "title": "" }, { "docid": "cf0079080efb5053b3c5dd2cda757b3f", "score": "0.56846344", "text": "def add_profile_menu(service, sign_in_email)\n # Search for the account signed in\n sign_in_account = service.search_account(sign_in_email) # Get Account\n\n # Input new profile details\n print \"Enter your first name: \".white.bold\n new_first_name = gets.chomp\n print \"Enter your last name: \".white.bold\n new_last_name = gets.chomp\n print \"Enter your date of birth (DD/MM/YYYY): \".white.bold\n new_dob_string = gets.chomp\n new_dob = Date.parse(new_dob_string)\n print \"What is your favorite genre? : \".white.bold \n new_favorite_genre = gets.chomp\n\n # Create new profile\n new_profile = Profile.new\n new_profile.first_name = new_first_name.capitalize\n new_profile.last_name = new_last_name.capitalize\n new_profile.date_of_birth = new_dob\n new_profile.favorite_genre = new_favorite_genre\n\n # Add new profile to account\n sign_in_account.add_profile(new_profile)\n\n # Display add profile success\n puts \"\\nNew profile added successfully!\".white.bold\nend", "title": "" }, { "docid": "40380068c63bc6d4bee5cc7864ee8837", "score": "0.56805533", "text": "def find_cards_for_me\n if current_user.blank?\n flash[:notice]=\"Please Sign In To Get The Expert Advice For Purchasing A Credit Card\" \n redirect_to new_user_session_path and return\n end\t\n @profile = current_user.profile \n if !params[:profile].blank?\t\n \n \t\n current_user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Expert Person Will Write A Message Within 24 Houres.\"\n redirect_to :back\n end\n end", "title": "" }, { "docid": "b9de0d9daef05beecaaf9289dd3655a9", "score": "0.56719154", "text": "def profile_complete?\n unless current_volunteer.profile_complete\n redirect_to :action => 'profile'\n end\n end", "title": "" }, { "docid": "f4597e1aa2fc05708be1a1f096cb0283", "score": "0.56682026", "text": "def is_profile_complete\n if current_user\n @security_users_detail = SecurityUsersDetail.find_by_security_user_id(current_user.id)\n unless current_user.is_profile_completed\n if @security_users_detail.nil?\n current_user.set_default_relations\n end\n redirect_to edit_security_users_detail_path(SecurityUsersDetail.find_by_security_user_id(current_user.id))\n end\n end\n end", "title": "" }, { "docid": "b886986a2f323d0d336f9dc97492421b", "score": "0.5663219", "text": "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Candidate\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "title": "" }, { "docid": "97c78b529abc6d3a30d34934d0bae8fd", "score": "0.56576824", "text": "def create_profile!\n cert = certificate_to_use\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name] || [bundle_id, profile_type.pretty_type].join(' ')\n\n unless Sigh.config[:skip_fetch_profiles]\n if Spaceship.provisioning_profile.all.find { |p| p.name == name }\n UI.error(\"The name '#{name}' is already taken, using another one.\")\n name += \" #{Time.now.to_i}\"\n end\n end\n\n UI.important(\"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}' for '#{Sigh.config[:platform]}' platform\")\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id,\n certificate: cert,\n mac: Sigh.config[:platform].to_s == 'macos',\n sub_platform: Sigh.config[:platform].to_s == 'tvos' ? 'tvOS' : nil,\n template_name: Sigh.config[:template_name])\n profile\n end", "title": "" }, { "docid": "7d4da984c0dde287d085a0e191caab25", "score": "0.56547904", "text": "def create\n @professional_skill = current_profile.professional_skills.create(professional_skill_params)\n\n respond_to do |format|\n if @professional_skill.save\n format.html { redirect_to profile_professional_skills_path, notice: 'Professional skill was successfully created.' }\n format.json { render :show, status: :created, location: @professional_skill }\n else\n format.html { render :new }\n format.json { render json: @professional_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d046d6a7b177e539fc4c1686b86d9de5", "score": "0.56538236", "text": "def create\n # Uses the parameters from the form to create a new profile\n @profile = Profile.new(profile_params)\n # If the profile is a mentor and/or mentee, sets their initial availability for that role(s) to true\n if @profile.mentor == true\n @profile.mentor_availability = true\n end\n if @profile.mentee == true\n @profile.mentee_availability = true\n end\n # Adds in the user_id to the profile (so that the Profile model can relate to the User model - one Profile has one User (required) and one User can have one Profile (optional))\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: \"Profile was successfully created.\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd6f50a2213170e57d2ddec4afc4e840", "score": "0.56535333", "text": "def require_submit_profile\n #debugger\n if user_signed_in? && current_user.profile.nil?\n flash[:alert]=\"Please First submit\"\n redirect_to new_profile_path\n #redirect_to edit_profile_path(current_user.profile.id)\n end \n end", "title": "" }, { "docid": "0c722c6e4a1c6c56a5af8356d049f0ef", "score": "0.56417316", "text": "def add_pro_hired?(pro_user)\n users_pro_shares.find_by_professional_id(pro_user.id)\n end", "title": "" }, { "docid": "9c738c4809a76ef66e66842f8418433d", "score": "0.56302136", "text": "def require_profile\n if current_user and not current_user.default_profile\n redirect_to new_profile_path and return false\n end\n end", "title": "" }, { "docid": "0a3458bb8f2a5ac10a8c57252a405934", "score": "0.56203526", "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": "3e409a6fc5dc79e0b1fd5a47eb5b2e0a", "score": "0.56187665", "text": "def index\n # @profiles = Profile.all\n # if @profile = Profile.where(user_id: current_user.id) \n\n # else\n # redirect_to household_items_path, notice: \"This is not your profile. You are only allowed to view your own profile page.\"\n # end\n end", "title": "" }, { "docid": "c2d8c58f88927b890418bb3647b62aad", "score": "0.5617017", "text": "def add_profile(profile)\n profile.account = self\n @profiles << profile unless @profiles.include?(profile)\n end", "title": "" }, { "docid": "a6e7f69b0522b03b85d93a131344e50d", "score": "0.56164736", "text": "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Candidate\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "title": "" }, { "docid": "a6b899934c7b176ae18ea38279e9b4f1", "score": "0.56096673", "text": "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Employer\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "title": "" }, { "docid": "70a5c1c91a602d99bd99947b06d25c9f", "score": "0.5604691", "text": "def profile_view\n sleeper(25)\n page(FooterTabBarPage).select_tab(\"Profile\")\n sleeper(25)\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(SubmissionPage).select_action(\"Saved\")\nend", "title": "" }, { "docid": "5f583f345a04d09ae28f2609337eb202", "score": "0.56026405", "text": "def check_current_profile\n if user_signed_in?\n if current_user.profile_type == \"Employer\"\n redirect_to root_path , notice:\"Not authorised to view this page\"\n end\n end\n end", "title": "" }, { "docid": "c68533aa5b314f66dd05f8b8ddf23f63", "score": "0.55973977", "text": "def profile\n if current_user.update(ign_profile_params)\n flash[:success] = \"Profile Complete! Go To The My Account Page To Add Games And Set Presences.\"\n redirect_to root_path\n else\n if (current_user.errors.messages.keys-User::IGN_USER_NAME_FIELD).empty?\n current_user.reload\n\t\t\t\tcurrent_user.validate_dublicate_ign = false\n current_user.update(profile_params)\n current_user.assign_attributes(ign_profile_params)\n\t\t\t\tcurrent_user.validate_dublicate_ign = true\n\t\t\t\tcurrent_user.valid?\n render :ign_user_profile\n else\n render :user_profile\n end\n end\n end", "title": "" }, { "docid": "000bc55f80397bfa0b0979fb7c3b7617", "score": "0.5586878", "text": "def button_down_create_profile(id, x, y)\n if (@ok_button2.mouse_inside? and id == MsLeft) or id == KbReturn\n name_included = false\n @profiles.each do |p|\n name_included = true if p.name == @text_input.text\n end\n name_included = true if @text_input.text.upcase == \"GUEST\" or @text_input.text == \"\"\n if name_included\n @message = \"'#{@text_input.text}' ist not available. Please try again.\"\n @text_input.text = \"\"\n elsif @big_font.text_width(@text_input.text) > 640\n @message = \"'#{@text_input.text}' is too long. Please try again.\"\n else\n @player = Profile.new(@text_input.text)\n @profiles << @player\n save_profiles\n puts \"Profile '#{@player.name}' was created\"\n @text_input.deactivate\n @no_profiles = false\n @profile_menu.update_options(@profiles, 0, \"name\")\n @game_state = :main_menu\n end\n elsif id == MsLeft and y > HEIGHT-100 and x < 200\n @game_state = :profile_menu\n end\n end", "title": "" }, { "docid": "04ca6268a6367e660213c2a37ae0d17f", "score": "0.5584866", "text": "def beverlyhillsuser\n if user_signed_in?\n @profpic = ProfilePic.where('profile_pics.id' => current_user.id).first\n end\n @user = User.find(params[:id])\n @profiles = Profile.find(params[:id])\n end", "title": "" }, { "docid": "0cb1cf8833aec588135080dd61a4169e", "score": "0.5583401", "text": "def check_profile_exists\n profile = Profile.find_by_user_id(current_user.id)\n\n # If profile is not found it will be set to nil and this will redirect to creating a profile\n unless profile \n redirect_to new_user_profile_path()\n end\n end", "title": "" }, { "docid": "a4c4090df599dbc3b575db920abcb001", "score": "0.55798984", "text": "def existing_user_needs_credits?\n !new_user? && !have_played_quiz?\n end", "title": "" }, { "docid": "bace7b755b2726394c5e6168203c012a", "score": "0.55794847", "text": "def create\n @profile = Profile.new(profile_params)\n # To have the user id from user.\n @profile.user = current_user\n # if profile_params[:privacy] == \"1\"\n # @profile.privacy = true\n # else\n # @profile.privacy = false\n # end\n if @profile.privacy == true\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:privacy]=\"Please acknowledge that you have read and acknowledged of the company privacy policy\"\n render :new\n end\n end", "title": "" }, { "docid": "9b8bb5ea932fd6820ac822736dd20228", "score": "0.5572908", "text": "def profile_attribute_check(profile)\n\n # Check is freelancer title visible, and check attributes as Freelancer / Else, will check Company's Attributes\n if @profile_page.is_freelancer_title_displayed\n\n # Getting values from Freelancer's attributes (Name, title, Description)\n\n @profile_page.wait_for_freelancer_skills_displayed\n freelancer_name = @profile_page.get_freelancer_name_text\n freelancer_title = @profile_page.get_freelancer_title_text\n freelancer_description = @profile_page.get_freelancer_description_text\n freelancer_skills = if @profile_page.is_freelancer_skills_displayed\n @profile_page.get_freelancer_skills\n end\n\n freelancer_profile = FreelancerProfile.new(freelancer_name, freelancer_title, freelancer_description, freelancer_skills)\n check(profile, freelancer_profile)\n else\n\n # Getting values from Company's attributes (Name, title, Description)\n\n @profile_page.wait_for_company_skills_displayed\n company_name = @profile_page.get_company_name_text\n company_title = @profile_page.get_company_title_text\n company_description = @profile_page.get_company_description_text\n freelancer_skills = if @profile_page.is_company_skills_displayed\n @profile_page.get_company_skills\n end\n\n freelancer_profile = FreelancerProfile.new(company_name, company_title, company_description, freelancer_skills)\n check(profile, freelancer_profile)\n end\n end", "title": "" }, { "docid": "14e87ec00a01117065c667ecfd823cad", "score": "0.5570769", "text": "def must_have_current_household_profile\n if persisted? && !current_household_profile\n errors.add(:base, \"Current demographic profile is out of date\")\n end\n end", "title": "" }, { "docid": "c29a467a2fd25a41ce24427c10b22bfe", "score": "0.55704886", "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": "3b9690f71ae6c56ae34fba5d5ea70ce1", "score": "0.5559158", "text": "def set_profile\n # if profile_signed_in?\n \n # @profile = Profile.find(current_profile)\n # else\n @profile = Profile.find(params[:id])\n # end\n \n end", "title": "" }, { "docid": "5d48f5817058d0d719a0e1cc61ff3ef1", "score": "0.55590093", "text": "def user_profile\n\tend", "title": "" }, { "docid": "b4eb84f3b0fa18666936d5968fce8231", "score": "0.55578995", "text": "def add_user_abilities!; end", "title": "" }, { "docid": "99cf039988f3a99b25c0e40a6543bec6", "score": "0.55563885", "text": "def myProfile\n @checkFor = current_user\n authorize @checkFor\n @user = current_user\n # @courses = @user.courses.all\n end", "title": "" }, { "docid": "694c9acc2c1b9dc1f6d31315fa061631", "score": "0.55563533", "text": "def new\n @profile ||= current_user.profiles.new\n current_user.properties.reload\n end", "title": "" }, { "docid": "4953f2b8911a25308324963c0801f854", "score": "0.55555063", "text": "def profile_required=(value)\n @profile_required = value\n end", "title": "" }, { "docid": "bf0c849e7494d86aef753cb6cb4035a6", "score": "0.5550092", "text": "def profile_payable?\n is_profile_owner? && !(locked? && %w[tos account].include?(lock_type))\n end", "title": "" }, { "docid": "3f551636672bf55ff1d05c95486d58b0", "score": "0.5537796", "text": "def has_only_profile?\n profile.present? && tag_name.blank?\n end", "title": "" }, { "docid": "9d79dbb615b387e58bdd26106ca81337", "score": "0.553622", "text": "def payment_profile\n end", "title": "" }, { "docid": "f54aa02cac9289341e51effefb863d61", "score": "0.5530827", "text": "def action_create # rubocop:disable Metrics/MethodLength\n if @current_resource.created\n Chef::Log.debug \"#{new_resource.profile_name} already created\"\n else\n converge_by \"Creating WebSphere profile #{new_resource.profile_name}\" do\n manageprofiles :create,\n new_resource._?(:admin_password, '-adminPassword'),\n new_resource._?(:admin_username, '-adminUserName'),\n new_resource._?(:apply_perf_tuning_setting,\n '-applyPerfTuningSetting'),\n new_resource._?(:app_server_node_name, '-appServerNodeName'),\n new_resource._?(:cell_name, '-cellName'),\n new_resource._?(:default_port, '-defaultPorts'),\n new_resource._?(:dmgr_admin_password, '-dmgrAdminPassword'),\n new_resource._?(:dmgr_admin_username, '-dmgrAdminUserName'),\n new_resource._?(:dmgr_host, '-dmgrHost'),\n new_resource._?(:dmgr_port, '-dmgrPort'),\n new_resource._?(:dmgr_profile_path, '-dmgrProfilePath'),\n new_resource._?(:enable_admin_security, '-enableAdminSecurity'),\n new_resource._?(:enable_service, '-enableService'),\n new_resource._?(:federate_later, '-federateLater'),\n new_resource._?(:host_name, '-hostName'),\n new_resource._?(:import_personal_cert_ks, '-importPersonalCertKS'),\n new_resource._?(:import_personal_cert_ks_alias,\n '-importPersonalCertKSAlias'),\n new_resource._?(:import_personal_cert_ks_password,\n '-importPersonalCertKSPassword'),\n new_resource._?(:import_personal_cert_ks_type,\n '-importPersonalCertKSType'),\n new_resource._?(:import_signing_cert_ks, '-importSigningCertKS'),\n new_resource._?(:import_signing_cert_ks_alias,\n '-importSigningCertKSAlias'),\n new_resource._?(:import_signing_cert_ks_password,\n '-importSigningCertKSPassword'),\n new_resource._?(:import_signing_cert_ks_type,\n '-importSigningCertKSType'),\n new_resource._?(:is_default, '-isDefault'),\n new_resource._?(:is_developer_server, '-isDeveloperServer'),\n new_resource._?(:key_store_password, '-keyStorePassword'),\n new_resource._?(:node_name, '-nodeName'),\n new_resource._?(:personal_cert_dn, '-personalCertDN'),\n new_resource._?(:personal_cert_validity_period,\n '-personalCertValidityPeriod'),\n new_resource._?(:ports_file, '-portsFile'),\n new_resource._?(:profile_name, '-profileName'),\n new_resource._?(:profile_path, '-profilePath'),\n new_resource._?(:reponse_file, '-response'),\n new_resource._?(:server_name, '-serverName'),\n new_resource._?(:server_type, '-serverType'),\n new_resource._?(:service_user_name, '-serviceUserName'),\n new_resource._?(:set_default_name, '-setDefaultName'),\n new_resource._?(:signing_cert_dn, '-signingCertDN'),\n new_resource._?(:signing_cert_validity_period,\n '-signingCertValidityPeriod'),\n new_resource._?(:starting_port, '-startingPort'),\n new_resource._?(:template_path, '-templatePath'),\n new_resource._?(:validate_ports, '-validatePorts'),\n new_resource._?(:validate_registry, '-validateRegistry'),\n new_resource._?(:webserver_check, '-webServerCheck'),\n new_resource._?(:webserver_hostname, '-webServerHostname'),\n new_resource._?(:webserver_install_path, '-webServerInstallPath'),\n new_resource._?(:webserver_name, '-webServerName'),\n new_resource._?(:webserver_os, '-webServerOS'),\n new_resource._?(:webserver_plugin_path, '-webServerPluginPath'),\n new_resource._?(:webserver_port, '-webServerPort'),\n new_resource._?(:webserver_type, '-webServerType')\n end\n new_resource.updated_by_last_action(true)\n end\n load_new_resource_state\n new_resource.created(true)\n end", "title": "" }, { "docid": "b0430c893f998ebdabd6096e11825e5d", "score": "0.5524362", "text": "def new?\n profile\n @new\n end", "title": "" }, { "docid": "a53bfe5606100705d21b135662f77ba0", "score": "0.5522988", "text": "def ensure_user_profile\n if not current_user.user_profiles.any?\n session[:user_profile_return_to] ||= request.original_fullpath\n redirect_to new_user_profile_path, notice: 'Before continuing, can you tell us a bit more about yourself?'\n end\n end", "title": "" }, { "docid": "ec3864f32152271f692732d863af7d41", "score": "0.55222726", "text": "def skill_can_use?(skill)\n return false unless skill_learn?(skill)\n return super\n end", "title": "" }, { "docid": "44ffee65310cc6015b155bc5689abaa4", "score": "0.55166316", "text": "def profile?\n !!@profile\n end", "title": "" }, { "docid": "36406b47cc3a68b99572958c5f875ca6", "score": "0.5516012", "text": "def check_status\n\t\t@shop = ShopProfile.find_by(id: params[:shop_profile_id])\n\t\tif @shop.is_approved == false\n\t\t\tflash[:danger] = 'You are not approved to add products'\n\t\t\tredirect_to root_path\n\t\tend\n\tend", "title": "" }, { "docid": "5fc3642ab03b958b7c6f93a30c6ad756", "score": "0.5514706", "text": "def profile_active?(profile_id)\n profiles.has_key? profile_id\n end", "title": "" }, { "docid": "24799c5cce94e0955e2614220e94a709", "score": "0.55140054", "text": "def ask_equip_skills\n\tend", "title": "" }, { "docid": "af7174df9635ab293de54ce9bebe6e7d", "score": "0.55139875", "text": "def create_row_have_skill\n @have_skill = HaveSkill.new\n\n @have_skill.user_id = current_user.id\n @have_skill.skill_id = params[:full_skill_name]\n @have_skill.skill_category = Skill.find_by(id: params[:full_skill_name]).skill_category\n @have_skill.skill_subcategory = Skill.find_by(id: params[:full_skill_name]).skill_subcategory\n @have_skill.skill_description = Skill.find_by(id: params[:full_skill_name]).skill_description\n\n save_status = @have_skill.save\n\n if save_status == true\n #redirect_to(\"/have_skills\", :notice => \"Have skill created successfully.\")\n #render(\"profiles/new_profile.html.erb\")\n new_profile\n else\n #render(\"have_skills_templates/new_form.html.erb\")\n new_profile\n #render(\"profiles/new_profile.html.erb\")\n\n end\n end", "title": "" }, { "docid": "2dedf73bb6ee568a8c7bb9954f1de683", "score": "0.5511158", "text": "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n if current_user.profile\n # TODO(costan): add to the list of secondary profiles\n else\n current_user.update_attributes! :profile => @profile\n end\n\n format.html { redirect_to session_path }\n format.xml { render :xml => @profile, :status => :created, :location => @profile } \n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c83546bba898bad03180900d369662fd", "score": "0.55099195", "text": "def add_profile(member)\n filter_profiles.create(profile: member, is_approved: true)\n end", "title": "" }, { "docid": "2281e0060763e325789d5be48045d41f", "score": "0.5507107", "text": "def get_profile\n\n end", "title": "" }, { "docid": "a0159bc6afc63f36f0484e5d6fc7d1fc", "score": "0.5506734", "text": "def profile_get_info(profile)\n @record = @profile = profile\n @profile_policies = @profile.miq_policies.sort_by { |p| [p.towhat, p.mode, p.description.downcase] }\n @right_cell_text = _(\"Policy Profile \\\"%{name}\\\"\") % {:name => @profile.description}\n @right_cell_div = \"profile_details\"\n end", "title": "" }, { "docid": "583bcc84b4b523744cf0a0529819a1a4", "score": "0.55032384", "text": "def complete_profile\n @user = current_user\n authorize @user\n end", "title": "" }, { "docid": "8860c0c2bdaf0e433e884f40c8cd0ac4", "score": "0.5501141", "text": "def profiles; end", "title": "" }, { "docid": "8860c0c2bdaf0e433e884f40c8cd0ac4", "score": "0.5501141", "text": "def profiles; end", "title": "" }, { "docid": "1a316993246877173aebd9e685e007de", "score": "0.5500847", "text": "def show\n @user = current_user\n @therapist = @user.getProfileable \n render_wizard\n end", "title": "" } ]
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "d42e01ecbf24af0c33420900f25307da", "score": "0.6115859", "text": "def new_input_set()\n return GetBodyFatGoalInputSet.new()\n end", "title": "" } ]
[ { "docid": "d8eb34cfc5a1e737977f7023d4849c46", "score": "0.6740161", "text": "def new_input_set()\n return CreateObjectInputSet.new()\n end", "title": "" }, { "docid": "7c0d7c433cd4eb8e36bdc3a383e9ec33", "score": "0.65792465", "text": "def new_input_set()\n return RunRightScriptInputSet.new()\n end", "title": "" }, { "docid": "9a1c545ea1874b95135d6fa2e97a3506", "score": "0.65558183", "text": "def new_input_set()\n return InfluenceInputSet.new()\n end", "title": "" }, { "docid": "29907c20e026c8e930162f65d638136a", "score": "0.65377295", "text": "def new_input_set()\n return CreateSpreadsheetInputSet.new()\n end", "title": "" }, { "docid": "2c34e688c22d54eee9ac73db29a9af31", "score": "0.651472", "text": "def new_input_set()\n return RetrieveSpreadsheetsInputSet.new()\n end", "title": "" }, { "docid": "550b21e09ba37b82468d9f6bcdb25a60", "score": "0.64984775", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.6492179", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.649148", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.649148", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.649148", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "379f2bad1ebdcf9ebf33ef4260d37912", "score": "0.649148", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "b5b19e14ef652ba534c75a67d28d5236", "score": "0.64756495", "text": "def new_input_set()\n return ObjectGetInputSet.new()\n end", "title": "" }, { "docid": "5c261c4f514387dc0bd2e36bca490fd9", "score": "0.6469548", "text": "def new_input_set()\n return SetMetadataInputSet.new()\n end", "title": "" }, { "docid": "f8d996fb44a483923da55677c9ea943f", "score": "0.6459141", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "f8d996fb44a483923da55677c9ea943f", "score": "0.6459141", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "f8d996fb44a483923da55677c9ea943f", "score": "0.6459141", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "f8d996fb44a483923da55677c9ea943f", "score": "0.6459141", "text": "def new_input_set()\n return GetInputSet.new()\n end", "title": "" }, { "docid": "d55def6014dc613a08ef1401ddcfa074", "score": "0.6420778", "text": "def new_input_set()\n return BasicInputSet.new()\n end", "title": "" }, { "docid": "cf3e71bcb13be6d948718b9d1e7354bc", "score": "0.6380302", "text": "def new_input_set()\n return ProgramsInputSet.new()\n end", "title": "" }, { "docid": "b1a874e2ec5274ef3952f3e169d22eba", "score": "0.63723844", "text": "def new_input_set()\n return SetFileInputSet.new()\n end", "title": "" }, { "docid": "25879866dea24acc89b70986cf01ac98", "score": "0.63670284", "text": "def new_input_set()\n return PutObjectInputSet.new()\n end", "title": "" }, { "docid": "56b7ea1d7ddc8a60e0537ad5f22679c9", "score": "0.6361878", "text": "def new_input_set()\n return PutInputSet.new()\n end", "title": "" }, { "docid": "f209c20373044baac4b4f6157c773b86", "score": "0.63599646", "text": "def new_input_set()\n return RunInstancesInputSet.new()\n end", "title": "" }, { "docid": "bb497e0ab4991de72c54da5c0fb52583", "score": "0.6355693", "text": "def new_input_set()\n return RunCommandInputSet.new()\n end", "title": "" }, { "docid": "b56b28461b85253e529b25dfee370051", "score": "0.633107", "text": "def new_input_set()\n return GetEntityInputSet.new()\n end", "title": "" }, { "docid": "066356cae9f13cc656a69bf4b5db5fb7", "score": "0.63238645", "text": "def new_input_set()\n return BiosInputSet.new()\n end", "title": "" }, { "docid": "87d45711e5820be0aa278888ebc9e8f5", "score": "0.6307875", "text": "def new_input_set()\n return GetInstanceInputSet.new()\n end", "title": "" }, { "docid": "00dadedc1b0f258f11e02f7c22d148ba", "score": "0.63016987", "text": "def new_input_set()\n return GetUserExercisesInputSet.new()\n end", "title": "" }, { "docid": "a914ec52ac98475f1670cfd25388079f", "score": "0.63006276", "text": "def new_input_set()\n return GetExerciseInputSet.new()\n end", "title": "" }, { "docid": "a914ec52ac98475f1670cfd25388079f", "score": "0.63006276", "text": "def new_input_set()\n return GetExerciseInputSet.new()\n end", "title": "" }, { "docid": "709d525e0e00485c79b0309ce3bb1798", "score": "0.62943053", "text": "def new_input_set()\n return BatchInputSet.new()\n end", "title": "" }, { "docid": "404f3e7d7fcabdc3dd4f812917053cc9", "score": "0.62727773", "text": "def new_input_set()\n return ObjectSetInputSet.new()\n end", "title": "" }, { "docid": "ee223e52966b1d6604840d09929b90a6", "score": "0.62659407", "text": "def new_input_set()\n return UserInputSet.new()\n end", "title": "" }, { "docid": "bf2828072767f9efa0a0fb9b08f720d8", "score": "0.62627876", "text": "def new_input_set()\n return RetrieveWorksheetInputSet.new()\n end", "title": "" }, { "docid": "f3959501a2a021b252c666d045d3f234", "score": "0.6261033", "text": "def new_input_set()\n return Step1InputSet.new()\n end", "title": "" }, { "docid": "5532b50427f87e1b76abdbf99fac74b7", "score": "0.62600076", "text": "def new_input_set()\n return GetUserInputSet.new()\n end", "title": "" }, { "docid": "5532b50427f87e1b76abdbf99fac74b7", "score": "0.62600076", "text": "def new_input_set()\n return GetUserInputSet.new()\n end", "title": "" }, { "docid": "5532b50427f87e1b76abdbf99fac74b7", "score": "0.62600076", "text": "def new_input_set()\n return GetUserInputSet.new()\n end", "title": "" }, { "docid": "c052bcbb503b9e0b18bbe118631b548c", "score": "0.6254901", "text": "def new_input_set()\n return UpdateWorksheetInputSet.new()\n end", "title": "" }, { "docid": "c7705f845a9c6ea4e427a87735be5b51", "score": "0.6247919", "text": "def new_input_set()\n return RetrieveWorksheetsInputSet.new()\n end", "title": "" }, { "docid": "769d3f34ee661176af63874d07074fbb", "score": "0.6247774", "text": "def new_input_set()\n return CreateIdentityInputSet.new()\n end", "title": "" }, { "docid": "ffe7e3b018e447db78c5a0518f998870", "score": "0.6244586", "text": "def new_input_set()\n return MakeCallInputSet.new()\n end", "title": "" }, { "docid": "467b4e0e6f3a9454c990d0e286bf620b", "score": "0.6242735", "text": "def new_input_set()\n return RequestInputSet.new()\n end", "title": "" }, { "docid": "79843878bb9300894fb2199f81979b2b", "score": "0.62294745", "text": "def new_input_set()\n return ShoutInputSet.new()\n end", "title": "" }, { "docid": "79843878bb9300894fb2199f81979b2b", "score": "0.62294745", "text": "def new_input_set()\n return ShoutInputSet.new()\n end", "title": "" }, { "docid": "4aa3f85ab03137f36f633df9f38ea681", "score": "0.62285006", "text": "def new_input_set()\n return GetRequestInputSet.new()\n end", "title": "" }, { "docid": "7b8d3703808fe08c19e80b412c2b0e18", "score": "0.62236124", "text": "def new_input_set()\n return ZipObjectInputSet.new()\n end", "title": "" }, { "docid": "6eb6b8cd034e679fe98e77647f2476f9", "score": "0.6222381", "text": "def new_input_set()\n return GetObjectInputSet.new()\n end", "title": "" }, { "docid": "8eb9fefe6b62239f6988ebc1527b8479", "score": "0.6216551", "text": "def new_input_set()\n return SetupAppInputSet.new()\n end", "title": "" }, { "docid": "bf770232f660ecdb3d38d56dadfc5428", "score": "0.6209467", "text": "def new_input_set()\n return UpdateObjectInputSet.new()\n end", "title": "" }, { "docid": "611b2696535f52c9aa1ceb3cbe28707e", "score": "0.62094086", "text": "def new_input_set()\n return ByIDInputSet.new()\n end", "title": "" }, { "docid": "1a97f67cb954a4e66621ab0d75eae4a4", "score": "0.619902", "text": "def new_input_set()\n return CreateRunInputSet.new()\n end", "title": "" }, { "docid": "0b7e9cc6194b00c39e6628fa4230e482", "score": "0.61985475", "text": "def new_input_set()\n return PromptInputSet.new()\n end", "title": "" }, { "docid": "182a6a0d363403c3cc8dd6367a6124a4", "score": "0.6185518", "text": "def new_input_set()\n return CreateUserInputSet.new()\n end", "title": "" }, { "docid": "182a6a0d363403c3cc8dd6367a6124a4", "score": "0.6185518", "text": "def new_input_set()\n return CreateUserInputSet.new()\n end", "title": "" }, { "docid": "182a6a0d363403c3cc8dd6367a6124a4", "score": "0.6185518", "text": "def new_input_set()\n return CreateUserInputSet.new()\n end", "title": "" }, { "docid": "0cb71aa600d05441ccd00b08dfb8e48b", "score": "0.6183522", "text": "def new_input_set()\n return JSONInputSet.new()\n end", "title": "" }, { "docid": "62fe51e141f384411c60877192d0ec81", "score": "0.61817986", "text": "def new_input_set()\n return XLSToXMLInputSet.new()\n end", "title": "" }, { "docid": "5376915a27d7fb0b51877c970f87d041", "score": "0.6178847", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "5376915a27d7fb0b51877c970f87d041", "score": "0.6178847", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "5376915a27d7fb0b51877c970f87d041", "score": "0.6178847", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "5376915a27d7fb0b51877c970f87d041", "score": "0.6178847", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "5376915a27d7fb0b51877c970f87d041", "score": "0.6178847", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "bd0101b9e34c6803ca688f3d948e95c2", "score": "0.61736256", "text": "def new_input_set()\n return CheckinsInputSet.new()\n end", "title": "" }, { "docid": "7538b39dab9bcfd3cbb8ebc7d7d657fd", "score": "0.6172978", "text": "def new_input_set()\n return GetBatchEntitiesInputSet.new()\n end", "title": "" }, { "docid": "a9a72e1a6d46022f4fdd1f0c5c997aaa", "score": "0.61502624", "text": "def new_input_set()\n return RequestBodyHelperInputSet.new()\n end", "title": "" }, { "docid": "030769a221222accfa48c98dd3b5b82e", "score": "0.6149625", "text": "def new_input_set()\n return GetFileInputSet.new()\n end", "title": "" }, { "docid": "030769a221222accfa48c98dd3b5b82e", "score": "0.6149625", "text": "def new_input_set()\n return GetFileInputSet.new()\n end", "title": "" }, { "docid": "dd365cc11da27c281ef655ce6724d65a", "score": "0.614949", "text": "def new_input_set()\n return AllExercisesInputSet.new()\n end", "title": "" }, { "docid": "02cfd8f8f3979788d2f27409445d4875", "score": "0.6147385", "text": "def new_input_set()\n return AddWorksheetInputSet.new()\n end", "title": "" }, { "docid": "4efc0cadb538e9a2c27ec5236a0ecd34", "score": "0.6140712", "text": "def new_input_set()\n return ReadRunsInputSet.new()\n end", "title": "" }, { "docid": "d2521e23ead007b8b93906ddc8040ab8", "score": "0.6138477", "text": "def new_input_set()\n return UpdateInputSet.new()\n end", "title": "" }, { "docid": "9e4cf9a96e0c729dad5744955375204e", "score": "0.61349106", "text": "def new_input_set()\n return XMLInputSet.new()\n end", "title": "" }, { "docid": "00d56ff820361b7d760fa7b5e7858fd5", "score": "0.61312973", "text": "def new_input_set()\n return GetObjectMetadataInputSet.new()\n end", "title": "" }, { "docid": "836c2c9cc39285b687b5de5a70317769", "score": "0.61311215", "text": "def new_input_set()\n return PersonInputSet.new()\n end", "title": "" }, { "docid": "d8942e33f2e07cacde796302ca285385", "score": "0.6130533", "text": "def new_input_set()\n return GetIdentityInfoInputSet.new()\n end", "title": "" }, { "docid": "7d73a56c10e7fa37f258709d4b288d8b", "score": "0.6123586", "text": "def new_input_set()\n return WeatherForPointsOnLineSummarizedInputSet.new()\n end", "title": "" }, { "docid": "6b5d8cc7010422f605bc3d1d42777f00", "score": "0.61184305", "text": "def new_input_set()\n return BooksInputSet.new()\n end", "title": "" }, { "docid": "479e1a1717b71707d4cb7407537912c1", "score": "0.61139137", "text": "def new_input_set()\n return GetFoodsInputSet.new()\n end", "title": "" }, { "docid": "6691e89220dd2cf94464453b920ca2ba", "score": "0.6113304", "text": "def new_input_set()\n return CreateApplicationInputSet.new()\n end", "title": "" }, { "docid": "f68b9c0f9f8907610bc7c6aa2971e6e1", "score": "0.6112922", "text": "def new_input_set()\n return GetApplicationInputSet.new()\n end", "title": "" }, { "docid": "2a912f01ea4aeedea2ef244ac39530a1", "score": "0.6110259", "text": "def new_input_set()\n return GetFoodsInputSet.new()\n end", "title": "" }, { "docid": "605dbe1e383f90060126a3df550624a1", "score": "0.6107305", "text": "def new_input_set()\n return FindStoriesByIDInputSet.new()\n end", "title": "" }, { "docid": "5fa506746a74f11c5f20a3011338bc8e", "score": "0.6105043", "text": "def new_input_set()\n return GetRecommendationsInputSet.new()\n end", "title": "" }, { "docid": "42de1999e12fad7d4bda6074a6262364", "score": "0.61033785", "text": "def new_input_set()\n return GetActivitiesInputSet.new()\n end", "title": "" }, { "docid": "178aa355ac1f2e4a14d11cdcdbf9c0e1", "score": "0.60996526", "text": "def new_input_set()\n return ReadProductInputSet.new()\n end", "title": "" }, { "docid": "ed0006e02a92f1f30f84ad61e8963bdc", "score": "0.60936093", "text": "def new_input_set()\n return LaunchArrayInstanceInputSet.new()\n end", "title": "" }, { "docid": "29ff45390f218209f53a64d677310cc7", "score": "0.6080745", "text": "def new_input_set()\n return GetActivitiesInputSet.new()\n end", "title": "" }, { "docid": "cd5134586aa1285a01ea54514f3e1190", "score": "0.6080311", "text": "def new_input_set()\n return GetRelationshipInputSet.new()\n end", "title": "" }, { "docid": "068666118f42a5a46dc9efe821367cb3", "score": "0.60787976", "text": "def new_input_set()\n return RetrieveUserInputSet.new()\n end", "title": "" }, { "docid": "dfebd182fc2ae9ee2b32d74ecded10eb", "score": "0.60776675", "text": "def new_input_set()\n return ReadGraphInputSet.new()\n end", "title": "" }, { "docid": "3cf345f748d4247aab680a45a4f89946", "score": "0.607729", "text": "def new_input_set()\n return UpdateUserInputSet.new()\n end", "title": "" }, { "docid": "3cf345f748d4247aab680a45a4f89946", "score": "0.607729", "text": "def new_input_set()\n return UpdateUserInputSet.new()\n end", "title": "" }, { "docid": "3cf345f748d4247aab680a45a4f89946", "score": "0.607729", "text": "def new_input_set()\n return UpdateUserInputSet.new()\n end", "title": "" } ]
a65db594b18702741e149ed9c3ff9017
GET /offerings/1 GET /offerings/1.js GET /offerings/1.json
[ { "docid": "b06629756eff5a86ec04285f41915e02", "score": "0.73440015", "text": "def show\n ## Creating the offering object\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html { get_collections and render :index }\n format.json { render json: @offering }\n format.js {}\n end\n end", "title": "" } ]
[ { "docid": "bc53898e169e5f1d2b8460a2f2813d6e", "score": "0.75844663", "text": "def index\n\n get_collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n format.js {}\n end\n end", "title": "" }, { "docid": "1e00651d75d6a36f2472a879b9ed0175", "score": "0.7561356", "text": "def index\n @offerings = Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end", "title": "" }, { "docid": "f2eb41f34d532623753b377dfcdcdd61", "score": "0.7350005", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "a73b02a25e474334a8423dc2d174f5ea", "score": "0.72531736", "text": "def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offering }\n end\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.719255", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.719255", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "9d61a43a1561e69a82b9ea492cf2b9d6", "score": "0.719255", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "d019bd1853a72c3c85667866bcbaf988", "score": "0.7083614", "text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "title": "" }, { "docid": "616820d9ceee544200c2ae8ee4ed93d3", "score": "0.68770355", "text": "def show\n @resource = Resource.find(params[:resource_id])\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "623eacccdc010f5e7c7312f7ee59ba8f", "score": "0.6874185", "text": "def index\n respond_to do |format|\n format.html\n format.js\n format.json { render json: @assignment_offerings }\n end\n end", "title": "" }, { "docid": "34f836afe96296b2bdf2a1ed2266383e", "score": "0.68354946", "text": "def index\n @offerings = Offering.all\n end", "title": "" }, { "docid": "979449d13f28edb94319ac7e03aa2c92", "score": "0.67732006", "text": "def show\n render status: 200, json: @dining_offer\n end", "title": "" }, { "docid": "62381998eaddcf4c0366aff3f8e7f057", "score": "0.675325", "text": "def show\n @admin_offer = Admin::Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_offer }\n end\n end", "title": "" }, { "docid": "62ccfc3f0abde22759b78c1f6b8b09ff", "score": "0.6722539", "text": "def index\n @offerings = Offering.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offerings }\n end\n end", "title": "" }, { "docid": "dab09f0ff1d8116ce4be3518c3ff0049", "score": "0.66913426", "text": "def show\n @resource_offer = ResourceOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_offer }\n end\n end", "title": "" }, { "docid": "480ebc89a9de0420c1de3364f3a2eec0", "score": "0.6690357", "text": "def index\n @admin_offers = Admin::Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_offers }\n end\n end", "title": "" }, { "docid": "8ac2203040b49c0dcdb3a2fab8a2953e", "score": "0.6663666", "text": "def index\n @offerings = Offering.search(params)\n respond_to do |format|\n format.html\n format.json {render :json => @offerings.to_json}\n format.xml {render :xml => @offerings.to_xml}\n end\n end", "title": "" }, { "docid": "e3e94cde6f497ba8234ab48802ecee47", "score": "0.665421", "text": "def show\n @offer = @request.offers.find(params[:id])\n end", "title": "" }, { "docid": "f0c29e71c31905155636b619dcb1ee64", "score": "0.6550574", "text": "def show\n\t\t@offers = @offer\n\t\t@json = @offers.to_gmaps4rails\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @json }\n\t\tend\n\tend", "title": "" }, { "docid": "caabaa02632f9b04975555932f3c5fdd", "score": "0.6536838", "text": "def index\n @offers = @request.offers\n\n end", "title": "" }, { "docid": "7f47a1014a99be7230782ce9a237237b", "score": "0.65359753", "text": "def get(params = {})\n client.get(\"/v2/shopping/hotel-offers/#{@offer_id}\", params)\n end", "title": "" }, { "docid": "8bcf716647e4f58db2caab28cd44d503", "score": "0.6507101", "text": "def show\n # return redirect_to offers_path unless @offer.is_parent_offer?\n setup_ratings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "d31191c89f01405699c9d263af6b2e42", "score": "0.6467412", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "dfdd766c35bb552e7b158837ddfdecfc", "score": "0.64081126", "text": "def show\n respond_to do |format|\n format.html\n format.json {render :json => @offering.to_json}\n format.xml {render :xml => @offering.to_xml}\n end\n end", "title": "" }, { "docid": "d62a9f6f7489e78c700161ae57010147", "score": "0.6402882", "text": "def show\n @offer = Offer.find(params[:id])\n end", "title": "" }, { "docid": "c5612f4c3d35939a300044c1dad8b3c0", "score": "0.6401035", "text": "def new\n ## Intitializing the offering object\n @offering = Offering.new\n set_deity_and_temple\n\n respond_to do |format|\n format.html { get_collections and render :index }\n format.json { render json: @offering }\n format.js {}\n end\n end", "title": "" }, { "docid": "f1ca898179e7f702878e270e5b09ab00", "score": "0.63859016", "text": "def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end", "title": "" }, { "docid": "b8e3218fcda0d12bc5034de676cc0ad0", "score": "0.63114357", "text": "def get(params = {})\n client.get(\n \"/v1/shopping/hotels/#{@hotel_id}/offers/#{@offer_id}\", params\n )\n end", "title": "" }, { "docid": "f34e5ccb8555d5bb5bd4f41b159f86ff", "score": "0.63064927", "text": "def new\n @offer = Offer.new\n\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.63055193", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.63055193", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "ef2dfa393e42b0cdce806450b9789ee6", "score": "0.63055193", "text": "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "d9963c0c2ed0de7fe7c063ab8d5ad57c", "score": "0.6289758", "text": "def details(offering_id)\n API::request(:get, \"offerings/#{offering_id}\")\n end", "title": "" }, { "docid": "f5f8e44b8dea468a9bcc17fa6771bd91", "score": "0.6287604", "text": "def show\n @offer_chain = OfferChain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_chain }\n end\n end", "title": "" }, { "docid": "4aa264ddd78cc1eb27f4dc2c8f9fdc0c", "score": "0.62805754", "text": "def new\n @offer = Offer.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "d113a8a3dc3833d8f0d1768674c397b2", "score": "0.6263674", "text": "def index\n @offers = Offer.all\n end", "title": "" }, { "docid": "dac626a5367ece0cdfa87d5788a85daa", "score": "0.62611246", "text": "def show\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "dac626a5367ece0cdfa87d5788a85daa", "score": "0.62611246", "text": "def show\n @offer = Offer.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "718d5c33963e8357816ce62d5fb3ed70", "score": "0.62139934", "text": "def offers_url\n offers_url_part = \"/feed/v1/offers.json\"\n \"#{@@base_url}#{offers_url_part}?#{req_attributes}\"\n end", "title": "" }, { "docid": "958613761c086217bfe1fe06f8735eb5", "score": "0.61988443", "text": "def index\n @portal_offerings = Portal::Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_offerings }\n end\n end", "title": "" }, { "docid": "958613761c086217bfe1fe06f8735eb5", "score": "0.61988443", "text": "def index\n @portal_offerings = Portal::Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_offerings }\n end\n end", "title": "" }, { "docid": "55b898140af5708765fa437f9c238ae4", "score": "0.6186304", "text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offers }\n end\n end", "title": "" }, { "docid": "55b898140af5708765fa437f9c238ae4", "score": "0.6186304", "text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offers }\n end\n end", "title": "" }, { "docid": "49b756b910b0758ea22f0072923947c3", "score": "0.61809105", "text": "def show\n @offer_log = OfferLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @offer_log }\n end\n end", "title": "" }, { "docid": "8cabf691b14b288e5c319b63ba399da5", "score": "0.61795676", "text": "def index\n if !params[:merchant_id]\n @offers = Offer.all\n else\n @offers = Offer.where(merchant_id: params[:merchant_id])\n end\n\n render json: @offers\n end", "title": "" }, { "docid": "89d39a0763bba93a92f1c8b45ed752c4", "score": "0.61760753", "text": "def load_offers\n request = OffersRequest.new(params, api_key)\n response = Net::HTTP.get_response(URI(request.url))\n body = read_response(response)\n body\n end", "title": "" }, { "docid": "65805b6356ab324a0125d8e41d153003", "score": "0.6172923", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "65805b6356ab324a0125d8e41d153003", "score": "0.6172923", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "65805b6356ab324a0125d8e41d153003", "score": "0.6172923", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "65805b6356ab324a0125d8e41d153003", "score": "0.6172923", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "65805b6356ab324a0125d8e41d153003", "score": "0.6172279", "text": "def show\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer }\n end\n end", "title": "" }, { "docid": "dce055789443c9b14622e093c643c36f", "score": "0.6167243", "text": "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "8b9b1d05b8d5909224dd6d77cbc53ba7", "score": "0.6156704", "text": "def index\n @offerers = Offerer.all\n end", "title": "" }, { "docid": "418d8bed26da8564c059682d1d3ae473", "score": "0.612184", "text": "def index \n if params[:search].blank?\n @offers = Offer.where(:type => 'Ogolny')\n else\n @search = Offer.search(params[:search])\n @offers = @search.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "title": "" }, { "docid": "dd4fdd19aa2c6f0ba680d33672291083", "score": "0.61139077", "text": "def show\n @push_offer = PushOffer.find(params[:id])\n\n render json: @push_offer\n end", "title": "" }, { "docid": "2927c28c043068047ab9557ffd749163", "score": "0.6112862", "text": "def index\n # We show only 'parent' offers (\"I want to get rid of my couch\"),\n # not offers posted as responses\n @offers = Offer.parent_offers.search(params[:q]).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "title": "" }, { "docid": "a417ac6c0bcd6ae648cf13e61cf0dd46", "score": "0.6094808", "text": "def index\n @offers = Offer.where(initiator_user_id: current_user.id).or(Offer.where(creator_user_id: current_user.id))\n\n render json: OffersRepresenter.new(@offers).as_json\n end", "title": "" }, { "docid": "f90aa5115f34aaa279a735dfb7139fb5", "score": "0.6092691", "text": "def skier_pings_index \n @pings = Skier.find(params[:id]).pings\n render json: @pings \n end", "title": "" }, { "docid": "1dd3414c4d914f384f67a2962ad261cf", "score": "0.6092635", "text": "def index\n params[:page] ||= 1\n @offers = Offer.where(:site_id => current_user.site.id).paginate(:page => params[:page], :per_page => 10)\n respond_to do |format|\n format.html\n format.xml\n format.js { render :template => '/offers/index.js.erb' }\n end\n end", "title": "" }, { "docid": "fa1c0adcfc2b5b0a280b594b1bac8ed6", "score": "0.60898", "text": "def index\n @egivings = Egiving.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @egivings }\n end\n end", "title": "" }, { "docid": "b11b9a4210fbdc148bf6b57b41add334", "score": "0.6082701", "text": "def find_listing_id\n listings = Listing.where(\"id = ?\",params[:listing_id]).to_a\n if !listings.empty?\n listing_ids = []\n listings.each do |listing|\n listing_ids << listing.id\n end\n @offers = Offer.includes(:listing => :book).where(\"listing_id IN (?)\", listing_ids).all\n if !@offers.empty?\n ret = []\n @offers.each do |offer|\n ret << offer.as_json(:include => {:listing => {:include => {:book => {:only => :title}}}, :user => {:only => :username}})\n end\n render :json => ret\n else\n render :json => \"user has no offers\".to_json\n end\n else\n render :json => \"user has no offers\".to_json\n end\n end", "title": "" }, { "docid": "fa5859ee26f401f0811976001ffbb2e7", "score": "0.6068347", "text": "def index\n @email = Admin::Customer::Email.find_by_tracking(params[:email_id]) if @email.nil?\n @admin_customer_offers = @email.offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_customer_offers }\n end\n end", "title": "" }, { "docid": "f9d1e506e2bd0619857269d2eb3f7367", "score": "0.60673535", "text": "def show\n @elevator = Elevator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @elevator }\n end\n end", "title": "" }, { "docid": "04b4ab235feb47572bb33dcbc8286c3a", "score": "0.60658514", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_customer_offer }\n end\n end", "title": "" }, { "docid": "ed2914fe4137ea5d23c9748b241fb1f9", "score": "0.606469", "text": "def show\n @breadcrumb = 'read'\n @offer_request = OfferRequest.find(params[:id])\n @items = @offer_request.offer_request_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @suppliers = @offer_request.offer_request_suppliers.paginate(:page => params[:page], :per_page => per_page).order('id')\n @offers = sort_offers_by_total(@offer_request).paginate(:page => params[:page], :per_page => per_page)\n #@offers = @offer_request.offers.paginate(:page => params[:page], :per_page => per_page).order('id')\n # Offer Approvers\n @is_approver = false\n if @offers.count > 0\n offer = @offers.first\n @is_approver = company_approver(offer, offer.project.company, current_user.id) ||\n office_approver(offer, offer.project.office, current_user.id) ||\n (current_user.has_role? :Approver)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_request }\n end\n end", "title": "" }, { "docid": "91788a6bafe7b9514d1f5f8b252685d6", "score": "0.60066545", "text": "def find(id)\n response = get('findById', {'id' => id}).body\n\n if response.success?\n response.result = HasOffers::Models::Offer.parse(response.body)\n end\n\n response\n end", "title": "" }, { "docid": "b4074954b5e464831ce46f740491b7ca", "score": "0.600384", "text": "def index\n @individual_offers = IndividualOffer.all\n end", "title": "" }, { "docid": "91cb852513c6bf9173ba8eea247be2ce", "score": "0.6002028", "text": "def new\n @resource = Resource.find(params[:resource_id])\n @offer = @resource.offers.new(params[:offer])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "title": "" }, { "docid": "36110976eb19f58e56cc93d04b45cdf6", "score": "0.5985681", "text": "def test\n response = JSON.parse(File.read(\"test/fixtures/sample_offers_response.json\"))\n @offers = response['offers']\n render \"search\"\n end", "title": "" }, { "docid": "22b6a1b6e83a03df7fac0bf8c25d8b18", "score": "0.598321", "text": "def show\n @shop_google_credit_offer = Shop::GoogleCreditOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_google_credit_offer }\n end\n end", "title": "" }, { "docid": "2ab39592826c119d36a2975aeb7014d8", "score": "0.5972533", "text": "def detail(offer_id)\n fetch_json(\"detail/#{offer_id}\")\n end", "title": "" }, { "docid": "081070f97affcef1d84534ea9f34ec3c", "score": "0.5971369", "text": "def index\n #@job_offers = JobOffer.find_by(id: params[:id])\n @job_offers = JobOffer.where(\"job_request_id = ?\", params[:job_request])\n end", "title": "" }, { "docid": "bbc643baecad50dafb4eb0e5b996f303", "score": "0.59707713", "text": "def fetch_offers\n pub0 = params[:pub0]\n uid = params[:uid]\n page = params[:page]\n http_response = Offer.fetch_offers(page,pub0,uid)\n @json_response = Offer.parse_to_json(http_response)\n verify_response(http_response.code,@json_response['code'])\n end", "title": "" }, { "docid": "dd38eb780618ee8566f49de0f3d20744", "score": "0.5957057", "text": "def show\n @lending = Lending.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lending }\n end\n end", "title": "" }, { "docid": "93bbed4f9bddfa753b6b65563e122763", "score": "0.59516144", "text": "def meetings\n @current_tab = \"Clubs\"\n \n sess = Patron::Session.new\n sess.base_url = \"http://online.equipe.com/\"\n #http://online.equipe.com/api/v1/clubs/####/meetings.json\n response = sess.get \"api/v1/clubs/\" + params[:id].to_s + \"/meetings.json\"\n @meetings = JSON.parse response.body\n \n \n \n respond_to do |format|\n format.html # meetings.html.erb\n format.xml { render :xml => @meetings }\n end\n \n end", "title": "" }, { "docid": "fc27406fe7c1055538ea84241f8ecac7", "score": "0.5942795", "text": "def show\n @offer_message = OfferMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_message }\n end\n end", "title": "" }, { "docid": "2b5dd632b2afbf9f27a9d61ec1d82629", "score": "0.5937404", "text": "def show\n #Fix id_numbering for (< v1.2)\n#params[:id] = Integer(params[:id]) - 90000\n #end fix\n\n handler = ResourceOfferHandler.new\n @parking_spot = handler.retrieve_spots({:only=>[params[:id]]}).first\n presenter = Api::V1::ResourceOfferContainersPresenter.new\n \n spot_json = presenter.as_json(@parking_spot, {:level_of_detail => params[:level_of_detail]})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:success => \"true\", :spot => spot_json, :count => \"one\", :level_of_detail => params[:level_of_detail]} }\n end\n end", "title": "" }, { "docid": "0debc5a7c68cebc032ef67818881e0b6", "score": "0.59355694", "text": "def show\n @poet = Poet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poet }\n end\n end", "title": "" }, { "docid": "a1775630eca3ba34740c20e3fa4bdf0b", "score": "0.59342635", "text": "def offer\n current_organization.offers.find_by_id(offer_id)\n end", "title": "" }, { "docid": "d29a843276297c6c4a72a04e2c916848", "score": "0.59325534", "text": "def index\n @shop_google_credit_offers = Shop::GoogleCreditOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_google_credit_offers }\n end\n end", "title": "" }, { "docid": "881fc56bbc9f3a8485bd025f2619fce5", "score": "0.59278524", "text": "def get_alert_summary \n get(\"/alerts.json/summary\")\nend", "title": "" }, { "docid": "a0aa6d507f30e2455fa2ec8571e388e2", "score": "0.5919053", "text": "def show\n @hotelsupply = Hotelsupply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotelsupply }\n end\n end", "title": "" }, { "docid": "f969e7b115a3dbdaad520cfa1532ea8a", "score": "0.591731", "text": "def show\n respond_to do |format|\n format.json { render json: @endpoint, status: 200 }\n end\n end", "title": "" }, { "docid": "2c1d7d1fa28f386c822317ebdffbb6f7", "score": "0.5915308", "text": "def show\n render json: @poll\n end", "title": "" }, { "docid": "cd1a3ebb1e8dc790c5d0d8a5180ad956", "score": "0.5913921", "text": "def show\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll }\n end\n end", "title": "" }, { "docid": "cd1a3ebb1e8dc790c5d0d8a5180ad956", "score": "0.5913921", "text": "def show\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll }\n end\n end", "title": "" }, { "docid": "8da8dbf412936ee0afc1e10cfe454c79", "score": "0.5906914", "text": "def show\n respond_to do |format|\n format.html\n format.js\n format.json #{ render json: @assignment_offering }\n end\n end", "title": "" }, { "docid": "ac8355d07e1353ac36659b08db8f2002", "score": "0.590671", "text": "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "title": "" } ]
597edfa8947031d3c07a7d68df76f913
Author: Matt Noblett Purpose: This is used to help determine what style of game is being played by the user. Input: checkUserInput What style of game is to be played. It is either a 0 or 1 Output: N/A
[ { "docid": "d5d943f0d6b5c9e95b1fb2eabca648e8", "score": "0.62276167", "text": "def hMode(checkUserInput)\n @checkUserInput = checkUserInput\n if(@checkUserInput == 0)\n play()\n else\n while(@done == 0)\n play()\n end\n end\n end", "title": "" } ]
[ { "docid": "563b90bf956ee27d23a8e4ce473f3f59", "score": "0.69090015", "text": "def check_who_win(user_input, computer_input)\r\n if user_input == computer_input\r\n \"Haha! It is a draw! #{user_player.name}, you can try again!\"\r\n elsif user_input == 'R'\r\n if computer_input == 'S'\r\n \"Wow! Rock smashes Scissors! #{user_player.name}, you Win!\"\r\n elsif computer_input == 'P'\r\n \"Oh! Paper covers Rock! #{user_player.name}, you Lose!\"\r\n end\r\n elsif user_input == 'P'\r\n if computer_input == 'R'\r\n \"Wow! Paper covers Rock! #{user_player.name}, you Win!\"\r\n elsif computer_input == 'S'\r\n \"Oh! scissors cuts Paper! #{user_player.name}, you Lose!\"\r\n end\r\n elsif user_input == 'S'\r\n if computer_input == 'P'\r\n \"Wow! Scissors cuts Paper! #{user_player.name}, you Win!\"\r\n elsif computer_input == 'R'\r\n \"Oh! Rock smashes Scissors! #{user_player.name}, you Lose!\"\r\n end\r\n end\r\n end", "title": "" }, { "docid": "8d8475e8e544c56541386761d5687234", "score": "0.677698", "text": "def ask_for_game_type\n system \"clear\"\n puts \"\n Welcome to Chess! What would you like to do?\n\n * Start a new Game -> Enter 'new'\n * Load a saved Game -> Enter 'load'\n\n * Exit -> Enter 'exit'\n \"\n\n allowed = [\"new\", \"load\", \"exit\", \"debug\"]\n input = \"\"\n\n loop do\n input = gets.chomp.downcase\n if allowed.include?(input)\n break\n end\n end\n\n return \"new\" if input == \"new\"\n return \"debug\" if input == \"debug\"\n return select_saved_game if input == \"load\"\n exit_game if input == \"exit\"\n end", "title": "" }, { "docid": "1022cd7c163cc9ee0f59c573df60ee57", "score": "0.67209923", "text": "def input(user_input)\n user_input = user_input.chomp\n case @state\n when :choosing_players\n choose_player(user_input)\n else\n play_user_turn(user_input)\n if (verdict = game_over?)\n draw_board\n if verdict == :draw\n @output << \"\\nIt's a draw!\\n\"\n else\n @output << \"\\nYou have won!\\n\"\n end\n return GameOver\n end\n\n play_computer_turn\n if (verdict = game_over?)\n draw_board\n if verdict == :draw\n @output << \"\\nIt's a draw!\\n\"\n else\n @output << \"\\nI have won!\\n\"\n end\n return GameOver\n end\n\n draw_board\n prompt_for_turn\n end\n end", "title": "" }, { "docid": "1a85e874001476b594f77d89e8c2fd87", "score": "0.6584201", "text": "def has_AI?\n\t\toutput, error_message = nil, nil # So that I can get it outside of the loop after\n\t\tloop do\n\t\t\t@board.clear\n\t\t\tputs \"Welcome to Connect 4 by Trevor Elwell! How would you like to play?\"\n\t\t\tputs error_message || \"Enter 1 to play against a computer. Enter 2 for 2-player mode.\"\n\t\t\tinput = gets.chomp.to_i\n\t\t\tif input == 1 or input == 2\n\t\t\t\t# Make has_AI? return true if user selected to play against a computer\n\t\t\t\tinput == 1 ? output = true : output = false\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\terror_message = \"Invalid input, please enter 1 for 1-player or 2 for 2-player.\"\n\t\t\t\tredo\n\t\t\tend\n\t\tend\n\t\toutput\n\tend", "title": "" }, { "docid": "da71d5d688907e54a9407fe6ebde09c8", "score": "0.65676457", "text": "def handle_guess(input)\n if input == false\n puts \"#{@current_user.name}: Seriously? No!\"\n lose_life(@current_user)\n elsif input == true\n puts \"#{@current_user.name}: YES! You are correct.\"\n puts \"P1: #{@players[0].lives}/3 vs P2: #{@players[1].lives}/3\"\n switch_user\n puts \"\\n\" + @@new_turn_alert\n play_game\n else\n puts \"Unhandled error\"\n end\n end", "title": "" }, { "docid": "5de1d0166308fb111277bece3e88a7f4", "score": "0.65205467", "text": "def win?(user_input, computer_input)\n outcome = false\n if user_input == 'rock'\n outcome = computer_input != 'paper'\n elsif user_input == 'scissors'\n outcome = computer_input != 'rock'\n elsif user_input == 'paper'\n outcome = computer_input != 'scissors'\n end\n outcome\nend", "title": "" }, { "docid": "342e6f57a040d71092d116acccb75323", "score": "0.64778113", "text": "def play_again?\n print \"\\n\"\n print \"Would you like to play again? Enter: \\n\"\n print \"************************************ \\n\"\n print \"1. Yes \\n\"\n print \"2. No \\n\"\n print \"3. View Stats \\n\"\n print \"\\n\"\n input =self.input\n case input\n when '1'\n print \"Great!\"\n system \"clear\"\n self.category_prompt #\n self.pick_category(gets.chomp)\n system \"clear\"\n self.new_game\n self.make_answers\n self.print_question\n self.check_answer(gets.chomp)\n self.play_again?\n when '2'\n system \"clear\"\n print BYE\n # print \"Bye. Thanks for playing \\n\"\n when '3'\n system \"clear\"\n print \"Your Stats \\n\"\n print \"********** \\n\"\n print \"\\n\"\n print self.user.correct_percentage\n print self.user.best_category\n print self.user.worst_category\n print \"\\n\"\n self.play_again?\n end\n end", "title": "" }, { "docid": "1f88bfdcd5b9cebc226adbf6b8584ec6", "score": "0.6401727", "text": "def inputcheck(input)\r\n\t\tcase input\r\n\t\t\twhen 1,2,3,4,5,6,7\r\n\t\t\t\treturn true\r\n\t\t\twhen 0\r\n\t\t\t\treturn \"pause\"\r\n\t\t\telse\r\n\t\t\t\treturn false\r\n\t\t\tend\r\n\tend", "title": "" }, { "docid": "bc288c693909c9fd2e1d9cd20a3d2b4b", "score": "0.63884526", "text": "def validateInput input, user\n if not input =~ /^\\d+$/\n puts \"Please only enter nubmers.\"\n return \"\"\n elsif not input.to_i.between?(0,@size**2-1)\n puts \"The number entered is not in [0 and #{@size**2-1}].\"\n return \"\"\n elsif not @squares[input.to_i].instance_of? Square\n puts \"This square is already occupied.\"\n return \"\"\n else\n if user == \"Player X\" then\n @squares[input.to_i] = XSquare.new(input.to_i)\n else \n @squares[input.to_i] = OSquare.new(input.to_i)\n end\n return input\n end\n end", "title": "" }, { "docid": "3fc0d492a3dc1f267346aad5a878bd39", "score": "0.6343019", "text": "def promptUser user\n input = \"\"\n while input == \"\"\n print \"#{user} enter a sqaure: \"\n\n input = gets.chomp\n input = validateInput(input, user)\n puts \"\"\n end\n if @board.checkLastMoveForWin(input.to_i)\n drawBoard\n puts \"We have a winner!!!!\"\n exit\n end\n end", "title": "" }, { "docid": "b2c89fd145001383a7af0e3b452d565f", "score": "0.63246423", "text": "def check(input)\n if input.to_i == self.answer\n puts \"#{self.player.name}: YES! You are correct.\"\n else\n puts \"#{self.player.name}: Seriously? No!\"\n self.player.lives -= 1\n end\n end", "title": "" }, { "docid": "9604cf2febf28964bdc1d648ad51f44f", "score": "0.6311781", "text": "def starts_game\n user_input = gets.chomp.downcase\n if user_input == 'yes'\n #move on to category selection...call some method here that progresses the game\n else\n abort('You\\'ve decided not to play. Lame!')\n end\nend", "title": "" }, { "docid": "905ed2175029448806e164ec8c601a96", "score": "0.62873", "text": "def get_player_2_type\n user_choice = get_user_input(\"Please enter \" + Paint[\"\\\"C\\\" \", :blue, :bold] + \"if you would like to play the Computer. Enter \" + Paint[\"\\\"H\\\" \", :blue, :bold] + \"if you would like to play the human sitting next to you:\", \"Invalid character. Please enter either C(Computer) or H(Human).\") do |input|\n input == 'c' || input == 'C' || input == 'h' || input == 'H'\n end\n user_choice = user_choice.upcase\n if user_choice == \"C\"\n :computer\n elsif user_choice == \"H\"\n :human\n end\n end", "title": "" }, { "docid": "cbc040c22148498a8d833f2e112daf8a", "score": "0.6283361", "text": "def game_round\n hide_letters\n win_lose?\n win_lose_feedback\n# GET PLAYER INPUT\n @player_guess = gets.chomp!\n if @player_guess == '0'\n menu\n# Cannot repeat letters.\n elsif @player_attempts.include?(@player_guess)\n puts \"Please enter a letter you haven't yet picked.\"\n game_round\n# Limit to one character, a-z\n elsif @player_guess =~ /[^a-z0]/\n puts \"Please enter a character between A and Z. Or enter '0' for the menu.\"\n game_round\n elsif @player_guess.length != 1\n puts \"Please enter just one character.\"\n game_round\n else\n letter_correct?\n end\n end", "title": "" }, { "docid": "69bf20f82a9f357d5493e025122a6090", "score": "0.6274439", "text": "def validation(input)\n guess = Guess.new(input, @sequence)\n if guess.short(input)\n puts \"Too Short\"\n play\n elsif guess.long(input)\n puts \"Too Long\"\n play\n elsif guess.correct?\n puts \"Congratulations! You guessed the sequence #{@sequence} in 8 guesses over 4 minutes,\n22 seconds.\"\n puts 'Do you want to (p)lay again or (q)uit?'\n replay = gets.chomp.downcase\n if play_commands(replay)\n play\n elsif quit_commands(replay)\n exit\n end\n elsif input.length == sequence.length && input != sequence\n positions = guess.correct_positions\n elements = guess.correct_elements\n puts \"'#{input}' has #{elements} of the correct elements with #{positions} in the correct positions\nYou've taken 1 guess\"\n end\n end", "title": "" }, { "docid": "56a5f9c77efcb41717e3b9e4aeb9e6dd", "score": "0.6273545", "text": "def wait_for_input # wait for user to enter a character, if valid, perform action\r\n case Navigation.wait_for_valid_input\r\n when \"N\" then show_new_game_prompt\r\n when \"S\" then show_scoreboard # class implmentation ========================== Check Chris'\r\n when \"R\" then show_game_rules\r\n when \"E\" then exit\r\n when \"B\" then show_welcome_screen\r\n when \"1\" then return 1\r\n when \"2\" then return 2\r\n when \"3\" then return 3\r\n when \"4\" then return 4\r\n end\r\nend", "title": "" }, { "docid": "2df380b05819c629daeee8032bffc627", "score": "0.627016", "text": "def get_input(player_name)\n system(\"clear\")\n valid_inputs = %w[1 2 3]\n input = valid_inputs.sample if @ai\n\n loop do\n print \"#{player_name.upcase}, make your selection:\\n 1 for ROCK,\\n 2 for PAPER, or\\n 3 for SCISSORS:\\n >> \"\n input = gets.chomp unless @ai\n if valid_inputs.include?(input)\n puts \"Thanks!\"\n break\n else\n puts \"Invalid input - please try again:\"\n end\n end\n\n input.to_i\n end", "title": "" }, { "docid": "1afe9ee01378f52cc35f9d48de3bd5cd", "score": "0.62341493", "text": "def gameType\n\t\tputs \"Do you want to guess (1) or create (2) the code\"\n\t\ttype = gets.chomp\n\t\tuserPlay if type == '1'\n\t\tcomputerPlay if type == '2'\n\tend", "title": "" }, { "docid": "03c2909deb06f3e4c0187ba32383d493", "score": "0.6233052", "text": "def player1_choose?\n puts \"Player 1, it's your turn.\"\n puts \"\\n ROCK, PAPER, or SCISSORS? Choose wisely!\"\n gets.chomp\n end", "title": "" }, { "docid": "f8298913b59a2483a0b8ff809800d770", "score": "0.62276506", "text": "def begin_game\n puts \"Hello there, welcome to Tic-tac-toe\"\n puts \"Would you like to play with 0, 1, or 2 players?\"\n input = gets.chomp\n input\n if input == \"0\"\n self.ai_game\n elsif input == \"1\"\n self.human_v_computer\n else input == \"2\"\n self.human_v_human\n end\n end", "title": "" }, { "docid": "752eaf18ffb532a1adff2d500e820b58", "score": "0.622569", "text": "def game_over?(display_in)\n winner_check = winner?(display_in)\n game_over = false\n if winner_check == USER_WINNER\n prompt(\"**** You won!!\")\n game_over = true\n elsif winner_check == COMPUTER_WINNER\n prompt(\"***** Computer won!!\")\n game_over = true\n elsif board_full?(display_in)\n prompt(\"**** Board is full\")\n game_over = true\n end\n return game_over, winner_check\n end", "title": "" }, { "docid": "63208bdfb0f716c59570edcfe9279c80", "score": "0.6181591", "text": "def valid_choice?(user_input)\n \tif user_input.length == 1 && user_input.to_i.to_s == user_input && user_input.to_i >= 1 && user_input.to_i <= 3\n \t\treturn true\n \telse\n \t\tputs \"You chose \" + user_input +\", I have no idea what to do with that.\"\n \t\treturn false\n \tend\n end", "title": "" }, { "docid": "d222302cd52adba96a8be7e14d8386f0", "score": "0.61474085", "text": "def user_input\n input = gets.chomp\n if input.downcase == \"exit\"\n exit_game\n elsif input.to_i <= 0\n puts \"You cannot bet that amount or say that. Try again.\"\n ask_bet unless @total_money.nil?\n load_game\n else\n input.to_i\n end\n end", "title": "" }, { "docid": "4a5d0abc992d687981c82256eeb3717a", "score": "0.61386186", "text": "def check_input\n input = gets.strip\n puts \"-----------------------------------------------------------------------\"\n if input.to_i < 21 && input.to_i > 0 && input =~ /^\\d+$/\n display_info(input)\n puts \"-----------------------------------------------------------------------\"\n puts \"If you would like to see another show, please put in a number (1-20)\".colorize(:yellow)\n puts \"-----------------------------------------------------------------------\"\n check_input\n elsif input.downcase == \"list\"\n list_shows\n check_input\n elsif input.downcase == \"exit\" || input.downcase ==\"end\"\n puts \"Thank you for using the New Series Suggester.\"\n puts \"Goodbye!\"\n puts \"-----------------------------------------------------------------------\"\n else\n puts \"I'm sorry but that is not a correct input\".colorize(:light_red)\n puts \"Only numbers 1 - 20, list, exit, or end are valid inputs\".colorize(:light_red)\n puts \"-----------------------------------------------------------------------\"\n check_input\n end\n end", "title": "" }, { "docid": "39d8aa89c879728cf4976ca5f679709b", "score": "0.6138491", "text": "def how_many_human_players()\n choice = \"0\"\n if [\"0\", \"1\", \"2\"].include?(choice) \n choice\n else\n p \"Incorrect Input\"\n how_many_human_players()\n end\nend", "title": "" }, { "docid": "b2061ff857d6e52e11f694638b930f81", "score": "0.6137807", "text": "def user_input \n puts \"Input Rock, Paper, or Scissors\"\n user_input = gets.strip.to_s\n arr = [\"Rock\", \"Paper\", \"Scissors\"]\n comp_input = arr.sample\n case user_input\n when user_input === 'Rock' && comp_input === 'Scissors'\n puts \"You win\"\n when user_input === 'Paper' && comp_input === 'Rock'\n puts \"You win\"\n when user_input === 'Scissors' && comp_input === 'Paper'\n puts \"You win\"\n else \n puts \"You lose\"\n end\nend", "title": "" }, { "docid": "aff4c157a58d6a538760128858d4a3b0", "score": "0.6122598", "text": "def game_select\n line_break\n puts \"\\n\"\n puts \"Available Games:\"\n puts \"\\n\"\n puts \"Classic - Human vs CPU\"\n puts \"Reversed - CPU vs Human\"\n puts \"\\n\"\n\n selection = gets.chomp.downcase\n if selection == \"classic\"\n max_range = get_number\n user_guess(max_range)\n elsif selection == \"reversed\"\n line_break\n puts \"Select the skill level of the CPU.\"\n puts \"Low - Random Search\"\n puts \"Medium - Linear Search\"\n puts \"Expert - Binary Search\"\n puts \"\\n\"\n difficulty = gets.chomp.downcase\n if difficulty == \"low\"\n robot\n puts \"My supreme intellect is grandiloquent.\"\n compu_guess_random\n elsif difficulty == \"medium\"\n robot\n puts \"I have witnessed 14 million possible timelines, and in all of them you lose.\"\n compu_guess_linear\n elsif difficulty == \"expert\"\n robot\n puts \"The end is nigh.\"\n result = compu_guess_binary\n puts result\n else\n puts \"Not a valid difficulty. Try low, medium or expert.\"\n end\n else\n puts \"Exiting\"\n end\nend", "title": "" }, { "docid": "91bb5df0dc07b7fdd8cf486c15efd3ff", "score": "0.6118955", "text": "def input_check input_type, input\n until input_type.include?(input) do\n puts \"I'm sorry. I'm unfamiliar with that.\"\n puts \"Please try again from one of the options listed above.\"\n input = gets.chomp.downcase\n spacing\n end\n return input\nend", "title": "" }, { "docid": "c530b10340e179c802d5c4649f9146a8", "score": "0.610928", "text": "def for_game_mode\n #Helpful instructions for first time user:\n puts \"\\nHere are your options:\"\n puts \"Press 1 for 1 Player mode. \"\n puts \"Press 2 for 2 Player mode. \"\n puts \"Press 3 for an automated game.\\n\\n\"\n\n #Get user input for the game mode:\n print \"What do you want your game mode to be? \"\n \n while true\n mode = Integer(gets.chomp)\n case mode\n when 1..3\n break\n else\n print \"Please enter a valid game type: \"\n end\n end\n \n return mode\n end", "title": "" }, { "docid": "71ef66257ee5003a81de8057d5542ac8", "score": "0.61078626", "text": "def user_play\n\tprint \"where would you like to go? Please enter a number: (or enter exit to leave the game) \"\n\t@input = gets.chomp\n\tputs \"You enter: #{@input}\"\n\n\tif @board.index(@input.to_i) != nil\n\t\tgo_ttt\n\telsif @input == \"exit\"\n\t\tputs \"You exit my game QQ\"\n\t\treturn\n\telse \t\n\t\tputs \"Sorry please enter again\"\n\tend\nend", "title": "" }, { "docid": "dbdc5dd6d80a1e0968e8a3a79709ea66", "score": "0.608871", "text": "def rps_game(player1, player2)\n legend = \"One of the players has input a wrong argument.\" +\n \"The correct options to enter are: rock or paper \" +\n \"or scissors.\"\n if (player1 == \"paper\") && (player2 == \"rock\")\n return \"player 1 win\"\n elsif (player1 == \"paper\") && (player2 == \"scissors\")\n return \"player 2 win\"\n elsif (player1 == \"paper\") && (player2 == \"paper\")\n return \"a draw was obtained\"\n elsif (player1 == \"rock\") && (player2 == \"rock\")\n return \"a draw was obtained\"\n elsif (player1 == \"rock\") && (player2 == \"scissors\")\n return \"player 1 win\"\n elsif (player1 == \"rock\") && (player2 == \"paper\")\n return \"player 2 win\"\n elsif (player1 == \"scissors\") && (player2 == \"rock\")\n return \"player 2 win\"\n elsif (player1 == \"scissors\") && (player2 == \"scissors\")\n return \"a draw was obtained\"\n elsif (player1 == \"scissors\") && (player2 == \"paper\")\n return \"player 1 win\"\n else\n return legend\n end\nend", "title": "" }, { "docid": "7a100b7dd35548e532c176390aad6fb2", "score": "0.6071803", "text": "def check\n user_guess = gets.chomp.to_i\n if user_guess == @answer\n puts 'YES! You are correct.'\n if @player1.turn\n @player1.turn = false\n @player2.turn = true\n else \n @player2.turn = false\n @player1.turn = true\n end\n score\n else\n puts 'Seriously? No!'\n if @player1.turn\n @player1.lives -= 1\n @player1.turn = false\n @player2.turn = true\n else \n @player2.lives -= 1\n @player2.turn = false\n @player1.turn = true\n end\n score\n end\n end", "title": "" }, { "docid": "bc32a5e35f6c6a0c4aff97d4810820ce", "score": "0.60541195", "text": "def play_game\n begin \n # to check input from player and validate win/draw for a roll\n puts \"\\n\" + \"#{$active_player.upcase}\" + \" choose a position to play\"\n is_available = 0\n # do while loop for multi check of valid input indexes \n get_available_slot\n # function calls to set new board design , check result after this iteration and choose the next active player\n current_board_design\n check_result\n choose_player\n\n # to display the winner \n if ($is_winner == 1) \n puts \"\\nNice Game !!! \\n\" + \"#{$winner.upcase}\" + \" is the WINNER !!!\"\n elsif ($is_draw == 1)\n puts \"\\nNice Try !!! It's a DRAW !!!\"\n end\n end while ($is_winner == 0 and $is_draw == 0)\n end", "title": "" }, { "docid": "487738ff4545296f48122cc37d908c4a", "score": "0.6051746", "text": "def check_answer\n if $stdin.gets.chomp.to_i == @answer\n puts \"YES! You are correct.\"\n\n if @player1.turn\n @player1.turn = false\n @player2.turn = true\n else\n @player2.turn = false\n @player1.turn = true\n end\n\n else\n puts \"Seriously? No!\"\n\n if @player1.turn\n @player1.life -= 1\n @player1.turn = false\n @player2.turn = true\n else\n @player2.life -= 1\n @player2.turn = false\n @player1.turn = true\n end\n end\n\n print_life\n game_over?\n end", "title": "" }, { "docid": "e8442d440f9f78d1a11ffe4d414d1c1b", "score": "0.6047355", "text": "def check_input(input); end", "title": "" }, { "docid": "e8442d440f9f78d1a11ffe4d414d1c1b", "score": "0.6047355", "text": "def check_input(input); end", "title": "" }, { "docid": "e8442d440f9f78d1a11ffe4d414d1c1b", "score": "0.6047355", "text": "def check_input(input); end", "title": "" }, { "docid": "29b1060df5dbb2bce0e538bea6c23ef4", "score": "0.6044658", "text": "def rps_game_2(player1, player2)\n legend = 'One of the players has input a wrong argument.' +\n 'The correct options to enter are: rock or paper ' +\n 'or scissors.'\n options = ['rock', 'paper', 'scissors']\n if ((player1 == options[1]) && (player2 == options[0])) ||\n ((player1 == options[0]) && (player2 == options[2])) ||\n ((player1 == options[2]) && (player2 == options[1]))\n return 'player 1 win'\n elsif ((player1 == options[1]) && (player2 == options[2])) ||\n ((player1 == options[0]) && (player2 == options[1])) ||\n ((player1 == options[2]) && (player2 == options[0]))\n return 'player 2 win'\n elsif options.include?(player1) && (player1 == player2)\n return 'a draw was obtained'\n else\n return legend\n end\nend", "title": "" }, { "docid": "c0db9f871341653171b0acba45bc3b60", "score": "0.6034633", "text": "def go\n\t\tuserError = false\n\t\tinput = \"\"\n\n\t\twhile input != \"q\"\n\t\t\tif @@turn == 0\t# if it's the player's turn\n\t\t\t\tif !userError\n\t\t\t\t\tputs \"It's your turn!\"\n\t\t\t\tend\n\t\t\t\tuserError = false\n\n\t\t\t\tinput = gets.chomp\n\t\t\t\tif input.ord >= 49 && input.ord <= 57\n\t\t\t\t\tif isThisBoxAvailable(myAtoI(input))\n\t\t\t\t\t\t@@board[myAtoI(input)] = \"X\"\n\t\t\t\t\t\t@@used += 1\n\t\t\t\t\t\t@@turn = 1\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"Hey, that square is already taken. Choose another one!\"\n\t\t\t\t\t\tuserError = true\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tputs \"Your input is invalid. Try again!\"\n\t\t\t\t\tuserError = true\n\t\t\t\tend\n\t\t\t\n\t\t\telsif @@turn == 1\t# if it's the computer's turn\n\t\t\t\tcomputerTurn\n\t\t\t\t@@turn = 0\n\t\t\tend\n\n\t\t\t# puts \"Next turn. (%s)\" % [@@turn]\n\t\t\tif !userError\n\t\t\t\tprintBoard\n\n\t\t\t\t# there could only possibly be a winner if 5 or more\n\t\t\t\t# squares were used, so we'll check for winners\n\t\t\t\t# at that point.\n\n\t\t\t\tif @@used >= 5 && thereIsAWinner\n\t\t\t\t\tif @@winner == \"X\"\n\t\t\t\t\t\tputs \"Congratulations, you win!\"\n\t\t\t\t\t\treturn true\n\t\t\t\t\telsif @@winner == \"O\"\n\t\t\t\t\t\tputs \"I win!\"\n\t\t\t\t\t\treturn true\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"Unfortunately, there was an unexpected problem.\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\telsif @@used >= 9\n\t\t\t\t\tputs \"It's a draw game...\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\tend", "title": "" }, { "docid": "1a8bbc9ec5b5566e265043af2e8cafb3", "score": "0.60321003", "text": "def get_user_selection()\n # maps the user character input to a an integer\n play_num = {'r' => 0, 'p' => 1, 's' => 2 }\n \n # flag to make sure user selection is valid\n valid_user_selection = false\n begin\n # Prompt user for selection\n puts \"Choose one: (P/R/S)\"\n \n # get selection from user\n user_selection = gets.chomp\n if(user_selection =~ /^[PpRrSs]$/)\n user_selection = user_selection.downcase\n valid_user_selection = true\n else\n puts \"Invalid Selection: #{user_selection}. Please try again.\"\n end\n end while valid_user_selection == false\n \n return play_num[user_selection] \nend", "title": "" }, { "docid": "6d8a39febafeaf2aed76c202e13ed2bd", "score": "0.6030367", "text": "def second_validation\r\n invalid_input = /[rps]/\r\n user_input = @player\r\n case [user_input,invalid_input]\r\n when invalid_input\r\n puts \"This is not a valid option\"\r\n get_user_input\r\n\r\n end\r\n end", "title": "" }, { "docid": "76821d8c022867c0497bf97310b8a6a9", "score": "0.6029789", "text": "def get_user_input_details\r\n good_input = false\r\n until good_input == true \r\n puts \"\"\r\n puts \"1. See related artists\"\r\n puts \"2. See top albums\"\r\n puts \"3. See top songs\"\r\n puts \"What would you like to see?\"\r\n puts \"Enter 1-3 or 'exit' to quit\"\r\n \r\n self.input = gets.chomp \r\n \r\n if input == \"1\" \r\n good_input = true \r\n elsif input == \"2\"\r\n good_input = true \r\n elsif input == \"3\" \r\n good_input = true \r\n elsif input == 'exit'\r\n good_input = true \r\n else \r\n puts \"Invalid input, please enter 1-3 or 'exit'.\"\r\n end \r\n end \r\n input \r\n end", "title": "" }, { "docid": "d789c284fd377c3da4faa181f30b47d4", "score": "0.6029782", "text": "def get_game_type\n puts \"Please select from the following list:\\n1. Rock, Paper, Scissors\\n2. Rock, Paper, Scissors, Lizard, Spock\"\n input = gets.chomp\n set_game_type(input)\n end", "title": "" }, { "docid": "1e08b1ed0cb852f5e800564c9efdf8bd", "score": "0.60278434", "text": "def getUserInput\n\t\t@userChoice.clear\n\t\thintsGiven = 0\n\t\twhile @userChoice.length < 3 && !@endGame\n\t\t\tputs \"Enter a card number between 1 and \" + @table.length.to_s + \". (Enter 0 for a hint) or (q to quit):\"\n\t\t\tputs \"\"\n\t\t\tprint \"Player \" + @turn.to_s + \": \"\n\t\t\tchoice = gets.chomp!\n\t\t\tif (1..@table.length) === choice.to_i and !@userChoice.include?(choice.to_i) \t#user entered a valid card\n\t\t\t\t@userChoice.push(choice.to_i)\n\t\t\telse\n\t\t\t\tif choice == \"0\" \t\t\t#user entered 0 for a hint\n\t\t\t\t\tif hintsGiven == 0\t\t\n\t\t\t\t\t\tputs \"There is a set on the table containing the card:\"\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprint \"\t \"\n\t\t\t\t\t\t@hintSet[0].printCard\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprintHint\n\t\t\t\t\t\thintsGiven = 1\n\t\t\t\t\telsif hintsGiven == 1\n\t\t\t\t\t\tputs \"Another card in the set is: \"\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprint \"\t \"\n\t\t\t\t\t\t@hintSet[1].printCard\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\thintsGiven = 2\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"There is only 1 possible card in the whole deck that will make a set with these 2 cards:\"\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprint \"\t \"\n\t\t\t\t\t\t@hintSet[0].printCard\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprint \"\t \"\n\t\t\t\t\t\t@hintSet[1].printCard\n\t\t\t\t\t\tputs \"\"\n\t\t\t\t\t\tprintHint\n\t\t\t\t\tend\t\t\t\t\t\t\n\t\t\t\telsif choice == \"q\" || choice == \"Q\" \t#user entered q or Q to quit\n\t\t\t\t\t@endGame = true\n\t\t\t\t\treturn\n\t\t\t\telse\t\t\t\t\t#user entered invalid input\n\t\t\t\t\tputs \"Invalid input! Please try again.\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "13b8bdf3d3c006fb396ec6ffd9e4815d", "score": "0.59980685", "text": "def user_input (choice)\n\tif choice == \"Yes\"\n\t\tputs \"Great!, I have a game for you, it's called \" +\"'Secret Number'.\"\n\t\tputs \"\\u00a0\"\n\t\tputs \"The follow are the rules to the Game: \" + \"\\n\" + \"I will choose a random number between 1-10, your job is to guess this number in 3 tries or less. \" + \"\\n\" +\n\t\t\t\"If you can't guess in 3 tries or less I win. If you can, you win the game!\"\n\t\tputs \"\\u00a0\"\n\t\tputs \"\\u266F----You are on #{$attempts} of 3 attempts-----\\u266F\"\t\n\t\tputs \"What is your guess?\" \n\t\tputs secret_number_eval\n\telse puts \"Good day, to you, then!\"\n\t\n\tend\nend", "title": "" }, { "docid": "44e741b80195f7008cfff72584dd11d6", "score": "0.5993735", "text": "def choose_mode\n mode = prompt_user(\"Would you like to play against a human (1) of a computer (2)?\",\n /^[12]$/, \"Please choose option 1 (human) or option 2 (computer).\")\n mode.to_i == 1 ? :human : :computer\nend", "title": "" }, { "docid": "84524b581353a051902884a370776601", "score": "0.59934247", "text": "def gameplay\n\t\t@turn = 0\n\t\tputs \"You can only guess the six colors of the rainbow.\\nRed (r), Orange (o), Yellow (y), Green (g), Blue (b), Purple (p).\"\n\t\twhile not won? || @turn >= 12\n\t\t\toutput = []\n\t\t\t@input = get_input\n\t\t\tinput = @input.split(//)\n\t\t\tanswer = @answer.split(//)\n\t\t\tinput.each.with_index do |x, i|\n\t\t\t\tif answer[i] == x\n\t\t\t\t\toutput.push \"*\"\n\t\t\t\t\tanswer = answer.join.sub!(x, \" \").split(//)\n\t\t\t\t\tinput = input.join.sub!(x, \"*\").split(//)\t\n\t\t\t\tend\n\t\t\tend\n\t\t\tinput.each do |x|\n\t\t\t\tif answer.include?(x)\n\t\t\t\t\toutput.push \"?\"\n\t\t\t\t\tanswer = answer.join.sub!(x, \" \").split(//)\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs output.sort.join + \"\\n\\n\"\n\t\t\t@turn += 1\n\t\tend\n\t\tif won?\n\t\t\tprint %x{clear}\n\t\t\tputs \"Please enter your guess: #{@input}\"\n\t\t\tputs \"****\"\n\t\t\tputs \"\\nCongratulations #{@name}! You guessed right, the code was #{@answer},\\nand you guessed it in #{@turn} tries!\"\n\t\telse\n\t\t\tputs %x{clear} + \"You were unable to guess the correct answer in the allotted number of tries!\\nGAME OVER!!!!! Better luck next time.\"\n\t\tend\n\t\tnew_game\n\tend", "title": "" }, { "docid": "3d1d44b7aac77dc0ef0ae55d1f3e7ec3", "score": "0.59882724", "text": "def num_players\n puts \"How many people are playing (0-2)?\"\n input = gets.strip.to_i\n\n # answer validation to run player assignment\n if input.between?(0,2)\n input\n# assign_players(input)\n else\n puts \"Your answer must be 0, 1, or 2.\"\n num_players\n end\nend", "title": "" }, { "docid": "a7ff1bbed8731ab7ceafb9ff26dfae89", "score": "0.5988001", "text": "def get_user_input(strikes, valid_entries) \r\n message = \"You have #{strikes} mistakes remaining. Enter a-z, or save\"\r\n puts message\r\n input = gets.chomp.downcase\r\n# I should implement error checking here.\r\n input \r\n end", "title": "" }, { "docid": "41506ed4e844204ce918f0e4aac84c01", "score": "0.59832793", "text": "def legality #Because it's a gambling game we need to ask if player is over 18\r\n\r\n puts \"To play this awesome game you will need to be over the age of 18!\"\r\n puts \"Are you over 18 years old?\r\n #{'Yes'.green} or #{'No'.red}\"\r\n\r\n age = gets.chomp\r\n case age\r\n when \"yes\"\r\n system(\"clear\")\r\n puts \"You may enter\".green\r\n when \"no\"\r\n puts \"Come back when youre older\".red\r\n exit\r\n end\r\nend", "title": "" }, { "docid": "c06ca1afd45575c58cb2b668cf3b07ea", "score": "0.59801364", "text": "def play_game?\n puts \"Want to play tic tac toe?\"\n response = STDIN.gets.chomp.downcase\n if response == \"yes\"\n return true\n else \n exit\n end\nend", "title": "" }, { "docid": "df888095b489aa6471102ae5ad60eda3", "score": "0.5979236", "text": "def character_info\n puts \"What would you like to know?\"\n\n if $round == 1\n puts\n \"1. Marital status\n 2. 1st appearance\n 3. Dead or alive?\"\n\n choice = gets.chomp\n\n if choice == \"1\"\n marital_status\n\nelsif choice == \"2\"\n first_appearance\nelsif choice == \"3\"\n dead_or_alive\n end\nquiz_choices\nend\nend", "title": "" }, { "docid": "85914075064a6f5b0db75c4543741a13", "score": "0.59750974", "text": "def query_user(user_prompt, input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend", "title": "" }, { "docid": "20c092590af2e822ab1327bc08ce67aa", "score": "0.5969346", "text": "def valid_num_players?(input)\n input == \"0\" || input == \"1\" || input == \"2\"\nend", "title": "" }, { "docid": "1bf075796f986b91dbc53a9d5725c3b5", "score": "0.59641427", "text": "def verify_input?(input)\n\t\n\t# input comes formatted as a string of the form \"x y state\"\n\tif !input.is_a? String\n\t\tputs \"input must be a string\"\n\t\treturn false\n\tend\n\t\n\t# divide input string into an array\n\tf_input = input.split(\" \")\n\t\n\tif f_input.length != 3\n\t\tputs \"wrong number of arguments\"\n\t\treturn false\n\t\n\telse\n\t\t# format string into Array\n\t\tx = f_input[0].to_i\n\t\ty = f_input[1].to_i\n\t\tstate = f_input[2].capitalize\n\t\t\n\tend\n\t\n\t# check data types\n\tif !(x.is_a? Integer) || !(y.is_a? Integer)\n\t\tputs \"x and y must be numbers\"\n\t\treturn false\n\t\n\telsif !(state.is_a? String)\n\t\tputs \"state must be a string\"\n\t\treturn false\n\t\n\tend\n\t\n\t# check data ranges\n\tif (x < 0 || x > WIDTH)\n\t\tputs \"x value out of range\"\n\t\treturn false\n\t\n\telsif (y < 0 || y > WIDTH)\n\t\tputs \"y value out of range\"\n\t\treturn false\n\t\n\telsif !(state == \"X\" || state == \"O\")\n\t\tputs \"state must be either X or O\"\n\t\treturn false\n\t\n\tend\n\t\n\t# everything's gravy\n\treturn true\n\t\nend", "title": "" }, { "docid": "75f727d0bc6fdbd66a52d5dd6515b912", "score": "0.59632635", "text": "def rps_game\n puts \"Player1 choose: rock, paper, scissors?\"\n input1=gets.chomp\n if input1 == \"rock\" || input1 == \"paper\" || input1 == \"scissors\"\n puts \"Now close your eyes. Player two get ready.\"\n puts \"Player2 choose: rock, paper, scissors?\"\n input2=gets.chomp\n if input2 == \"rock\" || input2 == \"paper\" || input2 == \"scissors\"\n if input1==\"rock\" && input2==\"paper\"\n puts \"player2 wins\"\n elsif input1 == \"rock\" && input2 == \"scissors\"\n puts \"player1 wins\"\n elsif input1 == \"paper\" && input2 == \"rock\"\n puts \"player1 wins\"\n elsif input1 == \"paper\" && input2 == \"scissors\"\n puts \"player2 wins\"\n elsif input1 == \"scissors\" && input2 ==\"rock\"\n puts \"player 2 wins\"\n elsif input1 == \"scissors\" && input2 == \"paper\"\n puts \"player 1 wins\"\n elsif input1 == input2\n puts \"tie! play again.\"\n rps_game\n end\n else\n puts \"Not an option, start over\"\n rps_game\n end\n else\n puts \"Not an option, start over\"\n rps_game\n end\nend", "title": "" }, { "docid": "e2a590a2b59bef8cb95b1a57e18abd8f", "score": "0.59632057", "text": "def determine_input\n if mouse_over_slider?\n state.user_input = :slider\n # If the mouse is over the star in the first grid\n elsif bfs_mouse_over_star?\n # The user is editing the star from the first grid\n state.user_input = :bfs_star\n # If the mouse is over the star in the second grid\n elsif heuristic_mouse_over_star?\n # The user is editing the star from the second grid\n state.user_input = :heuristic_star\n # If the mouse is over the target in the first grid\n elsif bfs_mouse_over_target?\n # The user is editing the target from the first grid\n state.user_input = :bfs_target\n # If the mouse is over the target in the second grid\n elsif heuristic_mouse_over_target?\n # The user is editing the target from the second grid\n state.user_input = :heuristic_target\n # If the mouse is over a wall in the first grid\n elsif bfs_mouse_over_wall?\n # The user is removing a wall from the first grid\n state.user_input = :bfs_remove_wall\n # If the mouse is over a wall in the second grid\n elsif heuristic_mouse_over_wall?\n # The user is removing a wall from the second grid\n state.user_input = :heuristic_remove_wall\n # If the mouse is over the first grid\n elsif bfs_mouse_over_grid?\n # The user is adding a wall from the first grid\n state.user_input = :bfs_add_wall\n # If the mouse is over the second grid\n elsif heuristic_mouse_over_grid?\n # The user is adding a wall from the second grid\n state.user_input = :heuristic_add_wall\n end\n end", "title": "" }, { "docid": "ed1e855b57ba65110a8360b88fbec2cb", "score": "0.59611905", "text": "def one_player\r\n game.board.reset!\r\n print \"You won't beat me, but you can try :P\\nWould you like to go first? (y/n): \"\r\n input = gets.strip\r\n\r\n if [\"y\", \"yes\"].include?(input.downcase)\r\n puts \"---- Human X vs Com O ----\\n\\n\"\r\n game.player_1 = Human.new(\"X\")\r\n game.player_2 = Computer.new(\"O\")\r\n elsif [\"n\", \"no\"].include?(input.downcase)\r\n puts \"---- Com X vs Human O ----\\n\\n\"\r\n game.player_1 = Computer.new(\"X\")\r\n game.player_2 = Human.new(\"O\")\r\n else\r\n puts \"Invalid input, quiting...\"\r\n return\r\n end\r\n\r\n game.play\r\n end", "title": "" }, { "docid": "d5b2433ca0cdd991a86e58bd95e02258", "score": "0.59601504", "text": "def wins_needed\n until @victory_condition > 0\n print \"How many rounds need to be won to win the game? \"\n @victory_condition = gets.chomp.to_i\n if @victory_condition <= 0\n \"I'm sorry that is not a valid number. Please try again.\"\n end\n end\n @victory_condition\n end", "title": "" }, { "docid": "9e996583d4573001fb9c1f578193daee", "score": "0.59596086", "text": "def victory?(current_player, status)\n puts \"\\n\"\n winner = \"Congratulations #{current_player.name} you won!\"\n\n # Rules for victory\n if (@a1.state == @a2.state) && (@a2.state == @a3.state) && (@a1.state != \"_\" )\n puts winner\n return true\n elsif (@b1.state == @b2.state) && (@b2.state == @b3.state) && (@b1.state != \"_\" )\n puts winner \n return true\n elsif (@c1.state == @c2.state) && (@c2.state == @c3.state) && (@c1.state != \"_\" )\n puts winner \n return true\n elsif (@a1.state == @b1.state) && (@b1.state == @c1.state) && (@a1.state != \"_\" )\n puts winner \n return true\n elsif (@a2.state == @b2.state) && (@b2.state == @c2.state) && (@a2.state != \"_\" )\n puts winner \n return true\n elsif (@a3.state == @b3.state) && (@b3.state == @c3.state) && (@a3.state != \"_\" )\n puts winner \n return true\n elsif (@a1.state == @b2.state) && (@b2.state == @c3.state) && (@a1.state != \"_\" )\n puts winner\n return true\n elsif (@a3.state == @b2.state) && (@b2.state == @c1.state) && (@a3.state != \"_\" )\n puts winner\n return true\n else\n end\n\n end", "title": "" }, { "docid": "f4cc1fa166357a1e0d12742cbb0a99b2", "score": "0.5956838", "text": "def player_menu\r\n #displays players\r\n Player.display_all_names_only\r\n #shows possible commands\r\n player_help\r\n\r\n #collects command\r\n while \r\n user_input = gets.chomp.downcase\r\n #I would've rather used a case\r\n #How to use case to check if number or string???\r\n if user_input.to_i != 0 && user_input.to_i <= Player.all.size\r\n player_asked = Player.get_from_index(user_input.to_i)\r\n player_asked.display_all_stats\r\n\r\n elsif user_input == \"help\"\r\n player_help\r\n elsif user_input == \"back\"\r\n #returning to the main menu\r\n menu_help\r\n return\r\n elsif user_input == \"exit\"\r\n #returns to the main menu to exit\r\n return user_input\r\n end\r\n end\r\n end", "title": "" }, { "docid": "31bba2bea326f0ccf9891d30d176dd62", "score": "0.5947999", "text": "def check(height, width, high, turns, board, group)\n i=0\n j=0\n puts\"\"\n base=board[0][0]\n #checks every block in the board. If any of them are a different colour, the next round starts otherwise the user wins.\n while(i<height)\n while(j<width)\n if(base!=board[i][j])\n draw_board(height, width, high, turns, board, group)\n end\n j=j+1\n end\n j=0\n i=i+1\n end\n puts \"Congratulations! you won after #{turns}\"\n #updates the high score\n if(turns<high)\n high = turns\n puts \"Well Done! You got a new high score.\"\n end\n puts \"press enter to return to main menu\"\n #waits for the user to return\n gets\n menu(height, width, high)\nend", "title": "" }, { "docid": "a9b1715476b21b9d15253683d15e4834", "score": "0.59433407", "text": "def color_critic\n puts \"What is your favorite color?\"\n choice = gets.chomp\n if choice == 'blue' || choice == 'green'\n puts \"#{choice} is a good choice\"\n else\n puts \"Really? #{choice} is not my favorite\"\n end\n\nend", "title": "" }, { "docid": "51559726e08211ad530751d1bf93d75b", "score": "0.5937575", "text": "def play_user_turn(user_input)\n column = case user_input.chars[0]\n when 'a', 'A'\n 0\n when 'b', 'B'\n 1\n when 'c', 'C'\n 2\n end\n\n row = case user_input.chars[1]\n when '1'\n 0\n when '2'\n 1\n when '3'\n 2\n end\n\n if @board.empty_at?(column, row)\n @board.play(@user_player, column, row)\n else\n # TODO: Handle invalid user play.\n end\n end", "title": "" }, { "docid": "6e36c33fdaf083c9b07c3e35e65c674b", "score": "0.59360117", "text": "def check_ans (ans, ans_user, player)\n if ans == ans_user.to_i\n puts \"Right !\".green\n puts \"Your life is #{ player[:live] }\".green\n else\n puts \"Wrong !\".red\n player[:live] -= 1\n puts \"Your life is #{ player[:live] }\".red\n end\nend", "title": "" }, { "docid": "f8fd36b2f9caeabc469b7f33a9112a7b", "score": "0.5928735", "text": "def result(player)\n #take input from user, convert into integre\n @answer = gets.chomp.to_i\n \n # check if sum is correct, output the message and lives\n @answer == num1 + num2 ? result = true : result = false\n if result == true\n puts \"#{player.name}: Yes! You are correct. (👍≖‿‿≖)👍 👍(≖‿‿≖👍)\".green\n player.lives\n else\n puts \"#{player.name}: Seriously? No! ( ; ̄ Д  ̄ )\".red\n player.lose\n end\n end", "title": "" }, { "docid": "5510c0114f33670c0da50db4b32a60f9", "score": "0.5928143", "text": "def human_winner?\n \tcheck_for_winner == \"human\"\n end", "title": "" }, { "docid": "9ff6bb79bb55a4bff6865e90c556a591", "score": "0.5925552", "text": "def validate_user_input()\r\n invalid_input = /[rps]/\r\n user_input = @player\r\n until\r\n user_input.match invalid_input\r\n puts \"Thanks for trying our app, please come back later\"\r\n exit\r\n end\r\n else\r\n\r\n end", "title": "" }, { "docid": "ebe93eadd1a5dc3d8a69d02e9bd27123", "score": "0.59249973", "text": "def make_decision(number, choice, ro, pa, sc)\n\n if choice == number\n puts \"*********you tied**********\"\n elsif choice == ro && number == sc\n puts \"*********Player Wins**********\"\n elsif choice == ro && number == pa\n puts \"*********Computer Wins**********\"\n elsif choice == pa && number == ro\n puts \"*********Player Wins************\"\n elsif choice == pa && number == sc\n puts \"***********Computer Wins************\"\n elsif choice == sc && number == ro\n puts \"***********Computer Wins*************\"\n elsif choice == sc && number == pa\n puts \"***********Player Wins***************\"\n end\n\nend", "title": "" }, { "docid": "c8fe71358a7a035fcbbd8aa0286d25ad", "score": "0.5909453", "text": "def check_input(input)\n\n if input.length == 1\n update_guessed_letters(input)\n\n if @word.include? input\n update_word_in_progress(input)\n won?(@word_in_progress)\n else\n @flower_pot.update_ascii\n end\n\n elsif input.length > 1\n won?(input.split(\"\"))\n @flower_pot.update_ascii\n end\n if @flower_pot.lost?\n puts \"\\n\\n\"\n @flower_pot.pot\n puts \"\\n YOU LOST!!! THE WORD WAS \" + \"#{@word.join(\" \")}!!!\".colorize(:cyan)\n exit\n end\n print_all\n end", "title": "" }, { "docid": "20a03ad37cf45cfea13777cdbf6fbb03", "score": "0.5902561", "text": "def ask_player_num \n valid_input = true\n until valid_input == false\n def player_prompt \n puts \"Are there 1 or 2 players? Please enter 1 or 2:\"\n player_input = gets.chomp\n end\n response = player_prompt\n if response == \"2\"\n valid_input = false\n puts \"Player 1 and Player 2: Welcome to the competition!!!!!!\"\n puts \"The first player to end a round with 10 points (or higher if there's a tie) wins!!\"\n puts \"Remember to spell correctly. Don't worry about capitalization\"\n puts \n puts \"If you get a wildcard question, you must wager your current points on it.\"\n puts \"If you answer it correctly, you win the number of points you wagered.\"\n puts \"But if you answer wrong, you LOSE the number of points you wagered.\" \n puts \"Good luck!\"\n return true\n elsif response == \"1\"\n valid_input = false\n puts \"Let's see how quickly you can get to 10 points and win!!\"\n puts \"Remember to spell correctly. Don't worry about capitalization\"\n return false\n else\n puts \"Error: Please enter the number 1 or the number 2\"\n end\n end\nend", "title": "" }, { "docid": "d31bec619f9a8d895acffc02486913af", "score": "0.58951426", "text": "def game_type\n valid_response = false\n response_list = ['yes', 'no']\n response = request_input('Would you like to start a new game? Type yes or no.')\n while valid_response == false\n response_list.include?(response) ? (valid_response = true) : (response = request_input('Please enter a valid response'))\n end\n response\nend", "title": "" }, { "docid": "e4e33ab326aa89cb2bc8c8a44f330608", "score": "0.5893056", "text": "def see?\n puts \"Would you like to see the current pot?\"\n user_input = gets.chomp\n user_input == \"yes\" ? true : false\n end", "title": "" }, { "docid": "a1d3cd93825067c8d8df5a2134db7c71", "score": "0.5892886", "text": "def get_input\n player_input = \"\"\n until OPTIONS.include?(player_input)\n print player_input == \"\" ? \"\" : \"That isn't part of the game, type 'Rock', 'Paper', or 'Scissors': \"\n player_input = gets.chomp.downcase\n end\n return player_input\n end", "title": "" }, { "docid": "ed1eade383894e4f5a29bc4245cbe547", "score": "0.58917326", "text": "def user_turn\t\t#method that retrieves the players move and makes sure that is in an empty slot of formated correctly\n\tput_line\n\tdraw_game\n\tprint \"\\n #{@user_name}, why don't you make a move or type 'exit' to quit? \"\n\tSTDOUT.flush\n\tinput = gets.chomp.downcase.to_sym\n\tput_bar\n\tif input.length == 2\n\ta = input.to_s.split(\"\")\n\t\tif(['a','b','c'].include? a[0])\n\t\t\tif(['1','2','3'].include? a[1])\n\t\t\t\tif @places[input] == \" \"\n\t\t\t\t\t@places[input] = @user\n\t\t\t\t\tput_line\n\t\t\t\t\tputs \" #{@user_name} marks #{input.to_s.upcase}\"\n\t\t\t\t\tcheck_game(@cpu)\n\t\t\t\telse\n\t\t\t\t\twrong_move\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twrong_input\n\t\t\tend\n\t\telse\n\t\t\twrong_input\n\t\tend\n\telse\n\t\twrong_input unless input == :exit\n\t\tputs \"\\n \tGoodbye! -- Thanks for Playing #{@user_name}\"\n\tend\n end", "title": "" }, { "docid": "24db806f17f1a524a6de98be861c3e51", "score": "0.5888124", "text": "def win_place\n puts \"That was a good thing to do, you might just win...\"\n puts \"You have one final choice to make: 'circle' or 'square'\"\n\n print $prompt\n choice = $stdin.gets.chomp\n\n if choice == \"circle\"\n puts \"Congratulations, you win!\"\n exit(0)\n elsif choice == \"square\"\n dead(\"So close but you picked the wrong one so you're dead!\")\n else\n dead(\"You were so close but you died because you still could follow the rules and type a valid choice!\")\n end\nend", "title": "" }, { "docid": "8d37a9f70d08a1c97b9b2ad31edb0127", "score": "0.58837", "text": "def get_user_input(player_number)\n valid_move = false\n until valid_move == true\n puts \"#{player_number}, place your mark (e.g. A1).\"\n move = gets.chomp\n if @@game_state[move] == ' '\n valid_move = true\n return move\n elsif @@game_state[move] == nil\n puts \"\\nHA! That is not a valid move, cheater! Try again.\"\n else\n puts \"\\nStop heathen! That space is already taken. Try again.\"\n end\n end\n end", "title": "" }, { "docid": "3b44e3f9308b59facc68dfbbd58d8b6c", "score": "0.58826214", "text": "def input(pack, suits, player, aces, computer, computer_aces)\n # 370 X$=INKEY$:IF X$<>\"S\" AND X$<>\"T\" THEN 370\n puts 'Twist (T) or Stick (S) ?'\n answer = gets.chomp.upcase\n input(pack, suits, player, aces, computer, computer_aces) if (answer != 'S' && answer != 'T')\n # 380 IF X$=\"S\" THEN 560\n stick(pack, suits, player, computer, computer_aces) if answer == 'S'\n # 390 LOCATE 3,YC+5\n # 400 YC=YC+1\n # 410 GOSUB 740\n value = deal(pack, suits)\n # 420 S=S+F\n player += value\n # 430 IF F=11 THEN ACES=ACES+1\n aces += 1 if value == 11\n score_check(pack, suits, player, aces, computer, computer_aces)\nend", "title": "" }, { "docid": "44a2a39332b71d47ae451cc12f47f492", "score": "0.5875506", "text": "def human_check\n begin\n human = gets.chomp.downcase\n if human != \"human\" && human != \"ai\"\n raise \"Wrong input!\"\n end\n rescue StandardError => e\n puts \"#{e} Write either 'human' or 'AI'\"\n retry\n else\n return human == 'human' ? true : false\n end\n end", "title": "" }, { "docid": "920d70c1d04a4f9ae6a249123f733990", "score": "0.5875285", "text": "def gather_user_input\n puts \"Enter your guess from a number 1 through 100: \"\n user_input = gets.chomp\n if is_valid_input (user_input)\n return user_input.to_i\n else\n return 0 # return zero as marker for invalid input\n end\nend", "title": "" }, { "docid": "39ee7f3df22d01f58d1927b7379dadf2", "score": "0.58748066", "text": "def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend", "title": "" }, { "docid": "e6b169c99b49cadc43cfb6cf6121e5c4", "score": "0.5867965", "text": "def valid_input?\n if @guess.length == 1 || @guess == 'save'\n @guess\n else\n puts \"INVALID INPUT\"\n user_guess\n end\n end", "title": "" }, { "docid": "97ac2e96b483a3b405ad67303dc1825c", "score": "0.5866675", "text": "def determine_input\n # If the mouse is over the star in the first grid\n if dijkstra_mouse_over_star?\n # The user is editing the star from the first grid\n state.user_input = :dijkstra_star\n # If the mouse is over the star in the second grid\n elsif greedy_mouse_over_star?\n # The user is editing the star from the second grid\n state.user_input = :greedy_star\n # If the mouse is over the star in the third grid\n elsif a_star_mouse_over_star?\n # The user is editing the star from the third grid\n state.user_input = :a_star_star\n # If the mouse is over the target in the first grid\n elsif dijkstra_mouse_over_target?\n # The user is editing the target from the first grid\n state.user_input = :dijkstra_target\n # If the mouse is over the target in the second grid\n elsif greedy_mouse_over_target?\n # The user is editing the target from the second grid\n state.user_input = :greedy_target\n # If the mouse is over the target in the third grid\n elsif a_star_mouse_over_target?\n # The user is editing the target from the third grid\n state.user_input = :a_star_target\n # If the mouse is over a wall in the first grid\n elsif dijkstra_mouse_over_wall?\n # The user is removing a wall from the first grid\n state.user_input = :dijkstra_remove_wall\n # If the mouse is over a wall in the second grid\n elsif greedy_mouse_over_wall?\n # The user is removing a wall from the second grid\n state.user_input = :greedy_remove_wall\n # If the mouse is over a wall in the third grid\n elsif a_star_mouse_over_wall?\n # The user is removing a wall from the third grid\n state.user_input = :a_star_remove_wall\n # If the mouse is over the first grid\n elsif dijkstra_mouse_over_grid?\n # The user is adding a wall from the first grid\n state.user_input = :dijkstra_add_wall\n # If the mouse is over the second grid\n elsif greedy_mouse_over_grid?\n # The user is adding a wall from the second grid\n state.user_input = :greedy_add_wall\n # If the mouse is over the third grid\n elsif a_star_mouse_over_grid?\n # The user is adding a wall from the third grid\n state.user_input = :a_star_add_wall\n end\n end", "title": "" }, { "docid": "0678e287991a8304061e7b2f8b8682f1", "score": "0.58597845", "text": "def want_to_play?\n puts \"Hello! Would you like to play a few games of Rock, Paper, Scissors? (type 'Y' or 'N')\"\n gets.chomp.upcase\n end", "title": "" }, { "docid": "d349b315f6738b0e4e6b8cbef9ded82f", "score": "0.5854414", "text": "def quality_control(answer)\n\t\tif answer == \"cheat code\"\n\t\t\t@p1_score = 100 - 1 \n\t\t\treturn true\n\t\telsif answer == \"start over\"\n\t\t\tnewGame = Game.new\n\t\t\tputs \"Started over. Scores have been reset\"\n\t\t\tnewGame.play\n\t\telsif answer == \"rock\" or answer == \"scissors\" or answer == \"paper\"\n\t\t\treturn true\n\t\telse\n\t\t\tputs \"What is #{answer}? I'm not sure it's a real word.\"\n\t\t\treturn false\n\t\tend\t\n\tend", "title": "" }, { "docid": "53ed4ee3af682a9c7208aded9bfcc058", "score": "0.58441097", "text": "def check_user_input\n\tloop do \n\t\tbreak if @storage.has_key?(@user_input)\n\t\tputs \"Sorry! It looks like that team is not in the World Cup. Please enter a valid team name.\"\n\t\t@user_input = gets.chomp.downcase\n\tend \nend", "title": "" }, { "docid": "f4fa26c17288a3504ce16b194ccca080", "score": "0.5843792", "text": "def present_test(challenge)\r\n \r\n Console_Screen.cls #Clear the display area\r\n print challenge + \"\\n\\n: \" #Display the challenge sentence\r\n result = STDIN.gets #Collect the player's input\r\n result.chop! #Remove the end of line marker\r\n \r\n #Analyze the player input and see if it is correct\r\n if challenge == result then\r\n \r\n #Keep track of the number of correctly retyped challenge sentences\r\n $noRight += 1 \r\n Console_Screen.cls #Clear the display area\r\n puts \"Your challenge phrase was: \\n\" + challenge + \"\\n\"#Keep the player informed\r\n puts \"\\nUser entered: \\n\" + result + \"\\n\"\r\n print \"Correct!\\n\\nPress Enter to continue.\" \r\n Console_Screen.pause #Pause the game\r\n \r\n else \r\n \r\n Console_Screen.cls #Clear the display area\r\n puts \"Your challenge phrase was: \\n\" + challenge + \"\\n\"#Keep the player informed\r\n puts \"\\nUser entered: \\n\" + result + \"\\n\"\r\n print \"Incorrect!\\n\\nPress Enter to continue.\"\r\n Console_Screen.pause #Clear the game\r\n \r\n end\r\n \r\n end", "title": "" }, { "docid": "f304250b559f41458219dfe9d45341b1", "score": "0.58417434", "text": "def tested_input(input, section)\n\n case section\n when 'create_player_names'\n\n if input.length > 20\n puts \"Sorry, your name can't be more than 20 characters\"\n redo_input(input)\n else\n input\n end\n\n\n when 'choose_player_marks'\n input.upcase!\n\n if input == 'X' || input == 'O'\n input\n else\n puts \"\\nThat's not a valid marker. Please type the letter X or O\"\n redo_input(input,section)\n end\n\n\n when 'take_a_turn'\n arr = input.split(\"\")\n\n arr[0].upcase!\n\n if arr.length == 2 && 'ABC'.include?(arr[0]) && '123'.include?(arr[1])\n # Players can't mark over a spot that already has one\n if Player.class_variable_get(:@@master_marker_history).include? input\n puts \"\\nThat spot is already marked, please choose a different location\"\n redo_input(input,section)\n else\n input\n end\n else\n puts \"\\nThat's not a valid coordinate. Please type the letter corresponding to column, followed by the number corresponding to row. For example, A3\"\n redo_input(input,section)\n end\n\n\n\n\n when 'close_game'\n input.upcase\n\n if input == 'Y' || input == 'N'\n input\n else\n puts \"\\nThat's not a valid answer. Please type the letter y or n\"\n redo_input(input,section)\n end\n\n end #End of case\n\nend", "title": "" }, { "docid": "266a9b8955e9e2e364209598044e1577", "score": "0.5841632", "text": "def valid_input?(input)\n if input.length == 1 # When user gives abbreviated color\n @colors.any? { |color| color[0] == input.downcase }\n else # When user gives full color\n @colors.include? input.downcase\n end\n end", "title": "" }, { "docid": "16a5c471fa5eb24d766240a9eea90be8", "score": "0.5841586", "text": "def game_rules\n\n puts \"LES RÈGLES\"\n puts \"Tu es en bas d'un escalier à dix marches.\"\n puts \"À chaque tour, tu vas lancer un dès.\"\n puts \"Si tu fais 5 ou 6, tu avances d'une marche\"\n puts \"Si tu fais 1, tu descends d'une marche.\"\n puts \"Si tu fais 2, 3, ou 4, rien ne se passe.\"\n puts \"Si tu veux tout arrêter tape *stop* à n'importe quel moment de ta partie !\"\n puts \"\"\n puts \"As-tu compris? (y/n)\"\n print \">\"\n\n input = gets.chomp\n\n if input == \"y\" \n play\n elsif input == \"n\"\n puts \"\"\n puts \"Ok, si tu veux revenir au menu, tape 1, si tu veux relire les règles, tape 2\"\n print \"> \"\n input2 = gets.chomp\n if input2 == \"1\"\n puts \"\"\n accueil\n elsif input2 == \"2\"\n puts \"\" \n game_rules\n end\n end\nend", "title": "" }, { "docid": "2fad18261236554bbbe356ec1c383d46", "score": "0.5841525", "text": "def get_and_validate_input\n result = gets.chomp.strip\n case\n when result.length < 2\n return FALSE\n when result == 'NO'\n return :quit\n else\n return result\n end\n end", "title": "" }, { "docid": "f5f509f851239f6d0f5b4ea93334a204", "score": "0.58260953", "text": "def start_game()\n prompt = TTY::Prompt.new\n choice = prompt.select(\"Welcome to Ash's Sudoku generator! Please select a game difficulty\", %w(Easy Medium Hard))\n if choice == \"Easy\" \n grid = $easy\n answers = $easy_answers\n elsif choice == \"Medium\" \n grid = $medium \n answers = $medium_answers\n else choice == \"Hard\"\n grid = $hard\n answers = $hard_answers\n end \n print_current_grid(grid)\n while $play_game == true\n user_input($reference_hash, grid, answers)\n puts print_current_grid(grid)\n if grid == $easy_answers || grid == $medium_answers || grid == $hard_answers\n puts \"Board complete - You win!\"\n $play_game = false\n else\n end\n end\nend", "title": "" }, { "docid": "18a9c3904c487709d3104205435716d1", "score": "0.58246505", "text": "def introduce_the_game()\n puts \"On the count of three, type either 'rock', 'paper', or 'scissors'.\"\n puts \"Ready?! (Y/N)\"\n response = gets.chomp.downcase\n until response == \"y\"\n puts \"...Ready now?\"\n response = gets.chomp.downcase\n end\n puts \"1\"\n puts \"2\"\n puts \"3\"\n selection = gets.chomp.downcase\n if (selection == 'rock' || selection == 'scissors' || selection == 'paper')\n return selection\n else puts \"#{selection} is invalid input. Let's try this again...\"\n introduce_the_game()\n end\nend", "title": "" }, { "docid": "1d4023e6d042147c2c4b1d659dc28514", "score": "0.58239555", "text": "def check_player_answer(question, player)\n print \"> \"\n input = $stdin.gets.chomp\n if question.check_answer(input)\n puts \"Yes! You are correct.\"\n else\n puts \"Seriously? No!\"\n player.incorrect\n end\nend", "title": "" }, { "docid": "ebec9e66d9af981425318eb517f7b065", "score": "0.58238125", "text": "def create_game(input)\n if input == 0\n game = Game.new(Players::Computer.new(\"X\"), Players::Computer.new(\"O\"), nil)\n elsif input == 2\n game = Game.new(nil, nil, nil)\n elsif input == 1\n puts \"Would you like to go first? (y/n)\"\n answer = gets.strip.downcase\n if answer == \"y\" || answer == \"yes\"\n game = Game.new(nil, Players::Computer.new(\"O\"), nil)\n elsif answer == \"n\" || answer == \"no\"\n game = Game.new(Players::Computer.new(\"X\"), nil, nil)\n else\n puts \"Your answer must be y or n.\"\n create_game(input)\n end\n end\n# game\nend", "title": "" }, { "docid": "08e2ca9d550df881f8c89f7a4e954a85", "score": "0.5823281", "text": "def handle_user_input(input)\n\t\t@player_move = nil\n\n\t\tif @@options[:exit].include? input\n\t\t\tputs \"Terminating game..\"\n\t\t\t@exit_game = true\n\n\t\telsif @@options[:new_game].include? input\n\t\t\tnew_game\n\n\t\telsif @@options[:moves].include? input.to_i and !is_game_end\n\t\t\tint_input = input.to_i\n\t\t\tif @board.is_open(int_input)\n\t\t\t\t@board.set_cell(int_input, @player_symbol)\n\t\t\t\t@player_move = true\n\t\t\telse\n\t\t\t\t@error_message = \"You cannot move to <#{int_input}>, choose again.\"\n\t\t\tend\n\n\t\telse\n\t\t\t@error_message = \"Invalid input '#{input}'\"\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "4bf7fe01c66b2f864d7f9b8f1b5f37e4", "score": "0.5822851", "text": "def display_error_messages(has_exceeded_attempts, is_a_numbered_input)\n if !has_exceeded_attempts\n if is_a_numbered_input\n puts 'Please choose a valid number'\n else\n puts 'Please enter something !'\n end\n else\n puts 'Alright - game is over |o| ...'\n end\n end", "title": "" }, { "docid": "8800ff7a9071a72d8707d4d24277b9cc", "score": "0.5817676", "text": "def winner\n case\n when @ui_choice == 1\n if @ai_choice == 2\n puts \"Paper covers Rock! Engagement -- Computer!\"\n @ai_point += 1\n elsif @ai_choice == 3\n puts \"Rock crushes Scissors! Engagement -- #{@name}!\"\n @ui_point += 1\n end\n when @ui_choice == 2\n if @ai_choice == 1\n puts \"Paper covers Rock! Engagement -- #{@name}!\"\n @ui_point += 1\n elsif @ai_choice == 3\n puts \"Scissors cuts Paper! Engagement -- Computer!'\"\n @ai_point += 1\n end\n when @ui_choice == 3\n if @ai_choice == 1\n puts \"Rock crushes Scissors! Engagement -- Computer!'\"\n @ai_point += 1\n elsif @ai_choice == 2\n puts \"Scissors cuts Paper! Engagement -- #{@name}!\"\n @ui_point += 1\n end\n end\n if @ui_choice == @ai_choice\n puts \"Engagement -- TIE! Go again!\"\n end\n end", "title": "" }, { "docid": "2e9581b989f3e3433ae56f3f2db37d04", "score": "0.58176184", "text": "def input_validator(input)\n\t\tif input =~ /^[a-c][1-3]$/\n\t\t\tunless already_picked(input)\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\tputs \"Sorry, that square is full. Try again.\"\n\t\t\t\treturn true\n\t\t\tend\n\t\telse\n\t\t\tputs \"Sorry, that input was invalid. Try again.\"\n\t\t\treturn true\n\t\tend\n\tend", "title": "" }, { "docid": "982e156fc409d97f2c7c1024d02f21ab", "score": "0.5812028", "text": "def another_game\n puts \"So? Another one? Type Y or N please\"\n answer = gets.chomp.upcase\n if answer == \"Y\"\n game\n elsif answer == \"N\"\n puts \"Ok, see ya!\"\n else\n puts \"I\\'ll take it as a no... Bye!\"\n end\nend", "title": "" } ]
3e7663214cea014d7a92569056d65087
Render without authorization, for better performance
[ { "docid": "ceeac6a9e3265af54f3d070785b10b2b", "score": "0.7222407", "text": "def render_without_authorization(*actions)\n self.actions_without_authorization = [*actions]\n\n class_eval do\n #\n # It needs to be created afterward,\n # No idea why\n #\n def render(*args)\n if render_without_authorization?\n Strongbolt.without_authorization { _render(*args) }\n else\n _render(*args)\n end\n end\n end\n end", "title": "" } ]
[ { "docid": "559bb9c63cea8af4b518f5bbebd3aaaa", "score": "0.8016162", "text": "def render(*args)\n if render_without_authorization?\n Strongbolt.without_authorization { _render(*args) }\n else\n _render(*args)\n end\n end", "title": "" }, { "docid": "21f8b021eab64a8abcd7a4c6b9455fea", "score": "0.74154115", "text": "def render_unauthorized\n\t\trender(status: :unauthorized)\n\tend", "title": "" }, { "docid": "42a950ab113c5312a73bb00ae4d05df4", "score": "0.6992153", "text": "def no_access\n render layout: nil\n end", "title": "" }, { "docid": "5ef72f982d24bd291723d3ada181f07f", "score": "0.6989198", "text": "def natural_unprivileged_render\n\t\t\tnil\n\t\tend", "title": "" }, { "docid": "73fcbc64199327b7eaae01e519ebdbe9", "score": "0.6948896", "text": "def render_admin_only\n render_unauthorized(msg=\"You must be Admin to perform this operation\")\n end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "b370b36a814780cc30165c0067984353", "score": "0.6920491", "text": "def render; end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.69034964", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.69034964", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.69034964", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "6e867b80a563fe7c94e95029f86c3038", "score": "0.69034964", "text": "def show\n skip_authorization\n end", "title": "" }, { "docid": "e22da30777104b86ae4c21d37e02745d", "score": "0.6852699", "text": "def render_no_access\n render file: 'public/401.html', status: :unauthorized\n end", "title": "" }, { "docid": "cc0257e257da7a7b653fb130e32d1109", "score": "0.67928016", "text": "def render_unauthorized\n render(file: 'public/401.html', status: :unauthorized, layout: false) and return\n end", "title": "" }, { "docid": "0f9897ee0de631b1f348b71485f5fdf8", "score": "0.67311287", "text": "def before_render; end", "title": "" }, { "docid": "e5204c35f3c5950773c84b789cffc089", "score": "0.66329384", "text": "def authorized\n render status: :unauthorized unless logged_in?\n end", "title": "" }, { "docid": "c30957be166b7490cda474a839cc32d8", "score": "0.6611365", "text": "def render\n end", "title": "" }, { "docid": "c30957be166b7490cda474a839cc32d8", "score": "0.6611365", "text": "def render\n end", "title": "" }, { "docid": "c30957be166b7490cda474a839cc32d8", "score": "0.6611365", "text": "def render\n end", "title": "" }, { "docid": "c30957be166b7490cda474a839cc32d8", "score": "0.6611365", "text": "def render\n end", "title": "" }, { "docid": "9cfdec68842e7833bd917a18f24f0ae8", "score": "0.66090983", "text": "def rendered\n end", "title": "" }, { "docid": "d0e689cc60dffc38c935c135510dc023", "score": "0.6592599", "text": "def render_tutor(options = nil, &block)\n options[:file] = \"../../#{@path}/views/#{options[:file]}\"\n @response_body << @controller.unprotected_render_to_string(options, &block)\n end", "title": "" }, { "docid": "743174339b74706f98e5919e1ba351a7", "score": "0.65791255", "text": "def show\n render \"shared/authorize\" and return\n end", "title": "" }, { "docid": "2acc4842060a8c942481224162d9225b", "score": "0.654936", "text": "def show\n redirect_to root_path, :status => :forbidden unless visible?\n render :layout => 'content'\n end", "title": "" }, { "docid": "31ea2a2e968bfe3e31f2ed9f3b819e84", "score": "0.6535969", "text": "def render_unauthorized\n render json: { errors: ['Unauthorized'] }, status: 401 and return\n end", "title": "" }, { "docid": "9275f63be611541e4a4e721d58cfd9d4", "score": "0.65354854", "text": "def render_unauthorized_user\n\t\trender json: { error: \"No está autorizado para accesar.\" }, status: 401\n\tend", "title": "" }, { "docid": "8a253f44ff76e1db9061a782fa7c4aba", "score": "0.6523508", "text": "def render\n if @user\n dash_methods = methods.delete_if {|method| !method.to_s.start_with?('dash_')}\n dash_methods.sort.each { |method| send(method) }\n # Create output\n %i[error warning info].each { |type| @html << \"<div class=\\\"dashboard-panel\\\">#{@msgs[type]}</div>\" }\n @html << '<div style=\"clear: both;\"></div>'\n end\n self\nend", "title": "" }, { "docid": "0906fc4bbdd421b32eeffc634a786c4b", "score": "0.6514108", "text": "def require_admin #this is our authorization\n render file: '/public/404' unless current_admin?\n end", "title": "" }, { "docid": "ca9f490d950416b3fb5f3f0653821e45", "score": "0.65052164", "text": "def render_page_template\n if @page.children_restricted? && !logged_in?\n render :action => 'restricted', :layout => @page.page_layout\n else\n respond_to do |wants|\n wants.html do\n if request.xhr?\n render :template => @page.public_template, :layout => false\n else\n render :template => @page.public_template, :layout => @page.page_layout\n end\n end\n wants.rss do\n render :template => @page.public_template, :layout => false\n end\n end\n end \n end", "title": "" }, { "docid": "6d531a16ecae140cc6cfc09de35d1e2e", "score": "0.6497623", "text": "def dont_allow\n render :forbidden\n end", "title": "" }, { "docid": "a36e8a426676d25d14cbcce0f6e7b937", "score": "0.64813125", "text": "def render_unauthorized\n raise BestOfYearAwards::Unauthorized if test?\n render_error(:status => 403, :type => 'Unauthorized', :message => t('errors.unauthorized'))\n end", "title": "" }, { "docid": "dbc52b0f58dd0e33e5992cd7f721736a", "score": "0.64780086", "text": "def default_render(*args)\n # no-op\n end", "title": "" }, { "docid": "5116c1ea4797c775872030fd64036a9e", "score": "0.6473533", "text": "def render\n\n end", "title": "" }, { "docid": "72182e416bb0e44739e070edce483614", "score": "0.6465423", "text": "def render\n\t\t\traise \"Not implemented.\"\n\t\tend", "title": "" }, { "docid": "31ed87c78c101e39a596bce719060a51", "score": "0.6461477", "text": "def respond_forbidden\n head :forbidden\n @performed_render = true\n end", "title": "" }, { "docid": "0915fc0988aa364176d574ae97916c1f", "score": "0.6457905", "text": "def render_unauthorized\n raise Mihi::Unauthorized if test?\n render_error(status: 403, type: 'Unauthorized', message: t('errors.unauthorized'))\n end", "title": "" }, { "docid": "8e4eb8f026fe38decaa50e542b6ff9e9", "score": "0.64048314", "text": "def safe_login\n render :layout => false\n end", "title": "" }, { "docid": "8875bde1c3435547867820660ddb6ba4", "score": "0.6378587", "text": "def login\n render(:layout => false)\n end", "title": "" }, { "docid": "eb58c2fddce303d0423c72fd0473d383", "score": "0.63748485", "text": "def render_plain; end", "title": "" }, { "docid": "4069f7258167acf3a83b9b73d2c00946", "score": "0.63705313", "text": "def restrict_access\n render :file => \"public/401.html\", :status => :unauthorized, :layout => false\n end", "title": "" }, { "docid": "bb038d03eb4449a9f56da9f4f1b176dc", "score": "0.6342997", "text": "def show\n if @cocktail.users.select { |user| user == @auth_user }.empty?\n render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n end\n end", "title": "" }, { "docid": "fd4a74f407e6aaca857e65bbced63f2d", "score": "0.63423634", "text": "def user_not_authorized\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end", "title": "" }, { "docid": "e2281064ae8e52749f6de4867c014687", "score": "0.63328844", "text": "def default_render; end", "title": "" }, { "docid": "50ebc1af5199372d848a937dcd8bfc2b", "score": "0.6332093", "text": "def template\n if params[:path].kind_of?(Array) && params[:path][2] =~ /\\.jpg|\\.gif|\\.png/\n render :nothing => true\n return\n end\n \n PageMap.reset_tree_nodes_list\n\n if params[:logout]\n AuthenticationModel.logout_from_admin\n\n # Upon logout we'd like to press Back in browser and refresh the page\n # So we need to remove the logout=true from URL.\n redirect_to request.url.sub(/logout=true/,'').sub(/\\?$/,'')\n return\n end\n \n @ip = request.remote_ip\n unless @website\n # External link\n check_url_migration(true)\n return\n end\n\n unless @presenter\n head_status_404\n return\n end\n\n # in case the page is not found in the DB\n unless @presenter.node\n # Internal link\n check_url_migration\n return\n end\n\n # in case the page's domain is not of correct\n unless @presenter.node.root.resource.id == @website.entry_point_id\n status_404\n return\n end\n\n\n respond_to do |format|\n format.html do\n if request.xhr?\n render_json_widget\n return\n end \n resource = @presenter.node_resource_type.hrid\n klass = t_class(resource)\n layout_class = l_class(resource)\n if AuthenticationModel.current_user_is_anonymous?\n # To cache even in development mode change\n # Rails.env == 'development'\n # to\n # false\n # Do not forget to uncomment correspondent lines in development.rb\n nocache = params[:nocache]\n if !self.perform_caching || nocache || @presenter.site_settings[:cache][:disable_cache]\n render :widget => klass, :layout_class => layout_class\n else\n key = @presenter.node.id.to_s\n result = Rails.cache.read(key)\n if result\n render :text => result #if stale?(:etag => result)\n else\n Rails.cache.write(key,\n render(:widget => klass, :layout_class => layout_class))\n # Store the list of tree nodes used to render the current page\n PageMap.save_tree_nodes_list\n end\n end\n else\n # Authenticated user ==> no cache\n render :widget => klass, :layout_class => layout_class\n end\n end\n format.json do\n render_json_widget\n return\n end\n format.rss {\n render_feed('rss')\n return\n }\n format.atom {\n render_feed('atom')\n return\n }\n end\n\n end", "title": "" }, { "docid": "626b8dfe831229f56f0fdc6f9a0d0f32", "score": "0.6323838", "text": "def render\n raise NotImplementedError\n end", "title": "" }, { "docid": "ecff5ef9a9efcf3d3db927bd96fb648a", "score": "0.6314974", "text": "def render \n # Base implementation is empty\n end", "title": "" }, { "docid": "456a9d7b441cc2522d18303009529bf8", "score": "0.6303531", "text": "def not_allowed\n render_template 'not_allowed'\n end", "title": "" }, { "docid": "456a9d7b441cc2522d18303009529bf8", "score": "0.6303531", "text": "def not_allowed\n render_template 'not_allowed'\n end", "title": "" }, { "docid": "2c8e822da175df235b279a4787f67319", "score": "0.62974024", "text": "def render\n raise NotImplementedError\n end", "title": "" }, { "docid": "7452ec9d2cacd52fdf7c6e1612060f8b", "score": "0.6296661", "text": "def access_denied\n render :template => 'shared/access_denied', :layout => false\n end", "title": "" }, { "docid": "1e90b80bc659e987a1c3b0b4089ae231", "score": "0.6296268", "text": "def authorized\n render_status :unauthorized unless logged_in?\n end", "title": "" }, { "docid": "5d398a6db6859123df4a85eb3e790d3f", "score": "0.62901247", "text": "def render( * )\n\t\tnil\n\tend", "title": "" }, { "docid": "afa08771938cc3cf5ebad21d969f8636", "score": "0.62870896", "text": "def view\n if(!@resource.can(:view, current_user))\n redirect_to root_path, notice: \"Your account does not enable you to view this \" + @resource.resource_type_for_display.downcase\n return\n end\n\n render :show\n end", "title": "" }, { "docid": "6a9ac98b2b89746c44eea4513cc510df", "score": "0.6276872", "text": "def require_login\n render :template => 'shared/login' unless logged_in?\n end", "title": "" }, { "docid": "2c93cc32aa064441a9a5fca7ec792969", "score": "0.6261063", "text": "def authenticate\n render_unauthorized unless authenticated?\n end", "title": "" }, { "docid": "5d301cb9e44911c33f893d76646e659a", "score": "0.624503", "text": "def preflight; render :nothing => true; end", "title": "" }, { "docid": "ae3128d6df666ccaf046e5ddbee8b8c4", "score": "0.6239395", "text": "def render(*args); end", "title": "" }, { "docid": "84e8d5ea6f7aa7b4e0cd47e95f1d3a0a", "score": "0.62333363", "text": "def allow_html_on_every_action\n render 'dashboard/index' and return if params[:format] != 'json'\n end", "title": "" }, { "docid": "5d46d5dbbfc3e31b9159489fcb2f0983", "score": "0.62327516", "text": "def nothing_special\n render plain: \"nothing_special\"\n end", "title": "" }, { "docid": "4bb2dc2ef88b6831ecd62574d659c388", "score": "0.62263083", "text": "def unauthorized\n collection\n @posts=@collection\n render :index\n end", "title": "" }, { "docid": "3e2571a61fdd83590862e540fa998ea4", "score": "0.6221895", "text": "def render!(*args, &blk)\n halt render(*args, &blk)\n end", "title": "" }, { "docid": "ee8ab497b1021a0063380a209be3b0e0", "score": "0.62192255", "text": "def render_forbidden(messages = [], *args)\n render @format => {messages: join_errors(messages, args) || []}, status: :forbidden\n end", "title": "" }, { "docid": "6d6c0beb2b9fc3f81ce9b84da84b555e", "score": "0.62155616", "text": "def show\n respond_to do |format|\n format.html { render :text => \"You don't have permission to view this\" }\n end\n end", "title": "" }, { "docid": "6d6c0beb2b9fc3f81ce9b84da84b555e", "score": "0.62155616", "text": "def show\n respond_to do |format|\n format.html { render :text => \"You don't have permission to view this\" }\n end\n end", "title": "" }, { "docid": "6d6c0beb2b9fc3f81ce9b84da84b555e", "score": "0.62155616", "text": "def show\n respond_to do |format|\n format.html { render :text => \"You don't have permission to view this\" }\n end\n end", "title": "" }, { "docid": "7b2336113e6ffe709ac6ef47f602436b", "score": "0.6212652", "text": "def initialize\n super\n render\n end", "title": "" }, { "docid": "9ec050e346210ffc2f415e059d71614b", "score": "0.6209942", "text": "def access_denied\n render 'access_denied'\n end", "title": "" }, { "docid": "d41cb47140943f8d2f246f36734c823d", "score": "0.6204403", "text": "def access_denied!\n render 'errors/401', status: :unauthorized, layout: 'empty' # && return\n end", "title": "" }, { "docid": "41a529e53995f90b781f1cf008675482", "score": "0.62039655", "text": "def render(*args, &block); end", "title": "" }, { "docid": "007935c975de9fe0f2215984ddcab85b", "score": "0.62025994", "text": "def not_authorized\n render(:text => \"Not Authorized\", :status => 401)\n end", "title": "" }, { "docid": "d47267dee4e9d838dd5283cfe3a884ae", "score": "0.61992645", "text": "def unauthorized\n render :text => \"Unauthorized.\", :status => :unauthorized\n end", "title": "" }, { "docid": "359a9993da5d8afbde1615e119adc243", "score": "0.61982876", "text": "def show\n authorize!(admin_permission? || is_me?)\n if is_me? && normal_user?\n render layout: 'public'\n end\n end", "title": "" }, { "docid": "85c3e510e80f547c8b4bd1e264c3e5ed", "score": "0.619649", "text": "def do_render\n render 'authentication/login'\n end", "title": "" }, { "docid": "b596570b888d654b35160b2a8c5e0341", "score": "0.6189077", "text": "def render_unauthorized\n render json: {errors: ['Bad credentials']}, status: 401\n end", "title": "" }, { "docid": "0863731d484999ca7fd2aa18b4d167bc", "score": "0.61866146", "text": "def access_denied\n return render(text: 'something wrong.')\n end", "title": "" }, { "docid": "6cfbb7d73c65be0293da2e589668544e", "score": "0.61861354", "text": "def render(*args, &block)\n super\n end", "title": "" }, { "docid": "b8aed14466cdde1723bdf33a86cc5137", "score": "0.61793053", "text": "def render(format, user, *args)\n end", "title": "" }, { "docid": "3ecb375a17a217a7e9c9cffaf9b7daee", "score": "0.61774015", "text": "def render!\n invalidate\n render\n end", "title": "" }, { "docid": "c44c6993a30c8b8b74f0d4a675ae539c", "score": "0.61732507", "text": "def passthru\n render :layout => false\n end", "title": "" }, { "docid": "b932b21276208abb033ce9dd99370f21", "score": "0.61633945", "text": "def render\n clear\n end", "title": "" }, { "docid": "da42b4683b49ee9e92aaf2e8a41cd3de", "score": "0.6160528", "text": "def index\n @user = current_user\n authorize @user\n render 'users/index'\n end", "title": "" }, { "docid": "233027c02931ba217831fd15adf13637", "score": "0.6159771", "text": "def render(template); end", "title": "" }, { "docid": "3f7fadd3e116acfc6add6609d75ba3e4", "score": "0.61589926", "text": "def render(opts)\n super(opts)\n rescue ActionView::MissingTemplate\n # do nothing\n end", "title": "" }, { "docid": "4b74f11f058e1e43e144b2504596dc73", "score": "0.6158257", "text": "def render(*args)\n super *args\n end", "title": "" }, { "docid": "96d9d6ef3a17133e59dc599b39fb3134", "score": "0.6153058", "text": "def unauthorized\n # Will render the app/views/errors/unauthorized.html.haml template\n end", "title": "" }, { "docid": "b120fa43c51176b890fc133e8425d5c3", "score": "0.6148206", "text": "def render r\n end", "title": "" }, { "docid": "a3476ea1e039e97c079f5391266d2888", "score": "0.61470455", "text": "def render(action = nil, options = {}, &blk)\n present(@page) unless admin? or @meta.present?\n super\n end", "title": "" }, { "docid": "6f14e9609361badce5f7d5092f4236d1", "score": "0.61451334", "text": "def show\n head :not_found unless @user\n # render 'layouts/invalid_page', status: :not_found\n end", "title": "" }, { "docid": "73262e3f947e42dd41f07795eb14ef26", "score": "0.6143099", "text": "def render_unauthorized\n error_message = Hash(access: [\"Unauthorized\"])\n errors = Hash(code: 10005, errors: error_message)\n\n render json: ErrorSerializer.new(errors), status: :unauthorized\n end", "title": "" }, { "docid": "2d432e8c17f1f4d3b36578098fc4b800", "score": "0.61413336", "text": "def render_safe\n RENDER_SAFE\n end", "title": "" }, { "docid": "ebe4b88463578c105aa289640d2c163c", "score": "0.61401606", "text": "def require_user\n render_unauthorized unless signed_in?\n end", "title": "" }, { "docid": "0dea306ed5111085f9d0c2b02e8be9d7", "score": "0.6139509", "text": "def show\n if @ingredient.users.select { |user| user == @auth_user }.empty?\n render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n end\n end", "title": "" }, { "docid": "3a9a8a72f8474ba1d3644383deb74c6f", "score": "0.6133165", "text": "def render_access_denied\n render_error_data :message => 'Admin access only.', :reason => :denied\n false\n end", "title": "" }, { "docid": "1d2852e93c5e8636efb3cc0105ae18cc", "score": "0.61319655", "text": "def unauthorized\n respond_to do |format|\n format.html do\n if admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n redirect_to login_path and return\n elsif current_user || admin?\n flash.now[:error] = I18n.t(:authorization_failure)\n render 'shared/unauthorized'\n #FIXME:: Should be that\n #render 'shared/unauthorized', :layout => 'layouts/application', :status => 401\n else\n store_location\n redirect_to login_path and return\n end\n end\n format.xml do\n request_http_basic_authentication 'Web Password'\n end\n format.json do\n render :text => \"Not Authorized \\n\", :status => 401\n end\n end\n end", "title": "" }, { "docid": "ca5f6d8846962eda0a4d63332ff6a7d1", "score": "0.6130752", "text": "def index\n render status: :forbidden, text: \"You do not have access to this page.\"\n # @articles = Article.all\n end", "title": "" }, { "docid": "d796b638729a8ed965747fdd88c3fa56", "score": "0.6123663", "text": "def index_fancy\n authorize! :show, List\n @lists = current_user.lists\n render \"lists/index_fancy\", :layout => false\n end", "title": "" }, { "docid": "e5a28a7c12394571326715a694e6fa6a", "score": "0.61209023", "text": "def render_the_login\n file = 'app/views/layouts/_auth.html.haml'\n template file, file, force: true\n\n file = 'app/views/layouts/_auth_browserid.html.haml'\n template file, file\n end", "title": "" } ]
946442aa7fc446411e2d2a27b8fb29bc
Sends only the name, id and ingreident ids of recipes, a simpiler view.
[ { "docid": "777fa8b6a7ed7f901cc493ae420dd57a", "score": "0.0", "text": "def array\n @recipes = Recipe.all\n render \"simple_index.json.jb\"\n end", "title": "" } ]
[ { "docid": "a5d7b9079eb5fabd77e105767542959a", "score": "0.61020595", "text": "def show\n # @prods = Product.find_by_sql(:conditions => [\"WHERE id in (\n#SELECT prods_id \n#FROM recipe_prods \n#WHERE recipes_id=49\n#)\"])\n $current_recipe = @recipe.id\n @prods_id = RecipeProd.where(\"recipes_id = :recip_id\", recip_id: $current_recipe)\n @comments = CommentSection.where(\"recipe_section_id = :recipe_id\",recipe_id: $current_recipe)\n\n #render '/recipes/view'\n end", "title": "" }, { "docid": "a570cebc96b2d356b8856ee1617425eb", "score": "0.60691756", "text": "def show\n @recipe = Recipe.find(params[:id])\n @title = @recipe_title = @recipe.name\n @complementos = Recipe.where('lunch_option_id != ?',@recipe.lunch_option_id).sample(3)\n @random_testimony = @recipe.comments.sample if @recipe.comments\n @is_favorite = current_user ? Favorite.where(:recipe_id => @recipe.id, :user_id => current_user.id).length > 0 ? true : false : false\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "afd77c78ece30bdccd092d30f4ebdae7", "score": "0.60640574", "text": "def show\n @recipes = Recipe.all\n end", "title": "" }, { "docid": "316050cd3635e550a5ffcb80dc831d3e", "score": "0.6038123", "text": "def show\n puts \"showing recipe with id: #{params[:id]}\"\n puts @user\n puts params\n render nothing: true, status: 200\n end", "title": "" }, { "docid": "7a398cd4224af0abdb66331be1872a1c", "score": "0.59710425", "text": "def show\n @recipe_ingredient = @recipe.ingredients.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_ingredient }\n format.json { render :json => @recipe_ingredient.to_json(:only => :id, :methods => [:how_much,:ingredient_name]) }\n end\n end", "title": "" }, { "docid": "d42cdb313c671304b8c854e1b7e5a4c6", "score": "0.5954201", "text": "def index\n @fridge_items = FridgeItem.all\n @fridge_item = FridgeItem.new\n @ingredients_data = Ingredient.all\n @ingredient_names = @ingredients_data.pluck(:name)\n @ingredients = @ingredients_data.group_by(&:id)\n @available_recipes = find_available_recipes\n end", "title": "" }, { "docid": "e389e9a6bd14014cfc8e806debb4f1eb", "score": "0.59303516", "text": "def show\n\n @ingreds = Recipe.where(:meal_id => params[:id])\n\n end", "title": "" }, { "docid": "f84fa471cad435d318e974b94eb1d36a", "score": "0.5926511", "text": "def show\n session[:recipe_id] = @recipe.id\n end", "title": "" }, { "docid": "69918eae71e5991c2110132ec7a5d032", "score": "0.5889124", "text": "def show\n @list = List.find(params[:id])\n @listing = Listing.where(list_id: @list.id)\n @recipe = @list.recipes.select(:id)\n @ingredients = @list.ingredients\n consolidate_ingredients\n listmultiplier\n\nend", "title": "" }, { "docid": "210e86e0af9b8c0f084f6ab89ca9c84c", "score": "0.5883095", "text": "def recipe_details\n @recipe_id = params[:id]\n # hardcoded:\n # url = \"https://api.spoonacular.com/recipes/120/information?apiKey=8a69fc25f1ca4ccfa484d58fee68b86a\"\n # interpolated\n\n #ariel's key\n url = \"https://api.spoonacular.com/recipes/#{@recipe_id}/information?apiKey=8a69fc25f1ca4ccfa484d58fee68b86a\"\n\n #alex's key\n # url = \"https://api.spoonacular.com/recipes/#{@recipe_id}/information?apiKey=85aeca77d8134a13be3a459305815224\"\n\n response = open(url).read\n @recipe = JSON.parse(response)\n # return the result of the spoonacular API\n\n\n # render json: { result: @recipe }\n end", "title": "" }, { "docid": "81c4eb8e7746b58aa042c6ffa18d253d", "score": "0.5873599", "text": "def display_recipe\r\n @recipe = Recipe.find(params[:id])\r\n end", "title": "" }, { "docid": "727abef02630e693263eed2a041d0d6b", "score": "0.58724195", "text": "def show\n @page = true\n @recipe = Recipe.includes(:ingredients, :personalRecipeInfo, :users).find_by_url_slug(params[:id]) \n if @recipe.nil?\n @recipe = Recipe.includes(:ingredients, :personalRecipeInfo, :users).find_by_url_slug(params[:name])\n end\n @ingredients = []\n @recipe.amounts.each do |amount|\n temp = {}\n temp['ingredient'] = @recipe.ingredients.select{|i| i.id == amount.ingredient_id}.first\n temp['amount'] = amount.amount\n temp['units'] = amount.units\n temp['details'] = amount.details\n @ingredients << temp\n end\n\n @cook_time = hash_from_cook_time_string(@recipe.cook_time)\n @created_by = @recipe.users.first\n @created_by_name = name_to_use(@created_by)[0]\n\n if current_user\n @usersRecipeInfo = @recipe.personalRecipeInfo.select{|info| info.user_id == current_user.id}.first\n if @usersRecipeInfo\n if @usersRecipeInfo.favorite == true\n @favorite = true\n else\n @favorite = false\n end\n if @usersRecipeInfo.rating\n @personal_rating = @usersRecipeInfo.rating\n else\n @personal_rating = nil\n end\n else\n @favorite = false\n @personal_rating = nil\n end\n if session[:recent_recipes] and session[:recent_recipes].index(@recipe.id) == nil\n if session[:recent_recipes].count > 3\n session[:recent_recipes].shift\n end\n session[:recent_recipes].push(@recipe.id)\n end\n end\n\n @users = @recipe.users\n @forks = @recipe.favorites\n #is this my recipe?\n @myRecipe = true if @recipe.users.first == current_user\n\n respond_to do |format|\n format.html\n format.json { render json: @recipe }\n format.js\n end\n end", "title": "" }, { "docid": "98200d55403e8e5d33c6e2f721ce3988", "score": "0.5860202", "text": "def show\n @recipe = Recipe.find(params[:id])\n @owner = @recipe.user\n @ingredients = @recipe.ingredients.split(\"\\n\")\n @instructions = @recipe.instructions.split(\"\\n\")\n @date = @recipe.created_at.strftime(\"%m/%d/%Y\")\n #find all comments associated with recipe\n @comments = @recipe.comments.paginate(page: params[:page])\n @chefcertified = false\n @comments.each do |comment|\n if (comment.rating == 4 && comment.user.chef)\n @chefcertified = true\n end\n end\n if @owner.chef\n @chefcertified = true\n end\n #debugger\n #@comments = Comment.find(:all, :recipe_id => @recipe.id)\n #@comments = @recipe.comments.paginate(page: params[:page])\n # Micropost.where(\"user_id = ?\", id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "d73d3a6dcf65e2196c6b983e85fcc9c9", "score": "0.5852568", "text": "def index\n @ingredients_recipes = IngredientsRecipe.all\n end", "title": "" }, { "docid": "b5467da04817eff1536075ccb201aedb", "score": "0.58262575", "text": "def index \n @recipes = Recipe.all\n @ingredients = Ingredient.all\n \n end", "title": "" }, { "docid": "82e3a5971e5368ccee78424019fc65b8", "score": "0.58226955", "text": "def recipe(id)\r\n BnetApi.make_request(\"/wow/recipe/#{id}\")\r\n end", "title": "" }, { "docid": "f8d1895f075e7b3ce453e53e4747d377", "score": "0.5819934", "text": "def show \n @current_user = current_user\n\n @recipe_details = Recipe.find(params[:id]).get_recipe_details\n @recipe = @recipe_details[:recipe_content]\n @recipe_ratings_histogram = @recipe_details[:ratings_histogram]\n render '/common/show'\n # respond_to do |format|\n # format.json { render json: @recipe }\n # end\n end", "title": "" }, { "docid": "28ec92fd5633fb10b3b79267683d56d2", "score": "0.58120304", "text": "def recipes\n end", "title": "" }, { "docid": "6277d9d8ff55cf47b9f6635752057fa6", "score": "0.5810871", "text": "def index\n @recipe_ingredient_groups = RecipeIngredientGroup.all\n @recipe = Recipe.find(params[:recipe_id])\n end", "title": "" }, { "docid": "bd64f35e17f8d409222e006ccd8dcb46", "score": "0.58039707", "text": "def show\n\t\t@recipe = Recipe.find(params[:id])\n\tend", "title": "" }, { "docid": "ba212882d95b11771cc27483076a3d34", "score": "0.5794899", "text": "def index\n if params[:user_id] == \"0\"\n if !logged_in?\n authenticate\n else\n redirect_to user_recipes_path(current_user)\n end\n return\n end\n \n user_id = params[:user_id] && params[:user_id].to_i\n user_id ||= current_user.try(:id)\n \n if user_id != current_user.try(:id)\n @viewing_user = User.find(user_id)\n end\n \n conditions = {:user_id => user_id} if user_id\n @recipes = Recipe.all(:conditions => conditions, :include => [{:items => {:food => :receipt_items}}, :photos, :user])\n @recipes = @recipes.sort_by(&:completion).reverse\n \n respond_to do |format|\n format.html # index.html.haml\n format.mobile # index.mobile.haml\n format.xml { render :xml => @recipes }\n end\n end", "title": "" }, { "docid": "2ca8f5bb2e243e9ae0518901b75ec733", "score": "0.57935715", "text": "def recipes\n end", "title": "" }, { "docid": "47ba73e3c6df29602a9f5456fd249886", "score": "0.57858914", "text": "def list\n display_recipes\n end", "title": "" }, { "docid": "e22bba2e2c3a6c511a6e3c62580aa086", "score": "0.57831097", "text": "def show\n #render :recipee\n end", "title": "" }, { "docid": "08a29cad33ca8e33457aa489e5f088aa", "score": "0.5783032", "text": "def show\r\n # @recipe = Recipe.find(params[:id])\r\n @recipe = current_user.recipes.find(params[:id])\r\n end", "title": "" }, { "docid": "f1217a67e2b799f3f3093b88eb6f4dd0", "score": "0.576134", "text": "def show\n @ingredient_recipe = IngredientRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredient_recipe }\n end\n end", "title": "" }, { "docid": "142b1fd54948501a16e851d65a78bf2c", "score": "0.5753218", "text": "def recipes\n end", "title": "" }, { "docid": "80286e0516f673ca2e77d282af968316", "score": "0.57490295", "text": "def show\n @ing_quant_pairs = get_recipe_ingredients(@recipe)\n end", "title": "" }, { "docid": "1de72d72eb775d4fdb1b36fa62c7816e", "score": "0.5747846", "text": "def show\n @other_recipes = @recipe.cocktail.recipes.where(\"id != ?\", @recipe.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "9766668dc88e28db4dfeb23392c42df5", "score": "0.57440776", "text": "def show\n @ryouri = Ryouri.find(params[:id])\n @ingredients = @ryouri.ingredients\n end", "title": "" }, { "docid": "3672ff60737a20d08e6c9be5ae1916bd", "score": "0.574278", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "3e54ceef842494d442bfe754491257fb", "score": "0.5739819", "text": "def show\n @recipe = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "17ac0138f84efd9e72293afa14686247", "score": "0.5713903", "text": "def by_ingredient\n # redirect_non_users\n \n user = User.find_by(id: params[:user_id])\n \n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n ingredient = Ingredient.find(params[:id])\n # if is_admin?\n # # Show all recipes from ingredient for admins\n # @recipes = Recipe.recipes_of_ingredient(params[:id])\n # else\n # Only show user's recipes\n recipes = user.recipes.recipes_of_ingredient(params[:id])\n # end\n else\n # flash[:alert] = \"That ingredient wasn't found.\"\n # Else show all users' recipes\n recipes = user.recipes\n end\n\n render json: RecipeSerializer.new(recipes).serialized_json, status: 200\n end", "title": "" }, { "docid": "29ce9da99a0b67a0a8a8befe8bd5a2bb", "score": "0.57007027", "text": "def show\r\n @food = Food.find(params[:id])\r\n @recipes = @food.recipes.sort.uniq\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @food }\r\n end\r\n end", "title": "" }, { "docid": "75a9fc1dd289d23187d5b83454141d5f", "score": "0.56978893", "text": "def index\n @recipes = Recipe.where(\"user_id = ?\", current_user.id)\n end", "title": "" }, { "docid": "1498f5f429354ac8350b33da0a70ed74", "score": "0.5693004", "text": "def recipe\n @recipe = Recipe.find_by(id: params[:recipe_id])\n @recipe_name = @recipe.name\n end", "title": "" }, { "docid": "f2eae7268c6a5f69a78cd5eda3f7f9a5", "score": "0.56926256", "text": "def show\n @allrecipes = current_user.myrecipes\n end", "title": "" }, { "docid": "536ace82dde0bb1627e57e260bb2cf96", "score": "0.5691704", "text": "def show\n @recipe = Recipe.find(params[:recipe_id])\n @used_ingredient = UsedIngredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @used_ingredient }\n end\n end", "title": "" }, { "docid": "117c777bacbcdbcade6d9ed467ddfdfe", "score": "0.5691396", "text": "def index\n\n @recipes = Recipe.all.where(user_id: current_user.id)\n\n end", "title": "" }, { "docid": "f1e220a653222864435b59dd00d8046c", "score": "0.56876427", "text": "def show\n @recipe = Recipe.find(params[:recipe_id])\n end", "title": "" }, { "docid": "ef2d15ae5a293b400b9c8f1e31cceaca", "score": "0.5680105", "text": "def recipe \n Recipe.all\n end", "title": "" }, { "docid": "2dd017a85807bf95a77069471a1921b9", "score": "0.56774294", "text": "def set_ingredients_recipe\n @ingredients_recipe = IngredientsRecipe.find(params[:id])\n end", "title": "" }, { "docid": "c8f7b2a55f1b404241626d7b3787ad35", "score": "0.56714153", "text": "def show\n @recipe_ingredients = RecipeIngredient.where(recipe_id:@recipe.id)\n @levels = Level.all\n @times = Duration.all\n end", "title": "" }, { "docid": "5b83bb85552f77159886dc22701a9b36", "score": "0.56705296", "text": "def edit\n @recipe = Recipe.find(params[:id])\n if !current_user || current_user.id != @recipe.user_id\n redirect_to root_path, notice: \"You cannot edit other people's recipe'!\"\n end\n\n# NOTE why used gon\n gon.ingredients = Ingredient.all\n @recipe = Recipe.find(params[:id])\n @users = User.all\n @cuisine_list = [\"Western\", \"Indian\", \"Malay\",\"Chinese\"]\n end", "title": "" }, { "docid": "c41c603a07ae7967f715a475fed319c7", "score": "0.5665994", "text": "def show\n @steps = Step.where(:recipe_id => params[:id])\n @ingredients = Ingredient.where(:recipe_id => params[:id])\n @page_icon = \"fd-healthyfood\"\n @page_header = @recipe.name\n\n\n #Can I Make?\n @ingredientsInStock = 0\n @missingIngredients = []\n @totalIngredients = @ingredients.count\n @ingredients.each do |thisIng|\n name = thisIng.name\n matches = KitchenItem.where('lower(name) = ?', name.downcase).where(:user_id => current_user.id)\n if matches.present?\n @ingredientsInStock += 1\n else\n @missingIngredients.push(thisIng)\n end\n end #End Recipe Ingredients loop\n\n if @totalIngredients - @ingredientsInStock == 0\n @canCook = true\n else\n @canCook = false\n end\n end", "title": "" }, { "docid": "232b20929c4e967f624b13d9e8103d47", "score": "0.56629485", "text": "def show\n @recipe_cookbook = RecipeCookbook.find(params[:id])\n @recipe_ingredients = RecipeCookbook.find(params[:id]).recipe_ingredients\n @recipe_instructions = RecipeCookbook.find(params[:id]).recipe_steps\n @ingredients = RecipeCookbook.find(params[:id]).ingredients\n end", "title": "" }, { "docid": "5883327fc2c059f9728971c28766054a", "score": "0.5649634", "text": "def show\n recipe_id = params[:id]\n recipe_id = retrieve_recipe_id if recipe_id == \"0\"\n session[:recipe_id] = recipe_id\n @recipe = Recipe.find_by(id: recipe_id)\n authorize @recipe\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "afd8c200644646c58f3ace1b0ff832eb", "score": "0.56473625", "text": "def show\n @user = User.find(@recipe.user_id)\n @instructions = @recipe.instructions\n end", "title": "" }, { "docid": "ddaff6c2b9ebd51ef449cd2e4e9f2730", "score": "0.56359625", "text": "def set_recipe\n @recipes = Recipe.find(params[:id])\n end", "title": "" }, { "docid": "daa176fdb1886269abf6fa39d87ec661", "score": "0.56299806", "text": "def show\n @recipe = Recipe.find(params[:id])\n render :show\n end", "title": "" }, { "docid": "60eb2b2edc1371dde0f319a45fdb1d1f", "score": "0.56238157", "text": "def show\n respond_with @recipe\n end", "title": "" }, { "docid": "60eb2b2edc1371dde0f319a45fdb1d1f", "score": "0.56238157", "text": "def show\n respond_with @recipe\n end", "title": "" }, { "docid": "f93e11bebd748283e1c17ed0643687a8", "score": "0.56232595", "text": "def index\n @ingredients = @recipe.ingredients.all\n end", "title": "" }, { "docid": "cad49f5498fda8fd9515149804abcec0", "score": "0.560996", "text": "def show\n @ingredient_description = IngredientDescription.find(params[:id])\n end", "title": "" }, { "docid": "3058b22b0cfc5870c2057a08afc62cbc", "score": "0.5607156", "text": "def show\n @grocery = Grocery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @grocery.to_json(:only => :id, :methods => [:how_much, :ingredient_name]) }\n format.xml { render :xml => @grocery }\n end\n end", "title": "" }, { "docid": "b17091de4b64cccb11bb1dd755eda228", "score": "0.5602934", "text": "def index\n @repiceingredientes = Repiceingrediente.all\n end", "title": "" }, { "docid": "9c168e8034ffbd036da4792ab2a67127", "score": "0.56002104", "text": "def recipe_id\n @recipe_id\n end", "title": "" }, { "docid": "57a8e87da23ec220bc3f2a2fe4088482", "score": "0.55987114", "text": "def show\n redirect_to recipes_path\n end", "title": "" }, { "docid": "8f815392eae4c1163c211d4fd9c8da64", "score": "0.5598697", "text": "def index\n @recipes = @client.recipes\n end", "title": "" }, { "docid": "bcd58faed8e49a23f58c16cd628b7fc2", "score": "0.55944556", "text": "def show\n @recipe = Recipe.find(params[:id])\n @newrecipes = Recipe.find_all_by_parent_id(@recipe.id, :order => \"id desc\", :limit => 5)\n @toprecipes = Recipe.find_all_by_parent_id(@recipe.id, :order => \"votes_up desc\", :limit => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe }\n end\n end", "title": "" }, { "docid": "e328c5644626a0363c45ca75c5d8be98", "score": "0.55941993", "text": "def index\n @recipe_ingredients = @recipe.ingredients\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_ingredients }\n format.json { render :json => @recipe_ingredients.to_json(:only => :id, :methods => [:how_much,:ingredient_name]) }\n end\n end", "title": "" }, { "docid": "58b564875279e01a2f2202d5172608f2", "score": "0.5585804", "text": "def show\n redirect_to recipe_item_path + \"/\" + params[:id] \n end", "title": "" }, { "docid": "abc11db6bace7a552194cd0671eacd14", "score": "0.5584879", "text": "def show\n @recipe = Recipe.find(params[:id])\n @ingredients = @recipe.ingredients.split(',').map(&:strip)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "8c01966a8d3b06d68168d7ab4aeb7878", "score": "0.55842483", "text": "def index\n @recipe = Recipe.all.order(\"created_at DESC\")\n @user = current_user\n @fridge = Fridge.where(user_id: current_user)\n end", "title": "" }, { "docid": "20632083a021379d90581843ea59b3ca", "score": "0.55819935", "text": "def recipe_params\n\n params.require(:recipe).permit(:id, :user_id, :title, :ingredients, :description, :directions, :servings, :img)\n\n end", "title": "" }, { "docid": "85014c367b22510db802b269b764b289", "score": "0.5566822", "text": "def show\n respond_to do |format|\n format.html { render action: 'show' }\n format.json { render json: { status: \"OK\", response: { recipe: @recipe }, message: nil } }\n end\n end", "title": "" }, { "docid": "1a20cebd42cabe8109f70ae5143d4212", "score": "0.55657935", "text": "def show\n\t\t@ingredient = Ingredient.find(params[:id])\n\tend", "title": "" }, { "docid": "22177a3457a3362c1db58f67932c987c", "score": "0.55624473", "text": "def show\n if @recipe.private\n check_permission\n end\n @recipe_ingredients = @recipe.recipe_ingredients\n @instructions = @recipe.instructions\n @reviews = @recipe.reviews.page(params[:page])\n # respond_to do |format|\n # format.html { render :show }\n # # format.json { render json: @recipe }\n # format.json { render json: @recipe, include: ['user', 'reviews', 'reviews.reviewer', 'recipe_categories', 'recipe_categories.category', 'recipe_ingredients', 'recipe_ingredients.ingredient', 'recipe_ingredients.measurement', 'instructions']}\n # end\n end", "title": "" }, { "docid": "2757b77ba8acbef5052cceb7db769042", "score": "0.55566853", "text": "def show\n redirect_to action: :index if not (@gardening.published or logged_in?)\n\n recipe_links = Hash.new{|h, k| h[k] = []}\n get_common_gardening_recipes(@gardening.id).each do |recipe_tag|\n recipe = Recipe.find(recipe_tag.recipe_id)\n next if !recipe.published\n tag = Tag.find(recipe_tag.tag_id)\n recipe_links[recipe] << tag\n end\n\n related = \"\"\n recipe_links.each do |recipe, tags|\n tagnames = tags.map { |t| t.tag }.uniq\n related << \"[#{ recipe.name } (Tags: #{ tagnames.join(\", \") })](#{recipe_path(recipe.id)})\\n\"\n end\n @related = @markdown.render(related)\n\n @gardening.description = @markdown.render(@gardening.description)\n @gardening.content = @markdown.render(@gardening.content)\n end", "title": "" }, { "docid": "ce97b63f78d529612242519383785424", "score": "0.5550856", "text": "def show\n @recipe = Recipe.find(params[:id])\n render('/recipes/show.html.erb')\n end", "title": "" }, { "docid": "a93f0b5dbd299146327e572a780d2898", "score": "0.5538085", "text": "def show\n @recipeingredient = Recipeingredient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipeingredient }\n end\n end", "title": "" }, { "docid": "fb35cc59689dd63acbad057f8544cecf", "score": "0.55373496", "text": "def recipes\n Recipe.all.includes(:user).map do |recipe|\n recipe.as_json.merge({\n author: {\n id: recipe.user_id,\n display_name: \"Chef #{recipe.author.full_name}\",\n },\n image_url: recipe.image_url\n })\n end\n end", "title": "" }, { "docid": "f827eaaf575238247e16c6025fbe3fc0", "score": "0.55369145", "text": "def show\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n @comment = Comment.new\n end", "title": "" }, { "docid": "838835ec98315be13fa6daeda6ffcedf", "score": "0.5533479", "text": "def index\n @recipe = Recipe.last\n\n @page = @recipe.page\n @dish = @recipe.dish\n @ingredients = \"#{@recipe.ingredient_1},#{@recipe.ingredient_2},#{@recipe.ingredient_3}\"\n\n @recipes = Recipe.set_of_recipes(@page, @dish, @ingredients)\n\n unless @recipes[0]\n redirect_to new_recipe_path, notice: 'Selection values did not produce any recipes.'\n end\n end", "title": "" }, { "docid": "e7ce2f52b1e3f16b8e5158eacb26ba31", "score": "0.5526518", "text": "def index\n if params[:recipe_id]\n @recipe = Recipe.find(params[:recipe_id])\n render json: @recipe.ingredients\n else\n @ingredients = Ingredient.all\n render json: @ingredients, include: :recipes\n end\nend", "title": "" }, { "docid": "3fe41449861fd2452b1fe46a9895e7c7", "score": "0.5523183", "text": "def show\n @recipe = Recipe.find(params[:id])\n render json: @recipe\n end", "title": "" }, { "docid": "4eac70cf646994396b0ea508bea5c55f", "score": "0.5522802", "text": "def index\n @recipes = current_user.recipes\n end", "title": "" }, { "docid": "db03ba7945a34f9e05d06e8a075d9ceb", "score": "0.55225444", "text": "def by_ingredient \n if authorize(@user)\n\n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n @ingredient = Ingredient.find(params[:id])\n \n # Show all recipes from ingredient for admins\n if is_admin?\n @recipes = Recipe.recipes_of_ingredient(params[:id])\n # Else only show this user's recipes\n else\n @recipes = @user.recipes.recipes_of_ingredient(params[:id])\n end\n \n # Show alert if ingredient not found in recipes\n flash[:alert] = \"#{@ingredient.name.titleize} not found in your recipes.\" if @recipes.length == 0 \n\n # Else show all user's recipes \n else\n flash[:alert] = \"That ingredient wasn't found.\"\n @recipes = @user.recipes\n end\n\n render :index\n end\n end", "title": "" }, { "docid": "84fdac3c142dee1eca2aab2d2a0f351f", "score": "0.5522505", "text": "def show\n @receta = Recetum.find(params[:id])\n @categoria = CategoriaRec.find(Recetum.find(params[:id]).categoria_rec_id)\n @ingredientes = Ingrediente.order('ingredientes.nombre ASC').all\n @rec = RecetaUsr.find_by(receta_id: params[:id], usuario_id: session[:user_id])\n @ingRec=@receta.receta_ings\n @ingRec.each do |t|\n logger.info \"Ings en Rec-----\"+t.ingrediente.nombre.to_s\n end \n end", "title": "" }, { "docid": "8b717cee224951ad749efdf43b151c1b", "score": "0.5514952", "text": "def show\n user = User.find_by_id(params[:user])\n\t @recipe_list = current_user.recipe_list\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe_list }\n end\n end", "title": "" }, { "docid": "dd052af5f394b3e88c22f0290b03db0c", "score": "0.55136293", "text": "def index\n @recipes = Recipe.all\n render :index\n end", "title": "" }, { "docid": "dd052af5f394b3e88c22f0290b03db0c", "score": "0.55136293", "text": "def index\n @recipes = Recipe.all\n render :index\n end", "title": "" }, { "docid": "d53034bafa5960d3ddf21ff1f81b7f8d", "score": "0.5512344", "text": "def show\n @receta = Receta.find(params[:id])\n @ingredients = Ingredient.find(:all, :conditions => [\"receta_id = ?\", params[:id]]) \n @steps = Step.find(:all, :conditions => [\"receta_id = ?\", params[:id]]) \n @comment = Comment.new if logged_in?\n @page_description = @receta.description\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receta }\n format.print { render :layout => \"print\"}\n end\n end", "title": "" }, { "docid": "ca7c4f73986dcffbf8f67f101ed2ef0e", "score": "0.55085546", "text": "def recipe_params\n params.require(:recipe).permit(:title, :user_id, :ingredients, :description)\n end", "title": "" }, { "docid": "9e795dbc36f9e8e2bab7ab62005733c0", "score": "0.5508438", "text": "def show\n @recipe = Recipe.find(params[:id])\n\n @comment = Comment.new\n @comment.recipe = @recipe\n @comment.user = current_user\n \n if current_user == nil\n respond_to do |format|\n format.html { render :action => \"public_recipe\"}\n format.xml { render :xml => @recipe }\n end\n elsif @recipe.user_id == current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recipe }\n end\n else\n respond_to do |format|\n format.html { render :action => \"public_recipe\"}\n format.xml { render :xml => @recipe }\n end\n end\n \n end", "title": "" }, { "docid": "801a6e2b60475b350e3b44ed1dd7e133", "score": "0.550756", "text": "def edit\n @recipe = find_by_id(Recipe)\n if session[:user_id] == @recipe.user_id \n recipe = 3.times.collect { @recipe.recipe_ingredients.build }\n else\n redirect_to recipes_path, notice: \"That is not your recipe to edit!\"\n end\n end", "title": "" }, { "docid": "a487fc398b3ae5253febca4f0bdd013d", "score": "0.54991466", "text": "def index\n @item_recipes = @recipe.item_recipe\n # era @item_recipes = ItemRecipe.all\n end", "title": "" }, { "docid": "adb456ee289a9308495146b19584c8a0", "score": "0.54948664", "text": "def index\n @recipes = Recipe.all\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "title": "" }, { "docid": "c58369874eec6ec5a383b92b4f31f648", "score": "0.549316", "text": "def set_recipe\n @recipe = Recipe.includes(ingredients: [:unit, :material]).includes(:user).find(params[:id])\n end", "title": "" }, { "docid": "7e5debde3e90bacbf0fd4db9da2ddf0b", "score": "0.54915565", "text": "def show\n #@ingredients = @measurement_unit.ingredient.find(params[:id])\n #@ingredients = @measurement_unit.ingredient.find(id_params)\n #byebug\n end", "title": "" }, { "docid": "c29e74975ab27964c0cb49a6f70b055f", "score": "0.5487944", "text": "def show\n @recipe = Recipe.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "title": "" }, { "docid": "10892bdab2da53692b6ef1865158120f", "score": "0.5485053", "text": "def show\n @ingredientsource = Ingredientsource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ingredientsource }\n end\n end", "title": "" }, { "docid": "fe3c80ebe74ed90df7b2a5f382ea059a", "score": "0.5484072", "text": "def show\n @id = params[:id]\n @main_recipes = Recipe.where(:user_id => @id, :recipe_select => \"1\")\n @sub_recipes = Recipe.where(:user_id => @id, :recipe_select => \"2\" )\n @recipes = Recipe.where(:user_id => @id)\n\n @menus = Menu.find(:all, :conditions => { :user_id => @id})\n @made_reports = MadeReport.find(:all, :conditions => { :user_id => @id})\n @user = User.find(@id)\n @favorite_recipes = @user.favorites.map {|favorite| favorite.recipe }\n end", "title": "" }, { "docid": "becd8bd4c90f9f05624947e9f3dda2a7", "score": "0.54831797", "text": "def display_all_recipe\n clear_screen\n puts 'RECIPE CATALOG'\n puts '--------------'\n recipe_id_array = []\n Crud.get_all_recipes.each do |recipe|\n puts \"#{recipe['id']}. \" + recipe['title'].capitalize + \" [ #{recipe['category']} ]\"\n recipe_id_array << recipe['id']\n end\n\n recipe_id = select_recipe(recipe_id_array)\n\n display_recipe(recipe_id)\nend", "title": "" }, { "docid": "6590c4138c7db6f97e1bbc4f47e02437", "score": "0.5480701", "text": "def show\n render json: @recipe\n end", "title": "" }, { "docid": "6590c4138c7db6f97e1bbc4f47e02437", "score": "0.5480701", "text": "def show\n render json: @recipe\n end", "title": "" } ]
d7d142a1b6a310827d70f82c008aa950
The base dataset used for the association, before any order/conditions options have been applied.
[ { "docid": "194ef6953c27e7732669c59d3d0bfe93", "score": "0.6425118", "text": "def _associated_dataset\n associated_class.dataset.clone\n end", "title": "" } ]
[ { "docid": "826e49e031e77972931c85105ca91229", "score": "0.67317384", "text": "def schema_utility_dataset\n @default_dataset\n end", "title": "" }, { "docid": "072e92253cdc169924f4ca6a1cb6b17b", "score": "0.6610137", "text": "def dataset\n @dataset ||= data_maker.dataset\n end", "title": "" }, { "docid": "34b0021ac98c3a0885776be00130db3f", "score": "0.65424633", "text": "def dataset\n @dataset ||= generate_dataset\n end", "title": "" }, { "docid": "bc65b54bfdccc74860203a5a6bda9386", "score": "0.65293807", "text": "def associated_dataset\n cached_fetch(:_dataset){apply_dataset_changes(_associated_dataset)}\n end", "title": "" }, { "docid": "fbded21f05ffcebff5285feddc269e91", "score": "0.64704245", "text": "def orig_dataset\n @opts[:orig_dataset]\n end", "title": "" }, { "docid": "dcf4c989527f45846a9b0776ce3c073c", "score": "0.6362746", "text": "def set_dataset_rel_and_attr\n @dataset.database = @database\n @dataset_id = @dataset.id\n organization = Organization.find_by_id(@organization_id)\n organization.datasets << @dataset\n @dataset.organization = organization\n end", "title": "" }, { "docid": "bd70f8e20efac353977733fd658863f6", "score": "0.6280282", "text": "def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end", "title": "" }, { "docid": "bd70f8e20efac353977733fd658863f6", "score": "0.6280282", "text": "def schema_utility_dataset\n @schema_utility_dataset ||= dataset\n end", "title": "" }, { "docid": "20ec7f331c7d9edc532b7a335a9b1ddc", "score": "0.6262149", "text": "def dataset\n self\n end", "title": "" }, { "docid": "20ec7f331c7d9edc532b7a335a9b1ddc", "score": "0.6262149", "text": "def dataset\n self\n end", "title": "" }, { "docid": "20ec7f331c7d9edc532b7a335a9b1ddc", "score": "0.6262149", "text": "def dataset\n self\n end", "title": "" }, { "docid": "c1f4c2784785b2bc66546137455ff00f", "score": "0.611851", "text": "def initialize_datasets\n @datasets = gateways.each_with_object({}) do |(key, gateway), h|\n h[key] = gateway.schema if config.gateways[key][:infer_relations]\n end\n end", "title": "" }, { "docid": "dd15a4bc9865f2a0bd3108f4b36647fc", "score": "0.61055", "text": "def association_dataset_proc\n ASSOCIATION_DATASET_PROC\n end", "title": "" }, { "docid": "eb069f016cf2ac87ac49ccae0c9d69f3", "score": "0.60372436", "text": "def dataset(branch = nil, options = {})\n return super() if @in_dataset or (!Branch::Context.current! and !branch)\n @in_dataset = true\n context = Branch::Context.get(branch)\n ds = dataset_from_context(context, options)\n @in_dataset = nil\n ds\n end", "title": "" }, { "docid": "54729f66267c22b3ec80ac042dbddff0", "score": "0.59784895", "text": "def dataset\n @@dataset\n end", "title": "" }, { "docid": "89694999059f09a7a07ab34c5a59cdd3", "score": "0.58997506", "text": "def setup\n @dataset = $dataset\n @dataset_2 = $dataset_2\n\n refute_nil @dataset, \"You do not have an active dataset to run the tests.\"\n\n super\n end", "title": "" }, { "docid": "0b62d1452fff7a5947e1a8601156d087", "score": "0.58960617", "text": "def associated_eager_dataset\n cached_fetch(:associated_eager_dataset) do\n ds = associated_dataset.unlimited\n if block = self[:eager_block]\n ds = block.call(ds)\n end\n ds\n end\n end", "title": "" }, { "docid": "4c25f69d5fd9c0de500947f7d9d4c5df", "score": "0.5891851", "text": "def assign_dataset_attributes\n if dataset\n reset_dataset_attributes\n @dataset_attributes = (dataset.data[dataset_group][dataset_key] ||= {})\n end\n rescue => e\n raise \"Qernel::Dataset: missing dataset item for #{dataset_group.inspect} #{dataset_key}. #{e.inspect}\"\n end", "title": "" }, { "docid": "46514dbe45aeb8bbd764fe9e98589baa", "score": "0.5889902", "text": "def establish_dataset( dataset )\n #print 'Dataset established: ', dataset.name if dataset.respond_to? :name and dataset.name\n @@dataset = dataset\n end", "title": "" }, { "docid": "db3600e0e2f32df14cb5af130f5949b2", "score": "0.585622", "text": "def selection_data\n dataset ||= DB[:selections]\n end", "title": "" }, { "docid": "9ac1a01accc02d6b5d2e13fbcb55b477", "score": "0.5835802", "text": "def dataset\n database[table_name]\n end", "title": "" }, { "docid": "2a42c02a5a5353c96e6c72786b86265e", "score": "0.58285975", "text": "def dataset\n @dataset ||= begin\n create_table!\n database[:data_stores]\n end\n end", "title": "" }, { "docid": "43a7d5efc22f784b717c5378a1ce1d5c", "score": "0.5799597", "text": "def _metadata_dataset\n super.\n with_identifier_input_method(identifier_input_method_default).\n with_identifier_output_method(identifier_output_method_default)\n end", "title": "" }, { "docid": "266b19df507c8e2e699de5256632a379", "score": "0.5798732", "text": "def initialize(dataset)\n opts = dataset.opts\n eager_graph = opts[:eager_graph]\n @master = eager_graph[:master]\n requirements = eager_graph[:requirements]\n reflection_map = @reflection_map = eager_graph[:reflections]\n reciprocal_map = @reciprocal_map = eager_graph[:reciprocals]\n limit_map = @limit_map = eager_graph[:limits]\n @unique = eager_graph[:cartesian_product_number] > 1\n \n alias_map = @alias_map = {}\n type_map = @type_map = {}\n after_load_map = @after_load_map = {}\n reflection_map.each do |k, v|\n alias_map[k] = v[:name]\n after_load_map[k] = v[:after_load] unless v[:after_load].empty?\n type_map[k] = if v.returns_array?\n true\n elsif (limit_and_offset = limit_map[k]) && !limit_and_offset.last.nil?\n :offset\n end\n end\n\n # Make dependency map hash out of requirements array for each association.\n # This builds a tree of dependencies that will be used for recursion\n # to ensure that all parts of the object graph are loaded into the\n # appropriate subordinate association.\n @dependency_map = {}\n # Sort the associations by requirements length, so that\n # requirements are added to the dependency hash before their\n # dependencies.\n requirements.sort_by{|a| a[1].length}.each do |ta, deps|\n if deps.empty?\n dependency_map[ta] = {}\n else\n deps = deps.dup\n hash = dependency_map[deps.shift]\n deps.each do |dep|\n hash = hash[dep]\n end\n hash[ta] = {}\n end\n end\n \n # This mapping is used to make sure that duplicate entries in the\n # result set are mapped to a single record. For example, using a\n # single one_to_many association with 10 associated records,\n # the main object column values appear in the object graph 10 times.\n # We map by primary key, if available, or by the object's entire values,\n # if not. The mapping must be per table, so create sub maps for each table\n # alias.\n records_map = {@master=>{}}\n alias_map.keys.each{|ta| records_map[ta] = {}}\n @records_map = records_map\n\n datasets = opts[:graph][:table_aliases].to_a.reject{|ta,ds| ds.nil?}\n column_aliases = opts[:graph_aliases] || opts[:graph][:column_aliases] # SEQUEL5: Remove :graph_aliases support\n primary_keys = {}\n column_maps = {}\n models = {}\n row_procs = {}\n datasets.each do |ta, ds|\n models[ta] = ds.model\n primary_keys[ta] = []\n column_maps[ta] = {}\n row_procs[ta] = ds.row_proc\n end\n column_aliases.each do |col_alias, tc|\n ta, column = tc\n column_maps[ta][col_alias] = column\n end\n column_maps.each do |ta, h|\n pk = models[ta].primary_key\n if pk.is_a?(Array)\n primary_keys[ta] = []\n h.select{|ca, c| primary_keys[ta] << ca if pk.include?(c)}\n else\n h.select{|ca, c| primary_keys[ta] = ca if pk == c}\n end\n end\n @column_maps = column_maps\n @primary_keys = primary_keys\n @row_procs = row_procs\n\n # For performance, create two special maps for the master table,\n # so you can skip a hash lookup.\n @master_column_map = column_maps[master]\n @master_primary_keys = primary_keys[master]\n\n # Add a special hash mapping table alias symbols to 5 element arrays that just\n # contain the data in other data structures for that table alias. This is\n # used for performance, to get all values in one hash lookup instead of\n # separate hash lookups for each data structure.\n ta_map = {}\n alias_map.keys.each do |ta|\n ta_map[ta] = [records_map[ta], row_procs[ta], alias_map[ta], type_map[ta], reciprocal_map[ta]]\n end\n @ta_map = ta_map\n end", "title": "" }, { "docid": "3692e8e07e52aba2d809847ef986f4ee", "score": "0.5790915", "text": "def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end", "title": "" }, { "docid": "afca6f0f4fd888d3ae47c230ef75c922", "score": "0.5775192", "text": "def dataset\n @dataset_class.new(self)\n end", "title": "" }, { "docid": "ff9333fdc00b70fb00cb72d9c0c42e9c", "score": "0.574557", "text": "def schema_ds_dataset\n schema_utility_dataset\n end", "title": "" }, { "docid": "5a0c521ef2b69594908d4b5b32ea0a21", "score": "0.57199633", "text": "def reset_default_dataset\n Sequel.synchronize{@symbol_literal_cache.clear}\n @default_dataset = dataset\n end", "title": "" }, { "docid": "e8633b3a4f60e1f1942f1521b3c51fe5", "score": "0.5717412", "text": "def source_data_set\n @data_set ||= PublicEarth::Db::DataSet.for_user(self)\n end", "title": "" }, { "docid": "82ed6803571860aa09f7a89609539bd2", "score": "0.5697951", "text": "def eager_loading_dataset(eo=OPTS)\n ds = eo[:dataset] || associated_eager_dataset\n if id_map = eo[:id_map]\n ds = ds.where(eager_loading_predicate_condition(id_map.keys))\n end\n if associations = eo[:associations]\n ds = ds.eager(associations)\n end\n if block = eo[:eager_block]\n ds = block.call(ds)\n end\n if eager_loading_use_associated_key?\n ds = ds.select_append(*associated_key_array)\n end\n if self[:eager_graph]\n raise(Error, \"cannot eagerly load a #{self[:type]} association that uses :eager_graph\") if eager_loading_use_associated_key?\n ds = ds.eager_graph(self[:eager_graph])\n end\n ds\n end", "title": "" }, { "docid": "d0e0cee45baf9f7b65e866e9cb50d869", "score": "0.56791896", "text": "def prepare_dataset\n @working_dataset.dataset.each { |tuple| @clustered_dataset[tuple] = -1 }\n end", "title": "" }, { "docid": "33a3966a62de888b3ea10cff941812a0", "score": "0.5657155", "text": "def aggreate_dataset_use_from_self?\n super || @opts[:values]\n end", "title": "" }, { "docid": "67aeec7f13799a595f82ca3c05ca12a0", "score": "0.5639032", "text": "def dataset\n ds = Sequel::Dataset.new(self)\n end", "title": "" }, { "docid": "67aeec7f13799a595f82ca3c05ca12a0", "score": "0.5639032", "text": "def dataset\n ds = Sequel::Dataset.new(self)\n end", "title": "" }, { "docid": "a5c23bdf42c62e085d2cdcc7f8ae4445", "score": "0.5587289", "text": "def load_project_or_dataset\n self[:dataset].nil? ? load_project : load_dataset\n end", "title": "" }, { "docid": "fd241e91c682e8bff70b6ad1068d2020", "score": "0.5578952", "text": "def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end", "title": "" }, { "docid": "0b88e1edc346f6075370d0dec8f48239", "score": "0.5532679", "text": "def dataset\n graph && graph.dataset\n end", "title": "" }, { "docid": "9fc6405fc1071dd4d8595aa55b2b0570", "score": "0.550864", "text": "def _dataset(opts)\n raise(Sequel::Error, \"model object #{inspect} does not have a primary key\") if opts.dataset_need_primary_key? && !pk\n ds = if opts[:dataset].arity == 1\n instance_exec(opts, &opts[:dataset])\n else\n instance_exec(&opts[:dataset])\n end\n _apply_association_options(opts, ds)\n end", "title": "" }, { "docid": "f6f501bb3477b050ac7a17da85b2075d", "score": "0.55025274", "text": "def default_data_options\n {}\n end", "title": "" }, { "docid": "fbc8dc062a1b5a55882ac00f98dd4f36", "score": "0.5501207", "text": "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "title": "" }, { "docid": "b4e1031da9310f572f093fb6f39dabec", "score": "0.54569215", "text": "def wrap_dataset(dataset)\n if relation.is_a?(Relation::Composite)\n relation.new(dataset).to_a\n else\n dataset\n end\n end", "title": "" }, { "docid": "aa9cb98d7fd959d3c7f173a25b373da7", "score": "0.5440027", "text": "def _update_dataset\n apply_instance_filters(super)\n end", "title": "" }, { "docid": "b6d8eba85c25d2fd5b2d6f274ea262f7", "score": "0.5434343", "text": "def apply_dataset_changes(ds)\n ds = ds.with_extend(AssociationDatasetMethods).\n clone(:association_reflection => self)\n self[:extend].each{|m| ds = ds.with_extend(m)}\n ds = ds.select(*select) if select\n if c = self[:conditions]\n ds = (c.is_a?(Array) && !Sequel.condition_specifier?(c)) ? ds.where(*c) : ds.where(c)\n end\n ds = ds.order(*self[:order]) if self[:order]\n ds = ds.limit(*self[:limit]) if self[:limit]\n ds = ds.limit(1).skip_limit_check if limit_to_single_row?\n ds = ds.eager(self[:eager]) if self[:eager]\n ds = ds.distinct if self[:distinct]\n ds\n end", "title": "" }, { "docid": "48fa9f34bc67ee1d42d25760ca698ea2", "score": "0.5430738", "text": "def apply_dataset_options(type, request, ds)\n ds = apply_filter(type, request, ds)\n if order = order_for(type, request)\n ds = ds.order(*order)\n end\n if eager = eager_for(type, request)\n ds = ds.eager(eager)\n end\n if eager_graph = eager_graph_for(type, request)\n ds = ds.eager_graph(eager_graph)\n end\n ds\n end", "title": "" }, { "docid": "7e4ea762d80d96aea5e43747c55c13bb", "score": "0.5419713", "text": "def inherited(klass)\n super\n\n if respond_to?(:adapter) && adapter.nil?\n raise MissingAdapterIdentifierError,\n \"relation class +#{self}+ is missing the adapter identifier\"\n end\n\n klass.defines :adapter\n\n # Extend with functionality required by adapters *only* if this is a direct\n # descendant of an adapter-specific relation subclass\n return unless respond_to?(:adapter) && klass.superclass == ROM::Relation[adapter]\n\n klass.class_eval do\n use :registry_reader\n\n defines :gateway, :dataset, :dataset_proc, :register_as\n\n gateway :default\n\n dataset default_name\n\n # skip defining :name option if it's a class that already has this method\n # which can happen when an adapter's relation class inherits from another\n # adapter's relation class (ie YAML::Relation < Memory::Relation)\n unless instance_methods.include?(:name)\n # Relation's dataset name\n #\n # In example a table name in an SQL database\n #\n # @return [Symbol]\n #\n # @api public\n option :name, default: -> { Name.new(self.class.register_as, self.class.dataset) }\n end\n\n # Set dataset name\n #\n # If a block is passed it will be evaluated in the context of the dataset\n # to define the default dataset which will be injected into a relation\n # when setting up relation registry\n #\n # @example\n # class Relations::Users < ROM::Relation[:memory]\n # dataset :users\n # end\n #\n # class Users < ROM::Relation[:memory]\n # dataset { sort_by(:id) }\n # end\n #\n # @param [Symbol] value The name of the dataset\n #\n # @api public\n def self.dataset(value = Undefined, &block)\n dataset_proc(block) if block\n super\n end\n\n # Set or get name under which a relation will be registered\n #\n # This defaults to `dataset` or `default_name` for descendant relations\n #\n # @return [Symbol]\n #\n # @api public\n def self.register_as(value = Undefined)\n if value == Undefined\n return @register_as if defined?(@register_as)\n\n super_val = super()\n\n if superclass == ROM::Relation[adapter]\n super_val || dataset\n else\n super_val == dataset ? default_name : super_val\n end\n else\n super\n end\n end\n\n # Return name of the source gateway of this relation\n #\n # @return [Symbol]\n #\n # @api private\n def gateway\n self.class.gateway\n end\n end\n\n klass.extend(AutoCurry)\n end", "title": "" }, { "docid": "bd3deaa40ba9da6fba4076526d614fb2", "score": "0.54153025", "text": "def all_data_criteria\n @derived_data_criteria + source_data_criteria\n end", "title": "" }, { "docid": "023e35a7cbf2a2728a37e786bba801c6", "score": "0.54052585", "text": "def _insert_dataset\n use_server(model.instance_dataset)\n end", "title": "" }, { "docid": "023e35a7cbf2a2728a37e786bba801c6", "score": "0.54052585", "text": "def _insert_dataset\n use_server(model.instance_dataset)\n end", "title": "" }, { "docid": "f9446490c2597ff23b6e608da4fc93ed", "score": "0.5397747", "text": "def _apply_association_options(opts, ds)\n unless ds.kind_of?(AssociationDatasetMethods)\n ds = opts.apply_dataset_changes(ds)\n end\n ds = ds.clone(:model_object => self)\n ds = ds.eager_graph(opts[:eager_graph]) if opts[:eager_graph] && opts.eager_graph_lazy_dataset?\n ds = instance_exec(ds, &opts[:block]) if opts[:block]\n ds\n end", "title": "" }, { "docid": "d4c542363c399e9402aa3ccc5ff39f0b", "score": "0.53861356", "text": "def source_data_set\n get :data_set, PublicEarth::Db::DataSet.for_anonymous(@ip_address, get(:tracking_id, UUIDTools::UUID.random_create.to_s))\n end", "title": "" }, { "docid": "fde137b19b4a21510f544f967691e931", "score": "0.53784525", "text": "def _metadata_dataset\n super.with_convert_smallint_to_bool(false)\n end", "title": "" }, { "docid": "5c1be7a073a04da1f167d86a3706961f", "score": "0.53568447", "text": "def default_attributes\n target_key = relationship.target_key.map { |property| property.name }\n source_scope = relationship.source_scope(source)\n super.except(*target_key).update(source_scope).freeze\n end", "title": "" }, { "docid": "90ed2921ddbd2923af29d28fe9b9252e", "score": "0.5347045", "text": "def dataset_class_default\n if self.class == Sequel::Database\n Sequel::Dataset\n else\n Sequel::Deprecation.deprecate(\"Using self.class.const_get(:DatasetClass) to get the default dataset class\", \"Modify the database adapter to implement Database#dataset_class_default\")\n self.class.const_get(:DatasetClass)\n end\n end", "title": "" }, { "docid": "0988ab58ebee20367c24f01bc76a5fa8", "score": "0.5344108", "text": "def inherited(subclass)\n super\n\n ds = dataset\n\n subclass.period_start_date_column = period_start_date_column\n subclass.period_end_date_column = period_end_date_column\n subclass.instance_eval do\n set_dataset(ds)\n end\n end", "title": "" }, { "docid": "33720456d85568a7328044d95cad705c", "score": "0.5339534", "text": "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "title": "" }, { "docid": "de360570cc6578bf82b789e59475480d", "score": "0.5331827", "text": "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "title": "" }, { "docid": "0cab8627d3ef6c56ae14accea065d82b", "score": "0.53257567", "text": "def prepare_data\n\t\t\tsuper\n\t\t\t@data[:tuneable_data] = @tuneable_data\n\t\t\t@data[:@lowest_old] = @lowest_old\n\t\tend", "title": "" }, { "docid": "8aa3dfa6aa07695ba9ea35285c2d56f0", "score": "0.5312355", "text": "def get_dataset(wi)\n if wi.options && wi.options['dataType']\n wi.options['dataType']\n else\n EternosBackup::SiteData.defaultDataSet\n end\n end", "title": "" }, { "docid": "7c6584cdb35c76865f4c843b9e8db3c0", "score": "0.52967656", "text": "def data_sets\n update\n library.values\n end", "title": "" }, { "docid": "13b4f6d0c2391384ceaf18816f0e89ea", "score": "0.5286912", "text": "def _delete_dataset\n apply_instance_filters(super)\n end", "title": "" }, { "docid": "2c53f64b92be42b7b75547c20eca301a", "score": "0.5280166", "text": "def _update_dataset\n this\n end", "title": "" }, { "docid": "2c53f64b92be42b7b75547c20eca301a", "score": "0.5280166", "text": "def _update_dataset\n this\n end", "title": "" }, { "docid": "358449932a20640443ec3b4b5a12a393", "score": "0.5277321", "text": "def before_load\n data_class.rebuild_table\n super\n end", "title": "" }, { "docid": "c9c5de7e7f7b323a8bb575298589d0f5", "score": "0.52763456", "text": "def set_datasets\n @datasets = current_user.get_datasets 'all'\n\n @metadata_array = []\n @metadata_array = Dataset.get_metadata_list(@datasets.map{|ds| ds.id}) if @datasets\n\n # TODO: Find a better way to do this\n @datasets.each_with_index do |ds, i|\n ds.metadata = @metadata_array['data'][i]['attributes']\n end\n end", "title": "" }, { "docid": "d96a05864760dc1c979a0bd991cb6e1b", "score": "0.5258673", "text": "def datasets\n @datasets || []\n end", "title": "" }, { "docid": "d96a05864760dc1c979a0bd991cb6e1b", "score": "0.5258673", "text": "def datasets\n @datasets || []\n end", "title": "" }, { "docid": "f2e3c8e0472469d3199ba10c136feb1c", "score": "0.5236204", "text": "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "title": "" }, { "docid": "34aadeaf8c34571d2612f53b8fc7c7e6", "score": "0.52306443", "text": "def base\n @base ||= Ldaptic::DN(adapter.default_base_dn, self)\n end", "title": "" }, { "docid": "01934c7c6eaf08e5e7cd7353e0373442", "score": "0.5226249", "text": "def _insert_dataset\n use_server(model.instance_insert_dataset)\n end", "title": "" }, { "docid": "4875613ec58224f40734f8c97d2872be", "score": "0.52194536", "text": "def reset_instance_dataset\n ret = super\n return unless ds = @instance_dataset\n\n if columns = insert_returning_columns(ds)\n ds = ds.returning(*columns)\n end\n @instance_insert_dataset = ds\n\n ret\n end", "title": "" }, { "docid": "8dbba1e50d0b0b897e00ce5e1166e6d8", "score": "0.5214163", "text": "def default_data\n end", "title": "" }, { "docid": "048b2933e74633e7e805abbacfb70449", "score": "0.52018076", "text": "def custom_data\n super.attributes\n end", "title": "" }, { "docid": "5eb4f4d273c0f594f4f97460640e0072", "score": "0.51926", "text": "def initialize\n super()\n init_data()\n end", "title": "" }, { "docid": "cf56a6f73b3a2f5ee89d6b3a05914ee0", "score": "0.51903015", "text": "def dataset_path\n @dataset_path ||= filename\n end", "title": "" }, { "docid": "70c566f6ee4fdae2f8cb7f5a8f546dcd", "score": "0.5186505", "text": "def freeze\n super\n\n @instance_insert_dataset.freeze if @instance_insert_dataset\n self\n end", "title": "" }, { "docid": "b4d18e49ef0aa2cb2beca51a30521d87", "score": "0.5186158", "text": "def fresh_dataset\n @dataset.clone\n end", "title": "" }, { "docid": "389c8cb682f650f1843eaad56b7db7fa", "score": "0.5184189", "text": "def initialize(dataset)\n @dataset = dataset\n end", "title": "" }, { "docid": "398d33931ee299f7a4de9c0fa3fbc029", "score": "0.51639295", "text": "def data_maker\n @data_maker ||= ::EdnaConsole::DataMaker.new(self.questions)\n end", "title": "" }, { "docid": "09cee3c3db8e17fdedccb2d5f18d4800", "score": "0.51534605", "text": "def meta_default_data\n get_default_association_values.present? ? { :association_values => get_default_association_values.literalize_keys } : {}\n end", "title": "" }, { "docid": "7b5307c1452a07a13b9c389a52ebd6e5", "score": "0.51510954", "text": "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "title": "" }, { "docid": "6dd0cfeeb2184b47fe488365e6a45dd1", "score": "0.51439714", "text": "def freeze\n valid_connection_sql\n metadata_dataset\n @opts.freeze\n @loggers.freeze\n @pool.freeze\n @dataset_class.freeze\n @dataset_modules.freeze\n @schema_type_classes.freeze\n @loaded_extensions.freeze\n # SEQUEL5: Frozen by default, remove this\n @default_dataset.freeze\n metadata_dataset.freeze\n super\n end", "title": "" }, { "docid": "ed64863dccf5cfac8fcd580503a4ff1a", "score": "0.51433873", "text": "def unordered\n cached_dataset(:_unordered_ds){clone(:order=>nil)}\n end", "title": "" }, { "docid": "0eaa57302a98368b1183eea0c290c4e0", "score": "0.5141235", "text": "def train(dataset)\n raise 'Override me!'\n end", "title": "" }, { "docid": "63e6c71de60e197881bdd78ceca89c86", "score": "0.51408285", "text": "def initialize(_layout, _data=[], _queries=[])\n @layout = _layout\n @queries = _queries\n #puts \"DATASET NEW queries:#{@queries}\"\n super(_data)\n end", "title": "" }, { "docid": "cb5ea82435d2b691cd64f29303b47682", "score": "0.5132663", "text": "def setup_baseline_data(options = {})\n entity = Flapjack::Data::Entity.new(:id => \"2000\", :name => \"clientx-app-01\")\n entity.save\n\n contact = Flapjack::Data::Contact.new(:id => '1000',\n :name => 'John Smith')\n contact.save\n\n medium = Flapjack::Data::Medium.new(:type => 'email', :address => 'jsmith@example.com',\n :interval => 30)\n medium.save\n\n contact.media << medium\n entity.contacts << contact\n end", "title": "" }, { "docid": "3b6a82be0fba7e6b13dc85d3025ded87", "score": "0.51240605", "text": "def dataset(name)\n fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) }\n end", "title": "" }, { "docid": "8b524ef767367a428cc5604bfccd954a", "score": "0.5123658", "text": "def association_dataset_for(object)\n condition = if can_have_associated_objects?(object)\n predicate_keys.zip(predicate_key_values(object))\n else\n false\n end\n\n associated_dataset.where(condition)\n end", "title": "" }, { "docid": "81d0d83b747aa441279b09efcc2b8bcb", "score": "0.51178527", "text": "def load_data(data_set)\n\t\tif data_set != :u\n\t\t\tload_hashes(\"#{data_set}.base\") # training set\n\t\t\tload_test(\"#{data_set}.test\") # test set\n\t\telse\n\t\t\tload_hashes(\"#{data_set}.data\") # training set\n\t\tend\n\tend", "title": "" }, { "docid": "6ece8346b9ba70cba228b0c877e40114", "score": "0.51079494", "text": "def this\n return @this if @this\n raise Error, \"No dataset for model #{model}\" unless ds = model.instance_dataset\n\n cond = if ds.joined_dataset?\n # SEQUEL5: Remove as joined model datasets are now allowed\n qualified_pk_hash\n else\n pk_hash\n end\n\n @this = use_server(ds.where(cond))\n end", "title": "" }, { "docid": "38887e3c9f45514e546869188c1a263d", "score": "0.51077396", "text": "def data_bag\n @_data_bag_override || node[node_key][:config_data_bag_override] || node_key\n end", "title": "" }, { "docid": "40f997ec396decfb813c95d6ea69077b", "score": "0.5090404", "text": "def lateral\n cached_dataset(:_lateral_ds){clone(:lateral=>true)}\n end", "title": "" }, { "docid": "073eecda88d5ffff71e23058dace27d4", "score": "0.50881124", "text": "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "title": "" }, { "docid": "ea900257a4dff4f7a80cea3beeaa3ddb", "score": "0.5083299", "text": "def add_defaults_local\n super\n self.collection_event ||= parent.collection_event if parent\n self.specimen_characteristics ||= CaTissue::SpecimenCharacteristics.new\n end", "title": "" }, { "docid": "08eb139aeb70496a655dc609f8aab610", "score": "0.5075078", "text": "def build_current_dataset_setting\n ds_params = {}\n ds_params = page_params.to_h[:dataset_setting] if params[:site_page] && page_params.to_h && page_params.to_h[:dataset_setting]\n\n @dataset_setting = nil\n if ds_params[:id]\n @dataset_setting = DatasetSetting.find(ds_params[:id])\n elsif @page.dataset_setting\n @dataset_setting = @page.dataset_setting\n else\n @dataset_setting = DatasetSetting.new\n @page.dataset_setting = @dataset_setting\n end\n @dataset_setting.assign_attributes session[:dataset_setting][@page_id] if session[:dataset_setting][@page_id]\n\n if ds_id = ds_params[:dataset_id]\n\n # If the user changed the id of the dataset, the entity is reset\n if @dataset_setting.dataset_id && @dataset_setting.dataset_id != ds_id\n delete_session_key(:dataset_setting, @page_id)\n session[:invalid_steps][@page_id] = %w[type columns preview]\n @dataset_setting.filters = @dataset_setting.columns_changeable = @dataset_setting.columns_visible = nil\n end\n\n @dataset_setting.assign_attributes(dataset_id: ds_id)\n ds_metadata = @dataset_setting.metadata['data'].first\n if ds_metadata\n @dataset_setting.api_table_name = ds_metadata.dig('attributes', 'tableName')\n @dataset_setting.legend = ds_metadata.dig('attributes', 'legend')\n end\n end\n\n if fields = ds_params[:filters]\n fields = JSON.parse fields\n\n # Removes the \"variable\" param and sets the filters\n @dataset_setting.filters =\n fields.map { |h| h.select { |k| k != 'variable' } }\n\n # Sets the changeable fields from the params\n @dataset_setting.set_columns_changeable(\n fields.map { |h| h['name'] if h['variable'] == true }.compact\n )\n end\n\n if fields = ds_params[:visible_fields]\n @dataset_setting.columns_visible = fields.to_json\n end\n\n if fields = ds_params[:widgets]\n @dataset_setting.widgets = fields\n end\n end", "title": "" }, { "docid": "f85f1f36aac4ffe5b32793d6613b2c96", "score": "0.50718284", "text": "def followings_dataset\n super.select_all(:follows).inner_join(:sites, :id=>:site_id).exclude(:sites__is_deleted => true).exclude(:sites__is_banned => true).exclude(:sites__profile_enabled => false).order(:score.desc)\n end", "title": "" }, { "docid": "6b09f90730472ca858cfe07fec9e350e", "score": "0.50684404", "text": "def set_data_set\n @data_set = DataSet.find_by(:id => params[:dataset_id])\n end", "title": "" }, { "docid": "6c4e89a81a4af53c9c3ca6959e031e4b", "score": "0.5068217", "text": "def defaults\n self.datasource_defaults ||= Hash.new\n end", "title": "" }, { "docid": "13fa7dbf54d059bb090cc57aa6941c26", "score": "0.5058688", "text": "def dataset?\n true\n end", "title": "" }, { "docid": "d2862d6c79bedd37db0210cf6d1a8506", "score": "0.5048803", "text": "def uses(*datasets)\n @used_datasets = datasets\n end", "title": "" }, { "docid": "3e9d9d4cdeb3332ff3888c6eb399da61", "score": "0.50413096", "text": "def data_center\n super\n end", "title": "" } ]
10a1fc855a12cfdb265488b017f649e5
converts a split ratio of the form 3:2 (i.e. numerator:denominator) into a decimal of the form 1.5 (i.e. numerator/denominator)
[ { "docid": "7367ba778c30e69a29ca0b405ef1e002", "score": "0.8002097", "text": "def reformat_split_ratio(split_ratio)\n numerator, denominator = *(split_ratio.split(\":\").map(&:strip))\n numerator.to_f / denominator.to_f\n end", "title": "" } ]
[ { "docid": "d26482ad8e7a41eccad3394f5be5b727", "score": "0.6719033", "text": "def format_ratio(n)\n \"%2.2f\\%\" % (n * 100).to_s\n end", "title": "" }, { "docid": "1ccaf0844bc1650205310096a9f4da37", "score": "0.6605158", "text": "def ratio\n # This call is interesting because it involves converting the\n # cog to a floar instead of both the chainring and the cog.\n # This avoids any uncessary conversions to get the job done!\n chainring / cog.to_f\n end", "title": "" }, { "docid": "da845378fb378efa2939535338823991", "score": "0.64595234", "text": "def split_div(str)\n str =~ /(\\d+)\\/(\\d+)/\n if $1 and $2\n result = $1.to_f / $2.to_f\n result.to_s.gsub(/\\.(\\d)\\d*/) { |s| \".\"+$1 }\n else\n str\n end\n end", "title": "" }, { "docid": "395045d57acd8276d5635ed6c8f220ea", "score": "0.64165235", "text": "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "title": "" }, { "docid": "4798248a480b8f655ee00d7e0ed23df7", "score": "0.6344871", "text": "def ratio(value_a1, value_a2, value_b2)\n (value_a1 * value_b2 / value_a2).to_i rescue 0\n end", "title": "" }, { "docid": "ce5476dd72b9f37acfbd3b9656c3f515", "score": "0.6340899", "text": "def curious_fraction(numerator,denominator)\n numerators = numerator.to_s.split('').map(&:to_i)\n denominators = denominator.to_s.split('').map(&:to_i)\n\n if numerators[0]==denominators[0] && numerators[0]!=0\n numerators.shift\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[1]==denominators[0] && numerators[1]!=0\n numerators.pop\n denominators.shift\n return (numerators[0].to_f)/denominators[0]\n \n elsif numerators[0]==denominators[1] && numerators[0]!=0\n numerators.shift\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n\n elsif numerators[1]==denominators[1] && numerators[1]!=0\n numerators.pop\n denominators.pop\n return (numerators[0].to_f)/denominators[0]\n else\n false\n end\n\nend", "title": "" }, { "docid": "d5eb3c3981ece45579820f473a83e9f9", "score": "0.6291107", "text": "def to_f\n numerator.to_f / denominator.to_f\n end", "title": "" }, { "docid": "80f970b37c5beb79e750905a616ba31a", "score": "0.62512916", "text": "def DivisionStringified(num1,num2)\n result = num1.to_f / num2.to_f\n result.round.to_s.chars.map(&:to_i).size <= 3 ? result.round : result.round(3)\nend", "title": "" }, { "docid": "95cadb6346f772c22a4faeb8f981c412", "score": "0.62378865", "text": "def test_split\n assert_equal((46 / 3.0).round(2), @check_test.split.to_f)\n end", "title": "" }, { "docid": "6bf0dd778b7286d55c6b25530a62dc7c", "score": "0.62240136", "text": "def denominator() end", "title": "" }, { "docid": "dfd2c171189d062620ae553ecf42bf57", "score": "0.6186549", "text": "def mixed_fraction(s)\n numerator, denominator = s.split('/').map(&:to_i)\n\n raise ZeroDivisionError if denominator.to_i.zero?\n \n if evenly_divides?(numerator, denominator)\n (numerator / denominator).to_s\n else\n simplify_fraction(numerator, denominator)\n end\nend", "title": "" }, { "docid": "5857d71d97f3d84b63839ff9d2888173", "score": "0.6174313", "text": "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "title": "" }, { "docid": "6b2983df2b8dd86057d74633b49ab99f", "score": "0.61717147", "text": "def divide(num1, num2)\n num2.to_f / num1.to_f;\nend", "title": "" }, { "docid": "a997aeb2c2970a52f1f341769f058c93", "score": "0.6142828", "text": "def divide(first_parameter, second_parameter)\n (first_parameter / second_parameter).to_f\n end", "title": "" }, { "docid": "da140d27110f39576fd00757f980090c", "score": "0.61341715", "text": "def read_ratio(cursor)\n num = @bindata_reader_32.read(@data[cursor..cursor+3])\n denom = @bindata_reader_32.read(@data[cursor+4..cursor+7])\n invalid_data(\"@#{cursor} - Invalid rational #{num}/#{denom}\") if ((denom == 0) and (num != 0))\n return (num == 0) ? 0 : num.to_f / denom.to_f\n end", "title": "" }, { "docid": "7cb56f8258b078a26f21c9679a891acd", "score": "0.6125818", "text": "def mixed_fraction(s)\n f = s\n fraction = f.split(\"/\").map { |x| x = x.to_i }\n p initial = Rational(fraction[0],fraction[1])\n p initial_split = initial.to_s.split(\"/\").map { |x| x = x.to_i }\n \n if initial_split[0] < 1\n initial_split[0] = initial_split[0] * -1\n initial_split[0]\n initial_split[2] = \"-\"\n initial_split[2]\n end\n if initial_split[1] == initial_split[0]\n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = initial_split[0]\n final_answer = final_answer.join\n elsif initial_split[0] == 0\n final_answer = \"0\"\n elsif (initial_split[0] / initial_split[1]) < 1\n final_answer = initial.to_s\n elsif (initial_split[0] / initial_split[1]) > 1\n if initial_split[0] % initial_split[1] == 0\n final_answer = \"#{initial_split[2]}#{initial_split[0]/initial_split[1]}\"\n elsif \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n else \n final_answer = Array.new\n final_answer[0] = initial_split[2]\n final_answer[1] = \"#{(initial_split[0]/initial_split[1])}\"\n final_answer[2] = \" #{initial_split[0] % initial_split[1]}/#{initial_split[1]}\"\n final_answer = final_answer.join\n end\n p final_answer\nend", "title": "" }, { "docid": "46bd6d517a125cafbcfb8e8a51f71497", "score": "0.61053824", "text": "def /(divider)\n raise ZeroDivisionError if divider.zero?\n new(amount / divider.to_f, currency)\n end", "title": "" }, { "docid": "09430b6069cf7373ab7838a4308a2e9f", "score": "0.60915816", "text": "def ratio_s4(m_d,m)\n\n if @target == \"max\"\n return \" \" if m_d==0.0\n r = Metric.op(m,m_d,\"/\")\n else\n return \" \" if m==0.0\n r = Metric.op(m_d,m,\"/\")\n end\n\n return \" 100+\" if (r >= 100.0)\n return \"<0.01\" if (r < 0.01)\n sprintf(\"%5.2f\",r);\n\n end", "title": "" }, { "docid": "b1c2b79cf6131f5d20a5813fb664ffa3", "score": "0.6085425", "text": "def /(denominator)\n raise MoneyError, \"Denominator must be a Fixnum. (#{denominator} is a #{denominator.class})\"\\\n unless denominator.is_a? Fixnum\n\n result = []\n equal_division = (cents / denominator).round\n denominator.times { result << Money.create_from_cents(equal_division) }\n extra_pennies = cents - (equal_division * denominator)\n \n # Make sure we don't loose any pennies!\n extra_pennies.times { |p| result[p] += 0.01 }\n result\n end", "title": "" }, { "docid": "15184aecfdb96383184c647532879cae", "score": "0.60244393", "text": "def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend", "title": "" }, { "docid": "d656d8b0b7bb86bc02a1e4e766b7c508", "score": "0.6022662", "text": "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "title": "" }, { "docid": "c1a3144aacdf59e166507fbe08120d70", "score": "0.6007489", "text": "def sec_fraction\n subsec\n end", "title": "" }, { "docid": "56575c105583d2ca41e892c6f14051e0", "score": "0.6006182", "text": "def denominator\n @data[1]\n end", "title": "" }, { "docid": "df102385e36e4d4831d14b74a949c084", "score": "0.5997694", "text": "def divide_fraction_by_fraction(frac1, frac2)\n\tif frac1 == frac2\n\t\treturn Term.new(frac1.line, frac1.col, magnitude: 1)\n\telsif frac1.numerator == frac2.numerator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac2.denominator, denominator: frac1.denominator)\n\telsif frac1.denominator == frac2.denominator\n\t\treturn Fraction.new(frac1.line, frac1.col, numerator: frac1.numerator, denominator: frac2.numerator)\n\telse\t\t\n\t\treturn multiply_fraction_and_fraction(frac1, invert_fraction(frac2))\n\tend\nend", "title": "" }, { "docid": "31811ca0086f1fc5f7973cc4b2e58cdd", "score": "0.5974529", "text": "def to_f\n\t\tnum.to_f/denom\n\tend", "title": "" }, { "docid": "8689a51dd54e27cdf9c175b0601f296d", "score": "0.59511656", "text": "def market_ratio (market_cap, income)\r\n if market_cap.end_with?(\"M\") and income.end_with?(\"M\")\r\n\t ratio = (income.to_f / market_cap.to_f).round(2)\r\n\telsif market_cap.end_with?(\"B\") and income.end_with?(\"B\")\r\n\t ratio = (income.to_f / market_cap.to_f).round(2)\r\n\telsif market_cap.end_with?(\"B\") and income.end_with?(\"M\")\r\n\t ratio = (income.to_f / (market_cap.to_f * 1000 )).round(2)\r\n\telsif market_cap.end_with?(\"M\") and income.end_with?(\"B\")\r\n\t ratio = ((income.to_f * 1000 )/ market_cap.to_f).round(2)\r\n end\r\nend", "title": "" }, { "docid": "f5984190c88fdb7fd4119944de98e6d1", "score": "0.59175223", "text": "def divide_two_places(big_float, small_float)\n quotient = big_float / small_float\n quotient.round(2)\nend", "title": "" }, { "docid": "3c30ff9473547db75e45a84d67b2567e", "score": "0.59135324", "text": "def /(number)\n (BigDecimal.new(self) / BigDecimal.new(number.to_s)).\n to_f.to_money(:currency => currency, :precision => self.precision)\n end", "title": "" }, { "docid": "0d11bf2e56fb359c64eb022349edb3bb", "score": "0.5896464", "text": "def divide_term_by_fraction(term, fraction)\n\tterm_fraction = Fraction.new(term.line, term.col, numerator: term)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), term_fraction)\nend", "title": "" }, { "docid": "396541e662d4be50d5c2547146ab20f7", "score": "0.5881118", "text": "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "title": "" }, { "docid": "a6f51088fe77b974f9e14274b83b2da6", "score": "0.5875007", "text": "def long_division (numerator, denominator)\n base = 10\n fraction = (numerator / denominator) . to_s + \".\"\n position = fraction . length\n seen = {}\n\n numerator %= denominator\n\n while !seen [numerator] do\n if numerator == 0\n then return (fraction)\n end\n seen [numerator] = position\n fraction += (base * numerator / denominator) . to_s\n numerator = base * numerator % denominator\n position += 1\n end\n\n return (fraction [0 .. seen [numerator] - 1] + \"(\" +\n fraction [ seen [numerator] .. -1] + \")\")\n \nend", "title": "" }, { "docid": "fba10f73ad59b93c53d5fee31d312898", "score": "0.5864692", "text": "def denominator_formula\n 1.upto(payments - 1).map { |m| \"(1 + percent) ** (#{m} * payment_period)\" }\n .push(1)\n .join(' + ')\n end", "title": "" }, { "docid": "afdf0731da0051686f6230fbf02230c3", "score": "0.5859833", "text": "def fractional; end", "title": "" }, { "docid": "6d9faa69d613957a3c2473cee8a12c82", "score": "0.58406854", "text": "def reduce(frac)\n n, d = frac.split('/').map(&:to_i)\n unless (g = gcd(n, d)) == 1\n n /= g; d /= g\n end\n \"#{n}/#{d}\"\nend", "title": "" }, { "docid": "632295cc680dcce5ad5e5e175785cd4a", "score": "0.58276767", "text": "def routing_fraction_to_percentage(fraction)\n \"#{(fraction * 100).to_i}%\"\n end", "title": "" }, { "docid": "bb46ffbc6bd19e6de139f21c88154609", "score": "0.5826052", "text": "def fracToDec(num,den)\r\n return num.to_f/den.to_f\r\nend", "title": "" }, { "docid": "ef65ff1c566d9717a305c04bb29e1afc", "score": "0.58006", "text": "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "title": "" }, { "docid": "8866e58d8302bf0060943e80278b0242", "score": "0.58003885", "text": "def divide_term_list_by_fraction\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, numerator: term_list)\n\treturn multiply_fraction_and_fraction(invert_fraction(fraction), tl_fraction)\nend", "title": "" }, { "docid": "28b0b8f7fce177fbe1f9d9e7e6cffe86", "score": "0.5779663", "text": "def formatted_division(num1, num2)\n result = (num1 / num2.to_f).round(4)\n left, right = result.to_s.split('.')\n left = left.reverse.scan(/\\d{1,3}/).join(',').reverse\n if right.size < 4\n right += '0' until right.size == 4\n end\n \"#{left}.#{right}\"\nend", "title": "" }, { "docid": "996cef960f0e3e4de45cfec82623569a", "score": "0.5773112", "text": "def divide_fraction_by_term(fraction, term)\n\tterm_fraction = Fraction.new(term.line, term.col, denominator: term)\n\treturn multiply_fraction_and_fraction(fraction, term_fraction)\nend", "title": "" }, { "docid": "7ff843e67d205a45ffaa400a87816b82", "score": "0.57687974", "text": "def budget_ratio\n budget = self.budget # cache result\n if budget > 0.0\n return ((self.spent / budget) * 100).round \n else\n self.progress\n end\n end", "title": "" }, { "docid": "8f1ea7b7ab30876835edf4f04f6cf069", "score": "0.5747183", "text": "def post_divide; end", "title": "" }, { "docid": "b44522d1d09aa95b39c3e1005e31b98b", "score": "0.5735822", "text": "def split_between(params)\n # if just a number is passed in, then money is split equally\n if params.is_a?(Integer)\n results = split_evenly_between(params)\n\n # if an array of monies is passed in, then split in proportions\n elsif params.is_a?(Array)\n\n raise ArgumentError, 'Can only split up over at least one ration' if params.empty? && !zero?\n\n results = params.map { |p| p.is_a?(::Money) ? p.cents : p }\n\n total = results.inject(:+)\n if total.zero?\n return Array.new(results.size, ::Money.new(0)) if zero?\n\n raise ArgumentError, \"Total of ratios should not be zero! You sent in: #{params.inspect}\"\n end\n\n results.map! do |ratio|\n ::Money.new((cents * (ratio.to_f / total)).round)\n end\n\n # Distribute rounding to max absolute to avoid a $0 amount getting the rounding\n remainder = self - results.total_money\n if !remainder.zero?\n biggest_value_index = results.index(results.max_by(&:abs))\n results[biggest_value_index] += remainder\n end\n else\n raise 'Either a Integer or array has to be passed in for splitting money'\n end\n\n results\n end", "title": "" }, { "docid": "c2af24748565fbf36b1ab9e27d68c40b", "score": "0.57195264", "text": "def test_Rational_InstanceMethods_fdiv\n\t\t# assert_equal(11/4, Rational(\"11/2\")/2)\n\t\tassert_equal(2.75, Rational(\"11/2\").fdiv(2))\n\tend", "title": "" }, { "docid": "22b58da39e2d8f98daf496c25ea8a49a", "score": "0.5707898", "text": "def part2(in1, in2)\n (in1.to_f + in2.to_f)/3\nend", "title": "" }, { "docid": "433b4f0c3730c17f30ee7630cb81e9c0", "score": "0.5705042", "text": "def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend", "title": "" }, { "docid": "ee9ef6ee309dceb53682a8a8a4da8f47", "score": "0.5698903", "text": "def pre_divide; end", "title": "" }, { "docid": "7790f1691bef78106f54d56889a14c19", "score": "0.56983155", "text": "def golden_ratio(precision)\n x = fib(99)/fib(98).to_f\n x.round(precision)\n end", "title": "" }, { "docid": "0aab68216a371c53049b7f00ce761924", "score": "0.5694804", "text": "def votes_ratio(voting_field = \"votes\")\n eval(voting_field).try(:[], 'ratio') || 0\n end", "title": "" }, { "docid": "f96b350b45d299b1d7358c2f26c6fee3", "score": "0.5692422", "text": "def ratio(m_d,m)\n\n if @target == \"max\"\n return \" \" if m_d==0.0\n r = Metric.op(m,m_d,\"/\")\n else\n return \" \" if m==0.0\n r = Metric.op(m_d,m,\"/\")\n end\n\n return \"#{r}\"\n\n\n end", "title": "" }, { "docid": "289db60262fa359d1d1e4b29ce1f18c2", "score": "0.5684516", "text": "def decimal(n, d)\n simp_array = simplify(n, d)\n nn = simp_array[0].round(2)\n nd = simp_array[1].round(2)\n dec = nn/nd\n puts \"#{dec}\"\nend", "title": "" }, { "docid": "5fd88e2d4a724ae9ad0108f618fec2fe", "score": "0.5681389", "text": "def to_i\n @numer / @denom\n end", "title": "" }, { "docid": "b8296be482661d07d41e0498676a5ee3", "score": "0.5679822", "text": "def /(value)\n value.respond_to?(:amount) ? (self.amount / value.convert_to(self.units).amount).to_f : self.class.new((self.amount / BigDecimal.new(value.to_s)), self.units)\n end", "title": "" }, { "docid": "4f170bac30e55ba0788fa2fc065f6fbf", "score": "0.5644697", "text": "def pounds_to_k(p)\n\tkilos = p.to_f/2.2\n\tputs kilos\nend", "title": "" }, { "docid": "b495dfe2d3b3fbef88455ca5b6d35e0f", "score": "0.56267977", "text": "def kw_per_ton_to_cop(kw_per_ton)\n \n return 3.517/kw_per_ton\n \nend", "title": "" }, { "docid": "a9a1e00ee9ee70eaddb8b7495faa2c6b", "score": "0.5625021", "text": "def DivisionStringified(num1,num2)\n quotient = num1.to_f / num2.to_f\n\n \"#{quotient.round.to_s.reverse.gsub(/(...)(?=.)/, '\\1,').reverse}\"\nend", "title": "" }, { "docid": "73ea03d881155ea2f8b4fac47fdf6e08", "score": "0.56134737", "text": "def divide_fraction_by_term_list(fraction, term_list)\n\ttl_fraction = Fraction.new(term_list.line, term_list.col, denominator: term_list)\n\treturn multiply_fraction_and_fraction(fraction, tl_fraction)\nend", "title": "" }, { "docid": "a553b9da3657088e87db9bdbd661aa36", "score": "0.56078", "text": "def divide(input_number)\n $number /= input_number\n return $number\nend", "title": "" }, { "docid": "5876c98ba385ba9d4ee6d611318853e0", "score": "0.5586493", "text": "def DivisionStringified(num1, num2)\n formatted_num = (num1.to_f / num2).round.to_s\n formatted_num.reverse.scan(/\\d\\d?\\d?/).join(',').reverse\nend", "title": "" }, { "docid": "6e7703e40a8a49c7bddfb732a7b493d9", "score": "0.5577289", "text": "def reduce\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n min = [numerator,denominator].min\n min.downto(2) do |x|\n if numerator%x == 0 && denominator%x == 0\n n = numerator/x\n d = denominator/x\n puts n.to_s + \"/\" + d.to_s\n break\n end\n end\n end\n end", "title": "" }, { "docid": "4edc99f9d0218b66c5bbb19ad6a40994", "score": "0.5560193", "text": "def Divide(val)\n self.value /= val\n end", "title": "" }, { "docid": "e4dc04400b07fddea347fc27fc7bad1c", "score": "0.55519706", "text": "def denominator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tad.lcm(bd)\n\tend", "title": "" }, { "docid": "e4dc04400b07fddea347fc27fc7bad1c", "score": "0.55519706", "text": "def denominator\n\t\tad = @a.denominator\n\t\tbd = @b.denominator\n\t\tad.lcm(bd)\n\tend", "title": "" }, { "docid": "09a089f8601d53ac2a625163761eefd7", "score": "0.55512923", "text": "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "title": "" }, { "docid": "005e8c87fcfe736bffcaac5b8789a581", "score": "0.5547763", "text": "def division (first_number, second_number)\nfirst_number / second_number\nend", "title": "" }, { "docid": "1354100fddca604c884cf2a784d035e8", "score": "0.5542839", "text": "def divide(first_number, second_number)\n first_number / second_number\nend", "title": "" }, { "docid": "8ad06ede07495d455782e8867d24a4e5", "score": "0.55308014", "text": "def make_ratio(array1, array2)\n if array1.empty? || array2.empty?\n result = 0\n else\n result = array1.compact.inject(0){|sum, item| sum + item}.to_f/array2.compact.inject(0){|sum, item| sum + item}.to_f\n end\n result\n end", "title": "" }, { "docid": "c43bad4d8c518a6551cae649440d818f", "score": "0.55304146", "text": "def _convert_to_common_denominator(frac_a, frac_b)\n frac_a_num = frac_a[0] # numerator of fraction a\n frac_a_den = frac_a[1] # denominator of fraction a\n frac_b_num = frac_b[0] # numerator of fraction b\n frac_b_den = frac_b[1] # denominator of fraction b\n\n denominator = least_common_multiple(frac_a_den, frac_b_den)\n\n # multiplier tells us what to multiply the numerators by\n mult_a = denominator/frac_a_den # multiplier for 'a'\n mult_b = denominator/frac_b_den # multiplier for 'b'\n\n [[(frac_a_num * mult_a), denominator],\n [(frac_b_num * mult_b), denominator]]\n end", "title": "" }, { "docid": "45ecc8e84dd42978e04c38496f00efb0", "score": "0.5522469", "text": "def token_relation( numerator, divider )\n return numerator / divider\n end", "title": "" }, { "docid": "ebfcd783e69b7b08f6110e3db2e46da1", "score": "0.55139923", "text": "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "title": "" }, { "docid": "ebfcd783e69b7b08f6110e3db2e46da1", "score": "0.55139923", "text": "def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end", "title": "" }, { "docid": "b15f9c42897ffa645a01811ac6a095e3", "score": "0.551362", "text": "def get_remaining_ratio(logged_ratio, done_ratio)\n if logged_ratio > 0\n Integer(logged_ratio.to_f/done_ratio.to_f*(100-done_ratio))\n else\n Integer(100-done_ratio)\n end\n end", "title": "" }, { "docid": "a6db339f1437a8d0c33e5fe327ec3f07", "score": "0.54943764", "text": "def return_rational(numerator)\n\t\tnumerator/36.to_r\n\tend", "title": "" }, { "docid": "2e13b19db5c2ac83bade144f01b44738", "score": "0.5488883", "text": "def serving_ratio(serving_amt = self.serving_size)\n ratio = 1.0\n #have to transform to float to maintain decimal precision\n if self.serving_size && serving_amt && self.serving_size > 0 && serving_amt > 0\n ratio = serving_amt/self.serving_size.to_f\n end\n ratio\n end", "title": "" }, { "docid": "7b43504794938cc52cd31b3d3039cf2f", "score": "0.5447169", "text": "def divide(n1, n2)\n divide = n1 / n2\n return divide\nend", "title": "" }, { "docid": "3395ea5cd056db7d080892db3267a17f", "score": "0.54471457", "text": "def calculate_fractional\n calculate_fractional ||= if @value.positive?\n @value / 100.rationalize\n else\n -100 / @value.rationalize\n end\n end", "title": "" }, { "docid": "d2f1b6722ae631a06f02de50efa02b8d", "score": "0.5443351", "text": "def /(divisor)\n return map {|currency, money| money / divisor}\n end", "title": "" }, { "docid": "0c27123b3ac8e470408ecc838948c306", "score": "0.544074", "text": "def divide(first_number, second_number)\n return first_number / second_number\n end", "title": "" }, { "docid": "917d9c70ba71f8df0dfce2532e9249b3", "score": "0.5433267", "text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n puts (f_divisor/f_dividend).round(1)\nend", "title": "" }, { "docid": "785c638602b3ead2cc9316731f9a412e", "score": "0.5430817", "text": "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "title": "" }, { "docid": "3e39879a498579af6f234686f81719b2", "score": "0.5429601", "text": "def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend", "title": "" }, { "docid": "ae2d6bd2b9200595a46eba9e28cc96c5", "score": "0.5426519", "text": "def test_Rational_InstanceMethods_denominator\n\t\tassert_equal(3, Rational(\"2/3\").denominator)\n\t\tassert_equal(365, Rational(\"343434/365\").denominator)\n\tend", "title": "" }, { "docid": "93e5539411d108217aaf1638bf780393", "score": "0.5423417", "text": "def fractional\n value = to_d * currency.subunit_to_unit\n if self.class.infinite_precision\n value\n else\n value.round(0, self.class.rounding_mode).to_i\n end\n end", "title": "" }, { "docid": "e65acf878bfc57ad64fb485866418f7d", "score": "0.54206103", "text": "def calc_upg_mwh_ch4(val1= calc_upg_gigjoules_ch4, val2= 3.6)\n\t\t(val1 / val2).round 2\n\tend", "title": "" }, { "docid": "59146e6c6407b76da50ac2e316419000", "score": "0.54186034", "text": "def solution(value)\n value.round(2)\nend", "title": "" }, { "docid": "c67e1606369a29f23522e08bc056ad4b", "score": "0.5407599", "text": "def win_ratio\n\t\t\n\t\t(((self.wins_total.to_f) / (self.wins_total.to_f + self.loss_total.to_f))*100).round(2)\n\n\t\t#Ruby naturally returns the last line that was executed\n\t\t#do not need any other variable named win_ratio\n\n\tend", "title": "" }, { "docid": "7b182b1e84cd4b962e14ab6adf9131a9", "score": "0.5407364", "text": "def final_decision_weight_ratio_pretty\n reviewer_weight = final_decision_weight_ratio * 100\n interviewer_weight = 100 - reviewer_weight\n \"R=#{'%.0f' % reviewer_weight} / I=#{'%.0f' % interviewer_weight}\"\n end", "title": "" }, { "docid": "41aae8719295ec31047b095a0cd58808", "score": "0.54064065", "text": "def div_stringed(num1, num2)\r\n\r\nend", "title": "" }, { "docid": "13f11cf299a63c77e9645dd06a918b14", "score": "0.539393", "text": "def divide(dividend:, divisor:)\n dividend / divisor\nend", "title": "" }, { "docid": "dd6a5977698145548d61549ba7c25461", "score": "0.53919655", "text": "def modulo_of(fraction); end", "title": "" }, { "docid": "59ee9d7591bfa9cef834938033845924", "score": "0.5386321", "text": "def perc_to_f(str)\n str.gsub(/%/, \"\").to_f / 100.0\n end", "title": "" }, { "docid": "04d2594579c7ac2fe5dfe1f54112f4ab", "score": "0.537515", "text": "def to_r\n return Rational(numerator,denominator)\n end", "title": "" }, { "docid": "170cba7321c5f3210bd39706d64eeba9", "score": "0.5366363", "text": "def calc_percent(n, total)\n (n.to_f/total.to_f) * 100.0\nend", "title": "" }, { "docid": "9b13bc48b1bd6f073090f83701d84b22", "score": "0.5361772", "text": "def divide(first_number, second_number)\n return first_number / second_number\nend", "title": "" }, { "docid": "53e7a3dabf335fff7e6c00a753b6504b", "score": "0.5359209", "text": "def divide(numerator, denominator)\n $LOG.debug(\"Numerator: #{numerator}, denominator #{denominator}\")\n begin\n result = numerator / denominator\n rescue Exception => e\n $LOG.error \"Error in division!: #{e}\"\n\tresult = nil\n end\n return result\n end", "title": "" }, { "docid": "78d9f50b52e906c9ce51b1c617bab12b", "score": "0.5356215", "text": "def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend", "title": "" }, { "docid": "f0a4e390e9ce65f5c86976f64580993f", "score": "0.5355624", "text": "def fraction(hash,n)\n result = {}\n result[:n] = (n - hash[:minus]**2)/hash[:n]\n result[:i] = (Math.sqrt(n).to_i + hash[:minus])/result[:n]\n result[:minus] = result[:i]*result[:n]-hash[:minus]\n result\nend", "title": "" }, { "docid": "37916f5df6a2a604f0ac247c60d78c31", "score": "0.5355186", "text": "def set_ratio\n @ratio = $program.width.to_f / $program.height\n end", "title": "" }, { "docid": "b35bea25df14e7c127f2246310fcb771", "score": "0.5349243", "text": "def to_r\n Rational(numerator.to_i, denominator.to_i)\n end", "title": "" }, { "docid": "cd8e4fd61fc86f9f94588926896c0778", "score": "0.53439784", "text": "def to_d() \n\t @n.to_f / @d\n\tend", "title": "" } ]
e5eee2778a0cc73f1a4a3ee22eac879f
The status of the virtual server instance. Possible values: [failed,paused,pausing,pending,restarting,resuming,running,starting,stopped,stopping]
[ { "docid": "9b968c1aa80c54b87cffc5425405ce22", "score": "0.0", "text": "def status\n @data[:status].downcase\n end", "title": "" } ]
[ { "docid": "2c52b4eacc6a8a673787636e80d7a70a", "score": "0.75410056", "text": "def status\n @status || :stopped\n end", "title": "" }, { "docid": "a5f55b328eafc2ebfaa6ab64d5206e95", "score": "0.74824846", "text": "def status\n if stopped?\n 'Stopped'\n elsif stopping?\n 'Stopping'\n elsif running?\n 'Running'\n elsif failed?\n 'Failed'\n else\n 'Unknown'\n end\n end", "title": "" }, { "docid": "cab3119ad1cfe5c3ba8904ea500b94dd", "score": "0.72341007", "text": "def status()\n @status = :stopped if @status.nil?\n return @status\n end", "title": "" }, { "docid": "1dba44a879bde633a52f44cf0c68565f", "score": "0.72313285", "text": "def status(*options)\n # TODO: this is *not* how it's supposed to work. This will only give the\n # status of all *running* instances. There is no way to define what is\n # /supposed/ to be running ATM, though.\n statuses = []\n self.instances.each {|instance| statuses << instance.to_s(*options)}\n \n return statuses\n end", "title": "" }, { "docid": "f19a046bb0ce6727a8379ee4eb1685c3", "score": "0.72234637", "text": "def server_status\n @current_state ? 'Available' : 'Unavailable'\n end", "title": "" }, { "docid": "4b2e8223bfdd9b5e9306c205160d371b", "score": "0.7118173", "text": "def _instance_status(instance=nil)\n\t\treturn (_connection_status) ? \"running\" : \"stopped\"\n\tend", "title": "" }, { "docid": "a93106d253612f115200e048b9d3c21d", "score": "0.7075201", "text": "def status\n response = @client.get('server/status')\n verify response,\n internal_server_error: 'Server failed to retrieve status'\n end", "title": "" }, { "docid": "19d03336df22242e1a58d81b99eb14e0", "score": "0.6992881", "text": "def status\n case real_stat\n when :up\n \"Service up\"\n when :just_down\n \"Service down\"\n when :down\n \"Service down\"\n when :unmonitored\n \"No process registered for monitoring\"\n end\n end", "title": "" }, { "docid": "f1911dc19c1a206ef042c6e444a68911", "score": "0.6899365", "text": "def state\n @running ? :running : :stopped\n end", "title": "" }, { "docid": "e212b90382044b16f64cc973ae021e07", "score": "0.6880184", "text": "def status\n return 'paused' if paused?\n @status.to_s\n end", "title": "" }, { "docid": "23c213b61e305d4dede248eca67df663", "score": "0.6837413", "text": "def status\n results = []\n\n vagrant('status') do |message, error|\n if message.is_a?(MachineReadableOutput::State)\n results << message.data\n end\n end\n\n results\n end", "title": "" }, { "docid": "0da5e9fe224ab6d5ca4845501d0a933f", "score": "0.6790877", "text": "def status\n {\n \"local_server_address\" => local_server_address,\n \"known_servers\" => servers.keys\n }\n end", "title": "" }, { "docid": "dc41a49cb3497d778ab721410a5b8e2b", "score": "0.6783971", "text": "def server_status\n nessus_rest_get('server/status')\n end", "title": "" }, { "docid": "431742878ae12044997d51788aced9da", "score": "0.67710483", "text": "def determine_status(vm)\n return 'running' if @all_running_vm_names.include? vm.name\n return 'suspended' if vm.suspend_file_exists?\n return 'not running'\n end", "title": "" }, { "docid": "1382063e0d653eca356210684b6f558f", "score": "0.67620003", "text": "def get_status\n status = {\n \"stopped\" => @stopped,\n \"controller_status\" => get_plugins_status,\n }\n return status\n end", "title": "" }, { "docid": "69682afa6ebcb4499e936c57e8d09002", "score": "0.67577523", "text": "def status_name\n ['paused', 'check wait', 'check', 'download wait', 'download',\n 'seed wait', 'seed', 'isolated'].at(status)\n end", "title": "" }, { "docid": "c6bf1f67897221f0aa9c4195e4dfe412", "score": "0.67522615", "text": "def server_status\n code, body, res = get('/v3/system/server_status')\n if code != \"200\"\n return \"Server is down (#{code})\"\n end\n js = checked_json(body, %w[status])\n status = js['status']\n return status\n end", "title": "" }, { "docid": "a4497dbfe0b32f41d977e42e083128f8", "score": "0.6724008", "text": "def status\n @server.get_run_attribute(@uuid, @links[:status])\n end", "title": "" }, { "docid": "fbcf1b724209f70387ecb9762a7fe71c", "score": "0.6719872", "text": "def status()\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714622", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714368", "text": "def status\n @status\n end", "title": "" }, { "docid": "577044049aadba142da024728d77b581", "score": "0.6714238", "text": "def status\n @status\n end", "title": "" }, { "docid": "5a2985a3ed6098e03e7a174f22102d68", "score": "0.670901", "text": "def status\n server = @options.first&.downcase || ''\n selected_server = @config.dig('servers', server)\n\n # End early if no server was found, and let the user know\n return \"No server found matching '#{server}'\" unless selected_server\n\n server_stats = MineStat.new(selected_server['host'], selected_server['port'])\n send_status_embed(server_stats)\n end", "title": "" }, { "docid": "ea6d2b6af4dd29a57675589c9da77efd", "score": "0.66817474", "text": "def status\n @status.state\n end", "title": "" }, { "docid": "330f19d1691fe2f0672f8185f4a7e8f8", "score": "0.6642038", "text": "def status\n output = run(\"info\")\n result = output.scan(/^state:\\s+([\\w]+)|pid:\\s+(-?[\\d]+)$/).flatten\n\n LXC::Status.new(result.first, result.last)\n end", "title": "" }, { "docid": "787b1758bf145210d10cf629f945eb11", "score": "0.66310775", "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": "b6256824371f13eee6fc64f0c95374ad", "score": "0.6627358", "text": "def status\n @status\n end", "title": "" }, { "docid": "bd34e520248cedca3ff65fa1a6e2ed52", "score": "0.6595195", "text": "def status\n @state[:status]\n end", "title": "" }, { "docid": "940e80e721bd4a1e4f471afd6b4a68a0", "score": "0.6590511", "text": "def live?\n @current_status ||= status\n @current_status == 'Running'\n end", "title": "" }, { "docid": "59cac39fb922aa15c65c74d60d1d0054", "score": "0.6586166", "text": "def status_enum\n [[ACTIVE], [DROPPED_OUT], [COMPLETED]]\n end", "title": "" }, { "docid": "2e288cf308176ed5224f006a43e14455", "score": "0.6575133", "text": "def state\n :running\n end", "title": "" }, { "docid": "e5b0c38e176924e4042b548d37158e45", "score": "0.657262", "text": "def status\n cmd(\"status\")\n end", "title": "" }, { "docid": "5c7f094e0b19d4cde3dfdf3c566e1aec", "score": "0.65673935", "text": "def status\n {\n 'device' => :ok,\n 'no device' => :dead,\n 'offline' => :offline\n }[@state]\n end", "title": "" }, { "docid": "3e2f981b8e2c14e68175193b570bdd4a", "score": "0.6566743", "text": "def status\n @instance['status']\n end", "title": "" }, { "docid": "deaf8e3d21c15ad9792e4853c7b908bd", "score": "0.65433997", "text": "def status\n {\n 'device' => :ok,\n 'no device' => :dead,\n 'offline' => :offline\n }[@state]\n end", "title": "" }, { "docid": "57e7ba4af2d9765b422e7ec85854b3b5", "score": "0.6535759", "text": "def status\n return @status\n end", "title": "" }, { "docid": "9a373de69581185a24d1a337c0aff716", "score": "0.65300316", "text": "def status\n return \"paused\" unless self.active?\n return \"pending\" unless self.has_checked_in?\n return \"ok\" unless self.late?\n return \"late\"\n end", "title": "" }, { "docid": "5f6387edf4cae0d950fbf2f4672e95a9", "score": "0.651238", "text": "def status\n @status = [{\"name\" => \"Active\", \"value\" => 1}, {\"name\" => \"Deactive\", \"value\" => 0}]\n end", "title": "" }, { "docid": "328dc9e09457802310e565e3e13bbcdb", "score": "0.6505902", "text": "def status\n request(@fpgastatus||:status)\n end", "title": "" }, { "docid": "9d5864b8adcb2f034f78f76c7bf5b659", "score": "0.65005606", "text": "def status\n servers_service = ServersService.new\n response = servers_service.status\n render json: response[:body], status: response[:status]\n end", "title": "" }, { "docid": "4c34a52b4ea93ce291e3feebc69feff5", "score": "0.6484501", "text": "def serf_statuses\n %w[none alive leaving left failed].freeze\n end", "title": "" }, { "docid": "9e8df7a636ec20cebc765ed43169e792", "score": "0.64772", "text": "def state\n status.status\n end", "title": "" }, { "docid": "63cfb0554f97a03a456792662a89831f", "score": "0.6467646", "text": "def vm_running\n # puppet doesn't seem to be able to distinguish between :present and\n # :running (which maps to absent...) so we need to figure out ourselves\n # There's probably a more puppety way of doing this... does anyone know\n # what it is?\n instance = vom.instance(@resource[:name])\n\n status = false\n if instance.get_vm.vm(:default).state == :running\n status = true\n end\n\n status\n end", "title": "" }, { "docid": "48a06847541fca867e54b9d9afd02cbf", "score": "0.646077", "text": "def status\n return 'active' if active?\n return 'finished' if finished?\n return 'waiting'\n end", "title": "" }, { "docid": "48a06847541fca867e54b9d9afd02cbf", "score": "0.646077", "text": "def status\n return 'active' if active?\n return 'finished' if finished?\n return 'waiting'\n end", "title": "" }, { "docid": "32720a1add99ba75a3eece91615e6d07", "score": "0.645432", "text": "def status\n return if none?\n\n strong_memoize(:status) do\n if only_of?(:skipped, :ignored)\n 'skipped'\n elsif only_of?(:success, :skipped, :success_with_warnings, :ignored)\n 'success'\n elsif only_of?(:created, :success_with_warnings, :ignored)\n 'created'\n elsif only_of?(:preparing, :success_with_warnings, :ignored)\n 'preparing'\n elsif only_of?(:canceled, :success, :skipped, :success_with_warnings, :ignored)\n 'canceled'\n elsif only_of?(:pending, :created, :skipped, :success_with_warnings, :ignored)\n 'pending'\n elsif any_of?(:running, :pending)\n 'running'\n elsif any_of?(:manual)\n 'manual'\n elsif any_of?(:scheduled)\n 'scheduled'\n elsif any_of?(:preparing)\n 'preparing'\n elsif any_of?(:created)\n 'running'\n else\n 'failed'\n end\n end\n end", "title": "" }, { "docid": "451b9674a676c0c5e3c167def2f8d21f", "score": "0.6447971", "text": "def states\n [\n ['0', 'READY_TO_RUN', 'We are ready to run']\n ]\n end", "title": "" }, { "docid": "9fe4a1bfdfe29a82f1a3804beb0d3cfe", "score": "0.6434503", "text": "def status\n return \"paused\" unless active?\n return \"pending\" unless has_checked_in?\n return \"ok\" unless late?\n \"late\"\n end", "title": "" }, { "docid": "514a33c5dfd6244fed7218ecd6e6b385", "score": "0.642563", "text": "def status\n if waiting?\n :waiting\n elsif running?\n :running\n elsif done?\n :done\n end\n end", "title": "" }, { "docid": "e1efd05a1205ba3c16dd73ae6ea6e332", "score": "0.64244264", "text": "def status\r\n #initialize nil values to something meaningful\r\n @status||=:not_executed\r\n return @status\r\n end", "title": "" }, { "docid": "6fb0a53c29f6fb56402e8623768af6c5", "score": "0.6413895", "text": "def status\n state\n end", "title": "" }, { "docid": "0228e099c9168bf07baef1a6492e7fbe", "score": "0.64107555", "text": "def status\n return @status\n end", "title": "" }, { "docid": "544ca7b0a7aa971166f298947023869e", "score": "0.6409479", "text": "def status\n # Initialize a nil value to something meaningful\n @status ||= :not_executed\n @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" }, { "docid": "c47ada21e2cbec753ea40a5fcda5c8b5", "score": "0.6407376", "text": "def status\n return @status\n end", "title": "" } ]
c56e3ca93bb5109de9ec1c9273996bf9
ssws: slash or sorws
[ { "docid": "c1430fb4129dc060f8e3c14f68b63dc4", "score": "0.0", "text": "def mos_elt(i); alt(:elt, i, :slash, :sorws_mos); end", "title": "" } ]
[ { "docid": "c4f0d422c44d40760568229ca88db1bb", "score": "0.6548324", "text": "def slashes \n\t\tself.envelop('/' , '/')\n\tend", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "76550e3a68f44786d3ee616cd29fa45f", "score": "0.60521996", "text": "def escape_path(s); end", "title": "" }, { "docid": "6eb3e59b278295934a304aa236b38dcd", "score": "0.58888197", "text": "def slash!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n type = SLASH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 171:9: '/'\n match( 0x2f )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end", "title": "" }, { "docid": "03f04fbdcd370e3266fd62ec07fcb73a", "score": "0.5868112", "text": "def quotepath s\n\t\t\ts = s.strip\n\t\t\ts = \"\\\"#{s}\\\"\" if s =~ /^([\\/*.])|((http|https|ftp):)/\n\t\t\ts\n\t\tend", "title": "" }, { "docid": "a20df2fc6da61d29fad9410b1a52147c", "score": "0.55807436", "text": "def slash!(path)\n path.end_with?('/') ? path : \"#{path}/\"\n end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "26569b6c5c4dd54e23b70bc2fc729bde", "score": "0.5519269", "text": "def unescape_path(s); end", "title": "" }, { "docid": "c0822f15324e906cdb52362b7c728e90", "score": "0.5502842", "text": "def ws_start\n /(?<=(\\A)|(?:\\s))/\n end", "title": "" }, { "docid": "2e5bec0dffb41cbe1dc2abbd2dfa9d2a", "score": "0.5491401", "text": "def / s\n V[x/s, y/s]\n end", "title": "" }, { "docid": "854655c1182894bbbb660df726bb65d8", "score": "0.54909486", "text": "def mixed_path(string)\n string.tr('\\\\', '/')\n end", "title": "" }, { "docid": "8e62b15826004d01fc42f76fd63a7390", "score": "0.54843515", "text": "def dress_up_slashes\n MiniTerm.windows? ? self.gsub(\"/\", \"\\\\\") : self\n end", "title": "" }, { "docid": "366372a6b18854c844fa2228d6d91bd4", "score": "0.5475106", "text": "def smart_slash(input)\n if !(input =~ /\\.\\w+$/)\n input = File.join(input, '/')\n end\n input\n end", "title": "" }, { "docid": "b500b4e9777815bca815cfdf05d72f80", "score": "0.54507166", "text": "def slasherize(args)\n if args.first && args.first.is_a?(String)\n args[0] = (\"/\" << args.first) unless args.first =~ /^\\//\n end\n\n args\n end", "title": "" }, { "docid": "be5b9d739b5eb43ec4c6185dc1680d9c", "score": "0.5404712", "text": "def /(s)\n process(\"/\", s)\n end", "title": "" }, { "docid": "e7bfbd71fd58f7ff3a572a137c598e79", "score": "0.5393274", "text": "def Slashed(urlpart)\n return urlpart if Builtins.substring(urlpart, 0, 1) == \"/\"\n Ops.add(\"/\", urlpart)\n end", "title": "" }, { "docid": "503e64b0220181c287acb2f2a3f7affc", "score": "0.53913546", "text": "def simplified\n r = to_s.gsub(/^[^\\.]*:\\/\\//, '')\n r[-1] = '' if r.index('/') == r.size-1 #same as r.count('/') == 1\n r\n end", "title": "" }, { "docid": "84cfdabf7c40d2e50cd1798f52866700", "score": "0.53699684", "text": "def uri_to_sws(uri)\n uri = URI(uri)\n geonames_number = uri.path.split('/')[1]\n \"http://sws.geonames.org/#{geonames_number}/\"\n end", "title": "" }, { "docid": "bfe7a5fcd4ac3205ce42cc03c1db425a", "score": "0.5348448", "text": "def location_with_slashes\n l = \"#{location}\"\n\n if l.first != '/'\n l = \"/#{l}\"\n end\n\n if l.last != '/'\n l = \"#{l}/\"\n end\n\n l\n end", "title": "" }, { "docid": "254e93946e0d85cfe505c4ae89d49e2e", "score": "0.53360087", "text": "def append_slash(str)\n return str.gsub(/\\/+$/,'') + \"/\"\n end", "title": "" }, { "docid": "24400560a0cd7eef77f696059d68046d", "score": "0.53316253", "text": "def ws\n while (c = peek) && WS.member?(c.ord) do\n get\n if c == C\n while (c = get) && c != LF do; end\n end\n end\n end", "title": "" }, { "docid": "363daa18163d490b92e8131862651138", "score": "0.5326497", "text": "def before_slash\n value_before_character('\\\\\\\\|\\/')\n end", "title": "" }, { "docid": "2a4c7ee7740cf40df53b5d53328bbbd8", "score": "0.52876806", "text": "def remove_slash(s)\n s.nil? ? nil : s.chomp(\"/\")\n end", "title": "" }, { "docid": "10c97f6d7027ac1fde7f249f3dd0b4bb", "score": "0.5275403", "text": "def shellescape\n # This is a contraction of Shellwords.escape function\n gsub(/[^\\w\\-.,:+\\/@\\n]/,'\\\\\\\\\\\\&').gsub(/\\n/,\"'\\n'\")\n end", "title": "" }, { "docid": "5f8246a9ffb1fe8b034b629402391e66", "score": "0.5272666", "text": "def check_slash\n unless url && !self.url.empty? && self.url[0..0] == \"/\"\n self.url = \"/#{self.url}\"\n end\n end", "title": "" }, { "docid": "5bdb1a0982490ca8652d28e2668c3512", "score": "0.5262092", "text": "def santize_path(path)\n path.gsub(%r{^[/]+}, '')\n end", "title": "" }, { "docid": "a25c5c18cd45cca7a19cfe6decbfe447", "score": "0.52481663", "text": "def win_slashify(path)\n path.gsub(File::SEPARATOR, (File::ALT_SEPARATOR || '\\\\'))\n end", "title": "" }, { "docid": "34a098ea127960cbb35dfcf71a5707c8", "score": "0.52244496", "text": "def e_js_sh(str)\n (e_sh str).gsub(\"\\\\\", \"\\\\\\\\\\\\\\\\\")\nend", "title": "" }, { "docid": "8006ac89228aa076302663fbe2f85ba6", "score": "0.52235395", "text": "def strip_slashes(str)\n str.gsub(/\\/\\//, '/')\n end", "title": "" }, { "docid": "e3a3f234aa0f91b8fe7c0394d1e941b7", "score": "0.5221544", "text": "def end_point\n \"SFU\" \n end", "title": "" }, { "docid": "96e5b00b762d445f1bed071e5dfd59be", "score": "0.5204498", "text": "def s(uri)\n (URI.decode(uri) != uri) ? uri : URI.escape(uri)\n end", "title": "" }, { "docid": "bff558dc3245766660c50379211e53fd", "score": "0.5193917", "text": "def e(s)\n\t\t\ts.gsub(/'/,'')\n\t\tend", "title": "" }, { "docid": "20e61dc6fdb4aea1b1e26ae53e07ff97", "score": "0.51811576", "text": "def escape_slash?\n @escape_slash\n end", "title": "" }, { "docid": "dad558e0a969bb73fd15afd3cd7e6cbb", "score": "0.5176045", "text": "def escape_slashes(word)\n word.gsub(/([^\\\\])\\//) { |s| $1 + '\\\\/' }\n end", "title": "" }, { "docid": "45a7334b994c36125ad2baca9b1925c4", "score": "0.5157963", "text": "def fwdslash_substitution \n self.title = self.title.gsub(\"/\",\"-\").gsub(\"\\\\\",\"-\")\n end", "title": "" }, { "docid": "e984847a725699fb03b1801a94f5557b", "score": "0.51561606", "text": "def slashify!\n if '/' != self[-1,1]\n self << '/'\n else\n nil\n end\n self\n end", "title": "" }, { "docid": "401f4eb272a3d0d12aa90346cbe6784e", "score": "0.51435494", "text": "def dress_up_slashes(name)\r\n backslash? ? name.gsub(\"/\", \"\\\\\") : name\r\n end", "title": "" }, { "docid": "fa7ce61182dfeaab681aa40b78f557df", "score": "0.51367813", "text": "def e_sh_js(str)\n (e_sh str).gsub(\"\\\\\", \"\\\\\\\\\\\\\\\\\")\nend", "title": "" }, { "docid": "17363ee324e6f843853426381e956ca3", "score": "0.51334375", "text": "def simple_escape(s)\n s.gsub! /<|>/, ''\n s\n end", "title": "" }, { "docid": "04c2c56bc0ba1d7ef77c377b7422eaa3", "score": "0.5127608", "text": "def path_with_slashes(path)\n path = '/' + path unless path.start_with?('/')\n path << '/' unless path.end_with?('/')\n path\n end", "title": "" }, { "docid": "c4ef32b9e462131f0adeac8cf41d15d0", "score": "0.5125494", "text": "def remove_leading_slash(str)\n if str.start_with?('/')\n str[1..-1]\n else\n str\n end\n end", "title": "" }, { "docid": "a7e03d8b1e8849eae6e7599a26d29294", "score": "0.5124712", "text": "def ensure_leading_slash(path)\n path[0..0] == \"/\" ? path : \"/#{path}\"\n end", "title": "" }, { "docid": "ab35cd6950542752c8fa8bd1a34d6670", "score": "0.51146007", "text": "def literal\n to_sys('/')\n end", "title": "" }, { "docid": "d7983f9cc7e8e8fea4d0042beab5e308", "score": "0.5113144", "text": "def _ws\n _tmp = scan(/\\A(?-mix:[ \\t\\n]+)/)\n set_failed_rule :_ws unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "7766c025853d1e6e4c9a084cebf39e25", "score": "0.5111153", "text": "def backslashes\n\t\tself.envelop('\\\\' , '\\\\')\n\tend", "title": "" }, { "docid": "17d5a33fb86d689e306b1dcc4e464b5d", "score": "0.5108067", "text": "def reg_url2; /(.+)\\//; end", "title": "" }, { "docid": "99d83124a0da885debdd41a428e06a06", "score": "0.51047623", "text": "def _ws\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_nl)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_ws unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "23813776d31a086c39bca9853f3e17da", "score": "0.5104545", "text": "def unslashify!\n if '/' == self[-1,1]\n self.chomp! '/'\n else\n nil\n end\n self\n end", "title": "" }, { "docid": "77671dad72d8ca0a4372f03b5379a857", "score": "0.5102788", "text": "def _WSP\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = apply_with_args(:_d, 9)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_WSP unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "e13b0a938535fa091cd3dd53d2baeb16", "score": "0.5100966", "text": "def uriish? str\r\n (str.include? ':') && str =~ UriSniffRx\r\n end", "title": "" }, { "docid": "dfb3ffeb031e580b950cfe264cd29710", "score": "0.50993073", "text": "def win_string\n to_s.tr('/', '\\\\')\n end", "title": "" }, { "docid": "179a8bfffa915ca7311156219e69f8c3", "score": "0.5088593", "text": "def fmt_url(s)\n \"\\00302\\037#{s}\\017\"\n end", "title": "" }, { "docid": "da16dd65ea31f897fd535453d41236ec", "score": "0.5078971", "text": "def rstrip!; end", "title": "" }, { "docid": "519deb0e6a5511dae00a817fb3ebcde4", "score": "0.50784", "text": "def strip_slashes(str)\n str.gsub('/','')\n end", "title": "" }, { "docid": "0580f3a4e4ca6775ccf7199652669e52", "score": "0.50782526", "text": "def to_s\n string = ''\n\n string += 'ws'\n string += 's' if self.secure\n string += '://'\n string += self.host\n string += ':' + self.port.to_s if self.port\n string += self.resource_name || '/'\n\n return string\n end", "title": "" }, { "docid": "16017309c93467ce01cf422512fc0ce0", "score": "0.5074245", "text": "def handle_s_dn\n handle_s\n handle_possible(SeparatorSpace)\n handle_dn\n @special = @wday\n @unit = :wday\n end", "title": "" }, { "docid": "e785d3bd98a6f4de7757cd9e6211a650", "score": "0.5072651", "text": "def swagger_path(str)\n str = str.gsub(/:(\\w+)/, '{\\1}')\n str = str.gsub(/\\/$/, '')\n\n if str[0] != '/'\n warn_added_missing_slash(str)\n str = '/' + str\n end\n str\n end", "title": "" }, { "docid": "0b17384ab56f4358c8c74c066f670d8d", "score": "0.5071803", "text": "def slash(str)\n\t\t\treturn str.gsub(/'/) { \"\\\\'\" }\n\t\tend", "title": "" }, { "docid": "93be5aa101d25f42a5c367930db6c2f0", "score": "0.50613874", "text": "def sanitise_path(path)\n path.gsub(/\\/+/, \"/\")\nend", "title": "" }, { "docid": "9da9dc02653af31d7208e4873aabf4be", "score": "0.50593066", "text": "def test_slash_s_is_a_shortcut_for_a_whitespace_character_class\n assert_equal \" \\t\\n\", \"space: \\t\\n\"[/\\s+/]\n end", "title": "" }, { "docid": "3d887c29fffdd479305d1bc40db1cc17", "score": "0.5050663", "text": "def simple_escape(s)\n s = s.to_s\n s.gsub! /<|>/, ''\n s\n end", "title": "" }, { "docid": "3d887c29fffdd479305d1bc40db1cc17", "score": "0.5050663", "text": "def simple_escape(s)\n s = s.to_s\n s.gsub! /<|>/, ''\n s\n end", "title": "" }, { "docid": "54652f192818c7ce788d7fca8b2ba244", "score": "0.50444984", "text": "def handle_s_u\n handle_s\n handle_possible(SeparatorSpace)\n handle_u\n end", "title": "" }, { "docid": "47ada57efde8061c52ec5242efdfb408", "score": "0.5038608", "text": "def trailing_slash?\n last = @lex.last\n return false unless last\n return false unless last.type == :on_sp\n\n last.token == TRAILING_SLASH\n end", "title": "" }, { "docid": "b80a75d9ab75dc9854e1ed5439b4afc2", "score": "0.502962", "text": "def after_slash\n value_after_character('\\\\\\\\|\\/')\n end", "title": "" }, { "docid": "b09a4c30112219b6b90288b29945527f", "score": "0.50286335", "text": "def /\n end", "title": "" }, { "docid": "9a87ab5072f5ede1b7a54a30037c3e20", "score": "0.50280625", "text": "def windowize_path(path)\n return path.gsub(/\\//, \"\\\\\")\n end", "title": "" }, { "docid": "a58f5e357e589ee5d008d32a0184d583", "score": "0.5020086", "text": "def strip_leading_slash(val)\n val.sub(/^\\//, \"\")\n end", "title": "" }, { "docid": "e9f28999fac2987128b445dcbd26d8e6", "score": "0.5018147", "text": "def strip_slashes(str)\n str.gsub('/','')\n end", "title": "" }, { "docid": "e9f28999fac2987128b445dcbd26d8e6", "score": "0.5018147", "text": "def strip_slashes(str)\n str.gsub('/','')\n end", "title": "" }, { "docid": "047f136680be04fad9863f2c6c6ad2fb", "score": "0.50164163", "text": "def _match_symbol_regexp(s)\n \"([^\\\\/]+)\"\n end", "title": "" }, { "docid": "8d522fb058a87238dec177ca9e731854", "score": "0.5013196", "text": "def scheme\n \"ws\"\n end", "title": "" }, { "docid": "21a4336376db1b8613faccf9c0fd7055", "score": "0.5004305", "text": "def sanitize_line(line)\n line.gsub('\\/', SANITARY_STRING)\n end", "title": "" }, { "docid": "f75c17ed499b2490c155b56e58914056", "score": "0.4998101", "text": "def pathify(s)\n s = s.gsub(/^\\//, \"\")\n s = s.gsub(\"..\", \",\")\n s = s.gsub(/[?\\/&]/, \",\")\n s = s.gsub(/[^A-Za-z0-9_.,=-]/) do |i|\n hex = i.unpack(\"H2\").first\n \"%#{hex}\"\n end\n s = \"_root_\" if s.empty?\n s = s.downcase\n s\n end", "title": "" }, { "docid": "4b7f6e248a22e5a2aaadd761e56a3f32", "score": "0.49796537", "text": "def windows_path\n windows? ? normalized_path.tr(\"\\\\\", \"/\") : normalized_path\nend", "title": "" }, { "docid": "3605a971ebea03af2f06ae32a11d9bfd", "score": "0.4979241", "text": "def sh_escape(str)\n if str !~ /^[a-z0-9\\/.:_-]*$/i && str !~ /\"/\n \"\\\"#{str}\\\"\"\n else\n str\n end\n end", "title": "" }, { "docid": "e0a3c03d613b0f8981a9c5867154344b", "score": "0.49741593", "text": "def append_slash(url)\n if url.end_with?(\"/\")\n url\n else\n \"#{url}/\"\n end\n end", "title": "" }, { "docid": "e0a3c03d613b0f8981a9c5867154344b", "score": "0.49741593", "text": "def append_slash(url)\n if url.end_with?(\"/\")\n url\n else\n \"#{url}/\"\n end\n end", "title": "" }, { "docid": "36f03018ebca45967a98b1e98c3e8e39", "score": "0.49637586", "text": "def test_allow_colons_in_path_component\n assert_sanitized(\"<a href=\\\"./this:that\\\">foo</a>\")\n end", "title": "" }, { "docid": "1083ddba517428871b5eaf1a50eecbb5", "score": "0.49629915", "text": "def hygienic?; @hygienic; end", "title": "" }, { "docid": "86757fe4520c39eaa20979afdf22c598", "score": "0.49576458", "text": "def add_slash(path)\n path + if path[-1..-1] == \"/\" then \"\" else \"/\" end\n end", "title": "" }, { "docid": "9357d6b4c5ad7b136a3caa0e691b51bb", "score": "0.49564126", "text": "def escape_path(path); end", "title": "" }, { "docid": "afb9637337ed624e2626f8d1d589ab42", "score": "0.495354", "text": "def correct_path(str)\nend", "title": "" }, { "docid": "e768ee4c3ad2ffa5f53d39df72d36599", "score": "0.4949126", "text": "def worksheet_safe_name(str)\r\n str = str.gsub(/\\//, 'and')\r\n str.delete!(\"\\/?*[]\")\r\n str\r\n end", "title": "" }, { "docid": "591fecb52e87bd23904729ef27e87220", "score": "0.49453962", "text": "def /(p); p[0]==?/?@root+p:p end", "title": "" }, { "docid": "8f23b44021d6f3fb0e8c30ad5c326f77", "score": "0.49389416", "text": "def weak?\n @raw.start_with?(\"W/\")\n end", "title": "" }, { "docid": "bbe30a410e61c020a64fee34792f8033", "score": "0.49388894", "text": "def s(str)\n str(str) >> space? \n end", "title": "" }, { "docid": "5cab05ae2754875c652ab32715aea2a8", "score": "0.49377874", "text": "def scp_clean(str)\n str = str.to_s.gsub(/([\\W\\/])/) { |s| \"\\\\#{ s }\"}\n return str\n end", "title": "" }, { "docid": "97fa1669766d095df9be1f05e35222ed", "score": "0.49280864", "text": "def fix_windows_path(cur_spring_conf)\n if cur_spring_conf.match(/^(C|c|b|d|e):\\//)\n return \"/#{cur_spring_conf}\"\n end \n return cur_spring_conf\nend", "title": "" }, { "docid": "87c89c3e39b840f25fb6b5c0361a0fb1", "score": "0.49233112", "text": "def e_snp(str)\n\tstr.to_s.gsub(/(?=[$`\\\\}])/, '\\\\')\nend", "title": "" }, { "docid": "550615ad487959f18f4086d10b23a023", "score": "0.49226937", "text": "def rstrip!\n end", "title": "" }, { "docid": "219082d8481c36d24e65fef11a93bfb2", "score": "0.49207497", "text": "def test_wiki_1_simple_with_ending_slash\n parameters={ \n 'n'=>'v'\n }\n sbs='GET&http%3A%2F%2Fexample.com%2F&n%3Dv'\n \n assert_signature_base_string sbs,parameters,'GET',\"http://example.com/\"\n end", "title": "" }, { "docid": "406bbff136debd1a78ee3b4086ce95f2", "score": "0.49203542", "text": "def win_friendly_path(path)\n if path\n new_path = path.gsub('/', '\\\\')\n new_path = \"c:#{new_path}\" if new_path =~ /^\\\\/\n end\n new_path\n end", "title": "" } ]
58ace47a4164740afd4728e12cdb9aeb
Upload a zip file or designate a zip file on the server to import samples into RATE's database. In the zip file, every dir stands for a class, every images in that dir is a sample of that class. === Parameters [has_file String] true: the client is going to upload the zip file. false: The zip file is on the server, then zip_path must be provided. [zip_path String] the path on the server for the zip file. This API may only be used by who has access to RATE's server [import_tag String] the import tag for all the classes and samples imported
[ { "docid": "fbf995c74b923063634b67b9afa37fd5", "score": "0.4643795", "text": "def import(options = {})\n need_arg! options, :import_tag\n if not options[:has_file]\n need_arg! options, :zip_path\n else\n need_arg! options, :path\n file_exist! options[:path]\n end\n\n cmd = [\"import\", \"import_tag:#{options[:import_tag]}\"]\n if options[:has_file]\n cmd << \"has_file:true\"\n @socket.puts cmd.join(' ')\n puts cmd.join(' ')\n send_file options[:path]\n else\n cmd << \"zip_path:#{options[:zip_path]}\"\n @socket.puts cmd.join(' ')\n end\n\n receive\n end", "title": "" } ]
[ { "docid": "96104a436966bd2cd68fc9ec5ddb2aab", "score": "0.5728953", "text": "def uploaded_file\n unless self.batch == true\n if self.file != \"\"\n self.file_name_all = sanitize_fn(file.original_filename)\n self.file_name_base = file_name_all.split('.')[0]\n self.extension = file_name_all.split('.')[1]\n self.content_type = file.content_type.strip\n zip_url = \"#{Z_URL}/zips/#{file_name_all}\"\n write_attribute(\"zip_url\", zip_url)\n write_attribute(\"z_name\", file_name_base)\n end\n end\n end", "title": "" }, { "docid": "e65940822513cb507b773ba24af8c788", "score": "0.55313754", "text": "def assure_created_zip\n FileCreator::createNewZip(self)\n raise \"No file created\" unless File.exists? zip_path\n end", "title": "" }, { "docid": "460885c30e42ac010f1e04e97886c87f", "score": "0.5451796", "text": "def zipfile; end", "title": "" }, { "docid": "d20b920cd3090b97a8019c6261cdbed1", "score": "0.5373467", "text": "def save_analysis_zip(filename)\n def add_directory_to_zip(zipfile, local_directory, relative_zip_directory)\n # puts \"Add Directory #{local_directory}\"\n Dir[File.join(local_directory.to_s, '**', '**')].each do |file|\n # puts \"Adding File #{file}\"\n zipfile.add(file.sub(local_directory, relative_zip_directory), file)\n end\n zipfile\n end\n\n FileUtils.rm_f(filename) if File.exist?(filename)\n\n Zip::File.open(filename, Zip::File::CREATE) do |zf|\n ## Weather files\n # TODO: eventually remove the @weather_file attribute and grab the weather file out\n # of the @weather_files\n puts 'Adding Support Files: Weather'\n if @weather_file[:file] && !@weather_files.files.find { |f| @weather_file[:file] == f[:file] }\n # manually add the weather file\n puts \" Adding #{@weather_file[:file]}\"\n zf.add(\"./weather/#{File.basename(@weather_file[:file])}\", @weather_file[:file])\n end\n @weather_files.each do |f|\n puts \" Adding #{f[:file]}\"\n zf.add(\"./weather/#{File.basename(f[:file])}\", f[:file])\n end\n\n ## Seed files\n puts 'Adding Support Files: Seed Models'\n if @seed_model[:file] && !@seed_models.files.find { |f| @seed_model[:file] == f[:file] }\n # manually add the weather file\n puts \" Adding #{@seed_model[:file]}\"\n zf.add(\"./seed/#{File.basename(@seed_model[:file])}\", @seed_model[:file])\n end\n @seed_models.each do |f|\n puts \" Adding #{f[:file]}\"\n zf.add(\"./seed/#{File.basename(f[:file])}\", f[:file])\n end\n\n puts 'Adding Support Files: Libraries'\n @libraries.each do |lib|\n raise \"Libraries must specify their 'library_name' as metadata which becomes the directory upon zip\" unless lib[:metadata][:library_name]\n\n if File.directory? lib[:file]\n Dir[File.join(lib[:file], '**', '**')].each do |file|\n puts \" Adding #{file}\"\n zf.add(file.sub(lib[:file], \"./lib/#{lib[:metadata][:library_name]}/\"), file)\n end\n else\n # just add the file to the zip\n puts \" Adding #{lib[:file]}\"\n zf.add(lib[:file], \"./lib/#{File.basename(lib[:file])}\", lib[:file])\n end\n end\n\n puts 'Adding Support Files: Worker Initialization Scripts'\n @worker_inits.each_with_index do |f, index|\n ordered_file_name = \"#{index.to_s.rjust(2, '0')}_#{File.basename(f[:file])}\"\n puts \" Adding #{f[:file]} as #{ordered_file_name}\"\n zf.add(f[:file].sub(f[:file], \"./scripts/worker_initialization//#{ordered_file_name}\"), f[:file])\n\n if f[:metadata][:args]\n arg_file = \"#{File.basename(ordered_file_name, '.*')}.args\"\n file = Tempfile.new('arg')\n file.write(f[:metadata][:args])\n zf.add(\"./scripts/worker_initialization/#{arg_file}\", file)\n file.close\n end\n end\n\n puts 'Adding Support Files: Worker Finalization Scripts'\n @worker_finalizes.each_with_index do |f, index|\n ordered_file_name = \"#{index.to_s.rjust(2, '0')}_#{File.basename(f[:file])}\"\n puts \" Adding #{f[:file]} as #{ordered_file_name}\"\n zf.add(f[:file].sub(f[:file], \"scripts/worker_finalization/#{ordered_file_name}\"), f[:file])\n\n if f[:metadata][:args]\n arg_file = \"#{File.basename(ordered_file_name, '.*')}.args\"\n file = Tempfile.new('arg')\n file.write(f[:metadata][:args])\n zf.add(\"scripts/worker_finalization/#{arg_file}\", file)\n file.close\n end\n end\n \n ## Measures\n puts 'Adding Measures'\n added_measures = []\n # The list of the measures should always be there, but make sure they are uniq\n @workflow.each do |measure|\n measure_dir_to_add = measure.measure_definition_directory_local\n\n next if added_measures.include? measure_dir_to_add\n\n puts \" Adding #{File.basename(measure_dir_to_add)}\"\n Dir[File.join(measure_dir_to_add, '**')].each do |file|\n if File.directory?(file)\n if File.basename(file) == 'resources' || File.basename(file) == 'lib'\n add_directory_to_zip(zf, file, \"#{measure.measure_definition_directory}/#{File.basename(file)}\")\n end\n else\n # puts \"Adding File #{file}\"\n zf.add(file.sub(measure_dir_to_add, \"#{measure.measure_definition_directory}/\"), file)\n end\n end\n\n added_measures << measure_dir_to_add\n end\n end\n end", "title": "" }, { "docid": "e3f214f71abda8460e264bf80448ad27", "score": "0.53732747", "text": "def add_zip(file_name)\n timestamp = Time.now.to_i\n directory_name = %(#{DIRECTORY_NAME}_#{timestamp})\n Dir.mkdir(directory_name)\n \n Zip::File.open(file_name.path) do |zip_file|\n zip_file.each do |entry| \n if valid_csv?(entry) \n entry_file_name = entry.name.split('/').last\n file_path = File.join(\"#{RAILS_ROOT}\", directory_name, entry_file_name) \n File.open(file_path, 'w') {|f| f.write(entry.get_input_stream.read) }\n add_import_job(entry_file_name, directory_name, Time.at(timestamp))\n end\n end\n import_data unless Import.find_by_status(Import::STATUS[:in_progress])\n end\n end", "title": "" }, { "docid": "c3eaea1e7f63fc810204e20eb5095577", "score": "0.5320839", "text": "def process_zip(upload_params)\n path = \"#{TMP_FOLDER}/#{upload_params[:source]}\"\n destination = \"#{TMP_FOLDER}/fixtures\"\n\n unzip_file(path, destination)\n parsed_results = process_files_inside_zip(\"#{destination}/#{upload_params[:source]}\")\n persist_result(DataAnalizer.new.join_data(parsed_results)&.reject(&:nil?), upload_params)\n end", "title": "" }, { "docid": "fcf532b11d40efc407ef94f7873efc97", "score": "0.5310696", "text": "def test_zip\n @io.setup_zip\n CheckWriteAndRead(@io, 'test_id', 'test content for zip')\n CheckWriteAndRead(@io, 'test_id', 'test content for zip a second time')\n end", "title": "" }, { "docid": "8a90c124d4501cac00814f4a89fcf3de", "score": "0.522376", "text": "def importZIP(path)\r\n\tdest_folder = File.join(Dir.pwd, 'public/ws')\r\n\tZip::File.open(path) do |zipfile|\r\n\t zipfile.each do |entry|\r\n\t \tcur_file = File.join(dest_folder, entry.name)\r\n\t unless File.exist?(cur_file)\t\r\n\t FileUtils::mkdir_p(File.dirname('public/ws/'+entry.name)) # Create website dir\r\n\t zipfile.extract(entry, cur_file)\t# Extract files into dir\r\n\t end\r\n\t end\r\n\tend\r\n\treturn true\r\nend", "title": "" }, { "docid": "7927c5e3ef66666fe36fd8538748522e", "score": "0.5209613", "text": "def upload_zip(filename)\n contents = Github::Client::Repos::Contents.new oauth_token: ENV['GITHUB_TOKEN']\n\n File.open(\"generated/#{filename}\", 'r') do |f|\n contents.create 'IMLS',\n 'state-program-report-data',\n \"reports/#{filename}\",\n path: \"reports/#{filename}\",\n message: \"Automated upload of #{filename}\",\n content: f.read\n end\nend", "title": "" }, { "docid": "4278c69f30bfa666697813058d121887", "score": "0.52087736", "text": "def initialize(zip_path, create = true)\n super()\n\n @zip_path = zip_path\n @zip_file = Zip::File.open(@zip_path, create)\n end", "title": "" }, { "docid": "10b471b711076c71a077003b2a77eaaa", "score": "0.5195898", "text": "def validate_zip_file_import zip_file\n error(\n \"The zip file `#{zip_file.to_s}' doesn't exist or is a directory.\"\n ) unless (is_file? zip_file)\n end", "title": "" }, { "docid": "ad32635e377257f6934ffbfae817426a", "score": "0.51784074", "text": "def create_zip(zipfile_name)\n current_path = Dir.pwd\n \n file_path = \"#{current_path}/assets/images/zip\"\n\n @images = Image.all\n \n if @images.count > 0 \n Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile|\n @images.each do |filename|\n zipfile.add(filename.name, \"#{filename.path.to_s}\")\n end\n \n end\n #delete_files_logs(file_path, file_list) \n \n end \nend", "title": "" }, { "docid": "e454050aacf7f66d26d9d53201654545", "score": "0.51696235", "text": "def zip_user_picture_phenotypes(zipfile)\n logger.info('Zipping user picture phenotypes')\n ZipUserPicturePhenotypes.new(zipfile, tmp_dir, time_str).call\n end", "title": "" }, { "docid": "5583c607bf1559b55ae32e1f910d025c", "score": "0.51223034", "text": "def upload_file(file_name, file_path, callback_method='parse')\n status = {}\n upload_config\n @file_name = file_name\n @file_path = file_path \n @original_zip_file = \"#{@file_path}/#{@file_name}\"\n @csv_file_name = @file_name.gsub(/\\.zip/,'')\n\n begin\n if @zipped\n delete_csv_if_present\n unzip_file\n end\n \n status = self.send(callback_method)\n rescue Exception => e\n error_in_upload([[invalid_file_message]]) if @error_file_needed\n Rails.logger.error e.formatted_exception(\"Uploading file #{@file_name} failed!\")\n status = { errors: 1, status: 500}\n ensure\n File.delete @original_zip_file if File.exists?(@original_zip_file)\n end\n status\n end", "title": "" }, { "docid": "cff04804455c5a8b7a7ffafcfdf54e9b", "score": "0.51131654", "text": "def zipped!\n return if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system 'tar', '-cf', zip_path, '-C', File.expand_path('..',path), File.basename(path)\n end", "title": "" }, { "docid": "9f51a3f49503174e181afbfd80e2afd6", "score": "0.50779366", "text": "def assure_zip_path\n assure_created_zip\n zip_path\n end", "title": "" }, { "docid": "6c394f24d4afcb0f4bb833002ed41741", "score": "0.5077581", "text": "def from_zip(zip)\n self.class.from_zip(zip)\n end", "title": "" }, { "docid": "243d64da973df4fa4dd0c0dd96303c87", "score": "0.5058582", "text": "def zipfile\n @zipfile ||= Zip::File.open( @file_path )\n end", "title": "" }, { "docid": "772bae857d882fc816c1a35ec89a8249", "score": "0.5040536", "text": "def upload(io_zip)\n opts = {}\n opts[:region] = @bucket_region if @bucket_region\n s3_client(opts).put_object(\n acl: 'private',\n bucket: @target_bucket,\n key: @target_name,\n body: io_zip\n )\n end", "title": "" }, { "docid": "2f627a1b84633ed309daba440df88617", "score": "0.50134504", "text": "def create\n @appzip = Appzip.new(appzip_params)\n upload = appzip_params[:zipfile]\n \n @appzip[:zipfile] = Base64.encode64(File.read(upload.path))\n @appzip[:filesize] = upload.size\n @appzip[:user_id] = current_user.id\n @appzip[:icon] = \"data:\" + appzip_params[:icon].content_type + \";base64,\" + \n Base64.encode64(File.read(appzip_params[:icon].path))\n respond_to do |format|\n if @appzip.save\n format.html { redirect_to @appzip, notice: 'Appzip was successfully created.' }\n format.json { render :show, status: :created, location: @appzip }\n else\n format.html { render :new }\n format.json { render json: @appzip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a417bfe576bd8dc2175ad64a6db86d93", "score": "0.49961293", "text": "def add_to_zip(zip_stream)\n xml_string = write_xml\n return false if xml_string.empty?\n zip_stream.put_next_entry(RubyXL::from_root(self.xlsx_path))\n zip_stream.write(xml_string)\n true\n end", "title": "" }, { "docid": "e60f461beb76a1954c180ccb1ea07df9", "score": "0.49944383", "text": "def zip\n @zip_file = \"#{RAILS_ROOT}/downloads/#{current_user.login}_briefcase_#{(Time.now).to_i}.zip\"\n\n if create_zip(@zip_file)\n send_file @zip_file\n else\n render :text=>'error creating zip of briefcase'\n end\n end", "title": "" }, { "docid": "1d249beaa19a5b8de073bb7c83910bbe", "score": "0.49861223", "text": "def zip_add_file(zip, filename, content)\r\n print_status(\"Adding '#{filename}' (#{content.length} bytes)\");\r\n zip.add_file(filename, content, nil, nil, nil)\r\n end", "title": "" }, { "docid": "ee604e1fe8c4979f1702aa4edb8f6364", "score": "0.4983469", "text": "def create_zip(zip_file, file)\r\n begin\r\n Zip::ZipFile.open(zip_file, Zip::ZipFile::CREATE) do |zipfile|\r\n zipfile.add(File.basename(file), file)\r\n puts \"\\t\\s => \" + \"#{File.basename(file)} [OK]\".green\r\n end\r\n rescue Zip::ZipEntryExistsError => e\r\n #puts \"file #{file} exists\"\r\n end\r\nend", "title": "" }, { "docid": "71964f33794b1119895a658c98d101a2", "score": "0.49820212", "text": "def automated_test_config_to_zip(zip_file, zip_dir, specs_file_path)\n self.add_test_files_to_zip(zip_file, zip_dir)\n test_specs = autotest_settings_for(self)\n test_specs['testers']&.each do |tester_info|\n tester_info['test_data']&.each do |test_info|\n test_info['extra_info']&.delete('test_group_id')\n end\n end\n zip_file.get_output_stream(specs_file_path) do |f|\n f.write(test_specs.to_json)\n end\n end", "title": "" }, { "docid": "1d9d4d1315ac31262e943a48db7f9832", "score": "0.4929822", "text": "def create\n @zipload = Zipload.new(params[:zipload])\n\n respond_to do |format|\n @zipload.user_id = current_user.id \n if @zipload.save\n \n # zipのtmpファイルを作成\n File.open(\"public/ziptmp/#{@zipload.id}.zip\",'w+b'){|file|\n file.binmode\n file.write @zipload.file\n }\n \n # zip展開、zipファイルの削除\n unzip(\"public/ziptmp/#{@zipload.id}.zip\",\"public/ziptmp/#{@zipload.id}\")\n FileUtils.rm_r(\"public/ziptmp/#{@zipload.id}.zip\")\n \n # アルバム作成\n @album = Album.new\n @album.title = @zipload.file_name.sub(/\\.zip/,'')\n @album.user_id = current_user.id\n @album.save\n \n # 展開したファイルをデータベースに登録\n\t\tDir::glob(\"public/ziptmp/#{@zipload.id}/**/*.*\").each {|f|\n\t\t if File::ftype(f) == \"file\"\n\t\t $readfile = File.open(f, 'r+b')\n\t\t @photo = Photo.new\n\t\t @photo.file = $readfile.read\n\t\t if MimeMagic.by_magic($readfile) == \"image/jpeg\"\n\t\t\t\t@photo.content_type =MimeMagic.by_magic($readfile)\n\t\t \t @photo.file_name = File::basename(f,'')\n\t\t \t@photo.title = @photo.file_name.gsub(/\\.(.+)/, \"\")\n\t\t\t \n\t\t\t img_tmp = Pikl::Image.open(f)\n\t img_tmp.fit(150, 150).save(\"public/ziptmp/#{@zipload.id}/tmp.jpg\")\n\t img_tmp = File.open(\"public/ziptmp/#{@zipload.id}/tmp.jpg\", 'r+b')\n\t\t @photo.short_file = img_tmp.read\n\t\t\t img_tmp.close\n\t\t\t\t\n\t\t\t @photo.user_id = current_user.id\n\t\t\t @photo.album_id = @album.id\n\t\t\t @photo.tag = \"\"\n\t\t\t @photo.save\n\t\t\telsif MimeMagic.by_magic($readfile) == \"image/png\"\n\t\t\t\t@photo.content_type =MimeMagic.by_magic($readfile)\n\t\t \t @photo.file_name = File::basename(f,'')\n\t\t \t@photo.title = @photo.file_name.gsub(/\\.(.+)/, \"\")\n\t\t\t \n\t\t\t image_tag photo.public_filename, :height => image_size[:height], :width => image_size[:width]\n\t\t\t \n\t\t\t img_tmp = Pikl::Image.open(f)\n\t img_tmp.fit(150, 150).save(\"public/ziptmp/#{@zipload.id}/tmp.png\")\n\t img_tmp = File.open(\"public/ziptmp/#{@zipload.id}/tmp.png\", 'r+b')\n\t\t @photo.short_file = img_tmp.read\n\t\t\t img_tmp.close\n\t\t\t\t\n\t\t\t @photo.user_id = current_user.id\n\t\t\t @photo.album_id = @album.id\n\t\t\t @photo.tag = \"\"\n\t\t\t @photo.save\n\t\t\tend\n\t\t\t$readfile.close\n\t\t end\n\t\t}\n\n\t\t\n\t\t# 作成した一時ファイルとデータベース削除\n\t\tFileUtils.rm_r(\"public/ziptmp/#{@zipload.id}\")\n \t@zipload.destroy\n\t\t\n\t\t\n\t format.html { redirect_to(photos_url) }\n\t format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @zipload.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "212bd8f1530bba3cdedf89ef1b8e48fe", "score": "0.49279752", "text": "def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end", "title": "" }, { "docid": "bd0a3f42bd9da1562a03dfd0a1dd21be", "score": "0.4919386", "text": "def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end", "title": "" }, { "docid": "bd0a3f42bd9da1562a03dfd0a1dd21be", "score": "0.4919386", "text": "def zip_path\n \"/tmp/play-zips/#{zip_name}\"\n end", "title": "" }, { "docid": "9716cc86d9818fb5d026818aefbde8bd", "score": "0.4906353", "text": "def zip_params\n params.require(:zip).permit(:zip)\n end", "title": "" }, { "docid": "e060ac2dfcecb8edf77499a52e08b8cf", "score": "0.49062565", "text": "def zip_user_phenotypes(zipfile)\n logger.info('Zipping user phenotypes')\n zipfile.get_output_stream(\"phenotypes_#{time_str}.csv\") do |f|\n GenerateUserPhenotypeCsv.new.call.each do |row|\n f.write(row)\n end\n end\n end", "title": "" }, { "docid": "ad1755d7e3cfd252106d9fae8a6a4d42", "score": "0.49016392", "text": "def create_zip(filepath: nil, callback: nil)\n if filepath.nil?\n # See http://thinkingeek.com/2013/11/15/create-temporary-zip-file-send-response-rails/\n # for explanation of the way we are using Zip library that looks weird.\n\n FileUtils.mkdir_p working_dir\n tmp_file = Tempfile.new(\"zip-#{work_id}\", working_dir).tap { |t| t.binmode }\n Zip::OutputStream.open(tmp_file) { |z| }\n filepath = tmp_file.path\n end\n\n tmp_comment_file = Tempfile.new(\"zip-#{work_id}-comment\", working_dir)\n tmp_comment_file.write(comment_text)\n tmp_comment_file.rewind\n\n count = members_to_include.size\n\n Zip::File.open(filepath, Zip::File::CREATE) do |zipfile|\n zipfile.comment = comment_text\n\n zipfile.add(\"about.txt\", tmp_comment_file)\n\n members_to_include.each_with_index do |member, index|\n filename = \"#{format '%03d', index+1}-#{work_id}-#{member.id}.jpg\"\n img_data = open(url_or_path_for_member(member), \"rb\")\n\n # We want to add to zip as \"STORED\", not \"DEFLATE\", since our JPGs\n # won't compress under DEFLATE anyway, save the CPU. Ruby zip does not\n # give us a GREAT api to do that, but it gives us a way.\n #\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/file.rb#L271\n # https://github.com/rubyzip/rubyzip/blob/05af1231f49f2637b577accea2b6b732b7204bbb/lib/zip/entry.rb#L53\n entry = ::Zip::Entry.new(zipfile.name, filename, nil, nil, nil, nil, ::Zip::Entry::STORED)\n zipfile.add(entry, img_data)\n\n # We don't really need to update on every page, the front-end is only polling every two seconds anyway\n if callback && (index % 3 == 0 || index == count - 1)\n callback.call(progress_total: count, progress_i: index + 1)\n end\n end\n end\n\n return tmp_file\n ensure\n tmp_comment_file.close\n tmp_comment_file.unlink\n end", "title": "" }, { "docid": "f165dba5ab7fae32814bdde1d7ac1757", "score": "0.48946258", "text": "def upload_source_bundle\n exclude_filenames = ['.gitignore', '.idea', 'docker-compose.yml', 'Gemfile', 'Gemfile.lock', 'classes/zipper.rb', 'classes/aws_deployer.rb', 'deploy.rb', '.DS_Store', '*.zip', 'credentials.json', 'credentials.json.template']\n @zipfile_name = \"#{@sha_hash}.zip\"\n \n zf = ZipFileGenerator.new(@folder, File.join(@folder, @zipfile_name), exclude_filenames)\n zf.write\n\n File.open(File.join(@folder, @zipfile_name), 'rb') do |file|\n @s3.put_object(bucket: @eb_bucket_name, key: @zipfile_name, body: file)\n end\n\n # Check to make sure the bundle is in S3\n begin\n @s3.get_object_acl(bucket: @eb_bucket_name, key: @zipfile_name)\n File.delete(File.join(@folder, @zipfile_name))\n return true\n rescue Aws::S3::Errors::NoSuchKey\n return false\n end\n end", "title": "" }, { "docid": "9ad2238801611a4443bae492c83a0145", "score": "0.48785064", "text": "def zip_file\n @zip_file ||= base_dir && File.expand_path(File.join(base_dir, \"..\", file_name))\n end", "title": "" }, { "docid": "7f0d6af75a6d274724121ba00682e8d0", "score": "0.48702225", "text": "def encode_from_zip\n \n Rails::logger.debug 'Encoding from zip'\n \n full_zip_path = full_filepath \n frames_dir = full_filepath + '_frames' \n FileUtils.mkdir frames_dir \n extract_frames frames_dir \n self.fps = calculate_fps(frames_count(frames_dir), capture_duration) \n self.content_type = 'video/quicktime'\n ext = 'mov' \n self.path = encode_do(frames_dir, ext) \n save_first_frame_as_thumbnail frames_dir \n # remove the zip & frame images (whole dir)\n File.unlink full_zip_path\n FileUtils.rm_rf frames_dir \n end", "title": "" }, { "docid": "7cdde6f4cd99dca99acf65c37a6975c7", "score": "0.4845799", "text": "def containing_zip zip\n\t\t\tok, body = get('/containing/zip', zip: zip)\n\t\t\tok && body\n\t\tend", "title": "" }, { "docid": "dcad3839a5579004d1f2848652ad0f93", "score": "0.48270035", "text": "def update_records_with_zip\n zip_file = Zip::File.open(params[:file])\n zip_file.sort.each do |entry|\n if entry.file? && File.extname(entry.name) == '.csv'\n csv_text = entry.get_input_stream.read\n @csv = CSV.parse(csv_text)\n @filename = entry.name\n update_records\n end # csv file check condition\n end\n end", "title": "" }, { "docid": "bde3c9ecd8212adbeb87d0b9468e2756", "score": "0.48220074", "text": "def upload\n ENV['AWS_REGION'] = 'us-east-2'\n\n s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION'])\n obj = s3.bucket('ruby-upload-script').object($zipfile_name)\n\n obj.upload_file($zipfile_name)\nend", "title": "" }, { "docid": "a06320989785389f65f27d724d82e870", "score": "0.48099023", "text": "def add(path, overrides = {})\n return unless File.exist?(path)\n #\n defaults = {delete_after: false, zipped_name: File.basename(path)}\n overrides = defaults.merge(overrides)\n # Add the source to the zip archive.\n zipped_name = overrides[:zipped_name]\n delete_after = overrides[:delete_after]\n @zip_file.add(zipped_name, path) { true }\n zip_commit\n # Delete the source if the delete_after flag is true.\n FileUtils.rm_rf(path) if delete_after\n end", "title": "" }, { "docid": "b6f4a649631513e3731e8ffd7bab3013", "score": "0.4808432", "text": "def archive_scenario_inputs(zip, scenario, info)\n if not(info.inputs.empty?)\n # make scenario input directory\n mkdir_with_time(zip, File.join(scenario, \"input\"), (@location + scenario + \"input\").mtime)\n\n # archive input data\n info.inputs.each do |input|\n input_location = @location + scenario + input\n add_file_with_time(zip, File.join(scenario, input), input_location)\n end\n end\n end", "title": "" }, { "docid": "d792f01ae4abfae689e04cb8c93d4ecb", "score": "0.47976643", "text": "def initialize(zip_file, files = nil)\n @zip_file = zip_file\n @filelist = []\n\n add(files) if files\n end", "title": "" }, { "docid": "d95a929a1d5ede81485b0c2359a7a476", "score": "0.47745928", "text": "def download_sample_starter_files\n assignment = record\n\n zip_name = \"#{assignment.short_identifier}-sample-starter-files.zip\"\n zip_path = File.join('tmp', zip_name)\n\n FileUtils.rm_f(zip_path)\n\n Zip::File.open(zip_path, create: true) do |zip_file|\n assignment.sample_starter_file_entries.each { |entry| entry.add_files_to_zip_file(zip_file) }\n end\n send_file zip_path, filename: zip_name\n end", "title": "" }, { "docid": "1eed24e050c553573a975c144a37c90c", "score": "0.47607216", "text": "def remove_zip\r\n File.delete \"#{@file}.zip\" if File.exists? \"#{@file}.zip\"\r\n end", "title": "" }, { "docid": "df0bac3dad843df0282d0cd47f3e1bf4", "score": "0.4746126", "text": "def add_files_to_zip(zipfile, files)\n files.each do |file|\n zipfile.add(file.sub(File.dirname(file) + '/', ''), file)\n end\n end", "title": "" }, { "docid": "6e7bb4188f78dbaadd72bfed1cb01d07", "score": "0.47412178", "text": "def export\n if !File.directory?(\"#{Rails.root}/tmp/zips/\") \n Dir.mkdir(Rails.root.join('tmp/zips'))\n end\n\n archive_file = \"#{Rails.root}/tmp/zips/#{self.id}-#{self.title.delete(' ')}.zip\"\n \n Zip::OutputStream.open(archive_file) do |zipfile|\n # add project description\n zipfile.put_next_entry(\"project_description.txt\")\n zipfile.print(self.description)\n\n step_num = 0\n step_increment = false\n\n self.steps.not_labels.order(\"published_on\").each do |step|\n logger.debug(\"on step #{step.name} with step_num #{step_num}\")\n if step.description.present?\n # add step description\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/description.txt\")\n step_increment = true\n zipfile.print(HTMLEntities.new.decode ActionView::Base.full_sanitizer.sanitize(step.description))\n end\n\n # add media\n step.images.each do |image|\n if image.is_remix_image?\n image = Image.find(image.original_id)\n end\n\n if !image.has_video?\n # add images\n if image.image_path.present?\n # add uploaded image\n img_path = image.image_path_url\n step_increment = true\n elsif image.s3_filepath.present?\n # add direct upload image\n img_path = image.s3_filepath\n step_increment = true\n else\n img_path = nil\n end\n\n if img_path != nil\n filename = File.basename(URI.parse(img_path).path)\n logger.debug(\"image filename: #{filename}\")\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n zipfile.print(URI.parse(img_path).read)\n end\n \n elsif !image.video.embedded?\n # add no embedded video\n filename = File.basename(URI.parse(image.video.video_path_url).path)\n logger.debug(\"video filename: #{filename}\")\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n begin\n zipfile.print(URI.parse(image.video.video_path_url).read)\n step_increment = true\n rescue OpenURI::HTTPError\n # don't export videos with these errors\n end\n end\n end # end step.images.each do |image|\n\n step.design_files.each do |design_file|\n filename = File.basename(URI.parse(design_file.design_file_path_url).path)\n zipfile.put_next_entry(step_num.to_s + \" - \" + step.name + \"/\" + filename)\n zipfile.print(URI.parse(design_file.design_file_path_url).read)\n step_increment = true\n end\n\n if step_increment\n step_increment = false\n step_num = step_num+1\n end\n \n end\n end\n end", "title": "" }, { "docid": "e5ace7460dfb1b0635b355f1277abbc7", "score": "0.47216535", "text": "def unzip_params\n params.require(:unzip).permit(:zip_file_path)\n end", "title": "" }, { "docid": "7887f17ccf9aaf82c035f5e51547fea8", "score": "0.47199106", "text": "def in_zip(zip)\n self.stores({'postalCode' => zip})\n end", "title": "" }, { "docid": "fa924a949a253b10d59bf8be4243ee13", "score": "0.47098473", "text": "def extract(zip_file, where)\n File.open(where+'/metadata.zip', 'wb') {|f| f.write(Base64.decode64(zip_file))}\n Zip::ZipFile.open(where+'/metadata.zip') { |zip_file|\n zip_file.each { |f|\n f_path=File.join(where, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n } \n }\n FileUtils.rm_r where+'/metadata.zip'\n end", "title": "" }, { "docid": "7fbe855047da63df795601a8fc18b8ea", "score": "0.46986082", "text": "def create\n @zip = Zip.new(zip_params)\n\n respond_to do |format|\n if @zip.save\n format.html { redirect_to @zip, notice: 'Zip was successfully created.' }\n format.json { render :show, status: :created, location: @zip }\n else\n format.html { render :new }\n format.json { render json: @zip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35b715dc40709e3ac8f5172975b3fca5", "score": "0.46735927", "text": "def upload_app(name, zipfile, resource_manifest = [])\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Name cannot be blank\" if name.nil? || name.empty?\n raise CloudFoundry::Client::Exception::BadParams, \"Zipfile cannot be blank\" if zipfile.nil?\n upload_data = {}\n begin\n if zipfile.is_a? File\n file = Faraday::UploadIO.new(zipfile, \"application/zip\")\n else\n filebits = File.new(zipfile, \"rb\")\n file = Faraday::UploadIO.new(filebits, \"application/zip\")\n end\n rescue SystemCallError => error\n raise CloudFoundry::Client::Exception::BadParams, \"Invalid Zipfile: \" + error.message\n end\n upload_data[:application] = file\n upload_data[:resources] = resource_manifest.to_json if resource_manifest\n put(\"#{CloudFoundry::Client::APPS_PATH}/#{name}/application\", upload_data, :raw => true)\n true\n end", "title": "" }, { "docid": "8c3d5b983ab93a66aa68e933e9e40876", "score": "0.4666402", "text": "def require_zip\n require 'zip'\n rescue LoadError\n gem_rubyzip\n require 'zip'\n end", "title": "" }, { "docid": "8d4c91f0cadacde67f3debf58c056c51", "score": "0.46632951", "text": "def file?(path)\n zipfile.file?(path)\n end", "title": "" }, { "docid": "eaaa9f75a4acb7f98aee02a39fcd2ae4", "score": "0.46628723", "text": "def file\n @zip_fs_file\n end", "title": "" }, { "docid": "192b3cd1847528f2acd6509fe9666f87", "score": "0.46608654", "text": "def create\n @zip = Zip.new(params[:zip])\n\n respond_to do |format|\n if @zip.save\n format.html { redirect_to @zip, notice: 'Zip was successfully created.' }\n format.json { render json: @zip, status: :created, location: @zip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce9633b858bfb20befd26f20c86aa335", "score": "0.46573615", "text": "def copy_to_zip\r\n FileUtils.cp @file, \"#{@file}.zip\"\r\n end", "title": "" }, { "docid": "0396c851e9820d90c7375a4451b12424", "score": "0.46528205", "text": "def zipcode? zip\n\t\tziptime = Ziptime::ZIPTIME \t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get ziptime data from library\n\t\tif ziptime.include? zip\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "title": "" }, { "docid": "fc52557f67d71c4325ab2d9742c9b765", "score": "0.4652225", "text": "def add_csv_to_zip(zip, csv_name, buildings, building_type)\n temp_csv = Tempfile.new(csv_name, Rails.root.join('tmp', 'zip'))\n\n begin\n # Create and populate CSV with given name\n CSV.open(temp_csv, 'wb') do |csv|\n # Add column headers to CSV\n csv << Building.column_names + building_type.questions.select(&:published?).map(&:parameter)\n # Add a row of building attribute values to the CSV for each building\n buildings.each do |building|\n csv << Building.column_names.map { |attr| building.send(attr) } + building_type.questions.select(&:published?).map{ |question| find_answer(question, building) }\n end\n zip.add(csv_name, csv.path)\n end\n end\n end", "title": "" }, { "docid": "1b875917f42b41381d9b6fa0b5f84a73", "score": "0.46495515", "text": "def test_class_can_parse_zip\n hidden_zip = File.expand_path '../hidden.zip.txt', __FILE__\n assert_nil @RP.can_parse(hidden_zip)\n end", "title": "" }, { "docid": "d6e9d99a2dfa5ef8240ec11b93aff144", "score": "0.4646577", "text": "def process_file(filename, zipname)\n puts \"Process file activity\"\n Zip::ZipFile.open(@local_dir + zipname, Zip::ZipFile::CREATE) do |zipFile|\n zipFile.add(filename, @local_dir + filename)\n end\n end", "title": "" }, { "docid": "81094744a8642b91ba07e983f6e5f5cb", "score": "0.46342647", "text": "def import_from zip_file\n VALIDATOR.validate_zip_file_import zip_file\n @contents = get_contents_from_zip zip_file\n @machine_name = @contents[MACHINE_NAME_FILENAME]\n @contents.delete MACHINE_NAME_FILENAME\n @dir = {\n machine: DM_MACHINES_PATH.join(@machine_name),\n certs: DM_CERTS_PATH.join(@machine_name)\n }\n #VALIDATOR.validate_directories_dont_exist *@dir.values\n VALIDATOR.validate_no_machine_name @machine_name\n config_json_path = get_config_json_path\n @contents[config_json_path] = insert_home_in @contents[config_json_path]\n write_contents\n # Finally, check that the newly imported machine is recognized by docker-machine.\n VALIDATOR.validate_machine_name @machine_name\n message(\n \"Successfully imported docker-machine configuration files from archive\",\n \" `#{zip_file.to_s}'\",\n \"for docker-machine\",\n \" `#{@machine_name}'\"\n )\n end", "title": "" }, { "docid": "d830edbb1d08a301f2d581a668f59c13", "score": "0.4627576", "text": "def generate_zipfile (zippath)\n Zip::Archive.open(zippath, Zip::CREATE) do |ar|\n Dir.glob('logs/histograms/*').each do |file|\n dest = File.join('histograms',File.basename(file));\n if !File.directory?(file)\n ar.add_file(dest,file)\n end\n end\n Dir.glob('public/assets/imgs/*').each do |file|\n dest = File.join('imgs',File.basename(file));\n if !File.directory?(file)\n ar.add_file(dest,file)\n end\n end\n Dir.glob('logs/*').each do |file|\n if !File.directory?(file)\n ar.add_file(file,file)\n end\n end\n end\n end", "title": "" }, { "docid": "1fcf47a081188de403f3c6e6fc3d435b", "score": "0.46248612", "text": "def zip_download\r\n add_one_to_counter('zip')\r\n download_zip_file if request.post?\r\n end", "title": "" }, { "docid": "97449346e69291b95c9cded20543ea27", "score": "0.4615804", "text": "def has_zip?; @has_zip = has_tool?('zip -v', @has_zip); end", "title": "" }, { "docid": "c0f0b4d95ea8b8de9d633f4e2fa717bd", "score": "0.4610786", "text": "def extract_data_from_zip(zipfn, tmpdir)\n logger.info \"extract-boundingbox: #{bare_druid} is extracting data: #{zipfn}\"\n\n tmpdir = File.join(tmpdir, \"extractboundingbox_#{bare_druid}\")\n FileUtils.rm_rf(tmpdir) if File.directory? tmpdir\n FileUtils.mkdir_p(tmpdir)\n system(\"unzip -o '#{zipfn}' -d '#{tmpdir}'\", exception: true)\n tmpdir\n end", "title": "" }, { "docid": "29760043380e41ba27df523f1b0ac12b", "score": "0.46046835", "text": "def createZipFile(dataset)\n\t\t\n\tend", "title": "" }, { "docid": "aa7a4d08ff91c02cefe1f3c2b808927f", "score": "0.46042505", "text": "def zip params = nil\n params ||= {}\n zip_final_path = if params.has_key?( :filename )\n params[:filename].expanded_path\n else\n zip_path.name\n end\n cmd = \"\"\n cmd << \"cd \\\"#{dirname}\\\";\"\n cmd << \"zip \"\n cmd << \"-r \" unless file?\n cmd << \" \\\"#{zip_final_path}\\\" \\\"#{name}\\\"\"\n res = `#{cmd}`\n return zip_path.exist?\n end", "title": "" }, { "docid": "1e6a8dca2bb6b06196f3e5b0f25bd28c", "score": "0.45796284", "text": "def add_to_archive(zip, blob, path)\n full_path_name = [path, blob.filename.to_s].compact.join('/')\n\n blob.download do |chunk|\n zip.put_next_entry(full_path_name)\n zip << chunk\n end\n\n @added << blob.id\n end", "title": "" }, { "docid": "0388ea66eaac64b67efc01a4d89d39a7", "score": "0.45704955", "text": "def process_zipfile(tmpdir, zipfilename, zip, path='')\n @sheet_files = []\n Roo::ZipFile.open(zipfilename) {|zf|\n zf.entries.each {|entry|\n if entry.to_s.end_with?('workbook.xml')\n open(tmpdir+'/'+'roo_workbook.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n # if entry.to_s.end_with?('sharedStrings.xml')\n # at least one application creates this file with another (incorrect?)\n # casing. It doesn't hurt, if we ignore here the correct casing - there\n # won't be both names in the archive.\n # Changed the casing of all the following filenames.\n if entry.to_s.downcase.end_with?('sharedstrings.xml')\n open(tmpdir+'/'+'roo_sharedStrings.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n if entry.to_s.downcase.end_with?('styles.xml')\n open(tmpdir+'/'+'roo_styles.xml','wb') {|f|\n f << zip.read(entry)\n }\n end\n if entry.to_s.downcase =~ /sheet([0-9]+).xml$/\n nr = $1\n open(tmpdir+'/'+\"roo_sheet#{nr}\",'wb') {|f|\n f << zip.read(entry)\n }\n @sheet_files[nr.to_i-1] = tmpdir+'/'+\"roo_sheet#{nr}\"\n end\n if entry.to_s.downcase =~ /comments([0-9]+).xml$/\n nr = $1\n open(tmpdir+'/'+\"roo_comments#{nr}\",'wb') {|f|\n f << zip.read(entry)\n }\n @comments_files[nr.to_i-1] = tmpdir+'/'+\"roo_comments#{nr}\"\n end\n }\n }\n # return\n end", "title": "" }, { "docid": "89ebf3f19e859fa12f6cf29e6f10cabc", "score": "0.45690477", "text": "def zip(file)\n ZipTask.define_task(file)\n end", "title": "" }, { "docid": "fd633604501b4f7dc1fc05b07131e15a", "score": "0.45555505", "text": "def _learning_repository_upload(path, file, method)\n # name = the content name,\n # e.g. \"Resource\", \"profileImage\", \"name\", \"description\", \"file\", \"targetUsers\"\n # file = the File's name in the directory.\n # method = POST or PUT\n # json = the json appended to the end of the request body\n # auth_uri = path\n auth_uri = create_authenticated_uri(path, method)\n uri = URI.parse(auth_uri)\n\n boundary = \"xxBOUNDARYxx\"\n header = { \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\" }\n # setup the post body\n post_body = []\n post_body << \"--#{boundary}\\n\"\n post_body << \"Content-Disposition: form-data; name = \\\"Resource\\\"; filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: application/zip\\r\\n\\r\\n\"\n post_body << File.read(file)\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = post_body.join\n\n # Send the request\n response = http.request(request)\n JSON.parse(response)\nend", "title": "" }, { "docid": "9ea856f6743add920c4b229cce4ef73d", "score": "0.45530453", "text": "def zipped(path)\n return zip_path if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system 'zip', '-0rjq', zip_path, path\n\n zip_path\n end", "title": "" }, { "docid": "317cb4881e4a4f7b21596092460755e6", "score": "0.4550356", "text": "def install(zip_file)\n tmp = zip_file.tempfile\n FileUtils.move tmp.path, Rails.root.join(\"plugins\")\n basename = File.basename(tmp.path)\n zip_filename = Rails.root.join(\"plugins\", basename)\n `cd plugins; unzip -o #{zip_filename}`\n true\n ensure\n FileUtils.rm_f(zip_filename) if zip_filename\n end", "title": "" }, { "docid": "d54897882cdb8c12dd17eb277e5eda65", "score": "0.45496538", "text": "def expects_zip_files\n ['application/octet-stream; gdal-format=AIG',\n 'application/zip; ogr-format=\"ESRI Shapefile\"']\n end", "title": "" }, { "docid": "e3aa8bf215641c325e9763c3c46c35f7", "score": "0.45461908", "text": "def process_zipfile(zipfilename_or_stream)\n @sheet_files = []\n\n unless is_stream?(zipfilename_or_stream)\n zip_file = Zip::File.open(zipfilename_or_stream)\n else\n zip_file = Zip::CentralDirectory.new\n zip_file.read_from_stream zipfilename_or_stream\n end\n\n process_zipfile_entries zip_file.to_a.sort_by(&:name)\n end", "title": "" }, { "docid": "1c03f834b1b42bd3a16e663b4f2ba824", "score": "0.45414472", "text": "def download_zip(path, zip_file_path)\n File.open(zip_file_path, 'wb') do |saved_file|\n open(@feed.url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n end", "title": "" }, { "docid": "430dc1bf7dc6d240a9733a831ea073a7", "score": "0.45336646", "text": "def within_zip(relative_filename)\n relative_filename = Pathname(relative_filename)\n filename = actual_path + relative_filename\n raise \"Zip file not found: #{filename}\" unless filename.exist?\n unzip_dir = unzip_dir_for(relative_filename)\n mkpath unzip_dir\n unzip_succeeded =\n system(*%W[unzip -qq #{filename} -d #{unzip_dir}])\n raise \"Could not unzip #{filename}\" unless unzip_succeeded\n push_working_dir(unzip_dir.relative_path_from(current_actual_path)) do\n yield(unzip_dir)\n end\n end", "title": "" }, { "docid": "0f06ecc49ad9352dd9eacf7ed3697f53", "score": "0.45258832", "text": "def export_to zip_file\n zip_file = Pathname.new \"#{zip_file.to_s}#{zip_file.to_s.match(/\\.zip\\z/i) ? '' : '.zip'}\"\n VALIDATOR.validate_zip_file_export zip_file\n files = get_files\n @contents = get_contents_from_files(*files)\n config_json_path = get_config_json_path\n @contents[config_json_path] = remove_home_in @contents[config_json_path]\n @contents[MACHINE_NAME_FILENAME] = @machine_name\n write_zip_file_to zip_file\n message(\n \"Successfully created zip archive\",\n \" `#{zip_file.to_s}'\",\n \"with the keys and certificates from docker-machine\",\n \" `#{@machine_name}'\"\n )\n end", "title": "" }, { "docid": "5c7ae6b031780873ac8afd7d0a959faf", "score": "0.45251617", "text": "def checkZip(file)\n return unless File.exist?(file)\n zip = Java.java.util.zip.ZipInputStream.new(Java.java.io.FileInputStream.new(file))\n zip_entry_count = 0\n while entry = zip.getNextEntry do\n # just iterate over all entries\n zip_entry_count = zip_entry_count + 1\n end\n zip.close()\n\n # jar tool fails with \"ZipException: error in opening zip file\" if empty\n if zip_entry_count > 0\n sh \"#{File.join(ENV['JAVA_HOME'], 'bin', 'jar')} tvf #{file}\"\n end\n end", "title": "" }, { "docid": "c0df4a263925ecfab1ba7863c2d80cc9", "score": "0.45212197", "text": "def zip_and_upload_data_dump(file_name, params={})\n upload_host = params[:upload_host] || SCP_DEST\n upload_user = params[:upload_user] || SCP_USER\n upload_password = params[:upload_password] || SCP_PASSWORD\n\n tmp_file = File.join(RAILS_ROOT, 'tmp', \"#{file_name}.csv\")\n Zip::ZipFile.open(File.join(RAILS_ROOT, 'tmp', \"#{file_name}.new.zip\"), Zip::ZipFile::CREATE) { |zipfile|\n zipfile.add(\"#{file_name}.csv\", tmp_file)\n }\n File.delete(tmp_file)\n FileUtils.mv File.join(RAILS_ROOT, 'tmp', \"#{file_name}.new.zip\"), File.join(RAILS_ROOT, 'tmp', \"#{file_name}.zip\"), :force => true\n FileUtils.chmod_R 0644, File.join(RAILS_ROOT, 'tmp', \"#{file_name}.zip\")\n Net::SCP.start(upload_host, upload_user, :port => 7012, :password => upload_password ) do |scp|\n scp.upload!(File.join(RAILS_ROOT, 'tmp', \"#{file_name}.zip\"), params[:upload_path])\n end\n\n end", "title": "" }, { "docid": "55104bcd8dd19ff6b0c154b89504cca2", "score": "0.45178688", "text": "def zip?\n is_content_type?('application/zip')\n end", "title": "" }, { "docid": "55104bcd8dd19ff6b0c154b89504cca2", "score": "0.45178688", "text": "def zip?\n is_content_type?('application/zip')\n end", "title": "" }, { "docid": "55104bcd8dd19ff6b0c154b89504cca2", "score": "0.45178688", "text": "def zip?\n is_content_type?('application/zip')\n end", "title": "" }, { "docid": "55104bcd8dd19ff6b0c154b89504cca2", "score": "0.45178688", "text": "def zip?\n is_content_type?('application/zip')\n end", "title": "" }, { "docid": "d89443e4856933f12b9e08d9634b8076", "score": "0.4514238", "text": "def zip_download\n download_zip_file if request.post?\n end", "title": "" }, { "docid": "6a93e88fdf94b5cc0ae0d1e1fdf40ded", "score": "0.45028332", "text": "def create\n @admins_zip = Admins::Zip.new(admins_zip_params)\n\n respond_to do |format|\n if @admins_zip.save\n format.html { redirect_to @admins_zip, notice: 'Zip was successfully created.' }\n format.json { render :show, status: :created, location: @admins_zip }\n else\n format.html { render :new }\n format.json { render json: @admins_zip.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72f29a0e73ae837ebd1c9791e1dbc588", "score": "0.44924754", "text": "def initialize(workflow_definition)\r\n \r\n super(workflow_definition)\r\n \r\n # Check if the zip file exists. If yes then remove it\r\n zipfile = Tempfile.new('package.zip')\r\n zipfile.binmode\r\n \r\n @filename = zipfile.path\r\n zipfile.print(workflow_definition)\r\n \r\n end", "title": "" }, { "docid": "7803565aa87c7fca4255362410c8352b", "score": "0.44885442", "text": "def extract_gis_data\n if File.exists?(KoeppenGeiger::Utils::ARCHIVE) \n begin\n #Open the existing zip file\n Zip::ZipFile::open(KoeppenGeiger::Utils::ARCHIVE) do |zipfile|\n zipfile.each do |f|\n #start extracting each file\n path = File.join(KoeppenGeiger::Utils::EXTRACT_DIR, f.name)\n FileUtils.mkdir_p(File.dirname(path))\n zipfile.extract(f, path) \n end\n end\n rescue Exception => e\n #If the script blows up, then we should probably be somewhere in this region\n puts \"An error occurred during decompression: \\n #{e}.\"\n end\n else\n puts \"\\n\\nArchive could not be found.\"\n end\n end", "title": "" }, { "docid": "2bace4edddb96fb98627c9345f30b774", "score": "0.448656", "text": "def starter_file_config_to_zip(zip_file, settings_filepath)\n default_starter_group = nil\n group_data = []\n directory_path = File.dirname(settings_filepath)\n self.starter_file_groups.each do |starter_file_group|\n group_name = ActiveStorage::Filename.new(starter_file_group.name).sanitized\n starter_file_group.write_starter_files_to_zip(zip_file, File.join(directory_path, group_name))\n if starter_file_group.id == self.default_starter_file_group_id\n default_starter_group = group_name\n end\n group_data << {\n directory_name: group_name,\n name: starter_file_group.name,\n use_rename: starter_file_group.use_rename,\n entry_rename: starter_file_group.entry_rename\n }\n end\n starter_file_settings = {\n default_starter_file_group: default_starter_group,\n starter_file_groups: group_data\n }.to_yaml\n zip_file.get_output_stream(settings_filepath) { |f| f.write starter_file_settings }\n end", "title": "" }, { "docid": "8b743781284ae35eed6270b7c1d25c81", "score": "0.44811502", "text": "def zip?\n find_itself unless @full_path\n if @full_path.end_with?(\".GZ\") || @full_path.end_with?(\".gz\")\n return true\n end\n false\n end", "title": "" }, { "docid": "128072ae7e078d7b0806dbefa6d14748", "score": "0.44808432", "text": "def zip_action\n #require 'rubygems'\n #require 'archive-zip'\n\n @zip_upload = ZipUpload.find(params[:zip_upload_id])\n if params[:i]==\"got\"\n @context = Context.find(params[:context_id])\n end\n @publish_assessment = false\n name1=@zip_upload.asset.original_filename.split('.')[0].to_s\n directory = @zip_upload.asset.path.gsub(\"/#{@zip_upload.asset_file_name}\",\"\")\n filename = directory+\"/#{@zip_upload.asset_file_name}\"\n destfile=\"#{Rails.root.to_s}\"+\"/public\"+\"/question_images\"\n Archive::Zip.extract(filename, directory)\n srcfile=directory+\"/\"\n @etxname=\"\"\n @rtn_etx=\"\"\n @n = 0\n @etx_files = Rails.root.to_s+\"/etx_files/\"+Time.now.to_s\n FileUtils.mkdir(@etx_files)\n respond_to do |format|\n if (Dir[directory+\"/\"+'/*.etx'])!=[]\n begin\n ActiveRecord::Base.transaction do\n zipfiles=Dir[srcfile+'/*']\n FileUtils.cp_r zipfiles, destfile\n Dir[directory+\"/\"+'/*.etx'].each do |etxfile|\n basename = File.basename(etxfile)\n b = basename\n lb = b.length\n basename1 = b[0,lb-4]\n\n @etxname=@etxname+basename1+', '\n\n file = File.new(etxfile)\n @file = etxfile\n @etx = Nokogiri::XML(file)\n\n @testpaper = @etx.xpath(\"//testpaper\")\n guidelines = @testpaper.xpath(\"guidelines\").attr(\"value\").to_s\n requisites = @testpaper.xpath(\"requisites\").attr(\"value\").to_s\n time = @testpaper.xpath(\"time\").attr(\"value\").to_s unless @testpaper.xpath(\"time\").empty?\n difficulty = @testpaper.xpath(\"level\").attr(\"value\").to_s unless @testpaper.xpath(\"level\").empty?\n pause = @testpaper.xpath(\"can_pause\").attr(\"value\").to_s unless @testpaper.xpath(\"can_pause\").empty?\n\n @var=ZipUpload.find(params[:zip_upload_id])\n\n if @var.check==1\n @quiz = Quiz.new\n @quiz.createdby = current_user.id\n @quiz.modifiedby = current_user.id\n @quiz.name = basename1\n @quiz.intro = guidelines\n @quiz.difficulty = difficulty.to_i\n @quiz.timeopen = 0\n @quiz.timeclose = 0\n @quiz.timelimit = time\n @quiz.introformat = 0\n @quiz.attempts = 0\n @quiz.attemptonlast = 0\n @quiz.grademethod = 1\n @quiz.decimalpoints = 2\n @quiz.questiondecimalpoints = -2\n @quiz.reviewattempt = 0\n @quiz.reviewcorrectness = 0\n @quiz.reviewmarks = 0\n\n qct=@etx.xpath(\"//question_set\")\n if @context==nil\n cxt=Context.new\n cxt.board_id=Board.find_by_name(qct.xpath(\"board\").attr(\"value\").to_s).id\n if ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s)!=nil\n cxt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s).id\n else\n cntnt=Content.new\n cntnt.board_id=Board.find_by_name(qct.xpath(\"board\").attr(\"value\").to_s).id\n cntnt.type=\"ContentYear\"\n cntnt.name=qct.xpath(\"class\").attr(\"value\").to_s\n cntnt.uri=\"/Curriculum/Content/\"+qct.xpath(\"board\").attr(\"value\").to_s+\"/\"+qct.xpath(\"class\").attr(\"value\").to_s\n clscode=qct.xpath(\"class\").attr(\"value\").to_s\n cntnt.code=clscode.to_i\n cntnt.save(:validate=>false)\n cxt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s).id\n #cxt.content_year_id=\"1\"\n end\n if Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,qct.xpath(\"subject\").attr(\"value\").to_s)!=nil\n cxt.subject_id=Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,qct.xpath(\"subject\").attr(\"value\").to_s).id\n else\n cntnt=Content.new\n cntnt.board_id=Board.find_by_name(qct.xpath(\"board\").attr(\"value\").to_s).id\n cntnt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s).id\n cntnt.type=\"Subject\"\n cntnt.name=qct.xpath(\"subject\").attr(\"value\").to_s\n\n cntnt.uri=\"/Curriculum/Content/\"+qct.xpath(\"board\").attr(\"value\").to_s+\"/\"+qct.xpath(\"class\").attr(\"value\").to_s+\"/\"+qct.xpath(\"subject\").attr(\"value\").to_s\n sjcode=qct.xpath(\"subject\").attr(\"value\").to_s\n sjcode=sjcode[0,2]\n cntnt.code=sjcode.downcase\n cntnt.save(:validate=>false)\n cxt.subject_id=Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,qct.xpath(\"subject\").attr(\"value\").to_s).id\n\n #cxt.subject_id=\"1\"\n end\n if Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s)!=nil\n cxt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s).id\n else\n cntnt=Content.new\n cntnt.board_id=Board.find_by_name(qct.xpath(\"board\").attr(\"value\").to_s).id\n cntnt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s).id\n cntnt.subject_id=Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,qct.xpath(\"subject\").attr(\"value\").to_s).id\n cntnt.type=\"Chapter\"\n cntnt.name=qct.xpath(\"chapter\").attr(\"value\").to_s\n cntnt.uri=\"/Curriculum/Content/\"+qct.xpath(\"board\").attr(\"value\").to_s+\"/\"+qct.xpath(\"class\").attr(\"value\").to_s+\"/\"+qct.xpath(\"subject\").attr(\"value\").to_s+\"/\"+qct.xpath(\"chapter\").attr(\"value\").to_s\n\n cntnt.save(:validate=>false)\n cxt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s).id\n\n #cxt.chapter_id=\"1\"\n end\n if !qct.xpath(\"topic\").empty?\n if Topic.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,cxt.chapter_id,qct.xpath(\"topic\").attr(\"value\").to_s)!=nil\n\n cxt.topic_id=Topic.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,cxt.chapter_id,qct.xpath(\"topic\").attr(\"value\").to_s).id\n else\n cntnt=Content.new\n cntnt.board_id=Board.find_by_name(qct.xpath(\"board\").attr(\"value\").to_s).id\n cntnt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,qct.xpath(\"class\").attr(\"value\").to_s).id\n cntnt.subject_id=Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,qct.xpath(\"subject\").attr(\"value\").to_s).id\n cntnt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s).id\n cntnt.type=\"Topic\"\n cntnt.name=qct.xpath(\"topic\").attr(\"value\").to_s\n cntnt.uri=\"/Curriculum/Content/\"+qct.xpath(\"board\").attr(\"value\").to_s+\"/\"+qct.xpath(\"class\").attr(\"value\").to_s+\"/\"+qct.xpath(\"subject\").attr(\"value\").to_s+\"/\"+qct.xpath(\"chapter\").attr(\"value\").to_s+\"/\"+qct.xpath(\"topic\").attr(\"value\").to_s\n\n cntnt.save(:validate=>false)\n #cxt.topic_id=Topic.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,cxt.chapter_id,qct.xpath(\"topic\").attr(\"value\").to_s).id\n cxt.topic_id=\"\"\n end\n end\n cxt.save\n else\n cxt=Context.new\n cxt.board_id=@context.board_id\n\n cxt.content_year_id=@context.content_year_id\n cxt.subject_id=@context.subject_id\n if @context.chapter_id==0\n if !qct.xpath(\"chapter\").empty?\n if Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s) != nil\n cxt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,qct.xpath(\"chapter\").attr(\"value\").to_s).id\n end\n end\n else\n cxt.chapter_id=@context.chapter_id\n end\n cxt.save\n end\n @q_institutions = Institution.where(:id=>cxt.board.user_ids)\n if !@q_institutions.empty?\n @q_institution = @q_institutions.first\n end\n @q_centers = Center.where(:id=>cxt.board.user_ids)\n if !@q_centers.empty?\n @q_center = @q_centers.first\n end\n unless current_user.institution_id.nil?\n @quiz.institution_id = current_user.institution_id\n else\n if !@q_institution.nil?\n @quiz.institution_id = @q_institution.id\n else\n @quiz.institution_id = 1\n end\n end\n unless current_user.center_id.nil?\n @quiz.center_id = current_user.center_id\n else\n if !@q_center.nil?\n @quiz.center_id = @q_center.id\n else\n @quiz.center_id = 1\n end\n end\n\n @quiz.context_id=cxt.id\n @quiz.reviewspecificfeedback = 0\n @quiz.reviewgeneralfeedback = 0\n @quiz.reviewoverallfeedback = 0\n @quiz.questionsperpage = 0\n @quiz.shufflequestions = 0\n @quiz.shuffleanswers = 0\n @quiz.sumgrades = 0.00000\n @quiz.grade = 0.00000\n @quiz.delay1 = 0\n @quiz.delay2 = 0\n @quiz.showuserpicture = 0\n @quiz.showblocks = 0\n @quiz.save(:validate=>false)\n #\n #@trgtgrp=QuizTargetedGroup.new\n #@trgtgrp.quiz_id=@quiz.id\n #@trgtgrp.group_id=4\n #@trgtgrp.to_group=1\n #@trgtgrp.published_by=1\n #@trgtgrp.save(:validate=>false)\n end\n j = 0\n @sections = {}\n questions = []\n @is_section = false\n @etx.xpath(\"//question_set\").each do |q|\n if q.parent.name == \"section\"\n if @quiz\n @section = QuizSection.find_or_create_by_name_and_quiz_id(q.parent.attr(\"name\"),@quiz.id)\n end\n @section_name = q.parent.attr(\"name\").to_s\n @sections[@section_name] = []\n @is_section = true\n end\n question = Question.new\n question.createdby = current_user.id\n question.name = \"\"\n question.questiontext = clean(q.xpath(\"question\").xpath(\"question_text\").inner_text)\n question.generalfeedback = clean(q.xpath(\"question\").xpath(\"comment\").inner_text)\n if q.xpath(\"qtype\").empty?\n next\n end\n if q.xpath(\"qtype\").attr(\"value\").to_s ==\"MCQ\"\n question.qtype = \"multichoice\"\n elsif q.xpath(\"qtype\").attr(\"value\").to_s == \"MTF\"\n question.qtype = \"match\"\n elsif q.xpath(\"qtype\").attr(\"value\").to_s == \"TOF\"\n question.qtype = \"truefalse\"\n elsif q.xpath(\"qtype\").attr(\"value\").to_s == \"SS\"\n question.qtype = \"parajumble\"\n else\n next\n end\n score = q.xpath(\"score\").attr(\"value\").to_s.to_f\n question.defaultmark = score.to_s.length == 0 ? 1 : score\n question.penalty = q.xpath(\"negativescore\").attr(\"value\").to_s\n if !q.xpath(\"course\").empty?\n question.difficulty = q.xpath(\"course\").attr(\"value\").to_s.to_i\n else\n question.difficulty = \"Regular\"\n end\n if !q.xpath(\"difficulty\").empty?\n question.difficulty = q.xpath(\"difficulty\").attr(\"value\").to_s.to_i\n else\n question.difficulty = 1\n end\n if q.xpath(\"prob_skill\").empty?\n question.prob_skill = 0\n else\n question.prob_skill = q.xpath(\"prob_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"data_skill\").empty?\n\n question.data_skill = 0\n else\n question.data_skill = q.xpath(\"data_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"useofit_skill\").empty?\n question.useofit_skill = 0\n else\n question.useofit_skill = q.xpath(\"useofit_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"creativity_skill\").empty?\n question.creativity_skill = 0\n else\n question.creativity_skill = q.xpath(\"creativity_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"listening_skill\").empty?\n question.listening_skill = 0\n else\n question.listening_skill = q.xpath(\"listening_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"speaking_skill\").empty?\n question.speaking_skill = 0\n else\n question.speaking_skill = q.xpath(\"speaking_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"grammar_skill\").empty?\n question.grammer_skill = 0\n else\n question.grammer_skill = q.xpath(\"grammar_skill\").attr(\"value\").to_s\n end\n\n if q.xpath(\"vocab_skill\").empty?\n question.vocab_skill = 0\n else\n question.vocab_skill = q.xpath(\"vocab_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"formulae_skill\").empty?\n question.formulae_skill = 0\n else\n question.formulae_skill = q.xpath(\"formulae_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"comprehension_skill\").empty?\n question.comprehension_skill = 0\n else\n question.comprehension_skill = q.xpath(\"comprehension_skill\").attr(\"value\").to_s\n end\n\n if q.xpath(\"knowledge_skill\").empty?\n question.knowledge_skill = 0\n else\n question.knowledge_skill = q.xpath(\"knowledge_skill\").attr(\"value\").to_s\n end\n if q.xpath(\"application_skill\").empty?\n question.application_skill = 0\n else\n question.application_skill = q.xpath(\"application_skill\").attr(\"value\").to_s\n end\n question.questiontextformat=\"\"\n question.generalfeedbackformat=\"\"\n question.length=\"0\"\n question.stamp=\"\"\n question.version=\"\"\n question.hidden=\"0\"\n question.tags=\"\"\n\n question.timecreated=\"\"\n question.timemodified=\"\"\n question.modifiedby=\"\"\n if @context==nil\n cxt=Context.new\n cxt.board_id=Board.find_by_name(q.xpath(\"board\").attr(\"value\").to_s).id\n if ContentYear.find_by_board_id_and_name(cxt.board_id,q.xpath(\"class\").attr(\"value\").to_s)!=nil\n\n cxt.content_year_id=ContentYear.find_by_board_id_and_name(cxt.board_id,q.xpath(\"class\").attr(\"value\").to_s).id\n else\n cxt.content_year_id=\"1\"\n end\n if Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,q.xpath(\"subject\").attr(\"value\").to_s)!=nil\n cxt.subject_id=Subject.find_by_board_id_and_content_year_id_and_name(cxt.board_id,cxt.content_year_id,q.xpath(\"subject\").attr(\"value\").to_s).id\n else\n cxt.subject_id=\"1\"\n end\n if Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,q.xpath(\"chapter\").attr(\"value\").to_s)!=nil\n cxt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,q.xpath(\"chapter\").attr(\"value\").to_s).id\n else\n cxt.chapter_id=\"1\"\n end\n if !q.xpath(\"topic\").empty?\n if Topic.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,cxt.chapter_id,q.xpath(\"topic\").attr(\"value\").to_s)!=nil\n\n cxt.topic_id=Topic.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,cxt.chapter_id,q.xpath(\"topic\").attr(\"value\").to_s).id\n else\n cxt.topic_id=\"\"\n end\n end\n\n cxt.save\n else\n cxt=Context.new\n cxt.board_id=@context.board_id\n cxt.content_year_id=@context.content_year_id\n cxt.subject_id=@context.subject_id\n if @context.chapter_id==0\n if !q.xpath(\"chapter\").empty?\n if Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,q.xpath(\"chapter\").attr(\"value\").to_s) != nil\n cxt.chapter_id=Chapter.find_by_board_id_and_content_year_id_and_subject_id_and_name(cxt.board_id,cxt.content_year_id,cxt.subject_id,q.xpath(\"chapter\").attr(\"value\").to_s).id\n end\n end\n else\n cxt.chapter_id=@context.chapter_id\n end\n cxt.save\n end\n @institutions = Institution.where(:id=>cxt.board.user_ids)\n if !@institutions.empty?\n @institution = @institutions.first\n end\n @centers = Center.where(:id=>cxt.board.user_ids)\n if !@centers.empty?\n @center = @centers.first\n end\n question.context_id=cxt.id\n unless current_user.institution_id.nil?\n question.institution_id = current_user.institution_id\n else\n if !@institution.nil?\n question.institution_id = @institution.id\n else\n question.institution_id = 1\n end\n end\n unless current_user.center_id.nil?\n question.center_id = current_user.center_id\n else\n if !@center.nil?\n question.center_id = @center.id\n else\n question.center_id = 1\n end\n\n end\n question.save(:validate=> false)\n if @is_section\n @sections[@section_name] << question.id\n else\n questions << question.id\n end\n\n q.set_attribute('id', question.id.to_s)\n i = 1\n apl = [\"A\",\"B\",\"C\",\"D\",\"E\"]\n num = [\"1\",\"2\",\"3\",\"4\",\"5\"]\n q.xpath(\"question//option\").each do |o|\n qa = QuestionAnswer.new\n qa.question = question.id\n qa.answer = clean(o.xpath(\"option_text\").inner_text)\n qa.feedback = clean(o.xpath(\"feedback\").inner_text)\n qa.answerformat=\"1\"\n qa.feedbackformat=\"1\"\n if !q.xpath(\"question//answer\").empty?\n if !q.xpath(\"question//answer\").first.attr(\"value\").nil?\n question_options = q.xpath(\"question//answer\").first.attr(\"value\").split(',')\n end\n end\n if question_options.count == 1\n if q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"A\" or q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"1\"\n if i==1\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n if q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"B\" or q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"2\"\n if i==2\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n if q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"C\" or q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"3\"\n if i==3\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n if q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"D\" or q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"4\"\n if i==4\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n if q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"E\" or q.xpath(\"question//answer\").first.attr(\"value\").to_s == \"5\"\n if i==5\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n else\n if question_options.include?apl[i-1] or question_options.include?num[i-1]\n qa.fraction = 1\n else\n qa.fraction = 0\n end\n end\n i = i +1\n\n qa.save(:validate=>false)\n o.set_attribute(\"id\",qa.id.to_s)\n end\n if @var.check==1\n qqi = QuizQuestionInstance.new\n qqi.quiz_id = @quiz.id\n qqi.question_id = question.id\n qqi.grade = question.defaultmark\n qqi.penalty = question.penalty\n qqi.quiz_section_id = @section.id if @is_section\n qqi.save(:validate=>false)\n end\n\n end\n\n if @var.check == 1\n if params[:group_id] != nil\n @target = QuizTargetedGroup.new\n @target.quiz_id = @quiz.id\n @target.group_id = params[:group_id]\n @target.pause = pause ? 1 : 0\n @target.assessment_type = 2\n @target.extras = 'practice'\n @target.published_by = current_user.id\n @target.to_group = true\n @target.save(:validate=>false)\n create_message(false,@quiz.id,@target.id)\n @publish_assessment = true\n end\n end\n\n images = []\n @builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.testpaper(@publish_assessment ? {:id=>@quiz.id.to_s,:version=>\"2.0\",:publish_id=>@target.id.to_s} :''){\n xml.guidelines(:value=>\"\")\n xml.requisites(:value=>\"\")\n xml.pause(:value=> pause ? 1 :0)\n xml.time(:value=>\"-1\")\n xml.level(:value=>3)\n if @var.check == 1\n if @quiz.quiz_sections.empty?\n @instance = QuizQuestionInstance.where(\"quiz_id = ?\",@quiz.id).each do |i|\n quiz_questions(xml,i,q=nil)\n end\n else\n @quiz.quiz_sections.each do |section|\n xml.section(:value=>section.name){\n section.quiz_question_instances.each do |i|\n quiz_questions(xml,i,q=nil)\n end\n }\n end\n end\n elsif @is_section\n @sections.each do |key,value|\n xml.section(:value=>key){\n value.each do |q|\n quiz_questions(xml,i=nil,q)\n end\n }\n end\n else\n questions.each do |q|\n quiz_questions(xml,i=nil,q)\n end\n end\n\n }\n end\n\n xml_string = @builder.to_xml.to_s\n @etxname.split(',')[@n]\n File.open(@etx_files+\"/\"+@etxname.split(',')[@n]+\".etx\", \"w+b\", 0644) do |f|\n #f.write(xml_string.to_s.gsub( \"\\n\", \"\" ).gsub(/>[ ]*</,'><'))\n f.write(xml_string.to_s)\n end\n\n @n = @n+1\n end\n @etxzip= Rails.root.to_s+'/tmp/cache/'+'etx_'+Time.current.to_i.to_s+\".zip\"\n #rtn_etx=@etx_file.split('~')\n Dir[@etx_files+\"/\"+'/*.etx'].each do |a|\n Archive::Zip.archive(@etxzip, a)\n end\n end\n format.html {render :action => \"zip_action_successful\"}\n rescue Exception => e\n puts \"Exception in etx uploading...............#{e.message}\"\n logger.info \"Exception in etx uploading....#{e.backtrace}.....#{@file}......#{e.message}\"\n flash[:error] = \"#{e.message}=======#{@file}\"\n format.html { redirect_to quizzes_zip_upload_path }\n end\n\n else\n @zip_upload.destroy\n FileUtils.rm_rf srcfile\n flash[:notice]= \"EXT is not found in the uploaded zip file\"\n format.html { redirect_to quizzes_zip_upload_path}\n end\n end\n end", "title": "" }, { "docid": "361baec3668f013657cef37bff47fbc3", "score": "0.4477937", "text": "def ensure_complete_upload! \n mods = file_hash[:mods] \n tei = file_hash[:tei]\n tfc = file_hash[:tfc]\n teibp = file_hash[:teibp]\n tapas_generic = file_hash[:tapas_generic]\n\n unless mods && tei && tfc && teibp && tapas_generic\n raise \"Could not create a new Core File using the zipped content!\" \\\n \" Mods file found at #{mods || 'NOT FOUND'},\" \\\n \" TEI file found at #{tei || 'NOT FOUND'},\" \\\n \" TFC file found at #{tfc || 'NOT FOUND'}\"\n end \n end", "title": "" }, { "docid": "5222fe378ca84e5a042fb5fea12bd767", "score": "0.44774538", "text": "def zipped(path)\n return zip_path if File.exist?(zip_path)\n FileUtils.mkdir_p \"/tmp/play-zips\"\n system 'zip', '-0rjq', zip_path, path\n\n zip_path\n end", "title": "" }, { "docid": "1413d3a698ec11aef0f23d6db76f5be6", "score": "0.4477048", "text": "def read_from_zip(file)\n Zip::ZipFile.open(@run.results.path) do |zip|\n zip.read(file)\n end\n end", "title": "" }, { "docid": "9936d13c4e9765573509c6b557960457", "score": "0.4472665", "text": "def initialize(zipfilepath)\r\n @filepath = File.expand_path(zipfilepath)\r\n end", "title": "" }, { "docid": "0ab8d98b929a564527c0f4fbe75a1d74", "score": "0.4463923", "text": "def test_230_zip()\n return unless (BitString.new.respond_to?(:zip))\n assert(false, '###FAIL! .zip not supported but .respond_to? is true!')\n end", "title": "" }, { "docid": "f3e3ba4e7616d80983ba452f8772b68e", "score": "0.44585356", "text": "def parseFromZipFile(path, pictures)\n Zip::ZipFile.open(path) do |zf|\n pathToCellmasks = \"cellmasks\"\n \n files = zf.dir.entries(pathToCellmasks).sort\n \n @experiment.import_progress = \"#{@images.length} / #{files.count}\"\n @experiment.save!\n \n files.each_with_index do |filename, i|\n file_path = pathToCellmasks + \"/\" + filename\n \n puts filename\n file = zf.file.open(file_path)\n parseCellmask(file, pictures.map{ |p| p[i] }.compact)\n file.close\n \n @experiment.import_progress = \"#{@images.length} / #{files.count}\"\n @experiment.save!\n end\n \n pathToAdjacencyList = \"statusflags/adjacencyList\"\n adjacencyListFile = zf.file.open(pathToAdjacencyList)\n parseAdjacencyList(adjacencyListFile)\n adjacencyListFile.close\n end\n end", "title": "" }, { "docid": "7714e4f14ee12985a53d39d545088a4a", "score": "0.44547337", "text": "def create_zip_file_from_output(output_dir,zip_name,file_name)\n begin\n\n Zip::ZipFile.open(\"#{output_dir}/#{zip_name}\", Zip::ZipFile::CREATE) do |file|\n file.add(file_name, \"#{output_dir}/#{file_name}\")\n end\n rescue Exception => e\n Output835.log.error \"Exception => \" + e.message\n Output835.log.error e.backtrace.join(\"\\n\")\n ensure\n #FileUtils.rm \"#{output_dir}/#{file_name}\", :force => true if File.exists?(\"#{output_dir}/#{zip_name}\")\n end\n end", "title": "" }, { "docid": "3e9abe57753bca9367372928816fa16d", "score": "0.44543776", "text": "def payload\n zipfile\n end", "title": "" }, { "docid": "1e35b6cb727d5b85a7218e038855b0b1", "score": "0.4450619", "text": "def build_hash_from_zip(zip_file, hash_to_build)\n yaml_file = zip_file.get_entry(CONFIG_FILES[hash_to_build])\n yaml_content = yaml_file.get_input_stream.read.encode(Encoding::UTF_8, 'UTF-8')\n properties = parse_yaml_content(yaml_content)\n if hash_to_build == :tags\n properties.each { |row| row[:user] = current_role.user_name }\n end\n properties\n end", "title": "" }, { "docid": "fbe2e02874491ba70a331483700a3ae2", "score": "0.44497412", "text": "def archive_scenarios(zip)\n @package_info.scenarios.each do |scenario|\n info = ScenarioInfo.read((@location + scenario + \"pione-scenario.json\").read)\n\n # make the scenario directory\n mkdir_with_time(zip, scenario, (@location + scenario).mtime)\n\n # archive scenario contents\n archive_scenario_document(zip, scenario)\n archive_scenario_info(zip, scenario)\n archive_scenario_inputs(zip, scenario, info)\n archive_scenario_outputs(zip, scenario, info)\n end\n end", "title": "" } ]
79b8fa8f5fffd267a685596138e5d193
Converts self into OrderedHash, so simply returns self.
[ { "docid": "49b746a2593d6a3b5ee202a415fe1574", "score": "0.748532", "text": "def to_ordered_hash\n self\n end", "title": "" } ]
[ { "docid": "f18ebc043773cae8ff300205d1656bcd", "score": "0.81195265", "text": "def to_ordered_hash\n OrderedHash.new(self)\n end", "title": "" }, { "docid": "bd56331c5e151f10079d400ee3327f8d", "score": "0.67572546", "text": "def hash\n to_h.hash ^ self.class.hash\n end", "title": "" }, { "docid": "ed4e04c471ee8330ebaa5356de69ef8b", "score": "0.65828407", "text": "def to_hash\n self\n end", "title": "" }, { "docid": "149979d36710513c3907ae583ed4cc36", "score": "0.6575256", "text": "def to_h\n @hash.dup # duplicate so caller can't change ordering of this hash\n end", "title": "" }, { "docid": "5e03cbb4458c61921d762bc4e1584b8d", "score": "0.65441984", "text": "def to_hash\n @hash.dup\n end", "title": "" }, { "docid": "5e03cbb4458c61921d762bc4e1584b8d", "score": "0.65441984", "text": "def to_hash\n @hash.dup\n end", "title": "" }, { "docid": "588ae5bc6f2a7ec4518d5f1dc7b0d309", "score": "0.65416235", "text": "def to_hash hash=nil\n case hash\n when ::Plist4r::OrderedHash\n @hash = @orig = hash\n when nil\n @hash\n else\n raise \"Must hash be an ::Plist4r::OrderedHash\"\n end\n end", "title": "" }, { "docid": "0e17d9bcbcd99cd1f1aefc505f547654", "score": "0.6519701", "text": "def to_h\n hashify(self)\n end", "title": "" }, { "docid": "0e17d9bcbcd99cd1f1aefc505f547654", "score": "0.6519701", "text": "def to_h\n hashify(self)\n end", "title": "" }, { "docid": "bbec606badf67038cf63a02be274d2b9", "score": "0.64980936", "text": "def unordered\n\t\tcopy = self.clone\n\t\tcopy.unordered!\n\t\treturn copy\n\tend", "title": "" }, { "docid": "d3e8cc7195be2707c41a48e29f528b5c", "score": "0.64759374", "text": "def hash\n @hash ||= super\n end", "title": "" }, { "docid": "a2613b67534d2f1788aa8a6a95ffab4f", "score": "0.6410941", "text": "def to_hash\n Hash.new.replace self\n end", "title": "" }, { "docid": "a2613b67534d2f1788aa8a6a95ffab4f", "score": "0.6410941", "text": "def to_hash\n Hash.new.replace self\n end", "title": "" }, { "docid": "4c8705b5c0fa3db82aef65ac86c44445", "score": "0.64022887", "text": "def hash\n to_s.hash ^ self.class.hash\n end", "title": "" }, { "docid": "57e30279992402331ca956276e706c28", "score": "0.6382978", "text": "def hash\n Util.irccase(self).hash\n end", "title": "" }, { "docid": "bdc43b0af323b6a193eac53a72dba4b1", "score": "0.63708407", "text": "def to_h\n @hash.dup\n end", "title": "" }, { "docid": "17c0276e18868097548bbc1bac678f5e", "score": "0.63538146", "text": "def to_hash\n Hash[self]\n end", "title": "" }, { "docid": "17c0276e18868097548bbc1bac678f5e", "score": "0.63538146", "text": "def to_hash\n Hash[self]\n end", "title": "" }, { "docid": "de2331760f8e096c654490830c523446", "score": "0.6353174", "text": "def as_plain_hash\n if @as_plain_hash_cache.include?(self.hash)\n @as_plain_hash_cache[self.hash]\n else\n result = {}.merge(self)\n\n result.each do |key, values|\n if values.size == 1 then\n result[key] = values.first\n end\n end\n\n if not @value.nil? then\n result[:value] = @value\n end\n\n @as_plain_hash_cache[self.hash] = result\n end\n end", "title": "" }, { "docid": "c1fec039e8f79b86dd81944194aad747", "score": "0.63493526", "text": "def hash\n @hash ||= to_a.hash\n end", "title": "" }, { "docid": "f63d883196af7472008d88e364f9ff10", "score": "0.6324587", "text": "def to_hash\n\t\t{}.merge(self)\n\tend", "title": "" }, { "docid": "8313893a7dc11519a0cf80c5bf3c6d38", "score": "0.6324504", "text": "def hash\n @hash ||= super\n end", "title": "" }, { "docid": "05254d330890ec1125f9db6f174e22fe", "score": "0.63172644", "text": "def hash\n to_hash.hash + self.class.hash\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "8d860d812da6b22ed72c85dc78560da9", "score": "0.6308135", "text": "def to_h\n @_hash.dup\n end", "title": "" }, { "docid": "58fec3dd067b809a522a1adb6f6a7ba6", "score": "0.63040626", "text": "def to_h\n @hash.dup\n end", "title": "" }, { "docid": "5a26831eebc3ae885d5fa99bdbd54001", "score": "0.62835264", "text": "def to_h\n @hash.dup\n end", "title": "" }, { "docid": "5a26831eebc3ae885d5fa99bdbd54001", "score": "0.62835264", "text": "def to_h\n @hash.dup\n end", "title": "" }, { "docid": "6df2798bb0d979d20214799349c70202", "score": "0.6266797", "text": "def to_h\n\t\t@hash.dup\n\tend", "title": "" }, { "docid": "6df2798bb0d979d20214799349c70202", "score": "0.6266797", "text": "def to_h\n\t\t@hash.dup\n\tend", "title": "" }, { "docid": "c9066188a663cea9e73dbbbbf61f8fe5", "score": "0.625984", "text": "def hash\n return (self.normalize.to_s.hash * -1)\n end", "title": "" }, { "docid": "6850b3da5cecad3beeac816ea41853d7", "score": "0.6251732", "text": "def to_hash\n self\n end", "title": "" }, { "docid": "70000ccef998c530771e15b1fda58bf7", "score": "0.6241478", "text": "def hash\n self.class.hash ^ object.hash\n end", "title": "" }, { "docid": "d2c3af3eb7080f296bf34c0359a12f3c", "score": "0.6236822", "text": "def to_hash\n {}.merge self\n end", "title": "" }, { "docid": "d2c3af3eb7080f296bf34c0359a12f3c", "score": "0.6236822", "text": "def to_hash\n {}.merge self\n end", "title": "" }, { "docid": "d2c3af3eb7080f296bf34c0359a12f3c", "score": "0.6236822", "text": "def to_hash\n {}.merge self\n end", "title": "" }, { "docid": "c86c9662ef43026913e8e9cb0197d7f3", "score": "0.62256783", "text": "def invert\n hsh2 = self.class.new\n order.each { |k| hsh2[@hash[k]] = k }\n hsh2\n end", "title": "" }, { "docid": "e198d186eb305f49942891c8d3f1647a", "score": "0.6216658", "text": "def to_hash\n\t\t\treturn @real_hash\n\t\tend", "title": "" }, { "docid": "0af4250ecb4f36ade127e8d006cd284f", "score": "0.62142867", "text": "def hash\n @hash ||= to_s.hash * -1\n end", "title": "" }, { "docid": "556862a1e5ecf94009054cef6f6803ba", "score": "0.6207787", "text": "def to_hash\n call\n @hash = @value\n @hash[:sort] = @sort.to_hash if @sort\n @hash\n end", "title": "" }, { "docid": "52f019a29cfd4395a45222ac4efc1863", "score": "0.6188866", "text": "def hash\r\n @orig.hash\r\n end", "title": "" }, { "docid": "a48f047b05d93ebe6eb76d4723a533a7", "score": "0.61755013", "text": "def hash\n id = self.id\n\n if primary_key_values_present?\n self.class.hash ^ id.hash\n else\n super\n end\n end", "title": "" }, { "docid": "f4f6698c371d8c16a3042834d595a06c", "score": "0.61675537", "text": "def hash\n to_a.hash\n end", "title": "" }, { "docid": "b848d54b6c2add7ef0b09aa3e2319e00", "score": "0.61608833", "text": "def to_h\n Hash[self]\n end", "title": "" }, { "docid": "a13456e2b316e8761a3ebaf446174f6b", "score": "0.61591196", "text": "def to_h\n @hash.dup\n end", "title": "" }, { "docid": "cffd4a03690ca03a300cb0cdeb3f776e", "score": "0.614456", "text": "def hash\n\t\tself.finalize\n\t\treturn @hash\n\tend", "title": "" }, { "docid": "a32a2b1c4ea5806d332e94d82b50b930", "score": "0.6142798", "text": "def hash\n to_h.hash\n end", "title": "" }, { "docid": "b72d70f6fd3462a10314d2e100a6d7b6", "score": "0.61397165", "text": "def to_h_without_circulars\n @hash\n end", "title": "" }, { "docid": "763f4158ed6575d000d37e518c5fccb9", "score": "0.6137439", "text": "def to_ordered_hash(ary)\n OrderedHash[*flatten_first_level(ary)]\n end", "title": "" }, { "docid": "d6fa7a726934925dc512cabf6aaafbd7", "score": "0.6136795", "text": "def hash\n from.hash + to.hash\n end", "title": "" }, { "docid": "721f270e23858e628b56e855a4fd9967", "score": "0.6115331", "text": "def hash\n to_a.hash\n end", "title": "" }, { "docid": "721f270e23858e628b56e855a4fd9967", "score": "0.6115331", "text": "def hash\n to_a.hash\n end", "title": "" }, { "docid": "ce72ff6e39d3a2e058fbb28994d1bef5", "score": "0.61049736", "text": "def hash\n to_hash.hash\n end", "title": "" }, { "docid": "7cc7e07074789be34261146a6f16880d", "score": "0.6098712", "text": "def to_tree_hash\n TreeHash.new(self)\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60958946", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60958946", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60958844", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60958844", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60958844", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60945415", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.60945415", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.6094213", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" }, { "docid": "f54d7a2f9ac0c340d63bf7c3bdecd641", "score": "0.6094183", "text": "def to_hash\n @hash.to_hash\n end", "title": "" }, { "docid": "a5a3c81adec79305642e90404b8bd139", "score": "0.60763735", "text": "def to_hash(keys_case=:underscore)\n\t\t\thash = super\n\t\t\tapply_order(hash)\n\t\t\thash\n\t\tend", "title": "" }, { "docid": "fa3c89dc3ebaf3894f2edd3232d0b3d0", "score": "0.60730535", "text": "def to_h\n ::Hash[self]\n end", "title": "" }, { "docid": "c99e1d0fad6c674e18db6fddbdb0503b", "score": "0.6054476", "text": "def hash\n self.to_s.hash\n end", "title": "" }, { "docid": "aeca949b738bb4e27269cec1f3922f27", "score": "0.6052974", "text": "def to_mash\n ::Hashie::Mash.new(self)\n end", "title": "" }, { "docid": "aeca949b738bb4e27269cec1f3922f27", "score": "0.6052974", "text": "def to_mash\n ::Hashie::Mash.new(self)\n end", "title": "" }, { "docid": "ed3b8194c6c54676488dff953a931a56", "score": "0.6050698", "text": "def hash\n super +\n @values.hash\n end", "title": "" }, { "docid": "2cc50d79690f31719c0033f67ca4c1f8", "score": "0.60418046", "text": "def hash\n if id\n self.class.hash ^ id.hash\n else\n super\n end\n end", "title": "" }, { "docid": "832c04e56b1edf21c6dcdb4206d08857", "score": "0.60338396", "text": "def to_hash\n raise NotImplementedError\n end", "title": "" }, { "docid": "832c04e56b1edf21c6dcdb4206d08857", "score": "0.60338396", "text": "def to_hash\n raise NotImplementedError\n end", "title": "" }, { "docid": "ea89cbcb1093637150da8194eb70d25e", "score": "0.6022679", "text": "def stable_hash\n @stable_hash ||= self._stable_hash\n end", "title": "" }, { "docid": "abee4b29083945e8911fd57672024053", "score": "0.6009656", "text": "def to_h\n\n {}.merge!(self)\n end", "title": "" }, { "docid": "5106c6f3179bf6017a5f01a41a28af89", "score": "0.6007735", "text": "def unordered\n clone(:order => nil)\n end", "title": "" }, { "docid": "25c2569bca1011c03ddda6faaef5d0fd", "score": "0.6005731", "text": "def to_h\n store.deep_dup\n end", "title": "" }, { "docid": "7f8cb648339a08f5845275d39012de0b", "score": "0.59939826", "text": "def hash = other.hash", "title": "" }, { "docid": "3713c700aefd6ced9fb846831e4d0af5", "score": "0.5993063", "text": "def hash\n @__hash || @__hash = keys.empty? ? super : keys.hash\n end", "title": "" }, { "docid": "4227810480ab619ba919700cc7e25f20", "score": "0.5992122", "text": "def hash\n super +\n @value.hash\n end", "title": "" }, { "docid": "4227810480ab619ba919700cc7e25f20", "score": "0.59913355", "text": "def hash\n super +\n @value.hash\n end", "title": "" }, { "docid": "d730a9ea60df6695b2c6a153d7d3a8b7", "score": "0.5979757", "text": "def hash\n as_hash.hash\n end", "title": "" }, { "docid": "338522d5111d1f0df3bdb69a2840423a", "score": "0.5979341", "text": "def to_h\n cached_hash\n end", "title": "" }, { "docid": "6a85c56720f945a00143d7032011bcfe", "score": "0.59770745", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "6a85c56720f945a00143d7032011bcfe", "score": "0.59770745", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "6a85c56720f945a00143d7032011bcfe", "score": "0.59770745", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "73e40ab1ab486f76079a06a97143e60e", "score": "0.597583", "text": "def ordered_hash\n PuppetX.const_get(\"SIMP#{Puppet[:environment]}\").const_get('CMOrderedHash').new\n end", "title": "" }, { "docid": "9723125abe34a08e67ddb106f17b51f8", "score": "0.59676456", "text": "def to_hash\n to_hash_as\n end", "title": "" }, { "docid": "d59d5cca0679f5d6577a66c530b12904", "score": "0.59593755", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "d59d5cca0679f5d6577a66c530b12904", "score": "0.59593755", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "d59d5cca0679f5d6577a66c530b12904", "score": "0.59593755", "text": "def hash\n [self.class, to_h].hash\n end", "title": "" }, { "docid": "4f4d1bf6d2d7ec9cc8cf0098cb6635fe", "score": "0.5952604", "text": "def raw_hash_form\n {}.merge(self)\n end", "title": "" }, { "docid": "d7315f03f2a46216ff9151063e429195", "score": "0.59503996", "text": "def hash\n @_hash ||= _hash\n end", "title": "" }, { "docid": "d7315f03f2a46216ff9151063e429195", "score": "0.59503996", "text": "def hash\n @_hash ||= _hash\n end", "title": "" }, { "docid": "d7315f03f2a46216ff9151063e429195", "score": "0.59503996", "text": "def hash\n @_hash ||= _hash\n end", "title": "" }, { "docid": "394b85e42986f180a752d32aaae96e17", "score": "0.59496176", "text": "def to_hash\n @hash\n end", "title": "" }, { "docid": "394b85e42986f180a752d32aaae96e17", "score": "0.59496176", "text": "def to_hash\n @hash\n end", "title": "" } ]
ecb32aa423b62b8dc97da744ba73440f
allow retrieval of borrowers by category.
[ { "docid": "f3c2c8e819b87f1992599e2c066d6823", "score": "0.53981656", "text": "def byCategory\n @borrower = Borrower.find(:all, :conditions => [ \"category = ?\" , params[:category]])\n @borrower.each{|b|\n b[:current_amount] = 0;\n @tran = Transaction.find(:all, :conditions => [\"borrower_id = ?\" , b[:borrower_id]]);\n @tran.each{|tr|\n b[:current_amount]=b[:current_amount]+tr[:amount]\n }\n }\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "title": "" } ]
[ { "docid": "58df5b1221781b09d422fbd20cfd69a2", "score": "0.6130112", "text": "def get_borrower(book_id)\n #Runs through all books in the library and finds the one\n #that matches the id, then looks at the borrower\n #Currently no error protection if the book isn't borrowed\n @books.each do |book|\n return book.borrower.first.name if book.id == book_id\n end\n end", "title": "" }, { "docid": "b906d0d20d602fcdcf0bc0e09c1511d9", "score": "0.58084846", "text": "def category\n booking_lines and booking_lines.size > 0 ? ::Yito::Model::Booking::BookingCategory.get(booking_lines[0].item_id) : nil\n end", "title": "" }, { "docid": "3baa60c8471144a4879b4a5da4f8b960", "score": "0.5790617", "text": "def find_owner_cat\n @cat = @owner.cats.find_by!(id: params[:id]) if @owner\n end", "title": "" }, { "docid": "66d324221c8991bb54f68ee379916515", "score": "0.5784136", "text": "def category()\n if (order_in_lines.length == 1)\n cat = order_in_lines[0].book_keeping_category\n if (cat)\n return cat.name\n else\n return \"?\"\n end\n else\n return \"?\"\n end\n end", "title": "" }, { "docid": "f94b9104da65960ca5f4f0bc10c8c19b", "score": "0.5766456", "text": "def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end", "title": "" }, { "docid": "31695ef08e8577cd41c6b45221be8393", "score": "0.57572967", "text": "def get_pool\n return Pool.where({\"category_id\" => self.id})\n end", "title": "" }, { "docid": "508c77fa84938129b6568aa9b26c02cc", "score": "0.5730263", "text": "def get_categories\n @redis.smembers category_collection_key\n end", "title": "" }, { "docid": "a9dd6f88a038b73880672a38db32b073", "score": "0.57128465", "text": "def get_related_to(category)\n raise \"Cannot do a look-up with a blank category!\" if category.blank?\n collection = self.class.new\n collection.kinds = @kinds.get_related_to(category)\n collection.mixins = @mixins.get_related_to(category)\n collection\n end", "title": "" }, { "docid": "99f556cf1cee45bb926693bc0797098f", "score": "0.56119597", "text": "def getCategories(_, _, _)\n @db.categories\n end", "title": "" }, { "docid": "27f03059a086169bf4ac386a0d0c0b7f", "score": "0.5521722", "text": "def get_category(category)\n CATEGORIES[category.downcase]\n end", "title": "" }, { "docid": "b7894fa2b53e6bb0410bfd032b935ae6", "score": "0.55060995", "text": "def cats \n Cat.all.select {|one_cat| one_cat.owner == self} \n end", "title": "" }, { "docid": "9750168db7c8d1a70934e771e34dd152", "score": "0.54884887", "text": "def objects_in_category(category_type_, *category_spec_)\n @config.lock\n\n return nil unless @categories.include?(category_type_)\n spec_ = category_spec_.size == 1 && category_spec_.first.is_a?(::Array) ? category_spec_.first : category_spec_\n tuple_hash_ = (@catdata[category_type_] ||= {})[spec_]\n tuple_hash_ ? tuple_hash_.values.map{ |objdata_| objdata_[0] } : []\n end", "title": "" }, { "docid": "f47d1681682084fd115f48ee2f76caf7", "score": "0.54781884", "text": "def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n candidates = candidates_for_name(singularize_name(category.name, category.head), @category_filters)\n if !candidates.empty?\n candidate_set = create_candidate_set(category.name,candidates)\n else\n candidate_set = candidate_set_for_syntax_trees(category.head_trees,@category_filters)\n end\n if candidate_set.empty?\n candidates = candidates_for_name(category.name, @category_filters)\n candidate_set = create_candidate_set(category.name,candidates) unless candidates.empty?\n end\n @category_cache[category] = candidate_set\n end", "title": "" }, { "docid": "0d2e80073c747bfc6e738172efedd9fc", "score": "0.54689217", "text": "def borrower\n end", "title": "" }, { "docid": "f57d95be77bcb4f47aef18495123220b", "score": "0.545241", "text": "def cats \n Cat.all.select do |cat_instance|\n cat_instance.owner == self \n end\n end", "title": "" }, { "docid": "fc8fe2572f935e5b8a87b4d00253ff8f", "score": "0.5432766", "text": "def borrowed_books\n @borrowed_books\n end", "title": "" }, { "docid": "fc8fe2572f935e5b8a87b4d00253ff8f", "score": "0.5432766", "text": "def borrowed_books\n @borrowed_books\n end", "title": "" }, { "docid": "9346bd7e4aefa835d6ccf0f7e73431de", "score": "0.54223025", "text": "def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n # from whole name singularized\n candidates = []\n decorated_category = Cyclopedio::Syntax::NameDecorator.new(category, parse_tree_factory: @parse_tree_factory)\n @nouns.singularize_name(category.name, decorated_category.category_head).each do |name_singularized|\n candidates.concat(candidates_for_name(name_singularized,@category_filters))\n end\n candidate_set = create_candidate_set(category.name,candidates)\n return @category_cache[category] = candidate_set if !candidate_set.empty? || @category_exact_match\n # from simplified name\n candidate_set = candidate_set_for_syntax_trees(decorated_category.category_head_trees,@category_filters)\n return @category_cache[category] = candidate_set unless candidate_set.empty?\n # from original whole name\n candidate_set = candidate_set_for_name(category.name, @category_filters)\n @category_cache[category] = candidate_set\n end", "title": "" }, { "docid": "0e2d548edef70479e835f35698db9d06", "score": "0.54092103", "text": "def ticket_category\n ticket.category if ticket\n end", "title": "" }, { "docid": "c86f5c82a998abec43af186312301966", "score": "0.539138", "text": "def cats\n Cat.all.select {|cat| cat.owner == self}\n end", "title": "" }, { "docid": "3c6b75358c380b33c8b025e819c65514", "score": "0.53683746", "text": "def cats\n Cat.all.select do |cat| \n cat.owner == self \n end \n end", "title": "" }, { "docid": "c179370c14f8de34831adda18e992c38", "score": "0.5362316", "text": "def cats\n\t\t# Note that you call upon the other class within this class.\n\t\tCat.all.select do |cat|\n\t\t\tcat.owner == self\n\t\tend\n\tend", "title": "" }, { "docid": "678fd7f28149ca6b8f96b867c00ccf13", "score": "0.53618425", "text": "def category\n self.item.category\n end", "title": "" }, { "docid": "989e0f5de3be910138d671d1cfc0afde", "score": "0.53397715", "text": "def cats\n Cat.all.select do |cat|\n cat.owner == self\n end\n end", "title": "" }, { "docid": "0bdc15edfe166dbe01c2a4ebfea7c90a", "score": "0.5337586", "text": "def cats\n Cat.all.select { |cats| cats.owner == self }\n end", "title": "" }, { "docid": "ba972d2983e7117f6a5b8f7e60d47cf5", "score": "0.5325324", "text": "def category\n client.categories.find(data[\"categoryId\"])\n end", "title": "" }, { "docid": "b0b679ef30daafa268dd4098ea219d09", "score": "0.53219104", "text": "def get_category_info\n category = self.category_id\n return Category.find_by_id(category)\n end", "title": "" }, { "docid": "24f79df36d968cf33a8381dee3e50f78", "score": "0.52990466", "text": "def cards_in_category(sel_category)\n @cards.select do |card|\n card.category == sel_category\n end\n end", "title": "" }, { "docid": "e6937a149d00f76aadfe80c84cc7e9e9", "score": "0.52976596", "text": "def cats\n #loop through .all class method for the class Cat\n #select the value for variable cat and return it to a new array\n #every time cat.owner == self is true\n Cat.all.select do |cat|\n #block determines true value\n cat.owner == self #returns if true\n end\n end", "title": "" }, { "docid": "892b64c4a5ddfa6fd87f4441aa60912c", "score": "0.5296966", "text": "def category\n revision.category\n end", "title": "" }, { "docid": "53cdf3acd599b1b28716837571439acc", "score": "0.52786225", "text": "def check_category!\n if self.category and (not self.category.saved?) and loaded = BookingCategory.get(self.category.code)\n self.category = loaded\n end\n if self.rental_storage and (not self.rental_storage.saved?) and loaded = RentalStorage.get(self.rental_storage.id)\n self.rental_storage = loaded\n end\n end", "title": "" }, { "docid": "023167777c49f915e09c3a492ce3f476", "score": "0.52785337", "text": "def buy_cat(name)\n #passing a name and this owner object into the cat object\n cat = Cat.new(name, self) \n @cats << cat\n \n end", "title": "" }, { "docid": "b0745b066af7dacd61317054ea30728f", "score": "0.5263503", "text": "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "title": "" }, { "docid": "291c3ac012820b20ee940e983fbcd6be", "score": "0.5259053", "text": "def categories\n category\n end", "title": "" }, { "docid": "dc4e20641bca1c3af9028d47d9e58165", "score": "0.5258394", "text": "def client\n result = contact_categories.first(:conditions => {:category_type => Client.to_s})\n result ? result.category : nil\n end", "title": "" }, { "docid": "3a6208c54693af5dd73c4ac7ebb9656e", "score": "0.5251612", "text": "def category\n data['category']\n end", "title": "" }, { "docid": "07615d4c23189db77fc325abd00b7f67", "score": "0.52376413", "text": "def category; end", "title": "" }, { "docid": "9d2d49c18d3f9beac2458ef11dc238f5", "score": "0.52166885", "text": "def get_category\n current_category = self.category.name\n end", "title": "" }, { "docid": "4de0189e6aa1620732542b4b2a4e842e", "score": "0.5215381", "text": "def category_object\n task = Todo.find_by_id(self.todo_id)\n category = Categories.find_by_id(task.category_id)\n return category\n end", "title": "" }, { "docid": "8ae704fbf8559a87f4a1f76ca386dfb8", "score": "0.5209954", "text": "def category_index\n @name = params[:category]\n \n category = Category.where(name: @name)\n \n #get bookmarks\n if category.empty? || category == nil\n redirect_to :root\n else\n category = category[0]\n @results = []\n\n category.bookmarks.each do |b|\n user_url = \"/\" + b.user.name\n entry = {id: b.id, url: b.url, title: b.title, user: b.user, name: b.user.name, user_url: user_url }\n @results.push(entry) \n end\n end\n \n #check to see if user is a subscriber\n if user_signed_in? && category.subscriber?(current_user)\n @is_subscriber = true\n else\n @is_subscriber = false\n end\n\n #check to see if user is moderator\n if user_signed_in? && category.moderator?(current_user)\n @is_moderator = true\n end\n \n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "93404993c8914cdef29d72a01c5268a9", "score": "0.5209061", "text": "def category\n return @category\n end", "title": "" }, { "docid": "436e3a4445639ef38a2dc76a0639a78e", "score": "0.5199957", "text": "def rooms_from_category(category)\n rooms.find_all do |room|\n room.category(:bedroom)\n end\n require \"pry\"; binding.pry\n end", "title": "" }, { "docid": "8231d71e31facc3017b01da376e9c7b2", "score": "0.5187083", "text": "def borrowable_items\n# items.where(\"borrower_id = 0\")\n Item.all.where(\"borrower_id = 0 and lender_id != :owner\", {owner: self.id})\n end", "title": "" }, { "docid": "2dfc1b3fc44d0089d4a335bb4092f6c4", "score": "0.518261", "text": "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "title": "" }, { "docid": "f368c3c8d9a88fbdf11aa5ac4969b5f8", "score": "0.516958", "text": "def get_category(cookbook_name)\n # Use Artifactory deployment logic only if flag sent by Artifactory plugin\n unless config[:artifactory_deploy]\n Chef::Log.debug('[KNIFE-ART] ArtifactoryShare::get_category called without artifactory flag, delegating to super')\n return orig_get_category(cookbook_name)\n end\n begin\n data = noauth_rest.get(\"#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}\")\n if data.nil?\n return data[\"category\"]\n else\n return 'Other'\n end\n rescue => e\n return \"Other\" if e.kind_of?(Net::HTTPServerException) && e.response.code == \"404\"\n ui.fatal(\"Unable to reach Supermarket: #{e.message}. Increase log verbosity (-VV) for more information.\")\n Chef::Log.debug(\"\\n#{e.backtrace.join(\"\\n\")}\")\n exit(1)\n end\n\n end", "title": "" }, { "docid": "361f3b42cde790e79fd3fcd7680a349f", "score": "0.5167014", "text": "def category\n # {{{\n if !@category then\n @category = Category.find(1).with(:is_private.is('t') & \n :category_id.in(User_Category.select(User_Category.category_id) { |cid| \n cid.where(User_Category.user_group_id == user_group_id)\n })).entity\n @category = Category.unassigned_category unless @category\n end\n @category\n end", "title": "" }, { "docid": "097175eac4d7f48bb988381f11bd9f23", "score": "0.5164778", "text": "def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end", "title": "" }, { "docid": "fe8dc6c3d4d606fdae87458dca47bf9c", "score": "0.5153886", "text": "def get_lookups\n\t @categories = Category.ordered \n\t\t@ownerships = Ownership.ordered\n end", "title": "" }, { "docid": "0b1a733c54a99e526e5db8c2cb3e8df5", "score": "0.515255", "text": "def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name, self)\n else \n brand_new_cat = Cat.new(cat, self)\n end \n end", "title": "" }, { "docid": "86b5f31fb11784a4faa4113aa467c7ef", "score": "0.5142886", "text": "def return_categories(key)\n if $redis.exists(key)\n categories = JSON.parse($redis.get(key))\n categories\n else\n data = fetch_categories()\n current_categories = []\n data.each do |child|\n add_category(key, child, current_categories)\n end\n return_categories(key)\n end\nend", "title": "" }, { "docid": "adffe62a7f0e8a96c4936ecab19b2794", "score": "0.51426584", "text": "def user\n result = contact_categories.first(:conditions => {:category_type => User.to_s})\n result ? result.category : nil\n end", "title": "" }, { "docid": "11d06bd305ddab5eb6d7a6206e8bffce", "score": "0.5141986", "text": "def get_category\n \t\t@category = Category.find(params[:category_id])\n end", "title": "" }, { "docid": "0aa66da6df67d07cb4503f26e84570a2", "score": "0.51416594", "text": "def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end", "title": "" }, { "docid": "637d40dc80f9a09d877207e872e028f4", "score": "0.51280916", "text": "def category\n @ole.Category\n end", "title": "" }, { "docid": "d2699ea5ba049c008fab99c88879c74a", "score": "0.5121543", "text": "def find_associated_records\n if category and (category.new_record? or category.dirty?)\n if category.name.blank?\n self.category = nil\n else\n existing_category = Category.find_by_name(category.name)\n self.category = existing_category if existing_category\n end\n end\n end", "title": "" }, { "docid": "924d233545d46cc18d84270476b3973f", "score": "0.51171005", "text": "def category\n categories[0].id\n end", "title": "" }, { "docid": "acef281613fa7c0b8d92d4a8c17467ca", "score": "0.50980204", "text": "def category_name\n object.category.name rescue \"\"\n end", "title": "" }, { "docid": "f0e4e07e981197a2110703b3489a2ba3", "score": "0.5096284", "text": "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "title": "" }, { "docid": "c3b53a4ef28bbe2ab2828e2518c4f083", "score": "0.5093911", "text": "def category\n @data['category']\n end", "title": "" }, { "docid": "56d10198481012ce9b4588e696c6e074", "score": "0.50921077", "text": "def compare_catetegory category_name\n condition=\"%#{category_name}%\"\n category=Category.where(\"name like ? \",condition).first\n if category.nil?\n category=Category.create name:category_name\n end\n return category\n end", "title": "" }, { "docid": "a61738f256c0870b1428da75bd9249b3", "score": "0.5083454", "text": "def category(name)\n @categories.find { |c| c.name == name}\n end", "title": "" }, { "docid": "296a6d559e5700ddf0cf1dd990bf6e4e", "score": "0.5070418", "text": "def get_character_achievements_category(achievement_category, name = @character_name, options = {})\n\t\t options = character_options(name, options)\n\t\t\toptions[:achievement_category] = achievement_category.to_i\n\t\t \n\t\t character_achievements_category = get_xml(@@character_achievements_url, options)\n\t\t \n\t\t return Wowr::Classes::AchievementsList.new(character_achievements_category, self)\n\t end", "title": "" }, { "docid": "5cd1e70faa0af7be1fdb62089bd37e9c", "score": "0.506983", "text": "def category_name \n\tself.category.name \n end", "title": "" }, { "docid": "0f8998ef229da92c2be79b990d48035c", "score": "0.5068298", "text": "def user_available_categories\n Category.select('name').\n where(\"user_id = ?\", current_user.id).\n pluck(:name)\n end", "title": "" }, { "docid": "7d246ddef94b5e3e103c9723a750ad80", "score": "0.5065911", "text": "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "title": "" }, { "docid": "d4aadd0cbd74e0019fe1d93e24419de6", "score": "0.5063942", "text": "def borrow\n @book.borrow(@user)\n render json: { object: 'Loan' }, status: :created\n rescue Exceptions::NoBookCopies\n # Not available copies for a new loan:\n render json: { object: 'Book'}, status: :conflict if @book.available == 0\n rescue Exceptions::LowAccountBalance\n # User haven't enougth balance:\n render json: { object: 'User'}, status: :conflict if @user.amount - @book.fee < 0\n end", "title": "" }, { "docid": "471bd2f8d7c3633488d85361698a0cbd", "score": "0.50630856", "text": "def subcontract_category; end", "title": "" }, { "docid": "dd0fd54b23472ba0430ed36bfa22198e", "score": "0.50586724", "text": "def category\n category_id = self.category_id;\n\n if (category_id)\n puts(\"Category ID found in time_record: \" + category_id.to_s);\n\n category = Category.find_by_id(category_id);\n\n if (category)\n puts(\"Category OBJECT found in quota: category: \" + category.name);\n return category\n else\n puts(\"Category OBJECT NOT found in quota: category_id: \" + category_id.to_s);\n return nil\n end\n\n else\n return nil\n end\n end", "title": "" }, { "docid": "f3dd975ed7d641ef5e5dc7eeb5f14e11", "score": "0.50497496", "text": "def borrow(book_id, user_id)\r\n @@books.each do |book|\r\n @@users.each do |user|\r\n if book.bookID == book_id && user.userID == user_id\r\n if book.status == \"available\"\r\n book.borrower = (user.fname+\" \"+user.lname)\r\n book.status = \"borrowed\"\r\n user.bookBorrowed = book.title\r\n puts(\"\\nFollowing user has borrowed the following book: \")\r\n puts(\"User : #{user.inspect}\")\r\n puts(\"Book : #{book.inspect}\")\r\n else\r\n puts \"\\nSorry! the selected book #{book.bookID} is currently not available and cannot be lend to #{user.userID}; \\nbecause it is borrowed by user : #{book.borrower}\" end\r\n end\r\n end\r\n end\r\n end", "title": "" }, { "docid": "64172282b9ddc45b5c65feeee0be2dc9", "score": "0.5037856", "text": "def retrieve_cards(category)\n self.unused_cards = Card.where(category: Category.find_by(name: category)).where.not(id: self.used_cards).pluck(:id).shuffle if self.unused_cards.empty?\n return [Card.find(self.unused_cards[0]), Card.find(self.unused_cards[1])]\n end", "title": "" }, { "docid": "430de463893d1974131d271c61269257", "score": "0.50370556", "text": "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "title": "" }, { "docid": "2c879c0086d2952af619970f79f91325", "score": "0.5035327", "text": "def get_category\n @category = Category.find(params[:id])\nend", "title": "" }, { "docid": "893e15882ac32a3b0b319d90ccae6a83", "score": "0.50258917", "text": "def set_contractor_category\n @contractor_category = ContractorCategory.find(params[:id])\n end", "title": "" }, { "docid": "b42117fe60e6bffa977fd5f8472e941a", "score": "0.5003358", "text": "def get_category_balance(category_name)\n category = CategoriesHelper.get_category(session[:current_user_id],\n session[:account_name], category_name)\n CategoriesHelper.get_category_entries_total category[:id]\n end", "title": "" }, { "docid": "0d6fd8990d188ee5619332494c5d62aa", "score": "0.49997687", "text": "def borrow(book)\n\t\t@checked_out_books << book\n\tend", "title": "" }, { "docid": "424cf475cf67e78712fa42c5f7cfcc50", "score": "0.49985936", "text": "def crumbs_by\n crumb_or_custom_class.all(:creator_id => self[Redcrumbs.creator_primary_key], :order => [:created_at.desc])\n end", "title": "" }, { "docid": "1599ab6a5b00045b74d80573d3ce7d89", "score": "0.49936342", "text": "def _category\n @_category ||= if category\n category\n elsif special_category\n special_category\n else\n nil\n end\n end", "title": "" }, { "docid": "3efba7d31a63fa7da2291f09de41fdbc", "score": "0.49928218", "text": "def set_borrower\n @borrower = Borrower.find(params[:id])\n end", "title": "" }, { "docid": "48b1d1f712206967bad676291945a00b", "score": "0.4990299", "text": "def category22\n return @category22\n end", "title": "" }, { "docid": "16ebe982f94bd3605cc1fb6dca21e72f", "score": "0.49865976", "text": "def category_name\n category.try(:name)\n end", "title": "" }, { "docid": "64631b9852bf540ad0e025f17b293537", "score": "0.49861646", "text": "def show\n if params[:id].to_i < 1\n pl = Permalink.find_by_url(params[:id])\n @category = pl ? pl.linkable : Category.first\n else\n @category = Category.find(params[:id])\n end\n if @category.public || current_user\n # Fetch Postings\n @items = @category.categorizables.descend_by_updated_at.paginate(:page => params[:page], :per_page => POSTINGS_PER_PAGE)\n # Append other 'categorizable' models to @items here...\n else\n flash[:error] = t(:this_category_is_not_public,:name => @category.name)\n redirect_to categories_path\n end\n end", "title": "" }, { "docid": "6a5f7b3bfd23ecefc10ba3adc9bbb4d8", "score": "0.49801928", "text": "def category_of_subject subject, &block\n found_cat = categories.select {|cat| cat.include? subject }\n yield found_cat if cat && block\n found_cat\n end", "title": "" }, { "docid": "db13fc1490375603463b32d016196561", "score": "0.4979489", "text": "def get_category_balance(category_name)\n category_id = CategoriesHelper.get_category_id(session[:current_user_id],\n session[:account_name], category_name)\n @category_balance = CategoriesHelper.get_category_entries_total category_id\n end", "title": "" }, { "docid": "e121d21472fb6935a7578161e72211e5", "score": "0.49787483", "text": "def by_category\n @category = Category.roots.find_by_slug(params[:category])\n raise ListingException, \"missing category\" if @category.blank?\n @subcategory = @category.children.find_by_slug(params[:subcategory]) if params[:subcategory].present?\n terms = [ListingFilter.category(@subcategory.present? ? @subcategory.id : @category.id), ListingFilter.state('active')]\n query = {filter: {bool: {must: terms}}, sort: {id: \"desc\"}}\n @listings = Listing.search(query).page(page).per(per).records\n\n @subcategories = @category.children.with_listings\n\n @title = [@category.name, @subcategory.try(:name)].compact.join(\" : \") + \" | Category\"\n\n respond_to do |format|\n format.html { render(action: :index, layout: !request.xhr?) }\n end\n end", "title": "" }, { "docid": "f078c51b00680ac3d94ad346552fc0fe", "score": "0.49776727", "text": "def find_category(specified_category)\n if specified_category.is_a?(String) || specified_category.is_a?(Symbol)\n Category.find_by_name(specified_category)\n else\n Category.find_by_id(category_id)\n end\n end", "title": "" }, { "docid": "ce1428c71cd866b370d5fe139c430ddd", "score": "0.49776137", "text": "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "title": "" }, { "docid": "75fcd1b8dd12daebd46ad5c3ef3a9667", "score": "0.49729198", "text": "def chalkler_bookings\n h = Hash.new {|h, c| h[c] = @booking_set.bookings.select{|b| b.chalkler == c } }\n @booking_set.bookings.collect(&:chalkler).uniq.compact.map {|c| h[c] }\n h\n end", "title": "" }, { "docid": "6e3f323b8929ca6fe410f52935388f9b", "score": "0.49686563", "text": "def borrow\n # This instance method is how a book is taken out of the library. Otherwise, use current_due_date to set the due_date of the book and move it from the collection of available books to the collection of books on loan, then return true.\n # This method should use lent_out? to check if the book is already on loan,\n if self.lent_out? == false\n @@due_date = Book.current_due_date\n @@on_shelf.delete(self)\n @@on_loan << self\n return true\n else\n return false\n end\n\n end", "title": "" }, { "docid": "f550b620b69020c219a51992d705c742", "score": "0.49675265", "text": "def cards_in_category(category)\n # Accumulate cards that match the input category using\n @cards.find_all do |card|\n card.category == category\n end\n end", "title": "" }, { "docid": "5d422751469ce77c891e4a7a4b97fb09", "score": "0.4965453", "text": "def category_name\n parse_cookbook_json do |parsing_errors, json|\n if parsing_errors.any?\n \"\"\n else\n json.fetch(\"category\", \"\").to_s\n end\n end\n end", "title": "" }, { "docid": "d0e67f44def762be9b806e1be19d6b46", "score": "0.4964571", "text": "def categories_for(race)\n case race.name\n when \"Junior Men\", \"Junior Women\"\n [ Category.find_or_create_by(name: race.name) ]\n else\n super race\n end\n end", "title": "" }, { "docid": "3f5ba25356f3f110797a8f12dde545ca", "score": "0.4959383", "text": "def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend", "title": "" }, { "docid": "005948e31d45dfec16a5e60f8a013d41", "score": "0.49556473", "text": "def category\n @services = Service.where(\"category = ?\", params[:category])\n @category = Service.categories.key(params[:category].to_i)\n end", "title": "" }, { "docid": "353b6117f976df7a24cf874d913bfdfe", "score": "0.49545002", "text": "def category_name\n c =StudentCategory.find(self.receiver_id)\n c.name unless c.nil?\n end", "title": "" }, { "docid": "4949a10e30e5d9a734dda52bd4a39ab4", "score": "0.49524444", "text": "def category_name \n self.category ? self.category.name : nil\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "69de6be62677f59c49b1af066a7431b2", "score": "0.0", "text": "def set_product_category\n @product_category = ProductCategory.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163821", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045432", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5945441", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.5916224", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58894575", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.5834073", "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.57764685", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5702474", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5702474", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.5653258", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.56211996", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54235053", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410683", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410683", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5410683", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53948104", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.5378064", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5356684", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53400385", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53399503", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53312254", "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.53121567", "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.52971965", "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.52964705", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.52956307", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52587366", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52450675", "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.5237777", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237777", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237777", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237777", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5237777", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.5233381", "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.52325714", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.52288216", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52229726", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.5218362", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52142864", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.5207988", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.5206337", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.51762295", "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.51745105", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51728606", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.516616", "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.5161016", "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.5157393", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.5152562", "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": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51524293", "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.5152397", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.5144533", "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.513982", "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.51342106", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5113793", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5113793", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5113671", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51092553", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.51062804", "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.50921935", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5088855", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5082236", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.5079901", "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.5066569", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.5055307", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5053106", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50499666", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50499666", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5035068", "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.50258636", "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.50220853", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015893", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50134486", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5001442", "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.50005543", "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.4998581", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.49901858", "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.49901858", "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.4986648", "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.49809486", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49792925", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.4978855", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49685496", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49656174", "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.49576473", "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.49563017", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4955349", "text": "def around_hooks; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.49536878", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.4952439", "text": "def save_action; end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49460214", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.494239", "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.49334687", "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.49315962", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49266812", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49261138", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.4925925", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4922542", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.4920779", "text": "def advice\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49173284", "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": "99a608ac5478592e9163d99652038e13", "score": "0.49169463", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.4916256", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49162322", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49156886", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" } ]
a7fb658e67d77568a2e58c3137c07d89
Add support for retrieving images by their size, e.g. 32x32, 16x16, etc.
[ { "docid": "e02d7633ae83120a354cd1798af23b1a", "score": "0.67813855", "text": "def method_missing(sym, *args, &block)\n if sym.to_s =~ /^(\\d+)x(\\d+)$/\n image_by_size $1, $2\n else\n super\n end\n end", "title": "" } ]
[ { "docid": "cd330413619a0a144987c6cf7eecfbf1", "score": "0.7604971", "text": "def images (size_requested = 'all')\n returned_images = []\n images = @record.fetch('ImageInfo', {})\n if images.count > 0\n images.each do |image|\n if size_requested == image['Size'] || size_requested == 'all'\n returned_images.push({size: image['Size'], src: image['Target']})\n end\n end\n end\n returned_images\n end", "title": "" }, { "docid": "340ec3a4660504e96edd60c87a117561", "score": "0.73710096", "text": "def with_size\n @with_size ||= begin\n img_nodes = parsed.search('//img').select{ |img_node| img_node['src'] }\n imgs_with_size = img_nodes.map do |img_node|\n [URL.absolutify(img_node['src'], base_url, normalize: false), img_node['width'], img_node['height']]\n end\n imgs_with_size.uniq! { |url, width, height| url }\n if @download_images\n imgs_with_size.map! do |url, width, height|\n width, height = FastImage.size(url) if width.nil? || height.nil?\n [url, width.to_i, height.to_i]\n end\n else\n imgs_with_size.map! do |url, width, height|\n width, height = [0, 0] if width.nil? || height.nil?\n [url, width.to_i, height.to_i]\n end\n end\n imgs_with_size.sort_by { |url, width, height| -(width.to_i * height.to_i) }\n end\n end", "title": "" }, { "docid": "d67821dda82cf4ad02561770ac88f6b1", "score": "0.733194", "text": "def image_by_size(width, height)\n if entry = @entries.find {|e| e[:width] == width && e[:height] == height }\n extract_image entry\n end\n end", "title": "" }, { "docid": "2ebe10b51b449f54e121a9674b9f0221", "score": "0.7231292", "text": "def dc_image_get_by_size(file_name, size)\n id = file_name[file_name.rindex('/') + 1, 24]\n return 'error: ID not valid' unless BSON::ObjectId.legal?(id)\n\n image = DcImage.find(id)\n return 'error: ID not found' unless image\n\n what = %w[o s m l].inject('l') do |r, e|\n field_name = \"size_#{e}\".to_sym\n break e if doc.send(field_name) == size\n e\n end\n \"/#{dc_get_site.params.dig('dc_image', 'location')}/#{doc.id}-#{what}.#{doc.img_type}\"\nend", "title": "" }, { "docid": "a0c4fff3453be7dd831a775aceee74d1", "score": "0.7091222", "text": "def images(size: 'square')\n if persisted?\n all_images.collect { |image| image[size] }\n else\n ([primary_image] + extra_images.to_s.split('|')).compact\n end\n end", "title": "" }, { "docid": "d55c8421b0057c26b53ec3b92dbe2b93", "score": "0.7060274", "text": "def with_size\n @with_size ||= begin\n img_nodes = parsed.search('//img')\n\n imgs_with_size = img_nodes.map do |img_node|\n if img_node['srcset']\n img_with_size_from_srcset(img_node)\n else\n src_value = img_node.attr('data-src') || img_node.attr('data-image') || img_node.attr('data-img') || img_node.attr('src')\n if src_value.present?\n [URL.absolutify(src_value.strip, base_url, normalize: false), img_node['width'], img_node['height']]\n end\n end\n end\n\n imgs_with_size += bg_and_other_imgs(parsed)\n\n imgs_with_size.compact!\n\n imgs_with_size.uniq! { |url, width, height| url }\n\n # Remove any urls that have been blacklisted\n imgs_with_size.reject! { |url| @image_blacklist_words.any? { |blacklist_word| url&.first.nil? || url.first.include?(blacklist_word) } }\n\n # After rejecting blacklisted and duplicated images, only take the first @max_image_downloads if this option is specified.\n # This can help avoid really long run times in the event there are a huge number of images on the page.\n imgs_with_size = imgs_with_size.first(@max_image_downloads) if @max_image_downloads\n\n if @download_images\n imgs_with_size.map! do |img_with_size|\n image_with_meta(img_with_size)\n end\n\n if @reject_invalid_images && @fetch_all_image_meta\n imgs_with_size.select! do |img_with_size|\n _url, _width, _height, _file_type, _file_size, valid = img_with_size\n valid\n end\n end\n else\n imgs_with_size.map! do |url, width, height|\n width, height = [0, 0] if width.nil? || height.nil?\n [url, width.to_i, height.to_i]\n end\n end\n imgs_with_size.sort_by { |url, width, height| -(width.to_i * height.to_i) }\n end\n end", "title": "" }, { "docid": "6eaf247377f0bb02019edd0c5c60fb26", "score": "0.69999003", "text": "def image_url(size = 150)\n self.images.find { |img| img.width == size }.to_s\n end", "title": "" }, { "docid": "5149493db1453f206df6086f24f887f1", "score": "0.69463974", "text": "def image_for_id_at_size(id, size) \n \"#{CANMORE_URL}/images/#{size}/#{id}/\"\n end", "title": "" }, { "docid": "b445ac7964a80c65f072a48bd0a7ec63", "score": "0.6931332", "text": "def image_dimensions(size=:default)\n {\n :thumbnail => \"_square\",\n :default => \"?w=80&h=80\",\n :medium => \"?w=125&h=125\",\n :large => \"_thumb\"\n }\n end", "title": "" }, { "docid": "2ac752b857850b4c87c1782cfed7b7c7", "score": "0.6893175", "text": "def dc_image_choices_for_image_size\n sizes = dc_get_site.params.dig('dc_image', 'sizes')\n return ['300x200'] if sizes.blank?\n\n sizes.split(\",\").map(&:strip)\nend", "title": "" }, { "docid": "8313fb53f2e62b05a6f108f46a68c461", "score": "0.68621737", "text": "def images(size = {})\n expect! size => Hash\n [avatar(size)].compact\n end", "title": "" }, { "docid": "d3865946a985b59d19e97bde5c174ed6", "score": "0.68071955", "text": "def show\n\n matches = params[:size].match(\"([0-9]+)x([0-9]+).*\") if params[:size]\n\n default_size = 200\n min_size = 16\n max_size = 200\n\n if matches\n\n width = matches[1].to_i\n height = matches[2].to_i\n\n if ((width < min_size) || (width > max_size) || (height < min_size) || (height > max_size))\n width = default_size\n height = default_size\n end\n\n else\n width = 200\n height = 200\n end\n \n send_cached_data(\"public/pictures/show/#{width.to_i}x#{height.to_i}/#{params[:id].to_i}.jpg\",\n :type => 'image/jpeg', :disposition => 'inline') {\n find_picture\n img = Magick::Image.from_blob(@picture.data).first\n img = img.change_geometry(\"#{width}x#{height}>\") do |c, r, i| i.resize(c, r) end\n\n img.format = \"jpg\"\n img.to_blob\n }\n\n end", "title": "" }, { "docid": "69d1599311be09e9835ab309416ce1dd", "score": "0.67062885", "text": "def image(size)\n\t\t\tsearch_xml(\"//artist/image[@size='#{size}']\").first.inner_html rescue \"\"\n\t\tend", "title": "" }, { "docid": "0f931847c5baed9e40f6a55aa3f07d32", "score": "0.6688893", "text": "def artist_image_sizes\n\t\t%w{ original large largesquare medium small }\n\tend", "title": "" }, { "docid": "1342cf2cf913ae45b77c581abe3ba4ff", "score": "0.6668663", "text": "def size_for_thumbnail(size)\n thumbnails.each do |thumb|\n return thumb if thumb.thumbnail == size.to_s\n end\n end", "title": "" }, { "docid": "3414e085c3de48b536464d6d1a69108a", "score": "0.6650407", "text": "def profile_image_dimensions(size=:medium)\n if size == :medium\n \"100x100\"\n elsif size == :small\n \"50x50\"\n elsif size == :tiny\n \"25x25\"\n end\n end", "title": "" }, { "docid": "1a1937d31c77f297ca663a553498337e", "score": "0.6647586", "text": "def thumbnail(size)\n images.first.file.url(size)\n end", "title": "" }, { "docid": "2da8b10a3ff37da02b21d5966477c71f", "score": "0.66295123", "text": "def medium_images\r\n return pictures.select{ |pic| pic.size_type == Picture::SIZE_MEDIUM }\r\n end", "title": "" }, { "docid": "32ac2af48ce5d6d5fe71bf13737e24d8", "score": "0.6627913", "text": "def display_image\n image.variant(resize_to_limit: [500, 500])\nend", "title": "" }, { "docid": "80dc1db1c3e2f7ce1df672472380b821", "score": "0.66075766", "text": "def images_size\n self.original_image_size + \n self.byproduct_image_size\n end", "title": "" }, { "docid": "caff3050a6096eed504d6f8508c9dcff", "score": "0.6544267", "text": "def resolution_finder(image_link)\r\n FastImage.size(image_link)\r\nend", "title": "" }, { "docid": "d5c9e0c2c5f1ee1a72eee069ce4a7fde", "score": "0.6499557", "text": "def image_size_large?\n image.size == 'large'\nend", "title": "" }, { "docid": "d7beea3b94b25059f01356deeda78247", "score": "0.6482169", "text": "def sizes \n @sizes ||= versions.reject {|v| v['size'] == 'thumbnail' }\n end", "title": "" }, { "docid": "944a38e110b362cb6c4244d6fd85c228", "score": "0.6474083", "text": "def sizes\n PhotoAttachedImage.image_sizes(model.for_print)\n end", "title": "" }, { "docid": "10429d4713196d95747076798fdf9dbb", "score": "0.6465396", "text": "def image_url_by_size(size)\n picture.image.url(size) if picture?\n end", "title": "" }, { "docid": "f2bc34f07b2b076b7a6e61da7898efca", "score": "0.6464965", "text": "def multisize_image_assets\n\t\tself.get_image_assets.each do |img|\n\t\t\tm = @@IMAGE_MATCH.match(img)\n\t\t\told_file_name = File.join(self.assets_folder_name, img)\n\t\t\tPhotoStorage.auto_orient(old_file_name)\n\t\t\tPhotoStorage.multi_resize(old_file_name, { 128 => :icon, 1024 => :display })\n\t\tend\n\tend", "title": "" }, { "docid": "48459a347e963bc911d69a39533ef97e", "score": "0.6461207", "text": "def image_sizes\n @entries.map {|e| [e[:width], e[:height]] }.sort\n end", "title": "" }, { "docid": "3553e1f536d8e783bf570c62cf3c281c", "score": "0.64352614", "text": "def img_tag(size)\n # Iterate through self.sizes backwards starting from #{size}\n # Find the first local path\n found_first_size = false\n img = ''\n actual_size = size\n Photo.sizes.reverse.each do |s|\n next if found_first_size == false && s != size\n next if img != ''\n found_first_size = true\n path = self.send('local_path_'+s)\n if !path.nil?\n img = path\n actual_size = s\n end\n end\n \"<img src=\\\"#{SiteConfig.photo_url_root}#{img}\\\" #{self.wh_attr(actual_size)} />\"\n end", "title": "" }, { "docid": "0708db005af7efe6139d3f09f06b64f9", "score": "0.6408922", "text": "def image_sizes\n [\n [ 'm1.small', 1.7, 1, 160, 32, 0.10],\n [ 'm1.large', 7.5, 4, 850, 64, 0.40],\n ['m1.xlarge', 15.0, 8, 1690, 64, 0.80],\n ['c1.medium', 1.7, 5, 350, 32, 0.20],\n ['c1.xlarge', 7.0, 20, 1690, 64, 0.80]\n ]\n end", "title": "" }, { "docid": "ab8c13341d2ad94aec097ba7f200104d", "score": "0.6403199", "text": "def dimensions(uri=self['src'])\n cached uri do\n begin\n Timeout::timeout(Rack::ImageSize::TIMEOUT) do\n begin\n open(uri.to_s, 'rb') do |image|\n # QUESTION: Should we sanitize this? If the path comes from\n # user input then it could open an exploit. But that is not\n # the common case. So perhaps the site should just do width\n # and height itself if the image comes from user input.\n specs = `#{Rack::ImageSize::IDENTIFY_COMMAND} #{image.to_tempfile.path}`\n specs.split(/\\s+/, 4)[2].split('x').collect(&:to_i) if $? == 0\n end\n rescue OpenURI::HTTPError\n $stderr.puts \"Failed to load #{uri}\"\n nil\n end\n end\n rescue Timeout::Error\n $stderr.puts \"Failure to load #{uri}\"\n nil\n end\n end\n end", "title": "" }, { "docid": "562160dff9477cc05a21742ae50144e5", "score": "0.63892955", "text": "def thumbnails\r\n return pictures.select{ |pic| pic.size_type == Picture::SIZE_THUMBNAIL }\r\n end", "title": "" }, { "docid": "bdc10b75d799b9c53f82a289c31ad63e", "score": "0.63714725", "text": "def image_urls(size=:default)\n return nil unless has_image_behavior?\n\n stacks_url = Settings.STACKS_URL\n\n file_ids.map do |image_id|\n image_id = image_id.gsub(/\\.jp2$/, '')\n\n \"#{stacks_url}/#{self.druid}/#{image_id}#{image_dimensions[size]}\"\n end\n end", "title": "" }, { "docid": "2456388d588fff783f31acc1bc41dbbe", "score": "0.6348724", "text": "def thumb(size)\n return nil if ! File.exist? File.join(CarrierWave.root, self.url)\n uploader = Class.new(self.class)\n uploader.version_names = [size]\n img = uploader.new(model, mounted_as)\n img.retrieve_from_store!(identifier)\n cached = File.join([img.url, File.basename(self.url)].join('_') )\n return cached if File.exist?(File.join(CarrierWave.root, cached))\n \n img.cache!(self)\n img.quality(100)\n resizer = case size\n when /xF/ then :resize_to_fill\n when /xL/ then :resize_to_limit\n when /xP/ then :resize_and_pad\n # add more like when /x./ then ...\n else :resize_to_fit\n end\n \n middle = /[\\d]+([\\D]+)[\\d]+/.match size\n size = size.split(middle[1]).map(&:to_i)\n img.send(resizer, *size)\n\n img.store! \n img\n end", "title": "" }, { "docid": "d964304e5a42a17116fd956a9a598bd0", "score": "0.6347677", "text": "def self_image_url_by_size(size)\n image.url(size)\n end", "title": "" }, { "docid": "00d247ebaac6dcbce13343920fc4db01", "score": "0.6329437", "text": "def url(size)\n \"#{size}.jpg\"\n end", "title": "" }, { "docid": "75014832224394ad891a51b5b30f3cb0", "score": "0.631796", "text": "def photo_size(size = :medium)\n size_hash.fetch(size.to_s, size_hash['medium'])\n end", "title": "" }, { "docid": "75014832224394ad891a51b5b30f3cb0", "score": "0.631796", "text": "def photo_size(size = :medium)\n size_hash.fetch(size.to_s, size_hash['medium'])\n end", "title": "" }, { "docid": "4120a0e227d233a2f543cc75b9e26110", "score": "0.63149846", "text": "def large_image\n @images.select { |image| image.image_name == 'LARGE' }.first\n end", "title": "" }, { "docid": "47edc2f173fb4c41a7de9b5c69e3f448", "score": "0.630748", "text": "def thumbnail input\n return self.company_images[input].variant(resize: '100x100%').processed\n end", "title": "" }, { "docid": "38d802a7351f85e03dd77c54eae2f299", "score": "0.6304515", "text": "def image_size(type)\n\t\treturn ICON_SIZES[type]\n\tend", "title": "" }, { "docid": "789e208e7238e4391fc89fdb0f730d6e", "score": "0.6295059", "text": "def get_all_big_images(browser)\n all_big_images = []\n browser.images.each do |image|\n src = image.src\n all_big_images << [FastImage.size(src).inject(:+), src] if image.visible? && is_ok_type?(src) && is_ok_size?(src)\n break if all_big_images.length >= 30 # in case of huge number of images\n end\n all_big_images.uniq\n end", "title": "" }, { "docid": "bdad6d67425a1175b2dcd16f5c9dd12b", "score": "0.6292483", "text": "def image_size # read image file height and width\n # we now use Dimensions gem\n case self.extname.downcase\n when \".png\", \".gif\", \".jpg\", \".jpeg\", \".tif\", \".tiff\"\n return Dimensions::dimensions(self)\n else\n return [nil, nil]\n end\n end", "title": "" }, { "docid": "9120ff9e6c84fa6f7ead526544765c88", "score": "0.6289002", "text": "def get_images(ten)\n return ten.map{|x| x[:images][:low_resolution][:url]}\n end", "title": "" }, { "docid": "bc548cc1efaaa445809f9b36e9292480", "score": "0.62825716", "text": "def display_image\n image.variable? ? image.variant(resize_to_limit: [500, 500]) : image\nend", "title": "" }, { "docid": "556c1fd6f31041f3d105b7f27b12cc56", "score": "0.62804115", "text": "def item_max\n @images.size * 8\n end", "title": "" }, { "docid": "d5357be576e284657033f52cfff0e101", "score": "0.62682104", "text": "def attachment_sizes\n if self.picture_orientation_horizontal\n size = { :medium => \"300x\", :thumb => \"50x50>\" }\n else\n size = { :medium => \"200x\", :thumb => \"50x50>\" }\n end\n size\n end", "title": "" }, { "docid": "5b778be58eeb8bf60c377764a1bd4b73", "score": "0.6262011", "text": "def image(size)\n if self.has_image\n image_url(size)\n else\n nil\n end\n end", "title": "" }, { "docid": "904b7ce0d0227819af9c59cd960d2b88", "score": "0.62438345", "text": "def image_size\n 4.times do |i|\n \tphoto = \"image#{i+1}\"\n \tif eval(photo).size > 5.megabytes\n \terrors.add(:picture, \"should be less than 5MB\")\n \tend\n end\n \tend", "title": "" }, { "docid": "df47c5ee050d493762417ef4d9fcbabf", "score": "0.62418324", "text": "def image_url(size = :medium)\n\t# It turns out that flickr always stores all the sizes of the picture even when getSizes call returns otherwise.\n\t# Not calling getSizes is also very important for performance reasons.\n\t# Retrieving 30 search results means calling the API 31 times if you call getSizes every time.\n\t# Mind that you still need to call getSizes if you go out for the original image.\n\tif size == :original\n\t size_hash[size.to_s].source if size_hash.has_key? size.to_s\n\telse\n\t key = \"_#{size_key(size.to_sym)}\"\n\t key = \"\" if key == \"_\"\n\t \"http://farm#{farm}.static.flickr.com/#{server}/#{id}_#{secret}#{key}.jpg\"\n\tend\n end", "title": "" }, { "docid": "df47c5ee050d493762417ef4d9fcbabf", "score": "0.62418324", "text": "def image_url(size = :medium)\n\t# It turns out that flickr always stores all the sizes of the picture even when getSizes call returns otherwise.\n\t# Not calling getSizes is also very important for performance reasons.\n\t# Retrieving 30 search results means calling the API 31 times if you call getSizes every time.\n\t# Mind that you still need to call getSizes if you go out for the original image.\n\tif size == :original\n\t size_hash[size.to_s].source if size_hash.has_key? size.to_s\n\telse\n\t key = \"_#{size_key(size.to_sym)}\"\n\t key = \"\" if key == \"_\"\n\t \"http://farm#{farm}.static.flickr.com/#{server}/#{id}_#{secret}#{key}.jpg\"\n\tend\n end", "title": "" }, { "docid": "899722ba6ba44865f4e53d2115332b3e", "score": "0.6237455", "text": "def show\n size = params[:size] || \"200x200\"\n size = size[0..-($1.length.to_i + 2)] if size =~ /[0-9]+x[0-9]+\\.([a-z0-9]+)/ # trim file extension\n \n id = params[:id].to_i\n\n send_cached_data(\"public/pictures/show/#{size}/#{id}.jpg\",\n :type => 'image/jpeg', :disposition => 'inline') {\n\n find_picture\n\n # resize and encode the picture\n @picture.resize!(:size => size)\n @picture.to_jpg!\n\n @picture.data\n }\n\n end", "title": "" }, { "docid": "8b3d570c3577d461f7c6be2f9184956d", "score": "0.6228639", "text": "def get_default_size(imageable_type)\n case imageable_type\n when 'Listing', 'TempListing' then 'large'\n else 'thumb'\n end\n end", "title": "" }, { "docid": "d1c52ba2f75d08e35c77d4a6c0fd1190", "score": "0.6213288", "text": "def is_big_imageable?\n return true\n end", "title": "" }, { "docid": "783f45892871c05d0234f379b6c0c83b", "score": "0.61962837", "text": "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "title": "" }, { "docid": "ebc0efe7b0abaa5225e167dcc8569ee5", "score": "0.61932576", "text": "def get_image_from_uri\n begin\n @image = MiniMagick::Image.open(@image_model.url)\n rescue Exception => general_msg\n Rails.logger.error('Failed to open image url.' + general_msg.to_s)\n @image = 'General error has occurred in opening the image file.'\n end\n\n #check if the given proportion are not greater then the original image proportion\n def image_size_allowed\n return @image.width > @image_model.width.to_i && @image.height > @image_model.height.to_i\n end\n\n end", "title": "" }, { "docid": "eedcd6a52c3057950e5eb3dec5955006", "score": "0.61931676", "text": "def dc_image_preview_resized(document, yaml, ignore)\n size = yaml['name'].last\n return '' if document[\"size_#{size}\"].blank?\n\n src = \"/#{dc_get_site.params.dig('dc_image', 'location')}/#{document.id}-#{size}.#{document.img_type}?#{Time.now.to_i}\"\n %(<span class=\"dc-image-preview\"><img src=\"#{src}\"></img></span><div id=\"dc-image-preview\"></div>).html_safe\nend", "title": "" }, { "docid": "c99a152ac73ebbd4c88f25262ea19d38", "score": "0.618634", "text": "def thumbnail select\n return self.uploads[select].variant(resize: \"400x300!\").processed\n end", "title": "" }, { "docid": "06c6572172e630648399f065413c4315", "score": "0.6185363", "text": "def image_size(path)\n o=`file #{path}`\n o.match(/\\b(\\d+)\\s*x\\s*(\\d+)\\b/)\n return {:width=>$1.to_i, :height=>$2.to_i}\nend", "title": "" }, { "docid": "c0e2139951a2f1aeff4973e7181abeb8", "score": "0.61850274", "text": "def image(size='original')\n self.images? ? convert_image(@images.first, size) : nil\n end", "title": "" }, { "docid": "ef8ae286ae63b91e3dcab6f27ca0a1c0", "score": "0.617144", "text": "def get_pixi_image size='default'\n size = get_default_size(@pic.imageable_type) if size == 'default'\n if @pic.photo.exists?\n @pic.photo.url(size.to_sym)\n elsif self.class.use_remote_pix?\n @pic.direct_upload_url\n else\n 'rsz_pixi_top_logo.png'\n end\n end", "title": "" }, { "docid": "538783fa88c51c52fd75eeed15530e9b", "score": "0.6158136", "text": "def image_size(img)\n i = ImageSize.new(img)\n {\"width\" => i.get_width, \"height\" => i.get_height}\nend", "title": "" }, { "docid": "131a33db272fd23b337a0208fe13e727", "score": "0.6152843", "text": "def generate_image_sizes()\n\tKernel.system \"mkdir -p #{DESTINATION_DIRECTORY_NAME}\"\n\t\n\timagemagick_command = \"find . -maxdepth 1 -type f \\\\( -name '*.tif' -o -name '*.png' \\\\) | xargs -P 4 -I@ #{IMAGEMAGICK_COMMAND} @ -quality #{WEBP_QUALITY} -define webp:lossless=true -set filename:name '%t' '#{DESTINATION_DIRECTORY_NAME}/%[filename:name].#{OUTPUT_FILE_EXTENSION}'\"\n\t\n\tputs imagemagick_command\n\tKernel.system imagemagick_command\nend", "title": "" }, { "docid": "bd3964499eec9bf5b8d0c5bfeaae67d8", "score": "0.614993", "text": "def generate_image_sizes()\n\tKernel.system \"mkdir -p #{DESTINATION_DIRECTORY_NAME}\"\n\tSIZES.each do |size|\n\t\timagemagick_command = \"find . -maxdepth 1 -type f \\\\( -name '*.tif' -o -name '*.png' \\\\) | xargs -I@ #{IMAGEMAGICK_COMMAND} @ -resize #{size[:max_width]} -set filename:name '%t' '#{DESTINATION_DIRECTORY_NAME}/%[filename:name]-#{size[:name]}.#{OUTPUT_FILE_EXTENSION}'\"\n\t\tputs imagemagick_command\n\t\tKernel.system imagemagick_command\n\tend\nend", "title": "" }, { "docid": "9f81421d11e0244b839be5ca08434b30", "score": "0.6135428", "text": "def sizes\n sizes_downloadable_images.sort { |a,b| a[:file_size_in_bytes] <=> b[:file_size_in_bytes] }\n end", "title": "" }, { "docid": "eff408f90fddb008ec4a115bbf273b3d", "score": "0.6134318", "text": "def thumbnail\n (self.files.select{|media| media.dimension_max == \"130x130\"}.first || nil) if is_image?\n end", "title": "" }, { "docid": "5b74ec8a1455124a1dc6020beb76acff", "score": "0.6126858", "text": "def candidate_images\n response = []\n PICTURE_SIZE.each do |size|\n CAMERA_REFERENCE.each do |camera|\n response << [image_cache, obfuscated_stock_reference, size, camera].join('/')\n end\n end\n response\n end", "title": "" }, { "docid": "95a65fb98a25164ca005b9b66a2ab8ba", "score": "0.61203045", "text": "def check_pix_from_cache(key, size)\n data = @map[key]\n if size == SMALL_SIZE\n if data.small_pix.nil?\n Trace.imc('Image::Cache check pix load small from cache'.brown)\n data.small_pix = GdkPixbuf::Pixbuf.new(file: Cfg.covers_dir+data.file_name, width: size, height: size)\n end\n return data.small_pix\n else\n if data.large_pix.nil?\n Trace.imc('Image::Cache check pix load large from cache'.brown)\n data.large_pix = GdkPixbuf::Pixbuf.new(file: Cfg.covers_dir+data.file_name, width: size, height: size)\n end\n return data.large_pix\n end\n end", "title": "" }, { "docid": "89d282da60ca7fe1e6bc95b90b1ae9cf", "score": "0.6110035", "text": "def possible_sizes\n FlickrMocks::Models::Helpers.possible_sizes\n end", "title": "" }, { "docid": "89d282da60ca7fe1e6bc95b90b1ae9cf", "score": "0.6110035", "text": "def possible_sizes\n FlickrMocks::Models::Helpers.possible_sizes\n end", "title": "" }, { "docid": "7b1dd7312af55b67581e98c508281028", "score": "0.61098593", "text": "def get_image_url\n %w[small medium large extralarge mega].reverse.each do |size|\n query = self.images.where(size: size)\n return query.first.url if query.exists?\n end\n return \"http://on.encore.fm/assets/public/applogo.png\"\n end", "title": "" }, { "docid": "85992f6f8bff862434d8d7ef91503ae0", "score": "0.6109427", "text": "def thumbnail input\n return self.images[input].variant(resize: \"150x150!\").processed\n end", "title": "" }, { "docid": "8d96f21c26163c2a55bfa47c38aacbe9", "score": "0.6095594", "text": "def set_image_size\n self.image_size = image_size\n end", "title": "" }, { "docid": "15823c21b0ec35024d7390f84703c2b3", "score": "0.60777557", "text": "def get_image_sizes(image)\n params = {\n action: 'query',\n prop: 'imageinfo',\n iiprop: 'size',\n titles: image\n }\n\n response = post(params)\n pageid = response['query']['pages'].keys.find(MediaWiki::Constants::MISSING_PAGEID_PROC) { |id| id != '-1'}\n return nil if pageid == '-1'\n response['query']['pages'][pageid]['imageinfo'].reduce({}, :merge)\n end", "title": "" }, { "docid": "ebf077c97ac624740fb378d81b455893", "score": "0.60645777", "text": "def thumb_open(filename, shrink = 1)\n if filename.end_with? \".jpg\"\n return Image.jpeg filename, \n :shrink_factor => shrink,\n :sequential => true\n elsif filename.end_with? \".tif\"\n return Image.tiff filename, \n :sequential => true\n elsif filename.end_with? \".png\"\n return Image.png filename, \n :sequential => true\n else \n return Image.new filename \n end\nend", "title": "" }, { "docid": "84253c52e9e9cca61dc6722d7fc41a3a", "score": "0.60516053", "text": "def update_image_dimension(agent, img_url, optional_headers={})\n img_page = agent.get(:url=>img_url, :headers => optional_headers)\n img_file = JPEG.new(StringIO.new(img_page.body))\n @url = img_url\n @width = img_file.width\n @height = img_file.height\n end", "title": "" }, { "docid": "e858199fe2b11a4e3e49a07b6beb1752", "score": "0.6050728", "text": "def image_urls\n photos.map {|h|\n o = h['original_size']['url']\n if File.exist?(resource_path(o))\n resource_path(o)\n else\n a = h['alt_sizes'].find {|h| h['width'] == 500 }\n if a\n resource_path(a['url'])\n else\n resource_path(o)\n end\n end\n }\n end", "title": "" }, { "docid": "5c2d92384c81d40c66a3059799ea62fb", "score": "0.6047076", "text": "def display_image_url(size=\"1000,\")\n if representative_id\n return \"\" unless current_ability.can?(:read, representative_id)\n representative_image = SolrDocument.find(representative_id)\n return \"\" unless representative_image.image?\n representative_image.display_image_url(size: size)\n elsif solr_document.image?\n solr_document.display_image_url(size: size)\n end\n end", "title": "" }, { "docid": "0d33c32f41d89650e805de8364309a7b", "score": "0.6038113", "text": "def buildThumbnails()\r\n # noImageFiles = %w[baghead.png ghostImage.png NoImageAvailable.png]\r\r\n thumbs = ImageList.new()\r\n @people.each { |p| \r\n if p.photo_uid \r\n thumbs.read(p.photo.thumb('100x100').file)\r\n else\r\n thumbs.read(\"#{Rails.root}/public/images/NoImageAvailable.png\")\r\n end\r\n }\r\n montage = thumbs.montage do\r\n self.tile=\"+1\"\r\n self.geometry=\"100x100\"\r\n end\r\n montage.write(@fileNames+\".png\")\r\n end", "title": "" }, { "docid": "c2fc530753c182b3ff8b6e00305ebd1a", "score": "0.6037066", "text": "def cover_image_response(size='medium')\n cover_images = get_service_type('cover_image')\n cover_images.each do |service_response|\n return service_response if service_response.service_data[:size] == size \n end\n return nil\n end", "title": "" }, { "docid": "c96e0795ba471f3a20217c29b8e3c5ef", "score": "0.60352683", "text": "def thumbnail_impl(from_path, size='large') # :nodoc:\n path = \"/thumbnails/#{@root}#{format_path(from_path, true)}\"\n params = {\n \"size\" => size\n }\n @session.do_get path, params, :content\n end", "title": "" }, { "docid": "6b89c9e04561c261e12240d42c830f4b", "score": "0.6025704", "text": "def images_for identifier\n find_elements(\"images(identifier)\", Elements::Image, identifier)\n end", "title": "" }, { "docid": "3c24acc590b8a84d62b265733ed288cf", "score": "0.60144895", "text": "def thumbnail input\n return self.images[input].variant(resize: \"700x1036!\").processed\n end", "title": "" }, { "docid": "a94ae341774859525bbe9fccf1614aea", "score": "0.6009832", "text": "def set_size_image\n @size_image = SizeImage.find(params[:id])\n end", "title": "" }, { "docid": "bdc2433cab4a74ff3545921edea199c5", "score": "0.6008691", "text": "def display_image\n image_url.variant resize_to_limit: [360, 400]\n end", "title": "" }, { "docid": "6418a97a21c6d166665215d9e640d3e8", "score": "0.6002343", "text": "def get_image_custom_size page_number, image_index, image_format, width=0, height=0\n begin\n \n if page_number == ''\n raise 'page number not sepcified'\n end\n \n if image_index == ''\n raise 'image index not sepcified'\n end\n \n if image_format == ''\n raise 'image format not sepcified'\n end\n \n if @filename == ''\n raise 'filename not sepcified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/images/' + image_index.to_s + '?format=' + image_format + '&width=' + width.to_s + '&height=' + height.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'}) \n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == '' \n output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + image_index.to_s + '.' + image_format\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n \n rescue Exception=>e\n print e\n end\n end", "title": "" }, { "docid": "2bf1c87623ded10996aa90a7d184fe8d", "score": "0.5996778", "text": "def large_image_width\n 850\n end", "title": "" }, { "docid": "a823197b0f627d7ba8fad43652bd3d3d", "score": "0.59962374", "text": "def representative_image_path(document, size='S')\n cover = CoverImage.find_by(solr_id: document.id)\n if cover\n if cover.updated_at.to_i > 2.weeks.ago.to_i\n if cover.thumbnail_url\n #if an image url is cached, just return it\n if 'S' == size\n return cover.thumbnail_url\n else\n return cover.full_url\n\t\t end\n end\n\n elsif document.has? 'isbn_t'\n #Search again if the cache is too old\n isbns = find_isbns_from(document)\n isbns.each do |isbn|\n\t thumbnail_url = get_image_url(isbn, 'isbn', 'S')\n\t if thumbnail_url\n\t full_url = get_image_url(isbn, 'isbn', 'M')\n\t image = CoverImage.update(cover.id, isbn: isbn, thumbnail_url: thumbnail_url, full_url: full_url, solr_id: document.id)\n if 'S' == size\n return thumbnail_url\n\t\t else\n return full_url\n\t\t end\n end\n end\n end\n\n # If the image has not yet been cached\n elsif document.has? 'isbn_t'\n isbns = find_isbns_from(document)\n isbns.each do |isbn|\n thumbnail_url = get_image_url(isbn, 'isbn', 'S')\n\t if thumbnail_url\n\t full_url = get_image_url(isbn, 'isbn', 'M')\n\t\t image = CoverImage.create(isbn: isbn, thumbnail_url: thumbnail_url, full_url: full_url, solr_id: document.id)\n if 'S' == size\n return thumbnail_url\n\t\t else\n return full_url\n\t\t end\n end\n end\n end\n image = CoverImage.create(solr_id: document.id)\n if document.has? 'format'\n return 'icons/'.concat(document['format']).concat('.png')\n end\n return nil\n end", "title": "" }, { "docid": "83e8045fbacb2c14c33d8335654497ee", "score": "0.59925044", "text": "def image(size = 'large')\n response['labels']['medium']\n end", "title": "" }, { "docid": "3d7344775277ed42149534a6d15a7951", "score": "0.59923774", "text": "def display_image\n image.variant(resize_to_limit: [500, 500])\n end", "title": "" }, { "docid": "f5afbb7dab718c5c96eea27718657df9", "score": "0.59848773", "text": "def get_sizes(id)\n\turi = URI.parse(\"http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=756d74d6303e66f5c305f2d24df19dfe&photo_id=#{id}\")\t\n\thttp = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n response.code # => 301\n response.body # => The body (HTML, XML, blob, whatever)\n return response.body\n end", "title": "" }, { "docid": "97d56466b5b8b9821c6aefde1e2e1729", "score": "0.5983934", "text": "def thumbnail size=:small\n populate_attrs unless @large_thumbnail && @small_thumbnail\n if size == :large\n\t@large_thumbnail\n else\n\t@small_thumbnail\n end\t\n end", "title": "" }, { "docid": "617cb6fa7bf5e84d268633ecf3096035", "score": "0.59806067", "text": "def show_large_thumbnail\n fetch_avatar(\"large_thumb\")\n end", "title": "" }, { "docid": "2e43d8cc5aa6685bd7c12620a58fad2d", "score": "0.5979667", "text": "def images; end", "title": "" }, { "docid": "2e43d8cc5aa6685bd7c12620a58fad2d", "score": "0.5979667", "text": "def images; end", "title": "" }, { "docid": "8ad1b9ca06a36b7a18c892e44e6771a5", "score": "0.59782374", "text": "def image_on_steroids(image, alt:, sizes: [], square: false, html_class: \"\")\n srcset = []\n\n if image.present? && image.variable?\n sizes.each do |size|\n resize_to_fit = [size, (square ? size : nil)]\n srcset << [url_for(image.variant(resize_to_fit: resize_to_fit)), \"#{size}w\"]\n end\n else\n image = \"no-image.jpg\"\n\n sizes.each do |size|\n srcset << [image_url(\"no-image-#{size}.jpg\"), \"#{size}w\"]\n end\n end\n\n image_tag image, alt: alt, class: html_class, srcset: srcset\n end", "title": "" }, { "docid": "18f54975229ccc40c9ac8ded35a656c4", "score": "0.597261", "text": "def imagesize(path)\n # returns [width, height]\n throw NotImplementedError\n end", "title": "" }, { "docid": "33f6bee661c2e904371a7d17c31a8134", "score": "0.59723157", "text": "def thumbnail input\n return self.avatars[input].variant(resize: '300x300!').processed\n end", "title": "" }, { "docid": "7f28c66572bccea9ff34965348ccb13f", "score": "0.5971999", "text": "def capture_size_before_cache(new_file) \n if model.image_width.nil? || model.image_height.nil?\n model.image_width, model.image_height = `identify -format \"%wx %h\" #{new_file.path}`.split(/x/).map { |dim| dim.to_i }\n end\n end", "title": "" }, { "docid": "fadff773acb2fcf349648db3851bccda", "score": "0.59678656", "text": "def resize_images(images, sizes, site)\n fullsize = []\n to_save = []\n images.each do |img|\n filepath = \"#{site.source}/assets/images/#{img[1]['name']}.jpg\"\n fullsize << Image::read(filepath).first\n end\n fullsize.each do |img|\n sizes.each_value { |size| to_save << img.resize_to_fit(size) }\n end\n to_save.each { |img| img.write(\"#{img.filename.split('.')[0]}-#{img.columns}.jpg\") { self.quality = 80 } }\n end", "title": "" }, { "docid": "d1cb45663a0446b79aab2be8f26f6363", "score": "0.59628093", "text": "def image_urls\n photos = @data[\"photos\"][0]\n original_size = photos[\"original_size\"]\n alt_sizes = photos[\"alt_sizes\"]\n alt_maxes = alt_sizes.sort_by{|img| -(img[\"width\"] * img[\"height\"]) }\n\n images = []\n images << original_size[\"url\"] if original_size\n images.concat(alt_maxes.map{|p| p[\"url\"] } )\n\n images\n end", "title": "" } ]
e1b28adf8cbc3b6c80278e26b0e3a29c
Set the value of the CommentID input for this Choreo.
[ { "docid": "87b8c816c6abdb35a4befe5dbd3bcc89", "score": "0.6798055", "text": "def set_CommentID(value)\n set_input(\"CommentID\", value)\n end", "title": "" } ]
[ { "docid": "39302f33ba100cb164d47f3670e3283a", "score": "0.6939344", "text": "def set_CommentId(value)\n set_input(\"CommentId\", value)\n end", "title": "" }, { "docid": "df790bd820e5ad4d91530dd73ad5839a", "score": "0.6828429", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "df790bd820e5ad4d91530dd73ad5839a", "score": "0.6828429", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "9a036e590149e4b48244feaf843ff3d2", "score": "0.67463064", "text": "def set_comment\n @comment = Comment.find params[:id]\n end", "title": "" }, { "docid": "a938e013dda26bda5e2239720bc44b9c", "score": "0.67240983", "text": "def set_comment\n logger.debug(\"***comment set_comment*** #{params}\")\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" }, { "docid": "93ff860c1da479cd4b5c8c192f72b769", "score": "0.669752", "text": "def set_comment\n @comment = Comment.find(params[:id])\n end", "title": "" } ]
986b729235f753e8b84710f9f2c30574
options :cache => Cache Object :module_paths => Array[String] (Deprecated) :spec_searcher_configuration => PuppetfileResolver::SpecSearchers::Configuration
[ { "docid": "1f6102099fdc4a44a5753fc42487d716", "score": "0.0", "text": "def resolve(options = {})\n if options[:ui]\n raise 'The UI object must be of type Molinillo::UI' unless options[:ui].is_a?(Molinillo::UI)\n ui = options[:ui]\n else\n require 'puppetfile-resolver/ui/null_ui'\n ui = PuppetfileResolver::UI::NullUI.new\n end\n provider = ResolutionProvider.new(@puppetfile, @puppet_version, ui, options)\n\n resolver = Molinillo::Resolver.new(provider, ui)\n begin\n result = resolver.resolve(dependencies_to_resolve)\n rescue Molinillo::VersionConflict => e\n # Wrap the Molinillo error\n new_e = PuppetfileResolver::Puppetfile::DocumentVersionConflictError.new(e)\n raise new_e, new_e.message, e.backtrace\n rescue Molinillo::CircularDependencyError => e\n # Wrap the Molinillo error\n new_e = PuppetfileResolver::Puppetfile::DocumentCircularDependencyError.new(@puppetfile, e)\n raise new_e, new_e.message, e.backtrace\n end\n ResolutionResult.new(result, @puppetfile)\n end", "title": "" } ]
[ { "docid": "1e1116261935d4e08babbcc1da2178e4", "score": "0.56260365", "text": "def initialize(puppetfile_document, puppet_version, resolver_ui, options = {})\n require 'semantic_puppet'\n\n @puppetfile_document = puppetfile_document\n raise 'The UI object must be of type Molinillo::UI' if resolver_ui.nil? || !resolver_ui.is_a?(Molinillo::UI)\n @resolver_ui = resolver_ui\n @spec_searcher_configuration = options[:spec_searcher_configuration] || PuppetfileResolver::SpecSearchers::Configuration.new\n @allow_missing_modules = options[:allow_missing_modules].nil? ? true : options[:allow_missing_modules] == true\n # There can be only one puppet specification in existance so we pre-load here.\n @puppet_specification = Models::PuppetSpecification.new(puppet_version)\n @module_info = {}\n @cache = options[:cache].nil? ? Cache::Base.new : options[:cache]\n\n # Check for deprecated options\n unless options[:module_paths].nil? # rubocop:disable Style/GuardClause\n Warning.warn 'The use of the module_paths option has been deprecated'\n @spec_searcher_configuration.local.puppet_module_paths = options[:module_paths]\n end\n end", "title": "" }, { "docid": "f7c3b32e57dfe8b47449c24fac408f5c", "score": "0.55767053", "text": "def init_options(options = { verbose: false })\n options[:cache_directory] ||= File.join(Dir.home, '.elm-install')\n @options = options\n end", "title": "" }, { "docid": "3c6fa159019090c200d4dbf232f82da8", "score": "0.5552277", "text": "def configure_cache; end", "title": "" }, { "docid": "baf59116fa1d7071414c0c23c82078cd", "score": "0.55281997", "text": "def preloaded_module_paths(resolver:, cache_key: T.unsafe(nil)); end", "title": "" }, { "docid": "778f5f11d876e69e652733ff408e3e41", "score": "0.5469255", "text": "def with_cache(options)\n path = Picasa.path(options)\n @request_cache.delete(path) if options[:reload]\n xml = nil\n if @request_cache.has_key? path\n xml = @request_cache[path]\n else\n xml = @request_cache[path] = xml(options)\n end\n if xml\n yield xml\n end\n end", "title": "" }, { "docid": "25b91d1520576d1b855df6e5bbad4f14", "score": "0.54184926", "text": "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "title": "" }, { "docid": "26a770e9d0e86b809e155074a22a32f9", "score": "0.53962374", "text": "def for_cache\n spec = dup\n\n spec.files = nil\n spec.test_files = nil\n\n spec\n end", "title": "" }, { "docid": "8d8e45256a916076e61d9abbc27ba273", "score": "0.53309596", "text": "def configure(opts)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "b966faf8aaa0e74f72f2370d913cc2c3", "score": "0.5288567", "text": "def installed_spec_directories; end", "title": "" }, { "docid": "0b8080d7d386dd73eec13f293e69fe29", "score": "0.52849084", "text": "def discovery_cache; end", "title": "" }, { "docid": "db3ee7700b795980ff9f9b13cd6347ba", "score": "0.52627325", "text": "def resolve_dependencies\n _pt_resolve_dependencies\n\n puts \"plugin hook after resolve_dependencies\"\n\n pt_internal = PT_internal.instance\n\n\n specifications = analysis_result.specifications\n specs_to_modify = specifications.select do |s|\n pt_internal.l_names_using_binary.index(s.name)\n end\n\n specs_to_modify.map do |s|\n # :exclude_files has no getter\n exclude_files = [s.attributes_hash[\"exclude_files\"]]\n\n s.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n\n s.subspecs.each do |subs|\n exclude_files = [subs.attributes_hash[\"exclude_files\"]]\n subs.exclude_files = [exclude_files, PT::EXCLUDE_SOURCE_PATTERN].flatten\n end\n\n end\n end", "title": "" }, { "docid": "b1f41838d84b67eaa1bd87d15b1df032", "score": "0.51980394", "text": "def refresh_dependencies(options = {}); end", "title": "" }, { "docid": "4d2c105caa2c3d3be183fb3d880d09e5", "score": "0.5196031", "text": "def initialize(&block)\n @exclude_from_manifest = Regexp.union(/\\.(git|DS_Store|semaphore)/,\n /^(doc|coverage|pkg|tmp|Gemfile(\\.lock)?)/,\n /^[^\\/]+\\.gemspec/,\n /\\.(swp|jar|bundle|so|rvmrc|travis.yml|byebug_history|fossa.yml|ruby-version)$/,\n /~$/)\n @gemspecs = Hash.new\n yield self if block_given?\n end", "title": "" }, { "docid": "4ac2f885c1eba365f8d7456db9064bf9", "score": "0.5173499", "text": "def configure(*args)\n @options = args[0] || {}\n @fetcher_opts = @options.dup\n @fetcher_opts.delete(:backends_file)\n @fetcher_opts.delete(:domainmap_file)\n @fetcher_opts.delete(:interval)\n end", "title": "" }, { "docid": "ebe6c492f5dd4cd750aca89ba0941693", "score": "0.5140475", "text": "def show_specs(options = {})\n options = {\n mode: nil,\n spec: nil,\n type: nil,\n sub_type: nil,\n specs_to_be_shown: SpecArray.new,\n owner: nil,\n symbol: false,\n creating_spec: false\n }.update(options)\n options[:symbol] ? symbol = options.delete(:spec) : symbol = nil\n specs_to_be_shown = options[:specs_to_be_shown]\n filter_hash(_specs, options[:spec]).each do |_spec, hash|\n filter_hash(hash, options[:mode]).each do |_mode, hash_|\n filter_hash(hash_, options[:type]).each do |_type, hash__|\n filter_hash(hash__, options[:sub_type]).each do |_sub_type, spec|\n if symbol\n if spec.symbol && (spec.symbol.gsub(/<.*?>/, '').downcase.to_sym == symbol)\n specs_to_be_shown << spec\n end\n else\n specs_to_be_shown << spec\n end\n end\n end\n end\n end\n # If no specs were found must check the possibility another search\n # should be started with mode set to :local or :global\n if specs_to_be_shown.empty?\n # Don't want to re-call this method if the callee is trying to create a spec and just wants to know\n # if there is a spec with the exact same options\n if options[:creating_spec] == false\n # Doesn't make sense to recall the method however if the mode is already set to :global or :local\n unless [:global, :local, nil].include?(options[:mode])\n # Need to check if there are :global or :local specs that match the filter(s) as well\n if self == Origen.top_level\n options[:mode] = :global\n else\n options[:mode] = :local\n end\n options[:specs_to_be_shown] = specs_to_be_shown\n Origen.log.debug \"re-calling show_specs with options #{options}\"\n return show_specs(options)\n end\n end\n Origen.log.debug \"Returning no specs for options #{options}\"\n nil\n elsif specs_to_be_shown.size == 1\n print_to_console(specs_to_be_shown) if options[:verbose] == true\n Origen.log.debug \"returning one spec #{specs_to_be_shown.first.name}\"\n specs_to_be_shown.first\n else\n Origen.log.debug \"returning an array of specs during initial search: #{specs_to_be_shown}\"\n specs_to_be_shown\n end\n end", "title": "" }, { "docid": "e61602ee52fad5e3c6a1613d6f87167a", "score": "0.51209843", "text": "def refresh_dependents(options = {}); end", "title": "" }, { "docid": "54baba286ea4b743754934cf9be28147", "score": "0.5097012", "text": "def puppet_module_install(opts, &block)\n RSpecSystemPuppet::Helpers::PuppetModuleInstall.new(opts, self, &block)\n end", "title": "" }, { "docid": "32384de1b786b896faad0d5d10820ad7", "score": "0.50954163", "text": "def podspec_local_cache\n @podspec_local_cache ||= CocoapodsMonorepo::PodspecLocalCache.from_local_path(Resolver.monorepo_path)\n end", "title": "" }, { "docid": "3718e5e032a471adbd6524e8ea4e5858", "score": "0.5093107", "text": "def gem_config(*names)\n options = names.extract_options!\n options[:type] ||= :memory\n config = {}\n names << :simple if names.empty?\n names.each{|n| config.merge!(send(\"#{n}_config\")) }\n config.merge!(send(\"#{options[:type]}_config\"))\n Storehouse.set_spec(config)\n end", "title": "" }, { "docid": "910a0cc3d2ad77b6235c1dde5389b3be", "score": "0.50753814", "text": "def initialize(options = {})\n @options = options\n @cache = {}\n load\n end", "title": "" }, { "docid": "679df783bf08e32a59ef5f3b523f60f7", "score": "0.5072822", "text": "def spec_dirs; end", "title": "" }, { "docid": "688ef5f53f3f4eb898ace63af006d1d3", "score": "0.5056341", "text": "def load_spec name\n cache\n\n gemspec_reference = \"#{@reference}:#{name}.gemspec\"\n\n Dir.chdir repo_cache_dir do\n source = Gem::Util.popen @git, 'show', gemspec_reference\n\n source.force_encoding Encoding::UTF_8 if Object.const_defined? :Encoding\n source.untaint\n\n begin\n spec = eval source, binding, gemspec_reference\n\n return spec if Gem::Specification === spec\n\n warn \"git gem specification for #{@repository} #{gemspec_reference} is not a Gem::Specification (#{spec.class} instead).\"\n rescue SignalException, SystemExit\n raise\n rescue SyntaxError, Exception\n warn \"invalid git gem specification for #{@repository} #{gemspec_reference}\"\n end\n end\n end", "title": "" }, { "docid": "3e75545f40ea3f0614eb2eb62a13b98d", "score": "0.5054039", "text": "def spec_dirs=(_arg0); end", "title": "" }, { "docid": "0ee9bc1bc071d9069c59c272d78653f2", "score": "0.5050479", "text": "def spec\n YAML.load_file(\"#{tmp_folder}/#{repository_name}/#{spec_name}\")\n end", "title": "" }, { "docid": "bd2ebf8629ecb5403ddf06a480bfa42c", "score": "0.5042213", "text": "def initialize(supplied_module_path=nil,config={})\n super\n # below is the Spec Object which serves as a context for template rendering\n # you will need to initialize this object, so the erb templates can get the binding\n # the SpecObject can be customized to your liking as its different for every plugin gem.\n @context = ::Foreman::SpecObject.new(module_path, config)\n validate_name(context.plugin_name)\n end", "title": "" }, { "docid": "bd2b789973710e0415b6afe085cc1c5d", "score": "0.4992662", "text": "def initialize options = {}\n @options = options\n @asset_host = options[:asset_host]\n\n @use_cache = options[:use_cache] || false\n @cache_ttl = options[:cache_ttl] || (15 * 60) # 15 mins\n @template_cache = LRUCache.new(:ttl => @cache_ttl) if @use_cache\n\n @logger = options[:logger] || NullLogger.instance\n @strict = options[:strict] || (%w{development test}.include?(ENV['RACK_ENV']))\n end", "title": "" }, { "docid": "a2129c9d44b23870e234cc712c1c4549", "score": "0.49903077", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/puppet/modules/#{name}\"\nend", "title": "" }, { "docid": "9910597a9db332fee4c9db5c9928f43d", "score": "0.49886245", "text": "def cache\n @options[:cache]\n end", "title": "" }, { "docid": "bdaabaa703525555bc4ac68c7d20a896", "score": "0.4986755", "text": "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "title": "" }, { "docid": "a11fc9162a9b4ec76394f2bc5e7339b2", "score": "0.49748084", "text": "def initialize(options = {}, &block)\n @options = options = {\n cookbook_path: RSpec.configuration.cookbook_path || calling_cookbook_path(caller),\n role_path: RSpec.configuration.role_path || default_role_path,\n log_level: RSpec.configuration.log_level,\n path: RSpec.configuration.path,\n platform: RSpec.configuration.platform,\n version: RSpec.configuration.version,\n }.merge(options)\n\n Chef::Log.level = options[:log_level]\n\n Chef::Config.reset!\n Chef::Config.formatters.clear\n Chef::Config.add_formatter('chefspec')\n Chef::Config[:cache_type] = 'Memory'\n Chef::Config[:client_key] = nil\n Chef::Config[:cookbook_path] = Array(options[:cookbook_path])\n Chef::Config[:role_path] = Array(options[:role_path])\n Chef::Config[:force_logger] = true\n Chef::Config[:solo] = true\n\n yield node if block_given?\n end", "title": "" }, { "docid": "f2828233c957909cc5c4593309412fe8", "score": "0.49708277", "text": "def rpcoptions\n oparser = MCollective::Optionparser.new({:verbose => false, :progress_bar => true}, \"filter\")\n\n oparser.parse do |parser, opts|\n yield(parser, opts) if block_given?\n\n Helpers.add_simplerpc_options(parser, opts)\n end\n end", "title": "" }, { "docid": "80d77d47011f8cfd187b47ef58bd06b2", "score": "0.49202585", "text": "def initialize(options)\n super\n raise ArgumentError, \"requires options to contain[:caches]\" unless options && options[:caches]\n @caches = Array(options[:caches]).map do |descriptor|\n ActiveSupport::Cache.lookup_store(descriptor)\n end\n end", "title": "" }, { "docid": "c4dad52596b4a628b91c41ff94a6acf8", "score": "0.49049369", "text": "def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end", "title": "" }, { "docid": "208c6aed86d7f15f647b964a34db1ef7", "score": "0.4901441", "text": "def module_options(module_name, options)\n\t\t\t@project.add_module_options(module_name, options)\n\t\tend", "title": "" }, { "docid": "e30afa502e51d24a92dc5e26dea94e2a", "score": "0.48925677", "text": "def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend", "title": "" }, { "docid": "dbcfef43255d25312e3b66e7608d5615", "score": "0.48883873", "text": "def find_modules\n find_engine\n find_storage\n find_pod\n end", "title": "" }, { "docid": "9a69b2386951dfe078ce073cb826464c", "score": "0.48880175", "text": "def modulepath\n [RSpec.configuration.module_path]\n rescue NoMethodError\n raise \"RSpec.configuration.module_path not defined set up rspec puppet or define modulepath for this test\"\n end", "title": "" }, { "docid": "9a69b2386951dfe078ce073cb826464c", "score": "0.48880175", "text": "def modulepath\n [RSpec.configuration.module_path]\n rescue NoMethodError\n raise \"RSpec.configuration.module_path not defined set up rspec puppet or define modulepath for this test\"\n end", "title": "" }, { "docid": "5b70842a7da140fd1b0a26ac1f9d594d", "score": "0.48796743", "text": "def options\n [\n ['--with-lcov', 'Enable Code Coverage support using lcov.'],\n ['--with-check', 'Run the test suite during install ~30sec']\n ]\n end", "title": "" }, { "docid": "5d6394c51a7c9cf1304494f8ee2317ae", "score": "0.48727372", "text": "def external_options\n options = {}\n # default facters first\n begin\n if !(defined?(::Facter)).nil?\n options[:cache_dir] = ::Facter.value('facter_cache_dir') if ::Facter.value('facter_cache_dir') != nil and ::Facter.value('facter_cache_dir') != ''\n options[:ttl] = ::Facter.value('facter_cache_ttl').to_i if ::Facter.value('facter_cache_ttl') != nil and ::Facter.value('facter_cache_ttl') != ''\n end\n rescue\n end\n \n begin\n options[:cache_dir] = ENV['FACTER_CACHE_DIR'] if ENV['FACTER_CACHE_DIR'] != nil and ENV['FACTER_CACHE_DIR'] != ''\n options[:ttl] = ENV['FACTER_CACHE_TTL'].to_i if ENV['FACTER_CACHE_TTL'] != nil and ENV['FACTER_CACHE_TTL'] != ''\n options[:debug] = true if ENV['FACTER_DEBUG'] == 'true'\n rescue\n end\n return options\n end", "title": "" }, { "docid": "f4b6fa1e9e4f00d81ba1d4ab6ffe2d04", "score": "0.4868057", "text": "def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end", "title": "" }, { "docid": "f4b6fa1e9e4f00d81ba1d4ab6ffe2d04", "score": "0.4868057", "text": "def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end", "title": "" }, { "docid": "0c7d22d865f03e05503beead3646e766", "score": "0.48506665", "text": "def resolve\n require 'puppetfile-resolver'\n\n # Build the document model from the modules.\n model = PuppetfileResolver::Puppetfile::Document.new('')\n\n @modules.each do |mod|\n model.add_module(\n PuppetfileResolver::Puppetfile::ForgeModule.new(mod.title).tap do |tap|\n tap.version = mod.version || :latest\n end\n )\n end\n\n # Make sure the Puppetfile model is valid.\n unless model.valid?\n raise Bolt::ValidationError,\n \"Unable to resolve dependencies for modules: #{@modules.map(&:title).join(', ')}\"\n end\n\n # Create the resolver using the Puppetfile model. nil disables Puppet\n # version restrictions.\n resolver = PuppetfileResolver::Resolver.new(model, nil)\n\n # Configure and resolve the dependency graph, catching any errors\n # raised by puppetfile-resolver and re-raising them as Bolt errors.\n begin\n result = resolver.resolve(\n cache: nil,\n ui: nil,\n module_paths: [],\n allow_missing_modules: true\n )\n rescue StandardError => e\n raise Bolt::Error.new(e.message, 'bolt/puppetfile-resolver-error')\n end\n\n # Validate that the modules exist.\n missing_graph = result.specifications.select do |_name, spec|\n spec.instance_of? PuppetfileResolver::Models::MissingModuleSpecification\n end\n\n if missing_graph.any?\n titles = model.modules.each_with_object({}) do |mod, acc|\n acc[mod.name] = mod.title\n end\n\n names = titles.values_at(*missing_graph.keys)\n plural = names.count == 1 ? '' : 's'\n\n raise Bolt::Error.new(\n \"Unknown module name#{plural} #{names.join(', ')}\",\n 'bolt/unknown-modules'\n )\n end\n\n # Filter the dependency graph to only include module specifications. This\n # will only remove the Puppet version specification, which is not needed.\n specs = result.specifications.select do |_name, spec|\n spec.instance_of? PuppetfileResolver::Models::ModuleSpecification\n end\n\n @modules = specs.map do |_name, spec|\n Bolt::Puppetfile::Module.new(spec.owner, spec.name, spec.version.to_s)\n end.to_set\n end", "title": "" }, { "docid": "75572adb04c8258524c1321aad242493", "score": "0.48340136", "text": "def initialize(options = nil)\n @options = options || {}\n @logger = @options.delete(:logger) || Logger.new($stdout, level: :fatal)\n Train::Platforms::Detect::Specifications::OS.load\n Train::Platforms::Detect::Specifications::Api.load\n\n # default caching options\n @cache_enabled = {\n file: true,\n command: false,\n api_call: false,\n }\n\n @cache = {}\n @cache_enabled.each_key do |type|\n clear_cache(type)\n end\n end", "title": "" }, { "docid": "5191e75dd580dac16719efd98dda3a53", "score": "0.48283598", "text": "def puppet_resource(opts, &block)\n if opts.is_a?(String)\n opts = {:resource => opts}\n end\n\n RSpecSystemPuppet::Helpers::PuppetResource.new(opts, self, &block)\n end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "aaf94b9c212e40acb391bdf4ef30dd1f", "score": "0.481918", "text": "def gemspec_helper=(_arg0); end", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "0a31fbb18aba7cce0067d7197205a57c", "score": "0.48147625", "text": "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "740322a39976937c174729f942e48408", "score": "0.48109987", "text": "def submodules(options = T.unsafe(nil)); end", "title": "" }, { "docid": "740322a39976937c174729f942e48408", "score": "0.48109987", "text": "def submodules(options = T.unsafe(nil)); end", "title": "" }, { "docid": "5eafca711701fbb0706a56ca4b52cd6b", "score": "0.48076722", "text": "def enable_dependency_loading=(_arg0); end", "title": "" }, { "docid": "5eafca711701fbb0706a56ca4b52cd6b", "score": "0.48076722", "text": "def enable_dependency_loading=(_arg0); end", "title": "" }, { "docid": "fbbecdcec50eab15aec2cff6d117d22e", "score": "0.4787011", "text": "def swap_rspec_configuration(key, value); end", "title": "" }, { "docid": "223cbf2937adb7916d1c7655e29115da", "score": "0.47839418", "text": "def specs\n collect_specs_via(:specs)\n end", "title": "" }, { "docid": "6e6b689ebe4b9e9bce57ca6f4de901bc", "score": "0.4772508", "text": "def initialize options = {}, &block\n @enabled = false\n @entries = []\n @environments = []\n @files = []\n @options = options\n\n path, name = options.values_at :path, :name\n\n raise ArgumentError, \"can't specify both name and path!\" if name && path\n options[:path] = File.expand_path(\"~/.gem/repos/#{name}\") if name\n\n fire :initializing\n\n user = File.expand_path \"~/.isolate/user.rb\"\n load user if File.exist? user\n\n file, local = nil\n\n unless FalseClass === options[:file]\n file = options[:file] || Dir[\"{Isolate,config/isolate.rb}\"].first\n local = \"#{file}.local\" if file\n end\n\n load file if file\n\n if block_given?\n /\\@(.+?):\\d+/ =~ block.to_s\n files << ($1 || \"inline block\")\n instance_eval(&block)\n end\n\n load local if local && File.exist?(local)\n fire :initialized\n end", "title": "" }, { "docid": "b42563ac672ebae21ea4061f37310b25", "score": "0.47630784", "text": "def initialize(options = {})\n @configuration = PyramidScheme::Configuration.new\n @index_provider = @configuration[:index_provider_class].new\n @indexer_class = @configuration[:indexer_class]\n end", "title": "" }, { "docid": "3be955ab014b6a4da14478a2d272eba7", "score": "0.47610867", "text": "def refresh!\n load_gems_in(self.class.installed_spec_directories)\n end", "title": "" }, { "docid": "33804791d92664365acf86fe4a2c74b9", "score": "0.47594798", "text": "def initialize(options = {})\n # Use any options given, but fall back to the defaults set on the module\n ChefAPI::Configurable.keys.each do |key|\n value = if options[key].nil?\n ChefAPI.instance_variable_get(:\"@#{key}\")\n else\n options[key]\n end\n\n instance_variable_set(:\"@#{key}\", value)\n end\n\n yield self if block_given?\n end", "title": "" }, { "docid": "d77720800fc06f6021114cf270e82114", "score": "0.4751305", "text": "def run_module_spec(module_name)\n\n puts '-' * 80\n puts \"Running rspec tests for module #{module_name}\"\n puts '-' * 80\n\n Dir.chdir(\"modules/#{module_name}\") do\n # The following is a customized replacement for 'spec_prep'.\n # We do not want to use upstream modules which are usually installed\n # using `rake spec_prep`, instead we symlink to our own modules.\n directory_name = \"spec/fixtures\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n link_name = \"spec/fixtures/modules\"\n system(\"ln -s ../../../../modules #{link_name}\") unless File.exists?(link_name)\n\n # We also need to create an empty site.pp file in the manifests dir.\n directory_name = \"spec/fixtures/manifests\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n site_file_name = \"spec/fixtures/manifests/site.pp\"\n system(\"touch #{site_file_name}\") unless File.exists?(site_file_name)\n\n puts \"Invoking tests on module #{module_name}\"\n system('rake spec_standalone')\n end\nend", "title": "" }, { "docid": "c5c098ea8de40e3060494cd1990df209", "score": "0.47491443", "text": "def initialize(name=:spec)\n @name = name\n @libs = [File.expand_path(File.dirname(__FILE__) + '/../../../lib')]\n @pattern = nil\n @spec_files = nil\n @spec_opts = []\n @warning = false\n @ruby_opts = []\n @fail_on_error = true\n @rcov = false\n @rcov_opts = ['--exclude', 'lib\\/spec,bin\\/spec,config\\/boot.rb']\n @rcov_dir = \"coverage\"\n\n yield self if block_given?\n @pattern = 'spec/**/*_spec.rb' if pattern.nil? && spec_files.nil?\n define\n end", "title": "" }, { "docid": "d55dbd1fc6687351797278178908cc69", "score": "0.47485274", "text": "def gemspecs; end", "title": "" }, { "docid": "e6b0b2c5fbe42debd375d21078db0227", "score": "0.47431952", "text": "def resolve\n require 'puppetfile-resolver'\n\n # Build the document model from the modules.\n model = PuppetfileResolver::Puppetfile::Document.new('')\n\n @modules.each do |mod|\n model.add_module(\n PuppetfileResolver::Puppetfile::ForgeModule.new(mod.title).tap do |tap|\n tap.version = mod.version || :latest\n end\n )\n end\n\n # Make sure the Puppetfile model is valid.\n unless model.valid?\n raise Bolt::ValidationError,\n \"Unable to resolve dependencies for modules: #{@modules.map(&:title).join(', ')}\"\n end\n\n # Create the resolver using the Puppetfile model. nil disables Puppet\n # version restrictions.\n resolver = PuppetfileResolver::Resolver.new(model, nil)\n\n # Configure and resolve the dependency graph, catching any errors\n # raised by puppetfile-resolver and re-raising them as Bolt errors.\n begin\n result = resolver.resolve(\n cache: nil,\n ui: nil,\n module_paths: [],\n allow_missing_modules: false\n )\n rescue StandardError => e\n raise Bolt::Error.new(e.message, 'bolt/puppetfile-resolver-error')\n end\n\n # Turn specifications into module objects. This will skip over anything that is not\n # a module specification (i.e. a Puppet version specification).\n @modules = result.specifications.each_with_object(Set.new) do |(_name, spec), acc|\n next unless spec.instance_of? PuppetfileResolver::Models::ModuleSpecification\n acc << Bolt::Puppetfile::Module.new(spec.owner, spec.name, spec.version.to_s)\n end\n end", "title": "" }, { "docid": "5eb10ccf7d9b859b4355ac5bd95b6594", "score": "0.4741616", "text": "def specs\n checkout\n\n return [] unless install_dir\n\n Dir.chdir install_dir do\n Dir['{,*,*/*}.gemspec'].map do |spec_file|\n directory = File.dirname spec_file\n file = File.basename spec_file\n\n Dir.chdir directory do\n spec = Gem::Specification.load file\n if spec\n spec.base_dir = base_dir\n\n spec.extension_dir =\n File.join base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version, \"#{name}-#{dir_shortref}\"\n\n spec.full_gem_path = File.dirname spec.loaded_from if spec\n end\n spec\n end\n end.compact\n end\n end", "title": "" }, { "docid": "9a0ddd28773f19e66199ff732c305d3a", "score": "0.47402218", "text": "def initialize path, options = {}, &block\n @enabled = false\n @entries = []\n @environments = []\n @install = options[:install]\n @path = path\n @verbose = options[:verbose]\n\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "48217725036ed0d8bd534c89c48f5c31", "score": "0.4738553", "text": "def search_for(host, options = T.unsafe(nil)); end", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "b3783264ea253ce8871e64c72e23b04c", "score": "0.4736773", "text": "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "title": "" }, { "docid": "9e3350aa540faffd9baa2cf0fec5a0cc", "score": "0.47314942", "text": "def to_resolver_module\n require 'puppetfile-resolver'\n\n PuppetfileResolver::Puppetfile::GitModule.new(name).tap do |mod|\n mod.remote = @git\n mod.ref = sha\n end\n end", "title": "" }, { "docid": "316622571b7a3fce1f28985726be3497", "score": "0.47288412", "text": "def resolve\n options[:rootpath] ||= Pathname.pwd\n options[:rootpath] = Pathname.new(options[:rootpath])\n options[:encryption_key] = resolve_encryption_key(options[:encryption_key])\n options[:decryption_key] = resolve_decryption_key(options[:decryption_key])\n options[:namespaces] ||= []\n options[:preset] ||= resolve_preset\n\n if %w{rails rails-engine}.include?(options[:preset])\n if options[:preset] == 'rails-engine'\n engine_spec_dummy_directory = options[:rootpath] + 'spec' + 'dummy'\n engine_test_dummy_directory = options[:rootpath] + 'test' + 'dummy'\n\n options[:rootpath] = if (engine_spec_dummy_directory + 'config.ru').exist?\n engine_spec_dummy_directory\n elsif (engine_test_dummy_directory + 'config.ru').exist?\n engine_test_dummy_directory\n end\n end\n\n options[:basepath] ||= options[:rootpath] + 'config'\n\n if options[:namespaces] == []\n require options[:rootpath].join('config', 'application').to_s\n\n options[:namespaces] = [\n ::Rails.env,\n Socket.gethostname,\n ]\n end\n else\n options[:basepath] ||= options[:rootpath]\n end\n\n options[:basepath] = Pathname.new(options[:basepath])\n\n options[:files] ||= [\n options[:basepath] + 'settings*.yml',\n options[:basepath] + 'settings',\n ]\n\n options\n rescue LoadError\n options\n end", "title": "" }, { "docid": "433cb380f9ccdfbe354f440fed469e91", "score": "0.47233135", "text": "def puppet_install(opts = {}, &block)\n RSpecSystemPuppet::Helpers::PuppetInstall.new(opts, self, &block)\n end", "title": "" }, { "docid": "e8cb30c86f136fbe1fb831055c24e871", "score": "0.47225535", "text": "def module_config\r\n []\r\n end", "title": "" }, { "docid": "cce3e78a71959ae6fc5a51c30b7068e5", "score": "0.47206149", "text": "def poise_spec_helpers\n @poise_spec_helpers ||= {resources: {}, providers: {}}\n end", "title": "" }, { "docid": "e9c2e8f6c17adad4ba242f979a4dfd4d", "score": "0.47197857", "text": "def set_defaults\r\n @options = {\r\n :caching => true\r\n }\r\n end", "title": "" }, { "docid": "10d0bcd10d2592c0766a4e1ff2dd537f", "score": "0.4711854", "text": "def cache_module(mod)\n\t\t@modcache[mod.type][mod.refname] = 1\n\tend", "title": "" }, { "docid": "8a15089026810e013aba2964b5553f15", "score": "0.47034538", "text": "def specs\n @specs ||= begin\n specs = resolve.materialize(requested_dependencies)\n\n all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))\n if all_dependencies.any? { |d| d.name == \"bundler\" } && !specs[\"bundler\"].any?\n bundler = sources.metadata_source.specs.search(bundler_query).last\n specs[\"bundler\"] = bundler\n end\n\n specs\n end\n end", "title": "" }, { "docid": "a28b2d8fc11125c5e22392311b72379d", "score": "0.46968427", "text": "def load_spec(name, version, platform, source) # :nodoc:\n @specs.fetch name\n end", "title": "" }, { "docid": "6ada1c53aec5a9bc9dd79eb78a420bc4", "score": "0.46964666", "text": "def initialize(setname, config, custom_prefabs_path, options)\n super\n @vagrant_path = File.expand_path(File.join(RSpec.configuration.system_tmp, 'vagrant_projects', setname))\n\n RSpec.configuration.rspec_storage[:nodes] ||= {}\n end", "title": "" }, { "docid": "fcbde34b5ce2c4bd65919123b59163a9", "score": "0.46888202", "text": "def cache\n clone.tap { |crit| crit.options.merge!(:cache => true) }\n end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "190ae8507215cbada832f0d6e9657183", "score": "0.46837527", "text": "def gemspec_helper; end", "title": "" }, { "docid": "d45d35ff2cc5e2443b9d83859a21a0c1", "score": "0.46771973", "text": "def scan_specs(options={})\n return enum_for(__method__,options) unless block_given?\n\n ignore = if options[:ignore] then Set.new(options[:ignore])\n else config.ignore\n end\n\n @lockfile.specs.each do |gem|\n @database.check_gem(gem) do |advisory|\n is_ignored = ignore.intersect?(advisory.identifiers.to_set)\n next if is_ignored\n\n yield Results::UnpatchedGem.new(gem,advisory)\n end\n end\n end", "title": "" }, { "docid": "b9723a3c05bbff800c14b02a6ee9e70e", "score": "0.46759698", "text": "def facter(opts = {}, &block)\n RSpecSystemPuppet::Helpers::Facter.new(opts, self, &block)\n end", "title": "" } ]
fa5120199ad149ac08a1a8bb17bd7ab7
Returns a score with a logarithmic approach
[ { "docid": "1d4bcc09c172f779867683f83a9df113", "score": "0.0", "text": "def soften(value, comparison)\n # returns a shaped curve\n sigmoid = ->(x) { 1 / (1 + Math.exp(-x * 10)) }\n # simoid boundaries are [0.5, 1]\n # so remove 0.5 and multiply by 2 to have boundaries [0, 1]\n (sigmoid.call(value / comparison) - 0.5) * 2\n end", "title": "" } ]
[ { "docid": "6d6f261cfd3c64c65fd387e2614fccd3", "score": "0.72443897", "text": "def logistic\n mult = @multiplier / 232.0 + 3.57\n num = @num / 100.0\n @num = (mult * num * (1.0 - num)) * 100\n end", "title": "" }, { "docid": "49754763b7b0f076d27f8aee24e8ee7e", "score": "0.70948285", "text": "def logarithmic\n\tb = (@n*@sylnx.element(0,0) - @sy*@slnx)/(@n*@slnx2 - @slnx**2)\n\ta = (@sy - b*@slnx)/@n\n\ty_pre = @x.map{|l| a.round(2)+b.round(2)*Math.log(l)}\n\texplained_var = y_pre.map{|l| (l - @y_ave)**2}.reduce(:+)\n\tr2 = explained_var/@total_var\n\treturn b.round(2), a.round(2), r2\nend", "title": "" }, { "docid": "985c224b967cd7295cd10c8781637685", "score": "0.69248396", "text": "def log(x,base) # logarithm of some base\n Math.log(x)/Math.log(base)\nend", "title": "" }, { "docid": "6205827c31c08713769adbd791454cf7", "score": "0.68738353", "text": "def logarithmic\n\tb = (N*Sylnx.element(0,0) - Sy*Slnx)/(N*Slnx2 - Slnx**2)\n\ta = (Sy - b*Slnx)/N\n\ty_pre = X.map{|l| a.round(2)+b.round(2)*Math.log(l)}\n\texplained_var = y_pre.map{|l| (l - Y_ave)**2}.reduce(:+)\n\tr2 = explained_var/Total_var\n\treturn \"#{b.round(2)}*ln(x) + #{a.round(2)}\", r2\nend", "title": "" }, { "docid": "1b210107cc30f86f9e88a5fd32ccf394", "score": "0.67835367", "text": "def score_rn(max_score , min_score)\n raise DataError , \"[score_nr] #@score > #{max_score} || #@score < #{min_score}\" unless max_score >= min_score and max_score >= @score and @score >= min_score\n score_rn = (Math.exp(@score) - Math.exp(min_score)) / (Math.exp(max_score) - Math.exp(min_score))\n (score_rn > 0)? log(score_rn) : MIN_NUM\n #Math.slog(score_rn)\n end", "title": "" }, { "docid": "facfb54bd84814db588cbf155489f105", "score": "0.6708505", "text": "def logscale val, inverse = false\n val = val.to_f\n if inverse\n 100 * (val ** (1.0/@curvature))\n else\n (val/100)**@curvature\n end\n end", "title": "" }, { "docid": "fc23c0828c856813d442d6c55d5c27ac", "score": "0.6659753", "text": "def get_neg_log(pval)\n if pval == 0\n return 50\n elsif pval == 1\n return 0.0\n else\n return -Math.log10(pval.to_f)\n end\n end", "title": "" }, { "docid": "868e83954a0862c222fe11f32050ddb1", "score": "0.66528046", "text": "def multiply_log\n find_all{|e|e>0}.inject(0){|e,r|e+Math.log(r)}\n end", "title": "" }, { "docid": "868e83954a0862c222fe11f32050ddb1", "score": "0.66528046", "text": "def multiply_log\n find_all{|e|e>0}.inject(0){|e,r|e+Math.log(r)}\n end", "title": "" }, { "docid": "be715a684189b2e32ecd027cbfa59b59", "score": "0.6612559", "text": "def score\n Math.log(self.notices_count.to_f) * (1 / Math.log(time_since_last_error))\n end", "title": "" }, { "docid": "6560ca28861d01eee118813cad9b598a", "score": "0.659883", "text": "def log\n Math::log10(self)\n end", "title": "" }, { "docid": "717b9e1b6b4832ae74b11b19838d6203", "score": "0.65106016", "text": "def logarithmic\r\n\t\t# formula from http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html\r\n\t\tsum_y_lnx = 0\r\n\t\tsum_lnx = 0\r\n\t\tsum_square_of_lnx = 0\r\n\t\tsum_y = 0\r\n\t\tn = @x_array.size\r\n\t\t\r\n\t\tn.times do |i|\r\n\t\t\tlnx = ln(@x_array[i])\r\n\t\t\tsum_y_lnx += @y_array[i]*lnx\r\n\t\t\tsum_lnx += lnx\r\n\t\t\tsum_square_of_lnx += lnx**2\r\n\t\t\tsum_y += @y_array[i]\r\n\t\tend\r\n\t\t\r\n\t\t# y = a + b ln x\r\n\t\tb = ((n*sum_y_lnx-sum_y*sum_lnx)/(n*sum_square_of_lnx-sum_lnx**2)).round(2)\r\n\t\ta = ((sum_y - b*sum_lnx)/n).round(2)\r\n\r\n LogarithmicEquation.new(a,b)\r\n\tend", "title": "" }, { "docid": "436adbedf9b8ea8eafce1d79946f69ff", "score": "0.64815885", "text": "def simplelogit(x)\n return 0.0 if x <= 0.0\n return 1.0 if x >= 1.0\n [[Math.log(x.to_f / (1.0 - x.to_f)) / Math.log(Math::E ** 4.5) + 0.5,0.0].max,1.0].min\n end", "title": "" }, { "docid": "c8cb7d33e06d476c28e3f98d692eedbc", "score": "0.6438914", "text": "def log_if_possible val\n val > 0 ? Math.log(val, base) : val\n end", "title": "" }, { "docid": "1ea4b86b8b35241165e4c1bd9da45425", "score": "0.6423003", "text": "def log2(v)\n return Math.log(v)/Math.log(2.0)\nend", "title": "" }, { "docid": "499db4d83e8ed5a67757faa35e861ebd", "score": "0.640821", "text": "def log10\n math :log10\n end", "title": "" }, { "docid": "499db4d83e8ed5a67757faa35e861ebd", "score": "0.640821", "text": "def log10\n math :log10\n end", "title": "" }, { "docid": "2e4745a410724efc51167b39f5a0d0d7", "score": "0.6392376", "text": "def log\n math :log\n end", "title": "" }, { "docid": "2e4745a410724efc51167b39f5a0d0d7", "score": "0.6392376", "text": "def log\n math :log\n end", "title": "" }, { "docid": "a24490cba23f1dac8b496ae9ceb27095", "score": "0.6377274", "text": "def ln\n map {|v| Math::log(v)}\n end", "title": "" }, { "docid": "d2c9a8fec23d527c08d6cab1e6a13743", "score": "0.6374612", "text": "def logsumexp(logs)\n ml = logs.max\n ml + Math.log(logs.inject(0.0) { |a, l| a + Math.exp(l - ml) })\nend", "title": "" }, { "docid": "edb4c8e52722d98c241ad7695dbd6571", "score": "0.63450205", "text": "def level(lumin)\n Math.log(lumin.to_f) * 2.0 / Math.log(2.0) + 16.0\nend", "title": "" }, { "docid": "edb4c8e52722d98c241ad7695dbd6571", "score": "0.63450205", "text": "def level(lumin)\n Math.log(lumin.to_f) * 2.0 / Math.log(2.0) + 16.0\nend", "title": "" }, { "docid": "73d9157ff719bdabf1093d88b2b49a3a", "score": "0.6312566", "text": "def score(category, words)\n size = category.size.to_f\n return -Float::INFINITY unless size > 0\n scores = category.scores(words)\n scores.inject(0.0) { |s, score| s + Math.log((score || 0.1) / size) }\n end", "title": "" }, { "docid": "30e7f150ebb8478eb9c682bf27c04e42", "score": "0.6292305", "text": "def test_log\n test_values = LARGE_RANGE_VALUES.reject do |x|\n # reject minus and zero values\n x[0,1] == '-' || x == '0'\n end\n compare_with_float(test_values, OraNumber,\n Proc.new {|n| Math::log(n)},\n Proc.new {|n| OCI8::Math::log(n)})\n compare_with_float(test_values, OraNumber,\n Proc.new {|n| Math::log(n)/Math::log(3)},\n Proc.new {|n| OCI8::Math::log(n, 3)})\n end", "title": "" }, { "docid": "ed93f2b79688323d5747041c0d5ac13d", "score": "0.62568676", "text": "def log5(a, b)\n return a*(1 - b)/(a*(1 - b) + (1 - a)*b)\nend", "title": "" }, { "docid": "ed93f2b79688323d5747041c0d5ac13d", "score": "0.62568676", "text": "def log5(a, b)\n return a*(1 - b)/(a*(1 - b) + (1 - a)*b)\nend", "title": "" }, { "docid": "8042cd88c2a84679ee9c47c37d03edf8", "score": "0.62461114", "text": "def log_norm(val, norm)\n retval = norm * Math.log10(Float(val) / norm * 10)\n retval < 0 ? 0 : retval\n end", "title": "" }, { "docid": "3be42a74f0c8262e6335d2381de80496", "score": "0.62286866", "text": "def score\n weighted_score = score_math\n (weighted_score * 1000).floor / 1000.0\n end", "title": "" }, { "docid": "43a773d4bd2ecdc67f4f8055bc6cbd3f", "score": "0.62280756", "text": "def stat_theil_l_index\n stat_normalized_distribution.inject(0) { |s,ae| \n e=ae[1].to_f; a=ae[0].to_f; s + a*Math.log(a/e) }\n end", "title": "" }, { "docid": "7b08c1bbf4279e02703a33bcd790c179", "score": "0.62233615", "text": "def boost(amount)\n Weights::Logarithmic.new(amount)\n end", "title": "" }, { "docid": "ce6638059a0b826ae6bf4dbedd9de507", "score": "0.6217779", "text": "def log_n(base, num)\n Math.log(num) / Math.log(base)\n end", "title": "" }, { "docid": "37527d7508d552d2ecd8a0a746c18e82", "score": "0.6195975", "text": "def logrms pcm\n sum_of_squares = 0.0\n pcm.each {|sample| sum_of_squares += sample * sample}\n rms = Math.sqrt sum_of_squares / pcm.size;\n rms = Math.max rms, 1\n Math.log(rms) * 20\n end", "title": "" }, { "docid": "54c423da54422b90bec2b2443c3e77fd", "score": "0.6170868", "text": "def log_ratio\n result = Examples.log_ratio\n\n result += words.map{ |word| Words[word].log_ratio }.sum\n\n if respond_to?(:features, true)\n result += present_features.map{ |feature| Features[feature].log_ratio }.sum\n end\n\n result\n end", "title": "" }, { "docid": "f0c4c2c817cdea32a987627a64e30e70", "score": "0.61431634", "text": "def safe_log(v)\n v > 0 ? Math.log(v) : -1\nend", "title": "" }, { "docid": "a527f91c24f786bf5bff475b2a646b74", "score": "0.6092287", "text": "def db20(p1,p0)\n 20 * Math::log10(p1/p0.to_f) \n end", "title": "" }, { "docid": "64dd506c2689dcfee6ad25564cbc6ef9", "score": "0.6086943", "text": "def get_log10(val)\n if val.to_f <= 0\n print \"p value out of range #{val}\\n\"\n end\n return -Math.log10(val.to_f)\n end", "title": "" }, { "docid": "e989bf60f8f370c273578b6797c89925", "score": "0.60866475", "text": "def score(probability, max=65535)\n log10 = Math.log10(probability / 10)\n ((-1 / log10) * max).to_i\n end", "title": "" }, { "docid": "f6814881181547e5a08be5d20a863023", "score": "0.60840845", "text": "def p_value(y, k, lam)\n\t\t \t return 1.0 if y > 1.0\n\t\t\t return 0.0 if y < 0.0\n\t\t \t return -lam*(Math.log(1.0-y))**(1.0/k)\n\t\t \t end", "title": "" }, { "docid": "355371c1fd5295aa7da7366d9656fbb8", "score": "0.6070927", "text": "def loglike_data\n loglike=0\n @nr.times do |i|\n @nc.times do |j|\n res=@matrix[i,j].quo(@total)\n if (res==0)\n res=1e-16\n end\n loglike+= @matrix[i,j] * Math::log(res )\n end\n end\n loglike\n end", "title": "" }, { "docid": "0f69d19e47c08cf7bac866bb16a376f0", "score": "0.6065774", "text": "def calc_logistic_pop\n number_of_years = query_year - max_data_year\n\n capital_a = (POPULATION_CAPACITY - max_data_year_pop) / max_data_year_pop\n\n denominator_part2 = Math.exp(-POST_DATA_GROWTH_RATE * number_of_years)\n denominator = 1 + (capital_a * denominator_part2)\n\n result = POPULATION_CAPACITY / denominator\n\n result.to_i\n end", "title": "" }, { "docid": "a14b824d5f04c185bec4091cf20fda06", "score": "0.6064699", "text": "def log3(n)\n a = log(n)\n b = log(3)\n return a / b\nend", "title": "" }, { "docid": "564dde74c940ae101aad77f3cf40033c", "score": "0.6053993", "text": "def score\n 99.98\n end", "title": "" }, { "docid": "60478263a175becf93cd158bd2a8b8c9", "score": "0.6050173", "text": "def add_logs(l1, l2)\n\t\tl2 + Math.log(1 + Math::E**(l1-l2))\n\tend", "title": "" }, { "docid": "60478263a175becf93cd158bd2a8b8c9", "score": "0.6050173", "text": "def add_logs(l1, l2)\n\t\tl2 + Math.log(1 + Math::E**(l1-l2))\n\tend", "title": "" }, { "docid": "cd003844a1ff28ba64abcc6c14fad636", "score": "0.60211164", "text": "def ln(a, implementierung = 1)\n\n # Wenn ein Integer uebergeben wurde, zaubern wir ein Float draus\n if a.is_a? Integer\n # arbeite mit einer Kopie, um nicht destruktiv zu sein\n x = a.to_f\n else\n x = a\n end\n\n # froehliches Exceptions werfen\n raise RangeError unless (x.is_a? Float or x.is_a? BigDecimal)\n raise RangeError unless x.finite?\n raise RangeError if x <= 0.0\n raise RangeError if x > 2.0\n\n # die Reihenentwicklung des natuerlichen Logarithmus fuer (1.5) liefert bei 49 Durchlaeufen die gleiche Genauigkeit, wie Math::log(1.5)\n # bei x=2.0 sieht das schon anders aus\n # welches ist nun also ein vernuenftiger Wert?\n\n genauigkeit = 500\n\n # Welche Implementierung wurde gewaehlt?\n # gut, um die verschiedenen Implementierungen auf ihre Performance zu ueberpruefen\n case implementierung\n when 1\n ln_iterativ_for(x, genauigkeit)\n when 2\n ln_iterativ_reduce(x, genauigkeit)\n when 3\n ln_rekursiv(x, genauigkeit)\n end\n\nend", "title": "" }, { "docid": "7267295b33e64bbd95626a3a0e1f18fc", "score": "0.6021092", "text": "def logarithmic_backoffs\n Enumerator.new do |yielder|\n x = 0.3\n loop do\n x += 1\n yielder << Math.log2(x**2)\n end\n end\n end", "title": "" }, { "docid": "9b9b905eab085f261275ad9c207278c5", "score": "0.6013101", "text": "def log(base, number)\n a = 1\n result = 0\n while a <= number\n a *= base\n result += 1\n end\n result -= 1\n a /= base\n remainder = number - a\n return \"#{base} ** #{result} == #{a}, remainder = #{remainder}\"\nend", "title": "" }, { "docid": "27f9d7ceceaf7a6c01a11e2c51ca58b9", "score": "0.60123897", "text": "def log_regression(x, y)\n\tx \t\t\t\t\t\t = x.collect { |xi| Math.log(xi) }\n\tsemi_log_coeff = regression(x, y, 1)\n\teqn \t\t\t\t\t = ['log', semi_log_coeff[0], semi_log_coeff[1]]\n\ty_expected\t\t = x.map { |xi| eqn[1] + (Math.log(xi)*eqn[2]) }\n\n\teqn << s_value(y, y_expected)\nend", "title": "" }, { "docid": "e01c88f822547681c311dd1eb9fe35f7", "score": "0.6004799", "text": "def assert_performance_logarithmic threshold = 0.99, &work\n assert_performance validation_for_fit(:logarithmic, threshold), &work\n end", "title": "" }, { "docid": "5925b4ebcdc59d776cb12e7bda98ba06", "score": "0.59908605", "text": "def log_with_base(base, num)\n Math.log(num) / Math.log(base)\n end", "title": "" }, { "docid": "62010841b5068997afc7f900b3764c5b", "score": "0.5989045", "text": "def log_prob(key)\n if @counter.total == 0 || !key || key == ''\n return Math.log(0, 2.0) # -Infinity\n end\n\n count = @counter.count(key, 0.5)\n Math.log(count, 2.0) - Math.log(counter.total, 2.0)\n end", "title": "" }, { "docid": "2aac9daf0063ceaa4742455bf2a3392a", "score": "0.59837943", "text": "def calculate_experience_for_level(level)\n x = (coefficient_a * Math.exp(coefficient_b * level)).to_i\n y = 10**(Math.log(x) / Math.log(10) - 2.2).to_i\n (x / y).to_i * y\n end", "title": "" }, { "docid": "3cfb230e06e482877ef9b3eba6a2562b", "score": "0.5978271", "text": "def ln\n Math::log(self)\n end", "title": "" }, { "docid": "127d70f82163741a33e07786ec81594e", "score": "0.5973054", "text": "def p(n)\n n * (Math::log(n) + Math::log(Math::log(n))-1 + 1.8*Math::log(Math::log(n))/Math::log(n))\nend", "title": "" }, { "docid": "5e77f9a6e10bb67337e58e834e194124", "score": "0.594904", "text": "def log(subject)\n\t\t\tif subject.is_a?(Array) or subject.is_a?(NArray)\n\t\t\t\treturn subject.collect{|n| NMath::log n}\n\t\t\telse\n\t\t\t\treturn log(Array[subject])[0]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "3928b85ef53c7634561aea7409766505", "score": "0.59378576", "text": "def log(x, base=nil)\n _convert(x).log(base, self)\n end", "title": "" }, { "docid": "c978f5d937c80e127148466c3908480a", "score": "0.59376454", "text": "def log2(x)\n _convert(x).log10(self)\n end", "title": "" }, { "docid": "c817c9b4ae1e451ccb3c6c6850215dc7", "score": "0.59340554", "text": "def fit_logarithmic xs, ys\n n = xs.size\n xys = xs.zip(ys)\n slnx2 = sigma(xys) { |x, _| Math.log(x) ** 2 }\n slnx = sigma(xys) { |x, _| Math.log(x) }\n sylnx = sigma(xys) { |x, y| y * Math.log(x) }\n sy = sigma(xys) { |_, y| y }\n\n c = n * slnx2 - slnx ** 2\n b = ( n * sylnx - sy * slnx ) / c\n a = (sy - b * slnx) / n\n\n return a, b, fit_error(xys) { |x| a + b * Math.log(x) }\n end", "title": "" }, { "docid": "545654744a2d5ca914ea8a817096097f", "score": "0.5930031", "text": "def normalized_log_term_frequency(term)\n count = term_counts[term]\n if count > 0\n (1 + Math.log(count)) / (1 + Math.log(average_term_count))\n else\n 0\n end\n end", "title": "" }, { "docid": "ec1456b4ff27295c248a3b8d5b729672", "score": "0.5920572", "text": "def stat_theil_s_index\n 0.5*stat_normalized_distribution.inject(0) { |s,ae| \n e=ae[1]; a=ae[0].to_f; s + Math.log(e/a)*(e-a) }\n end", "title": "" }, { "docid": "639b594d7e5cc69f65474038385912a4", "score": "0.59166396", "text": "def logb(x)\n _convert(x).logb(self)\n end", "title": "" }, { "docid": "e194c65247bcf1b09dc6cf10743e2648", "score": "0.59164375", "text": "def sum_of_logarithms(from = 0, to = list_size - 1)\n @sum_of_logarithms ||= DoubleDescriptive.sumOfLogarithms(@array_list, from, to)\n end", "title": "" }, { "docid": "e23ab5a2488151c44c8b485bc4dd8a89", "score": "0.5910393", "text": "def optimal_aggregation\n [2, Math::E, 3, 4].map{|i| i * (Math.log(1000)/Math.log(i)) }\nend", "title": "" }, { "docid": "7e2c9b38f969974166275bbbd8e386c2", "score": "0.5908733", "text": "def val2db(iRatio)\r\n if (iRatio == 0)\r\n return -1.0/0\r\n else\r\n return (6*Math.log(iRatio))/Math.log(2.0)\r\n end\r\nend", "title": "" }, { "docid": "1eb1c88cfbde0e9bec1adc19fd43bbc9", "score": "0.5884323", "text": "def entropy(hash) \n entr = 0.0\n total = 0.0\n hash.each_value do |v|\n total += v\n end\n hash.each_value do |v|\n if v > 0\n entr += (v/total)*Math.log2(v/total)\n end\n end\n \n entr = -entr#/Math.log2(normalizer) \n \n return entr\nend", "title": "" }, { "docid": "43195339f0711375d08f7f9cdd84f4fb", "score": "0.5876201", "text": "def score(category, features)\n Math.log(prior category) + features_likelihood(features, category)\n end", "title": "" }, { "docid": "600854cad122fd5e1b4fd9775d314d9c", "score": "0.5859802", "text": "def calculate_score\n self.score = RatingSystem::SCORE_FACTOR * (skill_mean - 2 * skill_deviation)\n self.score = [self.score.to_i, 0].max # ensure not negative\n end", "title": "" }, { "docid": "9c79efd5bf353a6c423a90c831caa706", "score": "0.5851814", "text": "def get_l_of_c(cat)\n if @logs_of_c[cat] == nil then\n value = -Math.log(get_prob_of_category(cat),2)\n @logs_of_c[cat] = value\n return value\n else\n return @logs_of_c[cat]\n end\n end", "title": "" }, { "docid": "13a7dc139d6a9e34caaa285125c69292", "score": "0.5846145", "text": "def ilog(probability)\n max = ceil || 65535\n log10 = Math.log10(probability / 10)\n ((-1 / log10) * max).to_i\n end", "title": "" }, { "docid": "6daca8fe53ae8e7b3677ae0609987c89", "score": "0.5832559", "text": "def multiplier_score(x)\n return score * x\n end", "title": "" }, { "docid": "285e670309b500d08533b32d7de8db75", "score": "0.5823281", "text": "def score\n @value.to_f\n end", "title": "" }, { "docid": "5b18096ef96b2af0cf64bd52a42ab541", "score": "0.5822907", "text": "def score_sombrero\n score = [\n -(weight*20 - 279)**2,\n -5000*((40-limbs).abs)\n ].sum + 150000\n [score, 0].max\n end", "title": "" }, { "docid": "c68683912cf41681601d2120ef7b97ef", "score": "0.5802499", "text": "def pgf(x)\n return map.max_score.to_f if x.to_f == 1.0\n\n 1 + ((x - 0.5) / (1 - x))\n end", "title": "" }, { "docid": "8061dfe350080a0bde52cd3f634c0d00", "score": "0.57953775", "text": "def calculate_score\n self.score = RatingSystem::SCORE_FACTOR * (skill_mean - RatingSystem::SCORE_MEAN_DEVIATION_K * skill_deviation)\n self.score = [self.score.to_i, 0].max # ensure not negative\n end", "title": "" }, { "docid": "c4f4cd91636c5499f50b8b944eef1f7b", "score": "0.57806736", "text": "def calculate_score\n self.score = (ll_score + tw_base + fb_base + google_base + pinterest_base + linkedin_base + delicious_base + stumble_base) / (((Time.now - created_at) / 1.hour) + 2 ** 3.0)\n end", "title": "" }, { "docid": "53f1cf35bb6a1f70a4ed14c8bfdbe5da", "score": "0.57744294", "text": "def get_score(score_hash)\n\t6.times do |i|\n\t\tif score_hash[i + 1] == nil\t# convert the nil values to zeros\n\t\t\tscore_hash[i + 1] = 0\n\t\tend\n\tend\n\troll_score = 0\n\tif score_hash[1] >= 3\n\t\troll_score = roll_score + 1000 # add 1000 points for three or more one's\n\tend\n\tif score_hash[1] == 6\n\t\troll_score = roll_score + 1000 # add another 1000 points if there are 6 one's\n\tend\n\t5.times do |i|\n\t\tif score_hash[i + 2] >= 3\n\t\t\troll_score = roll_score + 100 * (i + 2) # for other numbers, add 100 times the value\n\t\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# for more than three of a kind\n\t\tif score_hash[i + 2] == 6\n\t\t\troll_score = roll_score + 100 * (i + 2) # add that value again if there are \n\t\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# six of a kind\n\tend\n\troll_score = roll_score + score_hash[1]%3 * 100 # 100 points each for extra one's\n\troll_score = roll_score + score_hash[5]%3 * 50\t # 50 points each for extra five's\nend", "title": "" }, { "docid": "8f6297428a8608b48a71f55aecaa14d4", "score": "0.57735723", "text": "def score\n # workaround for a bug in ruby 1.9.2's floats\n sprintf(\"%.3f\", @score).to_f\n end", "title": "" }, { "docid": "c11bb505700cabd0d6f12e19baeb5766", "score": "0.57639146", "text": "def set_log_score\n @log_score = LogScore.find(params[:id])\n end", "title": "" }, { "docid": "a967ee14261fbbbdb13208cc16213501", "score": "0.57483554", "text": "def stat_entropy\n sum = stat_sum.to_f\n -inject(0) { |s,p| p=p/sum; s + p*Math.log(p) }\n end", "title": "" }, { "docid": "1aeba2b0e7664bec09fa745340ee3b39", "score": "0.5744894", "text": "def get_everage_score\r\n (@total_score / @results_count).round(2)\r\n end", "title": "" }, { "docid": "5aa8796708af547fa2c60dde4570db7d", "score": "0.5737656", "text": "def max_score\n # @value.to_f\n end", "title": "" }, { "docid": "5aa8796708af547fa2c60dde4570db7d", "score": "0.5737656", "text": "def max_score\n # @value.to_f\n end", "title": "" }, { "docid": "2bce4bd6973b3477bff256a752eb7aeb", "score": "0.57329816", "text": "def score(indexes)\n absolute_score(indexes).to_f / maximum_score\n end", "title": "" }, { "docid": "05706593a6cf40900ede349940627feb", "score": "0.572521", "text": "def log(n1)\r\n\r\n @num1=n1\r\n print \"The log of #{@num1} is : #{Math.log(@num1.to_i)}\"\r\n\r\n end", "title": "" }, { "docid": "7cc625fd05950a97328bd6fde2c657a3", "score": "0.57123953", "text": "def pretty_score\n \"%3.1f%\" % (@score*100)\n end", "title": "" }, { "docid": "d45ab6c80e93e963ac1921598b21b790", "score": "0.57028264", "text": "def test_Math_InstanceMethods_log\n\t\tassert_equal(2, Math.log(4,2))\n\t\tassert_equal(2, Math.log(9,3))\n\t\tassert_equal(2, Math.log(25,5))\n\tend", "title": "" }, { "docid": "0bd788f675ee8d6721101133ee63cb38", "score": "0.5701665", "text": "def multiplier_score(multiplier)\n return multiplier * score\n end", "title": "" }, { "docid": "0bd788f675ee8d6721101133ee63cb38", "score": "0.5701665", "text": "def multiplier_score(multiplier)\n return multiplier * score\n end", "title": "" }, { "docid": "83d32d67cc00f9c4763c18bf5ec36bea", "score": "0.5697723", "text": "def multiplier_score(multiplier)\n return score * multiplier\n end", "title": "" }, { "docid": "db9a809ae66ef5b32d1db83b0546f660", "score": "0.5696023", "text": "def logspace(s, e, num=50, base=10.0, precision=6)\n\texponents = linspace(s, e, num)\n\tepsilon = 10**(-precision)\n\texponents.map { |exp| (base**exp).round(precision).to_f().try_int(epsilon) }\nend", "title": "" }, { "docid": "174e7b3e1803242177a9dd29ee8335b0", "score": "0.5690311", "text": "def log\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n result = nil\n r = nil\n\n begin\n # at line 74:3: ( 'ln' r= exp | r= exp )\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0 == T__19 )\n alt_3 = 1\n elsif ( look_3_0 == LPAREN || look_3_0.between?( INT, UNMODVAR ) )\n alt_3 = 2\n else\n raise NoViableAlternative( \"\", 3, 0 )\n end\n case alt_3\n when 1\n # at line 74:5: 'ln' r= exp\n match( T__19, TOKENS_FOLLOWING_T__19_IN_log_268 )\n @state.following.push( TOKENS_FOLLOWING_exp_IN_log_272 )\n r = exp\n @state.following.pop\n # --> action\n result = BigMath.log(r, 2)\n # <-- action\n\n when 2\n # at line 75:5: r= exp\n @state.following.push( TOKENS_FOLLOWING_exp_IN_log_282 )\n r = exp\n @state.following.pop\n # --> action\n result = r \n # <-- action\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return result\n end", "title": "" }, { "docid": "a39dc757da7df2b95ba4e30bba46a850", "score": "0.5686171", "text": "def generate_logs\n value = 1 # Start with the 0th power\n 256.times do |log| # For all exponents 0-255\n @alog[log] = value\n @log[@alog[log]] = log\n\n value <<= 1 # Multiply by x\n value ^= REDUCING_POLYNOMIAL if value > 0xFF # If the value overflows\n value ^= @alog[log] # Add it's original value to itself\n end\n\n # Set some sensible defaults as log is only valid from 1-255\n # and antilog only from 0-254\n @log[0] = 0\n @alog[255] = @alog[0]\n end", "title": "" }, { "docid": "4899647f0adf9a1c7ba2d7fbaaa139ac", "score": "0.56824785", "text": "def compute_benford_prediction(n)\n p=Math.log(1+(1.0/n),10) * 100\n return p.round(2)\n end", "title": "" }, { "docid": "f7c246a43828f17990c6d3a152a46b77", "score": "0.56815624", "text": "def log_likelihoods(likelihoods)\n\t\t\tlikelihoods.map { |l| l.to_f == 0 ? -100 : Math.log10(l.to_f) }\n\t\tend", "title": "" }, { "docid": "b9293033e20b3a3a6d0c3e61f32d9db6", "score": "0.5680203", "text": "def score\n if !RatingVariable.current.nil?\n \t xVar= RatingVariable.current.x\n\t yVar= RatingVariable.current.y\n end\n\t return '' unless ((accuracy.to_f + clarity.to_f + relevance.to_f ) > 0 )\n \n score = (((accuracy.to_f * xVar) + (clarity.to_f * yVar)) / (xVar + yVar)) * (relevance.to_f / 10) \n sprintf(\"%.2f\", score) #2-decimal precision\n end", "title": "" }, { "docid": "4898b2ea4b2a64a99455cace1c8cfbeb", "score": "0.5672783", "text": "def pricesToLog(arry1)\r\n\r\n retArry = Array.new(arry1.length-1)\r\n\r\n counter=0\r\n\r\n while counter < arry1.length-1 do\r\n #p arry1[counter].to_f\r\n retArry[counter]=Math.log(arry1[counter].to_f/arry1[counter+1].to_f).round(2)\r\n counter=counter+1\r\n end\r\n\r\n return retArry\r\nend", "title": "" }, { "docid": "dd59d0c0088f3469f81c09bbac270f10", "score": "0.5669243", "text": "def db10(v1,v0)\n 10 * Math::log10(v1/v0.to_f)\n end", "title": "" }, { "docid": "a4badf079d3a3cdfc53107d5fe1a8b92", "score": "0.56536174", "text": "def d2logL\r\n sum00 = 0.0\r\n for i in 0..@n-1\r\n exponent = @parameter[0]+@predictor[i]*@parameter[1]\r\n sum00 += - @data[i] * 1.0 * 1.0 * Math.exp(exponent) / ((1.0 + Math.exp(exponent)) ** 2) -\r\n (@n_trials[i]-@data[i]) * 1.0 * 1.0 * Math.exp(-exponent) / ((1.0 + Math.exp(-exponent)) ** 2)\r\n end\r\n sum01 = 0.0\r\n for i in 0..@n-1\r\n exponent = @parameter[0]+@predictor[i]*@parameter[1]\r\n sum01 += - @data[i] * 1.0 * @predictor[i] * Math.exp(exponent) / ((1.0 + Math.exp(exponent)) ** 2) -\r\n (@n_trials[i]-@data[i]) * 1.0 * @predictor[i] * Math.exp(-exponent) / ((1.0 + Math.exp(-exponent)) ** 2)\r\n end\r\n sum10 = 0.0\r\n for i in 0..@n-1\r\n exponent = @parameter[0]+@predictor[i]*@parameter[1]\r\n sum10 += - @data[i] * @predictor[i] * 1.0 * Math.exp(exponent) / ((1.0 + Math.exp(exponent)) ** 2) -\r\n (@n_trials[i]-@data[i]) * @predictor[i] * 1.0 * Math.exp(-exponent) / ((1.0 + Math.exp(-exponent)) ** 2)\r\n end\r\n sum11 = 0.0\r\n for i in 0..@n-1\r\n exponent = @parameter[0]+@predictor[i]*@parameter[1]\r\n sum11 += - @data[i] * @predictor[i] * @predictor[i] * Math.exp(exponent) / ((1.0 + Math.exp(exponent)) ** 2) -\r\n (@n_trials[i]-@data[i]) * @predictor[i] * @predictor[i] * Math.exp(-exponent) / ((1.0 + Math.exp(-exponent)) ** 2)\r\n end\r\n GSL::Matrix.alloc([sum00,sum01,sum10,sum11],2,2)\r\n end", "title": "" }, { "docid": "d47f7325412203a176e6597c863d2770", "score": "0.5649917", "text": "def default_score_for(abil)\n add = 13\n add = 16 if self.high_ability.to_s == abil.to_s\n return add if self.level.nil? # Edge cases where this is just a validation run\n add + (self.level / 2.0).floor\n end", "title": "" }, { "docid": "5d7e0ea31ce998d612d09072bee8d346", "score": "0.5647244", "text": "def calcular_tf(ocurrencias)\n 10*ocurrencias.first +\n Math.log(1 + ocurrencias.second, 10) +\n Math.log(1 + ocurrencias.third, 2) +\n 10*ocurrencias.fourth\n end", "title": "" } ]
2b914ebf47e2aafc17c3a81c400aa5a3
Return an array of all UID values in Active Directory.
[ { "docid": "fb71cd3c90d96f8149a1f7da68bc1d31", "score": "0.7462979", "text": "def load_ldap_uids\n all_uids = []\n user_filter = Net::LDAP::Filter.eq(\"objectclass\", \"user\")\n\n @ldap.search(:base => @root, :filter => user_filter) do |entry|\n begin\n uid = entry.uidNumber.pop.to_i\n all_uids.push uid\n rescue NoMethodError\n end\n end\n\n all_uids\n end", "title": "" } ]
[ { "docid": "15c4f9750f03eb8fb2f4b7c4aa54d113", "score": "0.69917023", "text": "def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end", "title": "" }, { "docid": "c5945284eca6e310f27920cf043956ae", "score": "0.6873205", "text": "def userids\n each_userid.to_a\n end", "title": "" }, { "docid": "6ab5978f300b2b3c9036e06f6311d2a2", "score": "0.6822554", "text": "def uids\n @uids ||= records.map(&:uid)\n end", "title": "" }, { "docid": "b249435d310a368d67810c0e571d7806", "score": "0.6797881", "text": "def memberids\n members = weakref(:members) do\n results = ASF.search_one(base, \"cn=#{name}\", ['member', 'memberUid']).first\n results['member'] || results['memberUid'].map {|k| ASF::Person.dn(k)} || []\n end\n\n members.map {|uid| uid[/uid=(.*?),/, 1]}\n end", "title": "" }, { "docid": "f5f03ad8a14355f8375af34d3109ddb2", "score": "0.6754593", "text": "def uids\n return [] unless valid?\n\n queries.search(orcid_query).merged_uids\n end", "title": "" }, { "docid": "d57989189f9c1648b14d546068c1a985", "score": "0.65794647", "text": "def memberids\n members = weakref(:members) do\n ASF.search_one(base, \"cn=#{name}\", 'member').flatten\n end\n members.map {|uid| uid[/uid=(.*?),/, 1]}\n end", "title": "" }, { "docid": "369dbcfc096c6f6aa668b614f2dc960e", "score": "0.6501591", "text": "def get_all_id_list\n res = []\n User.all.each do |user|\n res.append(user.id)\n end\n res\n end", "title": "" }, { "docid": "41782261a7406793845bba5c5fd569fa", "score": "0.64877784", "text": "def uids\n return @uids if @uids\n\n @uids = []\n return @uids if not exist?\n\n CSV.foreach(imap_pathname) do |row|\n @uids << row[0]\n end\n @uids = @uids.map(&:to_i).sort\n @uids\n end", "title": "" }, { "docid": "7fd0ec64af1118389a0b79235d346c94", "score": "0.64706105", "text": "def user_list\n x = ActiveRecord::Base.connection.select_all <<~SQL\n SELECT ART_user_id FROM #{@database}.user_bak\n SQL\n x.map { |id| id['ART_user_id'].to_i }.push(0).join(',')\n end", "title": "" }, { "docid": "1f178d383a0fcfd6df556be5f16ef33e", "score": "0.6437237", "text": "def village_user_ids\n users.collect do |user|\n user.uid\n end.compact\n end", "title": "" }, { "docid": "18a3a62a623d426d920cd050a21b5cfe", "score": "0.63961244", "text": "def all_members_by_uid(uids, uid_attr)\n uids.map {|uid| Net::LDAP::Filter.eq(uid_attr, uid)}.reduce(:|)\n end", "title": "" }, { "docid": "0bfad14e794d3d168831bdc53eed8142", "score": "0.6361972", "text": "def iam_list_users\n iam_r.users.to_a\n end", "title": "" }, { "docid": "443bebd918b68aa25022ab0ffd051d14", "score": "0.6315589", "text": "def get_uids(users)\n\t\t\t#puts \"users=#{users.inspect}\"\n\t\t\tif users.nil? || users.empty?\n\t\t\t\tusers ||= []\n\t\t\t\tcuruser = Etc.getlogin\n\t\t\t\tusers << curuser unless curuser.eql?(\"root\")\n\t\t\telsif users.include?(:all)\n\t\t\t\treturn []\n\t\t\tend\n\t\t\tuids = []\n\t\t\tusers.each { |user|\n\t\t\t\t\tuid = getuseruid(user)\n\t\t\t\t\tuids << uid unless uid.nil?\n\t\t\t}\n\t\t\tuids\n\t\tend", "title": "" }, { "docid": "f22719cced60ced6d5d7744526b4ca60", "score": "0.62877405", "text": "def get_names entry_uuids\n #TODO switch to use entry uuids\n names = Hash.new\n if entry_uuids.length == 0\n return names\n end\n ldap = Net::LDAP.new(host: Global.ldap.host, \n port: Global.ldap.port,\n encryption: :simple_tls,\n auth: {\n method: :simple,\n username: Global.ldap.username,\n password: Global.ldap.password\n })\n filter = \"(|\"\n entry_uuids.each { |num| filter += \"(uidNumber=#{num})\" }\n filter += \")\"\n \n treebase = \"ou=Users,dc=csh,dc=rit,dc=edu\"\n attributes = [\"uidNumber\", \"cn\"]\n ldap.open do |ldap|\n ldap.search(base: treebase, filter: filter, attributes: attributes) do |entry|\n names[entry.uidNumber[0].to_i] = entry.cn[0]\n end\n end\n return names\n end", "title": "" }, { "docid": "13be14a64f2b9799529885ae17b9f796", "score": "0.6246721", "text": "def ownerids\n owners = weakref(:owners) do\n ASF.search_one(base, \"cn=#{name}\", 'owner').flatten\n end\n owners.map {|uid| uid[/uid=(.*?),/, 1]}\n end", "title": "" }, { "docid": "1041de8cddc215eab28935c42b8e6758", "score": "0.62342983", "text": "def user_ids\n @entries_by_user_id.keys\n end", "title": "" }, { "docid": "bc7dffddb45f17c0a84f6a45159b94ee", "score": "0.62293315", "text": "def uids\n (orcid_query.uids + name_query.uids).uniq\n end", "title": "" }, { "docid": "96989754b741dde09f9abe2f9631d74d", "score": "0.62087625", "text": "def all_users\n allofem = @redis.keys(\"DismalTony:UserIdentity:*\")\n @redis.pipelined { allofem.map! { |a| @redis.hgetall(a) } }\n allofem.map!(&:value)\n allofem.map! { |a| serialize_in(a) }\n allofem\n end", "title": "" }, { "docid": "31633f3621ded79de20b29505d5e245c", "score": "0.62022114", "text": "def uid\n @ldap_data['uid'][0]\n end", "title": "" }, { "docid": "d00911931628f0cd8f39da4742844f78", "score": "0.619649", "text": "def username_ids\n username_hash.keys\n end", "title": "" }, { "docid": "079e669dcc43615c64c0960b81e6a5b2", "score": "0.6177502", "text": "def user_ids\n galaxy_users.pluck(:userid)\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.61290187", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.61290187", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "d6010605f86ba531d3d8fc5382e24957", "score": "0.61290187", "text": "def user_ids\n @attributes[:user_ids]\n end", "title": "" }, { "docid": "591f5f333d4916ad15c5e646f57ccf03", "score": "0.6115345", "text": "def user_ids\n users.collect(&:id).flatten.compact.uniq\n end", "title": "" }, { "docid": "78d32a2a3f7efa48abbbb06c3e9c3ea6", "score": "0.61092186", "text": "def user_ids\n users.select(:id).pluck(:id)\n end", "title": "" }, { "docid": "9eec7522fe48fe780e4a42895ddd9ca4", "score": "0.6103043", "text": "def rand_uid()\n return [rand_digit(), rand_digit(), rand_digit(), rand_digit()]\n end", "title": "" }, { "docid": "54b7120eb5b532104e31b84d5d49306b", "score": "0.6073031", "text": "def members\n members = weakref(:members) do\n results = ASF.search_one(base, \"cn=#{name}\", ['member', 'memberUid']).first\n results['member'] || results['memberUid'].map {|k| ASF::Person.dn(k)} || []\n end\n\n members.map {|uid| Person.find uid[/uid=(.*?),/, 1]}\n end", "title": "" }, { "docid": "00646de9dc5b934214fa2e57dab16d35", "score": "0.6064477", "text": "def get_users\n @get_users ||= results.map {|entry| entry['uid'].first}.sort\n end", "title": "" }, { "docid": "a5cfa8051e06e322ef0d73ef6a24c974", "score": "0.60633147", "text": "def uid_set; end", "title": "" }, { "docid": "a230f617642562a7d08ba10ffd3af816", "score": "0.6052497", "text": "def user_person_list\n x = ActiveRecord::Base.connection.select_all <<~SQL\n SELECT person_id FROM users WHERE user_id IN (#{user_list})\n SQL\n x.map { |id| id['person_id'].to_i }.push(0).join(',')\n end", "title": "" }, { "docid": "8f4d59d8d4fc7f91de10078982b34cb8", "score": "0.6052367", "text": "def uids\n @proc.uids\n end", "title": "" }, { "docid": "6c5623775300096aa20e584b9bb75fcb", "score": "0.60522443", "text": "def tagged_user_ids\n tagged_users.collect(&:id)\n end", "title": "" }, { "docid": "a8fad65165673d586a8d2b3732ba6902", "score": "0.6029216", "text": "def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "title": "" }, { "docid": "a8fad65165673d586a8d2b3732ba6902", "score": "0.6029216", "text": "def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "title": "" }, { "docid": "2522ee8281e27df5081876e2f39ffaf9", "score": "0.60110986", "text": "def to_a\n @uuids\n end", "title": "" }, { "docid": "9b29befdb72c144b82668bc2e4505fd4", "score": "0.5989902", "text": "def all_users\n result = []\n \n self.descendants_and_self.each { |group| result << group.users }\n \n result.flatten!\n result.uniq!\n \n return result\n end", "title": "" }, { "docid": "1710475e157813087f54987cf800c6c8", "score": "0.5969714", "text": "def all_user_ids\n (user_ids + groups.map(&:user_id)).flatten.uniq\n end", "title": "" }, { "docid": "3f5eb8614dd40ce73b43ec34b70864bf", "score": "0.59591556", "text": "def usernames\n username_hash.values\n end", "title": "" }, { "docid": "e7b517b3c6265ea6f34add87f50582ce", "score": "0.59566647", "text": "def build_user_ids(data)\n\t\tids = []\n\t\tdata.collect do |x|\n\t\t\tids << x[:user_id] if !ids.include?(x[:user_id])\n\t\tend\n\t\tids\n\tend", "title": "" }, { "docid": "7c47c52d814ee1834914c62a5059b841", "score": "0.5955414", "text": "def dn_ous\n unless @dn_ous\n @dn_ous = []\n @ldap_object.dn.split(/,/).each do |entry|\n @dn_ous.push entry.gsub(/OU=/, '').gsub(/CN=/,'') if entry =~ /OU=/ or entry == \"CN=Users\"\n end\n end\n @dn_ous\n end", "title": "" }, { "docid": "2a05f2376a5f4997fd91dfbe2bc804bd", "score": "0.5947981", "text": "def array_users\n\t@all_users= []\n\tusers = @basketballdb.execute(\"select username from users\")\n\tusers.each { |hash| @all_users << hash[\"Username\"]}\n\t@all_users\nend", "title": "" }, { "docid": "1d1bbc8c747d6ed71c3f212e64f1e630", "score": "0.5924367", "text": "def get_ids(user_list)\n (user_list||[]).collect(&:id).join(',')\n end", "title": "" }, { "docid": "b25ffbe0815e1f2776f67f3ec69be5d4", "score": "0.5919298", "text": "def read_users()\n userIds = []\n queryParams = {\n 'type': [\"User\"]\n }\n endpoint = \"/restapi/v1.0/account/~/extension/\"\n resp = $platform.get(endpoint, queryParams)\n jsonObj = resp.body\n for record in jsonObj['records'] do\n # You can filter out any user you don't want to read analytics data!\n userIds.append(record['id'].to_s)\n end\n return userIds\nend", "title": "" }, { "docid": "f15b46f66c2d25795ecfdd33937e6326", "score": "0.58989364", "text": "def interesting_user_ids\n interesting_users.select(\"#{User.quoted_table_name}.id\").map(&:id)\n end", "title": "" }, { "docid": "24b32cd45a0eb996489ef2460c6b4df5", "score": "0.58861", "text": "def extract_user_ids\n User.all.map do |user|\n user.id\n end\nend", "title": "" }, { "docid": "0955abbb36623a0940abcd7f789ab1b9", "score": "0.5884994", "text": "def get_users_with_inventory()\n users = DB[\"SELECT DISTINCT owner_user_id FROM econ_user_inventory\"]\n\n array = []\n users.all.each do |user|\n array.push(user[:owner_user_id])\n end\n\n return array\n end", "title": "" }, { "docid": "fff427e256f7ebf5ccf400c586537396", "score": "0.587527", "text": "def parse_uids(uid_array, dn)\n uid_dn = dn.split(',')[0].split('=')[1]\n uid_alias = nil\n uid_array.each do |uid|\n if uid.match(uid_dn)\n uid_dn = uid\n else\n uid_alias = uid\n end\n end\n\n if uid_alias.nil?\n uid_alias = uid_dn\n end\n return uid_dn, uid_alias\nend", "title": "" }, { "docid": "fff427e256f7ebf5ccf400c586537396", "score": "0.587527", "text": "def parse_uids(uid_array, dn)\n uid_dn = dn.split(',')[0].split('=')[1]\n uid_alias = nil\n uid_array.each do |uid|\n if uid.match(uid_dn)\n uid_dn = uid\n else\n uid_alias = uid\n end\n end\n\n if uid_alias.nil?\n uid_alias = uid_dn\n end\n return uid_dn, uid_alias\nend", "title": "" }, { "docid": "058d6cb5b4e15769c694dc68a39ac011", "score": "0.5867841", "text": "def uids\n queries.search(author_query).merged_uids\n end", "title": "" }, { "docid": "e351548a40fdc0d2bc37afd875aa76c7", "score": "0.5865213", "text": "def listUsers\r\n\r\n listOfUsers = Array.new\r\n\r\n conn = ActiveDirectoryUser.ldapConnect(Encryptor.decrypt(@loginName, :key => KEY_TO_LOGIN),\r\n Encryptor.decrypt(@passwd, :key => KEY_TO_PASSWD))\r\n if conn and conn.bind \r\n\r\n xmlFile = File.new(Rails.configuration.peregrine_configfile)\r\n configHash = Hash.from_xml(xmlFile)\r\n config = configHash['pgguard']['authentication']['ldap']\r\n\r\n filter = Net::LDAP::Filter.eq(\"objectCategory\", \"organizationalPerson\")\r\n conn.search(:base => config['base'], :filter => filter) do |entry|\r\n if !entry['samaccountname'].first.nil?\r\n if entry.attribute_names.include?(:memberof)\r\n groups = []\r\n entry.memberof.each do |g|\r\n groups << g.gsub(/.*?CN=(.*?),.*/,'\\1')\r\n end\r\n listOfUsers << {:name => entry.samaccountname.first, :groups => groups}\r\n else\r\n listOfUsers << {:name => entry.samaccountname.first, :groups => []} # corner case with a user having no groups.\r\n end\r\n end\r\n end\r\n end \r\n\r\n return listOfUsers\r\n end", "title": "" }, { "docid": "9cc52c652801d1feb2db45cf98287a06", "score": "0.5864948", "text": "def user_ids\n @user_ids\n end", "title": "" }, { "docid": "74bf57274f5b055b23d32186b51c8de8", "score": "0.5860412", "text": "def users\n mem.inject([]) do |arr, member|\n arr << Etc2::User.find(member)\n end\n end", "title": "" }, { "docid": "291ab88bcd12aef798ddb6f39f5933b6", "score": "0.585067", "text": "def user_ids\n return @user_ids\n end", "title": "" }, { "docid": "a1b2e3a754b3ebf2bcd00742ccb4201e", "score": "0.58499646", "text": "def memberids\n weakref(:members) do # initialises @members if necessary\n ASF.search_one(base, \"cn=#{name}\", 'memberUid').flatten\n end\n end", "title": "" }, { "docid": "c423d0ddffce310943cc93f341e5d0b7", "score": "0.5848908", "text": "def user_ids\n\t\treturn @user_ids\n\tend", "title": "" }, { "docid": "eabb7883ccf4bafdba0b354b982f09db", "score": "0.5837693", "text": "def usernames\n users.map(&:username)\n end", "title": "" }, { "docid": "9697b2a73d9edb260f1439202cf3040d", "score": "0.5836381", "text": "def all\n all_users = @@users.values.sort { |a,b| a.id <=> b.id}\n end", "title": "" }, { "docid": "d3dd679c9135a7c25a9fd07b448140e5", "score": "0.5829043", "text": "def all\n ret = []\n @data.each { |user_data| ret.push user_data[:user] }\n ret\n end", "title": "" }, { "docid": "d007065c5d0fdda6c98e7d44af69d714", "score": "0.5824885", "text": "def member_uids(entry)\n entry[\"memberUid\"]\n end", "title": "" }, { "docid": "04c2c4f2a52859bb8ed77315f4490428", "score": "0.5815512", "text": "def alluser_ids\n \"#{User.all.pluck(:id).join(',')},#{current_user.id}\"\n end", "title": "" }, { "docid": "34d73cb0750f44f014612410ab2bea98", "score": "0.581167", "text": "def users\n acls.map(&:users).flatten.uniq\n end", "title": "" }, { "docid": "1a6db0404b238a2d0f5e67314efbb515", "score": "0.5794584", "text": "def list_users\n cmd = inspec.command(list_users_cmd)\n return [] if cmd.exit_status != 0\n cmd.stdout.chomp.lines\n end", "title": "" }, { "docid": "fa76e47915c8e8424dca804579e9cad9", "score": "0.57700294", "text": "def usernames\n users = authorized_usernames\n return users.split(', ') unless users.nil?\n []\n end", "title": "" }, { "docid": "03accda4cf1a3da53c54b230ee2611a6", "score": "0.57675177", "text": "def usernames\n @attributes[:usernames]\n end", "title": "" }, { "docid": "f8eb3b38c4e2708adfde7a53e6aa98da", "score": "0.5751694", "text": "def users\n all_users = []\n\n @containers.each do |container|\n all_users += container.users\n end\n\n all_users\n end", "title": "" }, { "docid": "64216d691b13b8cd2d9fd06b7129142e", "score": "0.571454", "text": "def oid_list\n @oid_list\n end", "title": "" }, { "docid": "28d5e7b71c9a1059b3d47c909e8c85ba", "score": "0.5690044", "text": "def get_user_by_id_list\n @ulist = []\n if params[:uids].nil?\n badparams(\"uids\")\n else\n params[:uids].split(\",\").each do |item|\n u = User.find(item)\n if !(u.nil?)\n @ulist << u\n end\n\n end\n render json: @ulist\n end\n end", "title": "" }, { "docid": "1a2ea6a39f1f1a8e80d7d3dbd3d11646", "score": "0.5688452", "text": "def get_id_array(user)\n\t\tid_array = []\n\t\tuser.songs.each do |song|\n\t\t\tid_array << song.songid\n\t\tend\n\t\tid_array\n\tend", "title": "" }, { "docid": "46b5a62597b5f16d63c8e2af4c688619", "score": "0.5682412", "text": "def get_read_users_a\n\n return [] if self.read_users.nil? or self.read_users.empty?\n\n arr = self.read_users.split('|')\n arr.compact!\n arr.delete('')\n\n return arr\n end", "title": "" }, { "docid": "bb145aa1cbc254f94c8181367478fee6", "score": "0.5668751", "text": "def find_uids_in_group(name)\n group = @ldap.search( :base => $ldap_groupdn, :filter => \"(&(cn=#{name})(objectClass=posixGroup))\", :attributes => 'memberUid' ).first\n if group\n uids = []\n group[:memberuid].sort{|x,y| x.downcase <=> y.downcase}.each do |uid|\n uids << uid\n end\n uids\n end\n end", "title": "" }, { "docid": "c0a540357425060f55d4fcabf07877c1", "score": "0.5655797", "text": "def all_users\n @channels.values.map(&:users).flatten.sort_by(&:id)\n end", "title": "" }, { "docid": "c6c73b5659f4517b0aa1c360d61e10d0", "score": "0.5651323", "text": "def get_druid_list\n \n druid_list = Array.new\n \n # append any druids passed explicitly\n if(@options.druid)\n druid_list << @options.druid\n end\n \n # identifier list is in a file\n if (@options.file && File.exist?(@options.file))\n File.open(@options.file) do |file|\n file.each_line do |line|\n druid = line.strip\n if (druid.length > 0)\n druid_list << druid\n end\n end\n end\n end\n \n return druid_list\n end", "title": "" }, { "docid": "b052e4ef40ec83a4561950a148129f5e", "score": "0.56432486", "text": "def list_aid()\r\n aarr = select(\"*\", \"*\", \"*\", \"*\", \"*\", 0)\r\n len = aarr.length\r\n\r\n aidarr = Array.new\r\n for i in (0..len-1)\r\n aidarr[i] = aarr[i].assay_id\r\n end\r\n aidarr\r\nend", "title": "" }, { "docid": "d63f58f06a62cbd85ff85010444b4545", "score": "0.5642287", "text": "def get_all_validic_users\n response = validic.get \"users.json\", basic_user_data\n if response.success?\n body = JSON.parse(response.body)\n # gather up all the ids into a flat array\n body[\"users\"].collect { |u| u[\"_id\"] }\n else\n logger.error \"API Call to Validic to provision user ##{self.id} was unsucccessful. Validic returned the following response:\\n#{response.body}\"\n return false\n end\n end", "title": "" }, { "docid": "2275851c3739f96350e1954732ade9a4", "score": "0.5638372", "text": "def all_users\n users = []\n users.concat self.users\n self.children.each do |child|\n users.concat child.users\n end\n return users.uniq\n end", "title": "" }, { "docid": "ae379a8a3e7f02e8e9e1ff25d6f8a937", "score": "0.5628074", "text": "def get_users\n users_list = Hash.new\n WmiCli.new.query('SELECT * FROM Win32_UserAccount').each do |user|\n users_list[user.properties[:sid]] = user.properties if !user.nil?\n end\n users_list\n end", "title": "" }, { "docid": "646c2febc9cd0f040edf37f32ed2cad1", "score": "0.5616473", "text": "def user_ids\n return nil unless (temp_extended_user_ids = read_attribute(:user_ids))\n # logger.debug2 \"temp_extended_user_ids = #{temp_extended_user_ids}\"\n YAML::load encrypt_remove_pre_and_postfix(temp_extended_user_ids, 'user_ids', 10)\n end", "title": "" }, { "docid": "023fbdbdad43d392c19b33dec4ae081a", "score": "0.5612402", "text": "def users\n # members.map { |dn| User.select_dn(dn) }\n members.map { |dn| self.class.user_klass.select_dn(dn) }\n end", "title": "" }, { "docid": "7ed312822c60654f9b6dc4b59aabb57b", "score": "0.55985737", "text": "def numbers_array\n numbers = []\n Group.find_by_name(group_name).users.each do |user|\n numbers << user.phone_number\n end\n return numbers\n end", "title": "" }, { "docid": "24c2aadeec53a9d946a950f72ce2788f", "score": "0.5592645", "text": "def allergy_users\r\n allergies.map {|allergy| allergy.user} \r\n end", "title": "" }, { "docid": "68d3097b1db58335947dee08403a073e", "score": "0.5571079", "text": "def user_device_ids(user)\n ids = []\n user.units.each do |u|\n u.devices.each do |d|\n ids << d.id\n end\n end\n return ids\n end", "title": "" }, { "docid": "f93472e8504d81a7437d0ec189176618", "score": "0.55689144", "text": "def get_users\n ret = @ds.retrieve_all_users\n \n return nil if ret.nil?\n \n users = []\n \n ret.each do |user|\n users << {\n :username => user.username,\n :first => user.given_name,\n :last => user.family_name,\n :active => user.suspended == \"true\" ? false : true,\n :admin => user.admin == \"true\" ? true : false,\n }\n end\n \n return users\n end", "title": "" }, { "docid": "813f124f00b0a0237d54e6441110b475", "score": "0.55634916", "text": "def users\r\n self.allergens.map do |a|\r\n a.user\r\n end\r\n end", "title": "" }, { "docid": "e916ed341cbea25df50ecbe4798dd7db", "score": "0.55571926", "text": "def _getIDVals(ids = nil)\n if ids.nil?\n doc = ownerDocument\n return [] if doc.nil?\n ids = doc._getIDAttrs\n end\n\n idelem = []\n if !ids[nodeName].nil?\n return attributes._getValues(ids[nodeName])\n elsif !ids['*'].nil?\n return attributes._getValues(ids['*'])\n end\n return []\n end", "title": "" }, { "docid": "92928a0590a0d8be562bc322875c1e6d", "score": "0.5556072", "text": "def readAll\n return @userInfoList\n end", "title": "" }, { "docid": "e036f6c3beb51be197aceb9b69e90bf7", "score": "0.55545455", "text": "def user_field_identifiers\n\n return @user_field_identifiers unless @user_field_identifiers.nil?\n\n mapping = setting_to_list(SiteSetting.user_fields_mapping)\n .map { |f| f.split ':' }\n .map { |kv| kv.map {|x| x.strip } } # sanitize input\n .tap { |arr| break Hash[arr] } # since to_h is only available with 2.1.0\n\n @user_field_identifiers = UserField.all\n .map { |uf| [mapping[uf.name] || uf.name, uf.id] }\n .tap { |arr| break Hash[arr] }\n end", "title": "" }, { "docid": "375fef6f122343b54dc89018cc80b1a0", "score": "0.5534351", "text": "def numbers_array\r\n numbers = []\r\n Group.find(group_id).members.each do |user|\r\n numbers << user.phone_number\r\n end\r\n return numbers\r\n end", "title": "" }, { "docid": "6aca1a0ecc86d9e8c0d02fa8014d578c", "score": "0.5529308", "text": "def _ids *str\n _ids_to_usernames.keys\n end", "title": "" }, { "docid": "e7ee110a8e95ab61c62869e938f40a56", "score": "0.5514184", "text": "def list\n return default if data.blank?\n\n data.each_with_object([]) do |(key, values), accumulator|\n next if values.blank?\n\n values.each do |id|\n accumulator << vista_account_id(key, id)\n end\n end\n end", "title": "" }, { "docid": "e7ee110a8e95ab61c62869e938f40a56", "score": "0.5514184", "text": "def list\n return default if data.blank?\n\n data.each_with_object([]) do |(key, values), accumulator|\n next if values.blank?\n\n values.each do |id|\n accumulator << vista_account_id(key, id)\n end\n end\n end", "title": "" }, { "docid": "4514002546df2a0c7161dcdd6a4381a0", "score": "0.55074865", "text": "def members\n filters = Net::LDAP::Filter.construct(\"(memberOf=#{dn})\")\n members_ldap = @conn.search(:filter => filters)\n members = []\n members_ldap.each do |member|\n user = Adauth::User.create_from_login(member.samaccountname.first)\n members.push(user)\n end\n return members\n end", "title": "" }, { "docid": "c7be2cf6862cae51dab4bb1ba3838d0f", "score": "0.5504365", "text": "def people_ids_to_array\n @people_ids_array ||= people_ids.present? ? people_ids.split(',').map { |x| x[/\\d+/] } - [0] : []\n end", "title": "" }, { "docid": "e49a86c13f7b68a531e69d62456ee320", "score": "0.5503275", "text": "def test_get_list_of_uids\n end", "title": "" }, { "docid": "71063d58af935d1463f0ba3f78007833", "score": "0.549472", "text": "def identifier_to_uids(identifier, opts)\n raise NotImplementedError\n end", "title": "" }, { "docid": "044eebcbe41314f75234a735e8a33a9b", "score": "0.54934675", "text": "def contacts\n ab_group.members.map do |p|\n p.valueForProperty(KABUIDProperty)\n end.sort\n end", "title": "" }, { "docid": "b0bd6d9f5a65ded32fc359bc8e8ff329", "score": "0.54884946", "text": "def user_ids\n students.collect(&:user_id)\n end", "title": "" }, { "docid": "1d5de1a5478718a0a2bc26c5d9606d2d", "score": "0.5487303", "text": "def get_udids(app_id)\n begin\n response = connection.get(get_udids_url(app_id)) do |request|\n request.headers[AUTHORIZATION] = \"Bearer \" + @auth_token\n end\n rescue Faraday::ResourceNotFound\n UI.user_error!(\"#{ErrorMessage::INVALID_APP_ID}: #{app_id}\")\n end\n response.body[:testerUdids] || []\n end", "title": "" }, { "docid": "1d5de1a5478718a0a2bc26c5d9606d2d", "score": "0.5487303", "text": "def get_udids(app_id)\n begin\n response = connection.get(get_udids_url(app_id)) do |request|\n request.headers[AUTHORIZATION] = \"Bearer \" + @auth_token\n end\n rescue Faraday::ResourceNotFound\n UI.user_error!(\"#{ErrorMessage::INVALID_APP_ID}: #{app_id}\")\n end\n response.body[:testerUdids] || []\n end", "title": "" }, { "docid": "cec99867a0ffffe54198d21482453a5e", "score": "0.54808694", "text": "def members\n memberids.map {|uid| Person.find(uid)}\n end", "title": "" } ]
4d065e6d82b95fef7238eb29772a3fba
a simple descriptor representing the kind of degree, such as Bachelor of Science, etc.
[ { "docid": "3c36d7ef6743f2245b4f5fb888f9c28c", "score": "0.0", "text": "def type\n ::HubEdos::Common::Reference::Descriptor.new(@data['type']) if @data['type']\n end", "title": "" } ]
[ { "docid": "1845ca44ebec0067788918fbc64a3dc6", "score": "0.72825783", "text": "def degree; end", "title": "" }, { "docid": "5a8a03131bcf015a72f93ae79a5757ab", "score": "0.66542405", "text": "def convert_degree_type (degree_type_num)\n degree_type_num = \"#{degree_type_num}\"\n case degree_type_num\n when \"aa\"\n convert_degree_text = \"Associate of Arts (A.A)\"\n when \"as\"\n convert_degree_text = \"Associate of Science (A.S.)\"\n when \"ba\"\n convert_degree_text = \"Bachelor of Arts (B.A.)\"\n when \"bs\"\n convert_degree_text = \"Bachelor of Science (B.S)\"\n when \"ma\"\n convert_degree_text = \"Master of Arts (M.A.)\"\n when \"ms\"\n convert_degree_text = \"Master of Science (M.S.)\"\n when \"phd\"\n convert_degree_text = \"Doctoral (Ph.D.)\"\n when \"md\"\n convert_degree_text = \"Medical Doctor (M.D.)\"\n when \"mph\"\n convert_degree_text = \"Master of Public Health (M.P.H)\"\n when \"mpa\"\n convert_degree_text = \"Master of Public Adminstration (M.P.A)\"\n when \"jd\"\n convert_degree_text = \"Juris Doctor (J.D)\"\n when \"mfa\"\n convert_degree_text = \"Master of Fine Arts (M.F.A)\"\n when \"mms\"\n convert_degree_text = \"Master of Music (M.M.S)\"\n when \"me\"\n convert_degree_text = \"Master of Engineering (M.E.)\"\n when \"mlis\"\n convert_degree_text = \"Master of Library Science (M.L.I.S)\"\n when \"msw\"\n convert_degree_text = \"Master of Social Work (M.S.W)\"\n when \"med\"\n convert_degree_text = \"Master of Education (M.Ed)\"\n when \"mba\"\n convert_degree_text = \"Master of Business Administration (M.B.A)\"\n else\n convert_degree_text = \"Best Degree Ever\"\n end\n end", "title": "" }, { "docid": "1f1c1256a22e95482b503ee9522d615a", "score": "0.6579462", "text": "def convert_degree_type (degree_type_num)\n case degree_type_num\n when 0\n convert_degree_text = \"A.A.\"\n when 1\n convert_degree_text = \"A.S.\"\n when 2\n convert_degree_text = \"B.A.\"\n when 3\n convert_degree_text = \"B.S.\"\n when 4\n convert_degree_text = \"M.A.\"\n when 5\n convert_degree_text = \"M.S.\"\n when 6\n convert_degree_text = \"Ph.D.\"\n when 7\n convert_degree_text = \"M.D.\"\n else\n convert_degree_text = degree_type\n end\n end", "title": "" }, { "docid": "2a8a520a43a2ec47209d4f350330c9a3", "score": "0.60220665", "text": "def full_name_degree\n if degree\n \"#{name}, #{degree}°\"\n else\n \"#{name}\"\n end\n end", "title": "" }, { "docid": "cfa33563426782eb5e7c8d696b804106", "score": "0.59051067", "text": "def nature; end", "title": "" }, { "docid": "39d21200c251edd62332c69a0ddc7968", "score": "0.58988774", "text": "def memer_degree\n\t\tstats = self.stats\n\t\tif stats[:general_stats].values.inject(0,:+) == 0\n\t\t\treturn \"Boring memer\"\n\t\tend\n\t\tnouns = {\n\t\t\t\"replier\" => stats[:general_stats][:comments_count], \n\t\t\t\"memer\" => stats[:general_stats][:memes_count], \n\t\t\t\"reposter\" => stats[:general_stats][:posts_count], \n\t\t\t\"reacter\" => stats[:general_stats][:reactions_count]\n\t\t}\n\t\tadjectives = {swipe_up: \"Wholesome\", swipe_down: \"Normie\", swipe_left: \"Dank\", swipe_right: \"Boring\"}\n\n\t\tuser_noun = nouns.max_by{|k,v| v }[0]\n\t\tuser_adjective = (stats[:general_stats][:reaction_counts])? adjectives[stats[:reactions_stats].max_by{|k,v| v }[0]] : \"Boring\"\n\t\tuser_adjective + \" \" + user_noun\n\tend", "title": "" }, { "docid": "de49a0ec99eb01e8f66f195f0dcc1cc1", "score": "0.5863108", "text": "def ordinal; end", "title": "" }, { "docid": "7b8f0541eb5fdd0b1a651c7dc9473c50", "score": "0.58165866", "text": "def degree(v) in_degree(v); end", "title": "" }, { "docid": "2b4524c253fc8ff4ba97c8baa763dc35", "score": "0.57590836", "text": "def cardinal; end", "title": "" }, { "docid": "f149d1041b6b74528c3a19e7e74e937d", "score": "0.5734139", "text": "def chord_types; end", "title": "" }, { "docid": "d2aa9fd8cab8e68822522da2e5889e03", "score": "0.57186925", "text": "def degree_params\n params.require(:degree).permit(:name, :description)\n end", "title": "" }, { "docid": "29e19753b0c84689e391dfe8f7ffba61", "score": "0.56897396", "text": "def initialize(degree = 1)\n\t\t@degree = degree\n\t\t@resFactor = 30\n\t\t@hilbertMap =\n\t\t{'a' =>\n\t\t\t{\n\t\t\t\t[0, 0] => [0, 'd'],\n\t\t\t\t[0, 1] => [1, 'a'],\n\t\t\t\t[1, 0] => [3, 'b'], \n\t\t\t\t[1, 1] => [2, 'a']\n\t\t\t},\n\t\t'b' =>\n\t\t\t{\n\t\t\t\t[0, 0] => [2, 'b'],\n\t\t\t\t[0, 1] => [1, 'b'],\n\t\t\t\t[1, 0] => [3, 'a'],\n\t\t\t\t[1, 1] => [0, 'c']\n\t\t\t},\n\t\t'c' =>\n\t\t\t{\n\t\t\t\t[0, 0] => [2, 'c'],\n\t\t\t\t[0, 1] => [3, 'd'],\n\t\t\t\t[1, 0] => [1, 'c'],\n\t\t\t\t[1, 1] => [0, 'b']\n\t\t\t},\n\t\t'd' =>\n\t\t\t{\n\t\t\t\t[0, 0] => [0, 'a'],\n\t\t\t\t[0, 1] => [3, 'c'],\n\t\t\t\t[1, 0] => [1, 'd'],\n\t\t\t\t[1, 1] => [2, 'd']\n\t\t\t}\n\t\t}\n\tend", "title": "" }, { "docid": "d1d0461fcb57a93400275401ef24803a", "score": "0.5676736", "text": "def highest_degree_offered\n degree = {\n '0' => nil, '1' => '4-year', '2' => '4-year', '3' => '4-year',\n '4' => '2-year' \n }\n\n !facility_code.nil? && degree.keys.include?(facility_code[1]) ? degree[facility_code[1]] : 'NCD'\n end", "title": "" }, { "docid": "ec86165d64ad799a64db4f96d7557f7f", "score": "0.565136", "text": "def basis_description()\n\t\tif (value.nil?) then\n\t\t\tdescriptor_class = self.namespaced_class(:ModelDescriptor)\n\t\t\tgoal_desc = descriptor_class::BASIS_TYPE_DESCRIPTIONS[self.class.basis_type]\n\t\telse\n\t\t\tself.value\t\t\n\t\tend\n\tend", "title": "" }, { "docid": "fac2c6190a8db46378cb80c07c12a159", "score": "0.5643677", "text": "def person_relator_terms\n {\n \"aut\" => \"Author\",\n \"cre\" => \"Creator\",\n \"edt\" => \"Editor\",\n \"phg\" => \"Photographer\", \n \"mdl\" => \"Module leader\",\n \"spr\" => \"Sponsor\",\n \"sup\" => \"Supervisor\" \n }\n end", "title": "" }, { "docid": "c623630653a57ebf94d3e8840bd9ab1d", "score": "0.56178004", "text": "def degrees\n\t\t@degrees ||= cardinal.keys.sort + [360.0]\n\tend", "title": "" }, { "docid": "41a9c8a066548814744df445a966af14", "score": "0.5599771", "text": "def degree\n self.in_degree + self.out_degree\n end", "title": "" }, { "docid": "10909201afe814549329b35c70fac533", "score": "0.5569897", "text": "def offer_degree?\n institution_of_higher_learning_indicator || non_college_degree_indicator\n end", "title": "" }, { "docid": "434f1101a8c6b0ada852c84ee680bb77", "score": "0.55687445", "text": "def degree()\n return self.rep.length\n end", "title": "" }, { "docid": "19a220205dafd5323c8e7f91159b796f", "score": "0.5563361", "text": "def description_and_dosage\n \t\"#{self.name} #{self.dosage}#{MedicationOrder.human_enum_name(:units, self.unit)} #{MedicationOrder.human_enum_name(:routes, self.route)} #{self.order_frequency.value} #{OrderFrequency.human_enum_name(:units,self.order_frequency.unit)} to #{self.necessity}\"\n end", "title": "" }, { "docid": "46b41e74e1f02a46ff86d64c63b1e0ba", "score": "0.5559935", "text": "def dean\n faculty.dean\n end", "title": "" }, { "docid": "3747ca8aa5447e8549eccb31252ed727", "score": "0.55597657", "text": "def description\n return geo_concern.description.first if geo_concern.description.first\n \"A #{geo_concern.human_readable_type.downcase} object.\"\n end", "title": "" }, { "docid": "83be5b1a41fcb5545d31fea8fc3d3ed8", "score": "0.5559685", "text": "def work_type_name(work)\n case work.person.gender\n when \"female\" then work.type.name_feminine\n when \"male\" then work.type.name_masculine\n end\n end", "title": "" }, { "docid": "5661c1544b82fd24f608d226f27951b8", "score": "0.55267", "text": "def degrees\n self\n end", "title": "" }, { "docid": "07fd1869adbe151da406b5a62bd8eecb", "score": "0.5515155", "text": "def nationality; end", "title": "" }, { "docid": "d3f96eb927b8b7d10bf4301add15a939", "score": "0.5508315", "text": "def getFinancialEducationObjName\r\n\t\t\treturn \"mfiforce__Financial_Education__c\"\r\n\t\tend", "title": "" }, { "docid": "c0aedad4448f4415b55be2d53fd87477", "score": "0.5488532", "text": "def set_degree\n @degree = Degree.find(params[:id])\n end", "title": "" }, { "docid": "c0aedad4448f4415b55be2d53fd87477", "score": "0.5488532", "text": "def set_degree\n @degree = Degree.find(params[:id])\n end", "title": "" }, { "docid": "01996cdd8f545a8158402ab5a2d230ba", "score": "0.54850423", "text": "def degree_params\n params[:degree]\n end", "title": "" }, { "docid": "826a9c81bda524259e0a42215ea3e328", "score": "0.5482465", "text": "def get_symbol_using_type(type)\n case type\n when EducationOrganizationCategoryType.to_string(:STATE_EDUCATION_AGENCY); :seas\n when EducationOrganizationCategoryType.to_string(:LOCAL_EDUCATION_AGENCY); :leas\n when SchoolCategory.to_string(:ELEMENTARY); :elementary\n when SchoolCategory.to_string(:MIDDLE); :middle\n when SchoolCategory.to_string(:HIGH); :high\n end\n end", "title": "" }, { "docid": "d212a455aef574a2e4c4e10e1f37e8d0", "score": "0.5480377", "text": "def can_be_officer?\n self.degree.to_sym == :master_mason\n end", "title": "" }, { "docid": "b48a437b60c3d88b9acd2c5c2a220c37", "score": "0.54665774", "text": "def degrees\n Enumerator.new(@structure.length) do |y|\n nodes.each do |node|\n y << [node, degree(node)]\n end\n end\n end", "title": "" }, { "docid": "648a275e0214507ce274264baf65f40c", "score": "0.5457679", "text": "def get_degree note\n relative_note = note - @tonic # we are only concerned with the note relative to the tonic\n octave = (relative_note.to_i / 12) - 1\n index = @intervals.index(@intervals.find{|n| n >= relative_note % 12})\n return \"#{((octave + 1) * @intervals.size) + 7}#\" unless index # if index is nil, it means note is a sharpened 7th index... we add 1 to octave to account for the -1st octave\n degree = index + 1\n approximate_degree = ((octave + 1) * 7) + degree\n accidental = ACCIDENTALS[relative_note - (((octave + 1) * 12) + @intervals[index])]\n return \"#{approximate_degree}#{accidental}\"\n end", "title": "" }, { "docid": "ebbbccb5e4658f740b7b2b6ae088c831", "score": "0.5449616", "text": "def desc() summary; end", "title": "" }, { "docid": "12f85d430bf68f4026c97930638b6913", "score": "0.5443574", "text": "def course_difficulty(num)\n case num\n when 0\n 'Easy'\n when 1\n 'Intermediate'\n else\n 'Advanced'\n end\n end", "title": "" }, { "docid": "73973b2acba09daa9f50a187fb28809b", "score": "0.5437449", "text": "def dod_paygrade; end", "title": "" }, { "docid": "d370e56354227fca7ad1e9043315f6e5", "score": "0.54355645", "text": "def degree(vertex)\n\tend", "title": "" }, { "docid": "4bf6db671244646efd6ee501abd42320", "score": "0.54319966", "text": "def name\n return \"Canadian Add Unitary and Apply Standard\"\n end", "title": "" }, { "docid": "004f45ef6c4c55b56438cbe176735fb4", "score": "0.5426399", "text": "def educational_attainment; end", "title": "" }, { "docid": "9a639fc71ca92fc2849746eb1dbf84bd", "score": "0.5388653", "text": "def at degree\n raise \"Degree must be 1 or greater... there is no degree 0!\" if degree.to_i == 0\n if degree.respond_to? :match\n accidental = degree.match(/b/) ? -1 : 0\n accidental = degree.match(/#/) ? 1 : accidental\n else\n accidental = 0\n end\n index = degree.to_i - 1\n octave = index / @intervals.size\n @intervals[(index % @intervals.size)] + (octave * 12) + @tonic + accidental\n end", "title": "" }, { "docid": "156d09fcac7d5aa7ea811f7e90e1dd9c", "score": "0.5380181", "text": "def personal_subjective_pronoun\n return @gender.personal_subjective\n end", "title": "" }, { "docid": "2fc2e63036e905e267d11324bccf21de", "score": "0.5373683", "text": "def description\n \"Level #{level} #{race} #{class_name}\"\n end", "title": "" }, { "docid": "9a2ee1552999256b1a7ca9d190680a38", "score": "0.53727275", "text": "def set_degree\n @degree = Degree.find(params[:id])\n end", "title": "" }, { "docid": "647d1794fe1a86d1e529eb780f65cfee", "score": "0.53538805", "text": "def education\n @bio.fetch('Education')\n end", "title": "" }, { "docid": "a898363ce155750ab8abc83c2b3280c8", "score": "0.5353037", "text": "def math_type\n self\n end", "title": "" }, { "docid": "eeb4e5923ae458958f787feef47171d3", "score": "0.53345054", "text": "def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end", "title": "" }, { "docid": "cb3666626ceffd6ee5e66aa99cc3d0a4", "score": "0.53271675", "text": "def fuel_type; end", "title": "" }, { "docid": "531f1795ae324ccf67b2b84aabf48cc9", "score": "0.5324537", "text": "def grade_level\n GradeLevelType.to_string(@grade)\n end", "title": "" }, { "docid": "92fb33692839667555cea242072d220a", "score": "0.53197825", "text": "def gender; end", "title": "" }, { "docid": "f1e5fb75192fce2bac236b2b571811a2", "score": "0.5317431", "text": "def type_name\n TYPE[self.exercise_type].to_s\n end", "title": "" }, { "docid": "77a3986ec2432433cb22fabe762d132e", "score": "0.5317288", "text": "def getLoanPurposeObjName\r\n\t\t return \"mfiforce__loan_purpose__c\"\r\n\t\tend", "title": "" }, { "docid": "f40e2df28491a2eed1dfecdf8292500e", "score": "0.5313206", "text": "def name; \"#{accidental.name}f\"; end", "title": "" }, { "docid": "cb44d590c8be6c4f0243debe0c6a48ce", "score": "0.5312057", "text": "def mary_desc\n name_descriptions(:peltigera_user_desc)\n end", "title": "" }, { "docid": "c76d7d58ce55cfe916975ce88d12e6fc", "score": "0.5311028", "text": "def court_department\n case(court)\n when \"superior\"\n \"Superior Court\"\n when /^bmc/\n \"BMC\"\n else\n \"N/A\"\n end\n end", "title": "" }, { "docid": "c705ada3e34e88797dd439db09e99f65", "score": "0.5297246", "text": "def get_kind\n\t\tend", "title": "" }, { "docid": "b031132107ec133f658dec6bb2cec94f", "score": "0.52967197", "text": "def concept_type_description_id\n concept_type.concept_type_id\n end", "title": "" }, { "docid": "6dbaef56f47221ada4b452308ad149d0", "score": "0.5296238", "text": "def note\n @scale.note(degree)\n end", "title": "" }, { "docid": "ab8c8ac6662be836092408e42010cc67", "score": "0.5288521", "text": "def type\n :american\n end", "title": "" }, { "docid": "686578364f34b541c6c1ea0e9a47d8b2", "score": "0.52882826", "text": "def degrees\n self * Math::PI / 180\n end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.52828676", "text": "def type_name; end", "title": "" }, { "docid": "df3d92b7417067915b5e3d085fd2aced", "score": "0.5280473", "text": "def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end", "title": "" }, { "docid": "82b73da804011d949d9ce019ce3ae9e1", "score": "0.52738196", "text": "def get_modo()\r\n\t\treturn \"tipo\"\r\n\tend", "title": "" }, { "docid": "e2b796b463cf7cfb16cbca5923cf3910", "score": "0.5267033", "text": "def type\n if self.institution?\n return \"Institution\"\n elsif self.funder?\n return \"Funder\"\n elsif self.organisation?\n return \"Organisation\"\n elsif self.research_institute?\n return \"Research Institute\"\n elsif self.project?\n return \"Project\"\n elsif self.school?\n return \"School\"\n end\n return \"None\"\n end", "title": "" }, { "docid": "78be7e2073e19a7b279ced6063840af9", "score": "0.5266926", "text": "def kind_enum\n\t\t['讲座沙龙','校园文化','竞赛创新','实践公益','其他']\n\tend", "title": "" }, { "docid": "1020a400af3fce73bf769a06eb670b0c", "score": "0.5263206", "text": "def human_type\n Core::TYPES_DESC[type]\n end", "title": "" }, { "docid": "eb2230c77a2dd83f9cf66bf0f910a346", "score": "0.5259735", "text": "def the_doctor; end", "title": "" }, { "docid": "4b03c5e71391d329ceb281edad8d7f60", "score": "0.525548", "text": "def name \n case type\n when \"percentage\"\n return \"#{@multiplier.round(0)}\\% Off\"\n when \"deduction\"\n return \"£#{@multiplier.round(0)} Off\"\n end\n end", "title": "" }, { "docid": "9845c9d7242ddd82003f3aeecfb5582c", "score": "0.5251646", "text": "def create_college_degree_from(attrs, participant_id)\n log \" -> Creating CollegeDegree record\"\n cd = CollegeDegree.create(\n :participant_id => participant_id,\n :institution_id => Institution.find_by_opeid(attrs[\"College Code/Branch\"]).try(:id),\n :graduated_on => Date.parse(attrs[\"Graduation Date\"]),\n :degree_title => attrs[\"Degree Title\"],\n :major_1 => attrs[\"Degree Major 1\"],\n :major_1_cip => attrs[\"Degree CIP 1\"],\n :major_2 => attrs[\"Degree Major 2\"],\n :major_2_cip => attrs[\"Degree CIP 2\"],\n :major_3 => attrs[\"Degree Major 3\"],\n :major_3_cip => attrs[\"Degree CIP 3\"],\n :major_4 => attrs[\"Degree Major 4\"],\n :major_4_cip => attrs[\"Degree CIP 4\"],\n :source => \"clearinghouse\",\n :clearinghouse_request_id => self.id\n )\n log \" #{cd.inspect}\"\n log \" Errors: #{cd.errors.messages.inspect}\" unless cd.valid?\n cd\n end", "title": "" }, { "docid": "40e8e65fb44186758cbb72e0f6a683a1", "score": "0.5249737", "text": "def degrees\n self * Math::PI / 180.0\n end", "title": "" }, { "docid": "d4dddb867fd18348853c499a8373f30a", "score": "0.5245817", "text": "def complexity_name\n COMPLEXITY[self.complexity_id-1][0]\n end", "title": "" }, { "docid": "04bbd036394add3271a4b5327bf45c22", "score": "0.52420795", "text": "def personal_objective_pronoun\n return @gender.personal_objective\n end", "title": "" }, { "docid": "5fca29fc38728a8904f93c6450aa7f29", "score": "0.5237437", "text": "def gender_txt\n [\"Not Telling\", \"Male\", \"Female\"][self.gender - 1]\n end", "title": "" }, { "docid": "b3d65060c242113bd87ce04b5ae0fb56", "score": "0.5236479", "text": "def key\n :perc_actors\n end", "title": "" }, { "docid": "3e0f9890479b86873de5ee2e0c603a01", "score": "0.5234291", "text": "def grade\n @grade\n end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "3cf00cdf059ad5e7c61304c18faab969", "score": "0.5233497", "text": "def description; end", "title": "" }, { "docid": "65d84f94e9759d7ac59d8aa579250ffc", "score": "0.52317923", "text": "def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end", "title": "" }, { "docid": "df7a5d3c11b29e2fb1d7de9992dee28f", "score": "0.5224234", "text": "def kind; end", "title": "" }, { "docid": "df7a5d3c11b29e2fb1d7de9992dee28f", "score": "0.5224234", "text": "def kind; end", "title": "" } ]
810170590878ee334315ac343c6ffeac
searches for start node but not for the goal node the robot does not know where the goal node is but we need to find out where to start at
[ { "docid": "b8e2a673eda404d81e13f8c327c6b8e4", "score": "0.0", "text": "def parse_maze\n x = 0\n y = 0\n z = 0 # will be used as a node number\n @table_reversed.each do |row|\n row.each do |item|\n @start_node = z if item == \"S\"\n\n # create a simple array with all values\n @table_merged << item\n @table_convert << [item, [x, y]]\n y += 1\n z += 1\n end\n x += 1\n y = 0\n end\n end", "title": "" } ]
[ { "docid": "36e96e484d68e5f95f4afff99eae7460", "score": "0.6442505", "text": "def path_finder(start_node=START_NODE, goal_node=GOAL_NODE)\n\t\n\t# INITIALIZE\n\tvalid = valid_nodes # largest set\n\treachable = [start_node] # nodes we can reach from current node\n\texplored = [] # nodes we've already considered\n\t# nodes reachable, valid, and not explored\n\topen_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n\t# record node path {node => previous_node}\n\tnodes_path = {start_node => nil} \n\t\n\twhile !open_nodes.empty?\n # node = choose_node(reachable)\n\t\tnode = open_nodes.sample # random node in open_nodes\n\t\t\n\t\treturn build_path(goal_node, nodes_path) if node==goal_node # STOP if reached goal! \n \n # Don't repeat ourselves.\n reachable.delete(node) # remove current node from reachable\n explored.push(node) # add node to explored\n \n # What nodes are now open from this node?\n # Adjacent, not in explored, and valid (not an obstacle and in maze)\n new_reachable = (get_adjacent_nodes(node) - explored) & valid\n\t\t# ADD new nodes to reachable\n new_reachable.each do |adj_node|\n if !reachable.include?(adj_node)\n # adjacent.previous = node # Remember how we got there.\n nodes_path[adj_node] = node # {[0,3] => [0,2]}\n reachable << adj_node\n end\n end\n \n\t\t# REFRESH OPEN NODES\n open_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n \n end\n \n\treturn nil # open_nodes empty - no path found\nend", "title": "" }, { "docid": "186688df6bc1c93ca5bfb0c88519b834", "score": "0.6393843", "text": "def get_start(processed_maze)\n # start_horizontal; start_vertical = nil\n processed_maze.each_with_index do |row, vertical_index|\n row.each_with_index do |item, horizontal_index|\n if item == 'o'\n @start_vertical = vertical_index\n @start_horizontal = horizontal_index\n end\n end\n end\n end", "title": "" }, { "docid": "63ab7dafae15382a536d23b923b5349d", "score": "0.6363798", "text": "def get_start_node\n return @nodes.reduce{|sum, pair| pair[0] < sum[0] ? pair : sum}[1] \n end", "title": "" }, { "docid": "e2024b7171c69a03f0f6438f00ebc877", "score": "0.6298817", "text": "def neighbours_into_start(node)\n # Find all arcs that include this node in the right place\n passable_nodes = []\n @arcs.get_arcs_by_node_id(node.node_id).each do |arc|\n if arc.end_node_id == node.node_id and arc.end_node_direction\n passable_nodes.push nodes[arc.begin_node_id]\n elsif arc.begin_node_id == node.node_id and !arc.begin_node_direction\n passable_nodes.push nodes[arc.end_node_id]\n end\n end\n return passable_nodes.uniq\n end", "title": "" }, { "docid": "456f53737ca9b75fa52e3f6531f7df8a", "score": "0.6267682", "text": "def start_node?\n @traversal_position.isStartNode\n end", "title": "" }, { "docid": "c979a23c08fd3481bba9978c7ea0a623", "score": "0.6231205", "text": "def find_start\n find_cell(START)\n end", "title": "" }, { "docid": "bcd4d156977bbfd81b9bc825d3db5dfe", "score": "0.6203254", "text": "def build_path(start, end_pos)\n node = Node.new(start[0], start[1])\n target = Node.new(end_pos[0], end_pos[1])\n visited_nodes = []\n next_moves = [node]\n until next_moves.empty? do\n node = next_moves.shift\n puts \"Current node: #{node.x}, #{node.y}\"\n if node.x == target.x && node.y == target.y \n return node\n end\n visited_nodes.push(node)\n node.moves = get_moves(node)\n node.moves.reject do |square|\n visited_nodes.include?(square)\n end\n node.moves.each do |move| \n next_moves.push(move)\n end\n end\n return node\nend", "title": "" }, { "docid": "6f84c4f318edb4fb45708780b7b22f6a", "score": "0.613403", "text": "def seek_from_node(starting_node)\n puts \"seek started from node #{starting_node.inspect}...\"\n \n # -- PART I -- (starting from one node for now...) \n visited_nodes = grow_basic_path([ starting_node ])\n \n puts \"got basic path of length #{visited_nodes.length}, moving on to IIa)...\"\n \n # -- PART II a) --\n if visited_nodes.length < nodes.length\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n \n while target_nodes.length > 0\n puts \"TNL: #{target_nodes.length}\"\n visited_nodes = restructure_path(visited_nodes, target_nodes)\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n end\n end\n \n puts \"...done, moving on to IIb)...\"\n \n # -- PART II b) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes)\n end\n \n puts \"...done, moving on to IIc)...\"\n \n # -- PART II c) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes.reverse)\n end\n \n # -- PART III --\n results = {}\n \n if visited_nodes.length < nodes.length \n results[:path] = visited_nodes\n else\n results[:tour] = visited_nodes\n \n cycle_starts = connected_to(visited_nodes.first).map do |node|\n visited_nodes[visited_nodes.index(node) - 1]\n end\n cycle_ends = connected_to(visited_nodes.last)\n \n (cycle_starts & cycle_ends).each do |node|\n index = visited_nodes.index(node)\n \n circuit = visited_nodes[0..index] + [ visited_nodes.last ]\n circuit += visited_nodes[(index + 1 - visited_nodes.length)..-2].reverse\n \n results[:cycles] ||= []\n results[:cycles] << circuit\n end\n end\n \n results\n end", "title": "" }, { "docid": "ca8466f12a8527957fc8c325a7a083f5", "score": "0.6105458", "text": "def find_moves(start, target)\n visited = breadth_first_search(start, target)\n moves = []\n find_coordinate = target\n visited.reverse.each do |vertex|\n vertex.neighbors.each do |coordinate|\n if coordinate == find_coordinate\n moves << vertex.key\n find_coordinate = vertex.key\n end\n end\n end\n moves.reverse << target\n end", "title": "" }, { "docid": "8f0e138c9c5aa24ad4be3a67e59372c6", "score": "0.60912746", "text": "def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end", "title": "" }, { "docid": "3de476f3caceba5b4d665bf685e55f24", "score": "0.60246754", "text": "def heuristic(node, start, goal)\n raise NotImplementedError\n end", "title": "" }, { "docid": "4dc79672d909d8fd120f6ce84dfda0a7", "score": "0.60078305", "text": "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end", "title": "" }, { "docid": "accfa5e1fa042d0219914ee4c7ddbefa", "score": "0.59187883", "text": "def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend", "title": "" }, { "docid": "75d4c6f8e3951f48146546f1a3b7f895", "score": "0.5905322", "text": "def find_path(start_node, end_node, grid)\n start_node = sanitize(start_node)\n end_node = sanitize(end_node)\n if grid.nil?\n [start_node]\n else\n _max_x = grid.max_x\n _max_y = grid.max_y\n\n @current_grid = grid.inner_grid.clone\n\n raise 'max_x & max_y required' unless _max_x && _max_y\n\n _start_node = start_node.clone\n _end_node = end_node.clone\n\n heuristic = @heuristic.new(_end_node, @weight)\n\n _start_node[:f] = 0 # sum of g and h\n _start_node[:g] = 0 # steps to start node\n _start_node[:h] = nil # steps to end node\n _start_node[:opened] = true\n\n # use heap or tree for better perf\n open = []\n open.push _start_node\n\n while !open.empty? do\n _current_node = open.pop\n\n _current_node[:closed] = true\n @current_grid[node_to_a(_current_node)] = _current_node\n\n if node_to_a(_current_node) == node_to_a(_end_node)\n return final_path(_current_node)\n end\n\n new_g = _current_node[:g] + 1\n\n x = _current_node[:x]\n y = _current_node[:y]\n\n neighbors = []\n\n neighbors << [x-1, y] if x > 0\n neighbors << [x, y-1] if y > 0\n neighbors << [x+1, y] if x < _max_x-1\n neighbors << [x, y+1] if y < _max_y-1\n\n _neighbors = neighbors.map do |position|\n node = @current_grid[position]\n if node.nil? || node[:walkable]\n node ||= {}\n @current_grid[position] = node.merge({\n x: position.first,\n y: position[1],\n closed: false,\n opened: false\n })\n end\n end.compact\n\n _neighbors.each do |neighbor|\n if (!neighbor[:opened] || new_g < neighbor[:g])\n neighbor[:g] = new_g\n neighbor[:h] ||= heuristic.h(neighbor)\n neighbor[:f] = neighbor[:g] + neighbor[:h]\n neighbor[:parent] = node_to_a(_current_node)\n\n if (!neighbor[:opened])\n open.push neighbor\n neighbor[:opened] = true\n else\n # ???\n puts \"got here some how!!!\"\n end\n end\n end\n\n open.sort_by! {|i| [-i[:f], -i[:h]]}\n # grid_p\n end\n end\n end", "title": "" }, { "docid": "09af4b997f0be7998a5ea6f8e06446cb", "score": "0.5884032", "text": "def possible_moves(start_node, destination)\n\t\n\t\tif start_node.value == destination\n\t\t\treturn start_node\n\t\telse\n\t\t\tgame.visited << start_node\n\t\t\tgame.unvisited = game.unvisited + (set_parent(start_node, possible_positions(start_node.value)) - game.visited)\n\t\t\tgame.unvisited.each do |position_node|\n\t\t\t\tif position_node.value == destination\n\t\t\t\t\treturn position_node\n\t\t\t\tend\n\t\t\t\tgame.visited << position_node\n\t\t\tend\n\t\t\tpossible_moves(game.unvisited.shift,destination) if game.unvisited.first != nil \n\t\tend\n\tend", "title": "" }, { "docid": "23a32d6ba191e50a474d5360b0b10489", "score": "0.5858065", "text": "def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend", "title": "" }, { "docid": "4f29690e0124aebf607fbe9e4549cc65", "score": "0.5852988", "text": "def get_start_coordinates\n start = @matrix.select { |k, v| v.type.eql?(Cell::TYPES[:start])}\n raise \"Start case not found\" unless start\n start.keys.first\n end", "title": "" }, { "docid": "f8009ca7977094681b283a9d68a1bd73", "score": "0.5840743", "text": "def knight_moves start, target\n raise StandardError.new(\"Invalid ending space\") if validate_space(target)\n root = Node.new(start, nil)\n target_acquired = nil\n queue = [root]\n return queue if root.position == target\n \n #build the structure to be searched\n puts \"I am right before the while loop\"\n while(!queue.empty? && !target_acquired)\n current = queue[0]\n potential_moves = get_possible_moves(current.position)\n potential_moves.each do |move|\n new_node = Node.new(move, current)\n current.children.push(new_node)\n queue.push(new_node)\n target_acquired = new_node if new_node.position == target\n puts \"FOUND IT MOFO\" if new_node.position == target\n end\n queue.shift\n end\n\n #search the structure, start with target node and go up parent\n current = target_acquired\n path = [current]\n while current.parent\n path.push(current.parent)\n current = current.parent\n end\n return path.reverse!\n end", "title": "" }, { "docid": "d70d0c436a55446e607885e359b38433", "score": "0.5840222", "text": "def a_star pitch, start, goal\n\t\t# The set of nodes already evaluated.\n\t\tclosedset = []\n\t\t# The set of tentative nodes to be evaluated.\n\t\topenset = []\n\t\t# Visited nodes\n\t\tfrontier = []\n\t\topenset << start\n\t\t# The map of navigated nodes.\n\t\tcame_from = { }\n\t\t# Distance from start along optimal path.\n\t\tg_score, h_score, f_score = { }, { }, { }\n\t\tg_score[start] = 0\n\t\th_score[start] = dist start, goal, :manhattan\n\t\t# Estimated total distance from start to goal through y.\n\t\tf_score[start] = h_score[start]\n\n\t\t# Main loop\n\t\twhile not openset.empty?\n\t\t\t# Fetching the node among openset with the least f_score\n\t\t\tx, _value = [], 1_000_000\n\t\t\topenset.each do |key|\n\t\t\t\tx, _value = key, f_score[key] if f_score[key] < _value\n\t\t\tend\n\n\t\t\tbreak if x == goal # We reached target point and thus finished looking for it !!\n\n\t\t\t# Moving x from openset to closedset\n\t\t\topenset.delete x\n\t\t\tclosedset << x\n\n\t\t\t(-1..1).each do |i|\n\t\t\t\t(-1..1).each do |j|\n\t\t\t\t\ty = [x[0] + i, x[1] + j]\n\t\t\t\t\tunless i == 0 and y == 0\n\t\t\t\t\t\tif pitch[y].nil? # We only want to explore neighbours\n\t\t\t\t\t\t\tnext if closedset.include? y # If already in closedset, we skip it\n\n\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\th = dist x, y, :manhattan\n\t\t\t\t\t\t\tg = g_score[x] + h\n\n\t\t\t\t\t\t\tif not openset.include? y then\n\t\t\t\t\t\t\t\treturn [] if frontier.include? y\n\t\t\t\t\t\t\t\tfrontier << y\n\t\t\t\t\t\t\t\topenset << y # Adding current neighbours to openset\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telsif g < g_score[y]\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Updating what needs to be\n\t\t\t\t\t\t\tif better then\n\t\t\t\t\t\t\t\tcame_from[y] = x\n\t\t\t\t\t\t\t\tg_score[y] = g\n\t\t\t\t\t\t\t\th_score[y] = dist y, goal, :manhattan # heuristic estimate of distance (y, coords)\n\t\t\t\t\t\t\t\tf_score[y] = g_score[y] + h_score[y]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# Finally assembling path and returning it\n\t\tpath = []\n\t\t_cur = goal\n\t\twhile _cur != start do\n\t\t\tpath << _cur\n\t\t\t_cur = came_from[_cur]\n\t\tend\n\n\t\treturn path.reverse\n\tend", "title": "" }, { "docid": "557ab8e0e0f978d0ff30b1dbae67a637", "score": "0.58222234", "text": "def connects_to_beginning?(node_id)\n (node_id == @begin_node_id and !@begin_node_direction) or\n (node_id == @end_node_id and @end_node_direction)\n end", "title": "" }, { "docid": "b8907018ff692f7a62911181c3546ee3", "score": "0.57803583", "text": "def find_start(id, from)\n from= to_epoch(from)\n node = $devices[id].head\n while node.next do\n return node if node.value >= from\n node = node.next\n end\n return nil #from time not in list\nend", "title": "" }, { "docid": "958372d3abd46eb7248c0bb4ed76c5df", "score": "0.5745183", "text": "def start_point; get(start_param) end", "title": "" }, { "docid": "737fcbe5b69ebeba768fb9451298af67", "score": "0.5733165", "text": "def morph start_morph, to: nil, current_point: nil\n if current_point\n # puts \"Finding from #{current_point.map {|r| r.join ' '}}\"\n searcher(start_morph, to).find_from_point current_point\n else\n searcher(start_morph, to).find\n end\n end", "title": "" }, { "docid": "b3bf03947d07223105c0467c8bf56ba0", "score": "0.57234466", "text": "def get_start_coordinates\n start_coord = []\n until start_coord_valid?(start_coord)\n puts \"START COORDINATES\"\n start_coord = @current_player.get_user_input\n start_coord = [] if [\"reset\", \"save\", []].include?(do_special_input_stuff(start_coord)) #hackhackhack\n end\n print_board(start_coord)\n puts \"Move #{@board[start_coord[0]][start_coord[1]].class.to_s.upcase} where?\"\n return start_coord\n end", "title": "" }, { "docid": "7387ac42abce2fea457ec887ae5673e6", "score": "0.5721831", "text": "def search(node = @root)\n if node.position == @target\n @target_node = node\n return\n else\n node.connected_knights.each { |knight| search(knight) }\n end\n end", "title": "" }, { "docid": "bfcb76b4a98d2ca8403179106a8f09b8", "score": "0.5700051", "text": "def starting_nodes(graph)\n graph.nodes.select { |node| node.incoming_edges.empty? }\n end", "title": "" }, { "docid": "5cff9a8265bee1de458ac8557b9238f2", "score": "0.56873065", "text": "def start\n start = []\n self.children.each { |c| \n start.push(c.start) unless c.start.nil?\n start.push(c.end) unless c.end.nil?\n }\n start.sort.first\n end", "title": "" }, { "docid": "f34c19a0dd2e195ec749c47f74e33cd0", "score": "0.5686097", "text": "def start\n @start ||= operands.detect {|op| op.is_a?(Start)}\n end", "title": "" }, { "docid": "a0a87e6933f12e4d57176ca291486799", "score": "0.5675541", "text": "def start\n\t\t\t@start < @end ? @start : @end\n\t\tend", "title": "" }, { "docid": "9737a859e304d5a71ee76a636879ed48", "score": "0.5668511", "text": "def find_path(start, goal)\n raise \"loc1 must not be the same as loc2\" if start == goal\n\n # Using A* path-finding algorithm\n # See pseudocode here: https://en.wikipedia.org/wiki/A*_search_algorithm\n # https://www.redblobgames.com/pathfinding/a-star/introduction.html\n # NOTE that this is overkill for this problem...\n open_set = Set.new([start])\n came_from = {}\n\n # Default value of \"Infinity\", but we can just use nil\n g_score = {}\n g_score[start] = 0\n\n # f_score = g_score[node] + h_score[node]\n # This uses both current best path (g score) aka similar to Djikstra's algorithm,\n # plus the heuristic score.\n f_score = {}\n # g_score[start] is 0, so not included here\n f_score[start] = h_score(start, goal)\n\n # Note that we add d_score as the weight of the edge, but in our\n # case, we consider all edges equally, so hardcode 1\n d_score = 1\n\n until open_set.empty? do\n # Node in open set with lowest f score (would ideally use PriorityQueue)\n current = open_set.min_by { |node| f_score[node] }\n\n if current == goal\n return reconstruct_path(came_from, current)\n end\n\n open_set.delete(current)\n\n valid_neighbours(current).each do |neighbour_loc|\n tentative_g_score = g_score[current] + d_score\n if g_score[neighbour_loc].nil? || tentative_g_score < g_score[neighbour_loc]\n # This path to neighbor is better than any previous one. Record it!\n came_from[neighbour_loc] = current\n g_score[neighbour_loc] = tentative_g_score\n f_score[neighbour_loc] = g_score[neighbour_loc] + h_score(neighbour_loc, goal)\n if !open_set.include?(neighbour_loc)\n open_set << neighbour_loc\n end\n end\n end\n end\n\n raise \"error, no path found!\"\n end", "title": "" }, { "docid": "bf75b5191f00e23b4e7c8c8a8cca6c69", "score": "0.5656496", "text": "def find_path(end_pos)\n node = root_node.dfs(end_pos)\n\n self.trace_path_back(node)\n end", "title": "" }, { "docid": "09f1fb59f56f071f21eb6961588b7148", "score": "0.56186163", "text": "def breadth_first_search?(graph, start, goal)\n visited = Hash.new(false)\n queue = Queue.new\n queue.push(start)\n visited[start] = true\n until queue.empty? do\n node = queue.pop\n return true if node == goal\n add_to_queue(graph, queue, node, visited)\n end\n false\n end", "title": "" }, { "docid": "f4fc426a25e34b10443c107628fdaaef", "score": "0.56100667", "text": "def valid_start_node(positions, avg_start_position = AVERAGE_START_POSITION)\n positions.collect{|p| p.split(':')[1].to_f }.inject{ |sum, el| sum + el } / positions.size <= avg_start_position\nend", "title": "" }, { "docid": "b2a673c86f4d773dbc21e7b7c7388ff5", "score": "0.5605499", "text": "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "title": "" }, { "docid": "80f76c3b1ebedddd66149e8e80b27451", "score": "0.5585714", "text": "def find_hamiltonian( start )\n # Define a list of unvisited states.\n @unvisited = @graph.keys\n\n # We will store the journey taken in the array journey.\n @journey = []\n\n # start the recursive hunt\n puts 'Hamiltonian does not exist' unless find_hamiltonian_recursively(start)\n end", "title": "" }, { "docid": "cb791781e374bcd6f3092df903a3f849", "score": "0.5578223", "text": "def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end", "title": "" }, { "docid": "0f4ac4fc5959e61a011ab7a5785fea9c", "score": "0.55722576", "text": "def search_jps\n open_list = [@nodes[@route.start_id]]\n close_list = []\n goal = @nodes[@route.goal_id]\n\n until open_list.empty?\n n = open_list.min_by { |node| @route.estimated_cost(node) }\n if n == goal\n @route.found = true\n break\n end\n\n close_list.push( open_list.delete(n) )\n\n adjacents_of_n = n.pruned_neighbors(@route.parent(n))\n adjacents_of_n.keys.each do |m|\n j = jump(n, clamp(m.x - n.x, -1, 1), clamp(m.y - n.y, -1, 1))\n next if j == nil or close_list.include?(j)\n h = @heuristic.call(j, goal)\n new_real_cost_j = @route.real_cost(n) + Math.sqrt((n.x-j.x)**2 + (n.y-j.y)**2) # g\n new_estimated_cost_j = new_real_cost_j + h # f = g + h\n if open_list.include?(j)\n # If estimated costs are equal then use real costs for more precise comparison (or we may get less optimal path).\n next if new_estimated_cost_j > @route.estimated_cost(j)\n next if new_estimated_cost_j == @route.estimated_cost(j) && new_real_cost_j >= @route.real_cost(j)\n @route.record(j, n, new_real_cost_j, h)\n else\n open_list.push(j)\n @route.record(j, n, new_real_cost_j, h)\n end\n @visited << j.id unless @visited.include? j.id # stats\n end\n @search_iter += 1 # stats\n end\n end", "title": "" }, { "docid": "cf6e0d6389bf702eb5d7d3cf17ef8dda", "score": "0.5558995", "text": "def connects_beginning_to_beginning?(first_node_id, second_node_id)\n (first_node_id == @begin_node_id and second_node_id == @end_node_id and\n @begin_node_direction == false and @end_node_direction == true) or\n (first_node_id == @end_node_id and second_node_id = @begin_node_id and\n @begin_node_direction == false and @end_node_direction == true)\n end", "title": "" }, { "docid": "c73f78f5833c876d3822ce720a07a756", "score": "0.5550563", "text": "def traverse_starter (node)\n return if node == nil\n traverse(node, 0)\n traverse_starter(node.left) if node.left\n traverse_starter(node.right) if node.right\nend", "title": "" }, { "docid": "bef26da852f5c3e7e37623e0b44ce82c", "score": "0.5548982", "text": "def start_nodes(rows)\n rows.reject do |row|\n rows.any? do |other_row|\n other_row.to == row.from\n end\n end\nend", "title": "" }, { "docid": "bb750a9a28f1f73867020e39611aa0e4", "score": "0.55481714", "text": "def getStartPoint()\n geoObject().firstPoint() ;\n end", "title": "" }, { "docid": "b37a1bce88a1c443947cba4f0797377c", "score": "0.5547049", "text": "def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend", "title": "" }, { "docid": "ce4e02b5f92102da892e53be986ef6e6", "score": "0.55442816", "text": "def node_search\n while (current_node = queue.shift).present? && final.nil?\n @processed += 1\n yield(current_node)\n log \"\\rProcessing #{start.name}.... %d / %d / %d / %d @ %ds - depth: %d\", @unmarked, @requeued, @processed, @steps, (Time.now - @started), current_node.depth\n end\n\n format_results\n save_results if final.present?\n self.final_path\n end", "title": "" }, { "docid": "76427af7b9c44f93bbd4095ef010aa7b", "score": "0.55334526", "text": "def find(start,last)\n next_nodes = Array.new\n next_nodes << start\n visited = {}\n while (not next_nodes.empty?)\n next_node = next_nodes.shift\n next if visited[next_node]\n visited[next_node] = true\n return true if next_node == last\n @paths[next_node].map do |x| next_nodes << x end\n end\n return false\n end", "title": "" }, { "docid": "48412710c08492591f41ec0553b303ce", "score": "0.55306005", "text": "def starting_position; end", "title": "" }, { "docid": "a00454e2f049229c3f5958cb515a3249", "score": "0.5518816", "text": "def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node, could use a PQueue instead\n\t\t\tsmallest = @infinity\n\t\t\tcurrent = @infinity\n\t\t\tunvisited.each do |node|\n\t\t\t\tif @vertices[node] < smallest\n\t\t\t\t\tsmallest = @vertices[node]\n\t\t\t\t\t# Step 6\n\t\t\t\t\t# - Set smallest weighted node as current node, continue\n\t\t\t\t\tcurrent = node\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend", "title": "" }, { "docid": "f20ac508d44b317f1d76e6add871d619", "score": "0.55177575", "text": "def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node\n\t\t\tcurrent = unvisited.collect { |node| [@vertices[node],node] }\n\t\t\tcurrent.empty? ? current = @infinity : current = current.min[1]\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend", "title": "" }, { "docid": "3c3b68b2ee7f640b1fb9b5140545466f", "score": "0.5513609", "text": "def pathfind begTile, endTile\n @traveled_tiles = [begTile]\n @current_tiles = [begTile]\n @next_tiles = Array.new\n #iterate through the maze one movement at a time, hard stop when all tiles have been exhausted\n while (!@current_tiles.include? endTile) && @traveled_tiles.length < @maze.size\n @current_tiles.each do |tile|\n (get_adjacent_floors tile).each do |next_tile|\n #makes sure no tiles are double counted, the first to hit will always be the shortest\n if (next_tile.is_floor) && (!@next_tiles.include? next_tile) && (!@traveled_tiles.include? next_tile)\n @next_tiles.push next_tile\n next_tile.previous_tile tile\n end\n end\n end\n @traveled_tiles.concat @next_tiles\n @current_tiles = @next_tiles.dup\n @next_tiles.clear\n end\n endTile.get_path\n end", "title": "" }, { "docid": "3e79059a60d43f99cc2e3c09b5d28e17", "score": "0.5505552", "text": "def next_starting_position\n\t\tpos = @starting_positions[@pos_idx]\n\t\t@pos_idx = (@pos_idx + 1) % @starting_positions.length\n\t\tpos\n\tend", "title": "" }, { "docid": "1138641a986273a514733fbe275cd3ab", "score": "0.5503464", "text": "def accessor_start(node); end", "title": "" }, { "docid": "733147b85dbbb262c934f84ee7767b73", "score": "0.5494541", "text": "def start\n @parts.first.start\n end", "title": "" }, { "docid": "11819d8e675434c1b03d79ccc686d95a", "score": "0.5483123", "text": "def search(path, final_point)\n\n current = path.first\n puts \"current.center = #{current.center}\"\n puts \"final_point.center = #{final_point.center}\"\n puts \"path.size = #{path.size}\"\n puts \"path = #{path.map{ |p| [p.center,p.wp_visited?].flatten }}\"\n puts \"current.wp_visited? = #{current.wp_visited?}\"\n\nbinding.pry # => debugger\n\n if wp_distance2(current, final_point) < 1.0\n puts \"found\"\n return path.reverse\n end\n\n wp_adjacents = sort_and_filter(current.wp_adjacents, final_point)\n\n wp_adjacents.each do |wp|\n search(path.unshift(wp), final_point)\nbinding.pry # => debugger\n wp.wp_mark\n end\n end", "title": "" }, { "docid": "b4956697b07cf194e83f9ab41a7c266d", "score": "0.5467058", "text": "def start_point\n o = st_start_point\n [o.y, o.x]\n end", "title": "" }, { "docid": "50287cbf38c1b5207a04947c613985fb", "score": "0.5458052", "text": "def solve_start(first)\n starting_edge = Edge.new(first,first,0, 0)\n @queue.push(starting_edge)\n solve(first)\n end", "title": "" }, { "docid": "869ac818a85922f3857a993fe9d829a6", "score": "0.5449001", "text": "def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return path_to_destination(current_position, initial_position_obj)\n end\n\n add_possible_destination(position, current_position, knights_path)\n end\n end", "title": "" }, { "docid": "ec2b3a1de38ad2fd93e182292a83908b", "score": "0.5435128", "text": "def find_start nums, target, left, right\n if left + 1 >= right\n return left if nums[left] == target\n return right if nums[right] == target\n return -1\n end\n\n mid = left + (right - left) / 2\n\n if nums[mid] >= target\n right = mid\n else\n left = mid\n end\n\n find_start nums, target, left, right\nend", "title": "" }, { "docid": "95f1998773e9059ea32a1092fcfe2198", "score": "0.5432391", "text": "def starting; end", "title": "" }, { "docid": "a2f99c15e260628f98cbc2ac4a487e9d", "score": "0.54297733", "text": "def find_starting_idx(destination_idx, jump_idx)\n jump_idx.length > 1 ? jump_idx[destination_idx - 1] : 0\nend", "title": "" }, { "docid": "18faf058fb0f0e5aa938c09eb4e9b0b7", "score": "0.54261994", "text": "def shortest_path(nodes, starting, ending)\n queue = [starting]\n previous = {}\n previous[starting] = nil\n while !queue.empty?\n p queue\n last_node = queue.pop\n if last_node == ending\n path = []\n while previous[last_node]\n path.unshift(last_node)\n last_node = previous[last_node]\n end\n path.unshift(starting)\n return path\n end\n if neighbors = nodes[last_node]\n neighbors.each do |neighbor|\n unless previous.has_key?(neighbor)\n queue.unshift(neighbor) \n previous[neighbor] = last_node\n end\n end\n end\n end\nend", "title": "" }, { "docid": "e3127123b3bcb2da243bbf1632b314f2", "score": "0.54250956", "text": "def find_target_node\n fullname = @fullname\n mark = ''\n if fullname.end_with?(Position::With_Singular_Leaf)\n mark = Position::With_Singular_Leaf\n elsif fullname.end_with?(Position::Without_Singular_Leaf)\n mark = Position::Without_Singular_Leaf\n end\n fullname.gsub!(/#{mark}/, '')\n @position = Position.find :first, :scope => :self, :conditions => {:fullname => fullname}\n end", "title": "" }, { "docid": "2e8560f416f01623b4bf7c7a94fa8808", "score": "0.54174894", "text": "def breadth_first_search(start_node, target_value)\n\t\tvisited = [start_node]\t\t\t\n\t\tqueue = [start_node]\n\t\n\t\twhile ( queue.length > 0 )\t\n\n\t\t\t# dequeue\n\t\t\tvertex = queue.shift\n\t\t\treturn vertex if target_value.name == vertex.name\n\t\n\t\t\t# visit all adjacent unvisited vertexes, mark visited, enqueue\n\t\t\tNode.childPointers.each do |child|\n\t\t\t\tif !eval(\"vertex.#{child}.nil?\")\n\t\t\t\t\tif !eval(\"visited.include?vertex.#{child}\")\n\t\t\t\t\t\tvisited << eval(\"vertex.#{child}\")\n\t\t\t\t\t\teval(\"vertex.#{child}.prev = vertex\")\n\t\t\t\t\t\tqueue << eval(\"vertex.#{child}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnil\n\tend", "title": "" }, { "docid": "53020e528b4950bb04539440d190cf54", "score": "0.5405279", "text": "def knight_moves(start, finish)\n tree = MoveTree.new(start)\n queue = [tree]\n result = nil\n visited_points = Set.new()\n while queue.length > 0\n current_node = queue.shift\n visited_points.add(current_node.point)\n if current_node.point == finish\n result = get_path(current_node)\n break\n else\n propagate_tree(current_node)\n queue += current_node.children.reject { |n| visited_points.include?(n.point) }\n end\n end\n result\nend", "title": "" }, { "docid": "5b8bd71ba4b75c4bee7ae57cde3ed393", "score": "0.54032075", "text": "def start_at(x, y = nil)\n from.coord x, y\n end", "title": "" }, { "docid": "1cc867c973abe6ccbb10ce72b9809702", "score": "0.53849524", "text": "def find_scene_starts(script)\n script = script.split(\"\\n\") if script.is_a?(String)\n scene_ends = find_scene_ends(script)\n scene_starts = scene_ends.map{|e| e+1} # Point to the next line after the \"- fin -\" marker\n scene_starts.unshift(start_of_first_scene(script)) # Add a scene start to the beginning\n scene_starts.pop # don't need the last one\n scene_starts\n end", "title": "" }, { "docid": "7bef22ff49f482b68f22a594d2eb6da6", "score": "0.53778625", "text": "def start!\n\t\t\n\t\t@skippy.print_location #prints initial location (i.e., (0,0))\n\t\twhile !@skippy.at_home? do\n\t\t\t@skippy.hop!\n\t\t\t@skippy.print_location #print location after each hop (don't need a method for final_location)\n\t\t\t@hops += 1\n\t\tend\n\t\t\n\tend", "title": "" }, { "docid": "bddb5b76d0cfc9cc44a90fc2c84001da", "score": "0.5377683", "text": "def find_shortest_path(start_node, end_node)\n\n\t\tif (!start_node || !end_node)\n\t\t\traise \"start and end nodes must be specified\"\n\t\tend\n\n\t\tqueue = Hash[@edges.keys.map { |k| [k, nil] }]\n\t\tqueue[start_node] = 0\n\n\t\tdistances = queue.dup\n\t\tcrumbs = {}\n\n\t\twhile queue.size > 0\n\n\t\t\texpanded_node = get_min(queue)\n\n\t\t\t# Check if the current path to each neighbor of the expanded_node\n\t\t\t# is shorter than the path currently stored on the distances hash\n\t\t\t@edges[expanded_node].each do |node, edge|\n\n\t\t\t\tif distances[expanded_node]\n\t\t\t\t\n\t\t\t\t\tcurrent_path_distance = distances[expanded_node] + edge.weight\n\n\t\t\t\t\t# The distance to node is shorter via the current path or the distance to node hasn't yet been computed.\n\t\t\t\t\t# Either way, the distance from start_node->node is updated with the current distance (since it is shorter)\n\t\t\t\t\tif (!distances[node] || current_path_distance < distances[node])\n\t\t\t\t\t\tdistances[node], queue[node] = current_path_distance, current_path_distance\n\t\t\t\t\t\tcrumbs[node] = expanded_node\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tqueue.delete(expanded_node)\n\n\t\tend\n\n\t\t# List of edges representing the shortest path from start_node to end_node\n\t\tshortest_path = []\n\t\tcurrent_node = end_node\n\n\t\twhile (current_node && current_node != start_node && crumbs.size > 0)\n\t\t\tprevious_node = crumbs[current_node]\n\t\t\tif (previous_node)\n\t\t\t\tshortest_path << @edges[previous_node][current_node]\n\t\t\t\tcrumbs.delete(current_node)\n\t\t\tend\n\t\t\tcurrent_node = previous_node\n\t\tend\n\n\t\treturn shortest_path.reverse\n\n\tend", "title": "" }, { "docid": "f95b5435e4020ddffe747c807a9bcbd4", "score": "0.53753614", "text": "def bfs(start, goal = :goalNode?)\n require 'set'\n visited = Set.new\n frontier = []\n frontier << start\n\n until frontier.empty?\n current = frontier.shift\n\n next if visited.include? current\n visited << current\n\n found = false\n found = if block_given?\n yield(current)\n else\n send(goal, current)\n end\n\n if !found\n current.connections.each do |node|\n frontier << node\n end\n else\n return current\n end\n end\n :goal_node_not_found\nend", "title": "" }, { "docid": "d614046e4f2e2bcda8e04d569842afc0", "score": "0.53639954", "text": "def find_path(end_pos)\n # self.dfs(target)\n end_node = root_node.bfs(end_pos)\n trace_path_back(end_node).map { |node| node.value }.reverse!\n end", "title": "" }, { "docid": "17bbbb88398739bae6eb0d78a89c6774", "score": "0.53631985", "text": "def start_board\n @start_node.board.dup\n end", "title": "" }, { "docid": "3f07aa57bebae1995a3fcf968468f4fe", "score": "0.5361823", "text": "def search_from_cursor(index)\n\t\tif index == cursor_index\n\t\t\tcursor_node\n\t\telsif index > cursor_index\n\t\t\tcurrent_node = cursor_node\n\t\t\t(index-cursor_index).times do |i|\n\t\t\t\tcurrent_node = current_node.next_node\n\t\t\tend\t\n\t\t\tupdate_cursor(node: current_node, index: index)\t\t\t\n\t\t\tcurrent_node\t\t\t\n\t\telse\n\t\t\tcurrent_node = cursor_node\n\t\t\t(index-cursor_index).times do |i|\n\t\t\t\tcurrent_node = current_node.previous_node\n\t\t\tend\t\n\t\t\tupdate_cursor(node: current_node, index: index)\t\t\t\n\t\t\tcurrent_node\n\t\tend\t\t\n\tend", "title": "" }, { "docid": "25a81ba2352ffc07b9e0b96dad04a08e", "score": "0.5360513", "text": "def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend", "title": "" }, { "docid": "6eca817b86a0e9bc730d2a706c710c09", "score": "0.53560823", "text": "def prev_node_finder(n_s, i)\n path_line = $dijkstra_result.select{ |line| line =~ /^#{n_s}/}\n path_line_array = []\n if (path_line[0] == nil)\n return\n else\n path_line_array = path_line[0].split(',')\n end\n prev_node = path_line_array[2]\n $path[i].push(prev_node)\n prev_node_finder(prev_node,i)\n #puts \"Previous node of #{n_d} is #{prev_node}\"\nend", "title": "" }, { "docid": "fbc93f7e7dd1c594a43e524c47d7fb51", "score": "0.535187", "text": "def find_shortest_path(initial_node, final_node)\n\t\tunless @nodes.include?(initial_node) && @nodes.include?(final_node)\n\t\t raise(\"Either of the nodes not found in the Graph\") \n\t\tend\n\t\tdistance = {}\n\t previous = {}\n\t\tdistance[initial_node] = 0 # Distance from initial_node to initial_node\n\t previous[initial_node] = nil\n\t\tnodes_counted = @nodes\n\t\t\t\n\t\tnodes_counted.each do |n|\n\t\t if n != initial_node \n\t\t\t distance[n] = Float::INFINITY # Unknown distance function from initial_node to final_node\n\t\t\t previous[n] = nil \t # Previous node in optimal path from initial_node\n\t\t\tend\n\t\tend\n\n\t\tuntil nodes_counted.empty? \n\t\t\n\t\t\tu = distance.select{|k,v| nodes_counted.include?(k)}.min_by{|k,v| v}.first # Source node in first case\n\t\t\tbreak if (distance[u] == Float::INFINITY)\n\t\t\tnodes_counted.delete(u)\n\t\t\t\n\t\t\t@paths[u].keys.each do |v|\n\t\t\t\talt = distance[u] + @paths[u][v]\n\t\t\t\tif alt < distance[v] # A shorter path to v has been found\n\t\t\t\t\tdistance[v] = alt\n\t\t\t\t\tprevious[v] = u\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t \n\t\tpath = []\n\t\tcurrent = final_node\n\t\twhile current\n\t\t\tpath.unshift(current)\n\t\t\tcurrent = previous[current]\n\t\tend\n \n\t\treturn distance[final_node], path\n\n\tend", "title": "" }, { "docid": "9814404c7545596edf7396c5a61f2757", "score": "0.53507334", "text": "def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end", "title": "" }, { "docid": "594aed7ab15a17915b7160ba6d423e52", "score": "0.5347514", "text": "def update\n return if @needs_reset\n\n # Message\n if !@start\n @message = 'Choose the start node.'\n elsif !@end\n @message = 'Choose the end node.'\n else\n @message = 'Add obstacles and press ENTER.'\n end\n\n if Gosu.button_down? Gosu::MsLeft\n node = find_node\n if node\n # Make start node\n if !@start && node != @end\n node.start!\n @start = node\n # Make end node\n elsif !@end && node != @start\n node.end!\n @end = node\n # Make obstacle\n elsif node != @start && node != @end\n node.obstacle!\n end\n end\n end\n\n # Clear a node\n if Gosu.button_down? Gosu::MsRight\n node = find_node\n if node\n node.reset!\n if node == @start\n reset_start!\n elsif node == @end\n reset_end!\n end\n end\n end\n end", "title": "" }, { "docid": "2b10f34c4bfa93a9479328fca7c7fee6", "score": "0.53447485", "text": "def get_route(start_arr, end_arr)\n root = Position.new(start_arr[0], start_arr[1])\n target = Position.new(end_arr[0], end_arr[1])\n solution = get_target_value(target, root)\n\n route = []\n route.unshift([target.x, target.y])\n location = solution.parent\n until location == nil\n route.unshift [location.x, location.y]\n location = location.parent\n end\n return route\nend", "title": "" }, { "docid": "3aea6a33fd71b7f50177868be577111d", "score": "0.534451", "text": "def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end", "title": "" }, { "docid": "ad3c73cb8477c1cf01dac98d8abd5df2", "score": "0.53437907", "text": "def prepare_search\n # puts \"prepare_search called\"\n @current_point = @start_vector\n @interval_index = 0\n @path = [@start_vector]\n @initial_run = true\n \n @current_cost = get_cost @current_point\n end", "title": "" }, { "docid": "16167b209fdb2997c8e6d11b05dbfd1a", "score": "0.53358454", "text": "def explore(start)\n visited = Hash.new(false)\n visited[start] = true \n start.out_edges.each do |edge|\n explore(edge.dest) if !visited[edge.dest]\n end\n return visited\n end", "title": "" }, { "docid": "1c51848966802b48e1b6a1bacf4f561d", "score": "0.53356695", "text": "def find_path(end_pos)\n path = [@root_node]\n valid_moves = KnightPathFinder.valid_moves(@root_node)\n valid_moves.each do |move|\n @move_tree.add_child(move)\n end\n \n if @move_tree.bfs(end_pos) == end_pos\n path << end_pos\n else \n end\n\n end", "title": "" }, { "docid": "28cd1059679bcd76a6361b8b9f767b9e", "score": "0.5327632", "text": "def a_star(start,goal)\n\t\treturn false # TODO make this actually work\n\t\t###########################################\n\t\tchecked = []\n\t\toptions = [start]\n\t\tpath = []\n\t\tg_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\th_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\tf_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\tg_score[start[:y]][start[:x]] = 0\n\t\th_score[start[:y]][start[:x]] = distance(start, goal, :diagonal)\n\t\tf_score[start[:y]][start[:x]] = h_score[start[:y]][start[:x]]\n\t\tuntil options.empty?\n\t\t\toption_scores = options.map{|o| f_score[o[:y]][o[:x]]}\n\t\t\tcurr = options.delete_at option_scores.index(option_scores.min)\n\t\t\tputs curr\n\t\t\treturn false if curr == goal\n\t\t\tchecked << curr\n\t\t\tcollect_adjacent_points(curr).each do |neighbor|\n\t\t\t\tnext if checked.include? neighbor\n\t\t\t\ttentative_g_score = g_score[curr[:y]][curr[:x]] + 1 # 1 == dist_between(curr,neighbor)\n\t\t\t\tif !options.include? neighbor\n\t\t\t\t\toptions << neighbor\n\t\t\t\t\ttentative_is_better = true\n\t\t\t\telsif tentative_g_score < g_score[neighbor[:y]][neighbor[:x]]\n\t\t\t\t\ttentative_is_better = true\n\t\t\t\telse\n\t\t\t\t\ttentative_is_better = false\n\t\t\t\tend\n\t\t\t\tif tentative_is_better\n\t\t\t\t\tg_score[neighbor[:y]][neighbor[:x]] = tentative_g_score\n\t\t\t\t\th_score[neighbor[:y]][neighbor[:x]] = distance(neighbor, goal)\n\t\t\t\t\tf_score[neighbor[:y]][neighbor[:x]] = g_score[neighbor[:y]][neighbor[:x]] + h_score[neighbor[:y]][neighbor[:x]]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "title": "" }, { "docid": "9fe250d9160c435f11cccc53c282f116", "score": "0.5318868", "text": "def selected_first_edges\n @next_summit = @edges_distances.select{ |edges| edges.include?(@first_position.select{ |distance| distance > 0}.min)if edges != @first_position }\n end", "title": "" }, { "docid": "651364db8e1205d8a3929607d96172d6", "score": "0.5316476", "text": "def findPath(startPoint, endPoint)\n # Initialize node array\n # This array will host all the map points we are going to visit\n # On each visit the point will be removed and marked as visited\n q = []\n # This is tie visited array that keeps the visit index\n @visited = Array.new(@width * @height, 0)\n \n # Add first point to visited\n @visited[self.getXYIndex(startPoint)] = 1\n \n # Add current point (the start point) to the search pool\n currentPoint = XYLoc.new(startPoint.x, startPoint.y)\n q.push(currentPoint)\n\n # Search until all points are searched\n while (q.count() > 0)\n # Get first item (and remove from the pool)\n pnext = q.shift\n \n # Get neighbors/children\n succList = self.getNeighbors(pnext)\n for succ in succList\n # Check if point already visited\n if (@visited[self.getXYIndex(succ)] >= 1)\n next\n end\n # Set visited index as the current visited index + 1\n @visited[self.getXYIndex(succ)] = @visited[self.getXYIndex(pnext)] + 1\n \n # Check if the end point is found\n if (succ.x == endPoint.x && succ.y == endPoint.y)\n # Extract path\n return self.extractPath(endPoint)\n end\n \n # Point is not the goal point.\n # Push the point into the search pool.\n q.push(succ)\n end\n end\n \n # The search pool is empty and the goal point hasn't\n # been reached. Return empty path.\n return []\n end", "title": "" }, { "docid": "16f661f260671be3c85c6989541b2bc2", "score": "0.53033066", "text": "def move(start, finish)\n unless @board.valid_position?(start) && @board.valid_position?(finish)\n return invalid_inputs\n end\n\n queue = [Node.new(start)]\n node = Node.new\n\n until node.data == finish\n node = queue.shift\n @board.moves_as_children(node)\n node.children.each { |child| queue << child }\n end\n\n print_path(create_path(node))\n end", "title": "" }, { "docid": "d617939934cdfa783f1df45bb476ad69", "score": "0.529925", "text": "def is_start?(cell)\n @start_cell.eql?(cell)\n end", "title": "" }, { "docid": "5a34f08dfe9bec2fc5e14987c2d316ca", "score": "0.5292294", "text": "def shortest_path_to_user(start_coord)\n queue = Queue.new\n queue << [start_coord]\n seen = Set.new([start_coord])\n while queue\n begin\n path = queue.pop(non_block = true)\n rescue ThreadError\n return nil\n end\n x, y = path[-1]\n if @map[y][x] == @USER\n return path\n end\n for x2, y2 in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]\n if (0 <= x2 && x2 < @map[0].length) && (0 <= y2 && y2 < @map.length) && (@map[y2][x2] != @WALL && @map[y2][x2] != @PERMANENT_WALL) && !seen.include?([x2, y2])\n queue << (path + [[x2, y2]])\n seen.add([x2, y2])\n end\n end\n end\n end", "title": "" }, { "docid": "9a1568df8bd12ca922981d8925c72186", "score": "0.5288517", "text": "def start; @opts['start']; end", "title": "" }, { "docid": "d1eb16d3cf6ff4b83600188e30212b6d", "score": "0.5286991", "text": "def shortest_path(start, finish)\n queue << [start, 0]\n loop do\n break if queue.empty?\n vertex, d = queue.pop\n graph[*vertex] = d\n break if vertex == finish\n enqueue_neighbours(*vertex, d + 1)\n end\n queue.clear\n !blank?(finish) ? build_path(start, finish) : []\n end", "title": "" }, { "docid": "ac6596fd7efa36b98f8b8340611737db", "score": "0.5284355", "text": "def locate(start, finish, &block)\n @stop = false\n @queue = Queue.new\n Thread.new(block) do\n sn = @ss.find(start)\n fn = @ss.find(finish)\n if sn == fn\n @drawer.slowly_draw_segment(Segment[start, finish], self) do\n draw\n end\n else\n path = @graph.path(sn.vertice, fn.vertice)\n if !path.nil?\n already_drew = []\n old = start\n path << finish\n path.each do |v|\n s = Segment[old, v]\n @drawer.slowly_draw_segment(s, self) do\n draw\n already_drew.each {|ad| @drawer.draw_segment(ad, :robot)} if @show_line\n end\n already_drew << s\n old = v\n end\n draw\n already_drew.each {|ad| @drawer.draw_segment(ad, :robot)} if @show_line\n @drawer.draw_circle(finish.x, finish.y, 5, :robot)\n else\n @statusbar.push(@context, \"Não existe caminho de #{start.inspect} até #{finish.inspect}\")\n draw\n end\n end\n block.call\n end\n end", "title": "" }, { "docid": "aa8d30aa8c68f372314d07b07c4b4c19", "score": "0.52806103", "text": "def node_recurse(startnode, name_steps)\n if not startnode.nil? and not name_steps.empty?\n #puts \"Starting at #{startnode[\"name\"]} and going through #{name_steps}\"\n next_dir = name_steps.shift\n #puts \"Next step is #{next_dir}\"\n next_node = startnode\n startnode[\"file\"].each do |child|\n #puts \"Comparing #{child['name']} to #{next_dir}\"\n if child[\"name\"] == next_dir\n #puts \"Found the matching child\"\n next_node = child\n break\n end\n end\n if next_node != startnode\n # Good. That means we found the next child.\n #puts \"Found #{next_dir}. Recursing for #{name_steps}\"\n return node_recurse(next_node, name_steps)\n else\n # Uh. Oh. The next child was not found in the startnode's file list. This must indicate a bad path\n puts \"ERROR: At startnode #{startnode[\"name\"]}, could not find the next child of #{next_dir}. Remaining paths: #{name_steps}\"\n return startnode\n end\n else\n if startnode.nil?\n puts \"Why? The startnode is Nil!\"\n end\n return startnode\n end\n end", "title": "" }, { "docid": "f2a4ab2d771139bc9e84477f27a5b935", "score": "0.5277505", "text": "def start\n @range.start\n end", "title": "" }, { "docid": "298d51d0e1dd28f659994a5d94f3c1ce", "score": "0.5276264", "text": "def start?\n @cursor == 0\n end", "title": "" }, { "docid": "320cbc0fb28f2c66160483ff457adbd2", "score": "0.5273135", "text": "def best_path(start, target)\n queue = []\n path = []\n targetX = target[0]\n targetY = target[1] \n update_possible_moves(start)\n path << [@x, @y]\n until @x == targetX && @y == targetY\n @moves.each do |valid_move|\n queue << valid_move unless out_of_bounds?(valid_move) \n end\n #shift because we want bread-first search\n next_move = queue.shift\n update_possible_moves(next_move)\n path << [@x, @y] \n end\n # Filter out the best path and present it\n best_possible_path = filter_path(path)\n puts \"You made it in #{best_possible_path.length} moves! The path is:\\n#{best_possible_path}\"\n end", "title": "" }, { "docid": "631a96a6a0582c3feba33132fe23e18e", "score": "0.527274", "text": "def processNextStart()\n while true\n path = starts.next\n if building_path\n if compare.call path.first, building_path.first\n add_path path\n else\n return next_path(path)\n end\n else\n next_path(path)\n end\n end\n rescue Pacer::EmptyPipe, java.util.NoSuchElementException\n if building_path\n r = building_path\n self.building_path = nil\n r\n else\n raise EmptyPipe.instance\n end\n end", "title": "" }, { "docid": "26c8c3b52cd453270cc76b5cce95ff96", "score": "0.5264514", "text": "def viewport_start_from_params\n case \n when !params[:start_pos] : @seq_begin\n when params[:start_pos].to_i < @seq_begin : @seq_begin\n when params[:start_pos].to_i >= @seq_end : @seq_end - 1\n else\n params[:start_pos].to_i\n end\n end", "title": "" }, { "docid": "8e502d090b9fce51ea9516ce23d485d0", "score": "0.5262434", "text": "def aStar(tx = @player.x/@TILESIZE, ty = @player.y/@TILESIZE, x = @x/@TILESIZE, y = @y/@TILESIZE)\n #exit conditions\n if tx > @map.WIDTH or ty > @map.HEIGHT or tx < 0 or ty < 0\n return Node.new(x, y, nil, 0)\n end\n start = Time.now\n evald = Array.new #nodes that have already been evaluated\n queue = [Node.new(x, y, 0)]#the last element is the g value\n until queue.empty?\n #queue.each{ |q| print q.toArray, \"...\"}\n #print \"\\n\" #for debugging\n current = queue[0]#finds the node in queue with the lowest f value\n queue.each do |q|\n current = q if q.f(tx, ty) < current.f(tx, ty)\n end\n evald.push(current)#move current from 'queue' to 'evald'\n queue.delete(current)\n #direction from the second node aka the one after the one the ghost is at\n if current.x == tx and current.y == ty\n current.trim\n return current\n #print \"the ghost is confused\\n\" # for debugging\n end\n @map.getSurrounding(current.x, current.y, false).each{ |n|\n node = Node.toNode(n)\n node.g= current.g + 1\n node.parent= current\n nodeInEvald = false\n evald.each{ |evNode|\n if(evNode.coords == node.coords)\n if(evNode.g > node.g)\n evNode.g = node.g\n evvNode.dir = node.dir\n end\n nodeInEvald = true\n break\n end\n }\n if !nodeInEvald\n queue.push(node) \n end\n }\n #just gives up if it's been trying to find a path for more than 5 seconds\n if Time.now - start > 5\n current.trim\n current.timeOut = true;\n return current\n end\n end\n nil\n end", "title": "" }, { "docid": "691058eb4d7122b763f2b94a19f07ab3", "score": "0.5255449", "text": "def is_start?\n type == TYPES[:start]\n end", "title": "" }, { "docid": "8ac5b7b58cb2810fa3a4e0ff09b91134", "score": "0.5255289", "text": "def _find_args_start(def_node)\n args = find_node(def_node, :ARGS, def_node.first_lineno, def_node.first_lineno)\n\n if args.size > 1\n @logger.error(\"I didn't think this was possible, I must have been wrong\")\n end\n args.first\n end", "title": "" }, { "docid": "1d6afbaf33ca8f9a8e648faa17e212fe", "score": "0.525061", "text": "def start\n @history.objects.find { |o| o.name == \"start\" }.val\n end", "title": "" }, { "docid": "521b23cb84034db28f0878cc9a21790a", "score": "0.5249727", "text": "def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end", "title": "" }, { "docid": "5b7027b7ab96cd8426cfed4c0e75a4ee", "score": "0.52472925", "text": "def get_starting_point\n\t\tif starting_location_meeting.blank?\n\t\t\tstarting_location_dl\n\t\telse\n\t\t\tstarting_location_meeting\n\t\tend\n\tend", "title": "" } ]
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "dfcf2a7dd57523a919666f46a5f03e31", "score": "0.0", "text": "def new_input_set()\n return GetRecordsInputSet.new()\n end", "title": "" } ]
[ { "docid": "64c57f88a4eac6079f885b7b88602378", "score": "0.66497", "text": "def execute(input_set = nil)\n # If the inputs are not configured, create a blank set.\n if input_set == nil\n input_set = InputSet.new()\n end\n param_map = {\"source_id\" => TembooSession.get_identifier()}\n body = input_set.format_inputs()\n results = @session.post_request(get_path(), body, param_map)\n return results.body()\n end", "title": "" }, { "docid": "0370ec21f4b4156dceaea811bf69fae0", "score": "0.6483957", "text": "def new_input_set()\n return MathAndScienceInputSet.new()\n end", "title": "" }, { "docid": "6003a0f29580546ce2272cb33adc5518", "score": "0.6319194", "text": "def new_input_set()\n return SetDescriptionInputSet.new()\n end", "title": "" }, { "docid": "970da208256e60850aa1685c98a46594", "score": "0.63119155", "text": "def new_input_set()\n return ContractsInputSet.new()\n end", "title": "" }, { "docid": "1fff84a6cf97ae95c807a4a69ea860fa", "score": "0.62781215", "text": "def input\n @input ||= Set.new\n end", "title": "" }, { "docid": "bf5f05369c2e84126567f9243ceb6dfe", "score": "0.6270611", "text": "def new_input_set()\n return GetEtymologyInputSet.new()\n end", "title": "" }, { "docid": "7b190fc73b9a20db17bf17565bfab2e1", "score": "0.62674415", "text": "def new_input_set()\n return GetDefinitionsInputSet.new()\n end", "title": "" }, { "docid": "5532b50427f87e1b76abdbf99fac74b7", "score": "0.6260382", "text": "def new_input_set()\n return GetUserInputSet.new()\n end", "title": "" }, { "docid": "0e57981ddef69faa6143422e6f3c471d", "score": "0.62576175", "text": "def new_input_set()\n return ExecutePaymentInputSet.new()\n end", "title": "" }, { "docid": "9142d9e074f4a393cf26ebf26fd947fe", "score": "0.62385845", "text": "def new_input_set()\n return MentionsInputSet.new()\n end", "title": "" }, { "docid": "a0a1b625c34045b8f2b2cfadfdfa0b86", "score": "0.62293905", "text": "def new_input_set()\n return UserInputSet.new()\n end", "title": "" }, { "docid": "4380abf25bae1870dbf523896564c95f", "score": "0.6219069", "text": "def new_input_set()\n return GetExamplesInputSet.new()\n end", "title": "" }, { "docid": "182a6a0d363403c3cc8dd6367a6124a4", "score": "0.6185865", "text": "def new_input_set()\n return CreateUserInputSet.new()\n end", "title": "" }, { "docid": "e3a3c9ca61d093f662ed935e7f3e16e3", "score": "0.61762726", "text": "def new_input_set()\n return GetContextInputSet.new()\n end", "title": "" }, { "docid": "dde8e7290f189f9ccdfc250a0a456044", "score": "0.61523426", "text": "def new_input_set()\n return GetInvoiceInputSet.new()\n end", "title": "" }, { "docid": "34f52112f91ac4f6b4d2ab7f359e6370", "score": "0.61429346", "text": "def new_input_set()\n return HealthAndSportsInputSet.new()\n end", "title": "" }, { "docid": "4064b0e875a2a7bb25793ee6a06d4192", "score": "0.61131257", "text": "def new_input_set()\n return MusicAndTheArtsInputSet.new()\n end", "title": "" }, { "docid": "efd5f55ce80b2e51651c843efb490c7a", "score": "0.6100583", "text": "def new_input_set()\n return DownloadSpreadsheetInputSet.new()\n end", "title": "" }, { "docid": "3761cf3b9d3dca7f3a689a4e9b45fca7", "score": "0.60944587", "text": "def new_input_set()\n return GetDeploymentInputSet.new()\n end", "title": "" }, { "docid": "363b6fd40cf0a01c6de776ec6034007d", "score": "0.6078606", "text": "def new_input_set()\n return GetByZipInputSet.new()\n end", "title": "" }, { "docid": "3cf345f748d4247aab680a45a4f89946", "score": "0.6077781", "text": "def new_input_set()\n return UpdateUserInputSet.new()\n end", "title": "" }, { "docid": "2f697e4a2dcee6ea752a702ca11e649b", "score": "0.60701245", "text": "def new_input_set()\n return RetrieveUserInputSet.new()\n end", "title": "" }, { "docid": "c1e400636ba2f601831ceb83c2eb2f0e", "score": "0.606116", "text": "def new_input_set()\n return CalculateTariffInputMetaDataInputSet.new()\n end", "title": "" }, { "docid": "be6950eccb0ed5b6a32963f44633be90", "score": "0.60604453", "text": "def new_input_set()\n return GetByCoordinatesInputSet.new()\n end", "title": "" }, { "docid": "85d90ec1957335b35243e6307ab0aacc", "score": "0.60544485", "text": "def new_input_set()\n return SetLocationInputSet.new()\n end", "title": "" }, { "docid": "4a246c210ac18101f25ee8639ce15637", "score": "0.6043399", "text": "def new_input_set()\n return GenomesInputSet.new()\n end", "title": "" }, { "docid": "5caf99c628383dcf6b26594fbbbaef6b", "score": "0.60309035", "text": "def new_input_set()\n return AssistanceInputSet.new()\n end", "title": "" }, { "docid": "fae4502229cda86053fcfffdbcd4009b", "score": "0.60242593", "text": "def new_input_set()\n return GetFileInformationInputSet.new()\n end", "title": "" }, { "docid": "1d772daa3314b804833edcd052724543", "score": "0.6015852", "text": "def new_input_set()\n return GetCurrentUserInputSet.new()\n end", "title": "" }, { "docid": "ab48c09a2e53f8efcc5bda03b2bde0f9", "score": "0.60094243", "text": "def new_input_set()\n return GetPhotosInputSet.new()\n end", "title": "" }, { "docid": "78f21f915801b8c22e1aaf7327068559", "score": "0.6007352", "text": "def new_input_set()\n return GetFileInfoInputSet.new()\n end", "title": "" }, { "docid": "77748b8f8bc82872718293a312df5959", "score": "0.5993843", "text": "def new_input_set()\n return EnrollmentDemographicsInputSet.new()\n end", "title": "" }, { "docid": "3b79655e82fffb0e9b11be262f75c42a", "score": "0.5968485", "text": "def new_input_set()\n return ResidenceInputSet.new()\n end", "title": "" }, { "docid": "56356457fdd982b6a6b4252954a16629", "score": "0.5949067", "text": "def new_input_set()\n return GetCommitteeInputSet.new()\n end", "title": "" }, { "docid": "53265b5f17fd1321e34c28f6d2ecda13", "score": "0.5948022", "text": "def new_input_set()\n return GetDataStreamInputSet.new()\n end", "title": "" }, { "docid": "a3baf51d483d98f14954c1e1e0611e2f", "score": "0.59332806", "text": "def new_input_set()\n return GetWeatherInputSet.new()\n end", "title": "" }, { "docid": "382b1d2254369dfafb4f97600cf16868", "score": "0.5932821", "text": "def new_input_set()\n return ZipFileInputSet.new()\n end", "title": "" }, { "docid": "bb0c9393427205724877835fe3d2648b", "score": "0.5929373", "text": "def new_input_set()\n return HistoryAndCivicsInputSet.new()\n end", "title": "" }, { "docid": "983ec298e381d714e412776f6f9bef37", "score": "0.59289706", "text": "def new_input_set()\n return GetDocumentInputSet.new()\n end", "title": "" }, { "docid": "32e7f4559b6e20bf00ea8809592b79d7", "score": "0.59180695", "text": "def new_input_set()\n return FindInputSet.new()\n end", "title": "" }, { "docid": "0aafc24aa7bfd676f6f07627c9f76bc6", "score": "0.5917539", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SetDescriptionResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "d7bec78259e5c17a67e83a6bcfd53c60", "score": "0.5910373", "text": "def new_input_set()\n return GetTerritoryInputSet.new()\n end", "title": "" }, { "docid": "40d13b4b21d0387b2dcccec5d1757e3d", "score": "0.59073514", "text": "def new_input_set()\n return CreateEntryInputSet.new()\n end", "title": "" }, { "docid": "40d13b4b21d0387b2dcccec5d1757e3d", "score": "0.59073514", "text": "def new_input_set()\n return CreateEntryInputSet.new()\n end", "title": "" }, { "docid": "40d13b4b21d0387b2dcccec5d1757e3d", "score": "0.59073514", "text": "def new_input_set()\n return CreateEntryInputSet.new()\n end", "title": "" }, { "docid": "40d13b4b21d0387b2dcccec5d1757e3d", "score": "0.59073514", "text": "def new_input_set()\n return CreateEntryInputSet.new()\n end", "title": "" }, { "docid": "40d13b4b21d0387b2dcccec5d1757e3d", "score": "0.59073514", "text": "def new_input_set()\n return CreateEntryInputSet.new()\n end", "title": "" }, { "docid": "2c8039ebb1bc668ec291f9dfe2ac8175", "score": "0.59038603", "text": "def new_input_set()\n return BulkUpdateInputSet.new()\n end", "title": "" }, { "docid": "493a54cf6c294cc7541cdb572a00c41c", "score": "0.5894226", "text": "def new_input_set()\n return GetTopExampleInputSet.new()\n end", "title": "" }, { "docid": "8b6d785c7563ba236dfa5a6fce52f4b0", "score": "0.5884498", "text": "def new_input_set()\n return FinancialAidInputSet.new()\n end", "title": "" }, { "docid": "dc0ff07c3d380eb6f938a4b7596fd9d5", "score": "0.58844876", "text": "def new_input_set()\n return ListAllSpreadsheetsInputSet.new()\n end", "title": "" }, { "docid": "e8959a6d0bd806ac8510153e0ceb1dbe", "score": "0.58826524", "text": "def new_input_set()\n return AutomobileInputSet.new()\n end", "title": "" }, { "docid": "15cc02c496d8b2be214ad2ce8fd1dc2d", "score": "0.5874958", "text": "def new_input_set()\n return PetInputSet.new()\n end", "title": "" }, { "docid": "f53555adedd597225dd939df2f61759c", "score": "0.5874178", "text": "def new_input_set()\n return ShipmentInputSet.new()\n end", "title": "" }, { "docid": "aea5a33094e4782286151ea5d2eaa907", "score": "0.58664834", "text": "def inputs\n @inputs ||= Scenario::Inputs.new(self)\n end", "title": "" }, { "docid": "e19c5fe272554ebd584b4ac231d4b5e9", "score": "0.58653915", "text": "def set_input\n @input = Input.find(params[:id])\n end", "title": "" }, { "docid": "e19c5fe272554ebd584b4ac231d4b5e9", "score": "0.58653915", "text": "def set_input\n @input = Input.find(params[:id])\n end", "title": "" }, { "docid": "e19c5fe272554ebd584b4ac231d4b5e9", "score": "0.58653915", "text": "def set_input\n @input = Input.find(params[:id])\n end", "title": "" }, { "docid": "e19c5fe272554ebd584b4ac231d4b5e9", "score": "0.58653915", "text": "def set_input\n @input = Input.find(params[:id])\n end", "title": "" }, { "docid": "cb5a1acd81d147b72d48c48fdabb3f60", "score": "0.5859559", "text": "def new_input_set()\n return CopyFileInputSet.new()\n end", "title": "" }, { "docid": "dbb7ea7fe4b9e792555e830519f00765", "score": "0.58583534", "text": "def new_input_set()\n return QueryInputSet.new()\n end", "title": "" }, { "docid": "94ff3e5dce632687de5176016910f3dc", "score": "0.58568496", "text": "def new_input_set()\n return PackageServicesRequestInputSet.new()\n end", "title": "" }, { "docid": "dbb7ea7fe4b9e792555e830519f00765", "score": "0.58567107", "text": "def new_input_set()\n return QueryInputSet.new()\n end", "title": "" }, { "docid": "ff8d26f82c8af0b1c648ff1b7f35d01e", "score": "0.5855941", "text": "def new_input_set()\n return GetAccessTokenInputSet.new()\n end", "title": "" }, { "docid": "b67bbbb5c650a377d46fd0ecb4bfe130", "score": "0.5851572", "text": "def new_input_set()\n return GetTariffsInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.5846944", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.58451885", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.58451885", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.58451885", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.58451885", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "344b95cef97f053b18f74db4010bdd5a", "score": "0.58451885", "text": "def new_input_set()\n return InitializeOAuthInputSet.new()\n end", "title": "" }, { "docid": "3f4bc9e7ba256886326d83cf4ffdc8c6", "score": "0.58441126", "text": "def new_input_set()\n return GetBalanceInputSet.new()\n end", "title": "" }, { "docid": "4e5e6fceeb3b0a529319e7f30ecc74d3", "score": "0.5842277", "text": "def new_input_set()\n return UpdateActivityInputSet.new()\n end", "title": "" }, { "docid": "4e5e6fceeb3b0a529319e7f30ecc74d3", "score": "0.5842277", "text": "def new_input_set()\n return UpdateActivityInputSet.new()\n end", "title": "" }, { "docid": "4e5e6fceeb3b0a529319e7f30ecc74d3", "score": "0.5842277", "text": "def new_input_set()\n return UpdateActivityInputSet.new()\n end", "title": "" }, { "docid": "5e779c458866fd39e080ef37777492be", "score": "0.5841737", "text": "def new_input_set()\n return GetStudentStatsInputSet.new()\n end", "title": "" }, { "docid": "5271f2af104d3a640a843cdd03b1c042", "score": "0.58400184", "text": "def new_input_set()\n return QueryInputSet.new()\n end", "title": "" }, { "docid": "c373739ba82a7a7c05d3493c4411e18e", "score": "0.58393395", "text": "def new_input_set()\n return PurchaseInputSet.new()\n end", "title": "" }, { "docid": "e08f1f3e3675c27f1c0bc546e31d17f0", "score": "0.58381844", "text": "def new_input_set()\n return GetBalanceInputSet.new()\n end", "title": "" }, { "docid": "1ca26947fad86f4be25e9339e13d014b", "score": "0.58348536", "text": "def new_input_set()\n return FindByCoordinatesInputSet.new()\n end", "title": "" }, { "docid": "1ca26947fad86f4be25e9339e13d014b", "score": "0.58348536", "text": "def new_input_set()\n return FindByCoordinatesInputSet.new()\n end", "title": "" }, { "docid": "7bdfbc5aa3fc48a35020e122c2bb6ffe", "score": "0.58322555", "text": "def new_input_set()\n return CopyFileInputSet.new()\n end", "title": "" }, { "docid": "be054cee606d5b1698715941dd50ce1d", "score": "0.5830102", "text": "def new_input_set()\n return GetWeatherByCoordinatesInputSet.new()\n end", "title": "" }, { "docid": "019e47d8d1c00f050b11ba1546cb09ca", "score": "0.5814216", "text": "def new_input_set()\n return ListSharedSpreadsheetsInputSet.new()\n end", "title": "" }, { "docid": "10003ab39e6f1dec85326313abd2635c", "score": "0.5814014", "text": "def new_input_set()\n return GetDatabaseInputSet.new()\n end", "title": "" }, { "docid": "2eea5d4dbce04ba5612fb1105e8813fd", "score": "0.58123386", "text": "def new_input_set()\n return UpdateFileInputSet.new()\n end", "title": "" }, { "docid": "ea710193a7343b5a22f46e515ceb3a1c", "score": "0.5811258", "text": "def new_input_set()\n return UpdateSettingsInputSet.new()\n end", "title": "" }, { "docid": "b3648369ebcb268cc6d106d542566fad", "score": "0.5810001", "text": "def new_input_set()\n return GetLocationInputSet.new()\n end", "title": "" }, { "docid": "7587f46bf908d0851280e5c1734ff257", "score": "0.5803499", "text": "def new_input_set()\n return GetMyRecordsInputSet.new()\n end", "title": "" }, { "docid": "f91100910ca3f592eef9a28fe1e52478", "score": "0.5802747", "text": "def input_conv_set\n @shell_input_procs << proc do |args|\n if args[0] && args[0].include?('=')\n ['set'] + args.shift.split('=') + args\n else\n args\n end\n end\n self\n end", "title": "" }, { "docid": "426086c30ac95224e03f4b0c0ada856f", "score": "0.5800833", "text": "def new_input_set()\n return ProcessDirectPaymentInputSet.new()\n end", "title": "" }, { "docid": "ede975b5e5bfac15d096695b8bb01fb3", "score": "0.57994205", "text": "def new_input_set()\n return RetrieveActivitiesInputSet.new()\n end", "title": "" }, { "docid": "ede975b5e5bfac15d096695b8bb01fb3", "score": "0.57994205", "text": "def new_input_set()\n return RetrieveActivitiesInputSet.new()\n end", "title": "" }, { "docid": "dd432e23d1305dcce2cf873eb4fc80bb", "score": "0.579249", "text": "def new_input_set()\n return MassPaymentsInputSet.new()\n end", "title": "" }, { "docid": "956588d91140e84379746b6f6ad8e577", "score": "0.5791174", "text": "def new_input_set()\n return MoveFileOrFolderInputSet.new()\n end", "title": "" }, { "docid": "74cc4b9318ee00624f8f61a95821492a", "score": "0.5790859", "text": "def new_input_set()\n return InsertInputSet.new()\n end", "title": "" }, { "docid": "291a647eb6aef705971262158db8d6f8", "score": "0.57864636", "text": "def new_input_set()\n return GetTokenInputSet.new()\n end", "title": "" }, { "docid": "c38a80aa1d374410fdc756dcecbe1576", "score": "0.57859343", "text": "def new_input_set()\n return UpdateEntryInputSet.new()\n end", "title": "" }, { "docid": "c38a80aa1d374410fdc756dcecbe1576", "score": "0.57859343", "text": "def new_input_set()\n return UpdateEntryInputSet.new()\n end", "title": "" }, { "docid": "c38a80aa1d374410fdc756dcecbe1576", "score": "0.57859343", "text": "def new_input_set()\n return UpdateEntryInputSet.new()\n end", "title": "" }, { "docid": "c38a80aa1d374410fdc756dcecbe1576", "score": "0.57859343", "text": "def new_input_set()\n return UpdateEntryInputSet.new()\n end", "title": "" } ]
149a74a9b243a9183eb17ee9ca193706
Returns an array of the dates the email of a specified category was sent
[ { "docid": "ce2ab3887f2f6c1676eb53359bc15e6c", "score": "0.8071173", "text": "def emails_sent_at(category)\r\n emails = self.email_logs.select {|e|e.category == category}\r\n emails.collect {|e| e.created_at}.sort\r\n end", "title": "" } ]
[ { "docid": "372b84e33cae2b3de6ba271c686f2c5f", "score": "0.8045334", "text": "def email_sent_at(category)\r\n emails = self.email_logs.select {|e| e.category == category}\r\n emails.collect {|e| e.created_at}.sort.last\r\n end", "title": "" }, { "docid": "b9e61a68569379fa5c4f662a9070542e", "score": "0.7213177", "text": "def emails(category = nil)\r\n return category ? self.email_logs.select {|e| e.category == category} : self.email_logs\r\n end", "title": "" }, { "docid": "a27d264f1f0c1fc728a60f0ddbabc26f", "score": "0.59212357", "text": "def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end", "title": "" }, { "docid": "875f0f79532cfdabe2110c4c7b9e323d", "score": "0.5675265", "text": "def mails_by_month(month)\n month_emails = self.email_tracks.where('extract(month from created_at) = ?', month).order(created_at: :desc)\n end", "title": "" }, { "docid": "41b12c1c165e7eb8269a9d5c55be09b3", "score": "0.56417847", "text": "def day_log(day)\n @url = url_for(:controller => 'worklogs', :action => 'index', :day => day)\n @all_users = User.status(\"1\").where(\"id > 1\") #.all - User.find(1)\n recipients = @all_users.collect(&:mail)\n \n @day = day || Date.today.to_s\n @worklogs = Worklog.where(\"status = 0\").where(\"typee = 0\").where(:day => @day)\n \n @sended_user_ids = @worklogs.collect(&:user_id).uniq\n # @no_need_users_ids = [1,61,55,46]\n @no_need_users_ids = Worklog.no_need_users_ids\n @need_user_ids = @all_users.collect(&:id) - @no_need_users_ids\n @unsended_users = User.find(@need_user_ids - @sended_user_ids)\n \n #recipients\n mail :to => recipients ,\n :cc => Setting.plugin_worklogs['WORKLOGS_MAIL_CC'],\n :subject => l(:mail_subject_worklog_day, day)\n end", "title": "" }, { "docid": "6a48ede2ca587de8f017064480a3c666", "score": "0.5412332", "text": "def chart_days\n daily_requests = self.daily_requests.limit(10)\n days = daily_requests.map(&:created_at)\n days.map { |d| d.strftime(\"%b %e\") }\n end", "title": "" }, { "docid": "5bcef77499f4f86f8fd97dc171692d55", "score": "0.53950673", "text": "def day_posted_for_purchase\n @day = params[:day]\n @buyer = @day.buyer\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n buyer_parent_ids = @buyer.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(buyer_parent_ids)\n send_mail(to: emails, subject: \"Someone wants to buy a Chickpeas Day\")\n end", "title": "" }, { "docid": "ef115f7b843329549336b08018eceb59", "score": "0.5337325", "text": "def attendance_logs_by_date\n attendance_logs.group_by { |al| al.occured_at.strftime(\"%F\") }\n end", "title": "" }, { "docid": "bf6fd96c546207ea1a644405a80122e7", "score": "0.5273472", "text": "def scheduled_emails\n @chat_history = EmailConversation.where(\"sender_id = #{current_user.id} AND sent_date is not null\")\n end", "title": "" }, { "docid": "3ade39ea2216748f184556755c3cd8bd", "score": "0.527337", "text": "def send_email\n \n if self.category == \"Success\"\n \n UserMailer.success_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Warning\"\n \n UserMailer.warning_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n elsif self.category == \"Error\"\n \n UserMailer.error_notification_email(c.user.perfil.emailadicional1,c.xml_file_name).deliver\n \n end\n \n end", "title": "" }, { "docid": "1d712a46397ad0140f3f26bedce5d2e0", "score": "0.52124107", "text": "def failed_email_delivery_contacts\n \n failed_email_delivery_contacts = Array.new \n \n mailout_contacts.each do |mc|\n failed_email_delivery_contacts.push(mc) if !mc.delivery_timestamp.blank? && mc.delivery_failed\n end\n \n return failed_email_delivery_contacts\n end", "title": "" }, { "docid": "0bb14464793feded2c7711922c03fa91", "score": "0.52004474", "text": "def todays_calories\n array = self.daily_logs.map do |log|\n if log.date == Date.today\n return log.calories \n # else \"No calories logged for today's date\"\n else \"0 Days left, please check your bet dash\"\n end\n end\n return array[0]\n end", "title": "" }, { "docid": "582505654456e7315360e65e98932427", "score": "0.51962835", "text": "def dailydigest_email(user)\n @user = user\n\n @profile_posts, @group_posts = Post.new_day_posts(@user)\n\n # @profile_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n if @profile_posts.length==1\n string = \"1 new post on your profile today\" #. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n elsif @profile_posts.length>1\n string = @profile_posts.length.to_s + \" new posts on your profile today. Answer or thank them! // www.projecthelp.co/users/\" +user.id.to_s\n @profile_posts.unshift(string)\n end\n\n subject = \"New posts for you today\"\n # @group_posts is an array with posts. Add an element to the beginning of the array with a string \n # declaring how many new posts the user has\n @group_posts.each do |group_id, posts|\n if !posts[0].title.blank?\n subject = posts[0].title\n end\n\n if posts.length == 1\n string = \"1 new post in \" +Group.find(group_id).name+ \" today\" #. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n elsif posts.length > 1\n string = posts.length.to_s+ \" new posts in \" +Group.find(group_id).name+ \" today. Answer or thank them! // www.projecthelp.co/groups/\" +group_id.to_s\n posts.unshift(string)\n end\n\n end\n\n if (@profile_posts!=nil && @profile_posts.length>0) || (@group_posts!=nil && @group_posts.length>0)\n mail :to => user.email,\n :subject => subject\n end\n end", "title": "" }, { "docid": "fe748bf27d09d5858a09eb8d2081ddd6", "score": "0.5196167", "text": "def todays_deliverables\n self.deliverables.where('DATE(created_at) = ?', Date.today)\n end", "title": "" }, { "docid": "9102e52393e0704a77edaa4a4b797b4e", "score": "0.5133509", "text": "def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end", "title": "" }, { "docid": "71046e7c7f7c050216d5fc30955f1ea6", "score": "0.50920033", "text": "def mails_per_day\n all_mpd = {}\n @senders.each do |name, value|\n # next sender it the current sender has no mails\n next if value.mails.empty?\n \n alldates = []\n value.mails.each {|i| alldates << i.date }\n alldates.sort!\n \n # get the date of the first (=oldest) mail\n since = alldates[0]\n # get the date of today\n now = Date.today()\n # how many days is the first mail old?\n duration = (now - since)\n # divide the number of mails by the duration\n mpd = (value.mails.length / duration).to_f\n # add the mail-per-day value to the dict\n all_mpd[name] = mpd\n end\n \n # sort from biggest to smallest\n all_mpd = all_mpd.sort {|a,b| b[1] <=> a[1] }\n \n puts \"Mails-per-day results of #{all_mpd.length} processed authors:\"\n \n all_mpd.each do |person, mpd|\n dpm = 1 / mpd\n puts \"#{person}: #{sprintf('%0.3f', mpd)} mails/day = #{sprintf('%0.1f', dpm)} days/mail\"\n end\n end", "title": "" }, { "docid": "b1426c687cf7b95660cd7d1b20a2ee69", "score": "0.5091613", "text": "def dates\n entries = Entry.all\n $dates_array = Array.new\n entries.each do |entry|\n $dates_array << entry.created_at.strftime(\"%Y-%m-%d\")\n end\n $dates_array.uniq\n end", "title": "" }, { "docid": "5aa336cf3107ad18590a1d850d1a8c11", "score": "0.5084544", "text": "def daily_email\n mail(to: 'john.henderson@stackedsports.com,ben@stackedsports.com', subject: 'Recruit Suite Daily Offer & Commit Tweets')\n end", "title": "" }, { "docid": "986f39a8a5dfd114c9532dc64be24948", "score": "0.5077146", "text": "def delivery_days_to\n hash[\"DeliveryDaysTo\"]\n end", "title": "" }, { "docid": "0e5997766162fc7769567f263efd1c6d", "score": "0.5075498", "text": "def sent_at\n # Use date it arrived (created_at) if mail itself doesn't have Date: header\n self.mail.date || self.created_at\n end", "title": "" }, { "docid": "4584e10a29f238e6cc8a2be465218b79", "score": "0.5065847", "text": "def send_mail_to_attendees_on_update\n if self.category.eql?(\"appointment\")\n if self.changed.include?(\"start_date\") or self.changed.include?(\"attendees_emails\") or self.changed.include?(\"repeat\") or self.changed.include?(\"count\") or self.changed.include?(\"until\")\n user = self.matter_people.assignee\n if self.attendees_emails\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_update_notificaton_to_attendees(user, self, i)\n end\n end\n\n true\n end\n end\n end", "title": "" }, { "docid": "4772e0534a13322d19016c7acfd05eb3", "score": "0.506388", "text": "def campaign_start_date\n badge.sending_interval.start\n end", "title": "" }, { "docid": "b023bdac934f8dcd8780cbcf4e32c479", "score": "0.5062836", "text": "def day_meetings\n days = []\n @course.weekdays.each_char.each_with_index do |w, i|\n days.push(DAYS_AS_SYM[i]) if w.to_i == 1\n end\n days\n end", "title": "" }, { "docid": "e0ba9a788ee927d9f41132ff8afa4f26", "score": "0.5053389", "text": "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "title": "" }, { "docid": "e0ba9a788ee927d9f41132ff8afa4f26", "score": "0.5053389", "text": "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "title": "" }, { "docid": "7e8b8afad584ee1698244386258455a1", "score": "0.5034623", "text": "def send_mail_to_attendees_on_create\n if self.category.eql?(\"appointment\") and !self.attendees_emails.blank?\n user = self.matter_people.assignee\n att_arr = self.attendees_emails.split(\",\")\n for i in att_arr\n send_notificaton_to_attendees(user, self, i)\n end\n\n true\n end\n end", "title": "" }, { "docid": "3820a675e264d628c34851b3202afd0c", "score": "0.5034025", "text": "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "title": "" }, { "docid": "765949e485ae6f2de1c6aa5cfdb01c47", "score": "0.5019856", "text": "def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end", "title": "" }, { "docid": "e51ccda0b5c0f041cd85786024f21a18", "score": "0.50103873", "text": "def dates\n if @dates.nil?\n first_post = MailingList.connection.select_value(\"select min(date) from posts\")\n if first_post\n last_post = MailingList.connection.select_value(\"select max(date) from posts\")\n @dates = first_post..last_post\n end\n end\n @dates\n end", "title": "" }, { "docid": "9d24417dddf538255be028464e855764", "score": "0.5006291", "text": "def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end", "title": "" }, { "docid": "4b854542ed266abb628b00de5989f207", "score": "0.49804214", "text": "def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end", "title": "" }, { "docid": "634dc845732122193ae149ea75de35e8", "score": "0.49797422", "text": "def aggregate_attendees_list(duration=1.day)\n\t\tstart_time = Time.now - duration\n\t\tself.attendees_events.select { |c| c.created_at >= start_time }\n\tend", "title": "" }, { "docid": "c8011fea627d79c42f5ef08b3ae03bc8", "score": "0.49783662", "text": "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end", "title": "" }, { "docid": "2a68f22ca564940f7eb7b8ceea8af36a", "score": "0.4973437", "text": "def email_date\n strftime(MO.email_time_format)\n end", "title": "" }, { "docid": "02441ec057626a2d78b4a60a8192f764", "score": "0.49597457", "text": "def activity_log_student_time_categories_array\n activity_log_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end", "title": "" }, { "docid": "f744c9ded8daca5440d6d27b44931f55", "score": "0.49513432", "text": "def get_schedule_url_postfixes( city, category )\n dates = []\n schedule_dates_url = [@host_url, city, \"schedule_#{category}\\/\"].join('/')\n doc = nil\n retry_if_exception do\n doc = Nokogiri::HTML( easy_curl(schedule_dates_url) )\n end\n return [] if not doc\n a_dates = doc.xpath(\"//div[@id='content']//div[@class='m-schedule-top-mrg'][1]//select[contains(@id, 'DateNavigator')][1]/option\")\n a_dates.each do |a_date|\n dates.push( a_date['value'] )\n end\n dates\nend", "title": "" }, { "docid": "4bf09dba65ca743b101b56f2bc00184d", "score": "0.49376842", "text": "def get_attendees()\n\t\turl = request.referrer.split(\"/\")\t# Get the URL of where the request CAME from, not the url that was requested.\n redis_key = url[-1].to_s + \":\" + url[-2].to_s + \":emails\";\n\t\tattendees = $redis.lrange(redis_key,0,-1)\n\t\tattendees.uniq!\n\t\tlogger.error \"@@@@@@@@@@@@ ATTENDEES: \" + attendees.to_s\n\t\treturn attendees\n\tend", "title": "" }, { "docid": "54ff526713bfab5b508f24310ede0674", "score": "0.49347883", "text": "def email_students\n date = params[:date][:send_email]\n reminder = params[:date][:reminder]\n #@emails = Survey.pluck(:student_email)\n @surveys = Survey.where.not(student_email: nil)\n\n if date == \"0\"\n delay = 0\n\n elsif date == \"1\"\n delay = Date.tomorrow.noon\n\n elsif date == \"2\"\n delay = 2.days.from_now.noon\n\n else\n delay = 1.week.from_now.noon\n end\n\n @surveys.each do |survey|\n #survey = Survey.find_by(student_email: email)\n section = Section.find_by(class_num: survey.class_num)\n if reminder == \"0\"\n StudentMailer.eval_email(survey, section).deliver_later(wait_until: delay)\n else\n StudentMailer.eval_reminder(survey, section).deliver_later(wait_until: delay)\n end\n\n end\n end", "title": "" }, { "docid": "13b1b1145d805ead31b181ce734b126a", "score": "0.49346825", "text": "def emails_send_to\n (emails + [cc.presence]).compact.uniq.to_sentence\n end", "title": "" }, { "docid": "e14988264efadf1f56e034ec969157ac", "score": "0.4932954", "text": "def argument_daily_digest\n subscriptions = Subscription.find(:all , :conditions => ['status = 1 && daily_digest = 1 && argument_id is not null'])\n subscriptions.each do |sub|\n Mailers::Debate.deliver_send_subscription_email(\"\",sub.argument,sub,HOST_DOMAIN)\n end\n end", "title": "" }, { "docid": "0532abf146a2900b2740f92297bf2653", "score": "0.49177596", "text": "def days_assigned\r\n days_assigned = []\r\n self.groups.each {|g| days_assigned.push(g.day)}\r\n return days_assigned\r\n end", "title": "" }, { "docid": "6605f9973b296e36b41a07a3f6b2d95f", "score": "0.49083373", "text": "def group_by_day\n\n\tend", "title": "" }, { "docid": "f2113dfac8cb041938c96634fb626b9c", "score": "0.49048662", "text": "def get_all_redemptions(start_date, end_date)\n redemption_counts = Redemption.where(created_at: start_date..end_date).count\n formatted_rc = Array.new\n formatted_rc.push end_date.to_f * 1000\n formatted_rc.push redemption_counts\n formatted_rc\n end", "title": "" }, { "docid": "eb27637519df3878d243da9e0764dd4c", "score": "0.48975965", "text": "def send_family_summaries\n @title = 'Send summaries'\n date_selection_filter = [\"summary_sent IS ? OR (? - summary_sent) > ?\", nil,\n Date.today, Settings.family.info_summary_interval]\n recipients = Family.those_active.where(date_selection_filter)\n @messages = []\n recipients.each do |family|\n if family.email\n @messages << Notifier.send_family_summary(family) \n family.update_attribute(:summary_sent, Date.today)\n#puts \"**Summary_sent set to #{family.reload.summary_sent}\"\n end\n end\n @messages.each {|m| m.deliver}\n flash[:notice] = \"Sent #{@messages.count} family summary messages\"\n redirect_to families_path\n end", "title": "" }, { "docid": "33714e20027b13291740bc01bc64c8a2", "score": "0.48955995", "text": "def daily_deals\n\n # all categories from the database\n @categories = Category.all\n\n # daily deals grouped by product category\n if ((current_user.user_type == User::USER_DONOR) && (current_user.npo_id))\n @daily_deals_by_category = Deal.where(:is_daily_deal => 1, :npo_id => current_user.npo_id).group_by{ |d| d.product.category }\n end\n end", "title": "" }, { "docid": "671cf7eff4e90d2abdbcb0d88cbae718", "score": "0.48844597", "text": "def by_mail_tracker\n end", "title": "" }, { "docid": "7e1409f0e82adb39654b44a57ea14aba", "score": "0.4876911", "text": "def index\n @dates = AudioMessage.active\n .where(\"event_date is not null\")\n .group(\"date_format(audio_messages.event_date,'%Y')\")\n .order(\"audio_messages.event_date DESC\")\n .count\n # Peek at most recent load date\n @latest_addition_date = AudioMessage.maximum('created_at')\n end", "title": "" }, { "docid": "e85605a20fc0a6a3a40a7c8e686d48eb", "score": "0.48719862", "text": "def category(period, category) \n category = [category].flatten\n \n list = []\n category.uniq.each do |c|\n list << keys.select { |k| k.category == c and k.period == period }\n end\n \n return list.flatten!\n end", "title": "" }, { "docid": "28f66f2b5a09c1202ca79f1d0594e288", "score": "0.4865353", "text": "def date_group_items\n @date_group_items ||= []\n end", "title": "" }, { "docid": "d0730236ac8462d56d029ddcb76ebe0d", "score": "0.48593718", "text": "def filter_mail(email, threaded=false)\n\n unless check_email_addresses(email) #first check if email address matches category\n check_subject_and_body(email) #Second check each word in subject and body against keywords in categories\n end\n\n if !threaded\n email.save\n email.category.cases << email.case\n end\n\n return email\n end", "title": "" }, { "docid": "1a92f65c19d2d3f8c983d61dd16a13a5", "score": "0.4842248", "text": "def category categories\n categories = categories.to_a if !categories.is_a? Array\n categories.collect { |i| calendars.find_by_title i.to_s }.compact\n end", "title": "" }, { "docid": "1b6ef617e5ea4d1c1b68d6012910e80f", "score": "0.48399508", "text": "def events_on(day)\n ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq\n end", "title": "" }, { "docid": "50b636a6b5fb724e84afb77d4622d6aa", "score": "0.48366258", "text": "def date\n success ? { 'datesent' => sent } : {}\n end", "title": "" }, { "docid": "c6a168bd6861b89c711b355896414449", "score": "0.48344398", "text": "def category_info\n {\n categories: self.object.appointments.map{ |appt| \n appt.category\n }\n \n }\n end", "title": "" }, { "docid": "e4b4363601b674943a0e0125092bf6c9", "score": "0.48328844", "text": "def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end", "title": "" }, { "docid": "f4fcb5ab8daa8f9e23b064dae85e395a", "score": "0.4831467", "text": "def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end", "title": "" }, { "docid": "f4fcb5ab8daa8f9e23b064dae85e395a", "score": "0.4831467", "text": "def notification_daily_send_time\n @attributes[:notification_daily_send_time]\n end", "title": "" }, { "docid": "f9501a7fb0ff7fd08da54163b750221e", "score": "0.48296705", "text": "def yearly\n NewsletterMailer.yearly\n end", "title": "" }, { "docid": "43d053be007c513657f73538e79cf067", "score": "0.48294482", "text": "def email_date; strftime(EMAIL_TIME_FORMAT); end", "title": "" }, { "docid": "f26bec485d8c740b321ba1c50d333c84", "score": "0.48280904", "text": "def production_date(*options)\n return (@check_level_details[:is_correspondent] ? @batch.date.strftime(\"%Y%m%d\") : @check.check_date.strftime(\"%Y%m%d\"))\n end", "title": "" }, { "docid": "98e50758627cccc5398ba8188cd7fff1", "score": "0.48209947", "text": "def show\n @event_data_by_category_and_minute = Event.where(whatspp_message_id: @whatspp_message_ids).group(:category).group_by_minute(:created_at).count\n @event_data_by_category = Event.where(whatspp_message_id: @whatspp_message_ids).group(:category).count\n end", "title": "" }, { "docid": "ee7c3371d5eb180c175dca4042a38558", "score": "0.48130333", "text": "def get_dates(arr) \ndayDifference = Date.today - 7.days\narr.select do |d| \nif d.created_at.to_date > dayDifference \n d \n end\nend \nend", "title": "" }, { "docid": "481dee867967edde75db77aee8ddd84e", "score": "0.4810315", "text": "def started_at\n [contact_date_date, contact_start_time]\n end", "title": "" }, { "docid": "ab8d413c5a481327905c6872e6104529", "score": "0.48036748", "text": "def event_disposition_category_for_contact\n if multiple_unique_events_for_contact?\n # GENERAL_STUDY_VISIT_EVENT\n NcsCode.for_list_name_and_local_code('EVENT_DSPSTN_CAT_CL1', 3)\n else\n event_type_code = contact_links.last.try(:event).try(:event_type_code)\n DispositionMapper.determine_category_from_event_type(event_type_code)\n end\n end", "title": "" }, { "docid": "0efd4b7dcf7d968a4b750a7f2656a336", "score": "0.4801892", "text": "def message_subjects\n list = []\n active_div.divs(:class=>\"inbox_subject\").each do |div|\n list << div.text\n end\n return list\n end", "title": "" }, { "docid": "37132901ce4a8c641fbe0f5e9ed87a0e", "score": "0.47853562", "text": "def group_by_day\n created_at.to_date\n end", "title": "" }, { "docid": "5b8b0f70c566baae67d33552cdcd61f8", "score": "0.4785283", "text": "def event_categories\n data.event_categories\n end", "title": "" }, { "docid": "1aaa553843b010f43ddc2ba2a831a97e", "score": "0.4784707", "text": "def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end", "title": "" }, { "docid": "03059668724831a656f740ea376e85f5", "score": "0.47846976", "text": "def data_for(date)\n UseLog::Data.find_all_by_date(date).collect do |log|\n [log.category, log.count]\n end\n end", "title": "" }, { "docid": "20331c5937ae3d1a3ba7a0aaccbad8d8", "score": "0.47812012", "text": "def can_send_mail\n month_emails = self.mails_by_month(Time.now.month)\n if(month_emails.count < self.setting_email_count_month )\n return true if month_emails.count == 0\n last_email_sent = month_emails.first.created_at\n (mail_duration(last_email_sent) >= self.setting_email_duration) ? true : false\n else\n false\n end\n end", "title": "" }, { "docid": "32efb6082dc9837ca2908619db90413b", "score": "0.47786483", "text": "def search_time_series(params)\n begin\n \n query = \"email:gmail.com\"\n date_from = params[:from_date]#\"2013-01-01\"\n date_to = params[:to_date]#\"2013-01-02\"\n tags = params[:tags]#[\"password-reset\", \"welcome\"]\n senders = params[:senders]#[\"sender@example.com\"]\n result = @mandrill.messages.search_time_series query, date_from, date_to, tags, senders\n # [{\"unique_opens\"=>42,\n # \"unsubs\"=>42,\n # \"clicks\"=>42,\n # \"time\"=>\"2013-01-01 15:00:00\",\n # \"complaints\"=>42,\n # \"rejects\"=>42,\n # \"soft_bounces\"=>42,\n # \"hard_bounces\"=>42,\n # \"sent\"=>42,\n # \"unique_clicks\"=>42,\n # \"opens\"=>42}]\n\n rescue Mandrill::Error => e\n # Mandrill errors are thrown as exceptions\n puts \"A mandrill error occurred: #{e.class} - #{e.message}\"\n # A mandrill error occurred: Mandrill::ServiceUnavailableError - Service Temporarily Unavailable\n raise\n end\n end", "title": "" }, { "docid": "4d2c82aa33a2bac6f3b62471ef864f05", "score": "0.47771516", "text": "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "title": "" }, { "docid": "eb7b74ab89938798bc4970b2bada893b", "score": "0.47740576", "text": "def final_due_date\n del = self.deliverables\n return nil unless del.size > 0\n\n dates = del.collect(&:due).delete_if { |d| d.blank?}\n \n return dates.sort[-1] \n end", "title": "" }, { "docid": "0b38ddcb0d413a928749c1487deeb244", "score": "0.47714043", "text": "def get_emails(emails,incidente)\n return ['informatica@botica.com.py'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"no-responder@botica.com.py\"]\n end\n mails1.concat(mails2).uniq\n end", "title": "" }, { "docid": "4f08590e757cedcfebff4a04e1a9420a", "score": "0.47692725", "text": "def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end", "title": "" }, { "docid": "13c0e476f8427cbda5c972eeaefcf290", "score": "0.47621775", "text": "def day_put_on_sale\n @day = params[:day]\n @seller = @day.seller\n @url = \"https://chickpeas.herokuapp.com/days\"\n\n seller_parent_ids = @seller.parents.map(&:id)\n # email to all parents other than those posting\n emails = Parent.all_current_with_active_email_except(seller_parent_ids)\n send_mail(to: emails, subject: \"A New Chickpeas Day is Up For Sale\")\n end", "title": "" }, { "docid": "0af4d88afefc7e5f41caf8eb05f43eda", "score": "0.47617215", "text": "def time_category\n # ActionController::Base.helpers.time_ago_in_words Groupify.groupify([self], Proc.new {|ep| ep.aired_at || ep.phile.file_created_at })[0][0]\n ActionController::Base.helpers.time_ago_in_words self.aired_at\n end", "title": "" }, { "docid": "a52db6f71d05b0fef68dc592359e4ede", "score": "0.47572008", "text": "def dates\n @dates ||= text.select do |line|\n line =~ @date_pattern \n end.map do |line|\n line[@date_pattern]\n end.uniq.first\n end", "title": "" }, { "docid": "40274b76935fe8a92202d0a7dd05b651", "score": "0.4755016", "text": "def message_date\n active_div.div(:id=>\"inbox_show_message\").div(:class=>\"inbox_date\").span.text\n end", "title": "" }, { "docid": "6fb1b833378ec02023ff4d6a1edd4d17", "score": "0.47525436", "text": "def send_on_date(n_weeks)\n today = category.user.today\n send_on_date = today + n_weeks * 7 + (send_on - today.wday % 7)\n send_on_date += 7 if today.wday > send_on\n send_on_date\n end", "title": "" }, { "docid": "7bd33e810a8088e51d33a667cc15b88a", "score": "0.4752061", "text": "def get_start_and_end_dates(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"When\" && \"Tickets\")\n description = description.split(\"When\")[1].split(\"Tickets\")[0]\n datetimes = description.gsub(\";\", \",\").split(\",\")\n @additional_datetimes = datetimes[1..-1].join(\",\") if datetimes.size > 1\n get_event_datetimes(datetimes[0])\n else\n [nil, nil]\n end\n else\n [nil, nil]\n end\n end", "title": "" }, { "docid": "b97eee34dce4cd6fd3a2d417c9a419a7", "score": "0.4751955", "text": "def requests_per_day\n group_by_day.map { |date, ents|\n [date, ents.size]\n }.sort { |a,b|\n a[0] <=> b[0]\n }\n end", "title": "" }, { "docid": "5a33af67fb3920a2cea47a80a46adc07", "score": "0.47512677", "text": "def get_sent_mailings_for_org(options={})\n raise ArgumentError, \":date_start is required\" unless options.has_key?(:date_start)\n raise ArgumentError, \":date_end is required\" unless options.has_key?(:date_end)\n\n options[:date_start] =\n options[:date_start].utc.strftime(\"%m/%d/%Y %H:%M:%S\") unless options[:date_start].is_a?(String)\n options[:date_end] =\n options[:date_end].utc.strftime(\"%m/%d/%Y %H:%M:%S\") unless options[:date_end].is_a?(String)\n\n request_body = String.new\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetSentMailingsForOrg do\n apply_xml_options!(xml, options)\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)[\"Mailing\"] || []\n end", "title": "" }, { "docid": "496ae0da059be094fe9c3a649a9cdb28", "score": "0.47476372", "text": "def emails\n public_instance_methods(false).map(&:to_s).sort\n end", "title": "" }, { "docid": "496ae0da059be094fe9c3a649a9cdb28", "score": "0.47476372", "text": "def emails\n public_instance_methods(false).map(&:to_s).sort\n end", "title": "" }, { "docid": "6a30e3d83505b8d2878d2610af333200", "score": "0.47453", "text": "def filter_messages(json, start_date, end_date)\n return json if start_date.nil? && end_date.nil?\n to_ret = Array.new\n json.each do | message |\n message_date = Date.strptime(message[\"created_at\"].to_s, '%s')\n if message_date >= start_date && message_date <= end_date\n to_ret << message\n end\n end\n return to_ret\nend", "title": "" }, { "docid": "68ed7ee2aa5025c6607d09bddde56ee3", "score": "0.47437316", "text": "def available_emails\n sent_emails = StudioEmail.sent_to(self).collect(&:email_name).collect(&:to_sym)\n Notifier.studio_emails - sent_emails\n end", "title": "" }, { "docid": "9c23fb43a3dace7c75f67e8f8d6696a3", "score": "0.47379583", "text": "def collect_messages(email, password, label, criteria, save_attachments)\n messages = []\n\n gmail = Gmail.connect(email, password)\n\n begin\n criteria.each do |c|\n messages += fetch_messages(gmail, label, c, save_attachments)\n end\n rescue Exception => e\n puts e.inspect\n ensure\n gmail.logout\n end\n messages\n end", "title": "" }, { "docid": "4154deb501f82900e294182678850934", "score": "0.47347012", "text": "def published_content_stats(start_time, end_time)\n start_time = start_time.to_i\n end_time = end_time.to_i\n arr = []\n @content_deliveries = ContentDelivery.where(\"user_id=? and created_at >=? and created_at < ? and message_id is NOT ? \", self.id, start_time, end_time, nil)\n @content_deliveries.each do |c|\n begin\n book_metadata = c.ibook.get_metadata\n uri = c.uri.split(\"/\") if c.uri.present?\n location = uri\n location.pop\n location.shift\n\n arr << [self.edutorid + \" (#{self.name})\", self.class.name , self.academic_class.present? ? self.academic_class.name : \"NA\", self.section.present? ? self.section.name : \"NA\",\n c.group_id.present? ? User.find(c.group_id).name : c.recipients,\n book_metadata[\"displayName\"],book_metadata[\"subject\"],book_metadata[\"academicClass\"],\n uri.last,c.user_asset.nil? ? \"NA\" : c.user_asset.asset_name,\n c.published_as,\"NA\",Time.at(c.created_at).to_formatted_s(:long),\n c.group_id.present? ? User.find(c.group_id).students.size : (c.recipients.nil? ? \"NA\" : c.recipients.split(\",\").size),\n c.group_id.present? ? c.message.message_sync_count(c.group_id) : (c.recipients.nil? ? \"NA\" :c.message.message_sync_individual_count(c.recipients)),\n c.message.assets.empty? ? \"NA\" : c.message.assets.last.attachment.url , c.published_to_inbox_or_toc,\n location[0].present? ? location[0] : \"NA\",\n location[1].present? ? location[1] : \"NA\", location[2].present? ? location[2] : \"NA\"]\n rescue\n next\n end\n end\n arr\n end", "title": "" }, { "docid": "0f2dfc032fed66910db4a8df3a48d8e9", "score": "0.4728632", "text": "def delivery_days_from\n hash[\"DeliveryDaysFrom\"]\n end", "title": "" }, { "docid": "8f1661a93ab553bc57eadfea29d81fef", "score": "0.47219434", "text": "def all_grouping_collection_dates\n submission_rule_hours = submission_rule.periods.pluck('periods.hours').sum.hours\n no_penalty = Set.new(groupings.joins(:extension).where('extensions.apply_penalty': false).pluck(:id))\n collection_dates = Hash.new { |h, k| h[k] = due_date + submission_rule_hours }\n all_grouping_due_dates.each do |grouping_id, grouping_due_date|\n if no_penalty.include? grouping_id\n collection_dates[grouping_id] = grouping_due_date\n else\n collection_dates[grouping_id] = grouping_due_date + submission_rule_hours\n end\n end\n collection_dates\n end", "title": "" }, { "docid": "8f8d57db9c53974aabcb03e4c48c14db", "score": "0.4717707", "text": "def notify_groups_for_alert(alert)\n @alert = alert\n groups = Group.where(id: alert.groups_alerted)\n\n users = groups.inject([]) do |users, group|\n users += group.users\n end.uniq\n\n user_emails = users.map(&:email)\n\n mail bcc: user_emails, subject: \"Alerta de inventário de item\"\n end", "title": "" }, { "docid": "3673f8feb742ff3f9a23097a06cb3d64", "score": "0.47140738", "text": "def this_period_dates(period_type)\n send(\"this_#{period_type}_dates\")\n end", "title": "" }, { "docid": "9b71791197b6568d1b140a795f48645a", "score": "0.471357", "text": "def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end", "title": "" }, { "docid": "cdc2f8bc7d8732b2e744ef00e82d57b3", "score": "0.47133738", "text": "def getDatesToDisplay()\n\n\t\tnumDays = 10\n\t\tretDays = []\n\n\t\tfor i in 0..10\n\t\t\ta_date = (DateTime.now + i.days)\n\t\t\tretDays.push(a_date)\n\t\tend\n\n\t\treturn retDays\n\tend", "title": "" }, { "docid": "2ca853c1a67a94b68edfd9f5b1f9a0f9", "score": "0.47082308", "text": "def category_names_of_subject subject, &block\n categories_of_subject(subject).keys\n end", "title": "" }, { "docid": "ff33b27a32ded97fd1bbc69702a3a723", "score": "0.47004595", "text": "def category\n business_event_category\n end", "title": "" }, { "docid": "d325075c83fd084ac2f6e7f868df8243", "score": "0.46889004", "text": "def date_of_service(service)\n notification = Notification.find_by_name()\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n \n if emails.present?\n mail :to => emails,\n :subject => \"Service is today. For #{vehicle.fleet_number}\"\n end\n end", "title": "" }, { "docid": "2980a73b8c1b0420af4dd7bbdfb0106a", "score": "0.4679136", "text": "def latest_mail(options = {})\n return only_latest(mail(options))\n end", "title": "" }, { "docid": "522a371bbbdcd56f137cc4d7e6453bc1", "score": "0.46759266", "text": "def fetch_month_sheets()\n date = Date.today\n days_in_month = date.end_of_month.day\n for day in ('1'..days_in_month.to_s).to_a\n range = day + \"!\" + ENV[\"CELL_RANGE\"]\n info_list = get_sheet_response(range)\n detect_change_send_email(info_list)\n end \nend", "title": "" } ]
47cdbf612c4c7ed02a92f6e5984dc39a
accessor to cgi query parameters (http GET)
[ { "docid": "564cfedb11d236e470e404ed71c6f2f4", "score": "0.75857085", "text": "def query_parameters\n $cuca.value[:request].GET\n# $app.cgi.query_parameters\n end", "title": "" } ]
[ { "docid": "096647b9ee7d0955fb6312facb22e66d", "score": "0.72907287", "text": "def GET\n if @env[\"rack.request.query_string\"] == query_string\n @env[\"rack.request.query_hash\"]\n else\n @env[\"rack.request.query_string\"] = query_string\n @env[\"rack.request.query_hash\"] = parse_query(query_string)\n end\n end", "title": "" }, { "docid": "1f9351ac63df54e66e0e953e3b81d5f1", "score": "0.7264016", "text": "def params\n request.GET\n end", "title": "" }, { "docid": "bb3e929cfc3ae2162e4e951eeadac708", "score": "0.7088285", "text": "def request_query(req)\n (req.\n request_uri.\n query || ''\n ).\n split(/[;&]/).\n map{|x| x.split('=', 2) }.\n inject({ }) { | h, kv | h[kv[0].to_sym] = kv[1]; h }\n end", "title": "" }, { "docid": "98675e5ce565d941ff7b672ba050cafe", "score": "0.70800513", "text": "def params\n self.GET\n end", "title": "" }, { "docid": "f23f0671d25f6a69f355b9a38b0320bf", "score": "0.6950998", "text": "def params\n @params ||= Rack::Utils.parse_query(request.query_string)\n end", "title": "" }, { "docid": "8c0124d458b19d4448c4057c87c5c1b1", "score": "0.69311625", "text": "def GET\n Rack::Utils.parse_query @hash['query']\n end", "title": "" }, { "docid": "bc8e1e239aa61c094f4017dc8ec3dde4", "score": "0.6880355", "text": "def query_string\n end", "title": "" }, { "docid": "31626bc3ddbd3c0ecd19c7f42b839ed6", "score": "0.6866965", "text": "def query_param(name)\n values = CGI.parse(self.query)[name] if self.query\n (values.nil? || name.include?(\"[]\")) ? values : values.last\n end", "title": "" }, { "docid": "7e031943423e603e07dde67e6029c37c", "score": "0.6741231", "text": "def query_string\n @env[Merb::Const::QUERY_STRING]\n end", "title": "" }, { "docid": "f94f54611a1d810bad46f0bf562327ed", "score": "0.6723129", "text": "def parse_query_params(url = current_fullpath)\n _path, query = url.split(\"?\")\n params = CGI.parse(query)\n params[\"q\"]\n end", "title": "" }, { "docid": "b22abe7cf0b50d753854677dbcbbccec", "score": "0.67130715", "text": "def query_string\n @env['QUERY_STRING']\n end", "title": "" }, { "docid": "821c32ece28e6bac3d394b0d7056bc4b", "score": "0.66940343", "text": "def params; request.params; end", "title": "" }, { "docid": "821c32ece28e6bac3d394b0d7056bc4b", "score": "0.66940343", "text": "def params; request.params; end", "title": "" }, { "docid": "1f8bec4e0d5836e42af8bbc7b0a70633", "score": "0.6692963", "text": "def query_params\n request.query_parameters\n end", "title": "" }, { "docid": "a9c7a26321aece97177c8759acb05ab5", "score": "0.6687309", "text": "def params() request.params end", "title": "" }, { "docid": "82558a5b9782070b3ebfd0fae98ebf19", "score": "0.6684025", "text": "def query ; @request.params ; end", "title": "" }, { "docid": "82558a5b9782070b3ebfd0fae98ebf19", "score": "0.6684025", "text": "def query ; @request.params ; end", "title": "" }, { "docid": "6de7a6312ec21facc1b0624653596a86", "score": "0.66322416", "text": "def query_parameters\n end", "title": "" }, { "docid": "e0c30a385f7b1d4f88c7c7db532b2748", "score": "0.6610574", "text": "def query_string_params\n [:cht, :chs, :chl, :chld, :choe]\n end", "title": "" }, { "docid": "572e4220b37e5ef8e82c97a693cc0186", "score": "0.66026646", "text": "def params(uri)\n if uri.query\n CGI.parse(uri.query).each_with_object({}){|(k,v),h| h[k.to_sym] = v} # symbolise keys\n else\n {}\n end\n end", "title": "" }, { "docid": "d424b2699e406800240872b7a98b5fa9", "score": "0.6601378", "text": "def original_params\n @original_params ||= CGI::parse(@request.query_string)\n end", "title": "" }, { "docid": "3c39d545f1af86e519f83831715e473c", "score": "0.66011447", "text": "def query_parameters; end", "title": "" }, { "docid": "24e6c2d2a925b7eb081f41b00f635bfc", "score": "0.6590624", "text": "def parse_query_params(url = path)\n _path, query = url.split(\"?\")\n params = CGI.parse(query)\n params[\"q\"]\n end", "title": "" }, { "docid": "f4fe4701c4ee9927b368879ccde657d7", "score": "0.6588669", "text": "def query_string; end", "title": "" }, { "docid": "f4fe4701c4ee9927b368879ccde657d7", "score": "0.6588669", "text": "def query_string; end", "title": "" }, { "docid": "f4fe4701c4ee9927b368879ccde657d7", "score": "0.6588669", "text": "def query_string; end", "title": "" }, { "docid": "83e82698adb775c4c8838a273acedc53", "score": "0.65793204", "text": "def request_query\n if @method == :get\n @given_options.fetch(:params, {})\n else\n {}\n end\n end", "title": "" }, { "docid": "83e82698adb775c4c8838a273acedc53", "score": "0.65793204", "text": "def request_query\n if @method == :get\n @given_options.fetch(:params, {})\n else\n {}\n end\n end", "title": "" }, { "docid": "83e82698adb775c4c8838a273acedc53", "score": "0.65793204", "text": "def request_query\n if @method == :get\n @given_options.fetch(:params, {})\n else\n {}\n end\n end", "title": "" }, { "docid": "4754c86a07b0a1eba8051b5c17d222e2", "score": "0.6579107", "text": "def params\n $cuca.value[:request].params\n# $app.cgi.parameters\n end", "title": "" }, { "docid": "a8b88649e553859717e38bbf1a62f974", "score": "0.64845526", "text": "def extract_params_from_url\n # extract_params\n # return if ENV['QUERY_STRING'].nil?\n # qstring = CGI::parse(CGI::unescape(ENV['QUERY_STRING']))\n # dbg qstring.inspect\n # # Rack::Utils.parse_nested_query( CGI::unescape(ENV['QUERY_STRING']) ).\n # qstring.each do |cle, valeur|\n # valeur = valeur[0] if valeur.count == 1\n # @params = @params.merge cle.to_sym => valeur\n # end\n end", "title": "" }, { "docid": "5c6cfab376aded96d13463d38b5bbf02", "score": "0.64779556", "text": "def GET\n @env[\"action_controller.request.query_parameters\"] ||= begin\n normalized_params = normalize_parameters(super)\n normalized_params ? deep_munge(normalized_params) : nil\n end\n end", "title": "" }, { "docid": "16045153acbe8ca9c0c9eb010a0258fb", "score": "0.6477625", "text": "def query_string=(_arg0); end", "title": "" }, { "docid": "16045153acbe8ca9c0c9eb010a0258fb", "score": "0.6477625", "text": "def query_string=(_arg0); end", "title": "" }, { "docid": "3ce637aedcd9a59daa9b803f21abac9f", "score": "0.64688915", "text": "def parameters\n request.query_parameters\n end", "title": "" }, { "docid": "7eee842e0556678badd608bda3aa4595", "score": "0.64403754", "text": "def get params\n @uri.query = URI.encode_www_form(@default_params.merge(params))\n Net::HTTP.get(@uri)\n end", "title": "" }, { "docid": "6e0022c72dd2bd44e1ff53959e3c9b02", "score": "0.64323217", "text": "def parse_query_params(url=path)\n path, query = url.split('?')\n params = CGI.parse(query)\n params['q']\n end", "title": "" }, { "docid": "c941e0a7cab6fb16b4ca2fad2c91d1da", "score": "0.64171505", "text": "def query_string_params\n super + [:chbh]\n end", "title": "" }, { "docid": "a25458d233b874ae33aa7ef0cc9a70ab", "score": "0.6411862", "text": "def params_get\n\t\t@page_params\n\tend", "title": "" }, { "docid": "8aa2eb848ffd6d97cece113709c64206", "score": "0.6404593", "text": "def query_params\n parse_form_encoded(URI.parse(@attributes['uri'].to_s).query || '')\n end", "title": "" }, { "docid": "fb797bfc2436e4703602c0727153197d", "score": "0.63844013", "text": "def params\n @params ||= Rack::Utils.parse_nested_query(request.uri.query)\n end", "title": "" }, { "docid": "db97d16870f7b21b7150e21d2c720c81", "score": "0.6382996", "text": "def GET\n @env[\"action_dispatch.request.query_parameters\"] ||=\n ActionDispatch::Request::Utils.deep_munge(normalize_encode_params(super || {}))\n rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e\n raise ActionController::BadRequest.new(:query, e)\n end", "title": "" }, { "docid": "11a0d1c7116e3eca7e60dcd6bec99919", "score": "0.635789", "text": "def parse_uri_query_params(query); end", "title": "" }, { "docid": "11a0d1c7116e3eca7e60dcd6bec99919", "score": "0.635789", "text": "def parse_uri_query_params(query); end", "title": "" }, { "docid": "167094a1b6ea3ff9f94b685f959429ce", "score": "0.63435817", "text": "def get_query\n kvs = []\n @params.each do |k,v|\n kvs.push(k.to_s+\"=\"+v.to_s)\n end\n return \"?#{kvs.join('&')}\"\n end", "title": "" }, { "docid": "daacc8c94a098a03df5ba4dc2602ff2d", "score": "0.6333368", "text": "def _arg( name )\n\t(\n\t\tname = name.to_sym\n\t\treturn request.request_parameters[name] || request.query_parameters[name]\n\t) end", "title": "" }, { "docid": "55f479c2a55eac7468ce4b870c600e30", "score": "0.63256186", "text": "def getQueryString(env)\n req = Rack::Request::new env\n paramMap = Rack::Utils.parse_nested_query req.query_string\n HarUtils.hashToList paramMap\n end", "title": "" }, { "docid": "4e2a3866a0e0a972d247d59ecdc4e9cb", "score": "0.6319371", "text": "def fetch_uri_params(request)\n URI.parse(request.url).query.split('&').map { |pair| pair.split('=') }.to_h\n end", "title": "" }, { "docid": "47268640ce4e6fb25952a892b65a6a37", "score": "0.6315253", "text": "def query\n unless @query\n @query = {}\n (uri.query || '').split(/&/).each do |kv|\n key, value = kv.split(/=/)\n if key && value\n key, value = CGI.unescape(key), CGI.unescape(value)\n @query[key] = value\n end\n end\n end\n @query\n end", "title": "" }, { "docid": "812caf167823926401a3303fa6b3fe48", "score": "0.6312052", "text": "def query_string\n @params.map { |param, value| \"#{CGI.escape(param.to_s)}=#{CGI.escape(value.to_s)}\" }.join(\"&\")\n end", "title": "" }, { "docid": "6f81a771791fd0ba75f8b02502988eb0", "score": "0.6310727", "text": "def query_parameters\n end", "title": "" }, { "docid": "9ab384f8bdcdcb9b8b4f49a77affc3c0", "score": "0.6304825", "text": "def get_query_param(query = nil)\n return nil if browser.bot?\n\n if query\n query.save unless query.id\n query.id.alphabetize\n elsif @query_params\n @query_params[:q]\n end\n end", "title": "" }, { "docid": "940de28f2392a4e93d9c3c11d3e6ab70", "score": "0.6297833", "text": "def get_params\n full_raw_url.scan(/(:\\w+)/).map {|k| k[0].gsub(\":\", \"\").to_sym }\n end", "title": "" }, { "docid": "a07a7cacc0c998a681f4fcd3ee1b0d7e", "score": "0.62921584", "text": "def query_param\n QueryParamController.instance\n end", "title": "" }, { "docid": "130ab5c4aab60ee34a3e5b7ac65ff710", "score": "0.62918466", "text": "def query_params\n request.query_parameters\n end", "title": "" }, { "docid": "130ab5c4aab60ee34a3e5b7ac65ff710", "score": "0.62918466", "text": "def query_params\n request.query_parameters\n end", "title": "" }, { "docid": "88379949049227ae78a7474dc5f79e61", "score": "0.6279464", "text": "def params_for_get\n \"params[:id]\"\n end", "title": "" }, { "docid": "88379949049227ae78a7474dc5f79e61", "score": "0.6279464", "text": "def params_for_get\n \"params[:id]\"\n end", "title": "" }, { "docid": "88379949049227ae78a7474dc5f79e61", "score": "0.6279464", "text": "def params_for_get\n \"params[:id]\"\n end", "title": "" }, { "docid": "14d97df21f6f906f03b864a0b624d9d9", "score": "0.6265565", "text": "def parse_url_params \n return if !Caboose.use_url_params \n url = \"#{request.fullpath}\"\n url[0] = \"\" if url.starts_with?('/') \n url = url.split('?')[0] if url.include?('?') \n arr = url.split('/') \n i = arr.count - 1\n while i >= 1 do\n k = arr[i-1]\n v = arr[i] \n if v && v.length > 0\n v = v.gsub('%20', ' ')\n params[k] = v\n end\n i = i-2\n end \n end", "title": "" }, { "docid": "14d97df21f6f906f03b864a0b624d9d9", "score": "0.6265565", "text": "def parse_url_params \n return if !Caboose.use_url_params \n url = \"#{request.fullpath}\"\n url[0] = \"\" if url.starts_with?('/') \n url = url.split('?')[0] if url.include?('?') \n arr = url.split('/') \n i = arr.count - 1\n while i >= 1 do\n k = arr[i-1]\n v = arr[i] \n if v && v.length > 0\n v = v.gsub('%20', ' ')\n params[k] = v\n end\n i = i-2\n end \n end", "title": "" }, { "docid": "954115c548f1c98309280aef4670f403", "score": "0.6264672", "text": "def query_string\n @env['QUERY_STRING'].present? ? @env['QUERY_STRING'] : (@env['REQUEST_URI'].split('?', 2)[1] || '')\n end", "title": "" }, { "docid": "19622a83df6bf64e9506a1e574f7c46e", "score": "0.6247583", "text": "def qstring\n self.uri_parts['QueryString']\n end", "title": "" }, { "docid": "a30c07d1090853a6edb1ff032eceef62", "score": "0.6243756", "text": "def getParams(line)\n uri = line.split(\" \")[1]\n parts = uri.split(\"?\")\n if parts.size > 1\n parts[1].split(\"&\").each do |var|\n vals = var.split(\"=\")\n @get[vals[0]] = vals[1]\n end\n # @get.each do |key, val|\n # puts \"key: #{key} ~~ val: #{val}\"\n # end\n end\n end", "title": "" }, { "docid": "6cf84d02ff3b4eac7a301d1c2d30741b", "score": "0.62372965", "text": "def url_query\n (@query.present?)?'?query='+@query:''\n end", "title": "" }, { "docid": "ee89ba2c557895b86bca0a0ff254e155", "score": "0.6208813", "text": "def it_keys_to_get_param\n self.it_keys_to_sym\n self.get_url_params = '?'\n\n self.keys.each do |key|\n self.get_url_params = self.get_url_params+'&' unless self.get_url_params.length == 1\n\n # Nested obj_attrs\n if self[key].is_a?(Hash)\n hash_name = key\n hash_obj = self[key]\n\n # Hash to GET URL\n param = to_nested_get_param hash_name, hash_obj\n else\n param=\"#{key}=#{self[key]}\"\n end\n\n self.get_url_params = self.get_url_params+param\n end\n\n # Remove the last char: &\n self.get_url_params = self.get_url_params[0..self.get_url_params.length-2] if self.get_url_params.index('\\\\')\n self.get_url_params\n end", "title": "" }, { "docid": "f1e53c400d4730b20a77f02fb888a165", "score": "0.61947584", "text": "def query_params\n Addressable::URI.parse(href).query_values || {}\n end", "title": "" }, { "docid": "4e80c2b84d48894298ec40c44ec84aac", "score": "0.6192381", "text": "def url_parameters\n kv = []\n get_parameters.each_pair do |k, v|\n kv += [\"#{k}=#{v}\"]\n end\n '?' + kv.join('&') unless kv.empty?\n end", "title": "" }, { "docid": "36faa606fed948f707a3f28439e20d6d", "score": "0.61868125", "text": "def query_params\n request.query_parameters.deep_symbolize_keys\n end", "title": "" }, { "docid": "18afb42e150844bd18f1e85299b3d366", "score": "0.61813617", "text": "def magic_params_not_truly_understood\n \"timekey=1&custom_search=0\"\n end", "title": "" }, { "docid": "31c62d642d37795a9fe26bbdaead7ba0", "score": "0.61775464", "text": "def query_string\n\t\t\tURI.encode_www_form(@params)\n\t\tend", "title": "" }, { "docid": "ba80ff2ea4cd67d5f58607affee123e7", "score": "0.6177522", "text": "def parameters\n FormUrlencodedParams.parse(query) if query\n end", "title": "" }, { "docid": "b53012d2e8aabb06c47d1d23767875f0", "score": "0.61728", "text": "def query_string\n if uri = @env['REQUEST_URI']\n uri.split('?', 2)[1] || ''\n else\n @env['QUERY_STRING'] || ''\n end\n end", "title": "" }, { "docid": "e416590838722b142e7dcbc5e41de6b8", "score": "0.6166264", "text": "def GET\n fetch_header(\"action_dispatch.request.query_parameters\") do |k|\n rack_query_params = super || {}\n controller = path_parameters[:controller]\n action = path_parameters[:action]\n rack_query_params = Request::Utils.set_binary_encoding(self, rack_query_params, controller, action)\n # Check for non UTF-8 parameter values, which would cause errors later\n Request::Utils.check_param_encoding(rack_query_params)\n set_header k, Request::Utils.normalize_encode_params(rack_query_params)\n end\n rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError, Rack::QueryParser::ParamsTooDeepError => e\n raise ActionController::BadRequest.new(\"Invalid query parameters: #{e.message}\")\n end", "title": "" }, { "docid": "6a1421fc770cd5ed5f93164e52e6c283", "score": "0.6158894", "text": "def query_string(options); end", "title": "" }, { "docid": "c67a77a3aa5baaa17619237a554d6de0", "score": "0.6154113", "text": "def query_string( q )\n qs = '?'\n q.each { | k, v | qs << CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s) + '&' }\n return qs.chop\n end", "title": "" }, { "docid": "51aa504f225cb12107136e68acce45a0", "score": "0.6124689", "text": "def url_params\n return unless original_request.query_string.present?\n\n @url_params ||= Rack::Utils.parse_nested_query(original_request.query_string)\n end", "title": "" }, { "docid": "18258908649263e22022f27f0275cfb8", "score": "0.61235297", "text": "def request_params=(_arg0); end", "title": "" }, { "docid": "6c6eeff86bb00662aae62b6fc02b0386", "score": "0.61211497", "text": "def params \n @params ||= Waves::Request::Query.new( captured ? \n request.query.merge( captured.to_h ) : request.query ) \n end", "title": "" }, { "docid": "94b4219d05fa0e769e815fa83ff74319", "score": "0.61178255", "text": "def params\n self.GET.update(self.POST)\n rescue EOFError, Errno::ESPIPE\n self.GET\n end", "title": "" }, { "docid": "23096596c7ae7f410b3e3602b4a7a25e", "score": "0.61075604", "text": "def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end", "title": "" }, { "docid": "a37500adccdb246bb6684ffaef6f6bf2", "score": "0.6104331", "text": "def query_params\r\n QueryParamsController.instance\r\n end", "title": "" }, { "docid": "47f9ab1e975318c1622e0d6d5979c2f1", "score": "0.6102294", "text": "def extract_params!(request); end", "title": "" }, { "docid": "1903d4973b662505f28364b9e61a9143", "score": "0.6097545", "text": "def query_params\n @query_params ||= raw_query_params\n end", "title": "" }, { "docid": "35c2d960e1ea6b564a84f52e6f4a9ac9", "score": "0.6097137", "text": "def get_params(env)\n req = ActionDispatch::Request.new(env)\n req.GET.merge(req.POST)\n end", "title": "" }, { "docid": "7c02d548ef3dd5c93a3e31f215e995cb", "score": "0.60926574", "text": "def query\n unless @query\n @query = {}\n uri.query.split(/&/).each do |kv|\n k, v = URI.unescape(kv).split(/=/)\n @query[k] = v if k && v\n end\n end\n @query\n end", "title": "" }, { "docid": "e93aa224f81d21cba4b91bec2be5d073", "score": "0.60826635", "text": "def query_params\n @query_params ||= Merb::Parse.query(query_string || '')\n end", "title": "" }, { "docid": "be0cc1b583163e1de2b5a9d5e5da69a5", "score": "0.6071059", "text": "def params\n @params ||= self.GET.merge(self.POST)\n rescue EOFError\n self.GET\n end", "title": "" }, { "docid": "530e7f6ff3264144c3961afdaa205d01", "score": "0.60509366", "text": "def params_for_get\n params = properties.select{|p| p.key?}.map{|p| \"params[:#{p.field}]\"}.join(', ')\n @params_for_get ||= (params == \"\" ? \"params[:id]\" : params)\n end", "title": "" }, { "docid": "332d3f15672b4106d707a12ed7a6a3f6", "score": "0.6050303", "text": "def raw_params\n URI.unescape( self.query.to_q ).split('&')\n end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.60398996", "text": "def request_params; end", "title": "" }, { "docid": "11aab8e9695616c3412a5a75cdcaf0f8", "score": "0.60398996", "text": "def request_params; end", "title": "" }, { "docid": "4692f174bc3f4cdedef073b72da9fba5", "score": "0.6031882", "text": "def query\n URI.split(url)[7]\n end", "title": "" }, { "docid": "3e8719720f73bf145cc74c095b7fc95d", "score": "0.6031716", "text": "def query_params\n {}\n end", "title": "" }, { "docid": "3e8719720f73bf145cc74c095b7fc95d", "score": "0.6031716", "text": "def query_params\n {}\n end", "title": "" }, { "docid": "3e8719720f73bf145cc74c095b7fc95d", "score": "0.6031716", "text": "def query_params\n {}\n end", "title": "" }, { "docid": "f2ddcfaa0b979f5e789869f0e2249987", "score": "0.6015474", "text": "def query_params\n @query_params ||= parse_query_param(request.query_parameters)\n @query_params\n end", "title": "" }, { "docid": "5de7a686eff8a204c5ad5d79225e1df3", "score": "0.60076255", "text": "def kept_params\n request.query_parameters\n end", "title": "" }, { "docid": "fa4681fa71a204d7890e4d8cf917544d", "score": "0.59802336", "text": "def extract_path_query(req)\n path = req.path.split('/')[1..-1]\n query = {}\n if !req.query_string.nil? && !req.query_string.empty? && req.query.empty?\n # WEBRick does not parse queries on PUT and some others so do it\n # manually.\n req.query_string.split('&').each { |opt|\n k, v = opt.split('=')\n # TBD convert %xx to char\n query[k] = v\n }\n else\n req.query.each { |k,v| query[k.to_sym] = v }\n end\n # Detect numbers (others later)\n query.each_pair { |k,v|\n i = Utils.attempt_key_to_int(v)\n query[k] = i unless i.nil?\n # TBD how about float\n }\n request_body = req.body\n if request_body.nil?\n body = nil\n else\n body = Data.new(\n Oj.strict_load(request_body, symbol_keys: true)\n )\n body.detect\n end\n [path, query, body]\n\tend", "title": "" }, { "docid": "c492ae18bb40c3d0990d094e4040bd63", "score": "0.59684044", "text": "def query_parameter(param = nil)\n if param\n @query_param = param\n else\n @query_param || :_auth_token\n end\n end", "title": "" } ]
9d2390335976570d59fc59f7ed66dbef
List branches Requires authenticated client for private repos.
[ { "docid": "b86aef236e553fedfc2657dddcb7abdb", "score": "0.69851553", "text": "def branches(repo, options = {})\n paginate \"#{Repository.path repo}/branches\", options\n end", "title": "" } ]
[ { "docid": "18ad2bbe60dc0c21e4d9458c5ed0a47a", "score": "0.78196317", "text": "def branches\n client.branches(repo)\n end", "title": "" }, { "docid": "b4c9faa14cac937d47823346beba1ecb", "score": "0.71130794", "text": "def branches\n @branches ||= get(\"/repos/show/#{owner.login}/#{name}/branches\")['branches'].map do |name, head|\n Branch.new(connection, \n :name => name,\n :head => head,\n :repo => self\n )\n end\n end", "title": "" }, { "docid": "d91d5687260ff2e15536d90e95941e30", "score": "0.70186186", "text": "def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end", "title": "" }, { "docid": "45f6f971253237d95f2a46bccc595674", "score": "0.68470997", "text": "def branches(repo)\n api.branches(repo).index_by(&:name)\n end", "title": "" }, { "docid": "91e4a3d8023219c21cc37829a309c5bf", "score": "0.6764096", "text": "def branches(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless (user? && repo?)\n normalize! params\n\n response = get_request(\"/1.0/repositories/#{user}/#{repo.downcase}/branches/\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end", "title": "" }, { "docid": "cf33dba3d294a2edb5aa794303efadc9", "score": "0.66213995", "text": "def branch_list\n raw_branches = `cd #{project_repo_path} && git branch -r`\n branches = raw_branches.split(/\\n/)\n return branches\n end", "title": "" }, { "docid": "97f2635dca3e11cfbc5231265931d9fd", "score": "0.6602694", "text": "def ls_branches\n working_branches = get_branches\n if working_branches.empty?\n $stdout.puts \"No branches\"\n exit\n end\n working_branches.map.with_index { |branch, idx| \"#{idx}. #{branch}\" }\nend", "title": "" }, { "docid": "80155901ac2fea6e40b923b3819486d3", "score": "0.6568508", "text": "def list\n Dir.chdir @root do\n cmd = \"git branch\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.split.map { |s|\n # Remove trailing/leading whitespace and astericks\n s.sub('*', '').strip\n }.reject { |s|\n # Drop elements created due to trailing newline\n s.size == 0\n }\n end\n end", "title": "" }, { "docid": "a2279c1389ba907915b4ba95db06f772", "score": "0.64211375", "text": "def list\n @connection.get('/user/repos').map do |repo_data|\n Rails.logger.info \"listing repos\"\n GitHubApi::Repo.new(self, repo_data)\n end\n end", "title": "" }, { "docid": "394b01b3e7da87fccfc0f442a2ee194d", "score": "0.6250018", "text": "def git_branches(git)\n array = Array.new\n body = raw_file(http_uri + git)\n body.scan(/\" title=\".*>(.*)<\\/a><\\/li>/) do |branch|\n array << branch\n end\n array.flatten\n end", "title": "" }, { "docid": "ed42821ca5d1d18512757c257abc7f8a", "score": "0.62288177", "text": "def all_branches\n git(\"branch --all\")\n end", "title": "" }, { "docid": "40a6cfcab6845c717cdaf039d7251cc9", "score": "0.61322194", "text": "def branches\n @branches = config.fetch('branches', ['master'])\n end", "title": "" }, { "docid": "40a6cfcab6845c717cdaf039d7251cc9", "score": "0.61322194", "text": "def branches\n @branches = config.fetch('branches', ['master'])\n end", "title": "" }, { "docid": "676bf1526b62cc855ad006185d722bf6", "score": "0.61169946", "text": "def branches\n Git::Branches.new(self)\n end", "title": "" }, { "docid": "c93fb82cbebcb98c5d78d9e71cfb5ea6", "score": "0.60696924", "text": "def list(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n normalize! params\n\n response = if params['ref']\n ref = params.delete('ref')\n _validate_reference ref\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n else\n get_request(\"/repos/#{user}/#{repo}/git/refs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "title": "" }, { "docid": "da3aa17e877c3bc2fe3e44df1d7f2df7", "score": "0.6016487", "text": "def list\n Rugged::Branch.each_name(@git, :local).to_a\n end", "title": "" }, { "docid": "0e530579ceeb2f18b5e996a32e77fc13", "score": "0.6000423", "text": "def all_branches\n @branches ||= git_call('branch -a').split(\"\\n\").collect { |s| s.strip }\n end", "title": "" }, { "docid": "10f2ac8d9907942f913d00a553965939", "score": "0.59988075", "text": "def index\n authorize! :index, Branch\n\n if current_user.is?(:superadmin)\n @branches = Branch.page(params[:page]).per(20).order('id DESC')\n else\n @branches = @current_store.branches.page(params[:page]).per(20).order('id DESC')\n end\n\n end", "title": "" }, { "docid": "3b36a1383563ad5b06a8ee7b7d624ddd", "score": "0.59618473", "text": "def list(options = {})\n get_path(\n path_to_list,\n options,\n Tinybucket::Parser::CommitsParser\n )\n end", "title": "" }, { "docid": "922a5d88fd4cd94d3d08181782f138b5", "score": "0.5952422", "text": "def list\n if today?\n commits = commits_today(repo, branch)\n elsif yesterday?\n commits = commits_yesterday(repo, branch)\n elsif this_week?\n commits = commits_this_week(repo, branch)\n elsif last_week?\n commits = commits_last_week(repo, branch)\n elsif this_month?\n commits = commits_this_month(repo, branch)\n elsif after && before\n commits = commits_between(repo, branch, after, before)\n elsif after\n commits = commits_after(repo, branch, after)\n elsif before\n commits = commits_before(repo, branch, before)\n else\n commits = all_commits(repo, branch)\n end\n\n write_json(commits.map(&:to_h))\n end", "title": "" }, { "docid": "4b14c018b3109ac4ce663fe7b031adaf", "score": "0.59504765", "text": "def branch(repo, branch, options = {})\n get \"#{Repository.path repo}/branches/#{branch}\", options\n end", "title": "" }, { "docid": "639d5f047438a000ea0a78f20936bad3", "score": "0.59456086", "text": "def get(*args)\n arguments(args, required: [:user, :repo, :branch])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/branches/#{arguments.branch}/protection\", arguments.params)\n end", "title": "" }, { "docid": "7983843d305700c0a89b3749dd3eeff1", "score": "0.5929487", "text": "def list(path=nil)\n sha = path_to_sha(path)\n # ensure correct operation even if path doesn't exist in repo\n t = sha ? tree(sha) : tree(@current_branch, (path ? [path] : []))\n t ? tree_contents( t ) : {}\n end", "title": "" }, { "docid": "1fcd4ccf0da45479c1abb32db8c97689", "score": "0.589435", "text": "def get_branches\n xml = call(:branches).parsed_response\n xml.css('branches branch').map { |b| Branch.new(b, self) }\n end", "title": "" }, { "docid": "50d51540d0c48aabf6a4497d0ee51668", "score": "0.58937395", "text": "def index\n @branches = Branch.order(:id) if current_user.is_admin?\n @branches = current_user.company.branches.order(:id) if current_user.is_admin_company?\n if @branches.nil?\n redirect_back_or_default home_url\n end\n end", "title": "" }, { "docid": "125c1d2feaae0cdece7f41ccf24327bb", "score": "0.5852097", "text": "def index\n @git_hub_repos = GitHubRepo.all\n end", "title": "" }, { "docid": "c5206ab4eb167f7c8b5445704fbc3d2c", "score": "0.58388406", "text": "def index\n @branches = Branch.all\n end", "title": "" }, { "docid": "c5206ab4eb167f7c8b5445704fbc3d2c", "score": "0.58388406", "text": "def index\n @branches = Branch.all\n end", "title": "" }, { "docid": "c5206ab4eb167f7c8b5445704fbc3d2c", "score": "0.58388406", "text": "def index\n @branches = Branch.all\n end", "title": "" }, { "docid": "961deea7d22365dfa0438d8e86940f9e", "score": "0.58367515", "text": "def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n end\n end", "title": "" }, { "docid": "8492794b457474cc4d58f77e85db785a", "score": "0.5836681", "text": "def branches\n @branch_heads.keys\n end", "title": "" }, { "docid": "0050b717677ebd4fff044f12aa051f36", "score": "0.5814866", "text": "def list(state = 'open')\n Core.list(:user => @user, :repo => @repo, :state => state)\n end", "title": "" }, { "docid": "b4c3cee3e9a2e1449131c0c1b9dd0e55", "score": "0.58097184", "text": "def branches\n @branches ||= build_branches\n end", "title": "" }, { "docid": "6091fd1a5c3832f92778649ee081ecbc", "score": "0.579402", "text": "def list_repo(repo_id)\n response = HTTParty.get(\n GIT_BASE_URL + 'projects/' + repo_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (list repo): #{response}\"\n return response['content']\n end", "title": "" }, { "docid": "c6d5b58b95146dc2cc70e4c29e256267", "score": "0.57218325", "text": "def list\n @repos\n end", "title": "" }, { "docid": "4a608d9e08a34ae5cc2490b6add3dfba", "score": "0.57124156", "text": "def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @branches }\n end\n end", "title": "" }, { "docid": "039897490875c9276d5dad23bd0b213d", "score": "0.5689043", "text": "def retrieve_branch_details(branches)\n\t\tdetails = []\n\t\tIO.popen(\"-\", \"r+\") do |io|\n\t\t\tif io.nil?\n\t\t\t\targs = [ \"show\", \"--pretty=format:%H\\t%d\\t%ct\\t%cr\\t%an\\t%s\", *branches ]\n\t\t\t\targs << \"--\"\n\t\t\t\texec \"git\", *args\n\t\t\telse\n\t\t\t\twhile l = io.gets\n\t\t\t\t\tnext unless l =~ /^[a-z0-9]{40}/\n\t\t\t\t\thash, refs, time, rtime, author, subject = * l.chomp.split(/\\t/)\n\t\t\t\t\trefs.gsub!(/^\\s*\\(|\\)\\s*$/, '')\n\n\t\t\t\t\trefs.split(/\\s*,\\s*/).each do |ref|\n\t\t\t\t\t\tis_remote = ref[%r{refs/remotes}]\n\t\t\t\t\t\tref.gsub!(%r{refs/(remotes|heads)/}, '')\n\t\t\t\t\t\tdetails.push Ref.new(hash, ref, time.to_i, rtime, author, subject)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tdetails\n\tend", "title": "" }, { "docid": "56e829694382cb875ea55eb72d0849c3", "score": "0.56725764", "text": "def list(options = {})\n get_path(\n path_to_list,\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "title": "" }, { "docid": "19f802883c5bbb1ed3b955632a234277", "score": "0.5667999", "text": "def show\n @branches = @entity.branches\n end", "title": "" }, { "docid": "04b8b39c08b9198a7df30283970a90e9", "score": "0.56515086", "text": "def refs\n select_branches(git.grit.refs)\n end", "title": "" }, { "docid": "37e7bfa73ee5cb51affccdac52fa0622", "score": "0.5650531", "text": "def branch(project_id, branch_id)\n params = { query: [project_id, branch_id] }\n\n data = endpoint(name: 'Branches', params: params).do_get\n\n resource 'Branch', data\n end", "title": "" }, { "docid": "29e57e1e9720380098e3908cb0540af9", "score": "0.562512", "text": "def build_branch_list\n local_branches = `git branch`.split(' ')\n active_branch_index = local_branches.index('*')\n\n local_branches.reject { |i| i == '*' }.map.with_index do |b, i|\n BranchModel.new(b, i == active_branch_index)\n end\n end", "title": "" }, { "docid": "a735e98a54747470dd24ca612d508a0a", "score": "0.56157196", "text": "def index\n @git_hub_accounts = GitHubAccount.all\n end", "title": "" }, { "docid": "63248bdd849e2c55a64f5acc4a7ab718", "score": "0.56029916", "text": "def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token => user.password)\n repo_list = []\n client.repositories(:user => user.gh_username).each { |repo|\n repo_list.push(repo.name)\n }\n render :json => {:repos => repo_list}\n end", "title": "" }, { "docid": "24313d339317c6b899f8ba7fd8c1f283", "score": "0.55922884", "text": "def remote_branches\n @rugged_repository.branches.each_name(:remote).sort\n end", "title": "" }, { "docid": "f0cbc0b8c0ad3cc01786e4207a4496b2", "score": "0.5582345", "text": "def local_branches(repo_path)\n result = []\n `(cd \"#{repo_path}\" && git branch | cut -c3-)`.split(\"\\n\").each do |branch|\n result << branch unless `(cd #{repo_path} && git log -1 --pretty=full #{branch})` =~ /git-svn-id:/\n end\n result\n end", "title": "" }, { "docid": "a7a814ba1ea961e9de7da225cf4831c8", "score": "0.55770993", "text": "def all_branches\n %x( git branch ).gsub!('*', '').gsub!(' ', '').split(\"\\n\")\nend", "title": "" }, { "docid": "873c225125d6f1d8d4d07a5fbc4130e9", "score": "0.5570791", "text": "def repos\n client.repos({}, query: { sort: \"asc\" })\n end", "title": "" }, { "docid": "36492e5825b9c52100e786e48bcb0619", "score": "0.5554483", "text": "def create_branches(repo)\n @branch_names.collect {|branch_name| \n Branch.new(branch_name ,Grit::Commit.find_all(repo, branch_name).sort_by { |k| k.authored_date}.reverse)}\n end", "title": "" }, { "docid": "3e6c737367a0e3374d496684b74f8ab6", "score": "0.55534667", "text": "def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend", "title": "" }, { "docid": "21fa43c2c74f6b680a95489811c56fd6", "score": "0.5551129", "text": "def list_repositories\n JSON.parse(request(:get, ''))\n end", "title": "" }, { "docid": "34b2a67df95c15daf9f5a9d45d682a89", "score": "0.55439717", "text": "def branches\n zombie_check\n pattern = self.class.branch_pattern(:name => @name)\n @repo.branches.select{ |b| b.name =~ pattern }\n end", "title": "" }, { "docid": "cd5b74af3086aaa6b02d3e3b56ae3390", "score": "0.55410254", "text": "def commits\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n @commits = @repository.commits(@branch)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "title": "" }, { "docid": "31f9f353d52e66d84fe9e6db4d83dd3b", "score": "0.55372655", "text": "def index\n @branches = Branch.all\n end", "title": "" }, { "docid": "83e266f9529d81180791dc0e785d0acf", "score": "0.55053115", "text": "def get_list\n @list_of_repos\n end", "title": "" }, { "docid": "a649f9e6c46fb0cffffb6e590258b39c", "score": "0.55033183", "text": "def test_branches_all\n branches = @lib.branches_all\n assert(branches.size > 0)\n assert(branches.select { |b| b[1] }.size > 0) # has a current branch\n assert(branches.select { |b| /\\//.match(b[0]) }.size > 0) # has a remote branch\n assert(branches.select { |b| !/\\//.match(b[0]) }.size > 0) # has a local branch\n assert(branches.select { |b| /master/.match(b[0]) }.size > 0) # has a master branch\n end", "title": "" }, { "docid": "10f406a08a0c90e386634d5b11e4c4d2", "score": "0.5499925", "text": "def branches\n object.branches.map { |b| b.id }\n end", "title": "" }, { "docid": "88c5d60ceb82231048fce91c34f46f82", "score": "0.54788876", "text": "def get_repos\n @api.list_repositories\n end", "title": "" }, { "docid": "f32566cbf82189ae95a43e4fececed09", "score": "0.5469779", "text": "def branch_names_list(branch_names)\n markaby do\n ul.page_control do\n for name in branch_names\n li do\n a name, :href => \"##{name.underscore}\"\n end\n end\n end\n end\n end", "title": "" }, { "docid": "e81a77decdd2a93433d313e708658eb5", "score": "0.5425733", "text": "def remote_branches\n @remote_branches ||= @project.branches.remote.map(&:full)\n end", "title": "" }, { "docid": "200966bf3be981eaa48d34b57bbb384f", "score": "0.54072034", "text": "def local_branches\n @local_branches ||= begin\n branches = []\n if not git.branches.local.empty?\n branches << git.branches.local.select{ |b| b.current }[0].name\n branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }\n end\n branches.flatten\n end\n end", "title": "" }, { "docid": "4dd83cdd66e29a35d70d7c764db821b3", "score": "0.5395178", "text": "def get_all_commits_in_repo\n @branches.collect(&:commits).flatten.sort_by { |k| k.authored_date }.reverse\n end", "title": "" }, { "docid": "ba8ade6ea91e25f99ddf2ce34bc582fb", "score": "0.5393952", "text": "def get_repository_project_branches(repoName)\n self.log(INFO, repoName, \"Searching for project branches...\")\n branches = []\n b=`git branch -r`\n b.each_line do |remoteBranch|\n remoteBranch.gsub!(/\\n/, \"\")\n if remoteBranch =~ /origin\\/project/\n localBranch = \"#{remoteBranch}\"\n localBranch.slice! \"origin/\"\n branches << localBranch.strip! || localBranch\n end\n end\n self.log(INFO, repoName, \"Project branches found : #{branches}\")\n self.log(INFO, repoName, \"Done.\")\n return branches\n end", "title": "" }, { "docid": "5a97fe07900482019149b9892d5fa970", "score": "0.5391553", "text": "def branches(type = :master, dir = Dir.pwd, _options = {})\n FalkorLib::Git.config(\"gitflow.branch.#{type}\", dir)\n #confs[type.to_sym]\n end", "title": "" }, { "docid": "4b76bb3a000f7f0d03d63e70e7e9a4f4", "score": "0.53807753", "text": "def listchannels(**args)\n stub.list_channels(\n Lnrpc::ListChannelsRequest.new(\n active_only: args[:active_only], inactive_only: args[:inactive_only],\n public_only: args[:public_only], private_only: args[:private_only]\n )\n )\n end", "title": "" }, { "docid": "006f7fb82b71ca8bf822ab8f7241f5a3", "score": "0.53676605", "text": "def show_repo_list\n # Synchronize user's id_github with Git Hub (4 days between refreshs)\n @owner.sync_github!(4.days).save!\n \n # Synchronize list of user's projects (4 hours between refreshs)\n if @owner.sync_projects_delay?(4.hours)\n github_projects = @owner.get_github_projects\n \n if github_projects\n @owner.upd_projectlist_at = Time.now\n repos = CacheRepo.where(path: github_projects)\n \n # Drop any projects than no more exist in the user space\n if repos.length > 0\n CacheRepo.where.not(id: repos.map(&:id)).where(owner: @owner).delete_all\n end\n \n # Add any new project to this user\n (github_projects - repos.map(&:path)).each do |github_project_new|\n new_project = CacheRepo.new(path: github_project_new, owner: @owner)\n # Alway be aware of we have multiple workers and possibility concurrent insert\n if !new_project.save\n new_project = CacheRepo.where(path: github_project_new).first\n new_project.owner = @owner\n new_project.save!\n end\n end\n end\n @owner.save!\n end\n \n # Repository information will be refreshed only if the user request it\n # So, this action is more light than #show_repo_details\n @projects = CacheRepo.where(owner: @owner)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_list, status: :ok, location: @owner }\n end\n end", "title": "" }, { "docid": "ce41f4996bf2480041ffa678aa5b058c", "score": "0.5366217", "text": "def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "title": "" }, { "docid": "068b74a1ecdda33d7b06897f6bd941a4", "score": "0.5359973", "text": "def get_branch_names(repo)\n repo.heads.collect(&:name)\n end", "title": "" }, { "docid": "64dde0ae996862d11f9eaef3d8b8935b", "score": "0.53524685", "text": "def index\n @branch_trees = BranchTree.all\n end", "title": "" }, { "docid": "638b037a430c87606652c50d3290df32", "score": "0.5310469", "text": "def list_repo(user, repo)\n get_request(\"/repos/#{user}/#{repo}/issues\", arguments.params)\n end", "title": "" }, { "docid": "d584235cca2d1d21863608c07d6af333", "score": "0.5292291", "text": "def index\n @providers_branches = Providers::Branch.paginate(page: params[:page], per_page: 5).order('id Desc').all\n render :layout =>false\n end", "title": "" }, { "docid": "482e90e798287562b07a6e4d3b2d9348", "score": "0.52869135", "text": "def get_repos project_id\n $logger.info \"Getting repos\"\n\n # from the bitbucket api\n rest_endpoint = \"/rest/api/1.0/projects/#{PROJECT_ID}/repos\"\n\n http = Net::HTTP.new(BASE_GIT_URL, BASE_GIT_PORT)\n repos_request = Net::HTTP::Get.new(\"/rest/api/1.0/projects/#{PROJECT_ID}/repos?limit=1000\")\n repos_request.basic_auth GIT_USER, GIT_PASSWORD\n repos_response = http.request(repos_request)\n repos_response.value\n\n # https://confluence.atlassian.com/bitbucket/what-is-a-slug-224395839.html\n repos_body = JSON.parse(repos_response.body)\n repos = repos_body['values'].map { |v| v['slug'] }\n\n $logger.info \"Found repos #{repos}\"\n\n return repos\nend", "title": "" }, { "docid": "90422e69a35cd076e7dc0d3bbe524955", "score": "0.5284283", "text": "def list(path=nil, sha=nil)\n remote_path = list_path(path).sub(/^\\//, '').sub(/\\/$/, '')\n\n result = @client.tree(repo, sha || source_branch, recursive: true).tree\n result.sort! do |x, y|\n x.path.split('/').size <=> y.path.split('/').size\n end\n\n # Filters for folders containing the specified path\n result.reject! { |elem| !elem.path.match(remote_path + '($|\\/.+)') }\n raise Error, 'Invalid GitHub path specified' if result.empty?\n\n # Filters out lower levels\n result.reject! do |elem|\n filename = elem.path.split('/').last\n File.join(remote_path, filename).sub(/^\\//, '') != elem.path\n end\n\n result.map do |elem|\n {\n name: elem.path.split('/').last,\n path: elem.path,\n type: elem.type == 'tree' ? 'folder' : 'file',\n sha: elem.sha\n }\n end\n end", "title": "" }, { "docid": "e64cd83c6ac5b548c73564187241e978", "score": "0.5279945", "text": "def ostree_branches(id)\n criteria = {:type_ids => [Runcible::Extensions::OstreeBranch.content_type]}\n unit_search(id, criteria).map { |i| i['metadata'].with_indifferent_access }\n end", "title": "" }, { "docid": "1ade793ae0c09032db4dbfd7aa096124", "score": "0.5274517", "text": "def branch_details(branches, remote_url)\n markaby do\n branches.map do |branch|\n h2.toggler.open \"Branch #{branch.name}\", :id => branch.name.gsub(/ /, '')\n div.toggle.branch do\n image_gallery(branch) if Babygitter.output_graphs\n div.branch_details do\n author_links(branch)\n branch_synopsis(branch)\n hr :class => \"end_of_info\"\n h3.toggler.open \"#{branch.name} commit history\"\n div.toggle do\n ul do\n branch_committer_detail(branch, branch.commits, remote_url)\n end\n end\n hr :class => \"end_of_info\"\n author_details(branch.name, branch.authors, remote_url, branch.total_commits)\n end\n end\n hr :class => \"end_of_branch_info\"\n end\n end\n end", "title": "" }, { "docid": "f9b244e487c40b5a51135d8706e07647", "score": "0.5265156", "text": "def index\n @company_branches = CompanyBranch.all\n end", "title": "" }, { "docid": "b5630faa9c8e81f497638ddd80a0f032", "score": "0.52467656", "text": "def branch(name, options = {})\n get_path(\n path_to_branch(name),\n options,\n get_parser(:collection, Tinybucket::Model::Commit)\n )\n end", "title": "" }, { "docid": "1cd5ec61e1245aca99abc7cb388656e1", "score": "0.52408326", "text": "def branches(hash={})\n Branch.all(:id => LoanHistory.parents_where_loans_of(Branch, {:loan => {:funding_line_id => funding_lines.map{|x| x.id}}, :branch => hash}))\n end", "title": "" }, { "docid": "426a0f78e8717a89bd9c38e83820f2ce", "score": "0.5237001", "text": "def index\n @repos = @user.repos.includes(:user)\n render json: to_json(@repos)\n end", "title": "" }, { "docid": "a717db8e9704149c4d95ec2f72103091", "score": "0.5233246", "text": "def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end", "title": "" }, { "docid": "7c2396572e16b3e61e8bbac2759f2726", "score": "0.52309465", "text": "def read\n bs = fetch_branches\n puts \"branches => #{bs}\"\n bs.each do |b|\n cs = fetch_commits(b)\n cs.each {|c| yield c }\n end\n end", "title": "" }, { "docid": "e8987e74044a2cabe6a3a86a6d037cba", "score": "0.52275705", "text": "def list(*args)\n params = args.extract_options!\n normalize! params\n\n response = if (user_name = params.delete(\"user\"))\n get_request(\"/users/#{user_name}/orgs\", params)\n else\n # For the authenticated user\n get_request(\"/user/orgs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "title": "" }, { "docid": "6c3e9e2652d92d3a8ad46bc94a87bdfb", "score": "0.5203654", "text": "def get(*args)\n arguments(args, required: [:user, :repo, :sha])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/commits/#{arguments.sha}\", arguments.params)\n end", "title": "" }, { "docid": "074c8b46c024d7eedeb6424c6e4fdca2", "score": "0.51996803", "text": "def get_target_branches\n unless @target_branches\n fetch_all\n base = @config['branches']['production']\n allowed_branches = @config['branches'].values\n allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']\n banned_branches = ['HEAD']\n target_branches = `git branch -r origin/#{base} | grep -ie '\\\\(#{allowed_branches.join(\"\\\\|\")}\\\\)' | grep -iv '\\\\(#{banned_branches.join(\"\\\\|\")}\\\\)' | sed -e 's/origin\\\\///g'`\n @target_branches = target_branches.split(\"\\n\").map{|a| a.gsub(/\\s+/, \"\")}\n end\n @target_branches\n end", "title": "" }, { "docid": "67684d64a64b071e32020319847dbab6", "score": "0.51923794", "text": "def index\n if is_branch_manager?\n @user_accounts = UserAccount.all\n success_response(message: 'All Accounts', data: { user_accounts: @user_accounts })\n else\n error_response(message: response.status_message, data: response.data)\n end\n end", "title": "" }, { "docid": "c541a10dbf736da95f9d8c41ffd36bb4", "score": "0.51907563", "text": "def fetch_syncables\n gh_client.repos.list.select{|repo| repo.permissions.admin}.map(&:full_name)\n end", "title": "" }, { "docid": "847556b5ec1a7d9b8ddf21abce2c1b55", "score": "0.51434827", "text": "def index\r\n if current_account.is_worker?\r\n @branches = current_account.branches.paginate(:page => params[:page], :per_page => 25)\r\n else\r\n @branches = @current_shop.all_branches.paginate(:page => params[:page], :per_page => 25)\r\n end\r\n end", "title": "" }, { "docid": "13ade028cba8bec49e5a6fa777672fbe", "score": "0.5139033", "text": "def list_repos\n repos = []\n end_cursor = nil\n\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n\n while next_page do\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n end\n\n repos.reject { |r| r.dig(\"isArchived\") || r.dig(\"isDisabled\") }\n end", "title": "" }, { "docid": "46bd17985b0d3cdfbc862a4cd2a4c077", "score": "0.5129595", "text": "def repos\n @client.repos.all.collect(&:clone_url)\n end", "title": "" }, { "docid": "f16f68ff617fcaa9eb6f81682588b9af", "score": "0.51266515", "text": "def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end", "title": "" }, { "docid": "b921c17f870a7178864a9431a4012f26", "score": "0.5120831", "text": "def repos(show_commits = false)\n response = @github.repos.list(user: 'siakaramalegos', sort: 'updated', direction: 'desc', page: 1, per_page: 10)\n repos = response.body\n\n repos.each_with_index do |repo, index|\n puts '-' * 80\n date_string = repo.updated_at\n date = DateTime.parse(date_string).to_date\n puts \"(#{index + 1}) #{repo.name}: #{repo.description} (updated: #{date.stamp('12/30/99')})\"\n\n if show_commits\n repo_commits = @github.repos.commits.list('siakaramalegos', repo.name, page: 1, per_page: 10).body\n\n repo_commits.each do |c|\n date_string = c.commit.author.date\n date = DateTime.parse(date_string).to_date\n puts \" #{c.commit.message} (#{date.stamp('12/30/99')})\"\n end\n end\n end\n puts '-' * 80\n repos\n end", "title": "" }, { "docid": "8c09b2cb1250115da85a946909741fd0", "score": "0.50977355", "text": "def repositories\n client.repositories(user_repo, @options)\n end", "title": "" }, { "docid": "f7dfe7ef74fc87aba881942388c86f3e", "score": "0.50959444", "text": "def lists(options = { :filter => :open })\n return @lists if @lists\n @lists = Client.get(\"/boards/#{id}/lists\", options).json_into(List)\n end", "title": "" }, { "docid": "b867b62f8b879f2be7dc41870a8dae84", "score": "0.5093516", "text": "def list_forks(user, repo_name)\n @connection.get(\"/repos/#{user}/#{repo_name}/forks\").map do |repo_data|\n GitHubApi::Repo.new(self, repo_data)\n end\n end", "title": "" }, { "docid": "3a975a36dc9c8fd8d430ad5908c594f2", "score": "0.508912", "text": "def index\n @branches = Branch.where(:regional_id=>current_user.parent_id)\n end", "title": "" }, { "docid": "51740421a656d4fff7c972442d059513", "score": "0.5075654", "text": "def index\n @repos = Repo.all\n end", "title": "" }, { "docid": "be09bcc130e2fff8e95a14f8c8057ff8", "score": "0.5074248", "text": "def index\n @industry_branches = IndustryBranch.all\n end", "title": "" }, { "docid": "b707437901ea9e51218416ac2d1e8e59", "score": "0.50722086", "text": "def branches *path\n return enum_for(:branches, *path) unless block_given?\n self.each_pair do |k,v|\n if k.slice(0, path.size) == path\n sub_key = k - k.slice(0,path.size)\n v = proxy?(v) ? v.deproxy : v\n yield sub_key[0], v unless sub_key.size != 1\n end\n end\n end", "title": "" }, { "docid": "35b96faa8f6ce3ca8fb9c3e0e6f0543a", "score": "0.5065755", "text": "def index\n @mercurials = Mercurial.all\n end", "title": "" }, { "docid": "ac95d35feb3467fbe68c97e76d82da38", "score": "0.5048323", "text": "def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "afb7fb193211ca1f05f6f7b83df3eff1", "score": "0.0", "text": "def question_params\n params[:question].permit(:title, :description)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67419964", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.674013", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.6734356", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.6591046", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.6502396", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6496313", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.6480641", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.64565", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6438387", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63791263", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.63740575", "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.6364131", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.63192815", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.62991166", "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.62978333", "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": "822c743e15dd9236d965d12beef67e0c", "score": "0.6292148", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6290449", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6290076", "text": "def valid_params_request?; end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.62894756", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6283177", "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.6242471", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62382483", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6217549", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6214457", "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.6209053", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.6193042", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.6177802", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.6174604", "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.61714715", "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.6161512", "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": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.6151757", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6150663", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.61461", "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.61213595", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6106206", "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.6105114", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6089039", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.6081015", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071004", "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.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6019971", "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.601788", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6011056", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6010898", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.6001556", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.6001049", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59943926", "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": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992201", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.59909594", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5990628", "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": "423b4bad23126b332e80a303c3518a1e", "score": "0.5980841", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59669393", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59589154", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.5958826", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.5957911", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.5957385", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5953072", "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": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.59526145", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5943361", "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.59386164", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59375334", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5933856", "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.59292704", "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.59254247", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.5924164", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.59167904", "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.59088355", "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": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.5907542", "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": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.59064597", "text": "def url_whitelist; end", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.5906243", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.5898226", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.589687", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5896091", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.5894501", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5894289", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.5891739", "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.58860534", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.5882406", "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.587974", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.58738774", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.5869024", "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": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.58679986", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.5867561", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.5865932", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5864461", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.58639693", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.58617616", "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": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.5861436", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5860451", "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.58602303", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5854586", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.58537364", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5850427", "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.5850199", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
964fa44ebd44b057400a2426c9a9b1c7
Commit a transaction, optionally creating, deleting or modifying some entities.
[ { "docid": "3ea2323892ed10cb8bb959c18783c6c6", "score": "0.64985085", "text": "def commit mutations, transaction: nil\n commit_req = Google::Datastore::V1::CommitRequest.new(\n project_id: project,\n mode: :NON_TRANSACTIONAL,\n mutations: mutations\n )\n if transaction\n commit_req.mode = :TRANSACTIONAL\n commit_req.transaction = transaction\n end\n\n execute { datastore.commit commit_req }\n end", "title": "" } ]
[ { "docid": "bc9e3b1f1b0f51cf45457c3339196008", "score": "0.71257603", "text": "def commit_transaction\n @transaction_manager.commit_transaction\n end", "title": "" }, { "docid": "d991a27bc6b8a03e2bcb38707e43e655", "score": "0.7123001", "text": "def commit\n @transaction_active = false\n self.execute('commit')\n end", "title": "" }, { "docid": "83b6c10903a0e13f061e4fc448896a51", "score": "0.7038684", "text": "def commit_transaction(conn, opts=OPTS)\n if supports_savepoints?\n sps = _trans(conn)[:savepoint_objs]\n if sps.empty?\n log_connection_yield('Transaction.commit', conn){conn.commit}\n elsif supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){supports_releasing_savepoints? ? conn.release_savepoint(sps.last) : sps.last}\n end\n else\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end\n end", "title": "" }, { "docid": "447129aba80ad9e20eb6f382f08f7f88", "score": "0.7001152", "text": "def commit\n resolve\n record_batch\n apply_deletes\n apply_inserts\n apply_updates\n end", "title": "" }, { "docid": "71aec4a38c6db63ac72074508edaa98f", "score": "0.6978798", "text": "def commit_db_transaction\n # COMMIT command only works with 'autocommit' disabled session.\n execute \"COMMIT\"\n end", "title": "" }, { "docid": "16798ba4d84f8d69c6534a9e78761338", "score": "0.69753855", "text": "def commit tid\n tx = @transactions[tid]\n raise RuntimeError, format(ERROR_NO_TRANSACTION, tid) unless tx\n begin\n @store.transaction do |inserts, deletes, dlqs|\n inserts.concat tx[:inserts]\n deletes.concat tx[:deletes]\n end\n # Release locks here, otherwise we expose messages before the\n # transaction gets the chance to delete them from the queue.\n @mutex.synchronize do\n tx[:deletes].each { |delete| @locks.delete delete[:id] }\n end\n @transactions.delete tid\n rescue Exception=>error\n abort tid\n raise error\n end\n end", "title": "" }, { "docid": "c713d087e469f921a5e19ba5ff6e9085", "score": "0.6962825", "text": "def commit(transaction)\n raise NotImplementedError\n end", "title": "" }, { "docid": "d7b07c0c122b8fc095f02efea3be300a", "score": "0.6940677", "text": "def commit\n raise \"COMMIT function not implemented\"\n end", "title": "" }, { "docid": "840843e8874c3c484da51e2047724f14", "score": "0.67904854", "text": "def commit_db_transaction\n hdl = execute(\"COMMIT\")\n end", "title": "" }, { "docid": "38bdd1296b76b8d41ab41a682426684e", "score": "0.6785757", "text": "def commit_transaction(name = nil)\n @objects.each { |obj| obj.commit_transaction(name) }\n end", "title": "" }, { "docid": "d8fe90c81127100cb5882bd9ae8767b5", "score": "0.6739541", "text": "def commit_transaction(conn, opts={})\n if supports_savepoints?\n sps = @transactions[conn][:savepoints]\n if sps.empty?\n log_yield(TRANSACTION_COMMIT){conn.commit}\n elsif supports_releasing_savepoints?\n log_yield(TRANSACTION_RELEASE_SP){supports_releasing_savepoints? ? conn.release_savepoint(sps.last) : sps.last}\n end\n else\n log_yield(TRANSACTION_COMMIT){conn.commit}\n end\n end", "title": "" }, { "docid": "357ad955bc3ae720821e6597b5006bbd", "score": "0.6725083", "text": "def commit\n @transaction_adapter.commit\n end", "title": "" }, { "docid": "827bbc8a2bbf13e2077f9269b9f82038", "score": "0.67089486", "text": "def trancommit\n\n @db.trancommit || raise_error\n end", "title": "" }, { "docid": "cbfe72f5c5a98bbfd97482dcde41c061", "score": "0.66746026", "text": "def commit\n execute \"commit transaction\"\n @transaction_active = false\n true\n end", "title": "" }, { "docid": "cbfe72f5c5a98bbfd97482dcde41c061", "score": "0.66746026", "text": "def commit\n execute \"commit transaction\"\n @transaction_active = false\n true\n end", "title": "" }, { "docid": "cbfe72f5c5a98bbfd97482dcde41c061", "score": "0.66746026", "text": "def commit\n execute \"commit transaction\"\n @transaction_active = false\n true\n end", "title": "" }, { "docid": "43ee3008420c9734849c161b5ab160f8", "score": "0.66739464", "text": "def commit(soft_commit = false)\n session.commit soft_commit\n end", "title": "" }, { "docid": "cd5ff045415e301c3ceae88f06dcbe5c", "score": "0.66648865", "text": "def commit!\n _commit( false )\n end", "title": "" }, { "docid": "cc7e024495398a6c4add89f0f5acd730", "score": "0.6660994", "text": "def commit\n # no op\n end", "title": "" }, { "docid": "4f04793cac6896f1c0ee9a6df0271aaa", "score": "0.6626851", "text": "def trancommit\n\n #check_transaction_support\n\n libcall(:tcadbtrancommit)\n end", "title": "" }, { "docid": "4ae467aa2aeb7c77cc5cce27660bf36f", "score": "0.6626004", "text": "def commit\n log_msg 'Transaction committed'\n end", "title": "" }, { "docid": "8c4c45b961125af06da9877235ccefc0", "score": "0.66189885", "text": "def commit!\n _commit( false )\n end", "title": "" }, { "docid": "227db8658f7a506949eadd7c1cc808a8", "score": "0.65808713", "text": "def commit!\n session.commit\n Entry.delete_entries(@delete_entries) unless @delete_entries.empty?\n rescue Exception => e\n clear_processed(entries)\n raise e\n ensure\n @delete_entries.clear\n end", "title": "" }, { "docid": "960d4c7ffa6862a268a74a6f3c621c33", "score": "0.65764624", "text": "def commit_transaction(conn, opts=OPTS)\n log_connection_execute(conn, commit_transaction_sql) unless savepoint_level(conn) > 1\n end", "title": "" }, { "docid": "bd6fa2371af18533a55c4034e99555ed", "score": "0.6573006", "text": "def commit(transaction)\n raise NotImplementedError, \"Repository.commit: Not yet implemented\"\n end", "title": "" }, { "docid": "6bf3a56dd279724630f0d7f1c66957b3", "score": "0.6563987", "text": "def commit_db_transaction()\n end", "title": "" }, { "docid": "317b015440bf286555813b5d4a2335e2", "score": "0.65626967", "text": "def commit(*args)\n safety_nets\n run :commit, args\n end", "title": "" }, { "docid": "24e128474ceaced098a46e7e5ac5aed3", "score": "0.6548889", "text": "def commit_transaction\n check_valid_transaction\n trigger_matches = compute_triggers_for_committed_transaction\n apply_modifications_to_plan\n apply_triggers_on_committed_transaction(trigger_matches)\n frozen!\n\n @committed = true\n committed_transaction\n plan.remove_transaction(self)\n @plan = nil\n\n yield if block_given?\n end", "title": "" }, { "docid": "c7ac78ca9c759cf448b683c84874f330", "score": "0.6547812", "text": "def commit\n _commit(@transactions.pop)\n @transactions << []\n true\n end", "title": "" }, { "docid": "381ecb6653b937f0c356af155e034a16", "score": "0.6517236", "text": "def save *entities\n commit { |c| c.save(*entities) }\n end", "title": "" }, { "docid": "b3389bd26d91af29b4eddc4b592dd5c1", "score": "0.65010965", "text": "def commit\n apply_inserts\n apply_updates\n end", "title": "" }, { "docid": "409e1b5f8402fcf705f31cdc19b1c1a3", "score": "0.6495688", "text": "def commit\n fail 'Method not supported in this persistor'\n end", "title": "" }, { "docid": "3d4dd81d55c2f90c70e2450c1d8a6336", "score": "0.64912605", "text": "def commit name, headers={}\n headers[:transaction] = name\n transmit \"COMMIT\", headers\n end", "title": "" }, { "docid": "29b89066cf972ff09f7f780eb468f77f", "score": "0.649008", "text": "def commit(name, headers = {})\n headers[:transaction] = name\n transmit \"COMMIT\", headers\n end", "title": "" }, { "docid": "9bb03f79580800695340192e2f1ec866", "score": "0.6488787", "text": "def commit_frame tx, h\n create_transaction_frame 'COMMIT', tx, h\n end", "title": "" }, { "docid": "c606160b6ff83316342aded2fe61e2dc", "score": "0.6473058", "text": "def commit_db_transaction\n @logger.unknown(\"ODBCAdapter#commit_db_transaction>\") if @@trace\n @connection.commit\n # ODBC chains transactions. Turn autocommit on after commit to\n # allow explicit transaction initiation.\n @connection.autocommit = true\n rescue Exception => e\n @logger.unknown(\"exception=#{e}\") if @@trace\n raise ActiveRecordError, e.message\n end", "title": "" }, { "docid": "bc545e7648f154c870ff5d21570562fb", "score": "0.6464187", "text": "def commit(name, headers = {})\n headers[:transaction] = name\n transmit(\"COMMIT\", headers)\n end", "title": "" }, { "docid": "bc545e7648f154c870ff5d21570562fb", "score": "0.6464187", "text": "def commit(name, headers = {})\n headers[:transaction] = name\n transmit(\"COMMIT\", headers)\n end", "title": "" }, { "docid": "5f3e17330d258d11f563bd198b1919d8", "score": "0.64552873", "text": "def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end", "title": "" }, { "docid": "ef648178fc56c37171d2b1eea2b26b7d", "score": "0.6449495", "text": "def commit_transaction(conn, opts=OPTS)\n if supports_savepoints?\n depth = savepoint_level(conn)\n log_connection_execute(conn, depth > 1 ? commit_savepoint_sql(depth-1) : commit_transaction_sql)\n else\n log_connection_execute(conn, commit_transaction_sql)\n end\n end", "title": "" }, { "docid": "967627f0281788e6b2acdf7e25887446", "score": "0.64447445", "text": "def transaction_commit(trsc) # :nodoc:\n\t\ttrsc.commit_transaction(false)\n\t end", "title": "" }, { "docid": "967627f0281788e6b2acdf7e25887446", "score": "0.64447445", "text": "def transaction_commit(trsc) # :nodoc:\n\t\ttrsc.commit_transaction(false)\n\t end", "title": "" }, { "docid": "04d7d7751b796fc46706f4975bbe19ef", "score": "0.6417466", "text": "def commit_db_transaction\n log('commit transaction', nil) { @connection.commit }\n end", "title": "" }, { "docid": "6e894c66faafe6893b5e426d589785b6", "score": "0.6416181", "text": "def commit!\n queue.autocommit && session.commit\n self.delete_entries.any? && Entry.delete_entries(self.delete_entries)\n rescue Exception => e\n clear_processed\n raise e\n ensure\n self.delete_entries.clear\n end", "title": "" }, { "docid": "b7c1c30b7c55d12d6a8cd9b465a0a985", "score": "0.64076734", "text": "def commit_transaction(conn, opts={})\n if supports_savepoints?\n depth = _trans(conn)[:savepoint_level]\n log_connection_execute(conn, depth > 1 ? commit_savepoint_sql(depth-1) : commit_transaction_sql)\n else\n log_connection_execute(conn, commit_transaction_sql)\n end\n end", "title": "" }, { "docid": "80b88c33f0b8bceca82d498cb8c1971b", "score": "0.6396321", "text": "def commit_db_transaction\n @connection.commit\n end", "title": "" }, { "docid": "b9e7ff112896fd98aa946d5730e7dddb", "score": "0.6369919", "text": "def commit_db_transaction\n puts_log \"commit_db_transaction\"\n log(\"commit transaction\", \"TRANSACTION\") {\n # Commits the transaction\n IBM_DB.commit @connection rescue nil }\n # Turns on auto-committing\n IBM_DB.autocommit @connection, IBM_DB::SQL_AUTOCOMMIT_ON\n end", "title": "" }, { "docid": "3bf17102d6bc24c6a3018e9803d63b9d", "score": "0.6368614", "text": "def commit\n raise NotImplementedError\n end", "title": "" }, { "docid": "3bf17102d6bc24c6a3018e9803d63b9d", "score": "0.6368614", "text": "def commit\n raise NotImplementedError\n end", "title": "" }, { "docid": "3bf17102d6bc24c6a3018e9803d63b9d", "score": "0.6368614", "text": "def commit\n raise NotImplementedError\n end", "title": "" }, { "docid": "0867cccdca2b60fa840c9e0cbb3450d2", "score": "0.6368297", "text": "def commit_transaction_sql\n 'COMMIT'\n end", "title": "" }, { "docid": "259163e40e4d1c2b8dc81d0154aebbde", "score": "0.63589686", "text": "def commit\n create_or_update\n end", "title": "" }, { "docid": "d299ecd223b4f07273edeb09412c7031", "score": "0.6340035", "text": "def trancommit\n raise_transaction_nme('trancommit')\n end", "title": "" }, { "docid": "594c6d08fb239022b3993e226c9a3c20", "score": "0.63342094", "text": "def commit( defer=false )\n save_logic( defer, false )\n end", "title": "" }, { "docid": "3fa711237f5db9634d77c88e96e7325d", "score": "0.63298935", "text": "def tx_commit\n send_frame(Qrack::Protocol::Tx::Commit.new())\n\n method = next_method\n\n check_response(method, Qrack::Protocol::Tx::CommitOk, \"Error commiting transaction\")\n\n # return confirmation\n :commit_ok\n end", "title": "" }, { "docid": "3f0cc50cf5650cc9a80eeed923ae389e", "score": "0.63257617", "text": "def commit_transaction_sql\n \"COMMIT TRANSACTION\"\n end", "title": "" }, { "docid": "3f0cc50cf5650cc9a80eeed923ae389e", "score": "0.63257617", "text": "def commit_transaction_sql\n \"COMMIT TRANSACTION\"\n end", "title": "" }, { "docid": "680152c521238e2962961ddb235c9b16", "score": "0.6314347", "text": "def commit\n @connection.commit\n end", "title": "" }, { "docid": "680152c521238e2962961ddb235c9b16", "score": "0.6314347", "text": "def commit\n @connection.commit\n end", "title": "" }, { "docid": "91725ec70f37efdb311d52c7fb323f82", "score": "0.6310437", "text": "def commit_transaction_sql\n SQL_COMMIT\n end", "title": "" }, { "docid": "91725ec70f37efdb311d52c7fb323f82", "score": "0.6310437", "text": "def commit_transaction_sql\n SQL_COMMIT\n end", "title": "" }, { "docid": "3eef2d2b8f408f6d8d9feccc2ccf7568", "score": "0.6290808", "text": "def commit\n @commit\n end", "title": "" }, { "docid": "ea4baf98f5c772f6a2e95f39552d8e32", "score": "0.628793", "text": "def commit_prepared_transaction(transaction_id, opts=OPTS)\n run(\"COMMIT TRANSACTION #{transaction_id}\", opts)\n end", "title": "" }, { "docid": "348893dc85a86d69ecca4a781fef0bc8", "score": "0.62805504", "text": "def commit(&block)\n if block_given?\n raise \"Illegal state for commit with block: #{@state}\" unless @state == :none\n begin\n self.begin\n rval = within(&block)\n self.commit if @state == :begin\n return rval\n rescue Exception => e\n self.rollback if @state == :begin\n raise e\n end\n else\n raise \"Illegal state for commit without block: #{@state}\" unless @state == :begin\n each_adapter(:prepare_adapter, [:rollback_and_close_adapter_if_begin, :rollback_prepared_and_close_adapter_if_prepare])\n each_adapter(:commit_adapter, [:log_fatal_transaction_breakage])\n each_adapter(:close_adapter, [:log_fatal_transaction_breakage])\n @state = :commit\n end\n end", "title": "" }, { "docid": "34abd3c829ad8d45c199fc521051a39f", "score": "0.6268928", "text": "def commit_transaction_sql\n SQL_COMMIT\n end", "title": "" }, { "docid": "da4571b0fa953a4ab0bf724614edaa03", "score": "0.62645656", "text": "def tx_commit\n\t\t\tsend_frame(Qrack::Protocol::Tx::Commit.new())\n\t\t\t\n\t\t\tmethod = next_method\n\t\t\t\n\t\t\tcheck_response(method, Qrack::Protocol::Tx::CommitOk, \"Error commiting transaction\")\n\n\t\t\t# return confirmation\n\t\t\t:commit_ok\n\t\tend", "title": "" }, { "docid": "5ad9d601e6a93dfbc14b8bebeba219e0", "score": "0.6261567", "text": "def commit\n raise NotImplementedError, 'must implement this method'\n end", "title": "" }, { "docid": "454fbe6a6b667cd6de7c89156a9050f5", "score": "0.6254931", "text": "def commit_transaction\n\t super if defined? super\n\n\t arguments.dup.each do |key, value|\n if value.respond_to?(:transaction_proxy?) && value.transaction_proxy?\n\t\t arguments.update!(key, value.__getobj__)\n\t\tend\n\t end\n\tend", "title": "" }, { "docid": "2ea9ab2c9df0e02794e7cadc6a758d56", "score": "0.62516373", "text": "def commit\n raise NotImplementedError.new\n end", "title": "" }, { "docid": "15adcf483dcd991732c67c5e66702b12", "score": "0.62208164", "text": "def commit_transaction_records(*)\n super if Manager.current.should_commit?(self)\n end", "title": "" }, { "docid": "554efc3a7671e269d5ea9f97335bfb61", "score": "0.62164974", "text": "def commit\r\n end", "title": "" }, { "docid": "b1e90135fe540d51eceabe2a4d8fcaea", "score": "0.6215309", "text": "def commit_transaction\n\t # if !Roby.control.running?\n\t # raise \"#commit_transaction requires the presence of a control thread\"\n\t # end\n\n\t check_valid_transaction\n\t frozen!\n\n\t plan.execute do\n apply_modifications_to_plan\n\n proxies = proxy_objects.dup\n clear\n # Replace proxies by forwarder objects\n proxies.each do |object, proxy|\n forwarder_module = Transaction::Proxying.forwarder_module_for(object.model)\n proxy.extend forwarder_module\n proxy.__freeze__\n end\n\n @committed = true\n\t\tcommitted_transaction\n\t\tplan.remove_transaction(self)\n\t\t@plan = nil\n\n\t\tyield if block_given?\n\t end\n\tend", "title": "" }, { "docid": "14ee7e63fda2ab0b5da03a61f0ba6ab5", "score": "0.62149733", "text": "def commit_or_rollback_transaction(exception, conn, opts)\n if exception\n false\n else\n commit_transaction(conn, opts)\n true\n end\n end", "title": "" }, { "docid": "650cfb91d5143200b39d423a24ee9707", "score": "0.6214655", "text": "def commit_transaction\n\t super if defined? super\n end", "title": "" }, { "docid": "f3a9af3a80914c6be59bc9689bba80c2", "score": "0.6203078", "text": "def commit\n @resource.commit\n end", "title": "" }, { "docid": "286b6617f466cfc5aaf6a7001c5f5807", "score": "0.6197091", "text": "def commit_prepared_transaction(transaction_id, opts=OPTS)\n run(\"XA COMMIT #{literal(transaction_id)}\", opts)\n end", "title": "" }, { "docid": "687f6d41e70470fda3f52841bdeaa89b", "score": "0.6179998", "text": "def commit\n\t\tquery do |dbh|\n\t\t\tdbh.transaction do\n\t\t\t\t@changed.uniq.each do |o|\n\t\t\t\t\tif o.kind_of?(String)\n\t\t\t\t\t\tquery {|innerdbh| innerdbh.do o.to_s}\n\t\t\t\t\telsif o.pending_deletion?\n\t\t\t\t\t\tdelete_one o\n\t\t\t\t\telsif o.serialized?\n\t\t\t\t\t\tstore_object o\n\t\t\t\t\telse\n\t\t\t\t\t\tinsert_object o\n\t\t\t\t\tend\n\t\t\t\t\to.rollback_buffer = []\n\t\t\t\tend\n\t\t\t\t@changed.clear\n\t\t\tend\n\t\t\tdbh.commit\n\t\tend\n\tend", "title": "" }, { "docid": "eaa81da14d91e0a2118588066c76f03e", "score": "0.6141304", "text": "def commit\n all_sessions.each { |session| session.commit }\n end", "title": "" }, { "docid": "adcf0c089c6a325e130fc3ec96e6ed5e", "score": "0.6116548", "text": "def commit\n query 'commit'\n self\n end", "title": "" }, { "docid": "9684a38cb9d8fac932872582cfa1d936", "score": "0.6116421", "text": "def transaction\n commited = false\n yield\n commit\n commited = true\n ensure\n rollback unless commited\n end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.6112667", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.6112667", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.6112667", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "1a2a1b1de2549eacabe79893cecbb2e0", "score": "0.6112667", "text": "def commit_db_transaction() end", "title": "" }, { "docid": "dc341c157d15ce6d7278e4ea0ce0a156", "score": "0.6102256", "text": "def commit_transaction(id)\n Fedora.post(id + '/fcr:tx/fcr:commit')\n end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6089388", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6089388", "text": "def commit; end", "title": "" }, { "docid": "b4003008064700df89de1cbf40139c4a", "score": "0.6089388", "text": "def commit; end", "title": "" }, { "docid": "948edc6f5a46e8e9ff0e37b0f008731e", "score": "0.6087307", "text": "def commit\n @change_counter ||= 0\n @change_counter += 1\n if @change_counter == commit_frequency\n @change_counter = 0\n commit_db_transactions\n begin_db_transactions\n end\n end", "title": "" }, { "docid": "735529c2f2d415e11a24bb20e5fe7bc4", "score": "0.6059144", "text": "def commit(soft_commit = false)\n with_exception_handling { all_sessions.each { |s| s.commit(soft_commit) } }\n end", "title": "" }, { "docid": "af29ef19b4db211e231c5f495e7a6d2c", "score": "0.6058376", "text": "def commit\n begin\n responses = @service.batch_write @operations.map(&:write)\n parse_results responses\n rescue StandardError => e\n raise BulkCommitBatchError, e\n end\n end", "title": "" }, { "docid": "51332defb77e1ac31474f7cabf043aa9", "score": "0.60563177", "text": "def commit\n token = @transaction\n @transaction = nil\n if !token.nil?\n return @client.commit @creds, token, @environment\n else\n return false\n end\n end", "title": "" }, { "docid": "d81ecf4d143403636f6e2a3bd10b8a7b", "score": "0.60539514", "text": "def transactional\n save_point\n returned = yield\n if returned.nil? or returned == false\n rollback\n else\n commit\n end\n returned\n end", "title": "" }, { "docid": "0319371bd0b8b9f8f45669bda968c5ad", "score": "0.6045582", "text": "def commit!\n raise NotImplementedError, \"#{self.class}#commit! must be implemented\"\n end", "title": "" }, { "docid": "11544a1f9052b32d3579d6a041097ad8", "score": "0.60352063", "text": "def commit\n\t\t@connection.commit\n\tend", "title": "" }, { "docid": "330fca4671dd373de8eac31d0c7519f6", "score": "0.6033814", "text": "def commit_or_rollback_transaction(exception, conn, opts)\n if exception\n false\n else\n if Thread.current.status == 'aborting'\n rollback_transaction(conn, opts)\n false\n else\n commit_transaction(conn, opts)\n true\n end\n end\n end", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.6031068", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "bf7e575bce73e7eec8f49c6975cfeb80", "score": "0.6031068", "text": "def commit_db_transaction; end", "title": "" }, { "docid": "71ba05d1bc3af502bdc46a2b6cdc6a91", "score": "0.5994711", "text": "def commit_db_transactions\n [:left, :right].each do |database|\n if maintain_activity_status?\n session.send(database).execute(\"delete from #{activity_marker_table}\")\n end\n session.send(database).transaction_manager.commit_transaction\n end\n end", "title": "" }, { "docid": "e21efa09464215a9537b55cd18a5f8a7", "score": "0.5963502", "text": "def commit\n unless @finished\n do_commit\n end\n end", "title": "" } ]
de9ae079a79b8b6eeed6361bd0f5f8c4
EMAILS = Array.new File.open("emails.txt", "r") do |f| f.each_line do |line| $emails.push(line) end end Ensure valid credentials, either by restoring from the saved credentials files or intitiating an OAuth2 authorization. If authorization is required, the user's default browser will be launched to approve the request.
[ { "docid": "ca511378d7977e4fd2a103d5d10ab93d", "score": "0.0", "text": "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'hendrikusbimawan@gmail.com'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\n end", "title": "" } ]
[ { "docid": "40ca0ba05da18fd069770d131e33202c", "score": "0.6084621", "text": "def _email\n if File.exists?(email_filename)\n email = File.readlines(email_filename).first.strip\n { :email => email }\n else\n puts \"================ WARNING ================\"\n puts \"Make sure you create #{email_filename} with your email in it, otherwise you won't be able to make too many requests to open street map\"\n { }\n end\nend", "title": "" }, { "docid": "6b94f1c9feab9284a5ae4428254bc52e", "score": "0.6015124", "text": "def read_credentials\n creds = []\n File.open(@conf) { |f| f.each_line { |l| creds << l.chomp } } if File.exists?(@conf)\n creds\n end", "title": "" }, { "docid": "522136d6d92b6a7a3e23a84857214c81", "score": "0.5942928", "text": "def file_to_lines!\n raise InvalidInputError, \":filename required\" if @filename.class != String\n raise InvalidInputError, \"bad :filename => #{@filename}\" unless File.exist? @filename\n\n @email_array = IO.readlines(@filename).each_with_index.map {|x,i| [x.chomp,i]}\n #i = -1\n #@email_array = IO.readlines(@filename).map {|x| [x.chomp,i+=1]}\n\n raise EmptyFileError, 'no emails found in supplied :filename' if @email_array.empty?\n\n return @email_array\n end", "title": "" }, { "docid": "bea8996abdc96487756fc970ccac35aa", "score": "0.5888194", "text": "def initialize(email_file:, sp_file:, output:)\n @emails = parse_file(email_file).map(&:downcase).uniq\n validate_emails\n @issuers = parse_file(sp_file).uniq\n validate_issuers\n @output = output\n validate_output\n end", "title": "" }, { "docid": "1efd6e60e95c2b1bbceaa925093debcf", "score": "0.5763049", "text": "def readfile\n File.readlines(@new_email).each do |line|\n if line =~ /Date: /\n puts line\n elsif line =~ /To: / && line !~ /Delivered-To:/\n puts line\n elsif line =~ /From: /\n puts line\n elsif line =~ /Subject: /\n puts line\n else\n end\n end\n end", "title": "" }, { "docid": "235f81bf1c93e460f54e19e7a7934f70", "score": "0.56970996", "text": "def makeEmail(aFile)\n begin\n inRead = File.open(aFile,'r')\n while line = inRead.gets\n $finalOut << line\n end\n rescue Exception => e\n log(\"[!] Error: #{e.message}\")\n ensure\n inRead.close if inRead\n end\nend", "title": "" }, { "docid": "f65bd537f8d4175773bb0f7167e9be38", "score": "0.56953526", "text": "def obtain_emails\n connect_config = {auth_type: :basic,email_address:'mah.sync24@gmail.com',password:'jaw35Maw'}\n KEE.config_connection(connect_config)\n KEE.new.unread_emails\nend", "title": "" }, { "docid": "23054220e80aa6fd8e124c576eba61db", "score": "0.56219614", "text": "def initialize(emails) # each new instance is intialized with access\n @emails = emails # to the emails reader so they can be set\n end", "title": "" }, { "docid": "63a5f717f701a93f60458f37b767e373", "score": "0.56095636", "text": "def open_accounts\n File.open(File.join(Dir.pwd,\"users\",\"accounts\"),\"r\") do |f|\n f.each_line do |line|\n b=line.split(\",\")\n a=Account.new(b[0],b[1],b[2].delete(\"\\n\"))\n @accounts.push(a)\n end\n end\nend", "title": "" }, { "docid": "be23729b9bcd8800c5c95f114ba39679", "score": "0.5597191", "text": "def initialize(email_list)\n @emails = email_list\n end", "title": "" }, { "docid": "cf59a171edfccc82f199fd70dcb01237", "score": "0.55707204", "text": "def parse(text)\n envlists = []\n text.split(\"\\n\").each do |line|\n envlist = emails = nil\n case line.chomp\n when /^\\s*#/; next\n when /^\\s*$/; next\n when /^\\s*(.+)\\s*:s*(.+)\\s*$/\n environment = $1\n emails = $2.sub(/#.*$/,'')\n else\n raise ArgumentError, \"Invalid envmail config file\"\n end\n\n # Now split the emails\n emails = emails.sub(/\\s+$/,'').split(/\\s*,\\s*/)\n envlists << [emails, environment]\n end\n envlists\n end", "title": "" }, { "docid": "92524c8a7d3ff46f685e261edf693d0b", "score": "0.55287355", "text": "def initialize(emails)\n @emails = emails\n end", "title": "" }, { "docid": "78c8c5eb4c82b0a48ef6120c0fbb242b", "score": "0.5508079", "text": "def initialize(file)\n if File.size?(file) then\n @file = true\n File.foreach(file) do |line| #check requirement\n line.chomp!\n @keyword = line.split(/^keyword:\\s?/i)[1] if line.match?(/^keyword:\\s?.+\\z/i)\n @numList = line.split(/^number:\\s?/i)[1].to_i if line.match?(/^number:\\s?([0-9]|10)\\z/i)\n @email = line.split(/^email:\\s?/i)[1] if line.match?(/^email:\\s?[a-z]+\\.[1-9]\\d*@osu\\.edu\\z/i)\n end\n else\n puts \"ERROR!: cannot open file or file is empty!\"\n end\n if @keyword == nil|| @numList == nil|| @email == nil then\n puts \"ERROR! missing or wrong inputs:\\n 'keyword: anything'\\n'number: [0-10]'\\n 'email: lastName.digits@osu.edu'\"\n else\n sendMail\n end\n end", "title": "" }, { "docid": "e1ff45038c95ab3f9f8778c0c63012d6", "score": "0.5500376", "text": "def load_auth\n\t\t\tbegin\n\t\t\t\tauthdata = JSON.parse(File.read(opts[:auth_file]))\n\t\t\t\t[authdata['email'], authdata['password']]\n\t\t\trescue\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "ea3990cf01633b5071efa3aa435e8875", "score": "0.5498015", "text": "def initFromFile(filename)\n @phrases = Array.new\n @disabled = false\n if not File.file?(filename) \n log \"No data file #{filename}\"\n return false\n end\n log \"Reading #{filename}\"\n File.open(filename).readlines.each do | line |\n line.strip!\n if line.start_with?(\"\\#DISABLED\")\n log \"This account is disabled\"\n return false\n end\n if not line.empty? and not line.start_with?(\"\\#\")\n debug \"#{line.length}: #{line}\"\n if line.length < 140\n @phrases << line\n else\n debug \"**LINE too long**\"\n end\n end \n end\n log \"Found #{@phrases.length} entries\"\n true\n end", "title": "" }, { "docid": "ab1afbe2bd065d915807b38b54ab465b", "score": "0.54948026", "text": "def initialize(emails = '')\n @emails = emails\n end", "title": "" }, { "docid": "b02f16bbcab9701e23f7c52b3eb0f840", "score": "0.54776466", "text": "def fetch_emails\n\t BusinessEnquiry.fetch_email(Constants::GMAIL_USER, Constants::GMAIL_PASSWORD)\n\t redirect_to '/', notice: \"Emails fetched.\"\n\tend", "title": "" }, { "docid": "9455e2be5370ced2099b118576e52c45", "score": "0.54656905", "text": "def get_recipient_list\n add_str = File.read(\"#{File.expand_path('../', __FILE__)}/email_recipients\")\n recipient_list = Array.new\n add_str.split(\"\\n\").each do |add|\n if !add.nil? && add.match(/\\A.+@.+\\.com\\Z/)\n recipient_list.push(add)\n end\n end\n return recipient_list\n end", "title": "" }, { "docid": "df5d8e6cc1e93bf572ade4fe35304dfb", "score": "0.5452695", "text": "def email_check\n\tFile.open(Rails.root.join('lib', 'csv', 'emails.csv'), \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t if line.split(',').any? { |mail| email.include?(mail)}\n\t\t \telse\n\t\t errors.add(:email, \"is not on our list\")\n\t\t \tend\n\t \t end\n\t\tend\n\tend", "title": "" }, { "docid": "3fa81e9f1ced4c0eec1cf9f9518e90a4", "score": "0.54165435", "text": "def emails; end", "title": "" }, { "docid": "9d95b03a7c18c42ca9c863274bb6dbe1", "score": "0.54021996", "text": "def import(file)\n spreadsheet = open_spreadsheet(file)\n header = spreadsheet.row(1)\n\n (2..spreadsheet.last_row).each do |i|\n row = Hash[[header, spreadsheet.row(i)].transpose]\n email = self.emails.find_by_emailAddress(row[\"emailAddress\"]) || Email.new\n if(row[\"emailAddress\"].to_s.include?(\"@\"))\n email.attributes = row.to_hash.slice(*(Email.accessible_attributes))\n email.default_values\n email.save!\n end\n unless emails.include?(email)\n emails << email\n end\n end\n end", "title": "" }, { "docid": "d0f67da9f91bfa04c0f9349a62a2847b", "score": "0.53989875", "text": "def get_users\n users=[]\n open(\"users.txt\"){|f|\n f.each_line{|l| users << l}\n }\n return users;\nend", "title": "" }, { "docid": "5e2c9292d33504cf18d115b424458a6b", "score": "0.5370001", "text": "def read_credentials\n print \"Username: \"\n username = gets.chomp\n print \"Password: \"\n password = STDIN.noecho(&:gets).chomp\n puts \"\"\n print \"Full name: \"\n fullname = gets.chomp\n print \"Email: \"\n email = gets.chomp\n roles = APP_CONFIG[\"user_roles\"].reject {|x| x[\"unassignable\"]}.map {|x| x[:name]}\n print \"Role (#{roles.join(\", \")}): \"\n role = gets.chomp\n encrypted_password = BCrypt::Password.create(password)\n return [username, encrypted_password, fullname, email, role]\nend", "title": "" }, { "docid": "fa0af722f20c4d71e0b7f5947afeb77c", "score": "0.5369118", "text": "def netrc_entries\n open('sample2.netrc').each_line do |line|\n yield(*line.split)\n end\nend", "title": "" }, { "docid": "5f06f1b9d97e9bc033cb8de20cc146f0", "score": "0.5350121", "text": "def initialize(email_list)\n self.email_list = email_list\n end", "title": "" }, { "docid": "8d8387f1664607075bc1ddc4a7a095b2", "score": "0.53403145", "text": "def initialize(emails)\n @emails = emails\nend", "title": "" }, { "docid": "0e71a1189934ef2263cd6a571f411fd3", "score": "0.5333268", "text": "def autosign_store(file)\n auth = Puppet::Network::AuthStore.new\n File.readlines(file).each do |line|\n next if line =~ /^\\s*#/\n next if line =~ /^\\s*$/\n auth.allow(line.chomp)\n end\n\n auth\n end", "title": "" }, { "docid": "b8e2a7fc7b74b590ab71d3c4f092641a", "score": "0.53305954", "text": "def check_token\n if File.exist?(@token_file)\n refresh_token = open(@token_file, &:read).chomp\n g_cal.login_with_refresh_token(refresh_token)\n else\n # A user needs to approve access in order to work with their calendars.\n puts 'Visit the following web page in your browser and approve access.'\n puts g_cal.authorize_url\n puts \"\\nCopy the code that Google returned and paste it here:\"\n\n # Pass the ONE TIME USE access code here to login and get a refresh token that you can use for access from now on.\n refresh_token = g_cal.login_with_auth_code($stdin.gets.chomp)\n\n # Save token to TOKEN_FILE\n File.open(@token_file, 'w') { |f| f.write(refresh_token) }\n puts \"Token saved to #{@token_file}\"\n end\n end", "title": "" }, { "docid": "be19c26e8b6fca0f9ab89943ae55c0c9", "score": "0.53192", "text": "def getAccessData(data_file)\n\taccessData = Array.new\n\tif !File.exists?(data_file) then\n\t\tputs \"Generating your access token...\"\n\t\taccessData[0],accessData[1] = TweetTrawler.genAccessToken(apikey,apisecret,\"https://api.twitter.com\")\n\t\t# also write out to file\n\t\taccessOut = File.open(data_file,\"w\")\n\t\taccessOut << \"#{accessData[0]}\\n#{accessData[1]}\"\n\t\taccessOut.close\n\telse\n\t\tFile.readlines(data_file).each do |line|\n\t\t\tline.chomp!\n\t\t\taccessData.push(line)\n\t\tend\n\tend\n\treturn accessData\nend", "title": "" }, { "docid": "5572761daaec052a3a32d39b2aa4d0b7", "score": "0.53175646", "text": "def login_system (email,password,load_from_file)\n if load_from_file == true\n @password_from_file = File.readlines 'password.txt'\n @email_from_file = File.readlines 'email.txt'\n @email_for_password_reset = @email_from_file\n @login_element.send_keys @email_from_file\n @password_element.send_keys @password_from_file\n @submit_element.submit\n \n\n elsif load_from_file == false \n @email = email\n @password = password\n @email_for_password_reset = password\n @password_element.send_keys @password\n @login_element.send_keys @email\n @submit_element.submit\n \n else\n raise \"Uh oh you need to only put true or false in load_from_file\"\n end\n end", "title": "" }, { "docid": "4b08a0fc22dc05e1fbfdafc706b5f4ce", "score": "0.53166574", "text": "def read_auth\n File.read(File.join(@auth, \"#{@file}-authorization-template\")).scan(/^\\[groups\\].*^\\[/m).first rescue ''\n end", "title": "" }, { "docid": "0ca00b219abf1b7010e033fdef1d6f18", "score": "0.5312664", "text": "def emails\n if self.alert_emails.blank?\n []\n else\n self.alert_emails.split(\" \")\n end\n end", "title": "" }, { "docid": "eff7f7f30bedc08346f1bc42051c6ca7", "score": "0.53125745", "text": "def readQuestions\n\tquestionsArray = Array.new\n\topen(\"questions.txt\", \"r\") do |f|\n\t f.each_line do |line|\n\t questionsArray << line.chomp\n\t end\n\tend\n\treturn questionsArray\nend", "title": "" }, { "docid": "7a851674c3f68f479890681952ff86fe", "score": "0.5300752", "text": "def email_list\n @raw_entries.collect do |line|\n name, city, state, email = line.split(\"|\")\n format_email_address name, email.chomp\n end.join(\", \")\n end", "title": "" }, { "docid": "7a851674c3f68f479890681952ff86fe", "score": "0.5300752", "text": "def email_list\n @raw_entries.collect do |line|\n name, city, state, email = line.split(\"|\")\n format_email_address name, email.chomp\n end.join(\", \")\n end", "title": "" }, { "docid": "6120d84d7ce799664985b5e6ef9e3327", "score": "0.529176", "text": "def scan\n @filearray = []\n file = File.new(@epw_filepath, 'r')\n while (line = file.gets)\n @filearray.push(line.split(','))\n end\n file.close\n end", "title": "" }, { "docid": "50b62df74d40d1a4b201a92a536af352", "score": "0.5266108", "text": "def get_supplied_emails\n emails = nil\n if $argv.length == 1\n # No emails passed on command line; read from STDIN instead.\n emails_raw = STDIN.read\n emails = emails_raw.split(/\\s/)\n else\n # Emails passed on command line.\n emails = $argv.drop(1)\n end\n emails.reject!{ |email| email.empty? }\n if emails.empty?\n STDERR.puts('Please supply at least one email as an argument or via STDIN.')\n abort\n end\n emails\nend", "title": "" }, { "docid": "cf3c7f7c86d69eb874ba716e87b60ad7", "score": "0.5252769", "text": "def get_entry(auth, user)\n File.open(auth){|f|\n f.each_line{|line|\n next if line.strip.chomp.empty?\n a_user, a_pass = line.chomp.split(\":\")\n return [a_user,a_pass] if user == a_user\n }\n }\n return nil\nend", "title": "" }, { "docid": "0e5e6b215ea65d512f30e60551d708a8", "score": "0.5249563", "text": "def parse_file!(path)\n f = open(path)\n lines = f.readlines()\n unless lines.length == 2\n raise \"Credentials file must be 2 lines: username on one, password on the other\"\n end\n\n @username, @password = lines.map {|line|; line.rstrip}\n end", "title": "" }, { "docid": "521e3c360a57e12099aef7e57fecdb00", "score": "0.524773", "text": "def getEmails( config )\n\n username = config[\"username\"]\n password = config[\"password\"]\n label = config[\"label\"]\n peek = config[\"peek\"]\n\n\n begin\n puts 'attempting to connect to ' + username + '@gmail.com'\n gmail = Gmail.new(username, password)\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (peek == 'true' ? true : false)\n\n if label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(label)\n boxname = label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n emails = inbox.emails(:unread).map { |email| parser(email) }\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n []\n end\nend", "title": "" }, { "docid": "4a7169bc6a66dccf29f70fa136b16d53", "score": "0.523895", "text": "def fill_twitter_valid_email_address\n\n fill_in UNLINK_TWITTER_EMAIL_FIELD, with: UNLINK_TWITTER_VALID_USER_EMAIL + read_file.to_s + UNLINK_TWITTER_VALID_DOMAIN\n\n end", "title": "" }, { "docid": "fe63684f1b3dc341f50407611c0d7ffc", "score": "0.5235794", "text": "def email_list\n end", "title": "" }, { "docid": "b8537c6dc738b4a8a78069c82b5f5172", "score": "0.5233245", "text": "def get_watchlist()\n text_array = []\n File.open(\"./watchlist.txt\", \"r\") do |file|\n text_array = file.read.split(\"\\n\")\n end\n\n return text_array\nend", "title": "" }, { "docid": "7eaee026854014468d1d7bd1de27b744", "score": "0.5223042", "text": "def email_address_and_api_key\n if ENV['TURBOT_API_KEY']\n ['', ENV['TURBOT_API_KEY']]\n elsif netrc_exists?\n open_netrc[\"api.#{host}\"] || []\n else\n []\n end\n end", "title": "" }, { "docid": "84f34c73266104a382a058a247f234d8", "score": "0.52229774", "text": "def read_msisdns_files\n array = []\n File.open('MSISDNs.txt') do |f|\n f.each_line.each do |line|\n array << line\n end\n end\n array\nend", "title": "" }, { "docid": "a299ab7bbd0ba1c70131688b58d2ae93", "score": "0.5220573", "text": "def collect_credentials(attempt = 1)\n email = ask('Email: ')\n pass = password\n account = Gemical.connection.get \"/account\", :basic_auth => [email, pass]\n configuration.write! :credentials, email, account[\"authentication_token\"]\n say_ok \"Authentication successful. Thanks!\\n\"\n account\n rescue Gemical::Connection::HTTPUnauthorized\n if attempt < 3\n say_warning \"\\nInvalid email and/or password.\"\n say_warning \"Try again:\"\n attempt += 1\n retry\n else\n say_error \"\\nAre your sure you have the right credentials?\"\n say_error \"Visit http://gemical.com/password/new for instructions.\"\n exit(1)\n end\n end", "title": "" }, { "docid": "05ed013abbfe1858e77df89e0406029b", "score": "0.5220273", "text": "def tweet_file_parser(file)\r\n\tstring = open(file,\"r\").read\r\n\tstring[0] = ''\r\n\tarray_of_names = string.split(\"\\n@\")\r\n\treturn array_of_names\r\nend", "title": "" }, { "docid": "05ed013abbfe1858e77df89e0406029b", "score": "0.5220273", "text": "def tweet_file_parser(file)\r\n\tstring = open(file,\"r\").read\r\n\tstring[0] = ''\r\n\tarray_of_names = string.split(\"\\n@\")\r\n\treturn array_of_names\r\nend", "title": "" }, { "docid": "05ed013abbfe1858e77df89e0406029b", "score": "0.5220273", "text": "def tweet_file_parser(file)\r\n\tstring = open(file,\"r\").read\r\n\tstring[0] = ''\r\n\tarray_of_names = string.split(\"\\n@\")\r\n\treturn array_of_names\r\nend", "title": "" }, { "docid": "76cecc5e2a1d629ce7fabf63e98ca8a5", "score": "0.5219082", "text": "def initialize(emails)\n @addresses = emails\n end", "title": "" }, { "docid": "813d936e883deb26c6ab33a756c574d3", "score": "0.5218415", "text": "def add_emails(emails)\n request_body = emails.map{ |email| {'key' => email, 'value' => '{}'} }.to_json\n response = do_request(Net::HTTP::Put, 'bulk', request_body)\n handle_response(response, emails.length.to_s + ' email(s) whitelisted.', 'Couldn\\'t whitelist email(s).')\nend", "title": "" }, { "docid": "0e31d461334a8d14cd852ed96f2243db", "score": "0.5209758", "text": "def extract_emails(emails)\n return [] if emails.blank?\n\n emails\n .split(',')\n .select { |email| ::EmailValidator.valid?(email) }\n .first(100)\n end", "title": "" }, { "docid": "b88075b8b7568b8b87186d045f66d7cc", "score": "0.52094966", "text": "def email_grab(prospects)\n logger = Logger.new(\"#{File.dirname(__FILE__)}/etc/daily.log\", 0, 100 * 1024 * 1024)\n logger.level = Logger::DEBUG\n\n signups = []\n prospects[\"prospect\"].each do |prospect|\n signups << prospect[\"email\"]\n end\n logger.info(\"Got prospects signed up #{signups.length}\")\n signups\nend", "title": "" }, { "docid": "bea8c3807c594427c78238670c99428c", "score": "0.5208684", "text": "def emails\n account['emails'] if setup?\n end", "title": "" }, { "docid": "baf5fb4c1920561fa14ec4714fb02ee0", "score": "0.51996017", "text": "def emails\n if page_info.nil?\n return nil\n end\n em = (page_info['emails'] || \"\").split(\"\\r\\n\")\n if em.empty?\n return []\n else\n return em\n end\n end", "title": "" }, { "docid": "a728d1f84cb3c25365de837673a4306c", "score": "0.51882905", "text": "def retrieve_credentials\n @auth_code = JSON.parse(File.read(@file))\n\n if @auth_code['access_token'].nil? || @auth_code['access_token'].empty?\n configuration_error\n end\n\n @auth_code\n\n rescue Errno::ENOENT\n authorize\n rescue JSON::ParserError\n configuration_error\n end", "title": "" }, { "docid": "5bd8d07751b18520255fa33ae908cd2b", "score": "0.51848984", "text": "def initialize(emails) #every time an email is made it gets turned to an instance variable \r\n @email = emails\r\n end", "title": "" }, { "docid": "043f1f1e4a2a0ffded89238d42484f83", "score": "0.51543397", "text": "def parse\n email_list.split(/, | |,/).uniq\n # binding.pry\n end", "title": "" }, { "docid": "e91d2672a1f669e3feec8e02034beb3f", "score": "0.51448065", "text": "def get_credentials\n client_id = Google::Auth::ClientId.from_file(credential_fpath)\n token_store = Google::Auth::Stores::FileTokenStore.new( :file => token_store_fp)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, OAuth2_SCOPE_read_photo, token_store)\n \n user_id = ENV['USER']\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI )\n puts \"Open #{url} in your browser and enter the resulting code:\"\n code = STDIN.gets\n # @@logger.debug \"gets code : #{code.inspect }\".green\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n \n # OK to use credentials\n # @@logger.debug \"Google API credentials : #{credentials.inspect}\"\n credentials\n end", "title": "" }, { "docid": "b5c1f9a58dcf150c112a218dcfbedd60", "score": "0.5128017", "text": "def orcid_api_emails(orcid:, bearer_token:)\n resp = RestClient.get \"#{APP_CONFIG.orcid.api}/v2.1/#{orcid}/email\",\n 'Content-type' => 'application/vnd.orcid+json', 'Authorization' => \"Bearer #{bearer_token}\"\n my_info = JSON.parse(resp.body)\n my_info['email'].map { |item| (item['email'].blank? ? nil : item['email']) }.compact\n rescue RestClient::Exception => e\n logger.error(e)\n []\n end", "title": "" }, { "docid": "25fba2de2dea411d5c8bcab2ca7a00ff", "score": "0.5125501", "text": "def read_files\n begin\n f = File.open(settings.subject_file, \"r\")\n session[:mms2_subject] = f.read.strip\n rescue\n session[:mms2_subject] = ''\n end\n \n begin\n f = File.open(settings.phones_file, \"r\")\n contents = f.read.strip\n session[:mms2_phones] = contents.split \"\\n\"\n rescue\n session[:mms2_phones] = Array.new\n end\n \nend", "title": "" }, { "docid": "3bdd44eccfe968f6afb3662676d69524", "score": "0.5124894", "text": "def get_user_emails\n emails = Hash.new\n if !person.blank?\n user_contactinfos = person.roles.collect{ |r| r.role_contactinfos.collect{|rc| rc.contactinfo }}.flatten.compact\n user_contactinfos.each do |c|\n emails.store(c.email_1, c.email_1) unless c.email_1.blank?\n emails.store(c.email_2, c.email_2) unless c.email_2.blank?\n emails.store(c.email_3, c.email_3) unless c.email_3.blank?\n end\n end\n logger.debug \"******** LOGIN: GET USER EMAILS array: #{emails} ***\"\n return emails\n end", "title": "" }, { "docid": "7ac7b64594871f304780213b040fad53", "score": "0.51232153", "text": "def GetUsers()\n if File.exist?(\"usernames_passwords.rpwf\")\n username_password_file = IO.read(\"usernames_passwords.rpwf\")\n username_passwords = username_password_file.split(\"#{@pairs_delimiter}\")\n username_password_pairs = [[]]\n i = 0\n while i < username_passwords.length()\n if i == 0\n username_password_pairs = [username_passwords[i].split(\"#{@individual_delimiter}\")]\n else\n username_password_pairs.push(username_passwords[i].split(\"#{@individual_delimiter}\"))\n end\n i += 1\n end\n @username_password_pairs = username_password_pairs\n else\n username_password_file = File.new(\"usernames_passwords.rpwf\", \"w\")\n username_password_file.close()\n end\n end", "title": "" }, { "docid": "f213458851b715461742a7dad60af653", "score": "0.5122044", "text": "def get_credentials(file)\n result = YAML.load_file(file)\n raise Exception \"No JIRA URL defined (url)\" unless result.has_key?('url')\n raise Exception \"No JIRA username defined (username)\" unless result.has_key?('url')\n raise Exception \"No JIRA password defined (password)\" unless result.has_key?('url')\n return result\nend", "title": "" }, { "docid": "624a0b116cde8607aca0ad1eaf0d2f46", "score": "0.5117322", "text": "def remove_mos_email_from_file(output_file)\n if File.exist?(output_file)\n (mos_username,mos_password) = get_mos_details()\n mos_head = mos_username.upcase.split(\"@\")[0]\n mos_tail = mos_username.upcase.split(\"@\")[1]\n array = []\n lines = File.readlines(output_file)\n if lines.to_s.match(/#{mos_head}/)\n lines.each do |line|\n if line.match(/#{mos_head}/)\n line = line.gsub(/#{mos_head}/,\"\")\n line = line.gsub(/#{mos_tail}/,\"\")\n end\n array.push(line)\n end\n File.delete(output_file)\n file = File.open(output_file,\"w\")\n array.each do |line|\n file.puts line \n end\n file.close \n end\n end\n return\nend", "title": "" }, { "docid": "ac03817af8fc2c5a84837144f44cf1d4", "score": "0.5102399", "text": "def fillArray!\n puts \"Setting your credentials\"\n user = ask(\"What's your github user name (Won't work with your email) ?\")\n password = ask(\"What's your git password ?\\n(This won't be logged, used to get an OAuth token)\") { |q| q.echo = false }\n self.class.basic_auth user, password\n\n @config['credentials']['user'] = user\n @config['credentials']['token'] = getToken(user,password)\n\n puts \"Now let's set up your repo you want to send your pull requests to\"\n @config['remote']['user'] = ask(\"What's the user you want to send your pull requests to ? \")\n @config['remote']['repo'] = ask(\"What's the user's repo ?\")\n\n puts \"Writing to config file : .git/githelper.config.yml\"\n header = \"# GithubHelper config file\\n# You can edit your configuration here\\n\"\n yaml = @config.to_yaml\n\n output = header + yaml\n begin\n File.open('.git/githelper.config.yml', 'w') {|f| f.write(output) }\n rescue Exception\n puts \"Can't write to .git/githelper.config.yml, are you sure this a git directory?\"\n raise\n end\n\n end", "title": "" }, { "docid": "0852503ecf6dd13eade42d1114da96a7", "score": "0.509426", "text": "def netrc_file; end", "title": "" }, { "docid": "cd98dac9f662ddf3bbabda47740baf3d", "score": "0.50900173", "text": "def export_emails(file_name, arr)\n csv_headers = [\"Client:\", \"Location:\", \"Internal Branded Name:\", \"CLS emails:\", \"Hub Emails:\"]\n CSV.open(file_name, \"wb\") do |csv|\n csv << csv_headers\n end\n i = 0\n while i < arr.length\n CSV.open(file_name, \"a+\") do |csv|\n formatted = []\n formatted.push(arr[i].client_name, arr[i].loc_name, arr[i].loc_internal_name, arr[i].loc_cls_emails, arr[i].loc_hub_emails)\n csv << formatted\n i = i+1\n end\n end\n puts \"Emails exported!\"\nend", "title": "" }, { "docid": "150ade5d4064faf5b4051fc22e585f1c", "score": "0.5089153", "text": "def initialize(email_addresses)\n @email_addresses = email_addresses\n end", "title": "" }, { "docid": "a749f72945a079bc302bdd2724c1c74d", "score": "0.5082085", "text": "def generate_email_list(num_emails)\r\n puts \"Generating Email list\"\r\n emails = []\r\n while emails.length < num_emails\r\n # Create randomized strings of letters for name and domain\r\n name = (0...15).map{(97 + rand(26)).chr}.join\r\n domain = (0...10).map{(65 + rand(26)).chr}.join\r\n email = name+'@'+domain+'.com'\r\n\r\n # First fill 50% of array with non-repeating emails\r\n if emails.length < num_emails/2\r\n emails << email\r\n # Then fill the rest of array with duplicating emails at random intervals \t\r\n else\r\n emails.insert(rand(emails.length), email)\r\n emails.insert(rand(emails.length), email)\r\n end\r\n end\r\n puts \"Email List Complete\"\r\n puts \"Displaying first ten emails\"\r\n emails[0...10].each {|email| puts email}\r\n return emails\r\nend", "title": "" }, { "docid": "f27f03a25a2b203113b0379215029241", "score": "0.50724447", "text": "def emails\n email_list.is_a?(String) ? email_list.split(',') : nil\n end", "title": "" }, { "docid": "2b820a6e8c8b6a860d1ebebb18dd4f1e", "score": "0.50619614", "text": "def authorize(credentials_file_name=$0)\n credentials_file = credentials_file_name + FILE_POSTFIX\n\n if File.exist? credentials_file\n File.open(credentials_file, 'r') do |file|\n credentials = JSON.load(file)\n @authorization.access_token = credentials['access_token']\n @authorization.client_id = credentials['client_id']\n @authorization.client_secret = credentials['client_secret']\n @authorization.refresh_token = credentials['refresh_token']\n @authorization.expires_in = (Time.parse(credentials['token_expiry']) - Time.now).ceil\n if @authorization.expired?\n @authorization.fetch_access_token!\n save(credentials_file)\n end\n end\n else\n auth = @authorization\n url = @authorization.authorization_uri().to_s\n server = Thin::Server.new('0.0.0.0', 8080) do\n run lambda { |env|\n # Exchange the auth code & quit\n req = Rack::Request.new(env)\n auth.code = req['code']\n auth.fetch_access_token!\n server.stop()\n [200, {'Content-Type' => 'text/html'}, RESPONSE_HTML]\n }\n end\n\n Launchy.open(url)\n server.start()\n\n save(credentials_file) if @authorization.refresh_token\n end\n\n return @authorization\n end", "title": "" }, { "docid": "abd95966e5c3a3114f0422186c3e0dac", "score": "0.5060883", "text": "def read_email\n question.validate(/^[a-z0-9._%+-]+@([a-z0-9-]+\\.)+[a-z]{2,6}$/i)\n question.prompt(question.statement) if question.error\n with_exception { read_string }\n end", "title": "" }, { "docid": "d38ca0ba05a1a72c9b137294d62d5695", "score": "0.50600296", "text": "def populate\n data = ERB.new(File.read(AUTH_FILE), nil, '<>').result(binding)\n\n @static_auth.load!(StringIO.new(data))\n end", "title": "" }, { "docid": "7b941c7e87d34c830199ba4c8109a0a2", "score": "0.50591546", "text": "def netrc_entries\n open('.netrc').lines do |line|\n yield(*line.split)\n end\nend", "title": "" }, { "docid": "d1e729f316dc17aa6f66b377981544ef", "score": "0.5057664", "text": "def load_file(filename)\n ::File.readlines(filename).each do |line|\n line.chomp!\n\n if line.scan(':').size != 2\n fail Dav::Exception, 'Malformed htdigest file. Every line should contain 2 colons'\n end\n\n (username, realm, a1) = line.split(':')\n\n unless a1 =~ /^[a-zA-Z0-9]{32}$/\n fail Dav::Exception, 'Malformed htdigest file. Invalid md5 hash'\n end\n\n @users[realm + ':' + username] = a1\n end\n end", "title": "" }, { "docid": "a2dedb101ed584470bd7d24ebaf5d1bc", "score": "0.50564146", "text": "def get_data_gitcreds(paths)\n\n paths.each do |file|\n\n file.chomp!\n\n data = read_file(\"#{file}\")\n\n print_good(data.strip)\n\n \t loot_path = store_loot(\"git-credentials.#{file}\", \"text/plain\", session, data, \"git-credentials_#{file}\", \"Git #{file} File\")\n\n print_good(\"Downloaded -> #{loot_path}\")\n\n end\n\n end", "title": "" }, { "docid": "484ff1e3b2a93ca9ef22438f182c2cf0", "score": "0.5055979", "text": "def read\n auth_info = [] << ADDRESS_TYPES[ @file.read(2).unpack('n').first ]\n\n 4.times do\n length = @file.read(2).unpack('n').first\n auth_info << @file.read(length)\n end\n AuthInfo[*auth_info]\n end", "title": "" }, { "docid": "6131dd67a6b47f792b6d04e83955b6f3", "score": "0.5054223", "text": "def employees_text filename\n array = []\n File.open(filename,\"r\").each_line {|l| array << l.delete(\"\\n\")}.close\n array\nend", "title": "" }, { "docid": "150b3b3785e9745f0b8b80225b1288a0", "score": "0.505192", "text": "def get_email_list\n url = ApiRequest.base_path(\"questionpro.survey.getEmailList\")\n result = self.class.get(url, body: self.options)\n\n self.full_response = result\n self.status = result['status']\n \n email_list = EmailList.new(result['response']['emailList'])\n \n return email_list\n end", "title": "" }, { "docid": "8b1fc4286ec818a9236e3079cf896fa1", "score": "0.504769", "text": "def initialize(csv_emails)\n @csv_emails = csv_emails\n end", "title": "" }, { "docid": "a5fb38b6e23c76d3cf865ed3d9e9b952", "score": "0.504411", "text": "def emails\n raise AuthenticationRequired, \"To view emails, you must be authenticated\" if Api.api.read_only?\n get(\"/user/emails\")['emails']\n end", "title": "" }, { "docid": "f4b49ce221927f889569e3b3335f6e0a", "score": "0.50430363", "text": "def get_email_settings(user_email)\n config_file = @config_dir.join(user_email)\n raise \"Email settings for user '#{user_email}' not found\" unless config_file.exist?\n JSON.parse config_file.read\n end", "title": "" }, { "docid": "0ecc74796c0db0aef059a7aef3c393a3", "score": "0.50401217", "text": "def login_system (email,password,load_from_file)\r\n if load_from_file == true\r\n @password_from_file = File.readlines 'password.txt'\r\n @password_from_file.each_with_index{|line, i| puts \"#{i+1}: #{line}\"}\r\n @email_from_file = File.readlines 'email.txt'\r\n @email_from_file.each_with_index{|line,i| puts \"#{i+1}: #{line}\"}\r\n @email_for_password_reset = @email_from_file\r\n @login_element.send_keys @email_from_file\r\n @password_element.send_keys @password_from_file\r\n @submit_element.submit\r\n \r\n\r\n elsif load_from_file == false \r\n @email = email\r\n @password = password\r\n @email_for_password_reset = password\r\n @password_element.send_keys @password\r\n @login_element.send_keys @email\r\n @submit_element.submit\r\n \r\n else\r\n raise \"Uh oh you need to only put true or false in load_from_file\"\r\n end\r\n end", "title": "" }, { "docid": "ced9f67cc9ccf958534991760aeec963", "score": "0.50360656", "text": "def auth_user_file path\n File.open(path, 'r').each do |line|\n if line.include? \"AuthUserFile\"\n line.chomp!.split[1]\n end\n end\n end", "title": "" }, { "docid": "e1e11d8d438733bfb7f9b7619d147b00", "score": "0.503391", "text": "def parse\n array = emails.gsub(\",\", \"\").split(\" \").uniq\n end", "title": "" }, { "docid": "6a43cfb32fa871cf3ff5ec516a730eff", "score": "0.5026695", "text": "def verify_batch(emails, options = {})\n if options['headers'].blank?\n options['headers'] = {}\n end\n\n date = Time.current.strftime('%m-%d-%y %H-%M')\n options['headers'].merge!(\n 'Content-Type' => 'text/csv',\n 'X-Kickbox-Filename' => \"Batch Email Verification #{date}\"\n )\n\n emails = emails.join(\"\\n\")\n @client.put(\"/verify-batch\", emails, options)\n end", "title": "" }, { "docid": "dcde36d857725d1c0944dc71e9d2a5ff", "score": "0.50149", "text": "def just_email(myArr)\n logger = Logger.new(\"#{File.dirname(__FILE__)}/etc/daily.log\", 0, 100 * 1024 * 1024)\n logger.level = Logger::DEBUG\n emails = Array.new\n\n logger.info(\"Just_email starting array #{myArr[0]}\")\n myArr.each do |i|\n # logger.info(\"i is #{i}\")\n # logger.info(\"email element of i as clled is #{i[:email]}\")\n emails << i['email']\n end\n logger.info(\"Ending array of #{emails[0]}\")\n emails\nend", "title": "" }, { "docid": "b8d6ddb1c286f740034eb1fbc5277419", "score": "0.5014416", "text": "def download_emails\n\tbegin\n\t\temails = []\n\t\timap = Net::IMAP.new @server, port:@port, ssl:@use_ssl\n\t\timap.login @user, @pass\n\t\timap.select @folder\n\t\timap.search([\"SINCE\", \"#{@lastDate}\"]).each do |seqno|\n\t\t\tnext if @lastSeqno >= seqno\n\t\t\tputs seqno\n\t\t\tbody = imap.fetch(seqno, 'RFC822')[0].attr['RFC822']\n\t\t\temail = Mail.new(body)\n\t\t\temails << [email, seqno]\n\t\tend\n\t\timap.logout\n\t\timap.disconnect\n\t\temails\n\trescue => e\n\t\traise e.message\n\tend\nend", "title": "" }, { "docid": "4868a4e5cbd24748053189388691c6c7", "score": "0.5011246", "text": "def test_email(ques, acc_file)\n sendgrid_category \"customer_test\"\n\n @questionnaire = ques\n @url = \"http://foundershookup.com\"\n @support_email = \"test_support@foundershookup.com\"\n @support_phone = \"+1-415-309-8860\"\n\n attachments['application.txt'] = File.read(acc_file)\n mail( :to => ques.email,\n :subject => \"accelerator test email\"\n )\n end", "title": "" }, { "docid": "81ce647d5f3e84a1b5ddbd6de5f6afd7", "score": "0.50082904", "text": "def authorize(interactive)\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil? && interactive\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the resulting code after authorization\\n\" + url\n code = $stdin.readline\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "d827e6a3ea7f9454e246bdc1b0838c0f", "score": "0.50053626", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end", "title": "" }, { "docid": "b1235cb727ba95d7fd479dc86c342f4a", "score": "0.5002945", "text": "def add_email(input)\n emails.push input\n end", "title": "" }, { "docid": "9b094742da1a8a8a20c91ee6acd2f8c6", "score": "0.49989823", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Opening the browser at: \" + url\n `open '#{url}'`\n puts \"Please enter resulting code:\"\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "cd7c8d80069f4e734b15f63a9d387c92", "score": "0.49963242", "text": "def getServiceNodeIPs()\n ipadresses = Array[]\n\n File.open(\"servicenode-attach-ips\", \"r\").each_line do |line|\n ipadresses.push(line.strip)\n end\n\n ipadresses\nend", "title": "" }, { "docid": "cc4707937025dd0399b1fb0e831beaba", "score": "0.49938855", "text": "def parse\n @mails.split(\",\").each do |email|\n email = email.strip\n if email.present? && email != @current_user.email && Devise.email_regexp.match?(email)\n @valid_mails.push(email)\n else\n @invalid_mails.push(email)\n end\n end\n\n @existing_mails = User.where(\n id: @project.collaborations.pluck(:user_id)\n ).pluck(:email)\n end", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.4989153", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.4989153", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.4989153", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.4989153", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" }, { "docid": "235574bb3a1e1fc1a25c99ee3a92afca", "score": "0.4989153", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "title": "" } ]
d22d5cfe83cb76080b4907b0f6c6f495
finds or creates soucy record for pilot
[ { "docid": "7207716d1c85508a86e4a613471e5475", "score": "0.60275984", "text": "def engage_soucy_for_pilot(pilot)\n soucy = SoucyResult.where(:pilot_id => pilot.id, :year => @year).first_or_create\n to_be_results = PcResult.joins(:c_result => :contest).where(\n \"pilot_id = ? and contests.region != 'National' and year(contests.start) = ?\",\n pilot.id, @year).all\n soucy.update_results(to_be_results)\nend", "title": "" } ]
[ { "docid": "b70710be486771b1ed942f00e5744c96", "score": "0.58109325", "text": "def create\n @ppi = Ppi.new(ppi_params)\n @document = Document.find(params[:document_id])\n dup = @document.ppis.where(\"(gene1 = ? and gene2 = ?) and (exp = ?) and (itype = ?)\",\n params[:ppi][:gene1], params[:ppi][:gene2], \n params[:ppi][:exp], params[:ppi][:itype]\n ).first\n\n unless dup.nil?\n render :nothing => true, :status => :conflict\n return\n end\n\n @ppi.document_id = @document.id\n respond_to do |format|\n if @ppi.save\n format.html { redirect_to @ppi, notice: 'Ppi was successfully created.' }\n format.json { render :show, status: :created, location: @ppi }\n else\n format.html { render :new }\n format.json { render json: @ppi.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90c6b050ad8ef22a63b61cd7cb8a10f7", "score": "0.57542187", "text": "def create\n @pilot = Pilot.new(params[:pilot], :without_protection => true)\n @pilot.surname = params[:pilot][:surname].strip\n @pilot.competition ||= competition\n redirect_to referer_base + (@pilot.save ? '/ok' : '/ko') + \".html?competition_id=#{competition.id}\"\n rescue\n logger.info $!\n redirect_to referer_base + \"/ko.html?competition_id=#{@pilot.competition_id}\"\n end", "title": "" }, { "docid": "572156af9f326371d0363948d7b13814", "score": "0.57260656", "text": "def get_existing_palletizing_criteria_setup\n #--------------------------------------------------------------------------\n #try to find an existing record, if not found create a new one by copying\n #the values from pallet_criteria_setup (setup for entire schedule)\n #--------------------------------------------------------------------------\n begin \n criteria = PalletizingCriterium.find_by_carton_setup_id(session[:current_carton_setup].id)\n if !criteria\n criteria = PalletizingCriterium.new\n schedule_criteria = PalletCriterium.find_by_production_schedule_id(session[:current_prod_schedule].id)\n schedule_criteria.export_attributes(criteria)\n criteria.carton_setup = session[:current_carton_setup]\n criteria.create\n end\n \n return criteria\n rescue\n raise \"Palletizing criteria could not be fetched for the carton setup. Reported exception: \" + $!\n \n end\nend", "title": "" }, { "docid": "4c83b59bca813cf1944cfbe692083a83", "score": "0.5691699", "text": "def CreateOrUpdatePI(pi)\n log_message \"CreateOrUpdatePI: this shouldn't happen - thePI was nil\" if pi.nil?\n begin \n pi.save!\n rescue ActiveRecord::RecordInvalid => error\n log_message \"CreateOrUpdatePI: raised an error for an investigator with the id of '#{pi.username} with an error of #{error.inspect}\"\n end \n pi\nend", "title": "" }, { "docid": "663204bc129a3d39f703e93bf5ae022a", "score": "0.5679402", "text": "def add_point(p)\n @shapefile.transaction do |tr|\n tr.add(GeoRuby::Shp4r::ShpRecord.new(\n GeoRuby::SimpleFeatures::Point.from_x_y(p[:coords][0],p[:coords][1]),\n :handle.to_s => p[:user_name],\n :text.to_s => p[:text],\n :time.to_s => p[:time],\n :hashtags.to_s => p[:hashtags],\n :loc.to_s => p[:location],\n :urls.to_s => p[:urls]))\n end\n end", "title": "" }, { "docid": "fd5c1e61eef2d66d16b7f99170b2595e", "score": "0.5655795", "text": "def create_or_retrieve_poi(poi)\n poi = Poi.new(poi)\n search = Poi.find_by(google_place_id: poi.google_place_id)\n if search.present?\n search\n else\n poi.save\n poi\n end\n end", "title": "" }, { "docid": "4cfc8a043f982a43a88620eb9a0c4978", "score": "0.56465656", "text": "def submitAddPoi(poi)\n poi.submitAdd() ;\n\n @poiTable[poi.id] = poi ;\n @poiList.push(poi) ;\n \n return poi ;\n end", "title": "" }, { "docid": "2f96e9bb035fbed2d41997bd04f5253f", "score": "0.5578044", "text": "def save_record_to_database(record)\n #if ScraperWiki.select(\"* from swdata where council_reference = '#{record['council_reference']}'\").empty?\n ScraperWiki.save_sqlite(['council_reference'], record)\n #else\n #puts \"Skipping already saved record \" + record['council_reference']\n #end\nend", "title": "" }, { "docid": "2f96e9bb035fbed2d41997bd04f5253f", "score": "0.5578044", "text": "def save_record_to_database(record)\n #if ScraperWiki.select(\"* from swdata where council_reference = '#{record['council_reference']}'\").empty?\n ScraperWiki.save_sqlite(['council_reference'], record)\n #else\n #puts \"Skipping already saved record \" + record['council_reference']\n #end\nend", "title": "" }, { "docid": "f4edad7e41a19fa0c224e3a09beb4596", "score": "0.5568808", "text": "def engage_student_for_pilot(pilot)\n student = CollegiateIndividualResult.where(:pilot_id => pilot.id, :year => @year).first_or_create\n to_be_results = PcResult.joins(:c_result => :contest).where(\n \"pilot_id = ? and year(contests.start) = ?\", pilot.id, @year).all\n student.update_results(to_be_results)\nend", "title": "" }, { "docid": "8ad345ccd7c94776a434ae9fa09dd317", "score": "0.5568045", "text": "def save_record\n if !saved_already?\n if valid?\n CONNECTION.execute(\"INSERT INTO #{table} (#{string_field_names}, timeslot_id, location_id) VALUES \n (#{stringify_self}, #{timeslot_id}, #{location_id});\")\n else\n false\n end\n else\n update_record\n end\n end", "title": "" }, { "docid": "abea37dbbc9152945657f3dbe038385f", "score": "0.5531137", "text": "def set_pilot\n @pilot = Pilot.find(params[:id])\n end", "title": "" }, { "docid": "08595d8c0950961f46289c0ab7218378", "score": "0.55136776", "text": "def park parking_lot\n \tupdate(parking_lot_id: parking_lot.id) \n \tlog_parking_history_in\n \tparking_lot.make_busy\n\n \tparking_lot.slot_number\n end", "title": "" }, { "docid": "8e1d81c20ccb3a20e4809fbba72df8b7", "score": "0.5511435", "text": "def create_reservoir(code, name, capacity, current_supply, current_supply_captured_on, lon, lat)\n reservoir = Reservoir.find_or_initialize_by(code: code)\n reservoir.name = name\n reservoir.capacity = capacity\n reservoir.current_supply = current_supply\n reservoir.current_supply_captured_on = Date.parse(current_supply_captured_on) - 1.day\n reservoir.lonlat = \"POINT(#{lon} #{lat})\"\n reservoir.save!\nend", "title": "" }, { "docid": "ca1cffd9e16825b1affa73dcaa0c711d", "score": "0.55104333", "text": "def record_plant_line(plant_line_name, plant_variety_id) # workshop notes: add the genetic status here: ,genetic_status]\n request = Net::HTTP::Get.new(\"/api/v1/plant_lines?plant_line[query][plant_line_name]=#{URI.escape plant_line_name}\", @headers)\n response = call_bip request\n if response['meta']['total_count'] == 0\n create_record('plant_line',\n plant_line_name: plant_line_name,\n plant_variety_id: plant_variety_id # <<- workshop notes: add a comma here , so it looks like: plant_variety_id: plant_variety_id,\n # genetic_status: genetic_status # remove the first '#' hashkey. This will add the submission of the genetic status object to the database.\n )\n else\n response['plant_lines'][0]['id']\n end\nend", "title": "" }, { "docid": "a0c98517b51f834f6a9d3eb57930457c", "score": "0.54972667", "text": "def set_parkinglot\n @parkinglot = Parkinglot.find(params[:id])\n end", "title": "" }, { "docid": "94369f11007f1179e5e2d22ddf8e9fd8", "score": "0.5495787", "text": "def create_savepoint\n @connection.save\n execute(\"SAVEPOINT #{current_savepoint_name}\")\n end", "title": "" }, { "docid": "a57a52fc4fd5e9ee6d9b11fedeb6abfb", "score": "0.54890877", "text": "def add_new_patron\n p = Patron.new\n print \"Name: \"\n p.name = gets.chomp\n print \"Email: \"\n p.email = gets.chomp\n\n p.isbn = gets.chomp\n\n p.save\n found_it(record)\nend", "title": "" }, { "docid": "93d2a1b602c70020a707ee878b673472", "score": "0.54855394", "text": "def set_pilot\n @pilot = Pilot.find(session[:pilot_id])\n end", "title": "" }, { "docid": "7433b052a3a88d45d9de181d93608611", "score": "0.54808396", "text": "def create\n @quality_rating = QualityRatingDataPoint.new(params[:quality_rating_data_point])\n @study = Study.find(@quality_rating.study_id)\n @project = Project.find(@study.project_id)\n\t\t@exists = QualityRatingDataPoint.where(:study_id => params[:quality_rating_data_point][:study_id]).all\n\t\tif !@exists.nil?\n\t\t\tfor qr in @exists\n\t\t\t\tqr.destroy\n\t\t\tend\n\t\tend\n\t\tif @saved = @quality_rating.save\n\t\t @message_div = \"saved_indicator_2\"\n\t\t #@table_container = \"quality_rating_data_points_table\"\n\t\t\t#@table_partial = \"quality_rating_data_points/table\"\n\t\telse\n\t \tproblem_html = create_error_message_html(@quality_rating.errors, \"\")\n\t\t\tflash[:modal_error] = problem_html\n\t\t\t@error_partial = \"layouts/modal_info_messages\"\n\t end\n\t\t@error_div = \"validation_message_rtg\"\t\n\t\trender \"shared/saved.js.erb\"\n end", "title": "" }, { "docid": "b914aa3b012cf618197ad9aef7c9f644", "score": "0.5480325", "text": "def create\n @pending_practical = PendingPractical.new(pending_practical_params)\n\n if PendingPractical.exists?(raspberry_pi_id: pending_practical_params[:raspberry_pi_id])\n redirect_to remote_path, alert: \"There is already a pending practical for that device..\"\n else\n respond_to do |format|\n if @pending_practical.save\n format.html { redirect_to dashboard_path, notice: 'Pending practical was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end\n end", "title": "" }, { "docid": "6694f1fb82b79f4b3e289a35e62be648", "score": "0.5475652", "text": "def save_record_to_database(record)\n #if ScraperWiki.select(\"* from swdata where 'council_reference'='#{record['council_reference']}'\").empty?\n # ScraperWiki.save_sqlite(['council_reference'], record)\n #else\n # puts \"Skipping already saved record \" + record['council_reference']\n #end\nend", "title": "" }, { "docid": "6694f1fb82b79f4b3e289a35e62be648", "score": "0.5475652", "text": "def save_record_to_database(record)\n #if ScraperWiki.select(\"* from swdata where 'council_reference'='#{record['council_reference']}'\").empty?\n # ScraperWiki.save_sqlite(['council_reference'], record)\n #else\n # puts \"Skipping already saved record \" + record['council_reference']\n #end\nend", "title": "" }, { "docid": "0e54c9b9a61f04c0a412d764175fde69", "score": "0.54650474", "text": "def create\n x = PoliceStation.all.pluck(:id).sort[-1] + 1\n @police_station = PoliceStation.new(id: x, name: admin_police_station_params[\"name\"], police_type: admin_police_station_params[\"police_type\"].to_i, prefecture_id: admin_police_station_params[\"prefecture_id\"].to_i)\n\n respond_to do |format|\n if @police_station.save\n format.html { redirect_to admin_police_stations_path, notice: 'Estación Policial ha sido creada con éxito.' }\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "59d86938f3f6ca6d4ad5efc47225427a", "score": "0.546479", "text": "def save()\n sql = \"INSERT INTO plastics (type, existence, weight, conversion_factor, recycable) VALUES ($1, $2, $3, $4, $5)\n RETURNING id;\"\n values=[@type, @existence, @weight, @conversion_factor, @recycable]\n results = SqlRunner.run(sql, values)\n @id = results.first()['id'].to_i\nend", "title": "" }, { "docid": "056e877427454204bcf42d0e3b1936d9", "score": "0.54619193", "text": "def add_politician(politician)\n @list_of_politicians << [politician.name, politician.party]\n create_another_politician\nend", "title": "" }, { "docid": "0cc8df050ff8d8b4c7cca16449974daf", "score": "0.54433167", "text": "def create\n @po_shipment = PoShipment.new(po_shipment_params)\n\n respond_to do |format|\n if @po_shipment.save\n @item_lot = ItemLot.create(item_id: @po_shipment.po_line.item_id)\n inspection_level = MasterType.where(:type_name => 'Level 1', :type_category => 'inspection_level').pluck(:id)[0]\n inspection_method = MasterType.where(:type_name => 'single', :type_category => 'inspection_method').pluck(:id)[0]\n inspection_type = MasterType.where(:type_name => 'Normal', :type_category => 'inspection_type').pluck(:id)[0]\n\n @quality_lot = QualityLot.new(:po_header_id => @po_shipment.po_line.po_header_id, :po_line_id => @po_shipment.po_line.id, :item_revision_id => @po_shipment.po_line.item_revision_id, :lot_quantity => @po_shipment.po_shipped_count, :quantity_on_hand => @po_shipment.po_shipped_count,\n :inspection_level_id => inspection_level, :inspection_method_id => inspection_method, :inspection_type_id => inspection_type, :lot_unit => @po_shipment.po_shipped_unit, :lot_self => @po_shipment.po_shipped_shelf)\n @quality_lot.lot_inspector = current_user\n\n if @quality_lot.save\n # lot_count = (@po_shipment.po_line.item.quality_lots.count == 0) ? 1 : self.po_line.item.quality_lots.count\n @item_lot.update_attribute(:quality_lot_id , @quality_lot.id)\n # @quality_lot.set_lot_control_no\n end\n\n @po_shipment.update_attribute(:quality_lot_id , @quality_lot.id)\n quality_lot = @po_shipment.quality_lot\n\n # unless quality_lot.lot_control_no.present?\n # quality_lot.delete\n # @po_shipment.delete\n # end\n # else\n # @po_shipment.set_quality_on_hand\n quality_lot = @po_shipment.quality_lot\n po_shipmnt = Hash.new\n @po_shipment.attributes.each do |key, value|\n po_shipmnt[key] = value\n end\n po_shipmnt[\"quantity_open\"] = @po_shipment.po_line.po_line_quantity - @po_shipment.po_line.po_line_shipped\n po_shipmnt[\"shipped_status\"] = @po_shipment.po_line.po_line_status\n po_shipmnt[\"po_shipped_status\"] = @po_shipment.po_line.po_header.po_status\n po_shipmnt[\"shipment_shipped_status\"] = @po_shipment.close_all_po_lines?(@po_shipment.id)\n po_shipmnt[\"po_shipped_id\"] = @po_shipment.po_line.po_header_id\n po_shipmnt[\"part_number\"] = @po_shipment.po_line.item.item_part_no\n po_shipmnt[\"po\"] = @po_shipment.po_line.po_header.po_identifier\n po_shipmnt[\"customer\"] = @po_shipment.po_line.organization.organization_name if @po_shipment.po_line.organization\n po_shipmnt[\"lot_id\"] = quality_lot.id if quality_lot.present?\n po_shipmnt[\"company_name\"] = CompanyInfo.first.company_name\n format.html { redirect_to po_shipmnt, notice: 'PO received was successfully created.' }\n format.json { render json: po_shipmnt, status: :created, location: @po_shipment }\n # end\n\n else\n format.html { render action: \"new\" }\n format.json { render json: {errors: @po_shipment.errors.first} }\n end\n end\n\n end", "title": "" }, { "docid": "c15bc80dae8978ea57b786c727ba92e2", "score": "0.5441744", "text": "def save()\n if(@pri_id && @pri_id != 0)\n update()\n else\n insert()\n end\n end", "title": "" }, { "docid": "58baa4f8683b12e7fbf142e8da620a70", "score": "0.543642", "text": "def save\n _create_record\n end", "title": "" }, { "docid": "e9f5b8d0ee345569e193d7fcd752ba2a", "score": "0.5427531", "text": "def on(priceable)\n pricings.create :priceable => priceable\n end", "title": "" }, { "docid": "300126ca45e66fd84e647f1169998203", "score": "0.54227656", "text": "def create\n @pilot = Pilot.new(params[:pilot])\n @pilot.company = current_user.company\n\n respond_to do |format|\n if @pilot.save\n format.html { redirect_to @pilot, notice: 'Pilot was successfully created.' }\n format.json { render json: @pilot, status: :created, location: @pilot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pilot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "180428b9cac348f90b1fd0af5d4ded95", "score": "0.54222107", "text": "def create\n @pilot = Pilot.new(pilot_params)\n\n respond_to do |format|\n if @pilot.save\n format.html { redirect_to @pilot, notice: 'Pilot was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pilot }\n else\n format.html { render action: 'new' }\n format.json { render json: @pilot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "134b45386e07f2a3234fcdd841c0005e", "score": "0.5418599", "text": "def create\n @question_point = QuestionPoint.new(question_point_params)\n @question_point.user = current_user\n @question_point.point = 1\n\n begin\n @question_point.save!\n redirect_to Question.find(question_point_params[:question_id])\n rescue ActiveRecord::RecordNotUnique => e\n if e.message == 'SQLite3::ConstraintException: UNIQUE constraint failed: question_points.extra'\n # Do your thing....\n end\n end\n\n end", "title": "" }, { "docid": "d2ccf2c03b3072f0fe5a595e20b3d4c5", "score": "0.5405477", "text": "def save()\n # connect to the database\n db = PG.connect({dbname: 'bounty_tracker', host: 'localhost'})\n # write INSERT sql\n sql = \"INSERT INTO bounties (name, species, value, last_location) VALUES ($1, $2, $3, $4) RETURNING id \"\n # create a values array for exec_prepared statement\n values = [@name, @species, @value, @last_location]\n # prepare the statement\n db.prepare(\"save\", sql)\n # run the prepared statement\n @id = db.exec_prepared(\"save\", values)[0][\"id\"].to_i\n # close the db\n db.close()\n end", "title": "" }, { "docid": "0b6b9ad8c74dc1921e17afe0411da3a4", "score": "0.5401248", "text": "def add_parameters_unique_record\n parameter = Parameter.first\n \n unless parameter\n parameter = Parameter.new\n parameter.save\n end\n end", "title": "" }, { "docid": "5c074b82879d48fca6502cab1b257d3a", "score": "0.53997254", "text": "def create(row)\n puts 'Adding row...'\n Stations.create(\n :sid => row[0],\n :name => row[1],\n :terminalname => row[2],\n :lastCommWithServer => row[3],\n :lat => row[4],\n :long => row[5],\n :installed => row[6],\n :locked => row[7],\n :installdate => row[8],\n :temporary => row[9],\n :public => row[10],\n :nbBikes => row[11],\n :nbEmptyDocks => row[12],\n :latestUpdateTime => row[13]\n ).save\n # end\nend", "title": "" }, { "docid": "94c9b4ace4a30c9f55912a9ab25a8aa5", "score": "0.53992677", "text": "def set_parking_lot\n @parking_lot = ParkingLot.find(params[:id])\n end", "title": "" }, { "docid": "9fb68792e820e3467f2132e3bf1f5ce0", "score": "0.5389379", "text": "def save()\n if(@pro_id) #if the row already exists\n update()\n else\n insert()\n end\n end", "title": "" }, { "docid": "c193947223693850764fcaab49f6276f", "score": "0.53817743", "text": "def new_tracks\n\n tmp_day=1\n (@feature.sprint.start .. @feature.sprint.finish).each do |one_day|\n if Sprint.is_commercial_day(one_day)\n track = Track.new\n track.task_id=id\n track.sprint_id = feature.sprint.id\n track.day=tmp_day\n tmp_day=tmp_day+1\n if one_day<start\n track.pending=0\n else\n track.pending=effort\n end\n track.save\n end\n end\n end", "title": "" }, { "docid": "b9a7282c46e89291764415992eca95e4", "score": "0.5375068", "text": "def set_parkingslot\n @parkingslot = Parkingslot.find(params[:id])\n end", "title": "" }, { "docid": "4822769a7dfc68d1bf40b77978b1c7a4", "score": "0.53740317", "text": "def create_lot(data)\n create(\"lots\", data).first\n end", "title": "" }, { "docid": "0b219bd7b0e455b376044136daf7a7ac", "score": "0.53735614", "text": "def create\n @quality_lot = QualityLot.new(quality_lot_params)\n @quality_lot.lot_inspector = current_user\n\n respond_to do |format|\n if @quality_lot.save\n @quality_lot.after_create_values\n format.html { redirect_to(@quality_lot, :notice => 'Quality lot was successfully created.') }\n format.json { render :json => @quality_lot, :status => :created }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @quality_lot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d930ce51b6f38b327999514ab15cd1a2", "score": "0.53673726", "text": "def save\n sql = \"INSERT INTO pets (name, type, pet_store_id) VALUES ('#{@name}', '#{@type}', #{@pet_store_id}) RETURNING *\"\n pet = SqlRunner.run(sql).first\n @id = pet ['id'].to_i\n end", "title": "" }, { "docid": "6ae9e49d98ebe99f91736f92497ee9ba", "score": "0.53646165", "text": "def create(record); end", "title": "" }, { "docid": "872921531ee050328cb5ad9d997e25a1", "score": "0.536264", "text": "def set_recordpltkt\n @recordpltkt = Recordpltkt.find(params[:id])\n end", "title": "" }, { "docid": "b76f5d683cf67707c09214327901d2da", "score": "0.53339034", "text": "def create_record(record)\n puts 'record does not exist - creating new record in CloudFlare'\n puts record\n exit\n\n if defined?(record['priority'])\n @ClassOfProviderToUpdate.create_record(record['record'], record['type'], record['value'], record['priority'])\n else\n @ClassOfProviderToUpdate.create_record(record['record'], record['type'], record['value'])\n end\n\n puts 'created: ' + record['record'] + ' => ' + record['value']\n end", "title": "" }, { "docid": "0854e159acab640da19e2a54c2779e00", "score": "0.53308594", "text": "def create\n @lot = Lot.new(lot_params)\n loop do\n @lot.key = ([*('a'..'z'),*('A'..'Z'),*('0'..'9')]-%w()).sample(8).join\n break unless Lot.exists?(key: @lot.key)\n end\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to farm_lots_path, notice: 'Lote creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @lot }\n else\n format.html { render :new }\n format.json { render json: @lot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f657a889121316bc6f5fc7664cc252e7", "score": "0.5328148", "text": "def createSave(historicName)\n\n\t\t@aventureDB.execute(\"UPDATE aventure historic = '#{historicName}' WHERE idMap = '#{@currentMap}' AND idSave = '#{@idSave}'\")\n\n\tend", "title": "" }, { "docid": "e45ee1d751fc87dd9d81dba168ef5e7a", "score": "0.53216666", "text": "def before_create_save(record)\n record.usr_id = session[:usr_id]\n # I derive the name of the object to prevent user from naming it stupidly\n record.name = \"#{record.rpt.name}-#{record.outputrpttype.name}\"\n end", "title": "" }, { "docid": "3c131db5249b9bc15ef4165021f7412d", "score": "0.53172296", "text": "def set_recordspleinnt\n @recordspleinnt = Recordspleinnt.find(params[:id])\n end", "title": "" }, { "docid": "3ac726064c5bf8735179215809aac88b", "score": "0.53006387", "text": "def set_sprint_chart_record\n @sprint_chart_record = SprintChartRecord.find(params[:id])\n end", "title": "" }, { "docid": "f2027dfa8b259c650591cf23fc2d1296", "score": "0.52968025", "text": "def save\n spot = Spot.create(title: title, latitude: latitude, longitude: longitude)\n Osakana.create(fish: fish, tackle: tackle, details: details, image: image, user_id: user_id, spot_id: spot.id)\n end", "title": "" }, { "docid": "5831be04796f702213132949b44e5bfb", "score": "0.5295227", "text": "def new_record?; @sys_id.nil?; end", "title": "" }, { "docid": "7d1fe820f053ef00b2c31f6e4a747a22", "score": "0.5289648", "text": "def create(record)\n raise Octothorpe::BadHash if record.nil?\n ot = Octothorpe.new(record)\n\n if id_ai\n ot = ot.reject{|k,_| k == id_fld}\n else\n raise(ArgumentError, \"ID field missing from record\") if ot[id_fld].nil?\n end\n\n sql, vals = sql_insert(ot) \n x = selectp(sql, *vals)\n x.first[id_fld]\n\n rescue Octothorpe::BadHash\n raise ArgumentError, \"Bad type for record parameter\"\n rescue\n handle_error $!\n end", "title": "" }, { "docid": "b75b2497806eda805e4eb6669f68d948", "score": "0.5285135", "text": "def add_record\n p station_params\n p \"pay attention!\"\n station = Station.find_by(place_id: station_params[:place_id])\n record = station.records.create\n station_params[:records].each do |key, value|\n record.entries.create({grade: key, price: value})\n end\n if station_params[:newLink]\n station.link = station_params[:link]\n end\n station.save\n end", "title": "" }, { "docid": "0ea358e83345dd176e2815215a7e8f4f", "score": "0.52849364", "text": "def create\n @pilot = Pilot.new(params[:pilot])\n respond_to do |format|\n # if @pilot.save \n \n if @pilot.save\n\t@pilot.update_attributes(:end => @pilot.end.change(:year => @pilot.begin.year, :month => @pilot.begin.month, :day => @pilot.begin.day))\n if @pilot.end < @pilot.begin\n\t @pilot.update_attributes(:end => @pilot.end + 1.days)\n\tend\n format.html { redirect_to pilots_path, notice: 'Pilot was successfully created.' }\n format.json { render json: @pilot, status: :created, location: @pilot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pilot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88db17da67aa4cdebc4f9b5bbef94a48", "score": "0.5271896", "text": "def create\n params.permit!\n @silicashiplot = Silicashiplot.new(params[:silicashiplot])\n\n respond_to do |format|\n if @silicashiplot.save\n format.html { redirect_to(@silicashiplot, :notice => 'Silicashiplot was successfully created.') }\n format.xml { render :xml => @silicashiplot, :status => :created, :location => @silicashiplot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @silicashiplot.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "061d08c59e4b090ac4822f173b54f775", "score": "0.5261193", "text": "def submission_for(lps)\n submissions.find_or_create_by_live_product_search_id(lps.id)\n end", "title": "" }, { "docid": "e053264c638da00c8e7173344d80cae5", "score": "0.52540684", "text": "def create\n data = params \n dprt = data[:slitting][:division_part]\n @error = 0\n @coil = Rawmaterial.find(data[:slitting][:rawmaterial_id])\n if dprt.to_i > 1\n for dpt in 1..dprt.to_i\n name = \"#{@coil.name}\" + \"-PT#{dpt}\"\n rawm = Rawmaterial.create(:name => name, :width => @coil.width ,:thickness => @coil.thickness, :coil_weight => data[:slitting][:process_coil_wt], :rawmaterial_category_id => @coil.rawmaterial_category_id, :grade => @coil.grade, :dateofreciept => @coil.dateofreciept, :address_id => @coil.address_id, :mother_id => @coil.id)\n end\n end\n slitted_coil = Rawmaterial.find(:first, :conditions=> [\"status = 0 and mother_id = ?\",@coil.id])\n @slit_plan = data.rehash.each_pair do |key,value|\n unless value[:slitting].blank?\n @slitting = Slitting.new(value[:slitting])\n if @slitting.valid?\n @slitting.rawmaterial_id = data[:slitting][:rawmaterial_id]\n @slitting.scrap = data[:slitting][:scrap]\n @slitting.division_part = data[:slitting][:division_part]\n @slitting.process_coil_wt = data[:slitting][:process_coil_wt]\n @slitting.slitt_rawmaterial_id = slitted_coil.id unless slitted_coil.blank?\n if @slitting.save\n flash[:notice] = 'Slitting Plan was successfully created.'\n else\n @error = 1\n end \n end \n end\n end\n if @error == 0\n if dprt.to_i <= 1\n @coil.update_attributes(:status => 1)\n end\n slitted_coil.update_attributes(:status => 1) unless slitted_coil.blank?\n redirect_to(slittings_path)\n else\n render :action => \"new\"\n end \n end", "title": "" }, { "docid": "b43111e87be215f59acbf5b832cb422a", "score": "0.52528304", "text": "def persist_puppy(pup)\n response = @db.exec_params(%q[\n INSERT INTO puppies (name, breed, age)\n VALUES ($1, $2, $3)\n RETURNING *;\n ], [pup.name, pup.breed, pup.age])\n\n update_on_hold_requests(pup.breed)\n\n build_puppy(response.first)\n end", "title": "" }, { "docid": "33ad0e1caca8721a302d8243632b70b0", "score": "0.5248602", "text": "def create_soils(i, field_id)\r\n #delete all of the soils for this field\r\n\tsoils = Soil.where(:field_id => field_id)\r\n\tsoils.delete_all\r\n for j in 1..params[\"field#{i}soils\"].to_i\r\n \t @soil = @field.soils.new\r\n\r\n\t @soil.key = params[\"field#{i}soil#{j}mukey\"]\r\n\t @soil.symbol = params[\"field#{i}soil#{j}musym\"]\r\n @soil.group = params[\"field#{i}soil#{j}hydgrpdcd\"]\r\n\t @soil.name = params[\"field#{i}soil#{j}muname\"]\r\n\t @soil.albedo = params[\"field#{i}soil#{j}albedo\"]\r\n\t @soil.slope = params[\"field#{i}soil#{j}slope\"]\r\n\t @soil.percentage = params[\"field#{i}soil#{j}pct\"]\r\n \t if @soil.save then\r\n\t\t if !(params[\"field#{i}soil#{j}error\"] == 2) then\r\n\t\t\tcreate_layers(i, j)\t\t \r\n\t\t end\r\n\t end\t \r\n\tend #end for create_soils\r\n\tsoils = Soil.where(:field_id => field_id).order(percentage: :desc)\r\n\ti = 1\r\n\tsoils.each do |soil|\r\n\t\tif (i <= 3) then\r\n\t\t\tsoil.selected = true\r\n\t\t\tsoil.save\r\n\t\t\ti = i + 1\r\n\t\tend \r\n\tend\r\n end", "title": "" }, { "docid": "d27266950c0598db3025eaf5a22472a2", "score": "0.52471554", "text": "def CreateOrUpdatePI(thePI)\n puts \"CreateOrUpdatePI: this shouldn't happen - thePI was nil\" if thePI.nil?\n begin \n thePI.save!\n rescue ActiveRecord::RecordInvalid => error\n puts \"CreateOrUpdatePI: raised an error for an investigator with the id of '#{thePI.username} with an error of #{error.inspect}\"\n end \n thePI\nend", "title": "" }, { "docid": "d27266950c0598db3025eaf5a22472a2", "score": "0.52471554", "text": "def CreateOrUpdatePI(thePI)\n puts \"CreateOrUpdatePI: this shouldn't happen - thePI was nil\" if thePI.nil?\n begin \n thePI.save!\n rescue ActiveRecord::RecordInvalid => error\n puts \"CreateOrUpdatePI: raised an error for an investigator with the id of '#{thePI.username} with an error of #{error.inspect}\"\n end \n thePI\nend", "title": "" }, { "docid": "0126b1a0ea437285337e4a804bb03e2b", "score": "0.52393055", "text": "def set_new_record(record); end", "title": "" }, { "docid": "975841539909341d75c23149cfb40939", "score": "0.52309513", "text": "def associate_line_with_population(plant_line_id, plant_population_id)\n create_record('plant_population_list',\n plant_line_id: plant_line_id,\n plant_population_id: plant_population_id\n )\nend", "title": "" }, { "docid": "89feff6f5a5eb83d3bad63f2d2ceaa62", "score": "0.5222974", "text": "def set_shot_record\n @shot_record = ShotRecord.find(params[:id])\n end", "title": "" }, { "docid": "38f7dfd62eee283e7ea027303ab3cdfa", "score": "0.52210695", "text": "def create\n @npi = Npi.find_or_initialize_by(npi_params)\n @npi.updated_at = Time.current unless @npi.new_record?\n\n respond_to do |format|\n if @npi.save\n format.json { render :show, status: :created, location: @npi }\n else\n format.json { render json: @npi.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e9a0274a738a6ce73bc8a0feed43481", "score": "0.52174485", "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": "ea54e53931a50c5bc5a5ad0b7373e2db", "score": "0.5215202", "text": "def create\n @tool_record = ToolRecord.find_or_create_by :created_at.gte => Date.today.beginning_of_day, :created_at.lte => Date.today.end_of_day, :engineer_name => params[:tool_record][:engineer_name]\n\n respond_to do |format|\n if @tool_record.update params[:tool_record]\n format.html { redirect_to @tool_record, notice: 'Tool record was successfully created.' }\n format.json { render json: {id: @tool_record.id}, status: :created, location: @tool_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tool_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbff55caec148474660d9b92ce2dd00b", "score": "0.52086407", "text": "def create\n ailment_id, prac_params = isolate_id(:ailment_id, params[:prac])\n @prac = Prac.new(prac_params)\n @prac.ailment = Ailment.find_or_new_name(ailment_id)\n\n respond_to do |format|\n if @prac.save\n format.html { redirect_to(@prac, :notice => 'Prac was successfully created.') }\n format.xml { render :xml => @prac, :status => :created, :location => @prac }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prac.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8edfd0b32c4c1ee4ed0e729877ef347a", "score": "0.52079487", "text": "def create_volume_plan plan_info\n plan_info['price'] *= 100.0\n plan_info['quota'] *= 1.hours\n plan_info['duration'] *= 1.days if plan_info['duration']\n found = VolumePlan.where plan_info\n if found.empty?\n found << (VolumePlan.create plan_info)\n end\n found.first\nend", "title": "" }, { "docid": "b2d55c83644a1f2cfdc50552787134e4", "score": "0.5187939", "text": "def create\n\n @paralavi = Paralavi.new(paralavi_params)\n # @paralavi.lot=@lot.lot\n\n respond_to do |format|\n if @paralavi.save\n format.html { redirect_to @paralavi, notice: 'Paralavi was successfully created.' }\n format.json { render :show, status: :created, location: @paralavi }\n else\n format.html { render :new }\n format.json { render json: @paralavi.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d5ceb9020a84c1e52137ca072d372f64", "score": "0.5178923", "text": "def index\n\n @natparks=Natpark.all\n\n @parkscall = apicall()\n\n @parkscall.each do |park|\n\n park[\"nps_id\"] = park.delete \"id\"\n \n @newpark = Natpark.create(park)\n end\n end", "title": "" }, { "docid": "0492f7d4c6fb23ad21b7c1a5b6d3ad9a", "score": "0.5176793", "text": "def create\n @workpiece = Workpiece.where(picnum: params[:procedure][:workpiece][:picnum]).first_or_create(wp_type: params[:procedure][:workpiece][:wp_type])\n @procedure = @workpiece.procedures.new(procedure_params)\n @procedure.stages.each_with_index do |stage, i|\n stage.run! if i == 0\n stage.arrival_amount = @procedure.procedure_amount\n end\n respond_to do |format|\n if @procedure.save\n format.html { redirect_to procedures_path }\n format.json { render :show, status: :created, location: @procedure }\n else\n format.html { render :new }\n format.json { render json: @procedure.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b7695e35c06b7be9d6d9113d3fd5592", "score": "0.5176325", "text": "def make_tshirt(user, access_point)\n tshirt = Tshirt.where(\n :epicenter_id => self.id, \n :user_id => user.id, \n :access_point_id => access_point.id\n ).first_or_create\n end", "title": "" }, { "docid": "35ed2a1d2c65ebb08477c4b0a77c6957", "score": "0.5174591", "text": "def createPiconet\n user = User.find_by(:phone_number => params[:master_id])\n @piconet = Piconet.new(:channel_id => params[:channel_id], :master_id => user[:id],:number_of_users => params[:number_of_users])\n @piconet.save\n channel = Channel.find_by(:id => params[:channel_id])\n channel[:piconet_id] = @piconet[:id]\n channel[:piconet_id] = @piconet[:id]\n channel.save\n user[:piconet_id] = @piconet[:id]\n user.save\n end", "title": "" }, { "docid": "5215118a1af0f3e68177718d391d816d", "score": "0.517117", "text": "def save_record(new_pokemon)\n\t\t\n\n\t\tCSV.open(@file, \"a\") do |csv|\n\n\t\t\tcsv << new_pokemon\n\t\tend\n\tend", "title": "" }, { "docid": "f518f25e5907cb54bba6f1a7cf16fc35", "score": "0.5170891", "text": "def savePVoutput\n\n #create a new entry or update existing data\n Pvoutput.\n find_or_initialize_by(:user_id => current_user.id).\n update_attributes!(:key => params[:pvoutput][:key],\n :sid => params[:pvoutput][:sid])\n\n redirect_to root_path\n end", "title": "" }, { "docid": "b5b3509492a0d71243a41188276854b1", "score": "0.5168337", "text": "def pilot_params\n params.require(:pilot).permit(:id, :fname, :lname)\n end", "title": "" }, { "docid": "c3ba57601fabf7f93d0099984878e3b5", "score": "0.51630175", "text": "def set_sprice\n @sprice = Sprice.find(params[:id])\n end", "title": "" }, { "docid": "7be86b9c67f26d5ca72639f1ecda80d6", "score": "0.516155", "text": "def create\n @point_of_interest = PointOfInterest.new(point_of_interest_params)\n\n puts @point_of_interest.company\n\n if @point_of_interest.company && Company.where(id: @point_of_interest.company.id) && @point_of_interest.save\n render json: @point_of_interest, status: :created\n else\n render json: @point_of_interest.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a5b0295c634bc317e91b95f18caa162a", "score": "0.5158124", "text": "def create\n @prow = Prow.new(prow_params)\n # @prescription = Prescription.find(params[:prescription]) \n Drug.set_drug(params[:drug_name],params[:drug_description])\n @drug = Drug.find_by_name(params[:drug_name]) \n @prow.drug_id = @drug.id\n @prow.period_type = params[:prow][:period_type]\n @box = BoxPart.find_by_part_num(params[:box]);\n\n respond_to do |format|\n if @prow.save\n @box.prow_id = @prow.id\n @box.save\n format.html { redirect_to prescription_path(:id => @prow.prescription_id) }\n format.json { render :show, status: :created, location: @prow }\n else\n format.html { render :new }\n format.json { render json: @prow.errors, status: :unprocessable_entity }\n end\n end\n \n end", "title": "" }, { "docid": "bd41bb11fa4213961d3c15698de29beb", "score": "0.51568824", "text": "def add_record(db, artist_name, album_name, rating, quality)\n db.execute(\"INSERT INTO record_collection (artist_name, album_name, rating, quality) VALUES (?, ?, ?, ?)\", [artist_name, album_name, rating, quality])\nend", "title": "" }, { "docid": "615defd73b1b58e370695e3266c8655c", "score": "0.5155497", "text": "def create\n @parkinglot = Parkinglot.new(parkinglot_params)\n\n respond_to do |format|\n if @parkinglot.save\n format.html { redirect_to @parkinglot, notice: 'Parkinglot was successfully created.' }\n format.json { render :show, status: :created, location: @parkinglot }\n else\n format.html { render :new }\n format.json { render json: @parkinglot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2dceba1810974203042b0a60597a355f", "score": "0.51536477", "text": "def create\n prs = known_issue_params[:pr].split(',')\n success = true\n prs.each do |pr|\n puts 'lkjlj'\n known_issue_params[:pr] = pr\n puts known_issue_params[:pr]\n puts pr\n @known_issue = KnownIssue.new(test: known_issue_params[:test],\n runtime: known_issue_params[:runtime],\n pr: pr)\n success = @known_issue.save and success\n end\n\n if success\n flash[:success] = 'Record created.'\n redirect_to known_issues_url\n else\n flash[:danger] = @known_issue.errors.first\n redirect_to known_issues_url\n end\n end", "title": "" }, { "docid": "2f4b18899d41a4342f02c270e84abebd", "score": "0.51505154", "text": "def poll_and_persist(location = DEFAULT_LOC)\n records_persisted = 0\n poll(location).each do |record|\n # Caruby2go provides coordinates in [longitude, latitude]\n coordinates = record['coordinates']\n vehicle_location = VehicleLocation.new(vehicle: record['name'],\n longitude: coordinates[0],\n latitude: coordinates[1],\n location: location,\n vin: record['vin'],\n exterior: record['exterior'],\n interior: record['interior'])\n vehicle_location.save!\n records_persisted += 1\n end\n records_persisted\n end", "title": "" }, { "docid": "b2f38ae7b5fa334f11b8aa73028b0cf9", "score": "0.51484925", "text": "def si\n Si.find_or_create self\n end", "title": "" }, { "docid": "a82fdc05debb0723d0d4328cb2395cd4", "score": "0.51417595", "text": "def create_empty_record\n @portfolio = Portfolio.new\n @portfolio.portfolio_active = true\n @portfolio.position = 99\n @portfolio.save\n \n redirect_to(controller: :portfolios, action: :edit, id: @portfolio)\n end", "title": "" }, { "docid": "548ba3c1f84bfab826504b7122ee4293", "score": "0.51373094", "text": "def create\n\n #Parse out petId from params\n first = session[:first];\n petId = params[:pets_id];\n empty = params[:first];\n\n #As long as an id was passed...\n unless params[:pets_id].nil?\n\n #Get the pet specified by the id\n pet1 = Pet.find(params[:pets_id])\n if first == 2\n\n #And associate this line pet with that pet\n @line_pet = @place.line_pets.build(pet: pet1)\n respond_to do |format|\n if @line_pet.save\n format.html { redirect_to new_foster_parent_path, pet_id: petId}\n format.json { render action: 'edit', status: :created, location: @line_pet }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_pet.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n set_pet_nil()\n respond_to do |format|\n format.html { redirect_to adoption_store_index_path}\n end\n end\n end", "title": "" }, { "docid": "dd234f679cff9142ee17ffa9ba55080c", "score": "0.51319206", "text": "def register\n @parking_lot = ParkingLot.find(params['parking_lot'])\n @guest = Guest.find(params['guest'])\n @vehicle = Vehicle.find(vehicle = params['vehicle'])\n is_disabled = params['is_disabled']\n\n # Try to find a free spot\n @spot = ParkingSpot.where([\"parking_spot_status_id in (select id from parking_spot_status where is_available = true)\n and parking_lot_id = ?\n and parking_spot_size_id = ?\n and is_private = false\n and is_occupied = false\n and is_for_disability = ?\",\n @parking_lot.id,\n @vehicle.parking_spot_size_id,\n is_disabled])\n .first\n\n # If is disabled and there's no free spot, try to find a non disabled free spot\n if is_disabled and @spot.nil?\n @spot = ParkingSpot.where([\"parking_spot_status_id in (select id from parking_spot_status where is_available = true)\n and parking_lot_id = ?\n and parking_spot_size_id = ?\n and is_private = false\n and is_occupied = false\n and is_for_disability = false\",\n @parking_lot.id,\n @vehicle.parking_spot_size_id])\n .first\n end\n\n # If we found a free spot, register the entrance\n if not @spot.nil?\n @spot.is_occupied = true\n @spot.update\n\n @entrance = Time.new\n GuestHistory.create({ guest: @guest, vehicle: @vehicle, parking_spot: @spot, entrance_date: @entrance})\n end\n end", "title": "" }, { "docid": "03808e66e1a3ef3c8cb03f28452207aa", "score": "0.5127981", "text": "def save\n self.id ? update_record : create_record\n end", "title": "" }, { "docid": "f0ce5a68bfe7e1009828b4b598230089", "score": "0.512739", "text": "def save\n pools = App.db[:pools]\n @created_at = Time.now # uniform created_at dates for all of the splits.\n\n # return a list of pool_ids for the new pools\n @splits.each do |user_id, split_pct|\n pools.insert( pool_id: @pool_id,\n user_id: user_id,\n split_pct: split_pct,\n created_at: @created_at)\n end\n \n true\n end", "title": "" }, { "docid": "f758281706f947da0cd4db53dfeedd6a", "score": "0.51260525", "text": "def createSave\n\t\t@save = ConnectDB.new.save(Connexion.getJoueur,self.to_yaml()).id_save\n\tend", "title": "" }, { "docid": "ddd49c18ac7cc5b9e3efc4ef9503f753", "score": "0.51204973", "text": "def save()\n #first connect to the database\n db = PG.connect( {dbname: 'Bounty', host:'localhost'} )\n # prepare an SQL statement in a big string\n sql = \"INSERT INTO Bounty_Tracks\n (\n name,\n species,\n bounty,\n danger_level\n )\n VALUES ($1,$2,$3,$4)\n RETURNING id\n \"\n\n #create a values of array for any prepare statement\n values = [@name, @species, @bounty, @danger_level]\n\n # use pg to run the prepared statement\n db.prepare(\"save\", sql)\n\n #run that prepared statement with pg\n @id = db.exec_prepared(\"save\", values)[0][\"id\"].to_i\n\n #finally, close the db connection\n db.close()\n\n end", "title": "" }, { "docid": "a6262084fef9d6f66c21a99557d9c9c2", "score": "0.51196533", "text": "def set_recordspnnt\n @recordspnnt = Recordspnnt.find(params[:id])\n end", "title": "" }, { "docid": "226ad98778776e24cb2d1b3d8c1091bf", "score": "0.51162696", "text": "def create\n spot2 = Spot.order(\"created_at\").last\n id = (spot2.id.to_i) + 1\n @spot = Spot.new(spot_params)\n @spot.id = id\n respond_to do |format|\n if @spot.save\n HTTParty.post(\"http://localhost:3000/spots?name=#{spot_params[:name]}&lat=#{spot_params[:lat]}&lon=#{spot_params[:lon]}&description=#{spot_params[:description]}&features=#{spot_params[:features]}&spot_type=#{spot_params[:spot_type]}&img=#{spot_params[:img]}\")\n format.html { redirect_to @spot, notice: 'Spot was successfully created.' }\n format.json { render :show, status: :created, location: @spot }\n else\n format.html { render :new }\n format.json { render json: @spot.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c4aea860fceb77857cdee3520771d3c8", "score": "0.5108939", "text": "def set_performed_plyometric\n @performed_plyometric = PerformedPlyometric.find(params[:id])\n end", "title": "" }, { "docid": "6b38d767a94cbf58b9defe4715e0ca6f", "score": "0.51067275", "text": "def update_lot(id, data)\n update(\"lots\", id, data).first\n end", "title": "" }, { "docid": "7a1cde993f55b7d14ad6cbf985096bd9", "score": "0.5106552", "text": "def create(data)\n @specie_model.create(data)\n end", "title": "" }, { "docid": "52aed0caae867598a5c5491d6c590f98", "score": "0.51051605", "text": "def find_sector\n @sector = Sector.find_or_create_by_id(params[:sector_id])\n rescue ActiveRecord::RecordInvalid\n not_found\n end", "title": "" } ]
ed6b0d09e02f9ff43414806416cd4a19
GET /sundry_debtors/new GET /sundry_debtors/new.xml
[ { "docid": "19c924b699c1ce573dbf678818044fc6", "score": "0.76258314", "text": "def new\n @sundry_debtor = SundryDebtor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sundry_debtor }\n end\n end", "title": "" } ]
[ { "docid": "e45e82ece40e4a7b0ac900c7f237d6d3", "score": "0.6969663", "text": "def create\n @sundry_debtor = SundryDebtor.new(params[:sundry_debtor])\n\n respond_to do |format|\n if @sundry_debtor.save\n flash[:notice] = 'SundryDebtor was successfully created.'\n format.html { redirect_to(@sundry_debtor) }\n format.xml { render :xml => @sundry_debtor, :status => :created, :location => @sundry_debtor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sundry_debtor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "397f3734ff8ac028573e9653bb0be148", "score": "0.689513", "text": "def new\n @dbs_deposit = DbsDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dbs_deposit }\n end\n end", "title": "" }, { "docid": "9148351512d740dcb4ffbb5a99b52d04", "score": "0.68666947", "text": "def new\n @revendedor = Revendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revendedor }\n end\n end", "title": "" }, { "docid": "bfb45e11fd538b553eb134267891f55b", "score": "0.66800636", "text": "def new\n @draught = Draught.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draught }\n end\n end", "title": "" }, { "docid": "ffa527ae0ae4ba4e3ec3dd3331c0ead1", "score": "0.66293883", "text": "def new\n @distribuidora = Distribuidora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "title": "" }, { "docid": "1b996ca1520f51d473be189a15f77025", "score": "0.6620851", "text": "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end", "title": "" }, { "docid": "3bcd4b67bdf0b98b53ac23d0bc820c60", "score": "0.66141707", "text": "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "title": "" }, { "docid": "fe8490b7c1ef9d1b7c1584b95d1dfa5f", "score": "0.66031146", "text": "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "title": "" }, { "docid": "eecbea4fdd4932745089817558379804", "score": "0.65982634", "text": "def new\n @pastor = Pastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pastor }\n end\n end", "title": "" }, { "docid": "1375f9f77681f270f179fc7a4112d017", "score": "0.65840226", "text": "def new\n @cantor = Cantor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cantor }\n end\n end", "title": "" }, { "docid": "13252be77e9387634a3ee940c0b4100f", "score": "0.65633196", "text": "def new\n @derivative = Derivative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @derivative }\n end\n end", "title": "" }, { "docid": "ea7ae404fc0eca1d198479f870bc2f6a", "score": "0.6546454", "text": "def new\n @authorship = Authorship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @authorship }\n end\n end", "title": "" }, { "docid": "7f20b8b2bf859b8cb8f7ff75e4d69758", "score": "0.6542207", "text": "def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end", "title": "" }, { "docid": "7c5c7b1e6628ac3c1c1ff4e77220fce4", "score": "0.65380836", "text": "def new\n @setor = Setor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setor }\n end\n end", "title": "" }, { "docid": "6ebc48d940cc2c0548bab051730a2f84", "score": "0.65378124", "text": "def new\n @rant = Rant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rant }\n end\n end", "title": "" }, { "docid": "fcfb5a9249572318a2b877421b9ee481", "score": "0.65278536", "text": "def new\n @deity = Deity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deity }\n end\n end", "title": "" }, { "docid": "935cf6c677e580f7a0bd431272f670b5", "score": "0.65268385", "text": "def new\n @simperson = Simperson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simperson }\n end\n end", "title": "" }, { "docid": "375378e9021b305ddb660460d49204b2", "score": "0.65223575", "text": "def new\n @debt = Debt.new\n @companies = Company.find(:all)\n @paydays = Payday.find(:all)\n @dtypes = DebtType.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @debt }\n end\n end", "title": "" }, { "docid": "3257dbe793a27a3cc27f82ee4295527c", "score": "0.6516477", "text": "def new\n @dossier = Dossier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dossier }\n end\n end", "title": "" }, { "docid": "31570a5a6ff7eb0c3cf11b12377cfb08", "score": "0.6500331", "text": "def new\n @settlement = @transaction.settlements.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @settlement }\n end\n end", "title": "" }, { "docid": "a0d48817f2db586af7dbc8070b89f8ce", "score": "0.64898694", "text": "def new\n @realtor = Realtor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @realtor }\n end\n end", "title": "" }, { "docid": "3fafd3c9182a958e8b0df8b70a917981", "score": "0.6487113", "text": "def new\n @dinosaur = Dinosaur.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dinosaur }\n end\n end", "title": "" }, { "docid": "b191c4b52ca5b7cd288a8dffc8b22183", "score": "0.6472984", "text": "def new\n @withdrawal = Withdrawal.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @withdrawal }\n end\n end", "title": "" }, { "docid": "eafa7080b1dd46331ff65364b5f2ba91", "score": "0.64720386", "text": "def new\n @solicitation = @representative.solicitations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\n end\n end", "title": "" }, { "docid": "278cc721a4f0a7eaf338a9bed4140c3d", "score": "0.6470269", "text": "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "title": "" }, { "docid": "656886a2a0662e03bf364cafeb86e6f2", "score": "0.6465326", "text": "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "title": "" }, { "docid": "656886a2a0662e03bf364cafeb86e6f2", "score": "0.6465326", "text": "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "title": "" }, { "docid": "63cdb442e873553ed9071eee50ea1f81", "score": "0.6456559", "text": "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @brother }\n end\n end", "title": "" }, { "docid": "ed27bb810eedeac4c9b46e65c8687a88", "score": "0.6455701", "text": "def new\n @sellerring = Sellerring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sellerring }\n end\n end", "title": "" }, { "docid": "35de7b2e9dda990602e1c84a7f673d5b", "score": "0.6439578", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @distributor_country }\n end\n end", "title": "" }, { "docid": "f6ad87f7337ec9c956bee014357caf83", "score": "0.6433443", "text": "def new\n @sponsor = Sponsor.new\n @states = State.find(:all, :order => :name)\n @countries = Country.find(:all, :conditions => {:printable_name => \"United States\"}, :order => :printable_name)\n @tags = Tag.find(:all, :order => :name)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sponsor }\n end\n end", "title": "" }, { "docid": "a2da68838c65fff5c0a875a9d2f47997", "score": "0.64308", "text": "def new\n @distraction = Distraction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distraction }\n end\n end", "title": "" }, { "docid": "78ac52ff3106cb36b69e0d58558547f6", "score": "0.64255726", "text": "def new\n @action_deduct = ActionDeduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_deduct }\n end\n end", "title": "" }, { "docid": "c89d9898a7701057ef5469d26fc150b2", "score": "0.64169484", "text": "def new\n @kennel = Kennel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kennel }\n end\n end", "title": "" }, { "docid": "95e4a04310f76e58d0a2144f0cb249cf", "score": "0.64133954", "text": "def new\n @diaper = Diaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diaper }\n end\n end", "title": "" }, { "docid": "df71876c603cb1bc2cf913b781a4c407", "score": "0.64124835", "text": "def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end", "title": "" }, { "docid": "504887687c99f6dcedbb704a0e1d6938", "score": "0.64112824", "text": "def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end", "title": "" }, { "docid": "e06fb3097bd2baf8055f3e59e9846923", "score": "0.64088243", "text": "def new\n @supplier = Supplier.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @supplier }\n end\n end", "title": "" }, { "docid": "f6a2eba9d586fe30e5480dbdeecc22d6", "score": "0.64077383", "text": "def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end", "title": "" }, { "docid": "892505ab82f92131fd1c4983d687f4a8", "score": "0.6406305", "text": "def new\n @depositocaucion = Depositocaucion.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @depositocaucion }\n end\n end", "title": "" }, { "docid": "a4f9a911f59465570d374fd57de41145", "score": "0.640589", "text": "def new\n @dokter = Dokter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dokter }\n end\n end", "title": "" }, { "docid": "908f053f662543d8fc92666cdfcb6814", "score": "0.6395452", "text": "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n flash[:notice] = 'Debt was successfully created.'\n format.html { redirect_to(@debt) }\n format.xml { render :xml => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "564a45432a296ceadaba5ec98953a40a", "score": "0.63926387", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end", "title": "" }, { "docid": "9e538aa52515d4fbd3d9ef2ab7df151a", "score": "0.6390287", "text": "def new\n @rede = Rede.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rede }\n end\n end", "title": "" }, { "docid": "20e06e27be2af752df8918f974a695e0", "score": "0.63843507", "text": "def new\n @funding_source = FundingSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funding_source }\n end\n end", "title": "" }, { "docid": "98c0f21652720c7d3adeb71bbeeb9f13", "score": "0.6379092", "text": "def new\n @dorm_account = DormAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dorm_account }\n end\n end", "title": "" }, { "docid": "55133392685d12c01eaf0d1ebf2a4b95", "score": "0.6373995", "text": "def new\n \n @donation = Donation.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @donation }\n end\n end", "title": "" }, { "docid": "685a98f929c633abe97b0c491b1fbb36", "score": "0.6366408", "text": "def new\n @origin = Origin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @origin }\n end\n end", "title": "" }, { "docid": "ce5d887dbeedeece2283ed2f1ce63eb4", "score": "0.6360259", "text": "def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end", "title": "" }, { "docid": "7f3875cb309766937e72138bd40dc095", "score": "0.6358735", "text": "def new\n @buddy = Buddy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @buddy }\n end\n end", "title": "" }, { "docid": "40e2606964c25dac2daff292595cf08b", "score": "0.6354495", "text": "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "title": "" }, { "docid": "859459e3e44856cdeaa7fc08f1616ddb", "score": "0.6350817", "text": "def new\n @dosage = Dosage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dosage }\n end\n end", "title": "" }, { "docid": "cc6329708f61b5af9e6b6ef4a21046e1", "score": "0.6348709", "text": "def new\n @consultation = Consultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consultation }\n end\n end", "title": "" }, { "docid": "12dc39bb6487be772f63e7c73a250f54", "score": "0.6345702", "text": "def new\n @deposit = Deposit.new\n users = User.all(:order => 'name')\n @users = users.map {|u| [u.name, u.id] }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deposit }\n end\n end", "title": "" }, { "docid": "7f93d4dae01b277334f2a4772145cd50", "score": "0.63430935", "text": "def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end", "title": "" }, { "docid": "7dab762784d82f91ac84cc8cd3f23693", "score": "0.63307416", "text": "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "title": "" }, { "docid": "ad6662d83c9f6cfe4a894db0349fdc1f", "score": "0.6328054", "text": "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "title": "" }, { "docid": "ad6662d83c9f6cfe4a894db0349fdc1f", "score": "0.6328054", "text": "def new\n @referral = Referral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "title": "" }, { "docid": "714d9a33ebbaf4ee2a0c530c5972bdf0", "score": "0.6327799", "text": "def new\n @student_regedship = StudentRegedship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @student_regedship }\n end\n end", "title": "" }, { "docid": "16ad8c0a26c09f754c8df330f4ab595f", "score": "0.6320777", "text": "def new\n @district = District.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @district }\n end\n end", "title": "" }, { "docid": "61d343388e69aaf4378d74b316bf8478", "score": "0.63198626", "text": "def new\n @hydrant = Hydrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hydrant }\n end\n end", "title": "" }, { "docid": "f4f50bf57091377ec384021756f13ab4", "score": "0.6314718", "text": "def new\n @lookup_drugunit = LookupDrugunit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_drugunit }\n end\n end", "title": "" }, { "docid": "ffa7e997462330cce187c5295c763304", "score": "0.63130325", "text": "def new\n @bouncer = Bouncer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bouncer }\n end\n end", "title": "" }, { "docid": "641ad87599e65226094acc2c04ed0a7e", "score": "0.6306385", "text": "def new\n @followership = Followership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @followership }\n end\n end", "title": "" }, { "docid": "b8f143c9f07132e778b849f6afda4394", "score": "0.6303974", "text": "def new\n @burger = Burger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @burger }\n end\n end", "title": "" }, { "docid": "99071fcb62fa5db9b5b3e84d82cacb63", "score": "0.6301559", "text": "def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end", "title": "" }, { "docid": "6bd334fcf876655eccdf88e314ab1f6b", "score": "0.62928694", "text": "def new\n @docent = Docent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @docent }\n end\n end", "title": "" }, { "docid": "f94374fe3f094b628698c687a30f2c06", "score": "0.6291713", "text": "def create\n @revendedor = Revendedor.new(params[:revendedor])\n\n respond_to do |format|\n if @revendedor.save\n flash[:notice] = 'Revendedor was successfully created.'\n format.html { redirect_to(@revendedor) }\n format.xml { render :xml => @revendedor, :status => :created, :location => @revendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @revendedor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46b78d839160ba46062f3f4418fe2104", "score": "0.62908894", "text": "def new\n @sticker = Sticker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sticker }\n end\n end", "title": "" }, { "docid": "e8dd9b6668a72a8332673f57bd8a2999", "score": "0.6284691", "text": "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "title": "" }, { "docid": "6076ce4dba85573ddd784fcb6b0c93f5", "score": "0.6281461", "text": "def new\n @pr = Pr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pr }\n end\n end", "title": "" }, { "docid": "0cae1fb82fbf0b9bac0c127495d58178", "score": "0.6279457", "text": "def new\n @fundation = Fundation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fundation }\n end\n end", "title": "" }, { "docid": "a3ef9a86f4a2702dc47d01adc9dfbbe0", "score": "0.62792975", "text": "def new\n @party_type = PartyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @party_type }\n end\n end", "title": "" }, { "docid": "4c7667d3f8ec9e218dab67d47b44336b", "score": "0.62785417", "text": "def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end", "title": "" }, { "docid": "d9dce493ab82f871a0c2d30f09b99f94", "score": "0.62757593", "text": "def new\n @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end", "title": "" }, { "docid": "f91ff30d142c6502b46e6ea52d5419c7", "score": "0.627376", "text": "def new\n @funder = Funder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @funder }\n end\n end", "title": "" }, { "docid": "cbca05025f83aacc2c324f138a39afce", "score": "0.62735003", "text": "def new\n @distribution = @foyer.distributions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribution }\n end\n end", "title": "" }, { "docid": "32d23e457194194ed523de156ee89693", "score": "0.6265942", "text": "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "title": "" }, { "docid": "c12a1f9492f29eea2cc4b6bfa1f396cc", "score": "0.6262501", "text": "def new\n @sire = Sire.new\n @breeds = Breed.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sire }\n end\n end", "title": "" }, { "docid": "0f3218eae6e7d6276ece71cc66bf0743", "score": "0.62618583", "text": "def new\n @direccion = Direccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @direccion }\n end\n end", "title": "" }, { "docid": "fcdebda20ad37ccb85e08e3745857ad0", "score": "0.6260197", "text": "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "title": "" }, { "docid": "c1f7dfc7f24e826f68d206f631e08b37", "score": "0.62561744", "text": "def new\n @referral = Referral.new\n # @mentors = Mentor.find(:all, :order => name).map { |m| m.name }\n @referral.city = \"Seattle\"\n @referral.state = \"WA\"\n\n @referral.role_model = 3\n @referral.reliability = 3\n @referral.creativity = 3\n @referral.enthusiasm = 3\n @referral.cultural_awareness = 3\n @referral.patience = 3\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @referral }\n end\n end", "title": "" }, { "docid": "3a37a37d7d7031d541245a4b810d9609", "score": "0.62500614", "text": "def new\n @unpaid_debt = UnpaidDebt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unpaid_debt }\n end\n end", "title": "" }, { "docid": "7795db250863186c2ff69d7be6615c3b", "score": "0.6237891", "text": "def new\n @donation_request = DonationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @donation_request }\n end\n end", "title": "" }, { "docid": "92549f188802a45167eb076f967c293f", "score": "0.6234838", "text": "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "title": "" }, { "docid": "35c6e10364fde9d64809993d20f55522", "score": "0.62330204", "text": "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "title": "" }, { "docid": "7fe475cbdc9c9f0a24f24357441961a5", "score": "0.6232621", "text": "def new\n @cuadrante = Cuadrante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cuadrante }\n end\n end", "title": "" }, { "docid": "ccff1356b0ec7aeabc85118a7dd7841a", "score": "0.6230857", "text": "def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end", "title": "" }, { "docid": "161da020e756114b40b9240b596e5b6b", "score": "0.62305397", "text": "def new\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @firm }\n end\n end", "title": "" }, { "docid": "ca6a39849d6cbfb489d1e4a8e8390fed", "score": "0.6227304", "text": "def new\n @lek = Lek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lek }\n end\n end", "title": "" }, { "docid": "fc88aaa8a2975073c533499b780972f6", "score": "0.62242407", "text": "def new\n @diabetes_consultation = DiabetesConsultation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diabetes_consultation }\n end\n end", "title": "" }, { "docid": "ef805769d8ed4bf8eeb997c42a8ac2c8", "score": "0.6223607", "text": "def new\n @domino = Domino.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domino }\n end\n end", "title": "" }, { "docid": "aa7333eb2ce89faf4d4ef279938ade21", "score": "0.62199503", "text": "def new\n @combat = Combat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @combat }\n end\n end", "title": "" }, { "docid": "3e71b8c126284413ea993da246b2560d", "score": "0.6219857", "text": "def new\n @foyer = Foyer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @foyer }\n end\n end", "title": "" }, { "docid": "f0f1b5561b8f398d8f00085382ffff02", "score": "0.62192506", "text": "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "title": "" }, { "docid": "d2c67ecab1f4b6f6c4e5a046f79956d6", "score": "0.62172717", "text": "def new\n @ru_pusk = RuPusk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ru_pusk }\n end\n end", "title": "" }, { "docid": "57b3a6104ccd5d4f1e3ce9b2e50cdf2a", "score": "0.62158394", "text": "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "title": "" }, { "docid": "aa7c3f2285b230938439c8865a179ad4", "score": "0.6214372", "text": "def new\n @diet = Diet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diet }\n end\n end", "title": "" }, { "docid": "78600fc2e819c71c38b20bd64c7f3b11", "score": "0.6212729", "text": "def new\n @despacho = Despacho.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @despacho }\n end\n end", "title": "" }, { "docid": "b1179a17f3aa77fc16cccf84e702c01a", "score": "0.6212659", "text": "def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end", "title": "" } ]
e08a4e135f78352b2400285e1f4b4932
Clears the prepared statements cache.
[ { "docid": "8bfd068e926bbf36268e510be027602d", "score": "0.80267036", "text": "def clear_cache!\n @statements.clear\n end", "title": "" } ]
[ { "docid": "183ddd24705bc59c13fea01e89300226", "score": "0.8246629", "text": "def clear_statement_caches\n pool.all_connections{|c| c.statement_cache.clear}\n end", "title": "" }, { "docid": "ca7a317b10ec281db2ddf65c69cc9909", "score": "0.7243486", "text": "def clear_cache!\n super\n @statements.clear\n end", "title": "" }, { "docid": "546ed1a51b27a7b596653cfebfac387e", "score": "0.70536387", "text": "def clear_cache!\n super\n # Make sure all query plans are *really* gone\n @connection.execute 'DEALLOCATE ALL' if active?\n end", "title": "" }, { "docid": "8aa6f8e4b5972116dc1232e2d8969a1c", "score": "0.68198556", "text": "def clear\n adapter.exec(clear_sql)\n end", "title": "" }, { "docid": "c4ca3b1d84cde4dcc739b880d94eeb22", "score": "0.6572052", "text": "def clear_query_cache\n @query_cache.clear if @query_cache\n @cache_version.clear if @cache_version\n end", "title": "" }, { "docid": "c4c5fb48441bb3265bd57d65801e2217", "score": "0.6527982", "text": "def clear_query_cache\n @query_cache.clear\n end", "title": "" }, { "docid": "c4c5fb48441bb3265bd57d65801e2217", "score": "0.6527982", "text": "def clear_query_cache\n @query_cache.clear\n end", "title": "" }, { "docid": "558d777b584cf2c8f0be4c1c2d7304cf", "score": "0.6440031", "text": "def clear_query_cache; end", "title": "" }, { "docid": "beff09426a749f0732cf23f6e4150432", "score": "0.6436533", "text": "def cache_clear\n Table.delete_all\n end", "title": "" }, { "docid": "7a59bea31704b435bdbcb1609ae6b11a", "score": "0.6368922", "text": "def clear_query_cache\n @lock.synchronize do\n @query_cache.clear\n end\n end", "title": "" }, { "docid": "a3a68d3a2d05ab926698f6db6e94e077", "score": "0.6331709", "text": "def clear_cache\n @cache.values {|connection| connection.close rescue nil}\n @cache.clear\n end", "title": "" }, { "docid": "6dba641f8594fd280f1760983adcdd3a", "score": "0.62708086", "text": "def clear\n @statements[:clear].execute! NamesTable\n end", "title": "" }, { "docid": "18f51c4060d12859a2e5fa739bc64b21", "score": "0.62066877", "text": "def clean\n tables_cache.keys.reverse_each do |table|\n ActiveRecord::Base.connection.execute %(\n DELETE FROM #{table}\n )\n end\n end", "title": "" }, { "docid": "dbac0540be99deafdfb8d90081efc538", "score": "0.6174936", "text": "def clear_statements\n send_delete_request('')\n end", "title": "" }, { "docid": "6f32d50c8062930d170424229033f7f6", "score": "0.6164063", "text": "def reset\n clean\n tables_cache.clear\n cache.clear\n end", "title": "" }, { "docid": "6f32d50c8062930d170424229033f7f6", "score": "0.6164063", "text": "def reset\n clean\n tables_cache.clear\n cache.clear\n end", "title": "" }, { "docid": "3508ef221502cd01763ce2aeac3ff2a0", "score": "0.6116155", "text": "def clear_columns_cache\n @cache.delete(:_columns)\n end", "title": "" }, { "docid": "2cc5de70046757b51fc06f13d03ee1aa", "score": "0.61113423", "text": "def clear_columns_cache\n @cache.delete(:_columns)\n end", "title": "" }, { "docid": "bc836765cc5008a28d6c417a61714bfa", "score": "0.61080444", "text": "def clear_cache\n @resources = nil\n @count = nil\n @next_page = nil\n @prev_page = nil\n @query = nil\n end", "title": "" }, { "docid": "953fed8ddf8ddbf5a1b5732c9b7fe059", "score": "0.6100355", "text": "def exec_cache(sql, binds)\n stmt_key = prepare_statement sql\n\n # Clear the queue\n @connection.get_last_result\n @connection.send_query_prepared(stmt_key, binds.map { |col, val|\n if val.kind_of?(String) && col.try!(:sql_type) == 'bytea'\n {value: val, format: 1}\n else\n type_cast(val, col)\n end\n })\n @connection.block\n @connection.get_last_result\n rescue PGError => e\n # Get the PG code for the failure. Annoyingly, the code for\n # prepared statements whose return value may have changed is\n # FEATURE_NOT_SUPPORTED. Check here for more details:\n # http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/cache/plancache.c#l573\n begin\n code = e.result.result_error_field(PGresult::PG_DIAG_SQLSTATE)\n rescue\n raise e\n end\n if FEATURE_NOT_SUPPORTED == code\n @statements.delete sql_key(sql)\n retry\n else\n raise e\n end\n end", "title": "" }, { "docid": "386f77b78934377c6c0bc2b911744d10", "score": "0.60866493", "text": "def clear_cache!\n # this should be overridden by concrete adapters\n end", "title": "" }, { "docid": "386f77b78934377c6c0bc2b911744d10", "score": "0.60866493", "text": "def clear_cache!\n # this should be overridden by concrete adapters\n end", "title": "" }, { "docid": "386f77b78934377c6c0bc2b911744d10", "score": "0.60866493", "text": "def clear_cache!\n # this should be overridden by concrete adapters\n end", "title": "" }, { "docid": "7102fca3d9b1ca81ecb5f28d7946c6e5", "score": "0.60799205", "text": "def cache_clear\n clear\n end", "title": "" }, { "docid": "ce97490a56c92d9049650775d07329f5", "score": "0.60658276", "text": "def clear_cached\n Rails.cache.delete(@cache_key, @options.opts_for_cache)\n end", "title": "" }, { "docid": "e0e227da773f4eaf9cda1cc5c257af95", "score": "0.60608816", "text": "def clear!\n @columns.clear\n @columns_hash.clear\n @primary_keys.clear\n @data_sources.clear\n @version = nil\n end", "title": "" }, { "docid": "f9d6fd22c063f495eb0a87d73e2829e0", "score": "0.60175455", "text": "def clear_data_source_cache!(name)\n @columns.delete name\n @columns_hash.delete name\n @primary_keys.delete name\n @data_sources.delete name\n end", "title": "" }, { "docid": "8dca2f666741fe3fd4e8b2a58a3caabf", "score": "0.6005698", "text": "def clear!\n @columns.clear\n @columns_hash.clear\n @primary_keys.clear\n @tables.clear\n @version = nil\n end", "title": "" }, { "docid": "a372c29cc8e3085b986cddfbfc20de17", "score": "0.6001297", "text": "def reset_pg_stats_statements\n return unless extension_loaded? 'pg_stat_statements'\n execute_sql 'SELECT pg_stat_statements_reset();'\n end", "title": "" }, { "docid": "43a43793d563a3d84f37183e6fb823b7", "score": "0.59945995", "text": "def clear_cache\n @cache.clear if @cache\n end", "title": "" }, { "docid": "43a43793d563a3d84f37183e6fb823b7", "score": "0.59945995", "text": "def clear_cache\n @cache.clear if @cache\n end", "title": "" }, { "docid": "43a43793d563a3d84f37183e6fb823b7", "score": "0.59945995", "text": "def clear_cache\n @cache.clear if @cache\n end", "title": "" }, { "docid": "43a43793d563a3d84f37183e6fb823b7", "score": "0.59945995", "text": "def clear_cache\n @cache.clear if @cache\n end", "title": "" }, { "docid": "43a43793d563a3d84f37183e6fb823b7", "score": "0.59945995", "text": "def clear_cache\n @cache.clear if @cache\n end", "title": "" }, { "docid": "247ece5e4fab48fd77f51c911ca971ed", "score": "0.59889996", "text": "def cleanup\n t = Time.now\n @hash.sort_by{|k,v| @sorter.call(t, v)}.first(@size_diff).each{|sql, stmt| remove(sql)}\n end", "title": "" }, { "docid": "294dbe95de9ac9a745c82e9a4ec6835b", "score": "0.59873414", "text": "def clear!\n @columns.clear\n @columns_hash.clear\n @primary_keys.clear\n @tables.clear\n end", "title": "" }, { "docid": "4acdf5040050d4022034a300939b58c5", "score": "0.5959509", "text": "def clear\n query { |db| db.execute \"DELETE FROM #{TABLE} WHERE 1\" }\n end", "title": "" }, { "docid": "f3bfc5df8b3d8836bee13211dbb150e0", "score": "0.5954466", "text": "def clear_cache\n\t\t@cache.clear\n\tend", "title": "" }, { "docid": "42648249a7056b2ebac7f6578c0e7434", "score": "0.5932994", "text": "def rs_clear\n\t\t@result_set.clear\n\tend", "title": "" }, { "docid": "0213e6e36f315ae0168816cb017098c4", "score": "0.5911753", "text": "def clear\n instrument(:clear, nil, nil) do\n with(&:flushdb)\n end\n end", "title": "" }, { "docid": "06299326358430f14b18730c311914e8", "score": "0.585162", "text": "def clear\n cache.clear\n end", "title": "" }, { "docid": "47378b663843e74aa1cdf3f9c050e3e6", "score": "0.5829395", "text": "def clear_batch\n check_closed\n\n if @bstmt\n @bstmt.clear_batch\n @spool.give @bstmt\n @bstmt = nil\n end\n\n @pstmts.each do |stmt|\n stmt.clear_batch\n end\n end", "title": "" }, { "docid": "7351bea45945cf7015af96030fae4fcf", "score": "0.58271486", "text": "def reset\n graphql_schema.query_cache.clear\n @cache_key = nil\n end", "title": "" }, { "docid": "c5e2e8ab1296b5ebf04b21bb6491688e", "score": "0.58190215", "text": "def clear(options = nil)\n cache.clear\n end", "title": "" }, { "docid": "36314b2a780ebabe061f016820768a47", "score": "0.5818251", "text": "def clear\n delete_cache_files\n @cache.clear\n end", "title": "" }, { "docid": "e91a9cf2a54ce63cc0e51c1744b27f6d", "score": "0.5812823", "text": "def clear_cache!\n @cache = {}\n end", "title": "" }, { "docid": "cdb84c003f59735e1c865c73f3ebc5f0", "score": "0.58110183", "text": "def destroy_cache\n set.each { |id| destroy_hash(id) }\n destroy_set\n end", "title": "" }, { "docid": "33af4b37f2a2baf6a7b72106bf00ee3d", "score": "0.5810289", "text": "def clear\n @cache.clear\n end", "title": "" }, { "docid": "33af4b37f2a2baf6a7b72106bf00ee3d", "score": "0.5810289", "text": "def clear\n @cache.clear\n end", "title": "" }, { "docid": "33af4b37f2a2baf6a7b72106bf00ee3d", "score": "0.5810289", "text": "def clear\n @cache.clear\n end", "title": "" }, { "docid": "a3e42997ba9c3f0fb2cc3235cbd596f0", "score": "0.5810004", "text": "def clear_all!\n @cache = Cache.new\n end", "title": "" }, { "docid": "05f58ee1a3db0c0d3ce923460d84bcc1", "score": "0.5809543", "text": "def clear_all_cache\n self.clear_permissions_and_roles\n self.clear_managers_and_reporters\n self.clear_ability_cache\n self.clear_available_programs_cache\n end", "title": "" }, { "docid": "0c614291e7322fa60618f2aef0d0aa2a", "score": "0.5808272", "text": "def clear\n provider.delete_matched(\"#{CACHE_KEY_PREFIX}*\")\n end", "title": "" }, { "docid": "058cd829f237bf097a1f80c384a7409f", "score": "0.5808095", "text": "def clear_cache!\n # This can be overridden\n end", "title": "" }, { "docid": "cf8e231d8abe97515b66c37dcee5f2ea", "score": "0.57816845", "text": "def clear_cache!\n self.cache.clear if self.cache.present?\n end", "title": "" }, { "docid": "1120cf40b180c0952ab1f92ae6ad8455", "score": "0.5774959", "text": "def clear_cache(options = {})\n defaults = {\n }\n\n options = defaults.merge(options)\n\n cached = []\n\n each_cache{|group, id| cached << VirtualMemory.clear(group, id)}\n\n field_cache.clear if field_cache\n\n #used_by_rows = used_by(true)\n\n #used_by_rows.each{|r| r.clear_cache }\n\n @cached = false\n \n cached.any?\n end", "title": "" }, { "docid": "f737161e3bdd6c61362a2404f76c2af4", "score": "0.57746756", "text": "def clear\n @cache.clear\n end", "title": "" }, { "docid": "9b52f1845f7a465c9b95a31bf9340341", "score": "0.5764178", "text": "def clear_cache\n @cache&.clear\n end", "title": "" }, { "docid": "9b52f1845f7a465c9b95a31bf9340341", "score": "0.5764178", "text": "def clear_cache\n @cache&.clear\n end", "title": "" }, { "docid": "3f6ce82fcf708e9ede1af46ca4df9735", "score": "0.5758879", "text": "def clear\n cache.clear\n end", "title": "" }, { "docid": "ed9dc626aeb590a3652864f6f89400b8", "score": "0.57570326", "text": "def clear_strategies_cache!(*args)\n scope, _opts = _retrieve_scope_and_opts(args)\n\n @winning_strategies.delete(scope)\n @strategies[scope].each do |k, v|\n v.clear! if args.empty? || args.include?(k)\n end\n end", "title": "" }, { "docid": "b99b75ad844e3d73b8b8069a286145da", "score": "0.5738244", "text": "def clear\n clear_database\n end", "title": "" }, { "docid": "a728a774967746d4c8fe2729a5e50097", "score": "0.5738022", "text": "def clear_queries\n @active_queries = []\n end", "title": "" }, { "docid": "7e69105bdc503638ed5c34caf6b30187", "score": "0.57209766", "text": "def clear_cache!\n @cache = {}\n end", "title": "" }, { "docid": "8d87f2fd761c2677b07cc0a32aa41515", "score": "0.5716319", "text": "def clear_all\n @orm.clear_all\n end", "title": "" }, { "docid": "765bc1101e522a88d165f1c6b86a4fb7", "score": "0.569372", "text": "def clear\n @pools = []\n DB.clear\n Host.clear\n end", "title": "" }, { "docid": "09ffb5b4a32483fc559bfe24cbfd5dcd", "score": "0.56858045", "text": "def drop_table(*)\n clear_statement_caches\n super\n end", "title": "" }, { "docid": "6e232962801993a4c4b7fc88784dd39e", "score": "0.5677156", "text": "def clear\n @cache.flush\n end", "title": "" }, { "docid": "0a02a2be7a8a04145bd66f3aa2c9d57d", "score": "0.567498", "text": "def flush_connections\n caches.synchronize { caches.clear }\n end", "title": "" }, { "docid": "aa18965f5ddd7f6ae28ff2f8bdd05bda", "score": "0.56710196", "text": "def clear_cache; end", "title": "" }, { "docid": "d76d1032eab0395cd33303335c669f55", "score": "0.5659531", "text": "def clear_resultset\n @resultset = nil\n end", "title": "" }, { "docid": "1eabc33f61200beebf6780d171e6c34b", "score": "0.5659406", "text": "def disable_sql_caching!\n cache_set(:_no_cache_sql, true)\n end", "title": "" }, { "docid": "da0acaf837be8efac6ce9b3611836ee0", "score": "0.56528586", "text": "def clear(options=nil)\n @cache_wrapper.clear\n @fetch_cache.clear\n end", "title": "" }, { "docid": "03311a59d89cbf47dd49c551e6de8dea", "score": "0.56509864", "text": "def clear_table_cache!(table_name)\n @columns.delete table_name\n @columns_hash.delete table_name\n @primary_keys.delete table_name\n @tables.delete table_name\n end", "title": "" }, { "docid": "03311a59d89cbf47dd49c551e6de8dea", "score": "0.56493306", "text": "def clear_table_cache!(table_name)\n @columns.delete table_name\n @columns_hash.delete table_name\n @primary_keys.delete table_name\n @tables.delete table_name\n end", "title": "" }, { "docid": "4957e57f470f68755459b67414080c4e", "score": "0.56466293", "text": "def purge_cache\n @cache = {}\n end", "title": "" }, { "docid": "1f794b5387b4850212883583fa0a8226", "score": "0.5645068", "text": "def clear_cache\n @_data = nil\n end", "title": "" }, { "docid": "72322b300618b8e12859483b25ce9e15", "score": "0.5643529", "text": "def clear\n invalid_keys = all_keys.select { |key| key.include?(@scope.table_name.downcase) }\n invalid_keys.each { |key| Rails.cache.delete(key) }\n\n Rails.cache.write(list_key, all_keys - invalid_keys)\n end", "title": "" }, { "docid": "063855984fdc96e60e0847ecbc1daf18", "score": "0.5642088", "text": "def flush_cache!\n @cache = { }\n end", "title": "" }, { "docid": "1511a2591bf37b1451431815fa0da171", "score": "0.5639496", "text": "def clear\n instrument(:clear, nil, nil) do\n @data.flushdb\n end\n end", "title": "" }, { "docid": "df39f2d7b113bb77f0907f2e6c1dd86b", "score": "0.5632275", "text": "def clear(options = {})\n @resource_writable.statements.delete(prepare_filter_insert_options(options))\n end", "title": "" }, { "docid": "2d9ba53b1b89355ab1f56e1ac56dffad", "score": "0.56302536", "text": "def clear_cache\n nil\n end", "title": "" }, { "docid": "2d9ba53b1b89355ab1f56e1ac56dffad", "score": "0.56302536", "text": "def clear_cache\n nil\n end", "title": "" }, { "docid": "e02ef2a5773d4c1e2d51d736a171a44a", "score": "0.56290406", "text": "def clear_cache\n @cache&.clear\n @populate_state = 1 if @populate_state == 2\n end", "title": "" }, { "docid": "4366cdb20c5687b7a8125d976a31cd08", "score": "0.5626221", "text": "def clear\n \n [ @store, @maps ].each { |db| truncate_db db }\n \n return unless @use_idx\n \n [ @idx1, @idx2 ].each { |db| truncate_db db }\n \n return unless @use_add_idx\n \n [ @k_idx, @v_idx, @id_idx ].each { |db| truncate_db db }\n end", "title": "" }, { "docid": "91ffe35505be49d6666d44946702e39c", "score": "0.56221294", "text": "def clear!\n NastyCache.instance.delete(\"#{name}#all\")\n NastyCache.instance.delete(\"#{name}#records\")\n end", "title": "" }, { "docid": "7fbcccb5b02ebef6785630b33f0c7734", "score": "0.561833", "text": "def removeAll()\n if @stmt.nil?\n raise CliError, \"ResultSet was aleady closed\"\n end\n if @stmt.con.nil? \n raise CliError, \"Statement was closed\"\n end\n if !@stmt.for_update\n raise CliError, \"Updates not allowed\"\n end\n @stmt.con.sendReceiveCommand(Connection::CliCmdRemove, @stmt.stmt_id)\n end", "title": "" }, { "docid": "5fbf9fbf713199cea0b3b8791302820d", "score": "0.56059474", "text": "def cache_reset\r\n cache_clear\r\n @cache_total_hits = 0\r\n @cache_total_queries = 0\r\n end", "title": "" }, { "docid": "5fbf9fbf713199cea0b3b8791302820d", "score": "0.56059474", "text": "def cache_reset\r\n cache_clear\r\n @cache_total_hits = 0\r\n @cache_total_queries = 0\r\n end", "title": "" }, { "docid": "a52dccc52d65a137cf5ad1494f305639", "score": "0.5601445", "text": "def clear_cache!\n \n end", "title": "" }, { "docid": "a52dccc52d65a137cf5ad1494f305639", "score": "0.5601445", "text": "def clear_cache!\n \n end", "title": "" }, { "docid": "b50edf9418f5bb54fe339415e4d3b07a", "score": "0.5596106", "text": "def clear_cache\n Rails.cache.clear\n end", "title": "" }, { "docid": "ebf194788d7ed0aead5570f77a48c370", "score": "0.55948067", "text": "def reset_cache\n return unless enabled?\n\n connection_pool.with do |redis|\n redis.keys(\"#{KEY_PREFIX}*\").each do |key|\n redis.del key\n end\n end\n end", "title": "" } ]
967665ee5a3a1c6123b2107dd59e0b0e
GET /discounts_products/1 GET /discounts_products/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "d1514b994211351a6f33043cae2fe3b3", "score": "0.7323721", "text": "def index\n @discounts_products = DiscountsProduct.all\n end", "title": "" }, { "docid": "db7b69e5d97cfa04e5b4b91de943e329", "score": "0.6696047", "text": "def set_discounts_product\n @discounts_product = DiscountsProduct.find(params[:id])\n end", "title": "" }, { "docid": "3503e75535ccbeba6849aee931bb6e9d", "score": "0.6695827", "text": "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end", "title": "" }, { "docid": "8ff28c9ff9c254503d27c003ce5205d3", "score": "0.66403383", "text": "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "title": "" }, { "docid": "19210ddea6e3a8d6d95c4ca55b670259", "score": "0.65196", "text": "def show\n json_response(@api_v1_product)\n end", "title": "" }, { "docid": "c18643ebc64f7c111d4cd5319e9fcfba", "score": "0.6509286", "text": "def index\n @food_products = FoodProduct.all\n render json: @food_products\n end", "title": "" }, { "docid": "280233bc0e09e2e3fe2c7ab8f024b28d", "score": "0.6493078", "text": "def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "title": "" }, { "docid": "c1131125291b7d642c8bc0fc87fddf57", "score": "0.64888144", "text": "def show\n render json: @product, status: 200\n end", "title": "" }, { "docid": "cda9cc6ce501e0759ebd220bb0d15c09", "score": "0.64819556", "text": "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "title": "" }, { "docid": "39954a9004383ebadcde3635937e7b58", "score": "0.6468122", "text": "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "title": "" }, { "docid": "e7f81a2db5836675357a443a3156c552", "score": "0.64570355", "text": "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "title": "" }, { "docid": "15487489fda1615d234261cbdb26c863", "score": "0.6452057", "text": "def index\n @products = Product.all\n render json: @products\n end", "title": "" }, { "docid": "fd872907eafc1e4ecae3f32975d12906", "score": "0.6444322", "text": "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "title": "" }, { "docid": "cbe9bfc8528a9100c5ab5f78e23a528f", "score": "0.64198595", "text": "def show\n @product = Product.find(params[:id])\n json_response(params)\n end", "title": "" }, { "docid": "46a7cb575b124de46aba3a3cf73285bf", "score": "0.6400003", "text": "def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end", "title": "" }, { "docid": "dd9cc5df6c7d7fafd6418651228ab7fe", "score": "0.639473", "text": "def show\n result = Product.find(params[:id])\n render json: {\n status: :ok,\n product: result\n } \n end", "title": "" }, { "docid": "8a8ccf8670d9dedfc2e6404e6079399e", "score": "0.6373034", "text": "def index\n @products = Product.all\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "title": "" }, { "docid": "ffb1081fdfc4e1f8b7c2909def8909c9", "score": "0.6366225", "text": "def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end", "title": "" }, { "docid": "3ecc00117e5a0474c987651dea0b0fce", "score": "0.63605344", "text": "def show\n @product = Product.find(params[:id])\n render json: @product, status: :ok\n end", "title": "" }, { "docid": "92d87189ba3298b171f77c895073d717", "score": "0.6359868", "text": "def show\n @shopifyproduct = Shopifyproduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopifyproduct }\n end\n end", "title": "" }, { "docid": "6c8d7e4dcd0a6d46362e62a643bbf326", "score": "0.6358918", "text": "def show\n render json: @product\n end", "title": "" }, { "docid": "e36da4a2dac5504806124a614e31ca70", "score": "0.63374263", "text": "def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end", "title": "" }, { "docid": "b87484a56cba3da8597b9e04bf9c47bf", "score": "0.63367796", "text": "def show\n render json: @product\n end", "title": "" }, { "docid": "2e89d4c09297497fde6d927887f2b3dd", "score": "0.6335383", "text": "def index\n @products = Spree::Product.not_deleted.includes(:variants).page(params[:page]).per(Spree::Config[:orders_per_page])\n respond_with @products\n end", "title": "" }, { "docid": "3738741b91e2c274e3a6b0b7bac7605c", "score": "0.6328281", "text": "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "title": "" }, { "docid": "aef886df1b6f6bb8d4a458b096a54329", "score": "0.6320468", "text": "def getProduct( product_id)\n params = Hash.new\n params['product_id'] = product_id\n return doCurl(\"get\",\"/product\",params)\n end", "title": "" }, { "docid": "a43c803a1ed48fd0223339cbf8718819", "score": "0.6295542", "text": "def show\n @product = Product.eager_loading.find_by_uuid(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_shop_product_path(@product.shop_id, @product)}\n format.json { render json: @product.as_json(:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]) }\n end\n end", "title": "" }, { "docid": "dce379fa4102e4ae376037be760ec3fc", "score": "0.62881446", "text": "def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end", "title": "" }, { "docid": "e53b997f98fdb6893b98062f550e4fd0", "score": "0.62879044", "text": "def get_product\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "title": "" }, { "docid": "4a8536c71da97a713153d862e8bdaf66", "score": "0.62803125", "text": "def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end", "title": "" }, { "docid": "c15e26856d1c0bf482da05f023949c3e", "score": "0.6278533", "text": "def index\n \tproducts = Product.all\n \trender json: products\n \tend", "title": "" }, { "docid": "8ac190f550d208c0ac48b3c226bd7085", "score": "0.6278095", "text": "def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end", "title": "" }, { "docid": "4d9287910e2fa117b1dcfa8f083ad01c", "score": "0.62723964", "text": "def show\n render json: @product_buy_click\n end", "title": "" }, { "docid": "0f760566c2f66ab13f99895b1246ded5", "score": "0.6267578", "text": "def index\n\t@products = Product.where(:inventory => true).order(:category_id).page(params[:page])\n @donors = Donor.all\n @categories = Category.all\n @products2 = Product.where(:inventory => false).order(:category_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "d51c94a568cbfeedbd6276c7a66a2e39", "score": "0.6266396", "text": "def show\n @product = ProductProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "501fe178c3ca851005fe6883f2b17603", "score": "0.6264292", "text": "def show\n @product = Product.find(params[:id]) \n # @product_id = @product.id\n # @review = Review.find(@product_id)\n\n # @reviews = Review.where(:product_id => params[:id])\n @reviews = Review.where(:product_id => @product.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "22c77d897f1c1828b58a8ae7bab74f51", "score": "0.625943", "text": "def show\n @product = Product.find(params[:id])\n @donor = Donor.all\n @event = Event.all\n @category = Category.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "fb0d0654ff379781219a23ec51f41e91", "score": "0.6258811", "text": "def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end", "title": "" }, { "docid": "ca2505d77a30a229da977ec6ddf7a596", "score": "0.6257491", "text": "def products\n request :public, :get, :products\n end", "title": "" }, { "docid": "9d44df0dcf4adc53c46e2aa4ff3d4bf9", "score": "0.6254128", "text": "def index\n @products = @co.products\n end", "title": "" }, { "docid": "9b98760fda2102d4755c6b0ab77fade8", "score": "0.62540805", "text": "def show\n render json: @food_product\n end", "title": "" }, { "docid": "22fa9ddee587d3d179774e4bb3e6a705", "score": "0.6241936", "text": "def get_products\n products = response['products']\n products_ops = []\n products.each_value do |value|\n product = {}\n product[:sku] = value['sku']\n product[:product_family] = value['productFamily']\n product[:pricing_list_id] = pricing_list.id\n attributes = value['attributes']\n product[:service_code] = attributes['servicecode']\n product[:location] = attributes['location']\n product[:location_type] = attributes['locationType']\n product[:usage_type] = attributes['usagetype']\n product[:operation] = attributes['operation']\n product[:request_description] = attributes['requestDescription']\n product[:request_type] = attributes['requestType']\n product[:service_name] = attributes['servicename']\n product[:pricing_list_id] = pricing_list.id\n product[:created_at] = Time.zone.now.utc\n product[:updated_at] = Time.zone.now.utc\n products_ops << product\n end\n products_ops\n end", "title": "" }, { "docid": "eb14d17ef9f0d3b375ed84c202fe007b", "score": "0.6241044", "text": "def index\n @products = Product.order('category, priority desc, price')\n @basket_size = count_basket_items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "ea1dbb70117bfb1f1b404fed58318ca5", "score": "0.6233028", "text": "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end", "title": "" }, { "docid": "3f74be3d02d9457bd02cb99107f2d11d", "score": "0.6231856", "text": "def show\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carts_product }\n end\n end", "title": "" }, { "docid": "fbd255aae29e7f8af10d6e129f479670", "score": "0.6230598", "text": "def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "6c6d68ac040b13bec98600ae91067da9", "score": "0.622307", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "6c6d68ac040b13bec98600ae91067da9", "score": "0.62227136", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "6c6d68ac040b13bec98600ae91067da9", "score": "0.62227136", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "6c6d68ac040b13bec98600ae91067da9", "score": "0.62227136", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "2ec7c4efc5b561b70ac9e94b79ce4f31", "score": "0.62144464", "text": "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "title": "" }, { "docid": "7bd14028073b4d69ed1d75e076507a4b", "score": "0.6213262", "text": "def index\n params[:page] ||= 1\n params[:perPage] ||= 10\n @page = params[:page].to_i\n @item_per_page = params[:perPage].to_i\n @item_count = current_user.shops.find_by_uuid(params[:shop_id]).products.count\n @products = current_user.shops.find_by_uuid(params[:shop_id]).products.eager_loading\n .limit(@item_per_page).offset(@item_per_page*(@page-1)).order(:position)\n json_options = {:include => {:product_variants => {:include => [:option_types,:pictures]}, :shipping_category => {}}, :methods => [:taxon_ids]}\n unless params[:promotionStart].blank?\n start_date = params[:promotionStart].to_datetime\n end_date = params[:promotionEnd].blank? ? nil : params[:promotionEnd].to_datetime\n json_options = json_options.merge({promotionStartDate: start_date, promotionEndDate: end_date})\n end\n respond_to do |format|\n format.html\n format.json { render json: {\n :products => @products.as_json(json_options),\n :page => @page,\n :total => @item_count,\n :perPage => @item_per_page\n }\n }\n end\n end", "title": "" }, { "docid": "ebc58d87a16c591cdfe7c5c829eaaeea", "score": "0.6213135", "text": "def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end", "title": "" }, { "docid": "23cf07919906cdc7068674e27e15c3f8", "score": "0.62022483", "text": "def show\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_product }\n end\n end", "title": "" }, { "docid": "d30f7c365bc8d4d3dfef94d966efe9c4", "score": "0.6197106", "text": "def index\n render :json => Producto.all\n end", "title": "" }, { "docid": "7076d6876750e22488e6c9058af0c60b", "score": "0.61933875", "text": "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "092e6731153f9e369b41e7d162045434", "score": "0.6193269", "text": "def show\n @product = Product.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "4ef39e25a97186b17396104c55367e7c", "score": "0.6183962", "text": "def index\n #@products = Product.all\n @products = Product.paginate( :page => params[:page],\n :per_page => 40\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "c1a10f4b1a8ea4f0189a52a607999216", "score": "0.6181308", "text": "def show\n @advicepost = Advicepost.find(params[:id])\n\n @products = Product.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advicepost }\n end\n end", "title": "" }, { "docid": "075ad7ed0c49c8b98b1f82ad28bf9480", "score": "0.6172795", "text": "def show\n @ordered_product = OrderedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordered_product }\n end\n end", "title": "" }, { "docid": "7c549d8df9bc9f9e2abef16ad7740a76", "score": "0.6170749", "text": "def new\n @product = Product.find(params[:product_id])\n @purchase = Purchase.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end", "title": "" }, { "docid": "901a4797f4d33199ced17e8fd0fb4dfb", "score": "0.61692095", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "title": "" }, { "docid": "901a4797f4d33199ced17e8fd0fb4dfb", "score": "0.61692095", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "title": "" }, { "docid": "901a4797f4d33199ced17e8fd0fb4dfb", "score": "0.61692095", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "title": "" }, { "docid": "901a4797f4d33199ced17e8fd0fb4dfb", "score": "0.61692095", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @products }\n end\n end", "title": "" }, { "docid": "ffc91496019ba479ecd05d9a9803823c", "score": "0.616781", "text": "def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "4d3145f2235ffd76a5d356155a30ec7f", "score": "0.61648923", "text": "def show\n @product_delivered = ProductDelivered.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_delivered }\n end\n end", "title": "" }, { "docid": "17bd9f8eac6bb24037a987f8eb7b063d", "score": "0.61645544", "text": "def show\n if is_my_resource(@product.prossumer_id)\n render json: @product.as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n end\n end", "title": "" }, { "docid": "9c065f81ee5f7c39ee9075914f0f0bca", "score": "0.61620164", "text": "def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end", "title": "" }, { "docid": "bde33ea78ab3b931b5d3a3f571943bc1", "score": "0.61605805", "text": "def index\n limit = params[:limit]&.to_i || 10\n page = params[:page]&.to_i || 0\n if params[:available] == \"1\"\n @products = Product.paginate(page, limit).available\n else\n @products = Product.paginate(page, limit)\n end\n render json: @products\n end", "title": "" }, { "docid": "a7bff1fdfa8f12c8958df1e1e90db365", "score": "0.6148239", "text": "def show\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productonegocio }\n end\n end", "title": "" }, { "docid": "6a6f585e61fdc3076fd42642e3520725", "score": "0.61442924", "text": "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "title": "" }, { "docid": "b911df536e0439e132470139efd43dd8", "score": "0.61399144", "text": "def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "title": "" }, { "docid": "c7e306647bbc87b76cfdfa27a2093dd1", "score": "0.6138354", "text": "def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end", "title": "" }, { "docid": "92a6a3f0560926e9e04fa5a12e077863", "score": "0.6130179", "text": "def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end", "title": "" }, { "docid": "9559e8d09288528c70dc48c620906f85", "score": "0.61262023", "text": "def show\n @star_product = Star::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @star_product }\n end\n end", "title": "" }, { "docid": "244eb744fb11fd6e98d7b84203f49aeb", "score": "0.6125803", "text": "def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end", "title": "" }, { "docid": "d66e49b041e02896ed2113ba2a873f87", "score": "0.6123489", "text": "def show\n @product_sold = ProductSold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_sold }\n end\n end", "title": "" }, { "docid": "a409888514b28aa7fc65c64029e66007", "score": "0.61199605", "text": "def index\n scope = Product.includes(:merchant, :brand, :category, :founder, :likers, comments: :user)\n scope = scope.order(updated_at: :desc)\n @products = paginate scope.all\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "title": "" }, { "docid": "8b628a6cb54c59730bee1295bfc8a336", "score": "0.6114552", "text": "def show\n render json: @product_management\n end", "title": "" }, { "docid": "a94c4e3783645e5c7fc49e3cd147416e", "score": "0.61104345", "text": "def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end", "title": "" }, { "docid": "77a92df4c44fc05a08ad64637fc1a254", "score": "0.6109182", "text": "def create\n @discounts_product = DiscountsProduct.new(discounts_product_params)\n\n respond_to do |format|\n if @discounts_product.save\n format.html { redirect_to @discounts_product, notice: 'Discounts product was successfully created.' }\n format.json { render :show, status: :created, location: @discounts_product }\n else\n format.html { render :new }\n format.json { render json: @discounts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.61061805", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "19c51210b20ce7f563db64569982c507", "score": "0.61060494", "text": "def index\n @products = Product.all\n render json: {is_success: true, error_code: 200, message: \"Products Found Successfully\", result: @products}, status: 200\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" }, { "docid": "7e2b915840ae4fbae4d15e4513dea87c", "score": "0.6105091", "text": "def show\n @product = Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "title": "" } ]
18da277f33376f6884383c032802d480
Gets the IP ToS values in packets sent to peer.
[ { "docid": "69161ff0814719e64f23d5d41c40d6a7", "score": "0.58087516", "text": "def ip_tos_to_peer\n super\n end", "title": "" } ]
[ { "docid": "785f874fdb9a26443ee51957fc54921c", "score": "0.6121373", "text": "def ip_tos\n\t\tself[:ip_tos].to_i\n\tend", "title": "" }, { "docid": "d7e1bb2b5a4cf1e402a3c2a5e63f104e", "score": "0.6088668", "text": "def sender_ip\n return @sender_ip\n end", "title": "" }, { "docid": "99a771ac74011fade519c534699f1ceb", "score": "0.5979375", "text": "def ip_tos\n # TODO\n end", "title": "" }, { "docid": "b266c618f9719ed4a2413350e4bb62dd", "score": "0.5956688", "text": "def get_IP\n ip_list = []\n Socket.ip_address_list.each do |address|\n ip_list.push(address.ip_address)\n end\n ip_list\n end", "title": "" }, { "docid": "2eb97f957d57b25236d933b3bee3190b", "score": "0.59499854", "text": "def to_s\r\n @ip\r\n end", "title": "" }, { "docid": "39b7f5d78f95bc4cb5414f064f9bdcdf", "score": "0.5926979", "text": "def ip_tos\n\t\t@ip_tos ||= (ip_dscp << 2)\n\tend", "title": "" }, { "docid": "26a7f26c94d80701b9c400db1ddc9906", "score": "0.5918061", "text": "def ips\n @ips\n end", "title": "" }, { "docid": "3780fa4389bc8deb282a6002eedd98b8", "score": "0.5904809", "text": "def ips\n @attributes['ips']\n end", "title": "" }, { "docid": "c937231b7e18538794aecc53d0115cd2", "score": "0.5875095", "text": "def ip_addresses\n @attributes[:ip_addresses]\n end", "title": "" }, { "docid": "c937231b7e18538794aecc53d0115cd2", "score": "0.5875095", "text": "def ip_addresses\n @attributes[:ip_addresses]\n end", "title": "" }, { "docid": "3a043ed04bcd22b5f1faa36e53efff10", "score": "0.58447725", "text": "def to_s\n @ip ||= calculate_ip\n end", "title": "" }, { "docid": "3a043ed04bcd22b5f1faa36e53efff10", "score": "0.58447725", "text": "def to_s\n @ip ||= calculate_ip\n end", "title": "" }, { "docid": "1771d1f150adc7d18ddea94d62cfa991", "score": "0.581674", "text": "def addresses\n @sender.addresses\n end", "title": "" }, { "docid": "14b8d0aee1105682d4b562f845ed4a69", "score": "0.5794755", "text": "def packed_ip()\n return(@ip)\n end", "title": "" }, { "docid": "c78c90ed5961fae9e4be4346226a7416", "score": "0.5705467", "text": "def get_node_ips\n ips = []\n node.workorder.payLoad.ManagedVia.each do |n|\n ips.push(n[:ciAttributes]['priviate_ip'])\n end\n ips\nend", "title": "" }, { "docid": "1b0b123e164f4f9b9a755db3d7742385", "score": "0.56739014", "text": "def get_recipients(packet)\n @recipients_certs\n end", "title": "" }, { "docid": "51ce31245c5ef3cef745ecff949ae67d", "score": "0.56691426", "text": "def get_addresses\n context.getAttribute('javax.servlet.sip.outboundInterfaces')\n end", "title": "" }, { "docid": "0a4258d38ba545241b630e3b567f925b", "score": "0.5635822", "text": "def ip\n @data && @data[:peer] && @data[:peer][:ip]\n end", "title": "" }, { "docid": "62c4abfc69c13ab630b2ac556991540c", "score": "0.5628524", "text": "def octets\n to_ip.split(\".\").map{|i| i.to_i}\n end", "title": "" }, { "docid": "4d850a4895c0105a4aebbd2ee8156ae0", "score": "0.55810386", "text": "def ip_to_string \n Networking.i_to_ip self.ip \n end", "title": "" }, { "docid": "192190c5966c491464f83ffa5ad28a1f", "score": "0.55401194", "text": "def ip\n @attributes[:ip]\n end", "title": "" }, { "docid": "192190c5966c491464f83ffa5ad28a1f", "score": "0.55401194", "text": "def ip\n @attributes[:ip]\n end", "title": "" }, { "docid": "192190c5966c491464f83ffa5ad28a1f", "score": "0.55401194", "text": "def ip\n @attributes[:ip]\n end", "title": "" }, { "docid": "192190c5966c491464f83ffa5ad28a1f", "score": "0.55401194", "text": "def ip\n @attributes[:ip]\n end", "title": "" }, { "docid": "33ae07b592dc0658ab256575159ff263", "score": "0.55167973", "text": "def ips\n @stats.central_tendency\n end", "title": "" }, { "docid": "93b6107b06a8f14fb4260a82c2f15f3a", "score": "0.5514809", "text": "def payload\n if self.send_type == EasyIP::Operand::STRING\n self.data.unpack(\"Z*\")\n else\n values = self.data.unpack(\"v\" * self.send_size)\n end\n end", "title": "" }, { "docid": "be058dd93cb1f18bf6508bfea5fb3758", "score": "0.5499937", "text": "def relay_i_p_address\n return @relay_i_p_address\n end", "title": "" }, { "docid": "c914a010340f617866ad80822e7fda49", "score": "0.54938155", "text": "def tcp_dst=(i); typecast i; end", "title": "" }, { "docid": "fd89089005dd06effb64d974026a6ca2", "score": "0.54711217", "text": "def to_s\n\t\tself.packet.to_s\t\n\tend", "title": "" }, { "docid": "f5afcf747b74dbfd875dbc100aa5e9d2", "score": "0.54702127", "text": "def getSenderAddress()\n return [@sendAddr, @sendPort]\n end", "title": "" }, { "docid": "1c3c68173fbf3131b3f46c33b8c9473e", "score": "0.546789", "text": "def sender_ip=(value)\n @sender_ip = value\n end", "title": "" }, { "docid": "ee95f2c4f93b6c2e6926b609b14df7a0", "score": "0.54552877", "text": "def ip_src\n\t\tself[:ip_src].to_i\n\tend", "title": "" }, { "docid": "47d3ce9cba8cb3037d8bf96d0f13cd7a", "score": "0.54551005", "text": "def values\n inet = []\n if @config[:address]\n PuppetX::BSD::HostnameIf::Inet.new(@config[:address]).process do |i|\n inet << i\n end\n end\n\n data = []\n data << vlan_string\n data << inet if inet\n data.flatten\n end", "title": "" }, { "docid": "0f983e8611bf19c90aef1269d6f59abd", "score": "0.54548013", "text": "def ip_dest\n\t\tself[:ip_dest].to_i\t\t\n\tend", "title": "" }, { "docid": "bbaf172db656d3ff15bf9b58b4d9e336", "score": "0.5452225", "text": "def to_s\n\t\t#Hex \n\t\tip_v_hl = [(self[:ip_v] << 4) + self[:ip_hl]].pack(\"C\")\n\t\tip_v_hl + self.to_a[2,10].map {|x| x.to_s}.join\n\tend", "title": "" }, { "docid": "9f7d4ae0261865e14f3be3834e2b7ed6", "score": "0.5442383", "text": "def to_s\n ip_address\n end", "title": "" }, { "docid": "aab52a66653a5c38488c876d5bf6d367", "score": "0.5437013", "text": "def values\n inet = []\n if @config[:address]\n PuppetX::BSD::Hostname_if::Inet.new(@config[:address]).process {|i|\n inet << i\n }\n end\n\n data = []\n data << vlan_string\n data << inet if inet\n data.flatten\n end", "title": "" }, { "docid": "9f57d74370dc942ec3dc3fc5645f3f3c", "score": "0.5422877", "text": "def get_list\n list = []\n\n @packets.each do |packet|\n if(packet[:direction] == CLIENT_TO_SERVER)\n value = \"%s:%s => %s:%s [%d bytes]\" % [packet[:src], packet[:sport], packet[:dst], packet[:dport], packet[:data].length]\n else\n value = \"%s:%s <= %s:%s [%d bytes]\" % [packet[:src], packet[:sport], packet[:dst], packet[:dport], packet[:data].length]\n end\n\n list << value\n# list << {\n# :value => value,\n# :details => Hex.get_str(packet[:data])\n# }\n \n end\n\n return list\n end", "title": "" }, { "docid": "dc9afafc83bd19c9d272724e77049253", "score": "0.54160416", "text": "def get_list\n list = []\n\n @packets.each do |packet|\n if(packet[:direction] == CLIENT_TO_SERVER)\n value = \"%s:%s => %s:%s [%d bytes]\" % [packet[:src], packet[:sport], packet[:dst], packet[:dport], packet[:data].length]\n else\n value = \"%s:%s <= %s:%s [%d bytes]\" % [packet[:src], packet[:sport], packet[:dst], packet[:dport], packet[:data].length]\n end\n\n list << value\n # list << {\n # :value => value,\n # :details => Hex.get_str(packet[:data])\n # }\n\n end\n\n return list\n end", "title": "" }, { "docid": "a6d8ab94cc42f06df97b69142acb3af5", "score": "0.53874534", "text": "def payer_ip\n params['sourceIp']\n end", "title": "" }, { "docid": "71fce790b1857df76a2f26752a91643a", "score": "0.53662455", "text": "def to_array\n [@ip_addr,\n @mac,\n @oui]\n end", "title": "" }, { "docid": "79f4940c374e08fb9d5187bccc334572", "score": "0.53662354", "text": "def peers_seeding\n attributes['peersSendingToUs']\n end", "title": "" }, { "docid": "30f24d8007b8f859ff1ea8da320385e2", "score": "0.53454727", "text": "def ip_address(session)\n return session.peeraddr[3]\n end", "title": "" }, { "docid": "afbb050f1e24e129592e7f1ae60822cb", "score": "0.5331766", "text": "def info\n @visitors_ip = @url.ips\n end", "title": "" }, { "docid": "ba682c8e6cec1713d9c60c2b01b0b59f", "score": "0.5325362", "text": "def current_values\n\t\t@values ||= read_ip\n\tend", "title": "" }, { "docid": "360c04d207e1ffb33d9f3f877e0b0eea", "score": "0.53136045", "text": "def ip_data\n @raw_data[ip_hlen*4,self.caplen-ip_hlen*4]\n end", "title": "" }, { "docid": "f35711f04b605eb037cc08728a9c296c", "score": "0.5305462", "text": "def tcp_sport ; ip_data[0,2].unpack(\"n\").first ; end", "title": "" }, { "docid": "1ed85fd1ec685f44c8853d3e50aab172", "score": "0.5304732", "text": "def ip_src\n @src\n end", "title": "" }, { "docid": "e36ef1b4bb3a2c0951d17a667b1ba3b9", "score": "0.52983385", "text": "def remote_ip\n @remote_ip ||= @socket.peername[0]\n end", "title": "" }, { "docid": "325d92899b28efd82338194280df3f97", "score": "0.5284602", "text": "def list_packets\n raise NotImplementedError # TODO\n end", "title": "" }, { "docid": "032d3b2c04880beb9293eef865798cbb", "score": "0.52838635", "text": "def ip_address\n @attributes[:ip_address]\n end", "title": "" }, { "docid": "42150bc07d352ad726e60f0bad6fcfbb", "score": "0.5273328", "text": "def arp_saddr_ip\n\t\t\t[arp_src_ip.o1,arp_src_ip.o2,arp_src_ip.o3,arp_src_ip.o4].join('.')\n\t\tend", "title": "" }, { "docid": "df515752de0f348f81eec830d004f6b7", "score": "0.5270455", "text": "def tcp_dport ; ip_data[2,2].unpack(\"n\").first ; end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.52550733", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.52550733", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.5254136", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.5254136", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.5254136", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "e6286af0040e1c7de1d084b7fc7e1c7a", "score": "0.52540153", "text": "def ip\n @ip\n end", "title": "" }, { "docid": "48ec58a227ba77ee9a5d3cba5cc05ab7", "score": "0.5253736", "text": "def allServedPointsPartialP2P\r\n createTotalThroughPutsReturnPartial(:include_peer_send_bytes => true).flipIndexValueOfContainedDuples\r\n end", "title": "" }, { "docid": "06669451cc3faf0a23e57047d9fa581c", "score": "0.5252667", "text": "def destination_service_ip\n return @destination_service_ip\n end", "title": "" }, { "docid": "931356a33b2fda3f927cad23d52233da", "score": "0.5247097", "text": "def data\n pkts = @pkts.sort_by!{|pk| pk.timestamp }\n pkts.map{|pkt| pkt.payload }.select{|pay| pay !~ /\\A\\0+\\Z/}.compact.join\n end", "title": "" }, { "docid": "5fa47f65b6ca2c1da9524d187bbbba32", "score": "0.52459335", "text": "def ip_saddr\n\t\t\t[ip_src.o1,ip_src.o2,ip_src.o3,ip_src.o4].join('.')\n\t\tend", "title": "" }, { "docid": "3bc52aafbbcb9fd4cd55a38f9bf04d2e", "score": "0.52393806", "text": "def ip\n self.IP\n end", "title": "" }, { "docid": "828e9a5cd9567492dca1fed9ee209289", "score": "0.5237237", "text": "def server_ip_tos\n super\n end", "title": "" }, { "docid": "756e7aa47a434edcac9178fd68419428", "score": "0.52356213", "text": "def get_ip\n return @ip\n end", "title": "" }, { "docid": "55b5263ebf55e023e427df849291d004", "score": "0.5232292", "text": "def arp_src_ip=(i); typecast i; end", "title": "" }, { "docid": "2936faf66cf30d2edc23fee14d9da29d", "score": "0.5229273", "text": "def state_values\n @values ||= read_ip_output\n end", "title": "" }, { "docid": "2936faf66cf30d2edc23fee14d9da29d", "score": "0.5229273", "text": "def state_values\n @values ||= read_ip_output\n end", "title": "" }, { "docid": "2936faf66cf30d2edc23fee14d9da29d", "score": "0.5229273", "text": "def state_values\n @values ||= read_ip_output\n end", "title": "" }, { "docid": "83c122e98c48c527313541d78c9488c6", "score": "0.52231914", "text": "def get_ip_address\n return @m_ip_address\n end", "title": "" }, { "docid": "e8db698f52b38c6a6cc090965fd54245", "score": "0.52223355", "text": "def tcp_dst; self[:tcp_dst].to_i; end", "title": "" }, { "docid": "773364eb20fcfa9d29c0b6c8c08370db", "score": "0.5219567", "text": "def udp_src; self[:udp_src].to_i; end", "title": "" }, { "docid": "b589df2f6ceea015dc672c6381eb9614", "score": "0.5218204", "text": "def ips\n json_response(Post.ips)\n end", "title": "" }, { "docid": "05f7a1ec2a34045bc2507f8f2654b30f", "score": "0.5218157", "text": "def peer_info\n peer_bytes = get_peername[2, 6].unpack(\"nC4\")\n port = peer_bytes.first.to_i\n ip = peer_bytes[1, 4].join(\".\")\n\n [ip, port]\n end", "title": "" }, { "docid": "62b795df10164dc02c04a1c7b3b3bc42", "score": "0.52170426", "text": "def peers\n# @table_lock.synchronize { @nid_peers.values }\n @nid_peers.values \n end", "title": "" }, { "docid": "3cc51b498569a4da17cd55914c7a0f73", "score": "0.5212717", "text": "def udp_src=(i); typecast i; end", "title": "" }, { "docid": "b1df84e220aea8782218003c1c577ae7", "score": "0.52107704", "text": "def remote_ip\n return self[\"client-ip\"] || @forwarded_for || @peeraddr[3]\n end", "title": "" }, { "docid": "df4396331502663adedd71577a8604bf", "score": "0.521063", "text": "def arp_src_ip; self[:arp_src_ip].to_s; end", "title": "" }, { "docid": "2ccc298ca2cc64bfb9c1c8f0e9d13f1d", "score": "0.52100265", "text": "def num_packets_all\n self.num_packets_incoming + self.num_packets_outgoing\n end", "title": "" }, { "docid": "e8488d5b442ebe8c6e837bb4931c7821", "score": "0.5209755", "text": "def getIPs interface\n return []\n end", "title": "" }, { "docid": "6d65f2c1855212dfc76b22d0f63c28ed", "score": "0.52081054", "text": "def private_ip_addresses\n @ni.private_ip_addresses\n end", "title": "" }, { "docid": "a6603d2647a8979af5acad1938e38f4e", "score": "0.520687", "text": "def ip_proto\n\t\tself[:ip_proto].to_i\n\tend", "title": "" }, { "docid": "7013ed6eac3a1de0b1529bf35732b700", "score": "0.5206801", "text": "def udp_dst=(i); typecast i; end", "title": "" }, { "docid": "672abfa68e2740f8a02b2836300a3a52", "score": "0.52031946", "text": "def arp_dst_ip=(i); typecast i; end", "title": "" }, { "docid": "49c13f55a75839707e542e3bec91a649", "score": "0.5196894", "text": "def getSendSockAttr\n return @sendSock, @sendAddr, @sendPort\n end", "title": "" }, { "docid": "da3f99f3753a73a40b4c82d2fc67dfac", "score": "0.51813006", "text": "def private_ip_addresses\n data[:private_ip_addresses]\n end", "title": "" }, { "docid": "3866dec7ea4db711db87a1f480b4cbd4", "score": "0.5176312", "text": "def client_ip_tos\n super\n end", "title": "" }, { "docid": "6d19fb4cdb2ae71d3d7b0070cf63564c", "score": "0.5158158", "text": "def addresses\n [get_peername, get_sockname].map do |addr|\n addr ? Socket.unpack_sockaddr_in(addr)[0, 2].reverse.join(':') : 'unknown'\n end\n end", "title": "" }, { "docid": "cf61155722e2eb8cd6e16cc387101030", "score": "0.5153508", "text": "def remote_ip\n @remote_ip ||= get_peername[4,4].unpack(\"C4\").map { |q| q.to_s }.join(\".\")\n end", "title": "" }, { "docid": "7a92cec7c333034196da5312961ec947", "score": "0.51530194", "text": "def getRoutingTableToSend(ip)\n rt_temp = [] # Temporary routing table for sending\n\n # Copy routing table\n @routing_table.each do |x|\n rt_temp.push(x)\n end\n\n rt_temp.push({:node_id => @id, :ip_address => ip}) # Add own details to copy\n return rt_temp\n end", "title": "" }, { "docid": "71fd1ca0ad79ccc85bf203af95ad6a55", "score": "0.515293", "text": "def get_slip_pbp\n search_pbp(SLIP)\n end", "title": "" }, { "docid": "433feb51b23e602a641e8abdceffae8f", "score": "0.5149327", "text": "def private_ip_addresses\n data.private_ip_addresses\n end", "title": "" }, { "docid": "5b9e8b8c1e072300ce1a0e387149741e", "score": "0.5144841", "text": "def smtp_list_ip\n send_request('smtp/ips')\n end", "title": "" }, { "docid": "1f9279ba35a4b78e311b89eea3aeb1e8", "score": "0.5144582", "text": "def tcp_urg=(i); typecast i; end", "title": "" }, { "docid": "cf856a7addb6a806e3212f405229137f", "score": "0.51436937", "text": "def ip_proto\n @raw_data.getbyte(9)\n end", "title": "" }, { "docid": "2e8c9d71c04854b94ecb3f96e76c02e8", "score": "0.5133028", "text": "def to\n (envelope[:to] || []).map {|a| address(a)}\n end", "title": "" }, { "docid": "16e78f4d9dd9b1f50d11a7a00f14d35b", "score": "0.5122788", "text": "def udp_sum=(i); typecast i; end", "title": "" }, { "docid": "6d0ad12e955f00b4acd8a74bfc6b5903", "score": "0.51178247", "text": "def arp_dst_ip; self[:arp_dst_ip].to_s; end", "title": "" }, { "docid": "9b78b569c55e41733a65397bdb466fbd", "score": "0.5117048", "text": "def ip_addresses; end", "title": "" } ]
bd989ce5eddd4c39b56be8de09767ee6
Sets the value of the `profile_details` attribute.
[ { "docid": "18f156d344f7cc2e7323d5def31c60a6", "score": "0.70961845", "text": "def profile_details=(list)\n if list.class == Array\n list = List.new(list)\n list.each_with_index do |value, index|\n if value.is_a?(Hash)\n list[index] = ProfileDetail.new(value)\n end\n end\n end\n @profile_details = list\n end", "title": "" } ]
[ { "docid": "802bbd0d233181124a2c4d6a15d97d65", "score": "0.68120795", "text": "def set_profile\n @profile = @current_user.profile\n end", "title": "" }, { "docid": "ad23e53d402025d7ff0e6ea7350f19ba", "score": "0.6794303", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "ad23e53d402025d7ff0e6ea7350f19ba", "score": "0.6794303", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "ad23e53d402025d7ff0e6ea7350f19ba", "score": "0.6794303", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "bc02e37ec595b5d8c3720d6db64456bd", "score": "0.6743228", "text": "def update_profile_details\n # https://api.slack.com/methods/users.profile.get\n # scopes: users.profile:read\n profile = slack_client.users_profile_get(user: slack_id)\n self.display_name = profile['profile']['display_name']\n self.image_url = profile['profile']['image_72']\n self.real_name = profile['profile']['real_name']\n save\n rescue Slack::Web::Api::Errors::MissingScope => _e\n false\n end", "title": "" }, { "docid": "f72f84eedc527f7ec7b53be3e8bae623", "score": "0.6605206", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "f72f84eedc527f7ec7b53be3e8bae623", "score": "0.6605206", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "f72f84eedc527f7ec7b53be3e8bae623", "score": "0.6605206", "text": "def set_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "1b360cca6d37ac3d8faffbc1a5d5affe", "score": "0.6595928", "text": "def set_profile\n @profile = current_user.profile \n end", "title": "" }, { "docid": "a4e2bc235598b6717728ddfb044c08bd", "score": "0.65913105", "text": "def set_user_profile\n @profile = current_user.profile\n end", "title": "" }, { "docid": "6b36757300ef6333746fcd6214b7ea20", "score": "0.658298", "text": "def details=(value)\n @details = value\n end", "title": "" }, { "docid": "6b36757300ef6333746fcd6214b7ea20", "score": "0.658298", "text": "def details=(value)\n @details = value\n end", "title": "" }, { "docid": "efe65903e4405b32eac4e3ac898eacb6", "score": "0.65500826", "text": "def set_profile\n @profile = current_user.profile || Profile.new\n end", "title": "" }, { "docid": "d2751501c0d9e326df9ef2459dd800b7", "score": "0.6544297", "text": "def set_profile\n @profile = current_user\n end", "title": "" }, { "docid": "d2751501c0d9e326df9ef2459dd800b7", "score": "0.6544297", "text": "def set_profile\n @profile = current_user\n end", "title": "" }, { "docid": "bd866e0c334cc651a4c1227d2e6a0c1c", "score": "0.65323365", "text": "def add_profile(details)\n # @TODO: Having all attributes explicity listed here is stinky as fuck\n profile = Profile.create!(\n user_id: id,\n email: self.email,\n salutation: details[:salutation],\n first_name: details[:first_name],\n last_name: details[:last_name],\n gender: details[:gender],\n date_of_birth: details[:date_of_birth],\n phone_number: details[:phone_number],\n avatar: details[:avatar]\n )\n\n if details[:address].present?\n profile.address_id = Address.where(\n street_address: details[:address][:street_address],\n suburb: details[:address][:suburb],\n state: details[:address][:state],\n postcode: details[:address][:postcode],\n country: details[:address][:country]\n ).create.id\n\n profile.save\n end\n end", "title": "" }, { "docid": "bf53a09792c001aee58e6f85d5591acf", "score": "0.64818335", "text": "def profile_details\n @profile_details\n end", "title": "" }, { "docid": "bf53a09792c001aee58e6f85d5591acf", "score": "0.64818335", "text": "def profile_details\n @profile_details\n end", "title": "" }, { "docid": "f7532330c36d6b1c26aafc653c9a0166", "score": "0.6479083", "text": "def set_profile\n\t\t# @profile = Profile.find_by(id: params[:id])\n\t\t@profile = current_user.profile\n\tend", "title": "" }, { "docid": "75f20e78d0fc4e123ee97c4d75e42cf8", "score": "0.64360803", "text": "def set_profile\n @profile = current_client.profile\n end", "title": "" }, { "docid": "e779c9b0f24588773f28010e48cd889f", "score": "0.6435725", "text": "def set_profile\n # @profile = current_user.profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "7c06254472bce17e6002e0bde599c510", "score": "0.64218825", "text": "def set_profile\n #@profile = Profile.find(params[:id])\n @profile = current_user.profile\n end", "title": "" }, { "docid": "a962333c99fb26dda40e3182d0a61c6f", "score": "0.64155984", "text": "def set_profile\n @profile = current_user.profile\n #@profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "59375b5431ef9c8b92b3958f40a698af", "score": "0.6404047", "text": "def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end", "title": "" }, { "docid": "26ebde9dfb0d3f54b8ee382faac8ecdf", "score": "0.6394468", "text": "def set_user_profile\n @user_profile = current_user.user_profile\n end", "title": "" }, { "docid": "21a01c78914c3da518cacb06d5810325", "score": "0.63596517", "text": "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "title": "" }, { "docid": "21a01c78914c3da518cacb06d5810325", "score": "0.63596517", "text": "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "title": "" }, { "docid": "b2da572d89e2ca7f3cffdadf246c0931", "score": "0.6358341", "text": "def set_Profile(value)\n set_input(\"Profile\", value)\n end", "title": "" }, { "docid": "b2da572d89e2ca7f3cffdadf246c0931", "score": "0.6358341", "text": "def set_Profile(value)\n set_input(\"Profile\", value)\n end", "title": "" }, { "docid": "70c486fe9889d893b627abb7ccd3d875", "score": "0.6345944", "text": "def set_profile\n @profile = Profile.find(current_user)\n end", "title": "" }, { "docid": "3e782e80bec238b01ddcb0dbfc008f51", "score": "0.63448465", "text": "def set_profile\n if @profile.nil? then\n @profile = Profile.find_by_user_id(current_user.id)\n end\n end", "title": "" }, { "docid": "671c38e337ec8baa9e69d1df51805803", "score": "0.63340956", "text": "def set_profile\n # Code to set/find the profile query\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "59fe8cb25113be8b8c134f58782b4e3f", "score": "0.63220847", "text": "def set_profile\n @profile = Profile.find_by(id: params[:id])\n end", "title": "" }, { "docid": "3bad60cd126d7871081a00ea377c1014", "score": "0.6321692", "text": "def set_profile\n @profile = Profile.for(current_user).find(params[:id])\n end", "title": "" }, { "docid": "79195d94748b6b3dfa7579cff20363b0", "score": "0.63180697", "text": "def set_profile_attribute\n @profile = Profile.find(params[:profile_id])\n @profile_attribute = @profile.profile_attributes.find(params[:id])\n end", "title": "" }, { "docid": "390440fa1e765e04d7a31878d5511ca1", "score": "0.63168746", "text": "def set_profile\n if params[:id] != nil\n @profile = Profile.find(params[:id])\n end\n end", "title": "" }, { "docid": "38382a31de65f2bcee61fb9b2923612b", "score": "0.63159084", "text": "def set(profile)\n perform_request(Entities::Response, 'profile.set.json', profile.as_json)\n end", "title": "" }, { "docid": "7c999d86dd279098870623bab55fbd53", "score": "0.62801325", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "7c999d86dd279098870623bab55fbd53", "score": "0.62801325", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "10b0dcb74fca9ddbf649109ef9c45cea", "score": "0.62763363", "text": "def set_profile\n @profile = Profile.find(session[:profile_id])\n end", "title": "" }, { "docid": "2927e61dcd995b310a687db858d094f0", "score": "0.62714493", "text": "def set_profile\n # @profile = Profile.find(params[:id])\n @user = User.find(params[:user_id])\n @profile = @user.profile\n end", "title": "" }, { "docid": "48a9561f70fd4857abd4f0ddecb3ed2f", "score": "0.62682885", "text": "def set_profile\n @profile = Profile.find_or_initialize_by(\n user_id: current_user.id\n )\n end", "title": "" }, { "docid": "dd6c64c9bad9c630831f608cc8da638b", "score": "0.62169087", "text": "def set_profile\n @profile = Profile.find_by(user_id: params[:user_id])\n end", "title": "" }, { "docid": "3e57ace39d00a8a1558836fa6f86945e", "score": "0.62159276", "text": "def set_profile\n @profile = Profile.find_by( id: params[:id])\n end", "title": "" }, { "docid": "4e53e9eed0dbb232564e8f52906d5b9d", "score": "0.6211699", "text": "def set_profile\n self.build_profile.save\n end", "title": "" }, { "docid": "51443f9674e939954182e6dc78938ac7", "score": "0.62109107", "text": "def set_profile\n # Looking at someone else’s profile\n if params[:id]\n # @profile = Profile.find(params[:id])\n @profile = Profile.find_by!(user_id: params[:id])\n # Current user’s profile\n else\n @profile = Profile.find_by(user: current_user)\n # @profile = Profile.find_by!(user: current_user)\n end\n end", "title": "" }, { "docid": "d89eb6838378a82d3f50652a6697c71a", "score": "0.61680716", "text": "def set_profile\n @profile = Profile.find_by(user_id: params[:id])\n end", "title": "" }, { "docid": "f4121322c70b040cdf1e541bc3eee0ec", "score": "0.61646104", "text": "def set_profile\n \tif Profile.count == 0\n \t\t@profile = \" \"\n \telse\n\t\t\t@profile = Profile.find(params[:id])\n\t\tend\n end", "title": "" }, { "docid": "bedefec33cae6af529a4a5a6cfc2a323", "score": "0.61641365", "text": "def set_profile\n @profile = Profile.friendly.find(params[:id])\n end", "title": "" }, { "docid": "a32ea4ac11fb701d059cc4559ae0e2d4", "score": "0.6162933", "text": "def set_user_profile\n @user_profile = User.find(params[:id]).user_profile\n end", "title": "" }, { "docid": "7d927a7b0ba914a434a75cec5f56f733", "score": "0.6159434", "text": "def set_profile\n @profile = User.find(params[:id])\n end", "title": "" }, { "docid": "7d927a7b0ba914a434a75cec5f56f733", "score": "0.6159434", "text": "def set_profile\n @profile = User.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" }, { "docid": "221fe56f27079b64affefab529c243f1", "score": "0.6140187", "text": "def set_profile\n @profile = Profile.find(params[:id])\n end", "title": "" } ]
1bf371e1fdfb1aca98e6e771e6e5ce46
PUT /tarifs/1 PUT /tarifs/1.xml
[ { "docid": "77b628dae04b4683ddd4e0f3adf7b2ff", "score": "0.5646312", "text": "def update\n @tarif = Tarif.find(params[:id])\n\n respond_to do |format|\n if @tarif.update_attributes(params[:tarif])\n flash[:notice] = 'Tarif was successfully updated.'\n format.html { redirect_to(@tarif) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tarif.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "545dadbe32aa3d9d0edf1d22293783fc", "score": "0.6539082", "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": "713161fe04801b44f5b9cdb91a95fe89", "score": "0.64185065", "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": "a6174ef5c57f0350802d9d10f71b4a2e", "score": "0.6369407", "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": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.62167144", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.60976475", "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": "38979984bdedacd95706689e25f09f9e", "score": "0.60837734", "text": "def put(document, method='')\n @resource[method].put(document.to_s, :content_type => 'text/xml')\n end", "title": "" }, { "docid": "24a5ae2ff27ca8646253b9827bda7563", "score": "0.5987121", "text": "def update\n tar_file = params[:container][:tar_file]\n params[:container].delete(:tar_file)\n respond_to do |format|\n if @container.update(container_params)\n if tar_file\n obj = S3_BUCKET.object \"container-#{@container.id}.tar\"\n obj.upload_stream do |stream|\n IO.copy_stream tar_file,stream\n end\n @container.s3_uri = obj.key\n Excon.patch(\"#{ENV['GRADING_SERVER']}/containers/#{@container.remote_id}\",\n headers: {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n },\n body: {\n name: @container.name,\n config_uri: obj.key\n }.to_json)\n end\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { render :show, status: :ok, location: @container }\n else\n format.html { render :edit }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "476c34f1955d8e27ff8ba558ce2abe37", "score": "0.59260535", "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": "7dcf61d28367255f0ec9cea7ade341de", "score": "0.5846916", "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": "78992a74047c3c20cef2afbb4232252b", "score": "0.5832764", "text": "def test_put_existing_if_match_star\n request = Http::Request.new(\n 'PUT',\n '/file1',\n { 'If-Match' => '*' },\n 'hello'\n )\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'hello',\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('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "c7ce258097892d5a25ac06cf5fa6fa33", "score": "0.5810498", "text": "def test_put_existing_if_match_correct\n request = Http::Request.new(\n 'PUT',\n '/file1',\n { 'If-Match' => \"\\\"#{Digest::MD5.hexdigest('foo')}\\\"\" },\n 'hello'\n )\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'hello',\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('hello')}\\\"\"]\n },\n response.headers\n )\n end", "title": "" }, { "docid": "6fd8842ed08fa1572950f3e78514aecf", "score": "0.5777216", "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": "8e18db431964c254de53caa41795b702", "score": "0.5765409", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.5756921", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "eb553a12c84b854dce36c4a124e8df74", "score": "0.5752203", "text": "def test_put_if_none_match_star\n request = Http::Request.new(\n 'PUT',\n '/file2',\n { 'If-None-Match' => '*' },\n 'hello'\n )\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": "ad54471b285e5e357d9be959c8ade2d8", "score": "0.57394165", "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": "d8d878c0391411134a17dcfe0f3ddd00", "score": "0.57292724", "text": "def put(request, response)\n if not @file\n parts = @local_path.split(\"/\")\n file = WSFile.all(parent: nil, name: parts[1])[0]\n endd = parts.last==\"\" ? -3 : -2\n parts[2..endd].each do |part|\n file = file.children(name: part)\n end\n parent = file_by_path parts[0..-2].join(\"/\")\n @file = WSFile.create(name: parts.last, create_time: DateTime.now, directory: false, edit_time: DateTime.now, parent: parent)\n Permission.create(user: @ws_user, file: @file, level: \"owner\")\n end\n io = request.body\n temp = Tempfile.new(\"websync-dav-upload\")\n data = io.read rescue \"\"\n temp.write data\n temp.close\n @file.content_type = _content_type temp.path\n temp.flush rescue nil\n @file.edit_time = DateTime.now\n @file.save!\n @file.data=data\n Created\n end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.56440735", "text": "def put(path , params = {})\n request(:put , path , params)\n end", "title": "" }, { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.55537933", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "11a78a2675569ab4c7cb38e702a32096", "score": "0.55485123", "text": "def put(request, response)\n exists = exist?\n\n @filesystem.open_upload_stream(\n path, content_type: content_type_for(path)\n ) { |f| f.write request.body }\n\n exists ? NoContent : Created\n end", "title": "" }, { "docid": "bb96bab09259313709de4d5029ee2765", "score": "0.5527571", "text": "def put(path, opts = {})\n request(:put, path, opts)\n end", "title": "" }, { "docid": "27096800d14893529f640b6cf4566aba", "score": "0.55215615", "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": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5521459", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "4ffc11b69657487c176109e7ccc9bdd3", "score": "0.55084264", "text": "def update(id, files)\n url = URI.parse(CREATE_URL)\n\n if PROXY_HOST\n proxy = Net::HTTP::Proxy(PROXY_HOST, PROXY_PORT)\n http = proxy.new(url.host, url.port)\n else\n http = Net::HTTP.new(url.host, url.port)\n end\n\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = ca_cert\n\n req = Net::HTTP::Patch.new(GIST_URL % id)\n req.body = JSON.generate(data(files, nil, nil))\n\n user, password = auth()\n if user && password\n req.basic_auth(user, password)\n end\n\n response = http.start{|h| h.request(req) }\n case response\n when Net::HTTPOK\n JSON.parse(response.body)['html_url']\n else\n raise \"Updating gist failed: #{response.code} #{response.message}\"\n end\n end", "title": "" }, { "docid": "67c9ab4237b70c6d7f1a4a457785ec83", "score": "0.547815", "text": "def put(path, opts = {}, &app); add_with_request_method(path, :put, opts, &app); end", "title": "" }, { "docid": "20d4b250d18e97d55879a70728d0e5be", "score": "0.54757285", "text": "def api_put(path, data = {})\n api_request(:put, path, :data => data).parsed\n end", "title": "" }, { "docid": "fa27a582d0b61cd39ab3fb7be4ea58f9", "score": "0.54731685", "text": "def update\n @file = Argo::File.find(params[:id])\n\n respond_to do |format|\n if @file.update_attributes(params[:argo_file])\n flash[:notice] = 'Argo::File was successfully updated.'\n format.html { redirect_to(@file) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8415acb983da3addb269a79e461bba00", "score": "0.5452839", "text": "def put(uri, options = {})\n request :put, options\n end", "title": "" }, { "docid": "dc71a98e1a32618d5909e4acdcb3ee22", "score": "0.54284614", "text": "def put(path, attrs, etag=nil)\n return get_fake_response(:put, path)\n end", "title": "" }, { "docid": "a48b3229e830876ae619b936301400b2", "score": "0.5426441", "text": "def put(url, xml, version = nil)\n req = Net::HTTP::Put.new(url)\n req.content_type = 'application/x-ssds+xml'\n \n if(!version.nil?)\n req['if-match'] = version;\n end\n \n req.content_length = xml.to_s.size.to_s\n req.basic_auth @username, @password\n req.body = xml.to_s\n execute_request(req)\n end", "title": "" }, { "docid": "4ee5e29ef62a6e95122a8f5d94e1d50d", "score": "0.5416699", "text": "def put(path, params = {})\n request :put, path, params\n end", "title": "" }, { "docid": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.5414277", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "366ae08ad927c0c995d6a0d6ff99b21f", "score": "0.5396517", "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": "6b88e8534e926c1447e1f752c95d2a77", "score": "0.5394889", "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.5394889", "text": "def rest_put(path, options = {}, api_ver = @api_version)\n rest_api(:put, path, options, api_ver)\n end", "title": "" }, { "docid": "be2d852a01758cf18a72669feb296dbe", "score": "0.5379814", "text": "def put(io, name, content_type=nil)\n uri = uri(name)\n req = Net::HTTP::Put.new(uri.request_uri)\n\n content_type = `file -ib #{Shellwords.escape(io.path)}`.chomp if !content_type && io.respond_to?(:path)\n\n req.add_field \"Content-Type\", content_type\n req.add_field \"Content-Length\", io.size\n req.body_stream = io\n\n target_uri = uri(\"/#{name}\")\n\n request(target_uri, req)\n\n target_uri.to_s\n end", "title": "" }, { "docid": "1e28e53cc6a046657398add19da32118", "score": "0.53792197", "text": "def put(path, arguments = {})\n Mavenlink.logger.note \"Started PUT /#{path} with #{arguments.inspect}\"\n parse_request(connection.put(path, arguments))\n end", "title": "" }, { "docid": "51d149364f00870123189da0a75f1b66", "score": "0.5376179", "text": "def update_file_on_index op, file_path\n begin \n HTTParty.post(\n \"#{@index_server_host}/update_index\", {\n body: {\n peer_id: @peer_id, \n file_path: file_path,\n op: op\n }\n }\n )\n puts \"Successfully updated the index server\"\n rescue => e\n puts \"Failed to update the index server\"\n end\nend", "title": "" }, { "docid": "55da59b1d33099c6d6340219a5bed6ca", "score": "0.53631073", "text": "def putData\n begin\n resource = RestClient::Resource.new(@url, SSL)\n @response = resource.put(File.read(@ttl), :content_type => 'application/x-turtle') \n rescue => e\n @response = e.response\n end\nend", "title": "" }, { "docid": "e2e55a6ecb4c00b7fe18a670cc021207", "score": "0.53463864", "text": "def put_entry(id,summary)\n xml = <<DATA\n <entry xmlns=\"http://purl.org/atom/ns#\">\n <summary type=\"text/plain\"></summary>\n </entry>\nDATA\n\n doc = REXML::Document.new(xml)\n doc.elements['/entry/summary'].add_text(summary)\n\n # REXML -> String\n data=String.new\n doc.write(data)\n\n #make request\n path=\"/atom/edit/#{id}\"\n req=Net::HTTP::Put.new(path)\n req['Accept']= 'application/x.atom+xml,application/xml,text/xml,*/*',\n req['X-WSSE']= @credential_string\n\n #YHAAAA!!!\n res = @http.request(req,data)\n return res\n end", "title": "" }, { "docid": "ee1cd4be510188a25a238100e4fc308a", "score": "0.5344726", "text": "def file_put(url, params={})\n multipart_conn.put(url, file_payload(params))\n end", "title": "" }, { "docid": "9ddf960eb3f437e62b9b99d34992bc0f", "score": "0.5332094", "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": "b7ead5baa123b9ee14873d91c3198241", "score": "0.53311414", "text": "def update\n @tarif = Tarif.find(params[:id])\n\n respond_to do |format|\n if @tarif.update_attributes(params[:tarif])\n format.html { redirect_to @tarif, notice: 'Tarif was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarif.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d60b7d73c524dd42aeb6c060c56ffc8f", "score": "0.53253794", "text": "def update_remote_file(node_id, options)\n post \"/cluster/#{node_id}/files\", options\n end", "title": "" }, { "docid": "6ee62ee271a58c6d3fddda7e093e38d2", "score": "0.5319143", "text": "def upload_file(url, headers, file_path)\n puts 'Upload file'\n\n uri = URI(url)\n file_contents = File.read(file_path)\n Net::HTTP.start(uri.host) do |http|\n response = http.send_request('PUT',\n uri,\n file_contents,\n headers)\n puts \"upload_file response.code = #{response.code}\"\n end\nend", "title": "" }, { "docid": "afecc7845542fce06842e523ac107fce", "score": "0.5318198", "text": "def put(path, options = {})\n request(:put, path, options)\n end", "title": "" }, { "docid": "eed302d7d8dbc11e9dc23d436ab56886", "score": "0.53178626", "text": "def update\n @tariff = Tariff.find(params[:id])\n\n respond_to do |format|\n if @tariff.update_attributes(params[:tariff])\n format.html { redirect_to(@tariff, :notice => 'Tariff was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tariff.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8ffb008aad98ad63d835a4c4d547c50", "score": "0.5317789", "text": "def put(path, data)\r\n fetch(:path => path, :method => 'PUT', :data => data)\r\n end", "title": "" }, { "docid": "3551a93e8829fecafd58bf691a860eeb", "score": "0.53144234", "text": "def update_object(path, id, info)\n json_parse_reply(*json_put(@target, \"#{path}/#{URI.encode(id)}\", info,\n @auth_header, if_match: info[:meta][:version]))\n end", "title": "" }, { "docid": "d82f7dc07c55ba699155d8a96115fe56", "score": "0.53138393", "text": "def put(uri, options = {})\n request :put, uri, options\n end", "title": "" }, { "docid": "d82f7dc07c55ba699155d8a96115fe56", "score": "0.53138393", "text": "def put(uri, options = {})\n request :put, uri, options\n end", "title": "" }, { "docid": "0a8f96513394213e5fadf5bbb3aab0c9", "score": "0.53101957", "text": "def put(path, options = {}, config = {})\n request(:put, path, options, config)\n end", "title": "" }, { "docid": "d2cb03309c546481f03dd83ab845468a", "score": "0.530223", "text": "def put(path, options={}, request_opts={})\n request(:put, path, options, request_opts)\n end", "title": "" }, { "docid": "8a7ac977bc74a758de027bffc68ef38c", "score": "0.52872795", "text": "def put(path, options={})\n request(:put, path, options)\n end", "title": "" }, { "docid": "8a7ac977bc74a758de027bffc68ef38c", "score": "0.52872795", "text": "def put(path, options={})\n request(:put, path, options)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.5284494", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.5284494", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.5284494", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.5284494", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.5284494", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "180ce56a55daa8081271f6e4234d5b30", "score": "0.52780527", "text": "def update\n @otml_file = OtrunkExample::OtmlFile.find(params[:id])\n\n respond_to do |format|\n if @otml_file.update_attributes(params[:otml_file])\n flash[:notice] = 'OtrunkExample::OtmlFile was successfully updated.'\n format.html { redirect_to(@otml_file) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @otml_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d4155ea1d5ec29dfeec7f8f3dfe64e7", "score": "0.52729905", "text": "def put(path, file, content_type=nil)\n path = canonicalized_resource(path)\n body = file.respond_to?(:read) ? file : file.to_s \n date = Time.now.rfc2822\n message = join('PUT', body, content_type, date, nil, path)\n headers = headers(date, message, content_type)\n\n if content_length = content_length(file)\n headers.merge!({'Content-Length' => content_length})\n end\n\n request = Net::HTTP::Put.new(path, headers)\n\n if file.respond_to?(:read)\n request.body_stream = file\n else\n request.body = body\n end\n\n begin\n response = http.start { |http| http.request(request) }\n Presss::HTTP::Response.new(\n response.code,\n response.instance_variable_get('@header'),\n response.body\n )\n rescue EOFError => error\n raise Presss::HTTP::RequestError, error.message\n end\n end", "title": "" }, { "docid": "cc8530b36f752f70d0ea1cb76f21134d", "score": "0.5272049", "text": "def put(path, **args); end", "title": "" }, { "docid": "832a04972f333a29e4b7b3fd35ec15d0", "score": "0.52626467", "text": "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end", "title": "" }, { "docid": "e48a472ecc79656c1decd56b7e5116e8", "score": "0.5256708", "text": "def put resource, id='', options=nil\n call resource, id, options, :put\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5253302", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "3c57675463bd3d8657476163302a7246", "score": "0.52461207", "text": "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "title": "" }, { "docid": "5a709be54da030e531e9297b7bde699d", "score": "0.52440745", "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": "e14bfd174a29c65046b92caa815c9b01", "score": "0.52391434", "text": "def put(path, data = nil, headers = {})\n request(:put, path, data, headers)\n end", "title": "" }, { "docid": "6109548c3281832ecabf0564bcc67946", "score": "0.52375793", "text": "def put(path, options={}, format=format)\n respond request(:put, path, options, format)\n end", "title": "" }, { "docid": "3ffd456313b52b1883f0de8ac78b02d8", "score": "0.52312416", "text": "def put(path, data, headers = {})\n request(:put, path, data, headers)\n end", "title": "" }, { "docid": "1b973018948b9fda211ffd09aee65941", "score": "0.52197", "text": "def put uri1, uri2=nil, options={}\n retrieve uri1, uri2, options.merge(:http_method => :put)\n end", "title": "" }, { "docid": "1b973018948b9fda211ffd09aee65941", "score": "0.52197", "text": "def put uri1, uri2=nil, options={}\n retrieve uri1, uri2, options.merge(:http_method => :put)\n end", "title": "" }, { "docid": "46c427a6236a62b6611e629963f4204f", "score": "0.52175874", "text": "def put(path, params = {}, options = {})\n request(:put, path, params, options)\n end", "title": "" }, { "docid": "43fdecba17efc7932ab9d9d4f0786094", "score": "0.5214774", "text": "def put(path, data = nil, model = 'raw')\n request(:put, path, data, model)\n end", "title": "" }, { "docid": "b281d991d5f075ee79653165b0d0a25a", "score": "0.52059203", "text": "def put(path, opts={})\n add_route(PUT, path, opts)\n end", "title": "" }, { "docid": "86d3169a8a66dfe03d5167fba1393b63", "score": "0.52007395", "text": "def post(id)\n self.class.post(\"/aldebaran-sige-files/file/#{id}\", :basic_auth => @auth, :body => nil)\n end", "title": "" }, { "docid": "583c66c312da549535e2caff0b8f9693", "score": "0.5196955", "text": "def create\n @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])\n\n respond_to do |format|\n if @<%= file_name %>.save\n flash[:notice] = '<%= class_name %> was successfully created.'\n format.html { redirect_to(@<%= file_name %>) }\n format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }\n end\n end\n end\n\n # PUT /<%= table_name %>/1\n # PUT /<%= table_name %>/1.xml\n def update\n @<%= file_name %> = <%= class_name %>.find(params[:id])\n\n respond_to do |format|\n if @<%= file_name %>.update_attributes(params[:<%= file_name %>])\n flash[:notice] = '<%= class_name %> was successfully updated.'\n format.html { redirect_to(@<%= file_name %>) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b29ef97080d9be06c869dec1a0c40a3", "score": "0.5196342", "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": "d849c2bc448d5ce0df573d1ab918e8f7", "score": "0.51939875", "text": "def put(url, options={}, header={})\n body = options[:body]\n access_token.put(url, body, {'Content-Type' => 'application/xml' })\n end", "title": "" }, { "docid": "b2d5fc83a907f25e5176864fa6beb3d0", "score": "0.5193677", "text": "def put_rest(path, json) \n run_request(:PUT, create_url(path), json)\n end", "title": "" }, { "docid": "f979deb039614b1b692ef78f7eec7898", "score": "0.5185851", "text": "def put(path,entry)\r\n h = @headers.clone\r\n h['X-HTTP-Method-Override'] = 'PUT'\r\n @url.put(path, entry, h)\r\n end", "title": "" }, { "docid": "03c87bf0bff6302e8f6b741e226ec9c9", "score": "0.51847225", "text": "def put_vm(xmlfile)\n xml=File.read(xmlfile)\n vm_info=REXML::Document.new(xml).root.elements\n\n url = URI.parse(@endpoint+'/compute/' + vm_info['ID'].text)\n\n req = Net::HTTP::Put.new(url.path)\n req.body = xml\n\n req.basic_auth @occiauth[0], @occiauth[1]\n\n res = CloudClient::http_start(url) do |http|\n http.request(req)\n end\n\n if CloudClient::is_error?(res)\n return res\n else\n return res.body\n end\n end", "title": "" }, { "docid": "20a4da0a095cabd56af2d863deee2d28", "score": "0.51748633", "text": "def put(path, params={})\n perform(:put, path, params)\n end", "title": "" }, { "docid": "d69a66f39d0080a167ba57134376a6c9", "score": "0.51693964", "text": "def put(path, params = nil, headers = nil)\n process(:put, path, params, headers)\n end", "title": "" }, { "docid": "d69a66f39d0080a167ba57134376a6c9", "score": "0.51693964", "text": "def put(path, params = nil, headers = nil)\n process(:put, path, params, headers)\n end", "title": "" }, { "docid": "b124e9081ab276ad97500c91637776e2", "score": "0.5168281", "text": "def put(path, options={})\n send_request(:put, path, options)\n end", "title": "" }, { "docid": "684f77794ec212c45e87b15d1470e9d4", "score": "0.51668", "text": "def put(path, params={})\n RestClient.put request_base+path, params\n end", "title": "" }, { "docid": "2d045b3a4d5c20ea4ce49d3f9a9a17fe", "score": "0.51649815", "text": "def put(path, **args)\n process(:put, path, **args)\n end", "title": "" }, { "docid": "684cccab8717b5866d44a734cb97b5f8", "score": "0.51644903", "text": "def put(options = {})\n request :put, options\n end", "title": "" }, { "docid": "2ee2116e03b90da80d77cd3247722369", "score": "0.516123", "text": "def put(path, options = {}, headers = {}, raw = false)\n request(:put, path, options, headers, raw)\n end", "title": "" }, { "docid": "fa77ea666a06a484c9e048b748d79d84", "score": "0.51601505", "text": "def put(path, params={}, options={})\n request(:put, path, params, options)\n end", "title": "" } ]
71b94ada620aa445e617d6ebeafeff39
Display the rendered output of the test and If the expected ouptput matches the rendered output, simply display that output If the expected ouptput does not match the rendered output, show the expect, then show the actual and give the user the option to overwrite expected with actual If no expected output is saved for the test, give the user the option to save the rendered output as the expected output
[ { "docid": "f918d1a8a8f6764acccb2bb7f336c2a4", "score": "0.75060964", "text": "def view\n if pending?\n ask_pending\n elsif failed?\n ask_failed\n else\n puts rendered\n puts \"Rendered output for #{test_file} matches expected.\"\n end\n end", "title": "" } ]
[ { "docid": "564e5651757a43a1d9989e513452d3c6", "score": "0.76904833", "text": "def display_results\r\n if @errors.empty?\r\n if @test_diff.empty?\r\n @out.puts \"Output matches exactly\"\r\n else\r\n @out.puts \"Test diff:\"\r\n @out.puts @test_diff\r\n end\r\n else\r\n @errors.each {|error| @out.puts error }\r\n end\r\n end", "title": "" }, { "docid": "175c1aa8b34098db851674c28bb530cd", "score": "0.6485164", "text": "def check_actual_vs_expected_output(actual_output_filename, expected_output_filename)\n # Diff actual output against expected output\n cmd = ['diff', actual_output_filename, expected_output_filename]\n stdout_str, stderr_str, status = Open3.capture3(*cmd, stdin_data: '')\n if status.success?\n puts \"Test passed!\"\n exit 0\n else\n puts \"Test failed\"\n puts \"Diff output:\"\n puts stdout_str\n exit 1\n end\nend", "title": "" }, { "docid": "7779517291f91dc6091d253b5ebda1be", "score": "0.6482607", "text": "def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend", "title": "" }, { "docid": "7779517291f91dc6091d253b5ebda1be", "score": "0.6482607", "text": "def printTestExpectedOutput( fp )\n\t\tfp.printf( \"%s\\t\", @name ) if @name\n\t\tmissing = countMissing()\n\t\tfp.printf( \"%s:%s:%d:%d\\t\",\n\t\t\t\tmissing < @vector.length ? \"I\" : \"?\",\n\t\t\t\tdegenerate? ? \"!\" : \"-\", \n\t\t\t\t@cats, \n\t\t\t\tmissing )\n\t\tfp.puts( @vector.collect { |x| x.nil? ? OUTPUT_NA_MARKER : x }.join(\"\\t\") )\n\tend", "title": "" }, { "docid": "0bf85595f3082c389bc4fbfbbe515cc6", "score": "0.6449881", "text": "def assert_output_equal!(a, b, msg=nil)\n if a == b\n assert true\n else\n flunk %Q{\n#{msg}\n==================== expected output ====================\n#{whitespace_escape(a)}\n======================== but was ========================\n#{whitespace_escape(b)}\n=========================================================\n}\n end\n end", "title": "" }, { "docid": "98ea056d10d209e60793583458282e19", "score": "0.63327587", "text": "def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end", "title": "" }, { "docid": "565e656322654b74108cf58de55138d1", "score": "0.6263543", "text": "def test_display_one\r\n assert_output(\"After 2 days, Rubyist #1 found:\\n\\t1 ruby.\\n\\t1 fake ruby.\\n\") { @g.display_rubies(1, 1, 1, 2) }\r\n end", "title": "" }, { "docid": "37efc129b94dde46720ce8328e8d5098", "score": "0.6250055", "text": "def print_output(expected, actual)\n puts \"expect: \" + expected.robust\n puts \"actual: \" + actual.robust\nend", "title": "" }, { "docid": "8b50d7b0cdf69e5943d465025a3935d2", "score": "0.6230315", "text": "def failure_details(io)\n super\n unless test_case.input.empty?\n format_block(io, \"Input\", test_case.input)\n end\n format_block(io, \"Evaluated commands\", test_case.evaluated_commands)\n comparisons.each do |expectation|\n expectation.format_details(io)\n end\n unless test_case.scope.debug.empty?\n format_block(io, \"Contents of *debug*\", test_case.scope.debug)\n end\n format_block(io, \"How to run this test\", test_case.shell_command_details)\n end", "title": "" }, { "docid": "6d04c6e4fca03bf819ce29b1c2c3726a", "score": "0.6197956", "text": "def cmp_output(test)\n # test out and err\n if test.expected_out_exists? && test.expected_err_exists?\n cmp_out(test)\n cmp_err(test)\n return :success if (test.out_result && test.err_result)\n\n # test only out\n elsif test.expected_out_exists?\n cmp_out(test)\n return :success if test.out_result\n\n # test only err\n else\n cmp_err(test)\n return :success if test.err_result\n end\n\n return :failed\n end", "title": "" }, { "docid": "6614a52166f3e1d0b6200a9bc3cb092b", "score": "0.61821955", "text": "def assert_correct_output(expected_outputs, command_output)\n foundit = check_correct_output(expected_outputs, command_output)\n assert(foundit, \"Did not find in command output: #{expected_outputs}\")\n end", "title": "" }, { "docid": "606ee4bdc1b860fa2924bb8be70ae74b", "score": "0.61697435", "text": "def verify_output(*expected_output)\n actual_output = read_output_stream\n expected_output.each do |expected|\n assert actual_output.include?(expected.to_s), show_missing_output(expected, actual_output)\n end\nend", "title": "" }, { "docid": "6b8c09aa3660a6c3be7f0984a8565414", "score": "0.6158287", "text": "def report expected, actual\n if expected == actual\n puts \"Yes, found '#{actual}'\"\n else\n puts \"Failed, found '#{actual}' but was expecting '#{expected}'\"\n end\nend", "title": "" }, { "docid": "78a5fad33facdfceebce0da90849b574", "score": "0.613909", "text": "def test_results_victory\r\n assert_output(\"Going home victorious!\\n\") { @g.results(10) }\r\n end", "title": "" }, { "docid": "e0a745e4b3f94b39fe57dec15a4b114d", "score": "0.6130538", "text": "def Results(testcase_no, checkpoint, result, screenshot)\n Current_Date_Time()\n\t$fileHtml.puts \"</td><tr><td width=110><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{testcase_no}\"\n\t$fileHtml.puts \"</td><td width=400><font size=2 face=verdana>\"\n\t$fileHtml.puts \"#{checkpoint}\"\n \tif (\"#{result}\" == \"PASS\")\n $fileHtml.puts \"</td><td width=100 bgcolor=green><font size=2 face=verdana color=white><center><font color=white>\"\n\t elsif (\"#{result}\" == \"FAIL\")\n\t Capture_Screenshot(screenshot, testcase_no)\t \n $fileHtml.puts \"</td><td width=100 bgcolor=red><font size=2 face=verdana color=white><center><a href ='\" + \"#{$shot}\" + \"'><font color=white>\"\n\t else\n $fileHtml.puts \"</td><td width=100 bgcolor=SeaShell><font size=2 face=verdana color=white><center>\"\n\t end\n $fileHtml.puts \"#{result}\"\n $fileHtml.puts \"</a>\"\n $fileHtml.puts \"</td><td width=110><font size=2 face=verdana><center>\"\n $fileHtml.puts \"#{$current_time}\"+\" \"+\"#{$current_date}\"\n $fileHtml.puts \"</td>\"\nend", "title": "" }, { "docid": "8d5824dd6a73d4b1b3565e609292dad4", "score": "0.61149925", "text": "def testi_display_result\n\t\t\tputs testi_stats\n\t\tend", "title": "" }, { "docid": "59026409817899d07fd2c0a3191309b1", "score": "0.60943913", "text": "def foorth_output(source, expected)\r\n self.assertions += 1\r\n failed, msg = false, \"\"\r\n vm = Thread.current[:vm]\r\n\r\n actual, _nc = capture_io do\r\n vm.process_string(source)\r\n end\r\n\r\n if expected != actual\r\n msg = \"Expected: #{expected.inspect}\\n Actual: #{actual.inspect}\"\r\n raise MiniTest::Assertion, msg, caller\r\n end\r\n\r\n ensure\r\n vm.interpreter_reset\r\n vm.compiler_reset\r\n end", "title": "" }, { "docid": "42cf80b6013ef8911cd46808e0f3ce2b", "score": "0.60841674", "text": "def test_results_sad\r\n assert_output(\"Going home sad.\\n\") { @g.results(9) }\r\n end", "title": "" }, { "docid": "dc4bb4a36c9ddf3559589c8278073481", "score": "0.605321", "text": "def test_see_results_valid_output\n mock_map = Minitest::Mock.new('Mock Map')\n mock_map_finder = Minitest::Mock.new('Mock Map Finder')\n joe = Prospector.new(mock_map, mock_map_finder)\n out_put = \"After 0 days, Rubyist 4 found:\\n 0 rubies.\\n 0 fake rubies.\\nGoing home empty-handed.\\n\"\n assert_output(out_put) { joe.see_results(4) }\n end", "title": "" }, { "docid": "a50c36f0d2157ebf0f912e08940491f5", "score": "0.60204", "text": "def test_results_sad_one\r\n assert_output(\"Going home sad.\\n\") { @g.results(1) }\r\n end", "title": "" }, { "docid": "bd18c4230ed09b7160696f28a245992a", "score": "0.6017846", "text": "def display_results_html\n\t\t output =\"<!DOCTYPE html><html xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><head><title></title></head><body>\"\n\t\t output.concat(\"<table><thead><tr><td>FileName</td></tr><tr><td>#{@folder1}</td></tr><tr><td>#{@folder2}</td></tr><tr><td>Equal</td></tr></thead>\")\n @filehash.each{ |key, value| output.concat(\"<tbody><tr><td>#{value.file_name}</td></tr><tr><td>#{value.file_hash1}</td></tr><tr><td>#{value.file_hash2}</td></tr><tr><td>#{value.file_hash1==value.file_hash2}</td></tr>\")}\n output.concat(\"</tbody></table></body></html>\")\n puts output\n end", "title": "" }, { "docid": "17f5ec5eba00370de4705d82101bb63f", "score": "0.6007695", "text": "def test_display_two\r\n assert_output(\"After 2 days, Rubyist #2 found:\\n\\t2 rubies.\\n\\t2 fake rubies.\\n\") { @g.display_rubies(2, 2, 2, 2) }\r\n end", "title": "" }, { "docid": "66ee390d000d32681bda4d15cde72153", "score": "0.6006447", "text": "def test_showResults\n\t\td = Driver::new(\"Driver 1\",0)\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 1 class!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hospital to cathedral\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 0 dinosaur toys!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from cathedral to museum\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 0 books!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 1 #from museum to hillman\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\t\td.setLocation 0 #from hillman to downtown\n\t\td.checkLocation\n\t\tassert_output (\"Driver 1 obtained 1 book!\\nDriver 1 obtained 1 dinosaur toy!\\nDriver 1 attended 2 classes!\\n\") {d.showResults}\n\tend", "title": "" }, { "docid": "b1156818cad2b44c6b5ef18ca572bac4", "score": "0.5970436", "text": "def test_print_silver_gold\n assert_output(\"\\tMining Results\\n\\tSilver found: 6 ounces\\n\\tGold found: 2 ounces\\n\") do\n @game.print_mining_results(6, 2)\n end\n end", "title": "" }, { "docid": "d7246df87b5ff2213926913f722ee605", "score": "0.596746", "text": "def expect_output(output)\n if output.respond_to?(:~)\n assert_matching_output(output.to_s, all_output)\n else\n assert_partial_output(output, all_output)\n end\n end", "title": "" }, { "docid": "6a81be4b7356aa9a71a3e3401f737d60", "score": "0.5955177", "text": "def test_print_results\n @d.add_book\n @d.add_book\n @d.add_book\n @d.add_book\n @d.add_dino\n @d.add_dino\n @d.add_dino\n @d.add_class\n @d.add_class\n assert_output(\"Driver 1 obtained 4 books!\\nDriver 1 obtained 3 dinosaur toys!\\nDriver 1 attended 4 classes!\\n\") { @d.print_results }\n end", "title": "" }, { "docid": "d12aca186236abe478b9744541e8255d", "score": "0.5941878", "text": "def assert(expected, output)\n left = expected.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n right = output.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n nodiff = left.scan(/./).sort == right.scan(/./).sort\n unless ( nodiff )\n puts \"\\nERROR in comparaison\\n\"\n puts \"EXPECTED : #{left}\"\n puts \"RETURNED : #{right}\"\n end\n nodiff.should == true\n end", "title": "" }, { "docid": "a431046b3a6fd851eb6439cdd69a634a", "score": "0.5940897", "text": "def assert(expected, output)\n left = expected.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n right = output.to_s.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\n left.scan(/./).sort.should == right.scan(/./).sort\n#\n# unless left == right\n# puts \"\", \"Expected:\"\n# puts left\n# puts tidy(left)\n# puts \"\", \"Got:\"\n# puts right\n# puts tidy(right)\n# puts\n# end\n# left.should == right\n end", "title": "" }, { "docid": "79b1d2b10c4f639acfe56af8acd8fa68", "score": "0.59404963", "text": "def format_output(string)\n test_name, test_puts, test_result, test_duration = if string =~ /(([.EF]):)\\s*\\(([\\d.]+)\\)\\s*\\z/m\n test_parts_with_duration(string)\n else\n test_parts_without_duration(string)\n end\n \n if test_name.nil?\n out = htmlize(string)\n else\n out = \"&nbsp;&nbsp;#{format_test_result(test_result)}&nbsp;&nbsp;#{format_test_name(test_name, test_result)}\"\n out << \":&nbsp;(#{test_duration})\" if test_duration\n out << \"<br/>\"\n out << %Q!<div style=\"background-color:#E6E6E6; padding: 5px 10px\">#{htmlize(test_puts)}</div>! unless test_puts.strip.empty?\n end\n \n out\nend", "title": "" }, { "docid": "dd22d6318a91d7ccbc924a863a16316d", "score": "0.59370226", "text": "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "title": "" }, { "docid": "64aa99e69e8700de4800a0619a1b6fae", "score": "0.5920566", "text": "def compare_result(test, result)\n if @per_test_insert\n expected = translate_column_names(test['expected'])\n else\n expected = test['expected']\n end\n expected.each do |key, value|\n if value == 'ignore'\n next\n end\n\n if !compare_values(value, result[key])\n @num_fails += 1\n @failed_tests.push(test['name'])\n\n puts \" Expected: \\\"#{key}\\\": #{value}\"\n puts \" Result: \\\"#{key}\\\": #{result[key]}\"\n puts \" Status: Failed\"\n return\n end\n end\n\n @num_successes += 1\n puts \" Status: Passed\"\n end", "title": "" }, { "docid": "3a1513a5c974e1a07292d1c5e3ee6f55", "score": "0.59160966", "text": "def test_print_gold\n assert_output(\"\\tMining Results\\n\\tGold found: 7 ounces\\n\") do\n @game.print_mining_results(0, 7)\n end\n end", "title": "" }, { "docid": "e5a437f619de1a0b96c023d1f9606e4f", "score": "0.59040123", "text": "def show\n @test_results = @test_run.test_results\n end", "title": "" }, { "docid": "b368ff15a183f592ed5d7d38b88ed43e", "score": "0.5890656", "text": "def out(result, revert = false)\n (result ? print('.'.green) : print('F'.red)) unless Rails.env.test?\n revert ? !result : result\n end", "title": "" }, { "docid": "7a6187357dbda0f68e090cd12919bac4", "score": "0.5889143", "text": "def test_print_silver\n assert_output(\"\\tMining Results\\n\\tSilver found: 5 ounces\\n\") do\n @game.print_mining_results(5, 0)\n end\n end", "title": "" }, { "docid": "589bd18401fb551e9df5fbf87ed9ffd4", "score": "0.5886739", "text": "def assert_equal(type,expected, actual)\n text1=get_text(type,expected)\n text2=$array1[\"#{actual}\"] \n puts text1\n puts text2\n if text1 == text2\n puts \"given text is available\"\n elsif \n $log.error \"given #{expected} text is not displayed\"\n raise(\"given #{expected} text is not displayed\")\n end\nend", "title": "" }, { "docid": "1bc93ad8a96de0975e891702ee95d419", "score": "0.58774227", "text": "def output\n options[:output] || 'test'\n end", "title": "" }, { "docid": "089ad4d2b5acc4a5500c6dbd724b484c", "score": "0.5876989", "text": "def test_example(output_exmpl, input_exmpl)\n converted_exmpl = output_suite.convert_example(input_exmpl, output_exmpl.opts, renderer)\n msg = output_exmpl.desc.presence || input_exmpl.desc\n\n assert_equal output_exmpl, converted_exmpl, msg\n end", "title": "" }, { "docid": "48d4fbb1f97536a91aeb2524b394ab98", "score": "0.58690274", "text": "def display_results\n make\n display_best\n display_mutations unless @mutations\n end", "title": "" }, { "docid": "b7339cdd0163ac0c4b1b5a225024f195", "score": "0.58629936", "text": "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "title": "" }, { "docid": "9b02cd1f63713b1254068dc32f7459be", "score": "0.5861483", "text": "def assert actual, expected, message\n display message\n puts actual == expected || display_error(actual, expected)\nend", "title": "" }, { "docid": "6c3d40a31e0c6051c780de9a20fc6b42", "score": "0.58505416", "text": "def ReportTest(test_description, test_result)\n # report it to the log\n Builtins.y2milestone(\"%1 %2\", test_description, test_result)\n\n # report it to the UI\n UI.ChangeWidget(\n Id(:log_view),\n :LastLine,\n Builtins.sformat(\n \"%1 %2\\n\",\n test_description,\n test_result ? @result_ok : @result_failed\n )\n )\n\n if test_result\n # passed\n return\n end\n\n Builtins.y2error(\"-- I.C. Winner --\")\n\n UI.ChangeWidget(\n Id(:log_view),\n :LastLine,\n Ops.add(\n Ops.add(\n \"\\n\",\n Builtins.sformat(\n # TRANSLATORS: an error message\n # %1 - link to our bugzilla\n # %2 - directory where YaST logs are stored\n _(\n \"This is worth reporting a bug at %1.\\nPlease, attach all YaST logs stored in the '%2' directory.\\n\"\n ),\n \"http://bugzilla.novell.com/\",\n \"/var/log/YaST2/\"\n )\n ),\n \"\\n\"\n )\n )\n\n nil\n end", "title": "" }, { "docid": "ad55c6fff8e0a0a37917cd4c0dcb3cf7", "score": "0.58494496", "text": "def test_show_rush_result\n assert_output(\"After 2 days, Rubyist 1 found:\n 10 rubies.\n 10 fake rubies.\nGoing home victorious!\\n\"){ @p.show_rush_result(2, 1, [10, 10]) }\n end", "title": "" }, { "docid": "f8c3fc8cd7d20039d850b03d067c7266", "score": "0.5802489", "text": "def testcase_output(str, testcase, newline=true)\n testcase.output(str, newline) if testcase\n end", "title": "" }, { "docid": "fb31d9aa0cc9715f8831f96985b177ae", "score": "0.5778364", "text": "def test(test=false, expecting=false, text=\"Unnamed Passing Test\")\n passed = test == expecting\n @tests += 1\n @passing += 1 if test == expecting\n result = passed ? PASS : FAIL\n symbol = passed ? SYM_PASS : SYM_FAIL\n status = \" #{result} (#{test.to_s[0]} #{symbol} #{expecting.to_s[0]})\"\n \n len_dot = WIDTH - text.length - status.length\n len_dot = 0 if len_dot < 0\n dots = (\".\"*len_dot).to_s\n flex_len = WIDTH - (status.length + dots.length)\n text = text[0..(flex_len-1)]\n result = \"#{text}#{dots}#{status}\"\n puts result\n result\n end", "title": "" }, { "docid": "e85ad6fde4c2db2c93a8d4db82ba30f2", "score": "0.5777043", "text": "def test_display_as_html\r\n\r\n assert_equal @responsemaps.reviewer_id, 380671078\r\n assert_equal @responsemaps.reviewee_id, 538862539\r\n time = @response.updated_at\r\n puts time\r\n assert @response.display_as_html\r\n end", "title": "" }, { "docid": "349f64f1241a7ea8ce1badcb6b96979f", "score": "0.57617116", "text": "def cmp_out(test)\n test.out_result = FileUtils.cmp(test.expected_out_path, \n test.result_out_path)\n end", "title": "" }, { "docid": "aa152fb567673ee098d43e00b075abd0", "score": "0.5761331", "text": "def compare!\n @config.output_type = 'compare'\n end", "title": "" }, { "docid": "365aaa1e8ba8bca15efd42a78be4faf0", "score": "0.5751855", "text": "def printTestExpectedOutput( fp )\n\t\t# mtproc does not re-emit the header (column names)\n\t\t@rows.each do |row|\n\t\t\tif row.instance_of?( RandomContinuousFeature ) then\n\t\t\t\trow.printTestExpectedOutput( fp, OUTPUT_FLOAT_FORMAT )\n\t\t\telse\n\t\t\t\trow.printTestExpectedOutput( fp )\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "2a9f05af1087fa061d56923ab6d1608c", "score": "0.5750426", "text": "def testAssert(message, test, assertion)\n puts message\n if test != assertion\n puts \"!!! Assertion Failed !!!\"\n puts \"On page text \\\"\" + \"#{test}\" + \"\\\" does not match #{assertion}\"\n else\n puts \"... Assertion Passed ...\"\n end\nend", "title": "" }, { "docid": "4aaa5edce3963a8f7ff334f18796419e", "score": "0.5743763", "text": "def test_print_fake\r\n test = Prospect.new(0)\r\n test.totalfakes = 1\r\n assert_output(/\\tFound 1 fake ruby in Enumerable Canyon. /) { test.print_all_rubies(test.totalruby, test.totalfakes)}\r\n end", "title": "" }, { "docid": "5b7b33fc01391f9962be75cad12e443e", "score": "0.5742046", "text": "def show\n @test_var = \"\"\n commit = @repo.lookup(@commit.sha)\n if commit.parents.length > 0\n diff_commits = commit.parents[0].diff(commit, :context_lines => 100000000)\n @test_var = Iconv.conv('utf-8', 'latin1', diff_commits.patch())\n end\n render :layout => 'application'\n end", "title": "" }, { "docid": "2ad16664980cb5a29cefecc6ea64a8fb", "score": "0.5738576", "text": "def test_remain_same_2\n\t\tgame = SetGame.new\n\t\tactual_output = File.new 'update_output/actual_remain_same2.txt', 'w'\n\t\t$stdout = actual_output\n\t\tgame.deck = DECK\n\t\tgame.hand = [CARD1, CARD2, CARD3, CARD4, CARD5, CARD6, CARD7, CARD8, CARD9]\n\t\tuser_input = [8,7,0]\n\t\tgame.top_card = 24\n\t\tgame.update user_input\n\t\tassert_equal 9, game.hand.size\n\t\tassert_equal 24, game.top_card\n\t\tactual_output.close\n\t\tassert_true FileUtils.compare_file('update_output/expected_remain_same2.txt', 'update_output/actual_remain_same2.txt')\n\t\tassert_equal CARD1, game.hand[0]\n\t\tassert_equal CARD2, game.hand[1]\n\t\tassert_equal CARD3, game.hand[2]\n\t\tassert_equal CARD4, game.hand[3]\n\t\tassert_equal CARD5, game.hand[4]\n\t\tassert_equal CARD6, game.hand[5]\n\t\tassert_equal CARD7, game.hand[6]\n\t\tassert_equal CARD8, game.hand[7]\n\t\tassert_equal CARD9, game.hand[8]\n\t\tassert_equal false, game.is_end\n\tend", "title": "" }, { "docid": "9c6c1a9e37543942b5b9b2c256f6b7d2", "score": "0.5734348", "text": "def assert_outputted(str)\n assert_includes output, str\n end", "title": "" }, { "docid": "34b0b565d1b64a8c9c16d79a008d382e", "score": "0.5727324", "text": "def test_basic\n testbase = 'help'\n op = StringIO.new('', 'w')\n Dir.chdir(SRC_DIR) do \n script = File.join('data', \"#{testbase}.cmd\")\n Debugger.const_set('Version', 'unit testing')\n Debugger.run_script(script, op)\n got_lines = op.string.split(\"\\n\")\n right_file = File.join('data', \"#{testbase}.right\")\n correct_lines = File.readlines(right_file)\n result = cheap_diff(got_lines, correct_lines)\n unless result\n puts '-' * 80\n puts got_lines \n puts '-' * 80\n end\n assert result \n end\n end", "title": "" }, { "docid": "c585a1cf9725aedbeb4a39b573ebb480", "score": "0.5710107", "text": "def test_dsl_4\n #-------------------------\n show Spock + Lizard + Rock\n #-------------------------\n assert_equal \\\n \"Lizard poisons Spock (winner Lizard)\\n\" \\\n \"Rock crushes Lizard (winner Rock)\\n\" \\\n \"Result = Rock\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "4c6d9d28d7249d759807eecd3a95b77e", "score": "0.569486", "text": "def show_results(generated_files: true)\n @end_time = Time.now\n tree = if generated_files\n [' ',\n \"Generated files: #{@out_dir}\",\n ' ',\n TTY::Tree.new(@out_dir).render]\n else\n ''\n end\n puts\n puts TTY::Box.frame(\"Start : #{@start_time}\",\n \"End : #{@end_time}\",\n \"Time : #{@end_time - @start_time} sec\",\n *tree,\n title: { top_left: \" #{self.class.name} \" },\n width: TTY::Screen.width, padding: 1)\n end", "title": "" }, { "docid": "431724454dd63db42d96511a9793a38e", "score": "0.56947994", "text": "def summary_at_exit\n reporter = Speciny::Reporter.new(@description)\n @tests.each do |example, result|\n reporter.print_test_result(example, result)\n end\n end", "title": "" }, { "docid": "d6fdaaee8d92c1dda3637ec2dd98922c", "score": "0.5685443", "text": "def xml_should_be_same(expected, actual)\n expected = Hpricot(expected)\n actual = Hpricot(actual)\n \n blame = \"\\n\\n#################### expected\\n#{expected.to_html}\\n\\n\" \"#################### actual:\\n#{actual.to_html}\\n\\n\" \n (xml_cmp(expected, actual)).should.blaming(blame).equal true\nend", "title": "" }, { "docid": "c8863d023c5c275cdeb48ac5b9e41384", "score": "0.56796986", "text": "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "d9141eebb39be7636fe7c9ae922d0484", "score": "0.5678774", "text": "def test_dsl_2\n #------------------\n show Spock + Lizard\n #------------------\n assert_equal \\\n \"Lizard poisons Spock (winner Lizard)\\n\" \\\n \"Result = Lizard\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "9de999f00645a9a507a7342e5701e828", "score": "0.56634355", "text": "def output_result(text)\n email_results ? (result_output << text) : RAILS_ENV!=\"test\"&&puts(text)\n end", "title": "" }, { "docid": "80c1edff5699b05c46c46e1355e68001", "score": "0.5659811", "text": "def testResult(code)\n require 'sicuro'\n logger.info\"................................#{code}\"\n @codeResult = Sicuro.eval(code)\n logger.info \"............................ #{@codeResult}\"\n (@codeResult.stdout).gsub(/(?:\\n\\r?|\\r\\n?)/, '<br>')\n end", "title": "" }, { "docid": "ab0b4fd30b0c4cd7a86c7f63d2813cf1", "score": "0.56588227", "text": "def test_remain_same_1\n\t\tgame = SetGame.new\n\t\tactual_output = File.new 'update_output/actual_remain_same1.txt', 'w'\n\t\t$stdout = actual_output\n\t\tgame.deck = DECK\n\t\tgame.hand = [CARD1, CARD2, CARD3, CARD4, CARD5, CARD6, CARD7, CARD8, CARD9, CARD10, CARD11, CARD12]\n\t\tuser_input = [9,7,8]\n\t\tgame.top_card = 12\n\t\tgame.update user_input\n\t\tassert_equal 12, game.hand.size\n\t\tassert_equal 12, game.top_card\n\t\tactual_output.close\n\t\tassert_true FileUtils.compare_file('update_output/expected_remain_same1.txt', 'update_output/actual_remain_same1.txt')\n\t\tassert_equal CARD1, game.hand[0]\n\t\tassert_equal CARD2, game.hand[1]\n\t\tassert_equal CARD3, game.hand[2]\n\t\tassert_equal CARD4, game.hand[3]\n\t\tassert_equal CARD5, game.hand[4]\n\t\tassert_equal CARD6, game.hand[5]\n\t\tassert_equal CARD7, game.hand[6]\n\t\tassert_equal CARD8, game.hand[7]\n\t\tassert_equal CARD9, game.hand[8]\n\t\tassert_equal CARD10, game.hand[9]\n\t\tassert_equal CARD11, game.hand[10]\n\t\tassert_equal CARD12, game.hand[11]\n\t\tassert_equal false, game.is_end\n\tend", "title": "" }, { "docid": "e695e3e3c57359756cd5053bfd35e643", "score": "0.5657166", "text": "def test_results\n test_result_string = ''\n test_result_string += \"Marquis test: #{marquis_test}. \" if marquis_test\n test_result_string += \"Mandelin test: #{mandelin_test}. \" if mandelin_test\n test_result_string += \"Mecke test: #{mecke_test}. \" if mecke_test\n test_result_string += \"Liebermann Test: #{liebermann_test}. \" if liebermann_test\n test_result_string += \"Froehde Test: #{froehde_test}. \" if froehde_test\n test_result_string += \"Gallic Acid Test: #{gallic_acid_test}. \" if gallic_acid_test\n test_result_string += \"Ehrlic Test: #{ehrlic_test}. \" if ehrlic_test\n test_result_string += \"Folin Test: #{folin_test}. \" if folin_test\n test_result_string += \"Robadope Test: #{robadope_test}. \" if robadope_test\n test_result_string += \"Simon's Test: #{simons_test}. \" if simons_test\n test_result_string += \"Scott Test: #{scott_test}. \" if scott_test\n test_result_string.strip\n end", "title": "" }, { "docid": "411312250dbf31206afd7f32298ce046", "score": "0.56456935", "text": "def test_report_success_output_after_successfully_cracked\n\t\tguess = 'axel'\n\t\ttarget = Digest::MD5.hexdigest(guess)\n\t\tnum_tries = @pass_cracker.num_tries\n\t\ttime_elapsed = @pass_cracker.timer.time_elapsed\n\n\t\tassert_output(/Cracked password in #{num_tries} tries, time elapsed: #{0.0}\\nThe password is axel.\\n/){@pass_cracker.successfully_cracked?(guess, target)}\n\tend", "title": "" }, { "docid": "fb540b46da9b733366cb2fa749292697", "score": "0.5645495", "text": "def execute_and_compare_stdout_with cmd, args, options, expected_output\n output = capture_stdout do\n cmd.execute(args, options)\n end\n output.should == expected_output\nend", "title": "" }, { "docid": "3da3cf56f03f84dac80d72a2b005e919", "score": "0.5637681", "text": "def test_report\n @report.heading('Testing')\n @report.run('echo', 'foo')\n assert_equal \">>>>> Testing\\n>>> echo foo\\nfoo\\n\", @report.text\n end", "title": "" }, { "docid": "49ee82cb5a661b5365fa8ebab90268df", "score": "0.56276494", "text": "def process_test_results(force: false, xunit_viewer: \"xunit-viewer\")\n process_test_results_xunit(force: force, xunit_viewer: xunit_viewer)\n end", "title": "" }, { "docid": "49c2852a847e3760f08c5b6fe26aa64f", "score": "0.562023", "text": "def compare_screenshots\n if COMPARE_SCREENSHOTS == 'True' && example_name\n # If there is a expected image then compare\n if FileTest.exists?(\"screenshots/expected/#{scenario_name}/#{example_name}/#{screenshot_id}.png\")\n FileUtils.mkdir(\"screenshots/diff/#{scenario_name}/#{example_name}\") unless FileTest.directory?(\"screenshots/diff/#{scenario_name}/#{example_name}\")\n compare_images(\"screenshots/actual/#{scenario_name}/#{example_name}/#{screenshot_id}.png\", \"screenshots/expected/#{scenario_name}/#{example_name}/#{screenshot_id}.png\",\n \"screenshots/diff/#{scenario_name}/#{example_name}/#{screenshot_id}.png\", image_difference_percentage_tolerance)\n end\n elsif COMPARE_SCREENSHOTS == 'True' && !example_name\n if FileTest.exists?(\"screenshots/expected/#{scenario_name}/#{screenshot_id}.png\")\n FileUtils.mkdir(\"screenshots/diff/#{scenario_name}\") unless FileTest.directory?(\"screenshots/diff/#{scenario_name}\")\n compare_images(\"screenshots/actual/#{scenario_name}/#{screenshot_id}.png\", \"screenshots/expected/#{scenario_name}/#{screenshot_id}.png\",\n \"screenshots/diff/#{scenario_name}/#{screenshot_id}.png\", image_difference_percentage_tolerance)\n end\n end\nend", "title": "" }, { "docid": "e41c0430e925e330bad6f926177beea4", "score": "0.56008554", "text": "def check_correct_output(expected_outputs, command_output)\n puts \"Command output:\"\n puts \"==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====\"\n puts \"#{command_output}\"\n puts \"==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====\"\n\n if expected_outputs.class == Array\n\n @lines = command_output.split(/\\n/)\n puts \"Feeder produced \" + @lines.length.to_s + \" lines of output.\"\n\n for expected_output in expected_outputs\n foundit = false;\n m = Regexp.compile(expected_output)\n @lines.each { |line|\n if m.match(line) || line == expected_output\n puts \"Found expected command output:\"\n puts line\n foundit = true\n end\n }\n return foundit;\n end\n return true\n else\n return expected_outputs == command_output\n end\n end", "title": "" }, { "docid": "2d9a9566a7847b1f6b572fb97e179c26", "score": "0.5597921", "text": "def pretty_result\n data['build']['result'] == 0 ? 'passes' : 'fails'\n end", "title": "" }, { "docid": "ffc35a903f09d520f48131ed378548c6", "score": "0.5592791", "text": "def assert_output output\n stdout = $stdout.dup\n Tempfile.open 'stdout-redirect' do |temp|\n $stdout.reopen temp.path, 'w'\n yield if block_given?\n $stdout.reopen stdout\n temp.rewind\n\n temp.readline; temp.readline\n assert_equal output, temp.read.chop\n end \n end", "title": "" }, { "docid": "92ca913b516ffbf7d8664039f6b52cec", "score": "0.55839163", "text": "def testOutput\n\t\tputs @health\n\t\tputs @total_mana\n\t\tputs @remaining_mana\n\t\tputs @side\n\t\tp @hand\n\tend", "title": "" }, { "docid": "4d2beda561891a7083ad108ce5b6dc18", "score": "0.55713385", "text": "def evaluateDiffResult()\n\n end", "title": "" }, { "docid": "977889045861fa4decd71982849d8d4e", "score": "0.55662346", "text": "def test_single_user_should_keep_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example4\", \"2012112804\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1, 1, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1, 1, 2)\n #TODO assert view\n end", "title": "" }, { "docid": "71676e864b69724f3d55c21300616d55", "score": "0.55634767", "text": "def to_html\n html = generate_header\n i = 0\n project = Continuous4r.project\n errors_or_warnings = 0\n html_details = \"\"\n if !(Config::CONFIG['host_os'] =~ /mswin/)\n require 'open3'\n end\n ['spec'].each do |runner|\n error_detail_array, result = run_runner(runner)\n passed = test_passed?(result, error_detail)\n if !(error_detail_array.match(/rake aborted/).nil?) and error_detail_array.split(/$/).length > 1\n error_detail = extract_error_detail(error_detail_array)\n end\n html << generate_line_start(runner, passed)\n raise \" #{runner} tests failed.\\n BUILD FAILED.\" if project.ignore_tests_failures == \"false\" and passed == false\n File.open(\"#{Continuous4r::WORK_DIR}/test_#{runner}.log\", \"w\") do |file|\n file.write(result)\n file.close\n end\n html << \"<td style='text-align: center;'><img src='images/icon_#{passed ? 'success' : 'error'}_sml.gif'/></td>\"\n file_content = File.read(\"#{Continuous4r::WORK_DIR}/test_#{runner}.log\")\n array_file_content = file_content.split(/$/)\n test_results = extract_test_results(array_file_content)\n examples = test_results[0]\n failures = test_results[1]\n failures ||= 0\n errors_or_warnings += failures.to_i\n if failures.to_i > 0\n html_details << generate_failure_lines(array_file_content)\n end\n if array_file_content.select{|l| l =~ /^Finished in/}.length == 0\n html << generate_default_result_and_time_columns(result, error_detail, passed)\n else\n html << generate_result_and_time_columns(examples, failures, array_file_content)\n end\n i += 1\n end\n html << \"</tbody></table>\"\n return html if errors_or_warnings == 0\n html << generate_error_details(html_details)\n end", "title": "" }, { "docid": "761c9a07621f9b05d27d8c8d55d2a7df", "score": "0.55447906", "text": "def format\n if compile_error?\n \"FAILED: Test did not run because of compilation error\"\n else\n lines.reduce([]) do |formatted, l|\n if l.match(/(FAILED: .*) expected to (.*), but (.*)/)\n formatted << $1\n formatted << \" expected: \" + $2\n formatted << \" actual: \" + replace_binary($3)\n end\n formatted\n end.join(\"\\n\")\n end\n end", "title": "" }, { "docid": "62d212fd1073ee7f1126d85b46fb572e", "score": "0.55396044", "text": "def prepare_result(expected)\n assert_nothing_raised do\n if expected.kind_of? Integer \n @returned = @returned.to_f\n @correct = expected.to_f\n @incorrect = expected.to_f\n elsif expected.kind_of? Float\n @returned = round_float(@returned.to_f, @@ACCURACY)\n @correct = round_float(expected, @@ACCURACY)\n @incorrect = round_float(expected, @@ACCURACY)\n else\n @returned = @returned\n @correct = expected\n @incorrect = expected\n end\n #debug info\n #puts \"expected: #{@correct} - returned: #{@returned}\"\n end\n end", "title": "" }, { "docid": "39416b955fabc24bd5d391b77f4e978d", "score": "0.55350614", "text": "def test_completed(test)\n case test.status\n when 'passed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[92mPassed\\e[0m\"\n when 'failed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[31mFailed\\e[0m\"\n when 'undefined'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[93mUndefined\\e[0m\"\n when 'pending'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[96mPending\\e[0m\"\n end\n end", "title": "" }, { "docid": "4b20ad99dcf2bbf46e12eb6763f0b6a7", "score": "0.5527942", "text": "def output_results(test_results)\n total_tests = test_results.size\n total_assertions = 0\n total_failures = 0\n total_errors = 0\n\n test_results.each do |test_result|\n if test_result.status == \"allow_failure\"\n output_stdout(\"Test #{test_result.name} was allowed to fail, and failed\\n\")\n elsif test_result.status == \"allow_success\"\n output_stdout(\"Test #{test_result.name} was allowed to fail, but succeeded\\n\")\n end\n total_assertions += test_result.assertion_count\n if not test_result.passed?\n total_failures += test_result.failures.size\n total_errors += test_result.errors.size\n faults = test_result.failures + test_result.errors\n faults.each_with_index do |fault, index|\n output_stdout(\"\\n%3d) %s\\n\" % [index + 1, fault.long_desc])\n end\n test_result.coredumps.each do |hostname, corelist|\n output_stdout(\"Coredumps on host #{hostname}:\\n\")\n corelist.each {|core| output_stdout(core.corefilename)}\n output_stdout(\"Binaries and corefiles saved in #{hostname}:#{corelist.first.coredir}\\n\")\n end\n end\n end\n output_stdout(\"In all: #{total_tests} Tests, #{total_assertions} Assertions, #{total_failures} Failures, #{total_errors} Errors.\\n\")\n end", "title": "" }, { "docid": "224304ed7afe52ee821fb4eb535c10ab", "score": "0.55265164", "text": "def enter_result(test_data)\n hide_notifications_bar\n logger.info \"Entering result '#{test_data[CoreUseOfCollectionsData::RESULT.name]}'\"\n wait_for_element_and_type(result_text_area, test_data[CoreUseOfCollectionsData::RESULT.name])\n end", "title": "" }, { "docid": "935159f8ab1dc414f0cae07357faa729", "score": "0.5525426", "text": "def check_dat(val, nice, noway)\n unless val\n system(\"echo '\\n\\033[31m----- Tests Failed -----\\033[0m\\n'\")\n system(\"echo \\\"#{noway.sample}\\\" | lolcat\")\n puts ''\n exit(1)\n end\n system(\"echo '\\n\\033[32m----- Tests OK -----\\033[0m\\n'\")\n system(\"echo \\\"Et Jésus déclara: #{nice.sample}\\\" | lolcat\")\n puts ''\n exit(0)\nend", "title": "" }, { "docid": "3182af643bc09961b76d542ff9c2973b", "score": "0.55224764", "text": "def test_result_changes(test_result)\n test_changes(test_result.run_result, test_result.test)\n end", "title": "" }, { "docid": "6a8eeec272a582e0da4468e83578c8bc", "score": "0.5522388", "text": "def failed?\n return false if pending?\n if rendered != File.read(full_output_file)\n @error = 'Rendered output does not match expected.'\n end\n !@error.nil?\n end", "title": "" }, { "docid": "a5151215c263a22927f4910e4c4d04c3", "score": "0.551695", "text": "def test_dsl_6\n #--------------------------------------------\n show Rock + Paper + Scissors + Lizard + Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors cut Paper (winner Scissors)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Spock smashes Scissors (winner Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "4d5f46589f13e8dcecb993a5d3aec56f", "score": "0.5509166", "text": "def test_dsl_7\n #--------------------------------------------\n show Rock - Paper - Scissors - Lizard - Spock\n #--------------------------------------------\n assert_equal \\\n \"Paper covers Rock (loser Rock)\\n\" \\\n \"Rock crushes Scissors (loser Scissors)\\n\" \\\n \"Scissors decapitate Lizard (loser Lizard)\\n\" \\\n \"Lizard poisons Spock (loser Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "c93a5d74d77b26680f65529da02a3b88", "score": "0.5508532", "text": "def test_dsl_3\n #------------------\n show Spock - Lizard\n #------------------\n assert_equal \\\n \"Lizard poisons Spock (loser Spock)\\n\" \\\n \"Result = Spock\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "9817afd268621c364a0121e44c0a317d", "score": "0.5504143", "text": "def test(message, expected, actual)\n if expected == actual\n puts \"Pass - #{message}\"\n else\n puts \"Fail - #{message}\"\n end\nend", "title": "" }, { "docid": "87e1fa827b0b0f8eab9602a87a193f0d", "score": "0.55039483", "text": "def suppress_diff_output\n return if @config[:runtime_config][:diff]\n\n @run_data[:profiles]&.each do |p|\n p[:controls]&.each do |c|\n c[:results]&.each do |r|\n next unless r[:message] # :message only set on failure\n\n pos = r[:message].index(\"\\n\\nDiff:\")\n next unless pos # Only textual tests get Diffs\n\n r[:message] = r[:message].slice(0, pos)\n end\n end\n end\n end", "title": "" }, { "docid": "2176cbace39826ce594e3ceb093a48e3", "score": "0.55008274", "text": "def verify_result(expect, model)\n puts \"running query: #{build_query(model)}\"\n result = search(build_query(model))\n assert_equal(expect.size, result.hit.size)\n expect.each_with_index do |expected_sub_scores,i|\n jsf = result.hit[i].field['summaryfeatures']\n sub_scores = extract_subscores(jsf, model.size)\n assert_equal(expected_sub_scores, sub_scores,\n \"subscores differ for hit #{i}: #{expected_sub_scores} != #{sub_scores}\")\n end\n end", "title": "" }, { "docid": "9ee094763a2aa16158c642dc16ab3bb5", "score": "0.5499414", "text": "def report_test_result success, msg\n if(success)\n print_success msg\n else\n print_error msg\n end\nend", "title": "" }, { "docid": "88f7bf8800af49250d77674cc62d95ae", "score": "0.5498363", "text": "def check_result(filename, result, must_fail, tag)\n if must_fail && !result.match(/^No search results$/)\n s = \"\"\n s << \"This case must be failed (type unsafe)\\n\"\n\n return s\n end\n\n if File.exists?(filename)\n content = File.read(filename)\n if result != content\n s = \"\"\n s << \"===== expect:\\n\"\n s << content\n s << \"\\n\"\n s << \"===== actual:\\n\"\n s << result\n s << \"\\n\"\n s << \"=====\"\n\n return s\n else\n return nil\n end\n\n else\n if result.length > 0\n puts \"[!] WARNING: no test for #{tag} (#{filename}) ===== \"\n\n # auto_generate_testcase(filename, result)\n\n puts result\n puts \" \" + \"=\" * 20\n end\n\n return nil\n end\nend", "title": "" }, { "docid": "f7ddd4f71f6b2937d804d471d7768846", "score": "0.5497609", "text": "def check_for_correct_output\n\t\tif Digest::MD5.hexdigest(File.read(OUTFILE)) == CORRECT_MD5\n\t\t\tputs 'Output is correct!'\n\t\telse\n\t\t\tputs 'Output is incorrect. Continue debugging.'\n\t\tend\n\tend", "title": "" }, { "docid": "7ae3931807d328ca1b6c1ede5bda113f", "score": "0.548419", "text": "def failure_message\n \"expected document to #{description}; got: #{@rendered}\"\n end", "title": "" }, { "docid": "7ae3931807d328ca1b6c1ede5bda113f", "score": "0.548419", "text": "def failure_message\n \"expected document to #{description}; got: #{@rendered}\"\n end", "title": "" }, { "docid": "3ac8b18f89b5b4894feb37189e958a47", "score": "0.54837275", "text": "def test_equality(expected, actual)\n \tif expected == actual\n \t\tputs \"pass :):):)\"\n \telse\n \t\tputs \"fail :(:(:(\"\n\tend\nend", "title": "" }, { "docid": "ec803bc910224c53cad4e3a307ae4d5a", "score": "0.54710156", "text": "def test_dsl_8\n #-------------------------------------------------\n show((Rock + Paper) - (Scissors + Lizard) + Spock)\n #-------------------------------------------------\n assert_equal \\\n \"Paper covers Rock (winner Paper)\\n\" \\\n \"Scissors decapitate Lizard (winner Scissors)\\n\" \\\n \"Scissors cut Paper (loser Paper)\\n\" \\\n \"Paper disproves Spock (winner Paper)\\n\" \\\n \"Result = Paper\\n\", \\\n @out.string\n end", "title": "" }, { "docid": "ef20dc9793cc7cc6bd1ad813f3b8915d", "score": "0.54695153", "text": "def print_result_summary(result, time_taken=0)\n if result.failure_count == 0 && result.error_count == 0\n final_color = success_color\n elsif result.error_count > 0\n final_color = error_color\n else\n final_color = fail_color\n end\n\n out \"\\nTests: #{result.run_count}, Assertions: #{result.assertion_count}, Fails: #{result.failure_count}, Errors: #{result.error_count}, Time taken #{sprintf('%.2f', time_taken)}s\", final_color\n end", "title": "" }, { "docid": "555ba0212e2038a8b6754f133a1bf375", "score": "0.5467947", "text": "def test(msg, expected, actual)\n if expected == actual\n puts \"pass!! #{msg}\"\n else\n puts \"fail!! #{msg}\"\n end\nend", "title": "" } ]
035fc0de15781acd1040515cde5a3dea
All of this specific instance of book, Looking for their genres
[ { "docid": "6a7c24fc4aefde1f9cca389876848d2a", "score": "0.82086223", "text": "def genres\n Genre.all.select{|genre| genre.book == self }\n end", "title": "" } ]
[ { "docid": "d3264b37f1178277fcbd9086e034a335", "score": "0.7563995", "text": "def genres\n to_array search_by_itemprop 'genre'\n end", "title": "" }, { "docid": "d1ac84dadd0aec02c454a780d91948f7", "score": "0.73882616", "text": "def books\n Book.all.select do |book|\n # Is this book's genre object matching to \"me\"?\n book.genre == self\n end\n end", "title": "" }, { "docid": "88ac0d5d0d28b3316bc4606c4cf18304", "score": "0.73745614", "text": "def returnBooksByGenre(userGenre)\n @books.each do \n |book|\n #book[0] holds just the key of all the book in the hash\n #book[1] holds availablility and the book itself\n #For every book, check if available\n book[1][0].select do\n |key, value|\n if(value.genre == userGenre)\n p value\n end\n end #end inner do\n end #end outer do\n end", "title": "" }, { "docid": "926372a9780c03f3611b12b169e2745a", "score": "0.73114014", "text": "def genres\n\t\t@songs.collect {|g| g.genre}\n\tend", "title": "" }, { "docid": "4b32562c2845474805d51bea9fb9d8a1", "score": "0.72458875", "text": "def genres\n @songs.collect {|s| s.genre}\n end", "title": "" }, { "docid": "1b81f0ecd57eaff07576ac9b31d61724", "score": "0.7230851", "text": "def genres\r\n self.songs.collect do |song|\r\n song.genre\r\n end\r\n end", "title": "" }, { "docid": "4c8ab68f563e8d43216aa3c74001df82", "score": "0.7214237", "text": "def genres\n songs.map{|song| song.genre} # giving back all the genres under that particular artist. artists can have nmany genres and calling of theirmany genres.\n # Song.all.map{|ind_song| ind_song.genre} #giving back all the different genres from the collection of song array. giving back all the genres of the songs\n # binding.pry\n end", "title": "" }, { "docid": "44fd2c12a4cfbf1e7c1dc6712c3b2080", "score": "0.7206448", "text": "def genres\n songs.collect do |song|\n song.genre\n end\n .uniq #does not return duplicate genres if the artist has more than one song of a particular genre (artist has many genres through songs)\n end", "title": "" }, { "docid": "2be1caaf28b0795d1360f47231999062", "score": "0.7203693", "text": "def genres \n songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres\n end", "title": "" }, { "docid": "48f8cbb5d929a9021653c795ef54eb89", "score": "0.71558064", "text": "def genres\n Song.all.collect{|song|song.genre}\n end", "title": "" }, { "docid": "769465c102354474ab7bb3eb1e20b321", "score": "0.71325976", "text": "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "769465c102354474ab7bb3eb1e20b321", "score": "0.71325976", "text": "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "769465c102354474ab7bb3eb1e20b321", "score": "0.71325976", "text": "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "769465c102354474ab7bb3eb1e20b321", "score": "0.71325976", "text": "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "769465c102354474ab7bb3eb1e20b321", "score": "0.71325976", "text": "def genres\n self.songs.collect do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "977c660f1bc27a045bb3d7d20d00fa35", "score": "0.7132194", "text": "def genres\n @songs.collect do |song|\n song.genre\n end.uniq\n end", "title": "" }, { "docid": "f2496134bd3e4f9ba7025993d55cbfaa", "score": "0.711248", "text": "def genres\n @new_array_of_genres = []\n @songs.each do |song| #iterate through each song to find the genre\n if @new_array_of_genres.include?(song.genre) #does not return duplicate genres\n nil\n else\n @new_array_of_genres << song.genre #collects genres through its songs\n end\n end\n @new_array_of_genres #returns a collection of genres for all of the artists songs\n end", "title": "" }, { "docid": "690a250cc97c6080c4c518cd134fd7bd", "score": "0.7110291", "text": "def genres\n self.songs.collect {|song| (song.genre) }.uniq\n end", "title": "" }, { "docid": "dfab731b6235cc629350a50acc108328", "score": "0.71099454", "text": "def genres\n @songs.collect { |song| song.genre }.uniq\n end", "title": "" }, { "docid": "dd6915b848094493d31eb4ad6085cf43", "score": "0.71090895", "text": "def genres\n songs.map {|song| song.genre }\n end", "title": "" }, { "docid": "4bfe932a4d485b54e789506b9032a69e", "score": "0.71057785", "text": "def genres\n @songs.collect{|song| song.genre }.uniq\n end", "title": "" }, { "docid": "4de4dc9a35029ae2f4d47e2a43e2ed5f", "score": "0.7097433", "text": "def genres\n document[\"genre\"].collect {|gender| gender[\"$\"]} rescue nil\n end", "title": "" }, { "docid": "5561d5239e860e75e732a045d8899afa", "score": "0.7084404", "text": "def genres\n songs.map{|song|song.genre}.uniq\n end", "title": "" }, { "docid": "5484fbff29f919de1899c3b65d2767dc", "score": "0.7060625", "text": "def genres\n songs.map do |song| song.genre end\n end", "title": "" }, { "docid": "2fd74cfcd63feb32c6920bae0cb0f525", "score": "0.70484227", "text": "def genres\n songs.map {|song| song.genre}\n end", "title": "" }, { "docid": "af555033569693029a7e420d1b3e4f50", "score": "0.7047492", "text": "def genres\n self.songs.collect {|song| song.genre}.uniq\n end", "title": "" }, { "docid": "00c24409c01ab8f2ad36f091a381edb6", "score": "0.7035377", "text": "def genres\n self.songs.map { |song| song.genre }.uniq\n end", "title": "" }, { "docid": "a1659353b24bab5c4d79e3f576d49d5b", "score": "0.70315963", "text": "def genres\n songs.collect{|song| song.genre}.uniq\n end", "title": "" }, { "docid": "d3f4711d9ecf0d69e7ba1c1b4dc4fdcc", "score": "0.69994843", "text": "def genres\n document.search(\"h5[text()='Genre:'] ~ a[@href*=/Sections/Genres/']\").map { |link| link.innerHTML.strip.imdb_unescape_html } rescue []\n end", "title": "" }, { "docid": "cffb05fba1a4bdc0c34e3008e85f07f1", "score": "0.6997356", "text": "def genres\n self.songs.map {|x| x.genre}\n end", "title": "" }, { "docid": "b38854353fc09e49322cdc8589af8db9", "score": "0.6995296", "text": "def genres\n self.songs.map do |artist_song|\n artist_song.genre\n end\n end", "title": "" }, { "docid": "a2808e3d41a7f2114062573e30443f08", "score": "0.6973603", "text": "def genres\n details.css(\"div.subtext a[href^='/genre/']\").map { |genre| genre.text } rescue []\n end", "title": "" }, { "docid": "e771672f72777f5158ca23e350f35cfa", "score": "0.69004977", "text": "def genres_hash\n search_by_itemprop_hash 'genre'\n end", "title": "" }, { "docid": "43746fddc011a3fc05e6ab8cc6f9d89d", "score": "0.689575", "text": "def genres \n songs.collect {|song| song.genre}.uniq \n\n end", "title": "" }, { "docid": "748dddaf64fb981a809d469655ea1ecf", "score": "0.6839914", "text": "def genres\n all_genres = []\n Song.all.each do |x|\n if x.artist == self\n all_genres << x.genre\n end\n end\nall_genres\nend", "title": "" }, { "docid": "41744c84e4672dd745e7e6898a267ce9", "score": "0.67750216", "text": "def bookGenre\n\t\tarr =[]\n\t\tcurrent_user.reads.each do |f|\n\t\t\tarr.push(Book.find_by_id(f.book_id).genre)\n\t\tend\n\t\th = Hash.new(0)\n\t\t\tarr.each do |word|\n\t\t\th[word] += 1\n\t\tend\n\t\tgenre = h.sort_by{|word,count| count}\n\t\tgenre = genre.reverse # Hash highest the genre picked the most\n\n\t\tarr2 =[]\n\t\tgenre.each do |key,value|\n\t\t\tarr2.push(key)\n\t\tend\n\t\tif(arr2.size > 1)\n\t\t\t@popGenre = arr2.at(0)\n\t\telse\n\t\t\t@popGenre = \"Adventure\"\n\t\tend\n\tend", "title": "" }, { "docid": "8f6389849b98b99e2e33280790e8ab50", "score": "0.67462975", "text": "def list_genre\n genre = gets.chomp\n Genre.all.each do |a|\n if a.name == genre\n a.songs.collect { |s| puts \"#{s.artist.name} - #{s.name} - #{s.genre.name}\" }\n end\n end\n end", "title": "" }, { "docid": "ee0d09d4ecc09f39d616902f2274f27f", "score": "0.67433137", "text": "def authors\n # 1. Find all of the books in this genre\n # 2. Return back the author for every book\n books.collect do |book|\n # Each book, I want the author\n book.author\n end.uniq\n end", "title": "" }, { "docid": "dca124245e5ed37808125f52830752c6", "score": "0.67240417", "text": "def genres\n return @metadata[:genres]\n end", "title": "" }, { "docid": "1257855f0259fede0a2e98fd83bee54c", "score": "0.67045295", "text": "def genres\n # look for a local variable called songs\n # look for a method on self. called songs => self.songs\n # looks up the parent chain\n self.songs.map do |song|\n song.genre\n end\n end", "title": "" }, { "docid": "71d4a8b6694e654deec03c97d0eaf61f", "score": "0.6681955", "text": "def genres\n songs.map do |song|\n song.genre\n end\nend", "title": "" }, { "docid": "7ca4613d725f5b71875adeef5364bd62", "score": "0.6623343", "text": "def genres\n self.songs.collect {|song| song.genre}\nend", "title": "" }, { "docid": "ace038eae90fad628f70c6a65455e83d", "score": "0.6586827", "text": "def genres #How to shorten? \n array = []\n songs.each do |song_instance|\n array << song_instance.genre \n end\n array.uniq\n end", "title": "" }, { "docid": "4e3ec0bab8bb34ff9ca2302ca4f1265b", "score": "0.6571334", "text": "def genres\n search_by_text('жанры').split(', ')\n end", "title": "" }, { "docid": "e1301ee1d89663ae9a9f96abe650e82d", "score": "0.65691817", "text": "def songs\n Song.all.select {|song_name| song_name.genre == self}\n end", "title": "" }, { "docid": "187051c77376a539754567a2e3a89525", "score": "0.6568335", "text": "def genre_array\n Genre.list.each { |genre| @available_genres << genre.kind }\n end", "title": "" }, { "docid": "2459c8ac9b323f0eb005618990e8a7ed", "score": "0.6556527", "text": "def all_songs_with_genre(songs=songs_array, genre)\n songs.select do |song|\n binding.pry\n # song[:genre] == genre\n end\n end", "title": "" }, { "docid": "d6f90bfee6d2b514d17ca2147c86d427", "score": "0.65477854", "text": "def plays_genres\n genres = Array.new\n self.genres.each do |genre|\n genres << genre.printable\n end\n genres.uniq\n end", "title": "" }, { "docid": "46f1beabadcff407dcf27d26963683a7", "score": "0.6534815", "text": "def concept_genres\n find_related_frbr_objects( :has_as_its_genre, :which_concepts?) \n end", "title": "" }, { "docid": "46f1beabadcff407dcf27d26963683a7", "score": "0.6534815", "text": "def concept_genres\n find_related_frbr_objects( :has_as_its_genre, :which_concepts?) \n end", "title": "" }, { "docid": "2027214f1d5695b42d41bb2a5c2ee027", "score": "0.65302354", "text": "def show\n @genre = Genre.find(params[:id])\n @genres = Genre.where(\"(genre_id = ?)\", @genre.id)\n @genres = Genre.all\n @books = Book.where(\"(genre_id = ?)\", @genre.id)\n\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "title": "" }, { "docid": "6d538fd29bae05d1dc1a04a17358c008", "score": "0.65042377", "text": "def genres\n self.songs.collect do |song| #call the artist class on the songs method and collect the song\n song.genre #then call the genre on the song\n end\n end", "title": "" }, { "docid": "765e101f5662c8d0b0242caa97d43c5a", "score": "0.64156014", "text": "def get_genre_list\n @genre_names = Genre.select('name')\n end", "title": "" }, { "docid": "a748b00214ff5fac5ff2703818c8adb6", "score": "0.6402625", "text": "def songs\n Song.all.select{|song| song.genre == self}\n end", "title": "" }, { "docid": "a748b00214ff5fac5ff2703818c8adb6", "score": "0.6402625", "text": "def songs\n Song.all.select{|song| song.genre == self}\n end", "title": "" }, { "docid": "4d0643f567cecce8954a158ea55f15df", "score": "0.63995695", "text": "def songs\n Song.all.select do |song|\n song.genre == self\n end\n end", "title": "" }, { "docid": "4d0643f567cecce8954a158ea55f15df", "score": "0.63995695", "text": "def songs\n Song.all.select do |song|\n song.genre == self\n end\n end", "title": "" }, { "docid": "7e156a8e4bcd9117ef7c6c9b1c448463", "score": "0.63929814", "text": "def genre_names\n genres.map {|genre| genre.name}\n #create empty array\n #@movie.genres\n #call genres, because @movie is the instance itself already\n #run map to get each name of each genre instance\n #return map\n end", "title": "" }, { "docid": "84ad6d63ad276861ca777b1247d1132d", "score": "0.63883036", "text": "def songs\n Song.all.select {|song| song.genre == self}\n end", "title": "" }, { "docid": "d97bde8280e8483ab18404fed40da9a5", "score": "0.63834053", "text": "def subgenres; end", "title": "" }, { "docid": "060f76963a2335780b3abd83f667d1ad", "score": "0.6360708", "text": "def initialize(title, genre)\n @title = title\n @genre = genre\n genre.books << self\n @@all << self\n end", "title": "" }, { "docid": "43e62cdc211005943061ac9cbe1804dd", "score": "0.63555294", "text": "def genre\n @ole.Genre\n end", "title": "" }, { "docid": "74826c05001ea961e16b7514db6cf603", "score": "0.6337178", "text": "def index\n set_genre\n @subgenres = @genre.subgenres.all\n end", "title": "" }, { "docid": "e7bd6c89f4dc3a3f35d47c8b685d40e0", "score": "0.6331131", "text": "def songs\n Song.all.select do |song|\n song.genre == self \n end\n end", "title": "" }, { "docid": "e8d3eaa027b48dd9a0cce19fa05abbfb", "score": "0.6325414", "text": "def genre; end", "title": "" }, { "docid": "e8d3eaa027b48dd9a0cce19fa05abbfb", "score": "0.6325414", "text": "def genre; end", "title": "" }, { "docid": "78a1f29e2b55548fb8fdd2bf11e49df5", "score": "0.63144964", "text": "def genre=(genre)\n \t@genre = genre\n \t# Now that we've assigned a genre to a book, we also want to push that genre to GENRES:\n \tGENRES << genre\n end", "title": "" }, { "docid": "e3e2633ccd3c6557abe0ab8cabc7b07c", "score": "0.62593186", "text": "def songs\n Song.all.select{|x| x.genre == self}\nend", "title": "" }, { "docid": "5ca8282bb56be1e0ef214f64fad3b49a", "score": "0.62145066", "text": "def get_content_genres\n if episode?\n return content.show.show_genres\n else\n return content.movie_genres\n end\n end", "title": "" }, { "docid": "bc7409c57514147ada86a08b664959b1", "score": "0.62119037", "text": "def gather_releases_by_subgenre(subgenre)\n check = self.releases \n collected = [] \n self.releases.each do |release|\n collected << release if release.subgenre == subgenre\n end\n collected \n end", "title": "" }, { "docid": "00c05c0df49eb324e76fee1575f6e884", "score": "0.6196086", "text": "def index\n @games = Game.search(params[:search], params[:genre]).page(params[:page])\n @genres_searched ||= []\n\n @games.each_with_index do |g, index|\n @genres_searched[index] = g.genre_id\n end\n\n @genres = Genre.all\n end", "title": "" }, { "docid": "0fac931c224fe6dc5b215cd218457c49", "score": "0.61948943", "text": "def reviewed_books\n self.reviews.map{|r| r.book}\n end", "title": "" }, { "docid": "585d4710a137a624b88f0d1cf1a0a75a", "score": "0.6178647", "text": "def books\n self.book_authors.map {|book_author| book_author.book}\n end", "title": "" }, { "docid": "e731ac0f90497d15857becf8acc06077", "score": "0.6172997", "text": "def genres\n genres = fetch_attribute(\"genres_en\")\n if genres\n return genres\n else\n return \"\"\n end\n end", "title": "" }, { "docid": "205d8e70b8253274c724c43ae46bc912", "score": "0.6170631", "text": "def list_genres\n Genre.all.uniq.sort { |genre1, genre2| genre1.name <=> genre2.name}.each.with_index(1) do |genre, i|\n puts \"#{i}. #{genre.name}\"\n end\n end", "title": "" }, { "docid": "481bdd54728e53dc6efa8273f14847bc", "score": "0.61307627", "text": "def genre\n @genre\n end", "title": "" }, { "docid": "481bdd54728e53dc6efa8273f14847bc", "score": "0.61307627", "text": "def genre\n @genre\n end", "title": "" }, { "docid": "481bdd54728e53dc6efa8273f14847bc", "score": "0.61307627", "text": "def genre\n @genre\n end", "title": "" }, { "docid": "7e730f95951c6f2876ec161579f28f9f", "score": "0.61302656", "text": "def genres\n document.search(\"[@class='actionLinkLite']\").select { |elem| elem['href'] =~ /genres/ }.map { |elem| elem.innerHTML.strip } rescue []\n end", "title": "" }, { "docid": "e00f1af3d7eb74121b5c0eaa583ab5dd", "score": "0.6129959", "text": "def genres\n self.songs.map do |song|\n song.genre\n end.uniq\n #unduped.uniq #uniq only works on an array\n end", "title": "" }, { "docid": "fe56279cb373f5e852f1d227001e2dc3", "score": "0.61196923", "text": "def songs\n Song.all.select do |song|\n song.genre == self\n end\nend", "title": "" }, { "docid": "7301def1c1497f1a1470604a6bb107ad", "score": "0.6107742", "text": "def getAllBooks()\n puts \"\\nBOOKS:\"\n puts \"-------------------------------------------------\"\n @books.each {|book| puts \"ID: \" + book.id.to_s +\n \", Name: \" + book.title +\n \", Author: \" + book.author +\n \", Publication: \" + book.publication +\n \", Year: \" + book.year.to_s +\n \", Rack No.: \" + book.rack_no .to_s+\n \", Total Copies: \" + book.total_copies.to_s +\n \", Copies Available: \" + book.copies_available.to_s\n }\n puts \"-------------------------------------------------\"\n end", "title": "" }, { "docid": "245fa33ad29648c76650b07467f255e7", "score": "0.6074404", "text": "def genres\n Genre.joins(user_room_genres: :user_room)\n .where(user_rooms: { game_room: self })\n .distinct\n end", "title": "" }, { "docid": "0c46f5dc2bfb22505113f6f2d8cb36bd", "score": "0.6069131", "text": "def genres\n genres = {}\n\n # Extract genres from the 'Episode' content type's validation rules\n $delivery.content_type('episode').fields.select do |field|\n field.id == 'genre'\n end.first.items.raw['validations'].first['in'].each do |genre|\n genres[parse_genre(genre)] = genre\n end\n\n genres\n end", "title": "" }, { "docid": "d17dd18727b2c4b0ec831cd19f32d2c1", "score": "0.60646814", "text": "def get_genres\n \tRails.cache.fetch(\"tmdb/genres_list\", expires_in: 24.hours) do\n \t\taction = \"genre/movie/list\"\n \t\targument = \"&language=en-US\"\n\t\t\tresponse = call_api(action, argument)\n\t\t\t@result = Hash.new\n\t\t\tresponse[\"genres\"].each do |genre|\n\t\t\t\t@result[genre[\"id\"]] = genre[\"name\"]\n\t\t\tend\n\t\t\t@result\n\t\tend\n\tend", "title": "" }, { "docid": "df2c69b93a0f7ab2225eccf0d84fff48", "score": "0.6026799", "text": "def all\n @books.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end", "title": "" }, { "docid": "d54b8ef792ca9507b8fc1c16bc9a3910", "score": "0.6025114", "text": "def show\n\t\t@genre = Genre.find(params[:id])\n\t\t@books_of_genre = @genre.books.order(title: :asc).paginate(page: params[:page], per_page: 24)\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend", "title": "" }, { "docid": "9eac4d63ac7c2a694a1efb7d55a8a622", "score": "0.60219", "text": "def index\n \n @books = Book.search(params[:search])\n \n if params[:book] and params[:book][:genre_id] > \"\"\n genreid = params[:book][:genre_id].to_i\n @books = @books.select { |b| b.genre_id == genreid }\n end\n \n \n \n @books = @books.paginate(page: params[:page], per_page: 5)\n \n \n end", "title": "" }, { "docid": "4cf7f982392a067cdc97935897ccad54", "score": "0.60196704", "text": "def fav_genre\n # NOTE : DID NOT ADD GENRES YET\n # r.shows.genres\n \"WIP - no genres yet\"\n end", "title": "" }, { "docid": "f4611bc8a5328e8779b9429fad44c15d", "score": "0.6008708", "text": "def index\n @genres = Genre.all\n end", "title": "" }, { "docid": "f4611bc8a5328e8779b9429fad44c15d", "score": "0.6008708", "text": "def index\n @genres = Genre.all\n end", "title": "" }, { "docid": "cc48f3aa592c10d27db77338381cfd7d", "score": "0.59985214", "text": "def list_genres\n sorted_list = Genre.all.sort_by {|artist| artist.name}\n sorted_list.each_with_index do |genre, idx|\n puts \"#{(idx + 1).to_s}. #{genre.name}\"\n end\n end", "title": "" }, { "docid": "09ce5f86ebd8dff9a527dbd80bc27875", "score": "0.5993177", "text": "def index\n @game_genres = GameGenre.all\n end", "title": "" }, { "docid": "6490c252056db803e21da236ba870649", "score": "0.5991859", "text": "def genre_list\n {\"1\" => 'シーバス', \"2\" => 'バス', \"3\" => \"青物\",\n \"4\" => \"フラットフィッシュ\", \"6\" => \"アジ\"}\n end", "title": "" }, { "docid": "f88cefdea670f1849495a5d6e064272c", "score": "0.598598", "text": "def index\n # @books = Book.all.order('created_at DESC')\n @genres = Genre.all\n @genre = if params[:genre]\n params[:genre]\n else\n nil\n end\n @books = if params[:genre]\n Book.genre(params[:genre])\n else\n Book.all.order('created_at DESC')\n end\n end", "title": "" }, { "docid": "3588102242c70804b28224cb42bed2bf", "score": "0.5974878", "text": "def genres\n MusicImporter.new(path).print_genres\n end", "title": "" }, { "docid": "8d553af8b8466ba706923ba47ccf40bd", "score": "0.59599745", "text": "def one_of_their_books\n reading_lists.sample.book\n end", "title": "" }, { "docid": "07706a774378d77c3c53ef182e459335", "score": "0.59556466", "text": "def index\n\t\t@genres = Genre.all\n\tend", "title": "" }, { "docid": "687bbf3d3bb7e7d92fb30e8cce237569", "score": "0.59321916", "text": "def named_books\n # I didn't have the creativity needed to find a good ruby only check here\n books.select(&:name)\n end", "title": "" }, { "docid": "3df3f4e1c2b21abe8e60426c8000af3c", "score": "0.5926348", "text": "def genre\n case result_item.format\n when \"Book\"\n \"book\"\n when :book_item\n \"bookitem\"\n when :conference_paper\n \"proceeding\"\n when :conference_proceedings\n \"conference\"\n when :report\n \"report\"\n when :serial\n \"journal\"\n when \"Article\"\n \"article\"\n else\n nil\n end \n end", "title": "" } ]
5870a9c4d0cbd280ab7313b191ee0bf7
=begin rdoc Instantiate a Packet object for an Image object with the given ident. =end
[ { "docid": "f78f018fa2578b2cbf6e874f5d080881", "score": "0.5647171", "text": "def initialize(ident, img, img_offset=nil, sz=nil )\n sz ||= img.size\n modelitem_init\n target_init\n sectioned_target_init img, img_offset, sz\n end", "title": "" } ]
[ { "docid": "9beea163d43a46fd62cba4f668c2f0c6", "score": "0.7448141", "text": "def add_packet_for_image(pkt_ident, img, img_off=0, sz=nil)\n p = Bgo::Packet.new( pkt_ident, img, img_off, sz )\n add_packet_object p\n end", "title": "" }, { "docid": "f08df2b24c859f7a34179432d9a0323b", "score": "0.66856015", "text": "def add_packet(pkt_ident, bytes)\n img = add_image( bytes )\n add_packet_for_image(pkt_ident, img, 0, bytes.length)\n end", "title": "" }, { "docid": "f1a0054fc2337c61e6d3c44c4b0eefc5", "score": "0.63319546", "text": "def packet(ident)\n @packets[ident]\n end", "title": "" }, { "docid": "84e611e99304c64dc7304cc2fd1a9a75", "score": "0.6028533", "text": "def create_item(icon, *args)\n Packet_Item.new(self, icon, *args)\n end", "title": "" }, { "docid": "022e71984ec0bb6d26f021086d0d6fb6", "score": "0.5960549", "text": "def initialize( ident, name, img, img_off=0, file_off=0, sz=nil,\n flags=DEFAULT_FLAGS )\n @file_offset = file_off\n super img, file_off, img_off, sz\n @ident = ident.to_s\n @name = name\n @flags = flags.dup\n @addresses = {}\n\n modelitem_init\n end", "title": "" }, { "docid": "0bdadb3a6458463cda293b0b8c4d1fb6", "score": "0.58707684", "text": "def initialize(packet_id, type, session_id, body)\n @packet_id = packet_id || rand(0xFFFF)\n @type = type || raise(DnscatException, \"type can't be nil!\")\n @session_id = session_id || raise(DnscatException, \"session_id can't be nil!\")\n @body = body\n end", "title": "" }, { "docid": "88c8bf9bf3dad1c8b09c08db678b7921", "score": "0.5573396", "text": "def initialize(id, lines)\n @id = id\n @image = Image.new(lines)\n @frozen = false\n end", "title": "" }, { "docid": "63535403a9b99c60838c0ac22b162432", "score": "0.55718637", "text": "def initialize(pcap_packet)\n @pcap_packet = pcap_packet\n extract_raw_packet_data\n end", "title": "" }, { "docid": "56682b90ce1b475a007d4a44b3ca1032", "score": "0.5533075", "text": "def initialize(width, height, imageID, active_layer)\n @width = width\n @height = height\n @imageID = imageID\n @active_layer = active_layer\n end", "title": "" }, { "docid": "c98f9af3be2fb30c0897a514bf62b72c", "score": "0.55139846", "text": "def duplicate\n Packet.new(self, nil)\n end", "title": "" }, { "docid": "0a82bf2cfe205159d252f3366885ed1d", "score": "0.5474459", "text": "def initialize drbdump, packet\n @drbdump = drbdump\n @loader = drbdump.loader\n @packet = packet\n @statistics = drbdump.statistics\n\n @source = nil\n @destination = nil\n end", "title": "" }, { "docid": "58d871242512fb7cb6768dde2ffc7675", "score": "0.54527414", "text": "def initialize(packet)\n self.opcode = packet.unpack(\"n\").first\n struct = TFTPHDR[opcode]\n raise IllegalTFTPop unless struct\n self.packet = packet.unpack(struct)\n end", "title": "" }, { "docid": "24de4fa3960ad6bc6545c728e7ff93ab", "score": "0.5450022", "text": "def initialize\n @packet = \"\"\n end", "title": "" }, { "docid": "6b434ddf22d533b85cc839689e3721d1", "score": "0.5433692", "text": "def ip_packet\n IPPacket.new(bytes.drop(14))\n end", "title": "" }, { "docid": "ccb939983e4294cca7098440263a14c0", "score": "0.54251987", "text": "def initialize(img, name_id, name_file_id)\n @name_id = name_id\n @name_file_id = name_file_id\n self.image = img\n end", "title": "" }, { "docid": "950cb364f57af0c9b685a9ded829fe99", "score": "0.533494", "text": "def create_raw\n Socket.new(Socket::PF_PACKET, Socket::SOCK_RAW, ETH_P_ALL)\n end", "title": "" }, { "docid": "c410170201a658ef1b3b157176389345", "score": "0.5322434", "text": "def initialize(packet)\n # Get first byte of IP header\n ip_hdr_start = packet.get_uchar(ETH_HDR_LEN).to_s(16)\n # First nibble is IP header version\n if ip_hdr_start[0].hex == 4\n # Second nibble is IP header length in words (4 bytes)\n @ip_hdr_len = ip_hdr_start[1].hex * 4\n else\n raise \"IPv6 not supported\"\n end\n\n ip_hdr_ptr = FFI::MemoryPointer.from_string(packet.get_array_of_uchar(ETH_HDR_LEN,(@ip_hdr_len)).pack('C*'))\n\n @ip_hdr = FFI::Packets::Ip::Hdr.new(ip_hdr_ptr)\n\n @tcp = @udp = false\n case @ip_hdr.proto\n when IP_PROTO_TCP\n @tcp = true\n tcp_hdr_len = packet.get_uchar(@ip_hdr_len + Constants::TCP_LEN_OFFSET + ETH_HDR_LEN).to_s(16)[0].hex * 4\n tcp_hdr_ptr = FFI::MemoryPointer.from_string(packet.get_array_of_uchar((ETH_HDR_LEN + @ip_hdr_len), tcp_hdr_len).pack('C*'))\n @l4_hdr = FFI::Packets::Tcp::Hdr.new(tcp_hdr_ptr)\n when IP_PROTO_UDP\n @udp = true\n udp_hdr_ptr = FFI::MemoryPointer.from_string(packet.get_array_of_uchar((ETH_HDR_LEN + @ip_hdr_len), UDP_HDR_LEN).pack('C*'))\n @l4_hdr = FFI::Packets::Tcp::Hdr.new(udp_hdr_ptr)\n end\n\n if @tcp or @udp\n class << self\n def sport\n @l4_hdr.sport\n end\n\n def dport\n @l4_hdr.dport\n end\n end\n end\n end", "title": "" }, { "docid": "79936dfa420d8a67d899cbea2d09c49b", "score": "0.5239424", "text": "def create_packet(cmdsig, data=\"\")\r\n flags = 0x00\r\n cmdset, cmd = cmdsig\r\n pktlen = data.length + 11\r\n buf = [pktlen, @my_id, flags, cmdset, cmd]\r\n pkt = buf.pack(\"NNCCC\")\r\n pkt << data\r\n @my_id += 2\r\n pkt\r\n end", "title": "" }, { "docid": "0153a8e5dd8acbce90abed7a31be907d", "score": "0.5222037", "text": "def initialize(image)\n create(image)\n end", "title": "" }, { "docid": "75ed104b89873382cc4fadab2aff064d", "score": "0.52019376", "text": "def packet id\n result = json \"api/packets\", :start => id, :limit => id\n rows = result['rows']\n raise ArgumentError, \"Unknown packet #{id}\" if rows.empty?\n return Packet.new(self, rows[0])\n end", "title": "" }, { "docid": "c869ad0d3afef3f41f588c5c12cb567e", "score": "0.5131964", "text": "def initialize(bytes)\n @ip = IpAddress.initialize(bytes)\n end", "title": "" }, { "docid": "901f9952e619c8d20e0f5d85c73364cc", "score": "0.51300216", "text": "def create(packet, *opts)\n do_view(packet, :create, *opts)\n end", "title": "" }, { "docid": "901f9952e619c8d20e0f5d85c73364cc", "score": "0.51300216", "text": "def create(packet, *opts)\n do_view(packet, :create, *opts)\n end", "title": "" }, { "docid": "6a6c62b9ed65e8ec229650103e7fafed", "score": "0.51234204", "text": "def packet\n @packet ||= nil\n end", "title": "" }, { "docid": "9832e4f86c6a0f0015e51ab132e66c33", "score": "0.5114522", "text": "def create_arp\n self.register(ARPPacket.new)\n end", "title": "" }, { "docid": "d23f9571a480e76ff5d8f5d6af0e8b90", "score": "0.50856805", "text": "def initialize(image, name, a, forb, tag)\n create(image, name, a, forb, tag)\n end", "title": "" }, { "docid": "3a4112afc76821dda61b00af90a1ae67", "score": "0.50851333", "text": "def image(ident)\n @images[ident]\n end", "title": "" }, { "docid": "7039515945435ce274210ff8d15c1c25", "score": "0.50777614", "text": "def initialize(ip, id = nil)\n fail SessionError 'IP is nil, not a valid value.' if ip.nil? ||\n ip.class != String\n ip = IPAddr.new(ip)\n fail SessionError 'IP is not in a valid format' if ip.nil?\n ip = ip.to_s\n @ip = ip\n if id.nil?\n entry = CoDTLS::RAMSession.connections.select { |c| c.ip == @ip }\n if entry.empty?\n create_standard_ip_object\n else\n @database_object = entry[0]\n end\n else\n entry = CoDTLS::RAMSession.connections.select { |c| c.id == id }\n create_standard_ip_object if entry.empty?\n @database_object.id = id\n end\n end", "title": "" }, { "docid": "0ef81888e570a1e5543501a0bbb22fc3", "score": "0.50736505", "text": "def to_pcap(args={})\n\t\t\tp = PcapPacket.new(:endian => args[:endian],\n\t\t\t\t\t\t\t\t\t\t\t\t:timestamp => Timestamp.new.to_s,\n\t\t\t\t\t\t\t\t\t\t\t\t:incl_len => self.to_s.size,\n\t\t\t\t\t\t\t\t\t\t\t\t:orig_len => self.to_s.size,\n\t\t\t\t\t\t\t\t\t\t\t\t:data => self)\n\t\tend", "title": "" }, { "docid": "c1be5e33182ab3363df50a1cad4b9112", "score": "0.50507486", "text": "def set_packet\n @packet = Packet.find(params[:packet])\n end", "title": "" }, { "docid": "cbd0759abb7f9fa797b07fbaf380b151", "score": "0.5046668", "text": "def inspect_in( packet ) nil end", "title": "" }, { "docid": "b9b1ed3ebd27c5bbb2c52d06130b6f5e", "score": "0.503735", "text": "def packet\n send_data @event.to_pcap,\n filename: \"event_#{@event.id}.pcap\",\n disposition: 'attachment',\n type: 'Application/vnd.tcpdump.pcap'\n end", "title": "" }, { "docid": "64181c30aeec1b2ff0494627642a9d5d", "score": "0.5035162", "text": "def initialize(packet)\n @db, @table, @org_table, @name, @org_name, @charsetnr, @length, @type, @flags, @decimals, @default =\n packet.db, packet.table, packet.org_table, packet.name, packet.org_name, packet.charsetnr, packet.length, packet.type, packet.flags, packet.decimals, packet.default\n @flags |= NUM_FLAG if is_num_type?\n end", "title": "" }, { "docid": "e49f97bbcdc1d97f0e9b1c0a1813f413", "score": "0.5016185", "text": "def initialize(name, instantiate=true)\n fail ArgumentError unless name.length > 0\n @encap_name = name\n create if instantiate\n end", "title": "" }, { "docid": "ed805643f9d55df488e863232ab97611", "score": "0.5011616", "text": "def initialize(if_name, dst_addr)\n @if_name = if_name\n @dst_addr = dst_addr\n end", "title": "" }, { "docid": "b810bac5d47a759ee2f3b463fcfb33ff", "score": "0.5010265", "text": "def initialize(window, type, identifier)\n @window = window\n\n @type = type\n raise InvalidCardType.new(type) unless TYPES.include?(type)\n\n @identifier = identifier\n raise InvalidCardIdentifier.new(identifier) if name.nil?\n\n @dimensions = Hash.new\n @destination = [identifier * 75, (TYPES.index(type) + 1) * 100]\n @shown = false\n @shown_image = Gosu::Image.new(\n @window, SVM::image(\"#{type}s_#{identifier + 1}.png\"), false\n )\n end", "title": "" }, { "docid": "480c5c09c2f19fd40a4f4c386c741c9d", "score": "0.5002046", "text": "def set_packet\n @packet = Packet.find(params[:packet][:packets_id])\n end", "title": "" }, { "docid": "e0139593d85df24f7f4deb97b45009ea", "score": "0.50011647", "text": "def to_pkt\r\n [ @msg_id, @reply ].pack(\"I_i_\")\r\n end", "title": "" }, { "docid": "0e856cfbbe9d978fd5da2c927cb16690", "score": "0.4998093", "text": "def initialize( img, offset, size, vma=nil, contents=nil )\n @image = img # Note : this allows @image to be nil\n @offset = offset\n @size = size\n @vma = vma || offset\n @contents_obj = contents\n @names = {}\n @references = []\n modelitem_init\n end", "title": "" }, { "docid": "3f7526e77229becbca216550fb95b2b0", "score": "0.49638316", "text": "def initialize( start_addr, img, offset=0, size=nil, flags=DEFAULT_FLAGS,\n arch_info=nil )\n size ||= img.size\n max_size = img.size - offset\n size = max_size if size > max_size\n\n super img, start_addr, offset, size, arch_info\n\n @flags = flags.dup\n\n modelitem_init\n end", "title": "" }, { "docid": "8bea28e8e36b04ebc64fb6b9f5de8044", "score": "0.49633205", "text": "def initialize (image, type)\n @image, @type = image, type\n end", "title": "" }, { "docid": "077dd8f2d599c23bcd776ee3aa390bcd", "score": "0.49630204", "text": "def constructImage(x,y,z,type)\n\t\tend", "title": "" }, { "docid": "6272c9029b8c720c54d34e19ee28e2bd", "score": "0.49601883", "text": "def initialize(client, user_id=-1)\n super('IMAGE_POOL','IMAGE',client)\n\n @user_id = user_id\n end", "title": "" }, { "docid": "4239226478e545458fca131ba0602456", "score": "0.49559543", "text": "def new(identifier); end", "title": "" }, { "docid": "4239226478e545458fca131ba0602456", "score": "0.49559543", "text": "def new(identifier); end", "title": "" }, { "docid": "251ca5de8e13e4bc4c5d39a9d47f913d", "score": "0.49343693", "text": "def store_obj_image(obj_id) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x0026 # Bytes to follow\n\n obj_type = 0x0008 # Object type (Picture).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x6011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')\n data = [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftCf (Clipboard format) subobject\n sub_record = 0x0007 # ftCf\n sub_length = 0x0002\n sub_data = [0xFFFF].pack( 'v')\n data += [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftPioGrbit (Picture option flags) subobject\n sub_record = 0x0008 # ftPioGrbit\n sub_length = 0x0002\n sub_data = [0x0001].pack('v')\n data += [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data += [sub_record, sub_length].pack('vv')\n\n # Pack the record.\n header = [record, length].pack('vv')\n\n append(header, data)\n\n end", "title": "" }, { "docid": "6e74f39847047f30e804758248d561ee", "score": "0.48968822", "text": "def initialize(pixels:, width:, height:)\n @pixels = pixels\n @width = width\n @height = height\n\n @pixels_per_layer = width * height\n @layers = []\n @num_layers = pixels.size / @pixels_per_layer\n\n generate_layers!\n generate_image!\n end", "title": "" }, { "docid": "3a3336acbd2a2b8fd3c74723458f09f2", "score": "0.48915476", "text": "def initialize(client, cid, type, flags, packet, **_)\n super(client, cid, type, flags, packet)\n\n initialize_abstraction\n end", "title": "" }, { "docid": "a41d2ca604f85510f808342a5ce298b4", "score": "0.48732135", "text": "def initialize(image)\n @image = image\n end", "title": "" }, { "docid": "d961017ee37d66d08069b0d4ce18031c", "score": "0.48659596", "text": "def initialize(netid, pass)\n @netid = netid\n @pass = pass\n end", "title": "" }, { "docid": "a8e4da3e79247d62246c421a326c3a55", "score": "0.4865707", "text": "def initialize(real, img)\n @real= real\n @img = img\n end", "title": "" }, { "docid": "9623c41d32844d669337288aaf42f792", "score": "0.48627228", "text": "def initialize \n @packet = []\n @hand = []\n \n end", "title": "" }, { "docid": "1078a091362f08c327920e44f8b4157f", "score": "0.4860278", "text": "def new(packet, opts = {})\n no_reroute = opts.delete(:no_reroute) \n xhr = packet.request.xhr? || packet.request.params[\"fake_xhr\"]\n if packet.request.post? || !opts.blank?\n params = opts.with_defaults(opts.delete(:params) || packet.request.params[@my_orange_name.to_s] || {})\n before = beforeNew(packet, params)\n obj = onNew(packet, params) if before\n afterNew(packet, obj, params) if before\n obj.save if obj && before\n end\n packet.reroute(@my_orange_name, :orange) unless (xhr || no_reroute)\n packet['template.disable'] = true if xhr\n (xhr ? obj.to_s : obj) || false\n end", "title": "" }, { "docid": "1ef880443c5becaa41c2d8a5e25ddf30", "score": "0.48460978", "text": "def initialize(image)\n super(image) # Image\n end", "title": "" }, { "docid": "1ef880443c5becaa41c2d8a5e25ddf30", "score": "0.48460978", "text": "def initialize(image)\n super(image) # Image\n end", "title": "" }, { "docid": "ed7f85b5cf236a49d165ad43bce1dfdd", "score": "0.48319867", "text": "def new(identifier = T.unsafe(nil)); end", "title": "" }, { "docid": "fbe726c69603cc05d1247059f330bfd4", "score": "0.48250335", "text": "def new\n @image = Image.new() \n end", "title": "" }, { "docid": "1fc82b510afccda04ec349ebd6c89517", "score": "0.48242912", "text": "def spawn_object(*args)\n puts \"Spawning entity: #{self} with id #{self.identity}\"\n\n # Broadcast spawn packet with networked fields\n Network.broadcast({\n type: \"spawn\",\n class: self.class.to_s,\n args: args << Network.connection_id << self.identity << -1\n })\n end", "title": "" }, { "docid": "da6cb60d8dc1522d8abc2bccee60ab66", "score": "0.48210377", "text": "def initialize(filename:)\n\t@filename = convert_to_png(filename) \n\t@img = Image.from_file(@filename)\n\t@delim = \"@$\"\n end", "title": "" }, { "docid": "2a82847ece12755615e54f6370d94104", "score": "0.48163894", "text": "def process_packet(packet)\n end", "title": "" }, { "docid": "f1aa0aaf8b806c0460c5211079d82135", "score": "0.48148167", "text": "def broadcast(packet)\n packet[\"identity\"] = @identity\n Network.broadcast(packet)\n end", "title": "" }, { "docid": "1abf5fa526fbe95c3f4c2f3c227b7e5e", "score": "0.48035172", "text": "def initialize(window, filename_or_rmagick_image, tileable, src_x, src_y, src_width, src_height); end", "title": "" }, { "docid": "e756cb51d4eb727679b46d92a8f170c5", "score": "0.47969937", "text": "def factory(element_xml)\n RenkeiVPE::Image.new(element_xml,@client)\n end", "title": "" }, { "docid": "df559f5a59ed56619fad686f775fe087", "score": "0.47912684", "text": "def initialize(user, image)\n @image = image\n @user = user\n end", "title": "" }, { "docid": "7f6d6676e6fbdfbc2d2be58be0254e3b", "score": "0.47896543", "text": "def initialize(owner)\n @record_data = [owner[0, 0x30]].pack('A112')\n end", "title": "" }, { "docid": "ba6254bd3b9cfdc99cc4d64d3a28d23d", "score": "0.4788695", "text": "def initialize(window,filename_or_rmagick_image,tileable,src_x=0,src_y=0,src_width=nil,src_height=nil)\n @window = window\n @tileable = tileable\n @src_x, @src_y = src_x, src_y\n @width, @height = src_width, src_height\n if filename_or_rmagick_image.respond_to?(:to_blob)\n setup_via_rmagic(filename_or_rmagick_image)\n elsif filename_or_rmagick_image.respond_to?(:to_str)\n setup_via_filename(filename_or_rmagick_image.to_str)\n else\n raise(ArgumentError,\"Second argument must be either a filename or an object which repsonds to :to_blob.\")\n end\n @drawing_events = []\n @window.image_added(self)\n end", "title": "" }, { "docid": "fe48ff528237dd010cdae690a450eee4", "score": "0.47820225", "text": "def initialize(ident)\n @identity = Node.ident(ident)\n @table = Sower::Relation::Table.new(self)\n end", "title": "" }, { "docid": "275e762c108617278583ec0505bcb1e3", "score": "0.47705635", "text": "def initialize(image_data)\n @image_data = image_data\n end", "title": "" }, { "docid": "639593243d67e7369c96c5245b4279dd", "score": "0.4767658", "text": "def initialize(real, img)\n @real = real\n @img = img\n end", "title": "" }, { "docid": "203aa9ec2cc5120358580f0ddc714400", "score": "0.47662422", "text": "def image(ident)\n obj = (@project || @working_data).image ident\n obj || images.select { |i| i.ident.start_with? ident }.first\n end", "title": "" }, { "docid": "c39f1e8e4a3bc4d00eba843efa85d608", "score": "0.47653505", "text": "def initialize( image_type, image_width, image_height, image_depth, image_array_size, image_row_pitch, image_slice_pitch, num_mip_levels, num_samples, buffer )\n super()\n self[:image_type] = image_type\n self[:image_width] = image_width\n self[:image_height] = image_height\n self[:image_depth] = image_depth\n self[:image_array_size] = image_array_size\n self[:image_row_pitch] = image_row_pitch\n self[:image_slice_pitch] = image_slice_pitch\n self[:num_mip_levels] = num_mip_levels\n self[:num_samples] = num_samples\n self[:buffer] = buffer\n end", "title": "" }, { "docid": "c39f1e8e4a3bc4d00eba843efa85d608", "score": "0.47653505", "text": "def initialize( image_type, image_width, image_height, image_depth, image_array_size, image_row_pitch, image_slice_pitch, num_mip_levels, num_samples, buffer )\n super()\n self[:image_type] = image_type\n self[:image_width] = image_width\n self[:image_height] = image_height\n self[:image_depth] = image_depth\n self[:image_array_size] = image_array_size\n self[:image_row_pitch] = image_row_pitch\n self[:image_slice_pitch] = image_slice_pitch\n self[:num_mip_levels] = num_mip_levels\n self[:num_samples] = num_samples\n self[:buffer] = buffer\n end", "title": "" }, { "docid": "43b563cf905675b002b6e1b7b655fc93", "score": "0.47616827", "text": "def []=(character, image); end", "title": "" }, { "docid": "192652c9af13c15d549c2c029d55f8be", "score": "0.47567979", "text": "def create image_id:nil,count:1\n RunLogger.level(1).detail \"assign node\"\n instances = Instance.create(image_id: image_id||'trustysrvx64c',\n count:count,\n login_mode:'keypair',\n keypair_id: @keypair_id\n )\n\n eips = Eip.create(count:count)\n \n (0...count).map do |i|\n RunLogger.level(1).detail \"bind ip: #{eips[i].address}\"\n eips[i] = eips[i].associate instances[i].id\n [ instances[i], eips[i] ]\n end.tap do |list|\n list.each{|instance,eip| ping eip.address,30}\n end\n end", "title": "" }, { "docid": "ae4087bcf4ccc007594a896a0691a888", "score": "0.47555196", "text": "def initialize(id, name, addr)\n\t\t@obj_id = id\n\t\t@obj_name = name\n\t\t@obj_addr = addr\n\t\t@@classVariable += 1\n\tend", "title": "" }, { "docid": "536c4b9d2bebfcb45e95e6709bd5803b", "score": "0.4755409", "text": "def initialize(window, filename_or_rmagick_image, tileable, src_x=0, src_y=0, src_width=nil, src_height=nil)\n @window = window\n @tileable = tileable\n @src_x, @src_y = src_x, src_y\n @width, @height = src_width, src_height\n if filename_or_rmagick_image.respond_to?(:to_blob)\n setup_via_rmagic(filename_or_rmagick_image)\n elsif filename_or_rmagick_image.respond_to?(:to_str)\n setup_via_filename(filename_or_rmagick_image.to_str)\n else\n raise(ArgumentError, 'Second argument must be either a filename or an object which responds to :to_blob.')\n end\n @drawing_events = []\n @window.image_added(self)\n end", "title": "" }, { "docid": "aba7f6f0c3e48175ddeb0d4159e22a77", "score": "0.47520912", "text": "def image(how, what) \n return Image.new(self, how, what)\n end", "title": "" }, { "docid": "59862e61b95ffe69b41051a705dbb34c", "score": "0.47514433", "text": "def create_image(credentials, opts={})\n safely do\n client = new_client(credentials)\n\n if opts[:name].nil?\n # default to instance name\n instance = client.get_vserver_attributes(opts[:id])\n opts[:name] = instance['vserver'][0]['vserverName']\n opts[:description] ||= opts[:name]\n end\n\n client.register_private_disk_image(opts[:id], opts[:name], opts[:description])\n hwps = hardware_profiles(credentials)\n\n #can't retrieve image info until it's completed\n Image.new(\n :id => \"PENDING-#{opts[:name]}\", #TODO: add check to create_instance to raise error for this image ID?\n :name => opts[:name],\n :description => opts[:description],\n :state => 'PENDING',\n :hardware_profiles => hwps\n )\n end\n end", "title": "" }, { "docid": "d08ecc5149d5cf5f72b4a3a3417c5bab", "score": "0.4745308", "text": "def initialize(actor)\n super(272, 64, 368, 192)\n self.contents = Bitmap.new(width - 32, actor.equip_kind.size * 32)\n @actor = actor\n refresh\n self.index = 0\n end", "title": "" }, { "docid": "561f59970392734b6faa7f0b94a31a37", "score": "0.47405913", "text": "def initialize(identity)\n self.id = identity\n end", "title": "" }, { "docid": "375cd8d99deb54336bb31f163ab40ec9", "score": "0.47397274", "text": "def initialize(objectinfo, offset, packed_size, packfile)\n @objectinfo=objectinfo\n @offset=offset\n @packed_size=packed_size\n @packfile=packfile\n end", "title": "" }, { "docid": "077e3ca14ddee42118e60432b4e933be", "score": "0.4739041", "text": "def initialize(connection, hash={})\n unless connection.is_a?(Docker::Connection)\n raise ArgumentError, \"Expected a Docker::Connection, got: #{connection}.\"\n end\n normalize_hash(hash)\n @connection, @info, @id = connection, hash, hash['id']\n raise ArgumentError, \"Must have id, got: #{hash}\" unless @id\n end", "title": "" }, { "docid": "4c5d0d3115836923b8595e77ad174b65", "score": "0.4736457", "text": "def initialize(attributes)\n super(attributes)\n self.id = attributes[:id]\n self.source = attributes[:source]\n self.target = attributes[:target]\n self.data = attributes[:data]\n end", "title": "" }, { "docid": "926e2b49ff3e693324fb6b32a5eafbc5", "score": "0.473002", "text": "def new\n # calls a Pictures.new method from the Object Pictures class\n @picture = Picture.new\n end", "title": "" }, { "docid": "73c87f43b83cbb8b82fc3307819371ad", "score": "0.47211298", "text": "def initialize(name:, image:, grid: nil, tile_grid: nil, scale_x: nil, scale_y: nil, center_x: nil, center_y: nil)\n super name: name, scale_x: scale_x, scale_y: scale_y, center_x: center_x, center_y: center_y\n @image = image\n @tile_grid = grid || tile_grid || open_struct # x y w h count stride\n @tile_grid.x ||= 0\n @tile_grid.y ||= 0\n @tile_grid.w ||= @image.width.to_i\n @tile_grid.h ||= @image.height.to_i\n @tile_grid.count ||= 1\n @tile_grid.stride ||= @tile_grid.count\n @subs = []\n end", "title": "" }, { "docid": "d45ba44989d221cd72ebeb503d997201", "score": "0.4709253", "text": "def startsniff(session,intid)\n\tbegin\n\t\t#Load Sniffer module\n\t\tsession.core.use(\"sniffer\")\n\t\tprint_status(\"Starting Packet capture on interface #{intid}\")\n\t\t#starting packet capture with a buffer size of 200,000 packets\n\t\tsession.sniffer.capture_start(intid, 200000)\n\t\tprint_status(\"Packet capture started\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error Starting Packet Capture: #{e.class} #{e}\")\n\tend\nend", "title": "" }, { "docid": "22cfeccbcf0cffb7fca99056b12b078e", "score": "0.47086918", "text": "def create(image, name, a, forb, tag)\n super(image) # Image\n @name = name # String\n @a = a # Alliance\n @forb = forb # Category\n @tag = tag # Integer\n end", "title": "" }, { "docid": "85b08ef9a17b412c1243317124f2fd2c", "score": "0.4708254", "text": "def create(image)\n @image = image # Image\n end", "title": "" }, { "docid": "3018296b2dad1471b07ff21ffcca7885", "score": "0.46992645", "text": "def initialize(args={})\n\t\t\t@array = [] # Where the packet array goes.\n\t\t\t@stream = [] # Where the stream goes.\n\t\t\t@iface = args[:iface] || Pcap.lookupdev \n\t\t\t@snaplen = args[:snaplen] || 0xffff\n\t\t\t@promisc = args[:promisc] || false # Sensible for some Intel wifi cards\n\t\t\t@timeout = args[:timeout] || 1\n\n\t\t\tsetup_params(args)\n\t\tend", "title": "" }, { "docid": "9d95be26f6c5e29d4ded35c02220d507", "score": "0.4695793", "text": "def initialize(addr=0,cmd=0,data_4byte=\"\\x00\\x00\\x00\\x00\",mode=:send)\n begin\n raise \"addr type Error\" if addr.is_a? String\n @mode=mode\n @addr=addr\n @cmd=cmd\n @data=data_4byte\n\n rescue \n @mode,@addr,@cmd,@data=self.unpack(addr)\n \n end\n \n \n end", "title": "" }, { "docid": "fcd912b409e4ff7b7d46356760a3af43", "score": "0.46887448", "text": "def initialize(packet, options, brokers)\n @name = (packet.respond_to?(:name) ? packet.name : packet.class.name.snake_case)\n @type = (packet.type if packet.respond_to?(:type) && packet.type != packet.class)\n @from = (packet.from if packet.respond_to?(:from))\n @token = (packet.token if packet.respond_to?(:token))\n @one_way = (packet.respond_to?(:one_way) ? packet.one_way : true)\n @options = options\n @brokers = brokers\n @failed = []\n end", "title": "" }, { "docid": "2cd24f823a21eca9f53109f8cf1b010b", "score": "0.46855694", "text": "def create_ad(packet)\n client = LedigtarbeteClient.new\n client.create_ad(packet)\n end", "title": "" }, { "docid": "547c7ee87cf8743a6dfce574951e0f3e", "score": "0.4680344", "text": "def get_in_packet(packet_id)\n debug \">> #{__method__}\"\n path = INPACKET_PATH % packet_id\n resp = get_object_to_network(@nwc_id, path)\n unless resp.status_code == Response::OK\n return nil\n end\n begin\n return Packet.from_object_hash(resp.body)\n rescue => ex\n error 'Exception: Get Invalid Message'\n error \" #{ex.message} #{ex.backtrace}\"\n return nil\n end\n end", "title": "" }, { "docid": "9a586ba06dae51a2bf168631c0f01660", "score": "0.46802378", "text": "def post_in_packet(in_packet)\n debug \">> #{__method__}\"\n path = INPACKETS_PATH\n post_object_to_network(@nwc_id, path, in_packet)\n end", "title": "" }, { "docid": "2d969755f9107a39519495fb80d94dff", "score": "0.467541", "text": "def initialize(iID, sIP = nil)\n\n\t\t@sEthernetPathFile = SssSEMapp.get(:pathFileOnlineEthernetBase, '/gitSwissalpS/SRParSBinoRuby/onlineIDs/eth/') + iID.to_s\n\t\t@sSerialPathFile = SssSEMapp.get(:pathFileOnlineEthernetBase, '/gitSwissalpS/SRParSBinoRuby/onlineIDs/com/') + iID.to_s\n\n\t\tif (sIP.nil?)\n\t\t\t# no IP, must be serial message\n\t\t\tself.goOnlineSerial()\n\t\telse\n\t\t\t# got IP, must be UDP message\n\t\t\tself.goOnlineEthernet(sIP)\n\t\tend # if serial or Ethernet message\n\n\tend", "title": "" }, { "docid": "081b11fc5028d40ae893b550a42d9ba7", "score": "0.4674961", "text": "def build_snippet_packet\n @__packet__ = SnippetPacket.new(format, rate, channels)\n instance_eval(&body_proc)\n @__packet__\n end", "title": "" }, { "docid": "20ee944e0aefecce795d13e610632530", "score": "0.46737415", "text": "def add_image\n @image = Image.new\n @ppi = @screen_config[:ppi]\n end", "title": "" }, { "docid": "428de322a20c5679a791bdb69ec4fb87", "score": "0.46709785", "text": "def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_object Host, { :ip_address => ip_address }\nend", "title": "" }, { "docid": "967009101dc6843f44e94bf73419aa71", "score": "0.4669707", "text": "def create_nic(options)\n Nic.create(options.merge(:server_id => self.id))\n end", "title": "" }, { "docid": "8eeeaa334835b680d7563e49079df653", "score": "0.46689057", "text": "def get_image(oid)\n raise \"Not implemented\"\n end", "title": "" } ]
7674d51b73c0af1c573f8717812014f1
Add this route between these two cities/metros
[ { "docid": "c9a5ff2d703e9a283b7cd5237879200c", "score": "0.78935903", "text": "def addRoute(city1, city2, distance)\n @routes[city1].push(EndpointCity.new(city2, distance))\n @routes[city2].push(EndpointCity.new(city1, distance))\n end", "title": "" } ]
[ { "docid": "6b6f86941f7170bc0efe70bc28e3319f", "score": "0.7499767", "text": "def add_route(metro1, metro2, distance)\n if exist_nodes([metro1, metro2])\n self.add_edge(metro1, metro2, distance)\n @nodes[metro1]['flight_to'].push(metro2)\n end\n end", "title": "" }, { "docid": "915963ca64a94dd17d726d5a9e560ef5", "score": "0.74050444", "text": "def addRoute(city1, city2, des)\n code1 = getCode(city1).code\n code2 = getCode(city2).code\n if(code1 == nil || code2 == nil)\n return false\n end\n key = setDistanceMapKey(code1, code2)\n if(@distanceMap[key] != nil)\n return false\n end\n @distanceMap[key] = des\n @map[code1].destinations[code2] = des\n return true\n end", "title": "" }, { "docid": "4b18e4948ac77201aaa31d50ec350fda", "score": "0.68355393", "text": "def addRoute(csa)\n @parse.map{ |airport| \n if( airport[\"name\"] == csa)#Found the city add the route\n destination = AddInfo.new.RouteMenu()\n airport[\"destinations\"].push(destination)\n end\n }\n end", "title": "" }, { "docid": "097d01a7da8896ccdf8ec610332b6bd2", "score": "0.6770002", "text": "def add_route(ports)\n # check if metros exist\n if @metros.has_key?(ports[0]) && @metros.has_key?(ports[1])\n code_start = @metros[ports[0]]\n code_end = @metros[ports[1]]\n\n metro_name_start = @vertices[code_start].metro.name\n metro_name_end = @vertices[code_end].metro.name\n\n distance = prompt_distance\n\n # create new edge from first metro to the second\n add_route_with_distance(code_start, code_end, distance)\n puts \"Added route from #{metro_name_start} to #{metro_name_end}\\n\"\n else\n puts 'Invalid Input'\n end\n end", "title": "" }, { "docid": "597dabc3bb17b79a5947466caa11808d", "score": "0.66148305", "text": "def addCityConnection(data, map, distanceMap)\n data[\"routes\"].each do |route|\n codes = route[\"ports\"]\n \n dist = route[\"distance\"]\n status = route[\"routeStatus\"]\n if(codes.size != 2)\n raise \"invalid ports size\"\n end\n codePair1 = setDistanceMapKey(codes[0], codes[1])\n codePair2 = setDistanceMapKey(codes[1], codes[0])\n if(status == nil || status == 2)\n node2 = map[codes[1]]\n node2.addDest(codes[0], dist)\n distanceMap[codePair2] = dist\n end\n node1 = map[codes[0]]\n node1.addDest(codes[1], dist) \n distanceMap[codePair1] = dist\n \n end\n return\n end", "title": "" }, { "docid": "b513027a9451c4d0f497435433843097", "score": "0.62980574", "text": "def add_route(point, distance)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, point)\n rel[:distance] = distance.to_f\n end\n\n self\n end", "title": "" }, { "docid": "fa3581f2f0ab44858f7faeb4e3772ec8", "score": "0.6276751", "text": "def addRoute(srcCode, destCode, distance)\n if @edges.has_key? [srcCode, destCode] or @edges.has_key? [destCode, srcCode]\n puts('Route already exists')\n return\n end\n if not @vertices.has_key? srcCode or not @vertices.has_key? destCode\n puts('Add route failed because city does not exist')\n return\n end\n if distance <= 0\n puts('Distance cannot be negative')\n return\n end\n @edges[[srcCode, destCode]] = Route.new([srcCode, destCode], distance)\n @edges[[destCode, srcCode]] = Route.new([destCode, srcCode], distance)\n @neighbours[srcCode].add(destCode)\n @neighbours[destCode].add(srcCode)\n end", "title": "" }, { "docid": "8183b310700827c4ba229190ba918e14", "score": "0.62678456", "text": "def join(other)\n raise 'cannot join routes from different maps' if map != other.map\n\n if points.first.adjacent_to?(other.points.first)\n combined = other.points.reverse + points\n elsif points.last.adjacent_to?(other.points.last)\n combined = points + other.points.reverse\n elsif points.first.adjacent_to?(other.points.last)\n combined = other.points + points\n elsif points.last.adjacent_to?(other.points.first)\n combined = points + other.points\n end\n\n Route.new(map, combined)\n end", "title": "" }, { "docid": "4c34aa948c47eee2b8a3166af24da2f4", "score": "0.6236697", "text": "def connect_nevada_with_other(cities)\n cities[0].connect cities[1]\n end", "title": "" }, { "docid": "04ee1396622b2af9a3fd26ddf529c417", "score": "0.621148", "text": "def test_add_route\n santiago = @south_america.vertices[@south_america.metros['santiago']]\n bogota = @south_america.vertices[@south_america.metros['bogota']]\n\n assert_equal(0, santiago.find_route('BOG'.to_sym).length)\n\n @south_america.add_route_with_distance('SCL'.to_sym, 'BOG'.to_sym, 5000)\n assert_equal(1, santiago.find_route('BOG'.to_sym).length)\n assert_equal(0, bogota.find_route('SCL'.to_sym).length)\n end", "title": "" }, { "docid": "43b299fa80303b15df9c76352f4871b4", "score": "0.619321", "text": "def two_opt_transform(point1, point2)\n new_tour = Tour.new(@route.length)\n clone_region_forward(new_tour, 0, point1 - 1)\n clone_region_reverse(new_tour, point1, point2)\n clone_region_forward(new_tour, point2 + 1, new_tour.length - 1)\n new_tour\n end", "title": "" }, { "docid": "47e545ccd42288313d24b28113b8912c", "score": "0.6188634", "text": "def connect_sutter_with_other(cities)\n cities[2].connect cities[1]\n cities[2].connect cities[4]\n end", "title": "" }, { "docid": "cb12ebc8e7de6eaabcf9796fedf46c5f", "score": "0.617779", "text": "def air_route_between_nodes(node1, node2, path, step, distance)\n\t\tif node1 == node2\n\t\t\tif @@final[step].nil? \n\t\t\t\t@@final[step] = {\"#{distance}\" => []}\n\t\t\telsif @@final[step][\"#{distance}\"].nil?\n\t\t\t\t@@final[step][\"#{distance}\"] = []\n\t\t\tend\n\t\t\t@@final[step][\"#{distance}\"] << path.dup \n\t\t\treturn \n\t\telsif @@connected[node1].nil? || step >= STEP\n\t\t\treturn\n\t\tend\n\t\t@@connected[node1].each do |node|\n\t\t\ts = step + 1\n\t\t\tp = (path << node)\n\t\t\tcc = @@distance[\"#{node1}/#{node}\"].to_i + distance\n\t\t\tair_route_between_nodes(node, node2, p, s, cc)\n\t\t\tpath.pop\n\t\tend\n\t\treturn\n\tend", "title": "" }, { "docid": "3d3a27b785a114118d1ed43d2ed87ff2", "score": "0.61673325", "text": "def connect(other, weight)\n raise ArgumentError.new('Invalid city.') unless other && other.kind_of?(City) && !eql?(other)\n raise ArgumentError.new('Non numeric weight.') unless weight.kind_of?(Numeric)\n \n city_roads[other] = Road.new(self, other, weight)\n other.city_roads[self] = city_roads[other]\n end", "title": "" }, { "docid": "47ebf7bae44c8686050387e52ff07aef", "score": "0.6151152", "text": "def connect_coloma_with_other(cities)\n cities[4].connect cities[3]\n cities[4].connect cities[2]\n end", "title": "" }, { "docid": "5445a2fcc9616961c5a388cde366f2d9", "score": "0.6116785", "text": "def add_route(route)\n @route = route\n @route.start_station.add_train(self) unless @route.start_station.trains.include?(self)\n end", "title": "" }, { "docid": "b4bc09902b1d2b191d4f40fafe87f07f", "score": "0.6023116", "text": "def routes_and_arrivals\n\t\tarrivals = arrivals_and_departures\n\t\tdata.routes.map do |r|\n\t\t\tr['arrivals'] = arrivals.find_all { |arr| arr.routeId == r['id'] }\n\t\t\tRoute.new(r['id'], r)\n\t\tend\n\tend", "title": "" }, { "docid": "57a68e0c1d93ea9d2b3828542d763d0a", "score": "0.60091895", "text": "def connect_angels_with_other(cities)\n cities[1].connect cities[0]\n cities[1].connect cities[2]\n cities[1].connect cities[3]\n end", "title": "" }, { "docid": "2ef51ba2c12901eafd11a2069d98afef", "score": "0.60064375", "text": "def add_and_new_journey\n add_journey\n new_journey\n end", "title": "" }, { "docid": "8e9e1e431c0bfa8a62e3e7cbc0a73766", "score": "0.59827685", "text": "def connect_midas_with_other(cities)\n cities[5].connect cities[3]\n cities[5].connect cities[6]\n end", "title": "" }, { "docid": "dcdf31eccaa615a4e12022859204ea05", "score": "0.5965377", "text": "def removeRoute(city1, city2)\n code1 = getCode(city1).code\n code2 = getCode(city2).code\n if(code1 != nil && code2 != nil)\n key = setDistanceMapKey(code1, code2)\n if(@distanceMap.delete(key) == nil)\n return false\n end\n @map[code1].destinations.delete(code2)\n return true\n end\n return false\n end", "title": "" }, { "docid": "bc6dc42a274b333fa8104c42b6b1d76c", "score": "0.5952156", "text": "def connect_virginia_with_other(cities)\n cities[3].connect cities[1]\n cities[3].connect cities[4]\n cities[3].connect cities[5]\n cities[3].connect cities[6]\n end", "title": "" }, { "docid": "b76d9c2e16f72557ed9d5968449e9620", "score": "0.5943223", "text": "def getRouteInfo(route)\n cities = route.split(\",\")\n dist = 0\n cost = 0\n unitPrice = 0.35\n distance = 0\n #V1^2-V0^2 = 2as\n acceleration = (700.0**2)/(2*200.0)\n time = 0\n if(cities.length < 1)\n return {\"dist\"=>dist, \"cost\"=>cost, \"time\"=>time}\n end\n prev = nil\n isFirst = true\n for curCity in cities\n node = getCode(curCity)\n #check if node exist\n if(node == nil)\n return nil\n end \n if(!isFirst) \n codes = setDistanceMapKey(prev, node.code)\n if (@distanceMap.has_key?(codes))\n #dist\n curDist = @distanceMap[codes]\n dist = dist + curDist\n #cost\n cost = cost + unitPrice*curDist\n temp = unitPrice-0.05\n unitPrice = (temp>0)?temp:0\n #time\n if(dist < 400)\n #s = 0.5*a*t^2\n t= Math.sqrt(dist*2/acceleration)\n time = time + t\n else\n time = time + Math.sqrt((400*2)/acceleration) + (dist-400)/750\n end\n outBounds = @map[prev].destinations.length\n temp = 2 - (1.0/6)*(outBounds-1)\n layover = (temp>0)?temp:0\n time = time+layover\n else\n return nil\n end\n prev = node.code\n else\n prev = node.code\n isFirst = false\n end \n end\n return {\"dist\"=>dist, \"cost\"=>cost.round(2), \"time\"=>time.round(2)}\n end", "title": "" }, { "docid": "76022976d9725c927e7af812414c5a29", "score": "0.59372693", "text": "def get_route(start_city, end_city)\n graph = Graph.new\n City.all.each {|node| graph.push node.id }\n\n\n #TODO: change to connect once seeds are corrected\n Route.all.order(from_id: :asc).each do |route|\n graph.connect_mutually route.from_id, route.to_id, route.duration.to_i\n end\n\n start_point = City.get_id_from_name(start_city).to_i # starting node\n end_point = City.get_id_from_name(end_city).to_i # arrival node\n\n results = graph.dijkstra(start_point, end_point)\n\n if results == nil\n\n return RouteResult.new valid: false,\n results: [name: \"No route found\"],\n distance: 0\n\n end\n\n distance = results[:distance] #graph.length_between(start_point, end_point)\n\n names = []\n routes = []\n\n last = nil\n results[:path].each do |res|\n\n city = City.find_by(id: res)\n names.push city\n if last \n found = Route.find_by(from: last, to: city)\n routes.push found\n end\n\n last = city\n end\n\n return RouteResult.new valid: true,\n results: names,\n distance: distance,\n routes: routes\n\n end", "title": "" }, { "docid": "fb9fb3fd35dae43579454fd11ee1a843", "score": "0.5883456", "text": "def add_route_with_distance(code_start, code_end, distance)\n route = Edge.new(@vertices[code_end], distance)\n @vertices[code_start].add_destination(route)\n end", "title": "" }, { "docid": "be548cba214e2b75f6516c0028a5ff76", "score": "0.58684653", "text": "def new\n @route = @trip.routes.new\n @route.trip_id = @trip.id\n @route.distance = calc_distance(route.start_place.name, route.end_place.name)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "title": "" }, { "docid": "10eeebd983edcb05a4f83e129154247b", "score": "0.5852811", "text": "def connect_eldorado_with_other(cities)\n cities[6].connect cities[5]\n cities[6].connect cities[3]\n end", "title": "" }, { "docid": "30e5275a4dd677617338ff08f9a5ba0a", "score": "0.5836018", "text": "def route_distance(route)\n return super unless gc_train?(route) && !other_gc_train?(route)\n\n n_cities = route.stops.select { |s| s.visit_cost.positive? }.count { |n| n.city? || n.offboard? }\n n_towns = route.stops.count(&:town?)\n \"#{n_cities}+#{n_towns}\"\n end", "title": "" }, { "docid": "a078a8377a6c7051074fa0dd2ccc9e7b", "score": "0.5832237", "text": "def build_route\n start_point = address\n end_point = address\n waypoints = []\n orders.each do |order|\n # Go to the company first.\n waypoints << order.company.address\n # Go to the client after\n waypoints << order.address\n end\n direction_hash = {\n \"direction\" => {\n \"data\" => { \"from\" => start_point, \"to\" => end_point}\n }\n }\n if waypoints.length > 0\n direction_hash[\"direction\"][\"options\"] = {\"waypoints\" => waypoints, \"display_panel\" => true, \"panel_id\" => \"instructions\"}\n end\n direction_hash\n end", "title": "" }, { "docid": "da2eec86d7bffb86a95a949013b65ef0", "score": "0.58205396", "text": "def create_route(attributes)\n \n unless attributes[:source_data_set_id]\n attributes[:source_data_set_id] = attributes[:source_data_set] && attributes[:source_data_set].id || nil\n end\n \n attributes[:category] ||= attributes[:category_id] \n attributes[:category] = attributes[:category].id if attributes[:category].kind_of? PublicEarth::Db::Category\n\n place = new(one.create_route(\n nil, \n attributes[:name], \n attributes[:route_vertexes] || nil,\n attributes[:original_id], \n attributes[:original_uri], \n attributes[:priority],\n attributes[:category],\n attributes[:source_data_set_id],\n attributes[:is_visible] || true\n ))\n \n place.created = 'route'\n \n # Create the name attribute...\n place.details.from attributes[:source_data_set_id]\n place.details.name = attributes[:name]\n place.details.save\n \n place\n end", "title": "" }, { "docid": "35cffbc7246624a4c0ec6ca2cf737e39", "score": "0.57872695", "text": "def introduceRoutes()\n\n code1 = check(3, \"Code1\")\n code2 = check(3, \"Code2\")\n \n distance = getBasic(\"Distance\").to_i\n \n destination = {\"ports\" => [code1, code2], \"distance\" => distance}\n return destination\n \n end", "title": "" }, { "docid": "222b8d13a0e8530e920f56aa88dc7484", "score": "0.5786511", "text": "def test_addCityConnection\n graph = AirGraph.new()\n sclSym = \"SCL\"\n limSym = \"LIM\"\n graph.map = {sclSym => CityNode.new(\"SCL\", \"name\", \"country\", \"continent\", \"timezone\", {\"N\"=>\"32\", \"S\" =>\"25\"}, \"population\", \"region\"), limSym =>CityNode.new(\"LIM\", \"name\", \"country\", \"continent\", \"timezone\", {\"N\"=>\"32\", \"S\" =>\"25\"}, \"population\", \"region\")}\n data = {\"routes\" => [{\"ports\"=>[\"SCL\", \"LIM\"], \"distance\"=>2453}]}\n graph.addCityConnection(data, graph.map, graph.distanceMap)\n assert_equal(graph.map[sclSym].destinations.length, 1)\n assert_equal(graph.map[sclSym].destinations.keys[0], limSym)\n assert_equal(graph.map[sclSym].destinations[limSym], 2453)\n assert_equal(graph.distanceMap[\"SCL LIM\"], 2453)\n assert_equal(graph.distanceMap[\"LIM SCL\"], 2453)\n end", "title": "" }, { "docid": "a58ffaef1c87a073790371b500f4130f", "score": "0.5777393", "text": "def prepare_graph\n self_routes = City.pluck(:id).map { |id| [id, id, 0] }\n db_routes = Route.pluck(\n :source_city_id,\n :destination_city_id,\n :distance\n )\n Graph.new.fill_from_array(db_routes + self_routes)\n end", "title": "" }, { "docid": "488b52bbc7085245b541c56eff341213", "score": "0.57760876", "text": "def initialize_routes(routes)\n routes.each do |route|\n self.add_route(route['ports'][0], route['ports'][1], route['distance'])\n self.add_route(route['ports'][1], route['ports'][0], route['distance'])\n end\n end", "title": "" }, { "docid": "27d16b6e639aa8cea33965d5e976aac7", "score": "0.57599646", "text": "def add_station_to_route\n route, station = choose_route_and_station\n route.add_station(station)\n press_enter_to_continue\n end", "title": "" }, { "docid": "ecc4535d5e9847caf3afd88454f94475", "score": "0.57570815", "text": "def add_road(u, v)\n @downtown.add_edge(u, v)\n @num_road = @num_road + 1\n\tend", "title": "" }, { "docid": "6ad3aea21f708b07d771aa8d255b6cf1", "score": "0.5735369", "text": "def route_distance(route)\n return super unless gc_train?(route) && !other_gc_train?(route)\n\n n_cities = route.stops.select { |s| s.visit_cost.positive? }.count { |n| n.city? || n.offboard? }\n n_towns = route.stops.count(&:town?)\n \"#{n_cities}+#{n_towns}\"\n end", "title": "" }, { "docid": "dffae5f2a5322699cc93a8709429a80f", "score": "0.5733304", "text": "def place_roads\n road_builder = RoadBuilder.new(self)\n road_builder.build_roads\n end", "title": "" }, { "docid": "7cfe0db449adaccb142a2d0a49cee0aa", "score": "0.5727833", "text": "def add_station_to_route\n return unless check_route && check_station\n\n new_station_to_route = @stations[@station_index]\n update_routes = @routes[@route_index]\n if update_routes.stations.map(&:name).include? new_station_to_route.name\n @interface.puts_station_to_route(false, new_station_to_route)\n else\n update_routes.stations.insert(-2, new_station_to_route)\n @interface.puts_station_to_route(true, new_station_to_route)\n end\n end", "title": "" }, { "docid": "900478905bd4b3abccb5c8436f0a9de5", "score": "0.5725384", "text": "def find_or_create_city(origin,destination,distance)\n find_city(origin).add_destination(Destination.new(find_city(destination),distance))\n end", "title": "" }, { "docid": "11bfddcb8330c3d568f8767bdac0acd1", "score": "0.5671218", "text": "def processRouteData(routesJSON)\n routesJSON.each { |route|\n ports = route['ports']\n start_code = ports[0]\n end_code = ports[1]\n\n start_city = @@code_to_city[start_code]\n end_city = @@code_to_city[end_code]\n\n # Because of symmetry\n @routes[start_city].push(EndpointCity.new(end_city, route['distance']))\n @routes[end_city].push(EndpointCity.new(start_city, route['distance']))\n }\n end", "title": "" }, { "docid": "f3269a4003eae072cbe9a0b2ededd31a", "score": "0.5613333", "text": "def connect(path, options = {})\n @set.add_route(path, options)\n end", "title": "" }, { "docid": "f3269a4003eae072cbe9a0b2ededd31a", "score": "0.5613333", "text": "def connect(path, options = {})\n @set.add_route(path, options)\n end", "title": "" }, { "docid": "f3269a4003eae072cbe9a0b2ededd31a", "score": "0.5613333", "text": "def connect(path, options = {})\n @set.add_route(path, options)\n end", "title": "" }, { "docid": "16ecc987f90a86cfa5227bdfb02e1078", "score": "0.5554785", "text": "def add_route_to_train\n return unless check_train && check_route\n\n @get_route = @routes[@route_index]\n @get_train = @trains[@train_index]\n @get_train.set_route(@get_route)\n @interface.puts_route_to_train(@get_train, @route_index, @get_route)\n end", "title": "" }, { "docid": "c7fd7cc32190f6a1a40ad5f93cf57249", "score": "0.5524839", "text": "def clone_region_forward(new_tour, start_index, stop_index)\n new_tour[(start_index..stop_index)] = @route[(start_index..stop_index)]\n end", "title": "" }, { "docid": "d4e21e72ebee8df714b240f704ff67e7", "score": "0.55171436", "text": "def parse_and_add_routes\n\n routes_list = @json_dict['routes']\n\n routes_list.each do |route|\n source = route['ports'][0]\n destination = route['ports'][1]\n @json_graph_api.add_edge(source,destination,route)\n end\n\n end", "title": "" }, { "docid": "db0770e9d769f0d695f77a0ddd4e6a73", "score": "0.5511002", "text": "def add_path(station_id1, station_id2, minutes)\n\t\taction = [\"MOVE\", station_id1, station_id2, minutes]\n\t\t@path.push(action)\n\tend", "title": "" }, { "docid": "a292446e4842e2ec4a0ae94b13368a4e", "score": "0.55003333", "text": "def ajax_join_locations\n @trip = Trip.find_by_id(session[:trip])\n start_location = @trip.locations.find_by_id(params[:start])\n end_location = @trip.locations.find_by_id(params[:end])\n \n if params[:next_travel_method].blank?\n start_location.update_attributes(:next_location => nil, :next_travel_method => nil)\n render :update do |page|\n @map = Variable.new(\"map\")\n page << \"trip_polylines.removePolyline(#{start_location.id})\" \n end\n else \n start_location.update_attributes(:next_location => end_location, :next_travel_method => params[:next_travel_method])\n travel_method = Location::TRAVEL_TYPES[params[:next_travel_method]]\n render :update do |page|\n @map = Variable.new(\"map\") \n page << \"trip_polylines.removePolyline(#{start_location.id})\" # remove any existing polylines originating from this start location\n page << \"trip_polylines.addPolyline(#{GPolyline.new([start_location.coords, end_location.coords], travel_method[:color], travel_method[:weight], travel_method[:opacity]).create}, #{start_location.id})\"\n end \n end\n end", "title": "" }, { "docid": "395202c03daecaa2910a0e2ee0621868", "score": "0.5496436", "text": "def route(start_point, end_point, transit_points = nil, route_type = 'car', lang = 'en', route_type_modifier = nil)\n transit_points = \",[#{transit_points.map {|point| point.to_latlon}.join(',')}]\" if not transit_points == nil\n route_type_modifier = \"/#{route_type_modifier}\" if not route_type_modifier == nil\n url = \"/#{start_point.to_latlon}#{transit_points},#{end_point.to_latlon}/#{route_type}#{route_type_modifier}.js?lang=#{lang}&units=km\"\n return Route.new(JSON.parse(connect url))\n end", "title": "" }, { "docid": "058148c97533491ff11315fe7a0e8f5b", "score": "0.5474509", "text": "def test_addRoute\n graph = AirGraph.new()\n data = {\"metros\" => [{\"code\"=> \"A\", \"name\"=>\"A\", \"population\"=>1}, {\"code\"=> \"B\", \"name\"=>\"B\", \"population\"=>2}, {\"code\"=> \"C\", \"name\"=>\"C\", \"population\"=>3}], \"routes\" => [{\"ports\"=> [\"A\", \"B\"], \"distance\"=>1}, {\"ports\"=> [\"B\", \"C\"], \"distance\"=>3}]}\n graph.fillData(data)\n ifSucceed = graph.addRoute(\"A\", \"C\", 100)\n assert_equal(ifSucceed, true)\n assert_equal(graph.distanceMap[\"A C\"], 100)\n assert_equal(graph.distanceMap[\"C A\"], nil)\n end", "title": "" }, { "docid": "4fba3aeb4b08e94d2630e68f940e51a7", "score": "0.54479194", "text": "def parse_and_add_cities\n\n cities_list = @json_dict['metros'] \n cities_list.each do |city_dict|\n @json_graph_api.add_vertex(city_dict['code'],city_dict)\n @city_to_code[city_dict['name']] = city_dict['code']\n end\n\n end", "title": "" }, { "docid": "7965c4fe3a1ec2fd8dbe8acc65c34ebf", "score": "0.5447422", "text": "def route(origin, destination)\n end", "title": "" }, { "docid": "4761139d96a7172bb792b6ae3c49ee87", "score": "0.5445315", "text": "def addCity(city)\n @metros.push(city)\n end", "title": "" }, { "docid": "2109163a7e394fc69bcf6c3ab0d6af15", "score": "0.5442048", "text": "def add_route(route)\n unless route.is_a?(Webmate::Routes::Base)\n route = Webmate::Routes::Base.new(route)\n end\n\n # add route to specific node of routes hash\n @routes[route.method.to_s.upcase] ||= {}\n route.transport.each do |transport|\n (@routes[route.method.to_s.upcase][transport.to_s.upcase] ||= []).push(route)\n end\n end", "title": "" }, { "docid": "25c46db467430e61504a2e08ded0f406", "score": "0.543718", "text": "def append_route\n route build_route\n end", "title": "" }, { "docid": "8afc899fe65744c47e6565125279bbfc", "score": "0.5432116", "text": "def index\n # @streets = Street.all\n lat = params[:lat].to_f\n lng = params[:lng].to_f\n s = Street.new\n zone = s.pairing_zone(lat,lng)\n s.zone = zone\n #voisins = s.voisin(1)\n # if !lat.nil?\n # #1. Recuperer les routes de la zone\n # route_zone = Street.where(:zone => zone)\n # #2 Verifie si route_zone est vide dans ce cas rechercher les\n # # route vosine du niveau 1\n # if route_zone.empty?\n # voisin = s.voisin(1)\n # route_zone = Street.where(:zone => voisin)\n # end\n # #3 recuperer les routes dans les way\n # route_way = []\n # # route_zone.each do |r|\n # # route_way.push({:points => Way.where(:wid => r.tid).first.points , :ttext => r.ttext , :id => r.tid})\n # # end\n #\n # #4 trier les routse par ordre de raprochement\n # #route_way_sorted = s.sorted_way(route_way)\n # @streets = route_zone\n # else\n # @streets = Relation.where(:rid => 5621205).first\n # city = City.all.select{|x| x.ttext.split(\";\").include?(\"admin_level@10\") && x.ttext.split(\";\").join(\"@\").split(\"@\").include?(\"name\") }.last\n # element = city.tname.classify.constantize.where(\"#{city.tname[0]}id\".to_sym => city.tid).first\n # name = city.ttext.split(\";\").join(\"@\").split(\"@\")\n # index = name.index(\"name\")\n @streets = Street.last\n # @streets = []\n# end\nend", "title": "" }, { "docid": "f3c77011081db53ae70eee9f667018d2", "score": "0.543094", "text": "def add_station(number_route, name_station)\n @routes.each do |route|\n route.add_station(@stations.find { |st| st.name == name_station }) if route.number_route == number_route\n end\n end", "title": "" }, { "docid": "46fc3cba2949e3443deeeb16b4c9b9e7", "score": "0.542639", "text": "def distance_to(*params)\r\n return super unless params.size > 0 && params.first.kind_of?(City)\r\n other_city = params.shift\r\n params.unshift other_city.longitude\r\n params.unshift other_city.latitude\r\n super\r\n end", "title": "" }, { "docid": "cf214d701b6e39684dc62f0f331f924f", "score": "0.5418056", "text": "def find_route(start,finish,start_line,finish_line, visited, route, time)\n visited << start.name\n connection = start.connections.find {|connection| !visited.include?(connection.station.name)}\n raise ArgumentError if connection.nil?\n new_time = time + connection.time.to_f\n pass_station = connection.station\n unless start_line == finish_line\n transfer = pass_station.transfers.find {|transfer| transfer.station.line == finish_line}\n unless transfer.nil?\n new_time = new_time + transfer.time.to_f\n route = transfer.station\n start_line = finish_line\n pass_station = transfer.station\n end\n end\n if pass_station.name == finish.name\n [new_time, route]\n else\n find_route(pass_station, finish, start_line, finish_line, visited, route, new_time)\n end\n end", "title": "" }, { "docid": "2d1cfbafa6dde0157e14851c09acf339", "score": "0.53937596", "text": "def get_route_recurse(origin,dest) \n #establish what lines the stations belong to.\n origins_lines = get_lines_for_station(origin)\n dests_lines = get_lines_for_station(dest)\n #and check if the stations share a common line?\n #initialise common_line to nil\n common_line = get_common_line(origins_lines, dests_lines)\n\n \n # if the stations didn't share a common line, then we begin the \n # recursive process:\n # but if they did, then we can simply list the stations between them \n # and return the actual route (this will also be what terminates the \n # recursive process)\n\n if common_line.nil? # (then the stations are not on the same line)\n\n # so add the origins lines to the list of lines already searched.\n @lines_searched += origins_lines\n\n # determine neighbouring lines that have not already been searched,\n neighbouring_lines_to_search = get_neighbouring_lines_not_yet_searched(\n origins_lines,\n @lines_searched)\n \n if neighbouring_lines_to_search.empty?\n return nil # then we've reached a point where we haven't found the \n # destination station in this direction.\n else\n # for all the neighbouring lines that we haven't looked at yet:\n neighbouring_lines_to_search.each do |neighbour_line_to_search|\n # go through all their junction_stations\n neighbour_line_to_search.junction_stations.each do |junction_station|\n # and find a junction that is on this line\n if stations_on_same_line?(origin, junction_station)\n # ensure we are looking at another junction \n # if we're already 'on' one:\n unless origin == junction_station\n # calculate the route from our 'current' origin \n # to the junction station we're considering\n route_from_origin_to_junction = get_route_recurse(origin, junction_station) \n #also calculate the route from the junction \n # station we're considering to the destination station:\n route_from_junction_to_dest = get_route_recurse(junction_station, dest)\n #if either of those return nil then it means we \n # were not considering an appropriate junction station \n # or we have been looking in the wrong direction to get \n # to our destination station and have hit a dead-end\n if !route_from_origin_to_junction.nil? && !route_from_junction_to_dest.nil?\n #then so far, we're on a branch that's either worth \n # pursuing further, or we have already found the \n # destination station.\n return route_from_origin_to_junction + route_from_junction_to_dest\n end\n else\n return nil # call back up the stack that this branch \n # was not worth pursuing\n end\n end\n end\n end\n end\n \n else # The stations are on the same line:\n # This block of code is basically the successful termination clause \n # of our recursion.\n # It means that the 'current' origin we're looking from can see the \n # destination station on one of the lines that it's also on:\n get_route_in_common_line(common_line, origin, dest)\n end\n end", "title": "" }, { "docid": "7ae98299fc49a02a06b5286f38d9cd4d", "score": "0.53927124", "text": "def nearest_possible_neighbor(cities, starting_city)\n current_city = starting_city\n route = [starting_city.name]\n\n# WHILE current_city.visited IS FALSE\n while current_city.visited == nil\n neighbor_cities = []\n# SET neighbor_cities TO current_city.neighbors\n for city in current_city.neighbors\n neighbor_cities.push(city) if cities.include? city[:city]\n end\n\n# SET next_city = neighbor_cities[0]\n for city in neighbor_cities\n# IF next_city.visited IS FALSE\n if city[:city].visited == nil\n# ASSIGN current_neighbor TO next_city\n next_city = city\n break\n end\n end\n\n# IF current_city is next_city.city (eof) then break\n break if current_city == next_city[:city]\n\n# FOR current_neighbor IN neighbor_cities\n for current_neighbor in neighbor_cities\n# IF current_neighbor.distance < next_city.distance\n if current_neighbor[:distance] < next_city[:distance] && !current_neighbor[:city].visited\n# ASSIGN next_city TO current_city\n next_city = current_neighbor\n end\n end\n\n# SET current_city.visited to TRUE\n current_city.visited = true\n# SET current_city to next_city.city\n current_city = next_city[:city]\n# ADD current_city.name to end of route\n route.push(current_city.name)\n end\n\n# return finished route\n route\nend", "title": "" }, { "docid": "9dbb681a6a4f62cd18db6ac5ca4ebeb0", "score": "0.5362938", "text": "def add_route\n if @stations.empty? || @stations.count < 2\n @interface.puts_text(:empty_stations)\n else\n show_stations\n first_last\n new_route\n end\n rescue RuntimeError => route_exception\n @interface.puts_exception(route_exception)\n retry\n end", "title": "" }, { "docid": "821eb44eb45189a0603e5d9b0b7ae845", "score": "0.5353222", "text": "def get_shorest_path(metro1, metro2)\n previous = self.dijkstra(metro1, metro2)\n \n current_metro = metro2\n expect_route = []\n while current_metro != nil\n expect_route.insert(0, current_metro)\n current_metro = previous[current_metro]\n end\n return expect_route\n end", "title": "" }, { "docid": "a769e12a4e9cc9db1a07ffccb4f44305", "score": "0.5332341", "text": "def create_routes_from_trip_object(trip_object)\n trip_object.routes.each do |r|\n driver = Driver.find(r.driver.id)\n route = Route.create(driver: driver)\n r.id = route.id\n r.passengers.each do |p|\n route.travellers << Traveller.find(p.id)\n end\n self.routes << route\n end\n end", "title": "" }, { "docid": "0446e8dfc05afce7860820f13b92fa46", "score": "0.5320429", "text": "def add_distances_to_clinic_openstructs\n add_clinic_full_address\n determine_clinic_coordinates\n calculate_distances\n end", "title": "" }, { "docid": "0abb48b9c9f6b99b1ddba4b889808aaa", "score": "0.5316554", "text": "def add_route(to, cost = 1)\n @routes << Route.new(self, to, cost)\n end", "title": "" }, { "docid": "fb61615c36c88a5bdaabc483d62fd50d", "score": "0.5314282", "text": "def add_station(station)\n @route.insert(-2, station)\n end", "title": "" }, { "docid": "d5e4e7c36c567d7b005aa90f22867025", "score": "0.5311147", "text": "def bus_route_planning (depart_address, destination_address)\n depart_coordinates = address_to_coordinates(depart_address)\n destination_coordinates = address_to_coordinates(destination_address)\n depart_stop = find_nearest_stop(depart_coordinates)\n destination_stop = find_nearest_stop(destination_coordinates)\n \n depart_stop_coordinates = [depart_stop.lan, depart_stop.lon]\n depart_walking_route = walking_route(depart_coordinates, depart_stop_coordinates)\n destination_stop_coordinates = [destination_stop.lan, destination_stop.lon]\n destination_walking_route = walking_route(destination_stop_coordinates, destination_coordinates)\n \n # This set contains all routes including the departing stop \n routes_containing_depart = find_routes_set_by_stop(depart_stop)\n # This set contains all routes including the destination stop \n routes_containing_destination = find_routes_set_by_stop(destination_stop)\n \n # This array defines the shape of the routing results, it contains multiple coordinates\n final_path_points = []\n final_path_points += path_from_google_route(depart_walking_route)\n \n common_routes = routes_containing_depart.to_set & routes_containing_depart.to_set\n if (not common_routes.empty?) # On the same route\n final_path_points += find_path(common_routes.to_a()[0], depart_stop, destination_stop)\n else # On different route\n min_walking_distance = Float::INFINITY\n min_walking_route = nil\n path_of_bus_route_1 = nil\n path_of_bus_route_2 = nil\n transfer_walking_route = nil\n # Iterate all the routes in two different set\n routes_containing_depart.each do |route_1|\n routes_containing_destination.each do |route_2|\n # Iterate all the stops in both routes\n route_1.stops.each do |stop_1|\n route_2.stops.each do |stop_2|\n if(stop1.id != stop2.id) # Not the same stop\n transfer_walking_route = walking_route(stop1, stop2)\n transfer_walking_route_distance = transfer_walking_route[:legs][0][:distance][:value]\n else\n transfer_walking_route = nil\n transfer_walking_route_distance = 0\n end\n # Find the shortest transfer walking route\n if(transfer_walking_route_distance < min_walking_distance)\n min_walking_distance = transfer_walking_route_distance\n min_walking_route = transfer_walking_route\n path_of_bus_route_1 = find_path(route_1, depart_stop, stop1)\n path_of_bus_route_2 = find_path(route_2, stop2, destination_stop)\n end\n end\n end\n # End iterate all stops\n end\n end\n # End iterate all routes\n final_path_points += path_of_bus_route_1\n final_path_points += path_from_google_route(transfer_walking_route)\n final_path_points += path_of_bus_route_2\n end #end of on the same or different route\n # From last bus stop to the destination\n final_path_points += path_from_google_route(destination_walking_route)\n return final_path_points\n end", "title": "" }, { "docid": "100758d7daa9d83eae495bb915dc4441", "score": "0.5300012", "text": "def route\n\t\tbest_route = []\n\t\t@optimal_route.each { | city | best_route << city.to_a }\n\t\treturn best_route\n\tend", "title": "" }, { "docid": "585202596adfaabf0bf1c8e3ab4703b2", "score": "0.5293222", "text": "def option_airports\n RouteCalculator.new(orig: origin).calculate_destinations\n end", "title": "" }, { "docid": "83d12ac73a6261cbcb8795786965b87d", "score": "0.5290266", "text": "def subway_metro_two_staions(red_staiton,start_point,green_staion,end_point)\n # call the subway_metro metro\n subway_metro(red_staiton,start_point,\"Park Street\")\n subway_metro(green_staion,\"Park Street\",end_point)\nend", "title": "" }, { "docid": "9671306aee3a88ad915622b92af672d4", "score": "0.5283295", "text": "def create\n # Neuer trip wird angelegt, Nutzer bin ich, car wird aus Parameter ausgelesen und eingetragen\n @trip = Trip.new()\n @trip.user_id = current_user.id\n @trip.car_id = params[:car]\n\n # Anahnd der Parameter wird die Geocoder-Coord. bestimmt, wenn sie nil ist schmeißen wir eine Exc.\n temp = Geocoder.coordinates(params[:address_start])\n if temp != nil\n @trip.starts_at_N = temp[0]\n @trip.starts_at_E = temp[1]\n else\n raise \"Fehler bei der Starteingabe\"\n end\n temp = Geocoder.coordinates(params[:address_end])\n if temp != nil\n @trip.ends_at_N = temp[0]\n @trip.ends_at_E = temp[1]\n else\n raise \"Fehler in der Zieleingabe\"\n end\n \n # set_address_info macht aus einem Addresseingabefeld drei Teile, so dass es in das Model eingetragen werden kann\n # set_route bestimmt distance und duration\n @trip = @trip.set_address_info\n @trip.set_route\n \n # Comment wird eingefuegt\n @trip.comment = params[:comment]\n # Die fuenf Eingabewerte der View werden zusammengefuegt, damit sie in ein Datenfeld des Models passen\n @trip.start_time = params[:start_year]+\"-\"+params[:start_month]+\"-\"+params[:start_day]+\"T\"+params[:start_hour]+\":\"+params[:start_minute]\n # Verfuegbare Sitzplaetze des Trips werden gesetzt\n if params[:free_seats] == \"\"\n @trip.free_seats = @trip.car.seats\n else\n @trip.free_seats = params[:free_seats]\n end\n # Ist der Fahrer bereit Gepaeck mitzunehmem?\n if params[:baggage] == nil\n @trip.baggage = false\n else\n @trip.baggage = true\n end\n\n if @trip.save\n redirect_to @trip, :notice => 'Die Fahrt wurde erfolgreich erstellt.'\n else\n redirect_to trips_path\n end\n end", "title": "" }, { "docid": "761e7a9a0c53fbaf455c9f675cfe2a7f", "score": "0.52757543", "text": "def return_route origin\n @stations[origin]\n end", "title": "" }, { "docid": "819240880224bc179838dd33df6973fb", "score": "0.52755886", "text": "def is_valid_route(stop1, stop2, graph_instance)\n city1 = graph_instance.node_hash[stop1]\n @layover_time = @layover_time + (@layover_rate - city1.linked_cities.size()*10)\n city1.linked_cities.each { |tuple|\n if(tuple.city == stop2)\n @total_distance = @total_distance + tuple.distance\n if(stop1 == @origin)\n @cost = @cost + @rate*tuple.distance\n else\n if(@rate != 0)\n @rate = @rate-0.05\n end\n @cost = @cost + @rate*tuple.distance\n end\n return true\n end\n }\n return false\n end", "title": "" }, { "docid": "71e5889baad8d95b2264ba45e82ff070", "score": "0.5271554", "text": "def _optimal_route_in_forward_direction bag, conveyors, optimized_route0, optimized_routes, original_common_parent,\n original_flight_gate, total_travel_time\n if original_common_parent != original_flight_gate\n puts \"\\n(4) Compute optimal baggage route from #{original_common_parent} to #{original_flight_gate}\"\n entry_points = []\n flight_gate = original_flight_gate\n common_parent = _common_parent original_common_parent, conveyors, entry_points, flight_gate, total_travel_time\n\n optimized_route = _create_optimized_route bag, common_parent, common_parent.first.uniq, nil\n optimized_route0.points += optimized_route.points\n optimized_route0.points = optimized_route0.points.flatten.uniq\n optimized_route0.total_travel_time += optimized_route.total_travel_time\n optimized_routes << optimized_route0\n else\n optimized_routes << optimized_route0\n end\n end", "title": "" }, { "docid": "c0ae26f664259ac5f98a4a1cbba4d423", "score": "0.5266716", "text": "def new\n @route = Route.new\n @route.line = Line.find_by_slug(params[:line_id])\n\n 30.times { @route.route_stops.build }\n @route.order_stops params[:order] if params[:order]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "title": "" }, { "docid": "298b672f3aab466b4633b111f2fb7215", "score": "0.5265515", "text": "def route\n \"#{from_airport.name} - #{to_airport.name}\"\n end", "title": "" }, { "docid": "e90435f9780200ed796dc72bd07be1b4", "score": "0.5252959", "text": "def crossroads()\n @downtown.vertices\n\tend", "title": "" }, { "docid": "c1def8f523f01c7cdca380f3113052f4", "score": "0.5251454", "text": "def route( start_node, target_node )\r\n\tend", "title": "" }, { "docid": "1dbb77a90400d0809752370df7aaac93", "score": "0.5245071", "text": "def add(routes_refine)\n\t\t\troutes.deep_merge! routes_refine.routes\n\t\t\treverse_routes.merge! routes_refine.reverse_routes\n\t\tend", "title": "" }, { "docid": "a7f9797c92f33a94963c524f97537e82", "score": "0.52333343", "text": "def travels\n end", "title": "" }, { "docid": "2510c3c2cee907d9c306b1d6397b5262", "score": "0.5225125", "text": "def request_car_route_from(coordinates)\n url = 'https://api.mapbox.com/directions/v5/mapbox/driving-traffic/'\n url += \"#{coordinates[:origin_lat]},#{coordinates[:origin_long]};\"\n url += \"#{coordinates[:dest_lat]},#{coordinates[:dest_long]}?access_token=#{@TOKEN}\"\n # url += '&geometries=geojson'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "title": "" }, { "docid": "4ded4c14508648a7d7d8e3d45b3bca94", "score": "0.5221382", "text": "def places\n photo_places = title_places + places_mentioned + routes_mentioned\n photo_places = photo_places << route if route_id\n photo_places\n end", "title": "" }, { "docid": "40c13517735de9c796666cae0043789b", "score": "0.52073616", "text": "def add_route(route)\n @routes << route\n route\n end", "title": "" }, { "docid": "75d8adc7803c87cbdf685691d94f73c0", "score": "0.5197137", "text": "def remove_route(from, to)\n c1 = search_city(from) # search_city search in city_hash, such city might not exist in the graph.\n c2 = search_city(to)\n if c1 != nil && c2 != nil\n if @graph.has_key?(c1.get_all['code'])\n if @graph[c1.get_all['code']].has_key?(c2.get_all['code'])\n @graph[c1.get_all['code']].delete(c2.get_all['code'])\n puts(\"Route #{c1.get_all['name']} to #{c2.get_all['name']} is removed!\")\n else\n puts(\"No such route! \")\n end\n else\n puts(\"No such route! \")\n end\n else\n puts(\"Cannot find the city you query! \")\n end\n end", "title": "" }, { "docid": "9624b9159bcb1dcccae7be767e04cc21", "score": "0.51967525", "text": "def add_route!(details)\n r = details.is_a?(Route) ? details : Route.from_hash(details, api_client: api_client)\n\n r.service = self\n r.save\n end", "title": "" }, { "docid": "9624b9159bcb1dcccae7be767e04cc21", "score": "0.51967525", "text": "def add_route!(details)\n r = details.is_a?(Route) ? details : Route.from_hash(details, api_client: api_client)\n\n r.service = self\n r.save\n end", "title": "" }, { "docid": "9624b9159bcb1dcccae7be767e04cc21", "score": "0.51967525", "text": "def add_route!(details)\n r = details.is_a?(Route) ? details : Route.from_hash(details, api_client: api_client)\n\n r.service = self\n r.save\n end", "title": "" }, { "docid": "777bca3603030d8350527c58c0824c6e", "score": "0.5189625", "text": "def get_route\n {\n \"id\": \"400\",\n \"stops\": [\n {\n \"name\": \"La parada por el palo\",\n \"location\": {\n \"latitude\": 9.894389,\n \"longitude\": -81.38932\n }\n },\n {\n \"name\": \"El rancho de la esquina\",\n \"location\": {\n \"latitude\": 9.43843,\n \"longitude\": -84.43784\n }\n }\n ],\n \"path\": [\n {\n \"latitude\": 9.894389,\n \"longitude\": -81.38932\n },\n {\n \"latitude\": 9.32832,\n \"longitude\": -81.38232\n },\n {\n \"latitude\": 10.4384,\n \"longitude\": -84.438943\n },\n {\n \"latitude\": 9.43843,\n \"longitude\": -84.43784\n }\n ]\n }\n end", "title": "" }, { "docid": "492622ee86ddaff080557a3ad01d3064", "score": "0.51860774", "text": "def set_road_transport1_part2\n @road_transport1_part2 = RoadTransport1Part2.find(params[:id])\n end", "title": "" }, { "docid": "d89c89a8b55c6a1970e9404c8f47fdce", "score": "0.5185988", "text": "def cost_of_activities_at_destination\n total_cost=cost_of_activities # cost at this location\n my_minor_places.each do |place|\n total_cost += place.cost_of_activities\n end\n end", "title": "" }, { "docid": "649dfba52e515a3a28c53a188e643c4e", "score": "0.5182871", "text": "def add_road(road)\n\t\traise MapError.new \"Road #{road.junctions.to_s} already on map\" if roads.include? road\n\n\t\t# self_add_junction road.start_junction\n\t\t# self_add_junction road.end_junction\n\n\t\troads << road\n\t\troad.map_name = \"R#{roads_count}\"\n\trescue MapError => e\n\t\tLog.warn e.message\n\tend", "title": "" }, { "docid": "c5dd02a7cd7dbfab7025f83e61a56d7b", "score": "0.5176123", "text": "def update_route_trains(entity, routes)\n remove_all_var_trains(entity)\n routes.each { |route| append_var_train(entity, route.train) }\n @corporation_trains[entity] = nil\n end", "title": "" }, { "docid": "47df83d8ac767ca15bf85603c0aaaae0", "score": "0.51743966", "text": "def destinations; end", "title": "" }, { "docid": "89ce28c082d342f87297bdba3da81206", "score": "0.5174185", "text": "def add_crossroad(v)\n @downtown.add_crossroad(v)\n @num_crossroad = @num_crossroad + 1\n\tend", "title": "" }, { "docid": "a847f79071f43c12e8ecc2b93313abc9", "score": "0.51715916", "text": "def route(from_lat,from_lon,to_lat,to_lon,at_time=Time.now)\n closedSet = Set.new\n start_points = Stop.neighbor_nodes_on_foot(from_lat,from_lon,3,1.0)\n end_points = Set.new(Stop.neighbor_nodes_on_foot(to_lat,to_lon,2,1.0).collect {|n| n[1][:Stop].stop_id})\n openSet = Set.new( start_points.collect { |n| n[1][:Stop].stop_id })\n \n @came_from = Hash.new\n there = GeoKit::LatLng.new(to_lat, to_lon)\n f_score = MultiRBTree.new\n g_score = Hash.new\n h_score = Hash.new\n @methods = Hash.new\n\n start_points.each do |spnval|\n spn = spnval[1]\n sp = spn[:Stop]\n here = GeoKit::LatLng.new(sp.stop_lat, sp.stop_lon)\n sc = score(spn)\n g_score[sp.stop_id] = sc\n hsc = spn[:Time] + 3600.0 * here.distance_to(there) / AVERAGE_SPEED\n h_score[sp.stop_id] = hsc\n sc += hsc\n f_score[sc] = spn\n @methods[sp.stop_id] = spn\n end\n\n while openSet.length > 0\n x = nil\n from_node = nil\n f_score.each do |fkv|\n from_node = fkv[1]\n x = from_node[:Stop]\n break if openSet.include? x.stop_id\n end\n if end_points.include? x.stop_id\n @total_time = 0\n puts \"found a route\"\n ret = reconstruct_path(x)\n here = GeoKit::LatLng.new(x.stop_lat, x.stop_lon) \n dist = here.distance_to(there)\n if dist > 0\n phi = here.heading_to(there)\n ratio = Math::sin(phi.radians).abs + Math::cos(phi.radians).abs\n dist *= ratio\n tm = (dist*3600/2.5)\n ret << {\n :Stop => nil,\n :WaitTime => 0,\n :Time => tm,\n :Method => \"Walk #{dist.round(2)} miles to your destination\"\n }\n end\n return ret\n end\n openSet.delete(x.stop_id)\n closedSet.add(x.stop_id)\n\n puts \"\\n\\nStop \"+x.stop_name+\"(\"+x.stop_id+\")\\n\\n\"\n nodelist = x.neighbor_nodes(at_time+g_score[x.stop_id])\n #puts \"\\nNodelist \"+nodelist.count.to_s\n count = 0\n nodelist.each do |nodevalue|\n node = nodevalue[1]\n #puts \"Node \"+node.inspect\n node_stop = node[:Stop]\n next if closedSet.include? node_stop.stop_id\n tsc = score(node, from_node)\n\n tentative_g_score = g_score[x.stop_id] + tsc\n if !openSet.include? node_stop.stop_id\n puts \" adding #{node_stop.stop_name} (#{node_stop.stop_id}) score #{tentative_g_score} to open set\"\n openSet.add node_stop.stop_id\n tentative_better = true\n elsif tentative_g_score < g_score[node_stop.stop_id]\n tentative_better = true\n else\n tentative_better = false\n end\n\n if tentative_better\n here = GeoKit::LatLng.new(node_stop.stop_lat, node_stop.stop_lon)\n @came_from[node_stop.stop_id] = x\n sc = tentative_g_score\n g_score[node_stop.stop_id] = sc\n phi = here.heading_to(there)\n ratio = Math::sin(phi.radians).abs + Math::cos(phi.radians).abs\n hsc = 3600.0 * here.distance_to(there) * ratio / AVERAGE_SPEED\n sc += hsc\n h_score[node_stop.stop_id] = hsc\n f_score[sc] = node\n @methods[node_stop.stop_id] = node\n count = count + 1\n end\n end\n puts \"evaluated #{count} stops\"\n end\n puts \"No route found :-(\"\n return nil\n end", "title": "" }, { "docid": "3e9e9fc6b2f470edd97d792dae201e6b", "score": "0.51676816", "text": "def subway_trip(start_line, start_stop, end_line, end_stop)\n\tif start_line == end_line\n\tfirst_line = []\n\tfirst_line = Train_routes.fetch(start_line)\n\tposition1 = first_line.index(start_stop)\n\tposition2 = first_line.index(end_stop)\n\t(position2.to_i - position1.to_i).abs\n\telse\n\tfirst_line = Train_routes.fetch(start_line)\n\tsecond_line = Train_routes.fetch(end_line)\n\tunion1 = first_line.index(\"union square\")\n\tunion2 = second_line.index(\"union square\")\n\tstart_sect = first_line.index(start_stop)\n\tend_sect = second_line.index(end_stop)\n\tfirst_dist = (union1 - start_sect).abs\n\tsecond_dist = (union2 - end_sect).abs\n\tfirst_dist + second_dist\n\tend\nend", "title": "" }, { "docid": "7a79bc4bbdf74f99ebf8c797075864c3", "score": "0.5161874", "text": "def routes_between_airports(origin:, destination:)\n command = Command.new(\n command: :RoutesBetweenAirports,\n result: Types::RoutesBetweenAirportsResults,\n version: 2,\n parameters: {origin: origin, destination: destination}\n )\n perform_operation(command)\n end", "title": "" }, { "docid": "6f62ae2f9105c2a02c107113590a0c21", "score": "0.5159263", "text": "def walk_route(params={})\n\n params[:origin] ||= {:lat =>53.797678, :lon =>-1.5359008} #-1.5359008,53.797678 bus station!\n lon_lat = Course.get_lon_lat(params[:lon_lat])\n \n params[:origin] = {:lat =>lon_lat[:latitude], :lon =>lon_lat[:longitude]} if lon_lat\n\n params[:start_time] ||= self.start_time.strftime(\"%H:%M\")\n if self.start_date < Time.now\n params[:start_date] ||= Time.now.strftime(\"%Y-%m-%d\")\n else\n params[:start_date] ||= self.start_date.strftime(\"%Y-%m-%d\")\n end\n\n time = params[:start_date]+\"T\"+params[:start_time]\n json = {\"locations\" => [{\"lat\"=>params[:origin][:lat], \"lon\"=>params[:origin][:lon]},{\"lat\"=>self.latitude, \"lon\"=> self.longitude}], \"directions_options\"=>{\"units\"=>\"kilometers\"},\"costing\" => \"pedestrian\" }.to_json\n location = \"#{params[:origin][:lon]},#{params[:origin][:lat]};#{self.longitude},#{self.latitude}\"\n url = \"#{AppConfig['osrm_url']}/route/v1/foot/#{location}?overview=false&alternatives=false&steps=true\"\n\n logger.debug \"calling #{url}\"\n\n response = HTTParty.get(url, {\n headers: {\"User-Agent\" => \"Leeds-Adult-Learning;Contact osm @chippy\"} \n })\n\n if response.code != 200\n msg = \"Problem with OSRM walk routing: Code: #{response.code.to_s} Body: \" + response.body.inspect\n raise ApiError, msg\n end\n \n body = JSON.parse(response.body)\n\n duration = body[\"routes\"][0][\"legs\"][0][\"duration\"]\n length = body[\"routes\"][0][\"legs\"][0][\"distance\"]\n departure_time = self.start_time - duration\n arrival_time = self.start_time \n\n parts = []\n body[\"routes\"][0][\"legs\"].each do | leg |\n leg[\"steps\"].each do | step |\n instruction = OSRMTextInstructions.compile(step)\n parts << { \"mode\" => \"foot\",\n \"pre_instruction\" => instruction,\n \"post_instruction\" => \"\",\n \"duration\" => step[\"duration\"],\n \"distance\" => step[\"distance\"],\n \"ref\" => step[\"ref\"]\n } \n end\n end\n \n return {:type => \"foot\",\n :duration => duration,\n :length => length,\n :date => params[:start_date],\n :departure_time => departure_time,\n :arrival_time => arrival_time,\n :parts => parts }\n\n end", "title": "" } ]
7c656e7462e823e712a9546afcfb0753
def [](num) optional but useful; return the bucket corresponding to `num` end
[ { "docid": "ab7930a219a7b52ade3e9c932629f522", "score": "0.0", "text": "def num_buckets\n @store.length\n end", "title": "" } ]
[ { "docid": "95c9d315c66cb5edfd635749d27198a9", "score": "0.8140234", "text": "def [](num) #<== maybe requires hash\n # num_hash = num.hash\n # @store[num_hash % num_buckets]\n @store[num % num_buckets]\n end", "title": "" }, { "docid": "f090ac5ab2ff7356cefd781dc8e2955d", "score": "0.7067379", "text": "def basic_bucket_function\n Proc.new do |item|\n bucket_number = bisect_right(@buckets, item) - 1\n\n # Counters is @buckets.size - 1\n # [bucket_number, counter_size-1].min\n\n if bucket_number > counter_size-1\n counter_size-1\n else\n bucket_number\n end\n end\n end", "title": "" }, { "docid": "ee491760c9e778c20eea8afc4025f30f", "score": "0.6605454", "text": "def [](i)\n end", "title": "" }, { "docid": "ee491760c9e778c20eea8afc4025f30f", "score": "0.6605454", "text": "def [](i)\n end", "title": "" }, { "docid": "377325217abc68f02a9c9521cf79c715", "score": "0.6381484", "text": "def [](num)\n return nil if num > (@size - 1) || (num * -1) > @size\n instance_variable_get(\"@a#{num % @size}\")\n end", "title": "" }, { "docid": "558efea8a56237422ab24018aad6ee4a", "score": "0.62958103", "text": "def fast_bucket_function\n Proc.new do |item|\n if item.is_a?(Float) && item.nan?\n nil\n else\n bucket_number = (item - min)/increment\n if bucket_number > counter_size || bucket_number < 0\n nil\n else\n [bucket_number.to_i, counter_size-1].min\n end\n end\n end\n end", "title": "" }, { "docid": "b3990d5e61c2ca7f97aff9339772119f", "score": "0.62525314", "text": "def [](n)\n nth(n) ;\n end", "title": "" }, { "docid": "fdd3d316876d2a4f1497a3281ce80451", "score": "0.6240235", "text": "def [](n)\n @data[n]\n end", "title": "" }, { "docid": "213c38ee6642392b8480dfb5a79a4257", "score": "0.62008923", "text": "def range_bucket(value, size=10)\n if value.present?\n x = (value / size * size) + 1\n y = x + (size - 1)\n return \"#{x} - #{y}\"\n end\n end", "title": "" }, { "docid": "d5d08f18f8410d8758ef172788dfa0ac", "score": "0.61970425", "text": "def [](i); @x[i]; end", "title": "" }, { "docid": "0292a310eb549fedde77075ee90a4cd6", "score": "0.6150895", "text": "def [](index)\n raise ArgumentError, \"index must be < #{size}\" if index >= size\n number[index]\n end", "title": "" }, { "docid": "0c828b8d4c2fbfe98fd8164030c0fd69", "score": "0.61323696", "text": "def[](num)\r\n if num == 0\r\n return @x\r\n elsif num == 1\r\n return @y\r\n elsif num == 2\r\n return @z\r\n else\r\n return nil\r\n end\r\n end", "title": "" }, { "docid": "d02099f7000dd950d4f9525ab2944fb6", "score": "0.61222744", "text": "def random_from(bucket, num)\n #ret = {}\n\n rbucket = buckets[\"#{bucket}\"]\n\n begin\n\n ret = rbucket.sort_by{ rand }.slice(0..num-1).collect { |k,v| { k => v } }\n\n rescue Exception => e\n puts e.message\n puts e.backtrace.inspect\n end\n\n return ret\n end", "title": "" }, { "docid": "63017278cca8cc1baff1a75cbf9ec3f2", "score": "0.61161935", "text": "def [](key)\n current_node = @buckets[index(key, size)].head\n if !current_node\n #raise InvalidKeyError \"Cannot retrieve that item - not instantiated\"\n return nil\n end\n while current_node.key != key\n current_node = current_node.next\n break unless current_node\n end\n\n if !current_node\n #raise InvalidKeyError \"Cannot retrieve that item - not instantiated\"\n return nil\n end\n\n return current_node.value\n end", "title": "" }, { "docid": "ccb562a9a82f51672b7c443b22e6ea7d", "score": "0.60935664", "text": "def get(key)\n slot = key % BUCKET_MOD\n head = @buckets[slot]\n while head\n return head.val if head.key == key\n head = head.next\n end\n -1\n end", "title": "" }, { "docid": "9c9be71bdc914ded0034b40d8beac2f1", "score": "0.60740846", "text": "def compute_bucket(value, size = table.length)\n value.hash % size\n end", "title": "" }, { "docid": "8ae2175e56d1cffc455d567b520fb8d8", "score": "0.6051731", "text": "def [](value); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "ee4f46953acf059db590ea37c8e4b1bb", "score": "0.60384065", "text": "def [](key); end", "title": "" }, { "docid": "53d2db7b60e9617b773636e4fea1d210", "score": "0.600942", "text": "def [](key)\n i = 1\n desired_index = index(key, size)\n while @items[desired_index].key != key\n desired_index += i**2\n i += 1\n end\n\n return @items[desired_index].value\n end", "title": "" }, { "docid": "a4c8d39dcceb774b8e943305fc392cff", "score": "0.600615", "text": "def [](index) # i.e. array style index lookup.\n end", "title": "" }, { "docid": "a668e5b1e114b71393c4e7a4c9f139dc", "score": "0.59536314", "text": "def get(key)\n idx, bucket = find_bucket_and_index(key)\n idx ? bucket[idx].last : -1\n end", "title": "" }, { "docid": "a996944aef3582b41d1e418829b7f12d", "score": "0.59459645", "text": "def [](index); end", "title": "" }, { "docid": "291d329d990b2f94002af69e155dc687", "score": "0.5907011", "text": "def [](index)\n lookup(index.to_sym)\n end", "title": "" }, { "docid": "fc363901f35e03fbc0c149f7bdbefb4a", "score": "0.5887767", "text": "def [](index)\r\n @high_scores[index]\r\n end", "title": "" }, { "docid": "8f9a421b98e0800b0c3f3305cf53863e", "score": "0.58781415", "text": "def [](key)\n @items[index(key, size)].value\n end", "title": "" }, { "docid": "b936ceca9b1a80e2114f79316e794536", "score": "0.5869009", "text": "def [](index)\n end", "title": "" }, { "docid": "b936ceca9b1a80e2114f79316e794536", "score": "0.5869009", "text": "def [](index)\n end", "title": "" }, { "docid": "93cff651b8bbfff01ae2bf33554c69a2", "score": "0.58622986", "text": "def [](index)\n return get(index)\n end", "title": "" }, { "docid": "ab23f62059ed84155a76c927fa42e336", "score": "0.58470535", "text": "def [](value) \r\n case value\r\n when Integer then value > 0 ? (n=cache[:number]) && n[value] : cache[value]\r\n when Symbol then cache[value]\r\n when NilClass then nil\r\n when String then value=~/\\d+/ ? self[value.to_i] : self[value.downcase.gsub(\" \", \"_\").to_sym]\r\n when Array then Collection.new(value.map { |v| self[v] })\r\n when Types::Base then value\r\n else raise \"Value must be an Integer or a Symbol, currently #{value.class}\"\r\n end \r\n end", "title": "" }, { "docid": "a4499bfab7bc663304fda44e6ea530f6", "score": "0.58445084", "text": "def increment_bucket(bucket)\n (bucket + 1) % table.length\n end", "title": "" }, { "docid": "5a15a31bd796292baf6629ed5b41fa29", "score": "0.5839664", "text": "def [](index)\n @val[index]\n end", "title": "" }, { "docid": "f9c6de0f1cd20f50cba0fe390062375c", "score": "0.5819258", "text": "def each\n @buckets.each_with_index do |count, index|\n yield(to_bucket(index), count)\n end\n end", "title": "" }, { "docid": "5f0bd00fa118a0d4b504caa69e35c95c", "score": "0.5807295", "text": "def [](x)\n @data[x]\n end", "title": "" }, { "docid": "5fcc4e48e9362e88693ba4fa4280df78", "score": "0.5801789", "text": "def [](i); self.objects.ith(i) end", "title": "" }, { "docid": "27b78c01b147c0e6606548ac76063471", "score": "0.58005315", "text": "def index(key, size)\n return key.sum%size\n end", "title": "" }, { "docid": "97dc66411ceb12949cb09de1875e890e", "score": "0.57973474", "text": "def [](idx)\n\t\t@bar[idx]\n\tend", "title": "" }, { "docid": "8ff383df5919fa13e0253393cf6206b5", "score": "0.5792011", "text": "def [](index)\n i = 0\n each { |x| return x if i == index; i += 1 }\n nil # out of index\n end", "title": "" }, { "docid": "a25b0ef26d8ea0707c170320796ae180", "score": "0.5766332", "text": "def get_index(i)\n i/BITS_PER_ITEM\n end", "title": "" }, { "docid": "f3fb27a37e193961d613134962c8b6fd", "score": "0.576244", "text": "def index(key, size)\n i = key.sum % size \n end", "title": "" }, { "docid": "fcac3a990d0f9134aaa52e634abec25b", "score": "0.57608396", "text": "def [](p0) end", "title": "" }, { "docid": "fcac3a990d0f9134aaa52e634abec25b", "score": "0.57608396", "text": "def [](p0) end", "title": "" }, { "docid": "c5220f716258062983388b1d49c5094c", "score": "0.57358617", "text": "def index(key, size)\n # Look into this. Same as previous ???\n # Review the base of tens to get a better understanding.\n return key.sum % size\n end", "title": "" }, { "docid": "d7cdb129ae845b0fcf2ffe2aae7529d1", "score": "0.5734312", "text": "def [](n)\n raise TypeError unless n.respond_to?(:to_int)\n int = n.to_int\n\n if int < 0 || empty?\n nil\n elsif int == 0\n head\n else\n tail[int - 1]\n end\n end", "title": "" }, { "docid": "848c40953d5f89422bdc6f390fd6e69e", "score": "0.57169396", "text": "def [](key)\n end", "title": "" }, { "docid": "848c40953d5f89422bdc6f390fd6e69e", "score": "0.57169396", "text": "def [](key)\n end", "title": "" }, { "docid": "ce2e475f9362ec4b1e9f3bd0b6e63fac", "score": "0.57062954", "text": "def [] (key)\r\n assert_exists\r\n arr_cells = cells\r\n return arr_cells[key - 1]\r\n end", "title": "" }, { "docid": "9723ef4f084d431e2e9e5e5fb79c0df1", "score": "0.5693853", "text": "def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end", "title": "" }, { "docid": "8a07ca2ace4b22dbf5284dc7345550bb", "score": "0.5691066", "text": "def [](key)\n (key.kind_of?(Integer) ? keys : hash)[key]\n end", "title": "" }, { "docid": "81622ebef409ef45260d2ed4f64cbf1e", "score": "0.56863606", "text": "def [](k)\n @hash[k]\n end", "title": "" }, { "docid": "87f01f8b1d33823cda875717c019b8fb", "score": "0.5681043", "text": "def [](i)\n seq[i]\n end", "title": "" }, { "docid": "9726063ede90336344e29ed08e55db22", "score": "0.56753325", "text": "def calculate(number)\n buckets = []\n (1..number).each do |n|\n @prime.factors(n).each do |prime_factor|\n bucket = find_bucket(buckets, prime_factor)\n if bucket.nil?\n bucket = []\n buckets << bucket\n end\n bucket << prime_factor\n end\n end\n reduce_bucket_size(buckets, number)\n @arrays.multiply(buckets.flatten)\n end", "title": "" }, { "docid": "c69b399c0637c7f2eee27c5c5db4c85b", "score": "0.56551874", "text": "def bucket_for(type)\n return BUCKETS[type.to_sym]\n end", "title": "" }, { "docid": "25958bc9bfb46893303decd1126c17bb", "score": "0.5633555", "text": "def index(key, size)\n (key.sum % size)\n end", "title": "" }, { "docid": "17f55dd541cbfb31d8f9e61249044344", "score": "0.5630857", "text": "def index(key, size)\n return key.sum % size \n end", "title": "" }, { "docid": "2e18386915180ad005936e03a346a8d4", "score": "0.56288296", "text": "def [](index)\n get(index)\n end", "title": "" }, { "docid": "29c0458497882d1847158bf90857af86", "score": "0.56265724", "text": "def [](n)\n @locations[n]\n end", "title": "" }, { "docid": "e2c61db930ed32783b898e0fe6e74600", "score": "0.5619891", "text": "def initialize(num_buckets = 8)\n @store = Array.new(num_buckets) { Array.new }\n @count = 0\n @num_buckets = num_buckets\n end", "title": "" }, { "docid": "c8ddda881b87015048c66bf6af9b18bc", "score": "0.56169915", "text": "def [] num\n array = self.to_a\n if num > array.length\n raise \"Could not find #{num} elements matching #{self}, found #{array.length}\"\n end\n element = array[num]\n element\n end", "title": "" }, { "docid": "bc1ee7211c1541d03b768b848bd2225c", "score": "0.5599201", "text": "def [](key, index_name = T.unsafe(nil)); end", "title": "" }, { "docid": "ac46a9d977761299321d631fb32d3803", "score": "0.5598029", "text": "def [](arg)\n end", "title": "" }, { "docid": "6652ed8bbe45a92c4440919a8f119fd0", "score": "0.55978465", "text": "def [](value)\n value.is_a?(Fixnum) ? get_ordered_element(value) : get_unordered_element(value)\n end", "title": "" }, { "docid": "01e3755fff0d9c25bd12bb07ce740aa6", "score": "0.5595399", "text": "def [](index); @data[index]; end", "title": "" }, { "docid": "c2fcf5bff8beb23ce734b12c0e873742", "score": "0.5593116", "text": "def [](slot)\n ((@min + @max) / (@slot_num + 1)) * slot\n end", "title": "" }, { "docid": "2cdfbe4c4cc30f830997a8731a7f10c7", "score": "0.5590179", "text": "def buckets\n @buckets ||= init_buckets\n end", "title": "" }, { "docid": "f119a4af121078bb513f36919496feba", "score": "0.55826825", "text": "def index(key, size)\n return key.sum % size\n end", "title": "" }, { "docid": "f119a4af121078bb513f36919496feba", "score": "0.55826825", "text": "def index(key, size)\n return key.sum % size\n end", "title": "" }, { "docid": "f119a4af121078bb513f36919496feba", "score": "0.55826825", "text": "def index(key, size)\n return key.sum % size\n end", "title": "" }, { "docid": "f119a4af121078bb513f36919496feba", "score": "0.55826825", "text": "def index(key, size)\n return key.sum % size\n end", "title": "" }, { "docid": "7bcea720ec4765ff0467d0e6f4872787", "score": "0.55801576", "text": "def [](key, pos= 0, len= -1)\n end", "title": "" }, { "docid": "c53ddc4ccbb6d932f88a54c55a8a7f5e", "score": "0.5579732", "text": "def index(key, size)\n key.sum % size \n end", "title": "" }, { "docid": "c53ddc4ccbb6d932f88a54c55a8a7f5e", "score": "0.5579732", "text": "def index(key, size)\n key.sum % size \n end", "title": "" }, { "docid": "9ac89988af8838551214e4c8ca23e260", "score": "0.55705625", "text": "def []( *moment )\n if moment.length > 1 then\n return self.slice( moment[0], moment[1] )\n end\n if moment[0].is_a? TimeSeries::Period then\n @buckets[ moment[0] ]\n else\n @buckets[ calculate_bucket( TimeSeries.Normalise_Time( moment[0] ) ) ]\n end\n end", "title": "" }, { "docid": "e74e45f0a7ee4a0e9d4c6506962df8bd", "score": "0.5563717", "text": "def [](key)\n @items[index(key,@items.length)].value\n end", "title": "" }, { "docid": "b4dacceeef2e071eb3065f08b6ef6a21", "score": "0.55629593", "text": "def initialize(num_buckets = 8)\n @store = Array.new(num_buckets) { Array.new }\n @count = 0\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" }, { "docid": "bca1257f623f1c18f7f4016d23362ac4", "score": "0.5547626", "text": "def index(key, size)\n key.sum % size\n end", "title": "" } ]
5595b1f89df833b71e503d9b5d57c18c
authenticate user from Authorization in header without exception
[ { "docid": "94673e41df6d399740bf46220349e8e7", "score": "0.0", "text": "def authenticate_user_from_token\r\n result = find_user\r\n @current_user = result.current_user\r\n end", "title": "" } ]
[ { "docid": "00a2aa46a4673155380c62d2ad887d06", "score": "0.7825193", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n authenticate_error unless authenticate_with_auth_token auth_token\n end", "title": "" }, { "docid": "dd07cfa99597e305b5a7b45725259bed", "score": "0.77898157", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "title": "" }, { "docid": "a5a6e3b786768c16a088abdfb6b1f4c9", "score": "0.7745781", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n set_guest_user\n # authentication_error\n end\n end", "title": "" }, { "docid": "869f5dc5b5981d47b3ff2bf738d58b89", "score": "0.769506", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "title": "" }, { "docid": "869f5dc5b5981d47b3ff2bf738d58b89", "score": "0.769506", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "title": "" }, { "docid": "9658549e45cc7e902fe13fc2612796a8", "score": "0.76741755", "text": "def authenticate\n pattern = /^Bearer /\n header = request.headers[\"Authorization\"] # <= env\n if header && header.match(pattern)\n token = header.gsub(pattern, '')\n @current_user = User.find_by_token token\n if @current_user.nil?\n raise AuthenticationError\n end\n else\n raise AuthenticationError\n end\n end", "title": "" }, { "docid": "d6c216197f29982301b8d62f005c401c", "score": "0.76669323", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "title": "" }, { "docid": "d6c216197f29982301b8d62f005c401c", "score": "0.76668316", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "title": "" }, { "docid": "088fc061b7e348d1b935876c41e43f5a", "score": "0.7656346", "text": "def authenticate_request\n unless request.headers[:token] == \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE0NjA2NTgxODZ9\"\n render json: { error: 'Not Authorized' }, status: 401\n end\n end", "title": "" }, { "docid": "40090e7904aa0368956b8930e7a9dc23", "score": "0.7564774", "text": "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token(auth_token)\n else\n authentication_error\n end\n end", "title": "" }, { "docid": "16ce81af97e4cf96b23e01d790bbe758", "score": "0.7558201", "text": "def authorize_request\n header = request.headers['Authorization']\n header = header.split(' ').last if header\n begin\n @decoded = decode(header)\n @current_user = User.find(@decoded[:user_id])\n rescue ActiveRecord::RecordNotFound => e\n render json: { errors: e.message }, status: :unauthorized\n rescue JWT::DecodeError => e\n render json: { errors: e.message }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "364115bed858c06d6806115940a3e53f", "score": "0.7524923", "text": "def authenticate_user_from_token!\n\t\tauth_token = request.headers['Authorization']\n\n\t\tif auth_token\n\t\t\tauthenticate_with_auth_token auth_token\n\t\telse\n\t\t\tauthentication_error\n\t\tend\n\tend", "title": "" }, { "docid": "298e08f840d7ca57b41207612aeef876", "score": "0.7460406", "text": "def authenticate_by_header\n return false if request.authorization.blank?\n token =\n ActionController::HttpAuthentication::Token.token_and_options(request)\n @current_user = User.where.not(authentication_token: nil)\n .find_by(authentication_token: token)\n end", "title": "" }, { "docid": "9f08c897e58adc6d492ce64dea356021", "score": "0.74596655", "text": "def api_authenticate \n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request \n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "title": "" }, { "docid": "a0e3c01f6b7dbc598c2a2117fd13ea04", "score": "0.7409897", "text": "def authenticate_from_header\n authenticate_with_http_token do |token, options|\n authenticate_with(token) if token\n end\n end", "title": "" }, { "docid": "c7666c791beee0c3ac481e0e8a685d59", "score": "0.73964053", "text": "def api_authenticate\n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request\n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "title": "" }, { "docid": "27ba7db93c456c02af8092e3d4b2aee8", "score": "0.7391614", "text": "def authenticate\n if request.headers[\"HTTP_AUTHORIZATION\"].present?\n token = request.headers[\"HTTP_AUTHORIZATION\"].split('Token token=').last\n if token != '0x3f01b98dce38ab266910c5527cb011602514bf88ee1a9e076fd071d78c54e319'\n unauthorize\n end\n else\n unauthorize\n end\n end", "title": "" }, { "docid": "01e0a4fe909171767954a99b8c8f7030", "score": "0.73903686", "text": "def authorization_header(env); end", "title": "" }, { "docid": "bea398407c817ccc1e49b63f6fc76b17", "score": "0.73861", "text": "def authenticate!\n\t\terror!('Unauthorized', 401) if !is_authenticated\n @request_user\n\tend", "title": "" }, { "docid": "98878b70aff6f0561324031e6dfbaafb", "score": "0.7384078", "text": "def authenticate_user\n @current_user = AuthorizeRequest.call(request.headers).result\n return render status: :unauthorized, json: {errors: ['Unauthorized']} unless @current_user\n end", "title": "" }, { "docid": "2c5d391720283468d28acaae3b144ec2", "score": "0.73656625", "text": "def authenticate\n pattern = /^Bearer /\n header = request.headers['Authorization']\n if header && header.match(pattern)\n token = header.gsub(pattern, '')\n @current_user = User.find_by_token token\n raise ForbiddenError, error_messages[:unverified_login] unless @current_user.verified?\n raise ForbiddenError, error_messages[:unverified_login] unless !@current_user.teacher? || @current_user.verified_teacher?\n else\n raise AuthenticationError\n end\n rescue ActiveRecord::RecordNotFound\n raise AuthenticationError\n end", "title": "" }, { "docid": "9e4ac948464766afa4775486f644ab8b", "score": "0.7364784", "text": "def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication_failed', status: 401\n end\n end", "title": "" }, { "docid": "1ffac4471b6fb6e04fa69cfbacdf5a92", "score": "0.73548794", "text": "def authenticate\n pattern = /^Bearer /\n header = request.headers[\"Authorization\"] # <= env\n if header && header.match(pattern)\n token = header.gsub(pattern, '')\n @current_user = User.find_by_token token\n if @current_user.nil?\n raise AuthenticationError\n end\n else\n raise AuthenticationError\n end\n end", "title": "" }, { "docid": "1e78b1ae34e9d1986bfccb0dce287433", "score": "0.73433125", "text": "def api_authenticate\n\n if current_user.blank? && request.headers['Authorization'].present?\n @current_user ||= begin\n token = request.headers['Authorization'].split.last\n Knock::AuthToken.new(token: token).current_user\n rescue JWT::DecodeError => e\n # recover from specific exceptions\n nil\n end\n\n head :unauthorized unless current_user\n end\n end", "title": "" }, { "docid": "02a78d6bea1354c6e7d2f680753a01c5", "score": "0.73262924", "text": "def authenticate_user_from_token!\n # ブラウザでログイン済の場合はスルー\n return if user_signed_in?\n\n authentication_token = request.headers['Authorization']\n\n if authentication_token\n authenticate_with_auth_token authentication_token\n else\n authenticate_error\n end\n end", "title": "" }, { "docid": "57cd4b913023f043be325034b7324587", "score": "0.7307019", "text": "def authenticate_user!\n authenticate_token || render_unauthorized(\"Access denied\")\n end", "title": "" }, { "docid": "417a58f7d7182374c5e6cb21beff6a7c", "score": "0.7298786", "text": "def end_user_authenticate \n if request.headers[\"Authorization\"].present?\n\n # stripping down and decoding incoming authtoken\n auth_header = request.headers['Authorization'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n\n if !@token_payload\n render json: { error: 'The provided user auth token wasn´t correct' }, status: :bad_request \n false\n else\n true\n end\n else\n render json: { error: 'Need to include the Authorization header for user auth token' }, status: :unauthorized # The header isn´t present\n false\n end\n end", "title": "" }, { "docid": "917084dc3810a30c47cce60016cafdce", "score": "0.7283945", "text": "def authenticate_request!\r\n access_token = request.headers[\"AUTHORIZATION\"].to_s.remove('Bearer ')\r\n\r\n raise Exceptions::HeaderRequiredError.new \"Missing access_token\" and return if access_token.blank?\r\n\r\n decoded = Utils::JasonWebToken.decode(access_token)\r\n\r\n email = decoded[:email]\r\n api_authentication_token = decoded[:api_authentication_token]\r\n\r\n user = User.where(email: email, api_authentication_token: api_authentication_token).first!\r\n\r\n sign_in user, store: false\r\n end", "title": "" }, { "docid": "0649284f274cd93605e3ac29374c12e7", "score": "0.72801256", "text": "def authenticate_request \n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result \n\t\trender json: { error: 'Not Authorized' }, status: 401 unless @current_user \n\tend", "title": "" }, { "docid": "907c7e794ec28c9ba3b18efdc2520fd4", "score": "0.722909", "text": "def authenticate_request!\n unless user_id_in_token?\n return render_unauthorized\n end\n\n @current_user = User.find(auth_token[:user_id])\n rescue JWT::VerificationError, JWT::DecodeError\n render_unauthorized_wrong_token\n end", "title": "" }, { "docid": "6f5cbf1478b631caed5104f8ff7f3f70", "score": "0.7219026", "text": "def authenticate!\n user = try_authenticate\n return user if user\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n halt 401, (te :not_authorized, {message: \"Invalid username or password.\"})\nend", "title": "" }, { "docid": "fffbe7a979cc2881ca665b5851768eed", "score": "0.72185147", "text": "def authorize_request\n # Grabs the header and splits out the token from the header\n header = request.headers['Authorization']\n header = header.split(' ').last if header\n begin\n # Decode helper method pulls user info from the token\n @decoded = decode(header)\n # Set instance variable current_user using user_id from token data\n @current_user = User.find(@decoded[:id])\n # If the user can't be found or the token isn't valid, we raise an unauthorized error\n rescue ActiveRecord::RecordNotFound => e\n render json: { errors: e.message }, status: :unauthorized\n rescue JWT::DecodeError => e\n render json: { errors: e.message }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "793a742f63566597badd1abd29514ec3", "score": "0.721665", "text": "def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[0][\"user_id\"])\n activate(@current_user)\n rescue JWT::ExpiredSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError\n raise NotAuthenticatedError\n end", "title": "" }, { "docid": "d7241f5eb731e7f64b6b4d679aef1e55", "score": "0.7198469", "text": "def authorize_user!\n if header_token.blank?\n # Anonymous users can't request current user\n render json: { errors: 'Login required' }, status: :forbidden\n else\n # Token may be invalid\n render json: { errors: 'Not authorized' }, status: :unauthorized unless user_signed_in?\n end\n end", "title": "" }, { "docid": "e1f47d83e6f263d2dc06bce19cfe2154", "score": "0.71932596", "text": "def authenticate!\n error!('401 Unauthorized', 401) unless current_user\n end", "title": "" }, { "docid": "6a4a1debd61a7ebc7f019f7d106d0959", "score": "0.71688855", "text": "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'You are not Authorized, please check your authorization from admin' }, status: 401 unless @current_user\n end", "title": "" }, { "docid": "9aecc55a1b4978fc80e128e68cce074b", "score": "0.7168237", "text": "def authenticate!\n error!('Authorization header is required', :unauthorized) unless headers['Authorization']\n\n @decoded = JsonWebToken.decode(headers['Authorization'])\n if entity_subdomain && entity_subdomain != @decoded[:subdomain]\n error!('Invalid authorization token', :unauthorized)\n end\n\n @current_entity = Entity.find_by!(subdomain: @decoded[:subdomain])\n resource_class = @decoded[:resource_type].constantize\n @current_user = resource_class.find(@decoded[:resource_id])\n rescue ActiveRecord::RecordNotFound => e\n error!('Invalid authorization token', :unauthorized)\n rescue JWT::DecodeError => e\n error!('Invalid authorization token', :unauthorized)\n end", "title": "" }, { "docid": "80aa037d5c691afb3063ebc6215be9a4", "score": "0.71646035", "text": "def authenticate_user\n # Authorization: Bearer <token> is the header the user will pass\n token, _options = token_and_options(request)\n user_id = AuthenticationTokenService.decode(token).to_i\n puts \"Auth Token gives user id of #{user_id}\"\n @current_user = User.find(user_id)\n rescue ActiveRecord::RecordNotFound\n render status: :unauthorized\n rescue JWT::DecodeError\n render status: :unauthorized\n end", "title": "" }, { "docid": "3515b2d160de7a29a2f827a8a173c563", "score": "0.71467227", "text": "def authenticate_request!\n # already authenticated in soft authentication\n return true if @current_user\n extract_user_from_auth_token\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError\n raise_auth_error('JWT Verification')\n rescue JWT::DecodeError\n raise_auth_error('JWT Decode')\n rescue ActiveRecord::RecordNotFound\n raise_auth_error('Record Not Found')\n end", "title": "" }, { "docid": "0cf99358a8dfe17e71cb50e5205233f7", "score": "0.7142674", "text": "def authenticate_request!\n fail AuthenticationError::NotAuthenticatedError unless user_id_in_auth_token?\n @current_user ||= User.find_by(id: decoded_auth_token[:id])\n rescue JWT::ExpiredSignature\n raise AuthenticationError::TimeoutError\n rescue JWT::VerificationError, JWT::DecodeError \n raise AuthenticationError::NotAuthenticatedError\n end", "title": "" }, { "docid": "11c6542b30bfeb38c93d1259c5c70cd6", "score": "0.71419376", "text": "def authenticate_request\n @current_user = AuthenticateApiRequest.call(request.headers).result\n\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n\n end", "title": "" }, { "docid": "4a1515b3cd508da5e710b1d60eac186a", "score": "0.7131244", "text": "def authenticate\n\tauthenticate_header || authenticate_params || render_unauthorized\n end", "title": "" }, { "docid": "85edddc2608f14294be8594c2fbac885", "score": "0.7129189", "text": "def authenticate_user\n auth_token = request.headers[\"auth_key\"]\n if auth_token == SERVER_AUTH_KEY\n return true\n else\n render :status=>401,\n :json =>{:Response => \"Fail\",\n :Data => nil,\n :Message => \"Unauthorized access.\"}\n end \n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "d92080932eee88b1927cab071dc3adf6", "score": "0.71287787", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "f0a144c79ec8130182b9ecad0659aa25", "score": "0.7107503", "text": "def http_header_auth_login\n if !user_signed_in? && request.headers.key?('HTTP_API_AUTHENTICATION')\n credentials = api_credentials(request.headers)\n if http_header_auth?\n u = User.where(email: credentials[:config][:username]).first\n sign_in :user, u\n authenticate_user!\n else\n warden.custom_failure!\n render json: 'Unable to authenticate user.', status: 422\n end\n end\n end", "title": "" }, { "docid": "ceabf15ee31634bb6adda9c10d2bd1e1", "score": "0.7106813", "text": "def authenticate\n begin\n token = request.headers['Authorization'].split(' ').last # token is taken from request headers\n payload, header = AuthToken.valid?(token) #checks to see if token is valid\n @current_organization = Organization.find_by(id: payload['organization_id']) # takes the user id from the payload in order to make current user\n if payload['user_id']\n @current_user = User.find(payload['user_id'])\n end\n rescue\n render json: { error: 'Authorization header not valid'}, status: :unauthorized # 401 if no token, or invalid\n end\n end", "title": "" }, { "docid": "a7c14d744f4b756ab828e6b1e7dd9ed3", "score": "0.7099339", "text": "def authenticate_by_auth_token\n auth_token = request.headers['HTTP_X_TOKEN'].presence\n user = auth_token && User.find_by(auth_token: auth_token)\n\n if user\n @current_user = user\n else\n render nothing: true, status: 401\n end\n end", "title": "" }, { "docid": "c9e8da24b3da3a8747c623143ac259bd", "score": "0.70949155", "text": "def authenticate!\n head :unauthorized unless current_user\n end", "title": "" }, { "docid": "e6527aab37d96e5bce189ebda00b83fd", "score": "0.70925194", "text": "def authenticate!\n headers \"WWW-Authenticate\" => %(Basic realm=\"#{@site.title}\") and\n @error_message = \"Not authorized\\n\" and throw(:halt, [401, erb(:error)]) and\n return unless authenticated?\n end", "title": "" }, { "docid": "baaf4515fb3080d985ce0e38bde2a6bd", "score": "0.70913583", "text": "def authenticate_user\n render json: { error: \"Unauthorized.\" }, status: 401 unless authenticated?\n end", "title": "" }, { "docid": "de65b1b7c8d0b00bbd0d3c79c31e7355", "score": "0.7075326", "text": "def authienticate_with_user_token\n token = request.headers[:token].to_s\n user = User.is_authenticated?(token) if token\n if user.present?\n sign_in user, store:false\n else\n respond_to do |format|\n format.json { render json: {errors: [t('api.token.invalid_token')]}, status: 401}\n format.zip {send_data(\"You are unauthorized\", filename: \"authentication.txt\", status: 401)}\n end\n end\n return user if user \n end", "title": "" }, { "docid": "2ad35eb0e7281fd6cd28dae5c2aa028b", "score": "0.70725644", "text": "def user_auth\n { headers: { \"authorization\" => @auth_token }}\n end", "title": "" }, { "docid": "2ad35eb0e7281fd6cd28dae5c2aa028b", "score": "0.70725644", "text": "def user_auth\n { headers: { \"authorization\" => @auth_token }}\n end", "title": "" }, { "docid": "2ad35eb0e7281fd6cd28dae5c2aa028b", "score": "0.70725644", "text": "def user_auth\n { headers: { \"authorization\" => @auth_token }}\n end", "title": "" }, { "docid": "3f4cc5db27c0faf4900fdd4d11c87588", "score": "0.7072014", "text": "def authenticate_request!\n unless user_id_in_token?\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n return\n end\n @current_user = User.find(auth_token[:user_id])\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "title": "" }, { "docid": "4496d190218e3f72bf0ae4ba9f0caeb4", "score": "0.7068284", "text": "def authenticate_request\n uid = JWT.decode(\n request.headers['Authorization'],\n Rails.application.secrets.secret_key_base\n )[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: { error: 'authentication failed' }, status: 401\n end", "title": "" }, { "docid": "8a577903d372657980cef9819c7bc106", "score": "0.7059226", "text": "def authenticate_request!\n unless user_id_in_token? # Valida que el token que ingresa tenga el id de usuario\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n return\n end\n if auth_token[:secret] == Constant::CONST_SECRET_PASSWORD_TOKEN\n if User.find(auth_token[:user_id])\n @current_user = User.find(auth_token[:user_id]) # Asigan la informacion del current_user\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "title": "" }, { "docid": "b8dbadeafc53af8ccb98c28bbc560832", "score": "0.70531535", "text": "def authenticate\n if ENV['RACK_ENV'] == 'development' or ENV['RACK_ENV'] == 'qa'\n return settings.user\n end\n\n user = request.env[\"HTTP_AUTHORIZATION\"]\n\n if user\n user = Base64.decode64(user[6,user.length-6])[/\\w+/]\n return user\n end\n\n return false\nend", "title": "" }, { "docid": "48a27181c0ee3ac5804b308d88b59f9d", "score": "0.70486516", "text": "def bearer_authenticated?; end", "title": "" }, { "docid": "8f13743a02413ea02c4be247425625f7", "score": "0.70452976", "text": "def authenticate!\n error!('Unauthorized. Invalid or expired token.', 401) unless authenticated_user\n end", "title": "" }, { "docid": "35402df3088446f70b84f122c93064f4", "score": "0.70441306", "text": "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "title": "" }, { "docid": "b1f4a3a3974700876d396b6750772d9e", "score": "0.70425516", "text": "def authenticate\n #\n # Look for X-Auth-Token in headers, and select based on it. That'll tell\n # you who the user is and prove that they're logged in.\n #\n @user = Person.find_by_auth_token(request.headers['HTTP_X_AUTH_TOKEN'])\n if @user.blank?\n render json: {status: \"Not authorized\"}, status: 401\n end\n end", "title": "" }, { "docid": "29eaec8b7201fa23c629e3c91f625ca9", "score": "0.70422816", "text": "def authenticate\n head :unauthorized unless current_user\n end", "title": "" }, { "docid": "5169eb2f573a0490408cfe7656e32aed", "score": "0.70233536", "text": "def authenticate\n# logger.debug \"Host name is: \" + request.host\n# logger.debug \"session user is:\" + (session[:user].nil? ? \"nil\" : session[:user])\n# logger.debug request.headers[\"HTTP_AUTHORIZATION\"].nil? ? \"No auth present in request\" : \"Auth headers present\"\n if session[:user]\n set_auth_vars\n elsif fake_auth_permitted?\n set_fake_auth\n else\n force_auth\n end\n @user\nend", "title": "" }, { "docid": "f93f770c9e0562a483a9d06be553cb2e", "score": "0.7023121", "text": "def auth\n auth_token || render_unauthorized\n end", "title": "" }, { "docid": "e0cd5294c84512f5c3a6277786a6012b", "score": "0.70163465", "text": "def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id])\n rescue JWT::ExpiredSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError\n raise NotAuthenticatedError\n end", "title": "" }, { "docid": "866b4d53a5cc7ad006b1aa3e596692f9", "score": "0.70157254", "text": "def require_login\n @response.add_header('WWW-Authenticate', \"Bearer realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end", "title": "" }, { "docid": "131f5e466b623be99c765e44e8179dbc", "score": "0.70103943", "text": "def authenticate_request\n if auth_token_expired?\n render json: { error: 'Auth token is expired' }, status: 419\n elsif !@current_user\n render json: { error: 'Not Authorized' }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "131f5e466b623be99c765e44e8179dbc", "score": "0.70103943", "text": "def authenticate_request\n if auth_token_expired?\n render json: { error: 'Auth token is expired' }, status: 419\n elsif !@current_user\n render json: { error: 'Not Authorized' }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "7820603b360d436f0420f160acce81bc", "score": "0.7008739", "text": "def auth_header\n fetch_header 'HTTP_AUTHORIZATION'\n rescue KeyError\n log MISSING\n halt [403, HTML, FORBIDDEN]\n end", "title": "" }, { "docid": "70a6fccc3129e1d352aab6851f6a7342", "score": "0.7008407", "text": "def authenticate_request\n token_string = unpack_token_from_header\n\n return false if token_string == false || token_string.nil?\n\n token = Token.new_from_jwt_string(token_string)\n if token.valid?\n @token = token\n return true\n else\n if token.errors?\n render json: {\n errors: token.errors\n }, status: 401\n else\n render json:\n {\n errors:\n [{\n title: 'Unknown token error',\n detail: 'The JWT token you gave was invalid, but no more specific error is known.'\n }]\n }, status: 401\n end\n return false\n end\n end", "title": "" }, { "docid": "07848002bcd71dca71329c2006a438ca", "score": "0.69978386", "text": "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "title": "" }, { "docid": "07848002bcd71dca71329c2006a438ca", "score": "0.69978386", "text": "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "title": "" }, { "docid": "842f3b47779ee8fdf65cddef38904021", "score": "0.6997628", "text": "def authenticate_student_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "title": "" }, { "docid": "72b7975494fa40365ba5b83d316b1016", "score": "0.6993354", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "217deb66e12ba2f0b5377141e40b4922", "score": "0.6988554", "text": "def authenticate()\n\tuser_env = @env[\"Authorization\"] || @env[\"HTTP_AUTHORIZATION\"]\n if user_env\n user = Base64.decode64(user_env[6,user_env.length-6])[/\\w+/]\n\t\treturn user\n else\n \treturn nil\n\tend\nend", "title": "" }, { "docid": "8601e18da235a89a3bd271aff4e4fccf", "score": "0.69825906", "text": "def authenticate\n email = authentication_params['email']\n password = authentication_params['password']\n\n command = Security::AuthenticateUser.call(email, password)\n if command.success?\n user = User.find_by(email: email)\n render json: {\n auth_token: command.result,\n message: 'Set the provided auth_token as Authorization request header value.'\n }, status: :ok\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end", "title": "" }, { "docid": "bcf47b5c3e41cffdb5b2c716f6262048", "score": "0.69820654", "text": "def authenticate\n token = request.headers[\"Authorization\"]&.split(\" \")&.last\n # TODO: for production need to change to RSA or any another similar algo :-)\n decoded_token = JWT.decode(token, nil, false)\n @current_user = decoded_token[0][\"sub\"]\n rescue JWT::DecodeError\n Rails.logger.warn \"Unable to decode JWT token\"\n end", "title": "" }, { "docid": "450935757b12d8fd1c43bd17ef307967", "score": "0.69798464", "text": "def authenticate(user)\n token = Knock::AuthToken.new(payload: { sub: user.id }).token\n request.env['HTTP_AUTHORIZATION'] = \"Bearer #{token}\"\n end", "title": "" }, { "docid": "24fce6b4e2b09a45e81cefb42e061140", "score": "0.69775957", "text": "def authenticate\n \tauthenticate_or_request_with_http_token do |token, options|\n begin\n if params[:controller] == 'user/users' || params[:controller] == 'user/user_normal'\n if params[:id]\n user = User.find(params[:id])\n puts user.name\n end\n else\n if params[:user_id]\n user = User.find(params[:user_id])\n end \n end\n if user != nil\n\n elsif params[:login].include? \"@\"\n user = User.find_by_mail(params[:login])\n else\n user = User.find_by_name(params[:login])\n end\n\n if user == nil \n false\n elsif user.validate(token)\n @user = user\n end\n rescue Exception => e\n answer = Array.new\n answer << 'Usuario no existe'\n respond_to do |format|\n format.json { render json: answer.as_json}\n end\n end \n end \t\n end", "title": "" }, { "docid": "8ff565c9a0cc40cfeada2aade0b267ae", "score": "0.6974834", "text": "def authenticate_user_from_token!\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "344d6e0d09c564877b08de9eee9aec51", "score": "0.69633955", "text": "def authenticate!\n payload, header = JWTAuth.decode_token(auth_token)\n\n user = User.where(\n _id: payload[\"user\"][\"id\"],\n token: auth_token\n ).first\n\n halt 401, error: \"User not found\" unless user\n\n @current_user = user\n @scopes = payload[\"scopes\"]\n\n rescue JWT::DecodeError\n halt 401, error: \"A token must be passed\"\n rescue JWT::ExpiredSignature\n halt 401, error: \"The token has expired\"\n rescue JWT::InvalidIssuerError\n halt 401, error: \"The token doesn't have a valid issuer\"\n rescue JWT::InvalidIatError\n halt 401, error: \"The token does not have a valid \\\"issued at\\\" time\"\n end", "title": "" }, { "docid": "c3e59dbf9b4f5ad455ec52379bdc2a45", "score": "0.6960584", "text": "def authenticate\n render json: {error: \"unauthorized\"}, status: 401 unless logged_in?\n end", "title": "" }, { "docid": "0ab83bb753e4384e7768c21cbd951a3e", "score": "0.69603765", "text": "def authenticate!(request)\n request['Authorization'] = Authentication::Header.new(request, access_key_id, secret_access_key)\n end", "title": "" }, { "docid": "baa5682198edfcfc8597523bece06053", "score": "0.69559604", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "baa5682198edfcfc8597523bece06053", "score": "0.69559604", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "85c01ed91384fc4912465c0956e538cb", "score": "0.69517124", "text": "def authorize! \n authorization = request.headers['HTTP_AUTHORIZATION']\n\n if authorization\n method, jwt = authorization.split(' ')\n decoded_jwt = JWT.decode(jwt, Figaro.env.jwt_secret)\n\n # Find the user if there is any\n user = User.find(decoded_jwt[\"user_id\"])\n\n if user\n # All good here\n @current_user = user\n return\n end\n end\n\n head :unauthorized\n rescue JWT::DecodeError => e # Thrown if the secret is incorrect\n head :unauthorized\n end", "title": "" }, { "docid": "2c253b524051a09be0960c3e3803a04c", "score": "0.69423294", "text": "def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\nend", "title": "" }, { "docid": "fe0b519d0f4badf4b72a969296131d39", "score": "0.69366586", "text": "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "title": "" }, { "docid": "f25ddc8b8381231e912331eaca50f179", "score": "0.69364476", "text": "def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n user_login = options.blank?? nil : options[:login]\n user = user_login && User.find_by(login: user_login)\n if user && ActiveSupport::SecurityUtils.secure_compare(user.authentication_token, token)\n render json: { error: 463 }, status: 463 if user.token_expires_at < Time.now\n @current_user = user\n else\n render json: {error: 401}, status:401\n end\n end", "title": "" }, { "docid": "7cb934c8d54e31772737485062d9989a", "score": "0.6925618", "text": "def authenticated!\n error(401) unless current_user\n end", "title": "" }, { "docid": "e77bad5ad6584cfb6f48c2a2050923e5", "score": "0.6922427", "text": "def verify_authentication_header\n case raw_response.headers['WWW-Authenticate']\n when /error\\=\\\"invalid_token\\\".*expired/\n fail OauthTokenExpired\n when /error\\=\\\"invalid_token\\\".*revoked/\n fail OauthTokenRevoked\n end\n end", "title": "" }, { "docid": "9b773a9f2ca0fc4a8135f4dbf665033f", "score": "0.6907272", "text": "def process_authorization_header\n auth = request.headers[\"Authorization\"]\n\n if auth.is_a?(String) && auth =~ /^Key (.+)$/\n key = $1\n begin\n decrypted = JSON.parse(rails_encryptor.decrypt_and_verify(key))\n if decrypted.is_a?(Hash) && decrypted[\"context\"].is_a?(Hash)\n fields = %w(user_id username token expiration org_id).map { |f| decrypted[\"context\"][f] }\n # Flag indicating, that user is calling from CLI\n fields.push(true)\n init_context(*fields)\n end\n rescue\n end\n end\n end", "title": "" }, { "docid": "c96ff6a25e94a1c0bbd80b86e4fbc82e", "score": "0.6903671", "text": "def authenticate\n authenticate_token || render_unauthorized\n end", "title": "" }, { "docid": "52a89de4aee8318cee2fd2668a73f6ca", "score": "0.6900128", "text": "def authenticate_user_from_token!\n user_token = params[:auth_token] || request.headers[\"HTTP_AUTH_TOKEN\"]\n user = user_token && User.find_by_authentication_token(user_token)\n if !user || user.authentication_token != user_token\n render :json => {:success=>false, :message=>\"You are not authorized to perform this action\"}, :status=>401 if !params[:controller].include?('admin') \n end\n end", "title": "" } ]
2b797fac089de0fb6770d4a75a89a8d4
GET /indexed_files/new GET /indexed_files/new.json
[ { "docid": "a25f4794ea4cd869cc9bd99ce913517b", "score": "0.8342747", "text": "def new\n @indexed_file = IndexedFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indexed_file }\n end\n end", "title": "" } ]
[ { "docid": "aafe9e094924a3b236045c67f6801ad1", "score": "0.7571444", "text": "def create\n @indexed_file = IndexedFile.new(params[:indexed_file])\n\n respond_to do |format|\n if @indexed_file.save\n format.html { redirect_to @indexed_file, notice: 'Indexed file was successfully created.' }\n format.json { render json: @indexed_file, status: :created, location: @indexed_file }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indexed_file.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c85a4bd862fbad9fd3579afb07b93b7", "score": "0.6648316", "text": "def new\n @indexed_gif = IndexedGif.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indexed_gif }\n end\n end", "title": "" }, { "docid": "3f05718b14876467341f1f84744153d5", "score": "0.663503", "text": "def new\n @images_index = ImagesIndex.new nil\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @images_index }\n end\n end", "title": "" }, { "docid": "c27e48f2e315b0e43f393e4866c7180d", "score": "0.65779585", "text": "def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end", "title": "" }, { "docid": "b20cdc2ddb00d3ce9b528de2a3f3da22", "score": "0.65667194", "text": "def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_version }\n end\n end", "title": "" }, { "docid": "59d3ecc9594eff00a4e3d8c44d40e5a5", "score": "0.65462583", "text": "def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end", "title": "" }, { "docid": "937098fe9798f7570f357202c72445d7", "score": "0.6463528", "text": "def new\n @store_indices_information = Store::Indices::Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_indices_information }\n end\n end", "title": "" }, { "docid": "d2ec5661f6e6f4961a8bd15d730988a7", "score": "0.6446985", "text": "def new\n @node_index = NodeIndex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_index }\n end\n end", "title": "" }, { "docid": "f0dc9b6faba342f9d18bc9aaca14ba5c", "score": "0.6376829", "text": "def show\n @indexed_file = IndexedFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexed_file }\n end\n end", "title": "" }, { "docid": "d47e6acc5bb95e26c997e505ea2e669a", "score": "0.63147676", "text": "def new\n @file_record = FileRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_record }\n end\n end", "title": "" }, { "docid": "3b5622c80cfcf49cf76e0efb1828865a", "score": "0.63041997", "text": "def new\n @inventory_file = InventoryFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @inventory_file }\n end\n end", "title": "" }, { "docid": "bd10913fc2dfa59e33fe1da32b683d98", "score": "0.62907135", "text": "def open_index_file\n end", "title": "" }, { "docid": "c45464cabfdff19247e57c7743caa07e", "score": "0.62586004", "text": "def new\n @test_file = TestFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_file }\n end\n end", "title": "" }, { "docid": "595d9678cfa321fc37f3a97da3bda320", "score": "0.6247576", "text": "def new\n @raw_file = RawFile.new\n\n respond_to do |format|\n format.html { render :new, :locals => { :raw_file => @raw_file } } # new.html.erb\n format.json { render :json => @raw_file }\n end\n end", "title": "" }, { "docid": "ff1f94471d68374cacf97d184e1fba71", "score": "0.6243599", "text": "def new\n @file_sequence = FileSequence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_sequence }\n end\n end", "title": "" }, { "docid": "686aa699481e9924bc5295c058559199", "score": "0.6225428", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @documents.map{|document| document.to_jq_upload } }\n \n end\n end", "title": "" }, { "docid": "d22535f118ffe2e102ca9aa978b4a3a5", "score": "0.6215075", "text": "def new\n @index = Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "title": "" }, { "docid": "37a91ada196abba4ad188883f99d2d23", "score": "0.62072265", "text": "def new\n @action_file = ActionFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @action_file }\n end\n end", "title": "" }, { "docid": "e6cc39dd2939a73c235175ce552b438b", "score": "0.61823815", "text": "def new\n @event_import_file = EventImportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event_import_file }\n end\n end", "title": "" }, { "docid": "ea163fff97dc9b906ea5fa39dfab996f", "score": "0.6179829", "text": "def new\n @treq = Treq.new\n @treq = @treq.incrament(@treq)\n @treq_file = @treq.treq_files.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @treq }\n end\n end", "title": "" }, { "docid": "00e2bbdf478f4152cb811797e5a847fa", "score": "0.61687005", "text": "def new\n index\n end", "title": "" }, { "docid": "16a24464c04b2447db70882951ae8c71", "score": "0.61492133", "text": "def new\n @indexer_task = IndexerTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indexer_task }\n end\n end", "title": "" }, { "docid": "c125c60c9dd5b56f93aeee06f6f7c5fc", "score": "0.6132289", "text": "def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "title": "" }, { "docid": "bd708fdddddfd07d3129695c8c2538fa", "score": "0.61232215", "text": "def new\n @arquivo = Arquivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arquivo }\n end\n end", "title": "" }, { "docid": "bd708fdddddfd07d3129695c8c2538fa", "score": "0.61231583", "text": "def new\n @arquivo = Arquivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arquivo }\n end\n end", "title": "" }, { "docid": "ae33a75ccc687132b9227fdddd5dc5ba", "score": "0.6104798", "text": "def new\n @home_categories_products_indices_photo = Home::Categories::Products::Indices::Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_categories_products_indices_photo }\n end\n end", "title": "" }, { "docid": "6e51178a68c9cd9ccf4b2932381dd0a2", "score": "0.60976213", "text": "def new\n #-------------------------------------------------------------------------------------------\n=begin \n document = CloudSearch::Document.new(:type => \"add\", # or \"delete\"\n :version => 12345,\n :id => 679,\n :lang => :en,\n :fields => {\n :actor => [\"PSI Marques\", \"WilPSI Fernandes\"], \n :director => [\"PSI, George\"], \n :text_relevance => '309',\n :title => \"Star Wars\"}) \n \n indexer = CloudSearch::Indexer.new\n indexer << document # add as many documents as you want (CloudSearch currently sets a limit of 5MB per documents batch)\n #sindexer.index\n render :text =>'<pre>'+CloudSearch.config.document_url.to_yaml and return true\n=end \n #-------------------------------------------------------------------------------------------\n @product = Product.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n\n end", "title": "" }, { "docid": "19fa2a3dcac22041d54c2c87b18937f7", "score": "0.6085705", "text": "def new_files; end", "title": "" }, { "docid": "d85011e821a0cddc6d38b801e1ffc12e", "score": "0.60783786", "text": "def new\n @resource_file = ResourceFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_file }\n end\n end", "title": "" }, { "docid": "8b2523890c98da8bc1f48c31d05870d8", "score": "0.6074052", "text": "def new\n @special_document = ModifiedDocument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_document }\n end\n end", "title": "" }, { "docid": "44badae4d67749d7e71ba7dee8848095", "score": "0.60674596", "text": "def new\n @file_project = FileProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_project }\n end\n end", "title": "" }, { "docid": "85c501b6a2b792304c9743084b175007", "score": "0.6052212", "text": "def index_new\n Index.new(self)\n end", "title": "" }, { "docid": "842a070f2080b0437ea08a323f0bfb91", "score": "0.60422194", "text": "def new\n @agent_import_file = AgentImportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @agent_import_file }\n end\n end", "title": "" }, { "docid": "e109442a37406526b12e72f1cb492d38", "score": "0.60384", "text": "def new\n @super_file = SuperFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @super_file }\n end\n end", "title": "" }, { "docid": "1d4a84588e6da2437e2b6fc558ff2fed", "score": "0.6018808", "text": "def new\n @storage_array = StorageArray.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storage_array }\n end\n end", "title": "" }, { "docid": "f7e68eaa401495a357ccc8801496ed72", "score": "0.5996638", "text": "def new\n @up_file = UpFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @up_file }\n end\n end", "title": "" }, { "docid": "75ce6b6994cb8e7986f0966b05bb0890", "score": "0.59932005", "text": "def new\n @mfile = Mfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mfile }\n end\n end", "title": "" }, { "docid": "13cc1bbce6d9733804d9e666d4da43e5", "score": "0.5973497", "text": "def new\n \n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n \n end", "title": "" }, { "docid": "4a85a09483dea47c772a55657f588f0d", "score": "0.59621096", "text": "def new\n @pgn_file = PgnFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgn_file }\n end\n end", "title": "" }, { "docid": "a55a0106102182ea19fa40c0b5825ec0", "score": "0.5943011", "text": "def new\n @virtual_storage_array = VirtualStorageArray.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @virtual_storage_array }\n end\n end", "title": "" }, { "docid": "2cbe178847dc24e7c074ad0e66c501c2", "score": "0.5934423", "text": "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "title": "" }, { "docid": "2cbe178847dc24e7c074ad0e66c501c2", "score": "0.5934423", "text": "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "title": "" }, { "docid": "a783d4d6071731922ab75d792e29e9a3", "score": "0.59065974", "text": "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @upload }\n end\n end", "title": "" }, { "docid": "f773969c3e2e6a362cc7a681cd8c8b7e", "score": "0.59063756", "text": "def new_files\n metadata_files if @existing_files.nil?\n @new_files\n end", "title": "" }, { "docid": "afbc197107713f02e6902d6f6d7d5ba3", "score": "0.5904048", "text": "def new\n @report_file = ReportFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_file }\n end\n end", "title": "" }, { "docid": "8b97411d84ebf77d94a33fa25ffeb8bc", "score": "0.58997625", "text": "def new\n @document_history = DocumentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_history }\n end\n end", "title": "" }, { "docid": "8f313e435d3c285f38daca514043f3f3", "score": "0.5890233", "text": "def create\n @indexed_gif = IndexedGif.new(params[:indexed_gif])\n\n respond_to do |format|\n if @indexed_gif.save\n format.html { redirect_to @indexed_gif, notice: 'Indexed gif was successfully created.' }\n format.json { render json: @indexed_gif, status: :created, location: @indexed_gif }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indexed_gif.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72514c5807b819b2ae3253d3513cd336", "score": "0.58873236", "text": "def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end", "title": "" }, { "docid": "b49c4e920f5dbc5e230b03104342463c", "score": "0.58852154", "text": "def index\n create\n end", "title": "" }, { "docid": "24e44a070edb5cbdc074cc0ee73870aa", "score": "0.58804935", "text": "def bulk_new\n @bulk_new = BulkNew.new\n\n respond_to do |format|\n format.html # bulk_new.html.erb\n format.json { render json: @bulk_new }\n end\n end", "title": "" }, { "docid": "7c862c9e9d31fe139f053f180425864d", "score": "0.58674204", "text": "def create_index(index)\n\n parsed = @http.put(\"http://#{@host}:#{@port}/#{index}\")\n ok = parsed[\"ok\"]\n @logger.error(\"parsed???\", :parsed => parsed)\n\n @logger.error(\"create_index ok\", :ok => ok, :index => index)\n\n @http.get(\"http://#{@host}:#{@port}/_flush\")\n\n end", "title": "" }, { "docid": "72ccf6c6c648fd1b48570eeeaf3a6215", "score": "0.5860959", "text": "def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer }\n end\n end", "title": "" }, { "docid": "78169df321f35b9d2c107b565e2c7caa", "score": "0.5845763", "text": "def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end", "title": "" }, { "docid": "78169df321f35b9d2c107b565e2c7caa", "score": "0.58449984", "text": "def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end", "title": "" }, { "docid": "78169df321f35b9d2c107b565e2c7caa", "score": "0.58449984", "text": "def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end", "title": "" }, { "docid": "78169df321f35b9d2c107b565e2c7caa", "score": "0.58449984", "text": "def new\n @upload = Upload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @upload }\n end\n end", "title": "" }, { "docid": "19a17ccda040097ec4598b93c7bc2c63", "score": "0.58085793", "text": "def new\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @attachment }\n end\n end", "title": "" }, { "docid": "e445e77442ce642d6095ff17124e199f", "score": "0.58085626", "text": "def new\n # Add second slash to url that rails routing eats\n url = request.fullpath.gsub(/\\/http(s?)\\:/, 'http:/')\n\n gif = Gif.find_or_initialize_by(url: url){|g| g.remote_gif_url = url}\n\n if gif.new_record? && gif.save\n load_index_data\n flash.now[:success] = thumb_flash(gif, \"Created gif!\")\n else\n if gif.errors.include? :checksum\n found = Gif.where(checksum: gif.checksum).first\n flash.now[:notice] = thumb_flash(found, \"We've got that GIF!\")\n end\n end\n \n load_index_data\n render action: 'index'\n end", "title": "" }, { "docid": "08399d7a3cce19958a9048205d7a5103", "score": "0.5806852", "text": "def new\n @userfile = Userfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @userfile }\n end\n end", "title": "" }, { "docid": "cd6b6ba0b1b7a9aa3c683d9b3d5ec4a2", "score": "0.57870924", "text": "def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\n end\n end", "title": "" }, { "docid": "523ebaf0a73d03bbc3dc385cc81079a9", "score": "0.57843846", "text": "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "4f09342ab0e7b99d89bcc36b00026e8c", "score": "0.5767766", "text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "45473ed0174ab0d4f4ccc81dc792d615", "score": "0.57660526", "text": "def index_create\n @workouts = Workout.where(creator_id: current_athlete.id)\n render 'index_create.json.jbuilder', status: :created\n end", "title": "" }, { "docid": "cb4604ecdb9a8157774694118b0bba6a", "score": "0.5754919", "text": "def new\n @user_file = UserFile.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_file }\n end\n end", "title": "" }, { "docid": "087a29f1545006a40c215df01c41afa0", "score": "0.57543874", "text": "def new\n @csv_file = CsvFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csv_file }\n end\n end", "title": "" }, { "docid": "efa5c5709a23f86f20ac00075a0ee1a8", "score": "0.57528615", "text": "def index\n @uploads = Upload.all\n \n @upload = Upload.new\n \n respond_to do |format|\n format.html \n format.json { render json: @uploads } \n end\n end", "title": "" }, { "docid": "8a96f162b3574843d22754095df6f926", "score": "0.5744402", "text": "def new\n @file_upload = FileUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @file_upload }\n end\n end", "title": "" }, { "docid": "1625995ca465877b0a86750e8f2f95d2", "score": "0.5742524", "text": "def new\n @purchase_file = PurchaseFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_file }\n end\n end", "title": "" }, { "docid": "c6373d0aa0b698a2455ff542a772a39a", "score": "0.5742482", "text": "def index\n @new_s = New.all\n end", "title": "" }, { "docid": "0959bbe500246a3b24f5fb593c146029", "score": "0.5732765", "text": "def new\n @backup_file = BackupFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @backup_file }\n end\n end", "title": "" }, { "docid": "d705b61e248ae0054639c9887c0d33b8", "score": "0.5723317", "text": "def new\n @journal_import = JournalImport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @journal_import }\n end\n end", "title": "" }, { "docid": "c09a1498262e5d7c3c507968e845ec4c", "score": "0.57148767", "text": "def create\n @git_repo = GitRepo.new(params[:git_repo])\n \n respond_to do |format|\n if @git_repo.save\n flash[:notice] = 'GitRepo was successfully created.'\n if reindex(@git_repo.path, {:id => @git_repo.id, :git_repo_path => @git_repo.path, :git_repo_name => @git_repo.name})\n flash[:notice] += ' Search Index was updated successfully'\n end\n format.html { redirect_to(@git_repo) }\n format.xml { render :xml => @git_repo, :status => :created, :location => @git_repo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @git_repo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e78fc358ae919322be24a822dc920a0c", "score": "0.5712309", "text": "def new\n @importtodb = Importtodb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importtodb }\n end\n end", "title": "" }, { "docid": "ef6179690923b10e24a84291eeed5c6d", "score": "0.5706901", "text": "def new\r\n @document = Document.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @document }\r\n end\r\n end", "title": "" }, { "docid": "e436c0f32985c7c5673ad850d525135b", "score": "0.5695895", "text": "def new\n @csv_upload = CsvUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csv_upload }\n end\n end", "title": "" }, { "docid": "43f324806f60466d137b733e0ad8d992", "score": "0.56924605", "text": "def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end", "title": "" }, { "docid": "f13b52dc7c82993499cd55da0034789d", "score": "0.5688382", "text": "def new\n @home_index = Home::Index.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_index }\n end\n end", "title": "" }, { "docid": "66031d79d2b858fc2c93b7ec5696fbe9", "score": "0.5688189", "text": "def index\n new\n end", "title": "" }, { "docid": "f773d1e7c524b8539bcaceb8ee942fd4", "score": "0.56873053", "text": "def open_index_file\n @index = File.open(@index_path, 'rb')\n end", "title": "" }, { "docid": "4cc1832e5cc2df4fb5a3cc4bfcee3703", "score": "0.5686696", "text": "def new\n @document = Document.new\n @keyfinding = Keyfinding.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end", "title": "" }, { "docid": "2e4604e437abdd9d511fbd7081474fef", "score": "0.5685969", "text": "def create\n @images_index = ImagesIndex.new(params[:images_index])\n\n respond_to do |format|\n if @images_index.id!= nil and @images_index.id!= \"\"\n ImagesIndex.update @images_index\n else\n ImagesIndex.add @images_index\n end\n format.html { redirect_to(\"/images_indices\", :notice => 'Images index was successfully created.') }\n end\n end", "title": "" }, { "docid": "77cbb16beeffafa9ce09bb9e737b16cb", "score": "0.56859237", "text": "def create\n @index = Indice.new(params[:index])\n\n respond_to do |format|\n if @index.save\n format.html { redirect_to(@index, :notice => 'Indice was successfully created.') }\n format.xml { render :xml => @index, :status => :created, :location => @index }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @index.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "17806491772965d6680b78c952dbdf31", "score": "0.56858504", "text": "def add_assets\n num_files = params[:count].to_i\n \n @new_assets = []\n @new_assets_html = []\n num_files.times do |file_num|\n # recreate the file key from the current index\n file = params[\"file-\"+file_num.to_s]\n @asset = Asset.new(:name => file.original_filename)\n @asset.save\n @asset.save_file(file)\n \n @new_assets.push(@asset)\n # render the html to add to the page for the json response\n asset_html = render_to_string :partial => \"shared/asset.html.haml\", :locals => { :asset => @asset }\n @new_assets_html.push(asset_html)\n end\n\n respond_to do |format|\n format.html { redirect_to assets_url, notice: 'Asset was successfully created.' }\n format.json { render json: {:assets => @new_assets, :assets_html => @new_assets_html, status: :created} }\n end\n\n end", "title": "" }, { "docid": "eb1520d740a51eb7fe755fa7fee98d1f", "score": "0.5674997", "text": "def index\n @incidentfiles = Incidentfile.all\n end", "title": "" }, { "docid": "c75e41f87e8604c5c75279806b34aba4", "score": "0.5663503", "text": "def new\n @hdfs_path = HdfsPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hdfs_path }\n end\n end", "title": "" }, { "docid": "68fcce1bd47ea811113a1f2f93ce2b0d", "score": "0.5655555", "text": "def new\n @status = Status.new\n @status.build_document\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "title": "" }, { "docid": "65ad0228aec679b44d1ec94f640914de", "score": "0.5653549", "text": "def new\n @nfer = Nfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nfer }\n end\n #for bulk imports\n #http://www.funonrails.com/2012/01/csv-file-importexport-in-rails-3.html\n end", "title": "" }, { "docid": "99a8982c6222c9f032b37727bc1c18d2", "score": "0.5643301", "text": "def new\n @event_import_file = EventImportFile.new\n @event_import_file.default_library = current_user.profile.library\n @event_import_file.default_event_category = @event_categories.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_import_file }\n end\n end", "title": "" }, { "docid": "d849829a11c7b14d8fad20568beb9382", "score": "0.56398505", "text": "def new\n 1.times { @work.work_documents.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work }\n end\n end", "title": "" }, { "docid": "1bf9c07b38cf58223483f7c08920f1e4", "score": "0.5634292", "text": "def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "title": "" }, { "docid": "c3e2edab78630e3d95fc245964d0190e", "score": "0.5631311", "text": "def create\n @node_index = NodeIndex.new(params[:node_index])\n\n respond_to do |format|\n if @node_index.save\n format.html { redirect_to @node_index, notice: 'Node index was successfully created.' }\n format.json { render json: @node_index, status: :created, location: @node_index }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_index.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c90ba5b87f3c115126236205ef5bc52e", "score": "0.5624904", "text": "def new\n @image_upload = ImageUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_upload }\n end\n end", "title": "" } ]
de7f3434f3eb9126612537d9818c3be1
TODO: we may want to remove unsaved (those without user_id) items from the database when removed from history
[ { "docid": "79bf2eed22538e1c46867af8f48ebe89", "score": "0.0", "text": "def clear\n if session[:history].clear\n flash[:notice] = I18n.t('blacklight.search_history.clear.success')\n else\n flash[:error] = I18n.t('blacklight.search_history.clear.failure')\n end\n\n redirect_back fallback_location: blacklight.search_history_path\n end", "title": "" } ]
[ { "docid": "8d5b615f8d7b92b027bc9a8d34d3c456", "score": "0.62304837", "text": "def remove_item\n\tsaved = current_user.saved\n\titem = saved.items.find(params[:item])\n saved.items.delete(item)\n redirect_to :back\n\tend", "title": "" }, { "docid": "82e2bc8f81fffbdf3dfa4fb8550f84b8", "score": "0.60901266", "text": "def history_items=(value)\n @history_items = value\n end", "title": "" }, { "docid": "797496c676fc91ff8a699c7ff0381c52", "score": "0.6070547", "text": "def save_items\n self.items.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_items.each { |c| c.save unless c.nil? } unless self.added_items.nil?\n end", "title": "" }, { "docid": "b1230128005c23693db68b1b46f2dfd7", "score": "0.6054165", "text": "def void_last_transaction\n#save add item to last transaction\n#take total and items list, and remove last transaction\n self.total -= self.last_transaction\n @title.pop\n end", "title": "" }, { "docid": "623f2c7d5bbd9c553c6eaaac17dcd1bc", "score": "0.59593153", "text": "def history_items\n return @history_items\n end", "title": "" }, { "docid": "3ab76397052280af9911c3ac0c25be01", "score": "0.59590656", "text": "def undolist\n @rank_participants = RankParticipant.only_deleted.reverse\n end", "title": "" }, { "docid": "f7331814437fd076552e50be6914d17f", "score": "0.5958753", "text": "def before_destroy_with_historic\n before_destroy_without_historic\n historic_copy_to_history\n end", "title": "" }, { "docid": "0506b41171a7f1ee338267565fb4c620", "score": "0.5882517", "text": "def undolist\n @ranks = Rank.only_deleted.reverse\n end", "title": "" }, { "docid": "b58b3ee39ddcf323d92d21cdef0697ac", "score": "0.5876551", "text": "def clear!\n @items.clear\n save\n end", "title": "" }, { "docid": "3f6c64751bae30c747704e267f12dd12", "score": "0.58427894", "text": "def clear!\n items.clear\n save\n end", "title": "" }, { "docid": "c5277bc6accf1d93969ef023c8f719f9", "score": "0.5792043", "text": "def add_bmet_item_history\n @original_bmet_item = BmetItem.find_by_id(self.id)\n if @original_bmet_item.try(:status) != self.status\n BmetItemHistory.create(\n :bmet_item_id => self.id,\n :bmet_item_status => self.status\n )\n end\n if @original_bmet_item.try(:condition) != self.condition\n BmetItemHistory.create(\n :bmet_item_id => self.id,\n :bmet_item_condition => self.condition\n )\n end\n end", "title": "" }, { "docid": "7fd591ab2c6973502523dba045b1a553", "score": "0.5788986", "text": "def remove_item\n\n end", "title": "" }, { "docid": "11383c859fa524d0a99865e7940d9db6", "score": "0.57669437", "text": "def remove_have\n if params[:id].present? and params[:remove_have].present?\n if params[:from_haves_tab] == 'true'\n @user = current_user\n # @have_items = @user.items\n item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n if item.present?\n # item.destroy\n item.update_attribute(\"status\",\"DELETED\")\n end\n flash[:info] = \"Item has been removed from your Haves Board .\"\n redirect_to haves_user_path(@user, :delete => item.id)\n # elsif params[:from_my_offers_tab] == 'true'\n # @user = current_user\n # @have_items = @user.have_items\n # item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n # item.destroy\n # params[:id] = params[:original_id]\n # @item = Item.find_by_id(params[:id])\n # @offer_ids = @item.current_offers.pluck(:offer_id)\n # @useritems = @user.items\n # @useritem_ids = @useritems.pluck(:id)\n # elsif params[:from_items_index] == 'true'\n # # item = Item.find_by_id(params[:id])\n # # item.destroy\n # respond_to do |format|\n # format.js\n # format.html { redirect_to items_path}\n # end\n end\n end\n end", "title": "" }, { "docid": "c841cf39c525a917dadbca43b4146e1c", "score": "0.57525796", "text": "def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend", "title": "" }, { "docid": "b78c3798ea7ed71e2482a9ede60e3947", "score": "0.5709495", "text": "def remove_from_hot_list\n self.update_attribute(:added_to_hot_list, nil)\n end", "title": "" }, { "docid": "89f595bfaf7b54d3deef897ba12f34e6", "score": "0.5708718", "text": "def remove_everything_about_testuser\n list_of_activerecords = [\n Follow.find_by(leader_id: TESTUSER_ID),\n Follow.find_by(user_id: TESTUSER_ID),\n Mention.find_by(username: TESTUSER_NAME),\n Tweet.find_by(user_id: TESTUSER_ID),\n User.find_by(username: TESTUSER_NAME)\n ]\n list_of_activerecords.each { |ar| destroy_and_save(ar) }\nend", "title": "" }, { "docid": "e19e2072dc49e8ee8f79bca5a4eabb96", "score": "0.56919736", "text": "def remove_item(user, item)\n before = get_item_count\n self.items.delete(item)\n after = get_item_count\n (before-after-1).times do\n user.add_to_list(item)\n end\n end", "title": "" }, { "docid": "f4ae9fffe0692a30386ad8352e42632b", "score": "0.5674254", "text": "def set_saved_list\n user = User.find_by(id: params[:id])\n @saved_list = user.saved_list\n end", "title": "" }, { "docid": "f5983bc17b08d0299139d6ae6f650970", "score": "0.5652803", "text": "def set_item_history\n @item_history = BmetItemHistory.find_by_id(params[:id])\n end", "title": "" }, { "docid": "c2910546b90f3ae7413a6f6955470fd2", "score": "0.5631053", "text": "def remove_from\n begin\n study = Study.find(params[:study_id])\n unless study.user_id != session[:user_id] || study.active\n params[:items].each do |i|\n item = Item.find(i)\n unless item.study_id != params[:study_id].to_i\n item.destroy\n end\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end", "title": "" }, { "docid": "2d3a9bd8a5a91fa0478bf0e383a462b6", "score": "0.5626947", "text": "def undo()\n return @history.pop\n end", "title": "" }, { "docid": "7948140de7166e0454f12adfd710a059", "score": "0.5600948", "text": "def history\n @submissions = current_user.submissions.order('created_at desc')\n end", "title": "" }, { "docid": "97688157be0b8af17bc7cb310bf031e8", "score": "0.5590129", "text": "def delete\n newTodos = []\n\n @@allTodos.each { |item|\n if item['id'] != @id\n newTodos.push(item)\n end\n }\n\n @@allTodos = newTodos\n Todo.presist_data\n end", "title": "" }, { "docid": "2641eaa69457671704581b90145c022a", "score": "0.5588926", "text": "def recently_saved_by(user, options = {})\n relation = user.listing_saves\n if options[:limit].present?\n relation = relation.limit(options[:limit])\n end\n if options[:exclude_sellers].present?\n exclude_seller_ids = Array.wrap(options[:exclude_sellers]).compact.map { |u| u.is_a?(User) ? u.id : u }\n relation = relation.joins(:listing).\n where(\"#{Listing.quoted_table_name}.seller_id NOT IN (?)\", exclude_seller_ids)\n end\n relation.order(\"#{ListingCollectionAttachment.quoted_table_name}.created_at DESC\")\n end", "title": "" }, { "docid": "9a1b5ca42c297d3352ca8cf122faa764", "score": "0.55878675", "text": "def write_history\n date = Time.now.send(\"beginning_of_#{self.class.config[:delete_from]}\") # ustawia okres w ktorym usuwamy stara historie. domyslnie jeden dzień\n self.send(self_class_name+'_histories').find_all_from_beginning_date(date).each {|ch| ch.destroy } if self.has_history_from?(date)\n \"History::#{self_class_name.camelize}History\".constantize.new(:date => Time.now, :owner => self, :value => self).save\n end", "title": "" }, { "docid": "9b68b7fe19045aba139133fbc0ec1c2a", "score": "0.5551107", "text": "def index\n @history_items = HistoryItem.all\n end", "title": "" }, { "docid": "7398d8352438effdb3990b4702665acc", "score": "0.55477107", "text": "def history\n @history ||= PublicEarth::Db::History.many.descriptive_changes_by_user(self.id)\n end", "title": "" }, { "docid": "449b3b5345335d15c27ef197fab38175", "score": "0.55373585", "text": "def destroy\n if session[:history].delete_at(params[:id].to_i)\n flash[:notice] = \"Successfully removed that search history item.\"\n else\n flash[:error] = \"Couldn't remove that search history item.\"\n end\n redirect_to :back\n end", "title": "" }, { "docid": "6ca46ab4206f1f36793c733d47e2dec0", "score": "0.5535417", "text": "def remove_all()\n @items.clear()\n end", "title": "" }, { "docid": "fc85384b8a172e2cc4c1810517a3ef19", "score": "0.5528213", "text": "def remove_last_item_from_items_collected_at_desk\n $items_collected.delete($items_collected.last)\n# returns user to previous task of choosing item from desk\n desk_options\nend", "title": "" }, { "docid": "39be6fdad9b4db3b4f9dd94c7cd7a6bb", "score": "0.5517869", "text": "def discard_saved_state\n end", "title": "" }, { "docid": "59cab62c9e42e7e57e49d41d43ba866f", "score": "0.5511527", "text": "def restore\n @item = @collection.items.get(params[:item_id])\n old_item = @item.versions.first(:deleted_at => params[:deleted_at])\n att = old_item.attributes\n att.delete(:deleted_at)\n att.delete(:original_uid)\n att.delete(:id)\n if @item.update(att)\n flash[:notice] = \"Item Restored Successfully!\"\n redirect_to project_collection_item_path(@project, @collection, @item)\n else\n flash[:error] = \"Item failed to restore!\"\n render :show\n end\n end", "title": "" }, { "docid": "13952d5e53e8c342140adeccfa895e27", "score": "0.5500673", "text": "def clean_up!\n puts Item.where(thread_id: self.uid).count\n Item.where(thread_id: self.uid).destroy_all\n @forum_items = []\n self.items = []\n self.items_md5 = nil\n save\n end", "title": "" }, { "docid": "06b2c9b7ab1d3bf44fb144cdf2dc1f10", "score": "0.5479337", "text": "def invalidate_history!\n @history = nil\n end", "title": "" }, { "docid": "b4b53bb7bf68e50525207e625a4a6b65", "score": "0.5447006", "text": "def destroy\n if has_history?\n update(active: false)\n else\n super\n end\n end", "title": "" }, { "docid": "b0dd2e2b5be6564fdbf4e47ca2280580", "score": "0.54399985", "text": "def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end", "title": "" }, { "docid": "09652bbaf37a9ce9d642ff1139c4532b", "score": "0.54254067", "text": "def deleteItems\n self.items.each do |item|\n item.delete\n end\n end", "title": "" }, { "docid": "91bf32d0397f7ec6fda4923dfb9b2d03", "score": "0.5423721", "text": "def add_to_history(item)\n found = nil\n Readline::HISTORY.each_with_index do |h,i|\n if h == item\n found = i\n break\n end\n end\n Readline::HISTORY.delete_at(found) if found\n Readline::HISTORY.push(item)\nend", "title": "" }, { "docid": "1aa7f655212ac73ad5d5add339002bbb", "score": "0.54180086", "text": "def unsaved?(item = nil)\n item ||= default_to_self\n last_saved = item[:last_saved]\n updated_at = item[:updated_at]\n last_saved.blank? || (updated_at.present? && (last_saved < updated_at))\n end", "title": "" }, { "docid": "45b3ff60a65a07441b41df2be4eed28f", "score": "0.54149354", "text": "def set_history_item\n @history_item = HistoryItem.find(params[:id])\n end", "title": "" }, { "docid": "9d80df9c9cea23fb6035fc9c2bb14a00", "score": "0.54144865", "text": "def remove\n empty if @playlist.length <= 0\n item_names = @playlist.map { |item| \"#{item['name']} by #{item['artist']}\" }\n item_names << 'Back'\n selection = @prompt.select('Which track would you like to remove?', item_names).split(' by ')\n menu if selection == 'Back'\n @playlist.each_with_index do |item, index|\n @user.playlist.delete_at(index) if item['name'] == selection[0]\n end\n update_playlist\n end", "title": "" }, { "docid": "903bdc219a5c304871bdfa99da1394fb", "score": "0.5412951", "text": "def compress_history()\n if self.counts[actor][\"requests\"].length > self.history_length\n to_delete = self.counts[actor][\"requests\"].length - self.history_length\n self.counts[actor][\"requests\"].slice!(0..to_delete-1)\n end\n end", "title": "" }, { "docid": "6e28fcb0dfc5b38cacacf2160e5d5227", "score": "0.5412168", "text": "def history\r\n []\r\n end", "title": "" }, { "docid": "4355b39897ed479dca6f21ebf6511f50", "score": "0.540483", "text": "def process_menu_authorization user, items\n to_delete = []\n if items\n for item in items\n if not item.allow_all_access and not user.authorized?(item.controller, item.action)\n to_delete << item\n end\n item.items = process_menu_authorization user, item.items\n end\n items -= to_delete\n end\n items\n end", "title": "" }, { "docid": "068a0f02a2f8dcd5d9718a29c9b4f6e6", "score": "0.5400981", "text": "def clear\n update_attribute :items, []\n end", "title": "" }, { "docid": "fe401daa977c63a322a07775fe75a8b7", "score": "0.53979975", "text": "def add_shop_items_from_user_cart(shop_cart)\n shop_cart.shop_items.each do |si|\n si.shop_cart_id = nil\n shop_items << si\n end\n end", "title": "" }, { "docid": "3baaa5c0fa5a8dc0f15dc5ec484e22c7", "score": "0.53770775", "text": "def mark_as_removed!\n self.removed = true\n self.save\n end", "title": "" }, { "docid": "2045819fe377a3354d9f9a0ff469f452", "score": "0.5371658", "text": "def after_save\n unless destroyed_by_association\n touch_subscriptions if saved_change_to_unread_entries?\n end\n end", "title": "" }, { "docid": "e549ac825e127fa47e0f781ceb9dc6d9", "score": "0.5366863", "text": "def delete_last()\n \n end", "title": "" }, { "docid": "227a7b8103f8ea8a6fe07c854b3f23da", "score": "0.5362767", "text": "def add_history(user, query_string, present_list)\n # get the records to be updated\n to_be_updated = (present_list.select do |item|\n !item.save_flag && item.query_string == query_string\n end).first\n\n # update or create\n if to_be_updated.present?\n SearchConditionRepository.update_time(to_be_updated)\n else\n present_size = present_list.reject(&:save_flag).length + 1\n create_and_delete(user, query_string, false, '', present_size)\n end\n end", "title": "" }, { "docid": "237577b0da95a974efe08e75d1ced941", "score": "0.536215", "text": "def clean_and_keep_recent(to_keep = 5)\n users = User.includes(:quizzes)\n users.each do |user|\n ids = user.quizzes.order(created_at: :desc).offset(to_keep).pluck(:id)\n Quiz.where(id: ids).delete_all\n end\nend", "title": "" }, { "docid": "2697455b5df01e8054bab24bedf29ab1", "score": "0.53599", "text": "def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend", "title": "" }, { "docid": "eec4e3942fe1459518653aa47bd7ef86", "score": "0.53587484", "text": "def remove_all\n store = @store\n @store = {}\n store.values.map(&:last)\n end", "title": "" }, { "docid": "cd2a576bfea181b87c7576b3224c831f", "score": "0.53456974", "text": "def undelete!\n new_type = changes.delete(\"type\")\n new_id = changes.delete(\"id\")\n new_object = change_loggable_type.constantize.new(changes)\n new_object.update_attribute(:id, new_id)\n if new_object.valid?\n new_object.save!\n self.restored_at = Time.now\n self.restored_user_id = Thread.current['user'].try(:id)\n self.save!\n end\n new_object\n end", "title": "" }, { "docid": "3c93b902c4e022aab44a95084dc8d552", "score": "0.534239", "text": "def save\r\n @@items.push self\r\n end", "title": "" }, { "docid": "5d1496f35a149a6ae548392270790033", "score": "0.5340607", "text": "def reset\n @item_ids = []\n end", "title": "" }, { "docid": "74e194654d21ac11073bbde47334a0be", "score": "0.53374517", "text": "def trash\n self.attributes = {\n :page_id => nil,\n :container_id => nil,\n :cell_id => nil,\n :folded => true,\n :public => false\n }\n self.remove_from_list\n end", "title": "" }, { "docid": "37c4b89e45529604e8fb8a4e3b90a173", "score": "0.5336081", "text": "def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end", "title": "" }, { "docid": "cdde209a5608a6acf9ac13fc126f0261", "score": "0.5333646", "text": "def remove_item(item, hash)\n hash.delete(item)\n return hash\nend", "title": "" }, { "docid": "d48f3585324048a08341218d3a783f5d", "score": "0.5329691", "text": "def history\n @history.dup\n end", "title": "" }, { "docid": "20b5e766f311392c6c061ae780db1b79", "score": "0.532833", "text": "def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end", "title": "" }, { "docid": "9078f3d9005d74005fd7fb7844a3472b", "score": "0.53245276", "text": "def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend", "title": "" }, { "docid": "3e57e5bab81ce447901cfe922d0259ff", "score": "0.5321173", "text": "def clean_pending_item_notifications!(owner_user_ids)\n owner_user_ids.each do|owner_user_id|\n pending_item_count = ::Item.pending.where(user_id: owner_user_id).count\n logger.info \" | user #{owner_user_id} has #{pending_item_count} pending items\"\n if pending_item_count < 1\n ::Users::Notification.where(sender_user_id: owner_user_id, related_model_type: 'Child',\n related_model_id: owner_user_id, title: ::Item::PENDING_ITEM_TITLE).\n destroy_all\n end\n end\n end", "title": "" }, { "docid": "e5943124d04fcf0541e8b89fc4c2734f", "score": "0.5316119", "text": "def delete\n DB.exec(\"DELETE FROM users WHERE id = #{@id};\")\n # DB.exec(\"DELETE FROM checkouts WHERE user_id = #{@id};\") --> delete books from users checkout history, but does not delete the books from the database??\n end", "title": "" }, { "docid": "11361d8de6dfc8dc0b6e4f86aa87ba42", "score": "0.5315457", "text": "def undo_update\n # CreateDefaultAdminUser.where(:type_code => 'very_shiny').first.delete\n end", "title": "" }, { "docid": "f21540e8893a38d5a5ca99258c029e33", "score": "0.53139055", "text": "def reload_items\n @item_data = nil\n end", "title": "" }, { "docid": "9fe521b659a920ec111b01c7ff0a1f9d", "score": "0.5312243", "text": "def remove_from_list\n empty_list if @mylist.length <= 0\n item_names = @mylist.map { |item| item['name'] }\n item_names << 'Back'\n selection = @prompt.select('Which item would you like to remove?'.colorize(:light_green), item_names)\n @menu.my_list if selection == 'Back'\n @mylist.each_with_index do |item, index|\n @mylist.delete_at(index) if item['name'] == selection\n end\n update_file\n end", "title": "" }, { "docid": "cc61f2c4420588890f9481faf9688119", "score": "0.53093547", "text": "def undo\n if(@history != nil)\n @history.undo\n end\n end", "title": "" }, { "docid": "6f9884877c05bcdad2fc9a3bd23c65f7", "score": "0.5304072", "text": "def destroy\n session[:savedlist] ||= []\n session[:savedlist].delete(params[:id])\n redirect_to request.referrer\n end", "title": "" }, { "docid": "46e5566f0fd4026614cf114c0a416059", "score": "0.5302384", "text": "def history\n self.class.history.of(self)\n end", "title": "" }, { "docid": "46e5566f0fd4026614cf114c0a416059", "score": "0.5302384", "text": "def history\n self.class.history.of(self)\n end", "title": "" }, { "docid": "84b99e7504acdc1a217b1f44a42ee19a", "score": "0.52930695", "text": "def clearance_items!\n return if @batch_ids.empty?\n @batch.save!\n @batch_ids.each do |item_id|\n item = Item.find(item_id)\n item.clearance!\n # NOTE: Considered adding a catch here if the item fails to save.\n # Feels unneeded as the item cannot possibly have invalid state at this point.\n @batch.items << item\n @notices << \"Item #{item_id} Clearanced Successfully!\"\n end\n end", "title": "" }, { "docid": "e295f6c8b83a2eed7c3e58521390d8f5", "score": "0.5287289", "text": "def remove_from_favourites\n user_id = current_user.id\n yummly_id = params[:yummly_id]\n\n user_favourite_recipe = UserFavouriteRecipe.find_by(yummly_id: yummly_id, user_id: user_id)\n user_favourite_recipe.destroy\n\n redirect_to recipes_url, notice: \"Removed recipe from your list of favourite recipes\"\n end", "title": "" }, { "docid": "30944602ee658fcda8a9a1589e71130f", "score": "0.5281504", "text": "def remove_from_recommendable!\n # Remove this item from the score zset\n Recommendable.redis.zrem(Recommendable::Helpers::RedisKeyMapper.score_set_for(self.class), id)\n\n # Remove this item's liked_by/disliked_by sets\n %w[liked_by disliked_by bookmarked_by].each do |action|\n set = Recommendable::Helpers::RedisKeyMapper.send(\"#{action}_set_for\", self.class, id)\n Recommendable.redis.del(set)\n end\n\n # Remove this item from any user's like/dislike/hidden/bookmark sets\n %w[liked disliked hidden bookmarked].each do |action|\n set = Recommendable::Helpers::RedisKeyMapper.send(\"#{action}_set_for\", self.class, id)\n Recommendable.redis.keys(set).each do |set|\n Recommendable.redis.srem(set, id)\n end\n end\n\n # Remove this item from any user's recommendation zset\n Recommendable.redis.keys(Recommendable::Helpers::RedisKeyMapper.recommended_set_for(self.class, '*')).each do |zset|\n Recommendable.redis.zrem(zset, id)\n end\n end", "title": "" }, { "docid": "8c20eb4bb3709094146adfabd38c6af2", "score": "0.52812856", "text": "def pull(*args)\n args.each do |val|\n @added.delete(val)\n\n # @removed is only for items which we'll remove when the Model is\n # persisted\n unless @initial_value.nil?\n @removed << val if @initial_value.include?(val)\n end\n\n unless @value.nil?\n @value.delete(val)\n end\n end\n end", "title": "" }, { "docid": "02d06236215c2de470cfc7bbd7fb709e", "score": "0.5270431", "text": "def clear\n super\n __wx_item_data.clear\n end", "title": "" }, { "docid": "f8fe4e005deafea80b9be51460c07f44", "score": "0.5268813", "text": "def history_destroy\n SygiopsSupport::History.remove(self.class.to_s, id)\n end", "title": "" }, { "docid": "2ddd0b832457d6b5d30d27f0d098097a", "score": "0.526861", "text": "def favourite\n if Favourite.where(user_id: current_user.id, link_id: @link.id).present?\n @favourite = Favourite.where(user_id: current_user.id, link_id: @link.id)\n @favourite.first.delete\n else\n @favourite = @link.favourites.new(user: current_user)\n @favourite.save\n end \n end", "title": "" }, { "docid": "8d2ba8626cdcf9fa4cde27e0f05ca6a8", "score": "0.5264102", "text": "def void_last_transaction\n @items.pop\n @total -= @transactions.pop\n end", "title": "" }, { "docid": "0cbb0038c77427982ba18a7508678da5", "score": "0.52628386", "text": "def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend", "title": "" }, { "docid": "d08eaf672514ba95c6d50ed984b5d04e", "score": "0.52594185", "text": "def show_history_items_page\n \t@sold = Transaction.find_all_by_seller_id(current_user.id)\n @bought = Transaction.find_all_by_buyer_id(current_user.id)\n end", "title": "" }, { "docid": "f47824b0e4fbb068cba48f23b92bfb63", "score": "0.52584976", "text": "def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend", "title": "" }, { "docid": "7423b51edb598be5e0cabff3a11c42a6", "score": "0.52536535", "text": "def restore\r\n self.update(deleted: false)\r\n end", "title": "" }, { "docid": "4485f27f4a2de03e18657d452b19078e", "score": "0.525244", "text": "def destroy\n current_user.selecteditems.destroy_all\n redirect_to display_cart_user_path(current_user.id)\n end", "title": "" }, { "docid": "dd0bf77f8459f69251b2ec31a0542f55", "score": "0.5251108", "text": "def remove_from_basket\n @basket = Basket.find_by(user_id: params[:user_id], book_id: params[:book_id])\n @basket.destroy\n redirect_to my_basket_path(params[:user_id])\n end", "title": "" }, { "docid": "0d1aadda9e30070fc7b327a44e77f8f5", "score": "0.5246519", "text": "def get_unrated_items(user)\n items = []\n\n Item.all.each do |item|\n review = Review.where(user_id: user.id, item_id: item.id).first\n if not review\n items.push item\n end\n end\n\n items\n end", "title": "" }, { "docid": "4c674b7cd4ede8f802d92609cc3aa83f", "score": "0.52462727", "text": "def destroy\n @item_history.destroy\n respond_to do |format|\n format.html { redirect_to bmet_item_histories_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "1d18b5e81b9967b6269890c9aa4c0360", "score": "0.52405936", "text": "def clear!\n registered_items.clear\n end", "title": "" }, { "docid": "1d18b5e81b9967b6269890c9aa4c0360", "score": "0.52405936", "text": "def clear!\n registered_items.clear\n end", "title": "" }, { "docid": "af3071b54c93627992c6351186492714", "score": "0.5240499", "text": "def add_saved(user, query_string, save_flag, name, present_list)\n return unless save_flag\n present_size = present_list.select(&:save_flag).length + 1\n create_and_delete(user, query_string, true, name, present_size)\n end", "title": "" }, { "docid": "2a30d6f48d4b10eb80522c8f8ba0a186", "score": "0.5239186", "text": "def history\n # blank\n end", "title": "" }, { "docid": "7222af34cf49edef47916f467a844c2a", "score": "0.52380514", "text": "def history\r\n\r\n end", "title": "" }, { "docid": "d02082c9e2f506c7c14696de1ba25be9", "score": "0.5237849", "text": "def save\n @@userList.push self\n self\n end", "title": "" }, { "docid": "40eb6997c6f51cf200d9f76ab8f28bd4", "score": "0.52354246", "text": "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "title": "" }, { "docid": "40eb6997c6f51cf200d9f76ab8f28bd4", "score": "0.52354246", "text": "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "title": "" }, { "docid": "bdf557cc3fdae667af63a9cced185155", "score": "0.52333564", "text": "def destroy\n\n # Obtain selected saved list\n @saved_list = SavedList.find(params[:id])\n @saved_list_users = SavedListUser.where(\"saved_list_id = ?\", @saved_list.id)\n\n # Destroy user saved list entries for all users in list\n @saved_list_users.each do |saved_list_user|\n saved_list_user.destroy\n end\n\n # Destroy saved list\n @saved_list.destroy\n\n respond_to do |format|\n format.html {\n redirect_to :action => 'index'\n flash[:notice] ='Saved list was successfully deleted.'\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bdf557cc3fdae667af63a9cced185155", "score": "0.52333564", "text": "def destroy\n\n # Obtain selected saved list\n @saved_list = SavedList.find(params[:id])\n @saved_list_users = SavedListUser.where(\"saved_list_id = ?\", @saved_list.id)\n\n # Destroy user saved list entries for all users in list\n @saved_list_users.each do |saved_list_user|\n saved_list_user.destroy\n end\n\n # Destroy saved list\n @saved_list.destroy\n\n respond_to do |format|\n format.html {\n redirect_to :action => 'index'\n flash[:notice] ='Saved list was successfully deleted.'\n }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90419c3fc495fb18b647f4a6676c38da", "score": "0.52331805", "text": "def delete_cache\n if self.id != nil && current_user != nil\n cache_key = \"activities/Users/#{current_user.id}/#{self.class.name}/#{self.id}-#{(self.updated_at.to_f * 1000).round(0)}\"\n Chorus.log_debug \"-- BEFORE SAVE: Clearing cache for #{self.class.name} with ID = #{self.id} --\"\n Rails.cache.delete(cache_key)\n return true # Prevent a missing key from the callback chain\n end\n end", "title": "" }, { "docid": "7b393f099f0019756900fff0176dfb1d", "score": "0.5230995", "text": "def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end", "title": "" }, { "docid": "d8da73344ab4c9179c8ce72e888f10de", "score": "0.52260906", "text": "def grocery_item_deleter(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "title": "" }, { "docid": "fbe9884078140a9e6fa42c9497cc29cf", "score": "0.52250576", "text": "def remove(*)\n super.tap do\n __debug_sim('USER initiates removal of existing entries.')\n end\n end", "title": "" } ]
823b5a5679a88b213fea44b116f3a261
Returns the complete contents of the generated RBI file as a string.
[ { "docid": "0b2d970abd18331673389fe0098f07cb", "score": "0.0", "text": "def rbi(strictness = 'strong')\n \"# typed: #{strictness}\\n\" + root.generate_rbi(0, options).join(\"\\n\") + \"\\n\"\n end", "title": "" } ]
[ { "docid": "f2a5ba0a1570781851fab521828cc7e3", "score": "0.64429665", "text": "def result_as_string\n File.open(result_file, 'rb') { |f| f.read }\n end", "title": "" }, { "docid": "ed12407c2c82dcaf92936175634e3a12", "score": "0.6309582", "text": "def body\n ::File.binread(path)\n end", "title": "" }, { "docid": "d52fefb56148f59ac5979db96be8ef41", "score": "0.6133818", "text": "def getBufferAsString\n return @file\n end", "title": "" }, { "docid": "d52fefb56148f59ac5979db96be8ef41", "score": "0.6133818", "text": "def getBufferAsString\n return @file\n end", "title": "" }, { "docid": "38211c2c33c251ffa7d171ad291ba86e", "score": "0.61205393", "text": "def read\n @contents.to_s\n end", "title": "" }, { "docid": "f2ac87ed93c8f50340514238b1084173", "score": "0.6118978", "text": "def raw_contents\n if @raw_contents.nil? then\n cmd = ['sambamba', 'view', '-H', @filename] + @opts\n Bio::Command.call_command_open3(cmd) do |pin, pout, perr|\n @raw_contents = pout.read\n raise_exception_if_stderr_is_not_empty(perr)\n end\n end\n @raw_contents\n end", "title": "" }, { "docid": "0c95355320e57a8f2a6fc9fc745401df", "score": "0.60726345", "text": "def to_string\n io.string\n end", "title": "" }, { "docid": "bb1452d24df02094567b3be69747ce81", "score": "0.6047835", "text": "def file_binary\n b = png_header\n b += ihdr_chunk\n b += idat_chunk\n b += text_chunk(\"Creation Time\", Time.now.strftime(\"%d %B %Y %H:%M:%S %z\"))\n b += text_chunk(\"Comment\", @comment)\n b += iend_chunk\n b\n end", "title": "" }, { "docid": "8573bf09db0ba69dc8316a2310eabe90", "score": "0.60416406", "text": "def to_s\n @body ||= download_report\n end", "title": "" }, { "docid": "8f5b074af0ade4475483bab72075280e", "score": "0.60384434", "text": "def as_string()\n\n data_map = IniFile.new( :filename => @file_path, :encoding => 'UTF-8' )\n data_map = IniFile.load( @file_path ) if File.file? @file_path\n return data_map.to_s\n\n end", "title": "" }, { "docid": "80d1a63bee446820559e0c1521379a1a", "score": "0.59534895", "text": "def to_s_report\n res = Resources4BmetCsv.new\n preamble = <<-REPORT_PREAMBLE.gsub(/^\\t*/, '')\n\t#{@items.length >= MAX_ITEMS_TO_PROCESS ? MAX_ITEMS_WARN_MSG : ''}\n\tProgram: #{File.basename($0)}\n\tSource collection handle: #{IS_SOURCE_ALL_COLLECTIONS ? 'All collections' : self.class.handle_to_url(SOURCE_COLLECTION_HANDLE)}\n\tSource collection name: #{IS_SOURCE_ALL_COLLECTIONS ? 'All collections' : res.lookup_collection_name(SOURCE_COLLECTION_HANDLE)}\n\n\tNumber of items with bitstreams: #{@items.length}\n\tNumber of filenames checked: #{@num_filenames}\n\tNumber of bad filenames: #{@bad_filenames.length}\n\n REPORT_PREAMBLE\n\n lines = []\n obj_list = @bad_filenames\n unless obj_list.empty?\n lines << \"BITSTREAMS WHERE FILENAME DOES NOT START WITH RMID:\"\n lines << \"\"\n\n # Header line\n hdr_list = [\"#\",\"ItemRMID;\",\"ItemHandle;\",\"ItemId;\",\"LastModified;\",\"Filename;\"]\n fmt_str = report_format_string(hdr_list, obj_list)\n lines << fmt_str % hdr_list\n\n # Detail lines\n obj_list.each_with_index{|item, i|\n lines << fmt_str % [i+1, item[:dc_id_rmids], self.class.handle_to_url(item[:item_hdl]),\n item[:item_id], item[:last_modified_short], item[:filename]]\n }\n\n end\n\n preamble + lines.join(NEWLINE) + NEWLINE\n end", "title": "" }, { "docid": "b29851551a304961a5e0dce64c54fbbf", "score": "0.59293854", "text": "def to_s\n to_io.read(nil)\n end", "title": "" }, { "docid": "b29851551a304961a5e0dce64c54fbbf", "score": "0.59293854", "text": "def to_s\n to_io.read(nil)\n end", "title": "" }, { "docid": "b29851551a304961a5e0dce64c54fbbf", "score": "0.59293854", "text": "def to_s\n to_io.read(nil)\n end", "title": "" }, { "docid": "b29851551a304961a5e0dce64c54fbbf", "score": "0.59293854", "text": "def to_s\n to_io.read(nil)\n end", "title": "" }, { "docid": "eec1f818e67fe2b74565047a145303d3", "score": "0.58902377", "text": "def read_report\n begin\n content = ''\n open_report_file.each_line do |line|\n content+= line\n end\n rescue; end\n content\n end", "title": "" }, { "docid": "eec1f818e67fe2b74565047a145303d3", "score": "0.58902377", "text": "def read_report\n begin\n content = ''\n open_report_file.each_line do |line|\n content+= line\n end\n rescue; end\n content\n end", "title": "" }, { "docid": "a368c72bb582989222c0ae82e465ed68", "score": "0.5854452", "text": "def contents\n c = StringIO.new\n @lines.each do |l| \n c.puts l if l\n end\n c.string\n end", "title": "" }, { "docid": "3d4df09361f66b0951f7625f305c7cac", "score": "0.5846503", "text": "def to_s\n self.filename + \"\\n\" + self.metadata.to_s\n end", "title": "" }, { "docid": "a063eb2540393bde9bb513dfd5a9352d", "score": "0.57936215", "text": "def to_binary_string\n header\n base_field_data\n row_data\n eof unless @rows.empty?\n @data\n end", "title": "" }, { "docid": "8e5024b6bc571db332c9fe938cb533d2", "score": "0.5775845", "text": "def get_FileContent()\n \t return @outputs[\"FileContent\"]\n \tend", "title": "" }, { "docid": "c08149ecf3a29b7665770d3d7f50eee1", "score": "0.577199", "text": "def content\n absolute_path.binread\n end", "title": "" }, { "docid": "87f85e18fa0578653ced181809d75438", "score": "0.5767712", "text": "def rbs\n root.generate_rbs(0, options).join(\"\\n\")\n end", "title": "" }, { "docid": "fadb2b1a80237da0c5e64f586cfa696a", "score": "0.5756434", "text": "def to_file; end", "title": "" }, { "docid": "693735e921d5bd0d503dcd60bcc9db40", "score": "0.5739897", "text": "def dump\n return @outstr.dup if @outstr\n return join_outary() if @outary\n return File.read(@iotmp.path) if @is_edit_finished && !completed?\n File.read(@fname)\n end", "title": "" }, { "docid": "7b13d3ab162c98099faab85d5b098637", "score": "0.57365435", "text": "def to_s\n [ super.chop,\n \"@filepath=\\\"#{@filepath}\\\",\", \n \"charset=#{self.charset},\", \n \"type=#{self.type}>\" ].join(' ')\n end", "title": "" }, { "docid": "b19d153485d8664fa31aa08837f608ff", "score": "0.5727216", "text": "def raw_contents\n buf = nil\n File.open(doc_path, 'rb') { |f| buf = f.read }\n buf\n end", "title": "" }, { "docid": "daf3d3c4d5278fb7c0267b5d7d833ba3", "score": "0.5726839", "text": "def file_as_string(file)\n\t\trVal = ''\n\t\tFile.open(file, 'r') do |file_handle|\n\t\t\tfile_handle.read.each_line do |line|\n\t\t\t\trVal << line\n\t\t\tend\n\t\tend\n\t\trVal\n\tend", "title": "" }, { "docid": "436fbf44816976526f487208bb9375fc", "score": "0.57227564", "text": "def file_content\n return @file_content if @file_content \n out = @file_header\n @batch.each{ |item| out << item.to_s }\n @file_content = out\n end", "title": "" }, { "docid": "17286ffbdd4dc434b95d7dcfef97db62", "score": "0.571463", "text": "def contents() File.read(@real_path) end", "title": "" }, { "docid": "f35083a0ac91d39fe5134f451cec71d9", "score": "0.56975186", "text": "def contents\n File.read(@file)\n end", "title": "" }, { "docid": "f1de234a3c7cc19abda92a2be8edbf35", "score": "0.56905526", "text": "def read\n contents = \"\"\n File.open(file.path).each {|line|\n contents << line\n }\n contents\n end", "title": "" }, { "docid": "5953ad1ee54980d0c37ef83ac4d50efb", "score": "0.5681986", "text": "def fileToString(file)\n \n data = ''\n f = File.open(file, \"r\")\n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "0ea9edc5d77bc8f68bd8dacf375dfb04", "score": "0.56804556", "text": "def fileToString(file)\n file = File.open(file)\n contents = \"\"\n file.each {|line|\n contents << line\n }\n return contents\nend", "title": "" }, { "docid": "8d58af27569d5f6aa798987518324f91", "score": "0.56539327", "text": "def dump()\n # have a fake, merge all into it, then dump it.\n base = IniFile.new()\n @paths.reverse.each do |ini|\n base.merge! ini.data\n end\n base.to_s\n end", "title": "" }, { "docid": "398e69bd0bcdb839e21e6c1089bc2598", "score": "0.5644604", "text": "def export_as_ris\n lines = []\n # all ris exports should begin with empty line\n lines << \"\"\n # TY needs to be second line\n lines << \"TY - #{ris_type}\"\n\n ris_format.each_pair do |tag, value|\n Array(value).each do |v|\n lines << \"#{tag} - #{v}\"\n end\n end\n\n lines << RIS_END_RECORD\n lines.join(RIS_LINE_END)\n end", "title": "" }, { "docid": "72c2f57ebfca3f4dd2001571f1c7e9f7", "score": "0.564142", "text": "def read\n return File.open(self, 'r'){|f| f.read} \n end", "title": "" }, { "docid": "abe644c681a52fe5b8b1359745d5630c", "score": "0.56266594", "text": "def to_s\n text = \"\\\"\\\"\\\"#{content_type_output_string}\\n\"\n text << contents_output_string\n text << '\"\"\"'\n end", "title": "" }, { "docid": "07e1f746ee58bcc9b1bfe0d1e6cd5081", "score": "0.5617986", "text": "def writeFileAndDisplay\n\t\tFile.open(\"sourcebin.txt\", 'w') {|f| f.write(@binData) }\n\t\t\n\t\tbegin\n\t\t\tfile = File.new(\"sourcebin.txt\", \"r\")\n\t\t\twhile (line = file.gets)\n\t\t\t\tputs \"#{line}\"\n\t\t\tend\n\t\t\tfile.close\n\t\trescue => err\n\t\t\tputs \"Exception: #{err}\"\n\t\t\terr\n\t\tend\n\tend", "title": "" }, { "docid": "6244828d701c104aec8f9a713944db38", "score": "0.56138253", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\")\n f.each_line do |line|\n data += line\n end\n return data\n end", "title": "" }, { "docid": "d53004688812b575a8bf8aabe76a4d11", "score": "0.56080717", "text": "def contents\n read\n end", "title": "" }, { "docid": "bfdeb16c52f27ecb0f502fd267f75137", "score": "0.5603816", "text": "def get_file_as_string(filename)\n data = ''\n File.open(filename, \"r\").each_line { |line| data += line }\n return data\n end", "title": "" }, { "docid": "6bc88e10d0db7adba0866cc6b3e5d0b7", "score": "0.5595376", "text": "def getText(file)\n \n base = File.expand_path(File.dirname(__FILE__))\n\n dest = File.join(base, file)\n\n return fileToString(dest) \nend", "title": "" }, { "docid": "7a8e218069bdf83065443d0c4f4d6bc4", "score": "0.5586804", "text": "def get_file_as_string path\n File.open(path, \"r\").read\nend", "title": "" }, { "docid": "f324639d6c426efa25e0421d8abb0bc0", "score": "0.5584003", "text": "def to_string_io\n content = StringIO.new\n while bytes = read and !bytes.empty?\n content.write( bytes )\n end\n content.rewind\n content\n end", "title": "" }, { "docid": "da8ef41363d11d5b8fd95c056f648bf1", "score": "0.5581431", "text": "def output\n file\n end", "title": "" }, { "docid": "da8ef41363d11d5b8fd95c056f648bf1", "score": "0.5581431", "text": "def output\n file\n end", "title": "" }, { "docid": "eb85dcc77f0c6e27862cf4ca40f541b1", "score": "0.55780613", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\")\n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "58e3959c1908ff792fde2a7d08d89e8d", "score": "0.5575347", "text": "def to_string(path=nil)\n File.open(self.to_pdf(path)).read\n end", "title": "" }, { "docid": "7ad6ac7b20bf739df8105d2c060e40dc", "score": "0.5574769", "text": "def to_s\n contents = <<-EOH\n#\n# This file is maintained by the sudotool script and should not be \n# edited directly.\n#\nEOH\n \n # Create a table of the attributes for this file\n @attrib.keys.each do |key|\n if key == :expires\n if @attrib[key] == :never\n contents += \"# %-15s: Never\\n\" % key.to_s\n else\n contents += \"# %-15s: %s\\n\" % [key.to_s, @attrib[key].strftime('%Y-%m-%dT%H:%M:%S%z')]\n end\n else \n contents += \"# %-15s: %s\\n\" % [key.to_s, @attrib[key]]\n end\n end\n contents += \"#\\n\\n\"\n \n # write out the host groups\n unless @hostgrps.empty?\n contents += \"# --Begin Host Aliases--\\n\\n\"\n @hostgrps.each {|group| contents += group.to_s + \"\\n\" }\n contents += \"\\n# --End Host Aliases--\\n\\n\\n\"\n end\n \n # write out the command groups\n unless @cmdgrps.empty?\n contents += \"# --Begin Command Aliases--\\n\\n\"\n @cmdgrps.each {|group| contents += group.to_s + \"\\n\" } \n contents += \"\\n# --End Command Aliases--\\n\\n\\n\"\n end\n \n # Write out the user rights\n unless @rights.empty?\n contents += \"# --Begin Rights--\\n\\n\"\n @rights.each {|right| contents += right.to_s + \"\\n\" }\n contents += \"\\n# --End Rights--\\n\"\n end\n \n return contents\n end", "title": "" }, { "docid": "d807f8e75a7c3822b4936c70eead6ac5", "score": "0.557447", "text": "def read\n file.raw_data\n end", "title": "" }, { "docid": "d807f8e75a7c3822b4936c70eead6ac5", "score": "0.557447", "text": "def read\n file.raw_data\n end", "title": "" }, { "docid": "53ec3acc768fc23df131e386d887c4d3", "score": "0.5572934", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "53ec3acc768fc23df131e386d887c4d3", "score": "0.5572934", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "53ec3acc768fc23df131e386d887c4d3", "score": "0.5572934", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "53ec3acc768fc23df131e386d887c4d3", "score": "0.5572934", "text": "def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\nend", "title": "" }, { "docid": "eea5abacd479094174052a88bc27e6a8", "score": "0.5566902", "text": "def contents\n @contents ||= if path\n File.new(path, 'r:utf-8').read\n else\n to_s\n end\n end", "title": "" }, { "docid": "6d18c2de2c9c4869c8cc8720929d58b8", "score": "0.5559863", "text": "def current_file_content\n @file.join(\"\\n\")\n end", "title": "" }, { "docid": "cae5236087457eb1b3f17780b9bc7656", "score": "0.55552095", "text": "def compiler_output_content\n File.open(@compiler_log_path).read\n end", "title": "" }, { "docid": "9e699b68f4c9103b7f722d176a73cb00", "score": "0.5549607", "text": "def to_s\n @contents\n end", "title": "" }, { "docid": "b8c6ed7e1004782edac4b4acbd96031e", "score": "0.55489415", "text": "def to_s\n stringio = StringIO.new\n output(stringio)\n stringio.string\n end", "title": "" }, { "docid": "4d4e1dbaa86d24509d8d14f83bb109c2", "score": "0.55398196", "text": "def results_file\n logf(:results_file)\n return <<EOF\n# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n# #{rcp.code_long} Results\n# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n#\n# This is a syntactically correct Ruby file, which is used by CodeRunner. Please do not edit unless you know what you are doing.\n# Directory: #{@directory}\n# Runname: #{@run_name}\n# ID: #{@id}\n\n# Results:\n#{(rcp.results+rcp.run_info - [:component_runs]).inject({}){|hash, (var,_type_co)| hash[var] = send(var); hash}.pretty_inspect}\n\n# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\nEOF\n\nend", "title": "" }, { "docid": "23847b0c58ee515bf271ce2c1e54c30d", "score": "0.55306387", "text": "def to_s\n \"{#{@name};#{@file}}\"\n end", "title": "" }, { "docid": "23847b0c58ee515bf271ce2c1e54c30d", "score": "0.55306387", "text": "def to_s\n \"{#{@name};#{@file}}\"\n end", "title": "" }, { "docid": "4edeaea7b9cfadb7428f282e37cbb804", "score": "0.5520532", "text": "def getSerialized\n rData = ''\n\n # Require a temporary file\n require 'tmpdir'\n lFileName = \"#{Dir.tmpdir}/#{object_id}.png\"\n if (save_file(lFileName, Wx::BITMAP_TYPE_PNG))\n File.open(lFileName, 'rb') do |iFile|\n rData = iFile.read\n end\n File.unlink(lFileName)\n else\n log_bug \"Error while loading data from temporary file: #{lFileName}.\"\n end\n\n return rData\n end", "title": "" }, { "docid": "77d4e62fb478a25a9782b285919e2392", "score": "0.5495547", "text": "def text\n @out.string\n end", "title": "" }, { "docid": "66866f33a3dfeae340b4c934917802b4", "score": "0.5489999", "text": "def data\n File.open(computed_path) { |fp| fp.read }\n end", "title": "" }, { "docid": "018be35b101ef02f32182c0ca552564a", "score": "0.54734004", "text": "def to_s\r\n @buffer\r\n end", "title": "" }, { "docid": "65b45985d5bf857ec98675ac0fbb735d", "score": "0.54708356", "text": "def file\n io.file\n end", "title": "" }, { "docid": "9fd5821589e3624b60451648e1fddb46", "score": "0.5470115", "text": "def html\n File.open(@outfile).read\n end", "title": "" }, { "docid": "7226331c985f3a2e4dbc0ab965d5b385", "score": "0.5463181", "text": "def to_s\n text = \"\\\"\\\"\\\"#{content_type_output_string}\\n\"\n text << content_output_string\n text << '\"\"\"'\n end", "title": "" }, { "docid": "eaea06e53aa46786ea816f0527f3e1fa", "score": "0.54557127", "text": "def to_raw\n to_raw_array.join(\"\\r\\n\") << \"\\r\\n\"\n end", "title": "" }, { "docid": "3f8f35d99064a2cb1c1184fcde91f8cb", "score": "0.5445614", "text": "def to_s\n return @content.reverse_each.map { |b| B2S_T[b] }.join\n end", "title": "" }, { "docid": "e9bd3848c715cb9d49bf8d676818b0d0", "score": "0.54388493", "text": "def to_s\n @util.build_script\n end", "title": "" }, { "docid": "d03f236b9366582f317edf2f59b11bf2", "score": "0.5434957", "text": "def to_s\n io = StringIO.new\n export_to(io)\n io.string\n end", "title": "" }, { "docid": "8417c71d9284a18fb4a554a29f83bc72", "score": "0.54348546", "text": "def to_s\n result = \"#{identifier} | #{developer} | #{time} | #{message}\\n\"\n self.each do |file|\n result << \" \" << file.to_s << \"\\n\"\n end\n result\n end", "title": "" }, { "docid": "0a52e6d44a004bc7603df848fca5733a", "score": "0.54312485", "text": "def content\n File.read(file_name)\n end", "title": "" }, { "docid": "f2a48bd4cbdc03e0675cb9b4679d942d", "score": "0.54311115", "text": "def response_body\n open(path).readlines.join\n end", "title": "" }, { "docid": "8842bddf8eca34b873665a957c7dd700", "score": "0.5415856", "text": "def to_s\n @buffer\n end", "title": "" }, { "docid": "850b0a4ed2667e28fd5c102c3c909830", "score": "0.5412852", "text": "def raw_output\n @raw_output ||= ''\n end", "title": "" }, { "docid": "23364cc0f6f16772b0c109eeef538326", "score": "0.54071486", "text": "def to_s\n to_string_io.string\n end", "title": "" }, { "docid": "fd00d5c6c56d536cc5f961a43fb701a8", "score": "0.54040015", "text": "def to_s\r\n result = ''\r\n result << \"#{@title} '#{@description}' -> #{@path}\\n\"\r\n\r\n @files.each { |e| result << ' ' << e.to_s << \"\\n\" }\r\n\r\n result\r\n end", "title": "" }, { "docid": "afa60ac45bc7c7683fc1ab4905c4e2b5", "score": "0.5403334", "text": "def blob\n io.read\n end", "title": "" }, { "docid": "29fb4d7d4acf41693c9a6c47f69e4519", "score": "0.5402226", "text": "def program_contents( program_directory )\n # Just grabbing the first file for now..\n file = Dir.glob( File.join( program_directory, '*.rb' ) )[0]\n if file == [] or ! File.exists?( file ) then\n return ''\n end\n f = File.open( file, 'r' )\n string = f.read\n f.close\n return string\nend", "title": "" }, { "docid": "29fb4d7d4acf41693c9a6c47f69e4519", "score": "0.5402226", "text": "def program_contents( program_directory )\n # Just grabbing the first file for now..\n file = Dir.glob( File.join( program_directory, '*.rb' ) )[0]\n if file == [] or ! File.exists?( file ) then\n return ''\n end\n f = File.open( file, 'r' )\n string = f.read\n f.close\n return string\nend", "title": "" }, { "docid": "61130187a43b782a45b2430f3c6d7d8b", "score": "0.5399308", "text": "def content\n lines().join(\"\\n\")\n end", "title": "" }, { "docid": "6abbb1329978beeed84ebe859b50f23b", "score": "0.53984755", "text": "def make_irb_input(template_file_path)\n irb_lines = []\n in_irb_block = false\n source_lines = File.readlines(template_file_path)\n source_lines.each do |source_line|\n source_line.chomp!\n if source_line == '```#run_irb'\n # Begin irb snippet; put commented-out markdown pragma.\n in_irb_block = true\n irb_lines.push(CommentPrefix + '```ruby')\n elsif source_line == '```'\n # End irb snippet; put commented-out markdown pragma.\n in_irb_block = false\n irb_lines.push(CommentPrefix + '```')\n else\n if in_irb_block\n irb_lines.push(source_line)\n else\n irb_lines.push(CommentPrefix + source_line)\n end\n end\n end\n irb_lines.push('') unless irb_lines.last.empty?\n irb_lines.join(\"\\n\")\n end", "title": "" }, { "docid": "f21d358b46e0129ff999b9d1b9c37c8a", "score": "0.53980297", "text": "def to_s\n @buffer\n end", "title": "" }, { "docid": "cd38bcb3a248a948a00ec56f8ecebcee", "score": "0.5397177", "text": "def raw\n grit\n end", "title": "" }, { "docid": "cd38bcb3a248a948a00ec56f8ecebcee", "score": "0.5397177", "text": "def raw\n grit\n end", "title": "" }, { "docid": "96b57acdddc7d9d9141ef72e73c9ce76", "score": "0.5390886", "text": "def to_s\n l = ''\n lines.each do |line|\n l += \"#{line}\\r\\n\"\n end\n l.chomp\n end", "title": "" }, { "docid": "96b57acdddc7d9d9141ef72e73c9ce76", "score": "0.5390886", "text": "def to_s\n l = ''\n lines.each do |line|\n l += \"#{line}\\r\\n\"\n end\n l.chomp\n end", "title": "" }, { "docid": "122789cc5d44134c0e150620a63f9f60", "score": "0.5389938", "text": "def to_s\n @to_s ||= begin\n line_number = @starting_line\n line_count = @code.count(\"\\n\")\n normal_template = @options[:template]\n highlight_template = @options[:highlight_template]\n highlight = @options[:highlight]\n digits = Math.log10(@starting_line+line_count).floor+1\n output = []\n output << sprintf(@options[:header], @file, line_number)\n @code.each_line do |line|\n template = highlight.include?(line_number) ? highlight_template : normal_template\n output << sprintf(template, digits, line_number, line.chomp)\n line_number += 1\n end\n output << @options[:footer]\n @to_s = output.compact.join(\"\")\n end\n end", "title": "" }, { "docid": "1c02c568a50c9a9044980b26b793dff0", "score": "0.53863865", "text": "def pleaseReadFile(pathToFile)\n contentFile = ''\n\n File.open(pathToFile, 'r:ascii-8bit') do |file|\n file.each_line do |line|\n contentFile += line\n end\n end\n\n return contentFile\nend", "title": "" }, { "docid": "25e7f6173696a5172beae37104caa8d8", "score": "0.53783107", "text": "def text\n File.read(@path)\n end", "title": "" }, { "docid": "0457a6fac8afdfc17df3f87124f2eaec", "score": "0.53721726", "text": "def read_file_to_string(file_name)\n file_content = \"\"\n File.open(file_name) do |file|\n while line = file.gets\n file_content += line\n end\n end\n file_content\n end", "title": "" }, { "docid": "d376f5ed66166efe650d83c39aab6fc6", "score": "0.53719467", "text": "def generate_rbi(indent_level, options)\n lines = generate_comments(indent_level, options)\n lines << options.indented(indent_level, \"module #{name}\")\n lines += [options.indented(indent_level + 1, \"interface!\"), \"\"] if interface\n lines += [options.indented(indent_level + 1, \"abstract!\"), \"\"] if abstract\n lines += generate_body(indent_level + 1, options)\n lines << options.indented(indent_level, \"end\")\n end", "title": "" }, { "docid": "05a2895a418aabb54d0bec4c20a4c91c", "score": "0.5371502", "text": "def to_s\n out = text_header <<\n \"\\n+SUMMARY+\\n\" <<\n generate_overview.to_s << \"\\n\" <<\n generate_warning_overview.to_s << \"\\n\"\n\n #Return output early if only summarizing\n if tracker.options[:summary_only]\n return out\n end\n\n if tracker.options[:report_routes] or tracker.options[:debug]\n out << \"+CONTROLLERS+\\n\" <<\n generate_controllers.to_s << \"\\n\"\n end\n\n if tracker.options[:debug]\n out << \"+TEMPLATES+\\n\\n\" <<\n generate_templates.to_s << \"\\n\"\n end\n\n res = generate_errors\n out << \"+ERRORS+\\n\" << res.to_s << \"\\n\" if res\n\n res = generate_warnings\n out << \"+SECURITY WARNINGS+\\n\" << res.to_s << \"\\n\" if res\n\n res = generate_controller_warnings\n out << res.to_s << \"\\n\" if res\n\n res = generate_model_warnings \n out << res.to_s << \"\\n\" if res\n\n res = generate_template_warnings\n out << res.to_s << \"\\n\" if res\n\n out\n end", "title": "" }, { "docid": "94634f547acd7f2bc900dddeb8edc29c", "score": "0.537078", "text": "def output(file)\n File.open(output_path(file),'rb'){|f| f.read}\n end", "title": "" }, { "docid": "1c45f1376d36c4cff7f4b60d54b2ece8", "score": "0.5360707", "text": "def to_txt\n res = \"\"\n @foodbase.each { | k,v | res += \"#{v.line}\\n\" }\n res\n end", "title": "" }, { "docid": "0882a9d76e2bda679a443e2b5cf78736", "score": "0.53583", "text": "def data(force_reload = false)\n # note: we cannot use show-buffer because that would escape tabstops\n if @data && !force_reload\n @data\n else\n if server.version >= \"1.3\"\n return server.invoke_command \"save-buffer -b #@number #{target_argument} -\"\n else\n server.invoke_command \"save-buffer -b #@number #{target_argument} #{@file.path}\"\n return @file.read\n end\n end\n end", "title": "" } ]
0c58e53d0c245396cdea8b38a55be6cb
GET /categories_courses GET /categories_courses.json
[ { "docid": "6df81377e7d8b6e8abc85eda173ba6cc", "score": "0.75490916", "text": "def index\n @categories_courses = CategoriesCourse.all\n end", "title": "" } ]
[ { "docid": "eafdf2bd6da95865e3c6ad1b99df52d5", "score": "0.743281", "text": "def show\n @category = Category.find(params[:id])\n @category_courses = @category.courses\n end", "title": "" }, { "docid": "a06e022257db4847b8f7e683778a4152", "score": "0.7318755", "text": "def index\n if params[:category_id]\n @category = Category.find(params[:category_id])\n @courses = @category.courses.visible\n elsif params[:enrolled]\n login_required\n @courses = []\n Enrollment.where(\"user_id = ?\", current_user.id).each do |e|\n @courses << e.course\n end\n elsif params[:taught] && logged_in?\n @courses = current_user.courses.order('updated_at desc')\n elsif params[:search]\n @courses = Course.search(params[:search]).bestest\n elsif params[:all]\n @courses = Course.visible\n else\n @courses = Course.best\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "e28fc998918e3f9d07bb2021b30debfd", "score": "0.72801656", "text": "def get_courses(url, options = {})\n response = send_get_request(url, options)\n body = JSON.parse(response.body)\n body_courses = body[\"courses\"]\n more_url = body[\"more\"]\n if more_url.present?\n more_url_parsed = URI.parse(more_url)\n options[:more] = Rack::Utils.parse_nested_query(more_url_parsed.query)[\"more\"]\n more_body_courses, response = get_courses(url, options)\n body_courses << more_body_courses\n body_courses.flatten!\n end\n [body_courses, response]\n end", "title": "" }, { "docid": "28a568d81f5d7bd17a22732a433cb777", "score": "0.7173814", "text": "def get_courses(opts = {})\n data, _status_code, _headers = get_courses_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "1add956ce9be1cb69d208d1c58cc41a5", "score": "0.7133991", "text": "def getCourses\n\t\treturn getFromAPI(API_URL)\n\tend", "title": "" }, { "docid": "21a0e967ab33f06382a3994e00f6c735", "score": "0.7116407", "text": "def index\n @courses = Course.all\n @categories = Category.all\n end", "title": "" }, { "docid": "2c958b74f121bbb734f660089ed294cf", "score": "0.7067301", "text": "def get_courses(opts = {})\n data, _status_code, _headers = get_courses_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "58b7a0097c4255aa208ae3956ba60611", "score": "0.70663685", "text": "def index\n \n selected_category_id = params[:selected_category]\n \n if selected_category_id.nil?\n \n @courses = Course.all\n authorize! :read, @courses\n @categories = Category.all\n respond_to do |format|\n format.html { render :action => \"index\", notice: \"current_user\" } # index.html.erb\n format.json { render json: @courses }\n end\n else \n @categories = Category.all\n @courses = Category.find(selected_category_id).courses\n authorize! :read, @courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end\n end", "title": "" }, { "docid": "e1f73287e9734365a25fd8739fb24301", "score": "0.7021665", "text": "def index\n @courses = Course.all\n render json: @courses\n end", "title": "" }, { "docid": "11282aee920829f1219d11a6e56a0dd5", "score": "0.7002388", "text": "def index\n @cate_courses = CateCourse.all\n end", "title": "" }, { "docid": "afee35be3840f70da7b4a06f6001d25a", "score": "0.69939286", "text": "def list_course\n @courses = Course.all()\n end", "title": "" }, { "docid": "cb3a2c8fa3393ae5d77c11a7655be84a", "score": "0.69853103", "text": "def new\n @course = Course.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end", "title": "" }, { "docid": "ac18c8d6a6aed5fa7974442076028488", "score": "0.6969765", "text": "def getAllCourses\n @courses\n end", "title": "" }, { "docid": "4d97503907306ec924d6439d61939ac7", "score": "0.69430625", "text": "def list_group_categories_for_context_courses(course_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/group_categories\",\n :course_id => course_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 RemoteCollection.new(connection, GroupCategory, path, query_params)\n \n end", "title": "" }, { "docid": "80cc0793117873103e2ad9575cbb6332", "score": "0.6917413", "text": "def fetch_tutor_courses\n # tutor can filter by rating, enrollments, etc\n @courses = Course.includes(%i(label introduction tutor)).where(tutor_id: current_api_v1_user.id)\n\n render json: @courses\n end", "title": "" }, { "docid": "6d03adc9b18d8cca9083a97bdb4738a3", "score": "0.6888928", "text": "def index\n @api_v1_courses = Api::V1::Course.all\n end", "title": "" }, { "docid": "ea8c63e99bb847721394853c5acf916a", "score": "0.6874576", "text": "def set_categories_course\n @categories_course = CategoriesCourse.find(params[:id])\n end", "title": "" }, { "docid": "4e97b03fb3e78d36c23ce5eb96f41b2f", "score": "0.6869396", "text": "def courses_by_category(category_id, api_id = 'cda', locale = 'en-US')\n courses(api_id, locale, 'fields.categories.sys.id' => category_id)\n end", "title": "" }, { "docid": "04c4f680743a297f2960cf588fe6698a", "score": "0.68493646", "text": "def index\n @cities = Course.cities\n @courses = Course.all\n @upcoming_courses = Course.upcoming_courses\n @ongoing_courses = Course.ongoing_courses\n @completed_courses = Course.completed_courses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "f0911ef1e3b9ef43a4d66621dd4cf64e", "score": "0.6814736", "text": "def index\n @current_courses = CurrentCourse.all\n render json: @current_courses\n end", "title": "" }, { "docid": "310952829c173f5cd5d09997d2b611c7", "score": "0.6810012", "text": "def courses(course_id = nil)\n data = get_data(\"api/courses/#{course_id}\")\n if course_id.present?\n AeriesNetApi::Models::Course.new(data)\n else\n models = []\n data.each do |course_data|\n models << AeriesNetApi::Models::Course.new(course_data)\n end\n models\n end\n end", "title": "" }, { "docid": "efcb5e10780279c84a4be599091f0268", "score": "0.68094784", "text": "def categories\n call_api('/categories')\n end", "title": "" }, { "docid": "7a79770aa26ca2c83c3deb686f183b52", "score": "0.68091935", "text": "def index\n # Restituisce tutti i corsi di studio del degree e dell'anno indicati\n @courses = @degree.courses.year(params[:year])\n\n render json: @courses\n end", "title": "" }, { "docid": "0fb7a1f15c2c9c85c4b0120714d2c78f", "score": "0.6786763", "text": "def index\n @user_courses = UserCourse.all\n\n render json: @user_courses\n end", "title": "" }, { "docid": "9dd82b587175b097da007a7e68fa52c2", "score": "0.67635703", "text": "def getcourses\n coursearr = Array.new;\n res = Hash.new\n apikey = request.headers[\"apikey\"]\n if apikey != nil\n user = User.where(apikey: apikey ).take\n if user!=nil\n @course = Course.all\n res[:status] =\"OK\"\n @course.each do |cs|\n c = Hash.new\n c[:course_id] = cs.id\n c[:course_name] = cs.course_name\n # c[:course_users] = Hash.new\n # c[:course_users][:users] = cs.apiusers\n # p cs.apiusers\n coursearr.push(c)\n end\n res[:courses] = coursearr\n else\n res[:status] = \"fail\"\n res[:message] = \"No such user find.\"\n end \n else\n res[:status] = \"Fail\"\n res[:message] = \"ApiKey Missing.\"\n end\n render json: res;\n end", "title": "" }, { "docid": "6536be384d7cacc5f3ace59e677bf045", "score": "0.67601764", "text": "def index\n # users can filter by rating, enrollments,\n @courses = Course.includes(%i(label introduction tutor)).approved\n\n render json: @courses\n end", "title": "" }, { "docid": "639baed6b3a647eb24df09a6ab54ea6e", "score": "0.6752423", "text": "def index\n @courses = Course.all\n\n render 'index.json'\n end", "title": "" }, { "docid": "86e5d5637eeb2a8cc989235e83e67c7b", "score": "0.67290026", "text": "def get\n payload = {}\n @client.post('categories/get', payload)\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "5c24a0163ec6e6c1aa8b7d3be6f97047", "score": "0.67200196", "text": "def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "bd7f457291ea26e7a11c69e4c64b3fd9", "score": "0.6711588", "text": "def fetch_categories\n xml = \"Request categories.\"\n respond_with_raw get(\"#{BASE_URL}/v1/categories?api_key=#{API_KEY}&format=json\", :body => xml)\n end", "title": "" }, { "docid": "2ee3b4e34be52e85356e7b86bf3306a8", "score": "0.6708797", "text": "def courses\n\tend", "title": "" }, { "docid": "ca79559ca9d4c93dfc7d9f6f07840b7f", "score": "0.67077154", "text": "def courses\n object.courses.map do |course|\n {\n id: course.id,\n title: course.title,\n images: course.images,\n short_description: course.short_description\n }\n end\n end", "title": "" }, { "docid": "25081f297e54bd1a294191c76b17b162", "score": "0.6695555", "text": "def get_charity_categories\n get(\"charity/categories\")\n end", "title": "" }, { "docid": "3cba43678b445865af5afd71d9719de9", "score": "0.66716665", "text": "def get_categories()\n response = RestClient.get @host + \"/categories\", { :accept => :json }\n return JSON.parse(response.body)\n end", "title": "" }, { "docid": "6f5b1199df94a0f382a0f5270eb32454", "score": "0.66696537", "text": "def fetch_categories\r\n c_url = BASE_URL + \"categories/list?\" + \"app_key=\" + API_KEY\r\n\r\n uri = URI.parse(c_url)\r\n body = uri.read\r\n resp = Net::HTTP.get_response(uri)\r\n data = JSON.parse(resp.body)\r\n\r\n categories = data[\"category\"]\r\n # binding.pry\r\n categories.each do |c|\r\n Category.new(c[\"name\"])\r\n end\r\n end", "title": "" }, { "docid": "ac29ec1c64f22e52fd6ae72b9fdecd55", "score": "0.6650351", "text": "def get_courses\n @prof = Professor.find(params[:pro_id])\n\n render json: @prof.courses\n end", "title": "" }, { "docid": "8714817a357a234339d70382f0d1de20", "score": "0.6625441", "text": "def index\n @courses = Course.all\n @course_types = CourseType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "title": "" }, { "docid": "80d5fd5b349055feaa583c738f42eb5b", "score": "0.6622531", "text": "def index\n @courses = @student.courses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end", "title": "" }, { "docid": "7f1c39c696df0c6398b0f8df08b76d16", "score": "0.65651995", "text": "def index\n\t\t@courses = Course.all\n\tend", "title": "" }, { "docid": "d1c0235d43e9f99d869262850dd4b256", "score": "0.6559813", "text": "def add_and_get_courses\n objects = JSON.parse(request.raw_post)\n result = []\n objects.each do |item|\n coursenumber = @unilib.course_normalize(item[\"number\"])\n course = find_by_number(coursenumber)\n if not course\n course = {}\n course['number'] = item['number']\n course['success'] = false\n else\n u = UserCourse.where(:user_id => @user[:id], :course_id => course[\"id\"],\n :group => 0).first_or_create\n course['success'] = true\n end\n result.push(course)\n end\n\n render :text => JSON.dump(result)\n end", "title": "" }, { "docid": "0c131d9434c785c004b76521c97c2d58", "score": "0.65566945", "text": "def index\n @courses = Course.all\n\n render :index, status: 200\n end", "title": "" }, { "docid": "63cf7c963306b807e0add053622facd6", "score": "0.6554422", "text": "def courses\n return [] if course_ids.blank?\n @courses ||= course_ids.split.to_a.collect do |course_id|\n CourseResource.find(course_id)\n end\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.6551035", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "f76a2c568dd2bd99e3d8152d2677207b", "score": "0.65509045", "text": "def show\n @course = Course.find(params[:id])\n @take = Take.find_by_course_id_and_user_id(@course.id, current_user.id)\n authorize! :read, @course\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "fdc3c61420c2d68d08f77240e52bde32", "score": "0.65506345", "text": "def index\n @courses = Course.all\n end", "title": "" }, { "docid": "5053559b60280b17bb663e83b09dd1a1", "score": "0.6543272", "text": "def get_courses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CourseApi.get_courses ...'\n end\n # resource path\n local_var_path = '/courses'\n\n # query parameters\n query_params = {}\n query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?\n query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?\n query_params[:'datetimeFilter'] = opts[:'datetime_filter'] if !opts[:'datetime_filter'].nil?\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'filterBy'] = opts[:'filter_by'] if !opts[:'filter_by'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'more'] = opts[:'more'] if !opts[:'more'].nil?\n query_params[:'includeCourseMetadata'] = opts[:'include_course_metadata'] if !opts[:'include_course_metadata'].nil?\n query_params[:'includeRegistrationCount'] = opts[:'include_registration_count'] if !opts[:'include_registration_count'].nil?\n query_params[:'includeTotalCount'] = opts[:'include_total_count'] if !opts[:'include_total_count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', '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 => 'CourseListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CourseApi#get_courses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "ec14212d07b2c606100f56c1b708c14e", "score": "0.65432215", "text": "def categories\n get('venues/categories').categories\n end", "title": "" }, { "docid": "f49ab951ed72799a3baa2a56019bd86f", "score": "0.65430856", "text": "def courses\n respond_with Course.find_all_by_user_id(params[:id],:select => [:course_name])\n end", "title": "" }, { "docid": "e3f0e7f04559f98c1f9762739f9e609f", "score": "0.65274286", "text": "def college_categories\n authorize :report, :view?\n render json: Category.joins(courses: {course_selections: :application})\n .where('courses.college_id': params[:id])\n .where('applications.created_at' => Application.current_year(params[:year].to_i))\n .group('categories.name')\n .order('count_id DESC')\n .limit(10)\n .count('id')\n end", "title": "" }, { "docid": "1945f36528d833e24d02acb7c3d412f0", "score": "0.65023243", "text": "def get_appcon_categories \n get(\"/appcon.json/categories\")\n end", "title": "" } ]
9444792d56572dbbc3bfd4abab0d468b
GET /sites/1 GET /sites/1.json
[ { "docid": "b64410622696ac4d7133716da959ad2d", "score": "0.0", "text": "def show\n @record = Site.find(params[:id])\n @record_admin ||= @record.site_admins.where( user_id: current_user ).first\n\n if current_user.is_admin? || @record_admin\n export_path = export_path_for_site( @record )\n if export_path && File.exist?( export_path )\n @export_url = export_site_url( @record )\n @export_mtime = File.mtime( export_path )\n @export_bytes = File.size( export_path )\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @record }\n end\n end", "title": "" } ]
[ { "docid": "85f624b9ca21e24fec1a59dafa0c20e1", "score": "0.7546538", "text": "def index\n @sites = Site.all\n render json: @sites\n end", "title": "" }, { "docid": "1c578611b1fd3d62e827e901deee1799", "score": "0.7469465", "text": "def index\n @sites = Site.by_user(current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "973714e02bde4321d89355da6bdee930", "score": "0.7444836", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "82b350df03e5d31ca4d092ac4cd538dd", "score": "0.742594", "text": "def show\n @site = Site.find(params[:id])\n render json: @site\n end", "title": "" }, { "docid": "1385af5def2ceb34480d6af0d6ad1696", "score": "0.738883", "text": "def index\n @api_v1_sites = Api::V1::Site.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @api_v1_sites }\n end\n end", "title": "" }, { "docid": "ca758ed9e6084932c67180fa2f28524a", "score": "0.7385594", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sites }\n end\n end", "title": "" }, { "docid": "ca758ed9e6084932c67180fa2f28524a", "score": "0.7385594", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sites }\n end\n end", "title": "" }, { "docid": "e052c8cf45ec95bc49b50ed05a6eb2b9", "score": "0.7331941", "text": "def index\n @user = current_user\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "cb4405722c7d7410e4ba5f004810d9e8", "score": "0.7298637", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "cb4405722c7d7410e4ba5f004810d9e8", "score": "0.7298637", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "1c96fd8fd5452762656da06f66e63f33", "score": "0.72879714", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n #@sites = Site.all\n #@sites = @sites.to_json\n end", "title": "" }, { "docid": "2995fb51f0fe83fd1581881b37f227b0", "score": "0.72834724", "text": "def get_sites()\n exec_get(\"#{@base_path}/api/v2/customers/sites.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "c8fbb4b21b4aed490a4813806aea6bed", "score": "0.7274746", "text": "def index\n get_user\n @sites = Site.find_by_user_id(@current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "a3de2e83ae13d1a78b65add371f288c1", "score": "0.7157775", "text": "def show\n @site = Site.find(params[:id]) \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "79626719689eb1fcdd0a706086402414", "score": "0.7066619", "text": "def index\n if GemAuth.current_user.id == \"491bbd3e-5aef-4932-8898-3bea023a729f\"\n sites = Site.all\n else\n sites = Site.where(partner_id: GemAuth.current_user.id)\n end\n render json: { sites: sites }, status: 200\n end", "title": "" }, { "docid": "3f1f92514c03ad7d41f67380c95534ba", "score": "0.70552397", "text": "def index\n if current_user.admin\n @sites = Site.all\n else\n @sites = current_user.sites\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "d616a602b63551a955d98febc6835277", "score": "0.7008785", "text": "def show\n @breadcrumb = 'read'\n @site = Site.find(params[:id])\n @apps = @site.apps\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "c02e6123d4f823b1d635f1ad0fd9e4ce", "score": "0.6959251", "text": "def index\n @sites = Site.order(\"created_at\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "0a1b4bdfda3a4077aff3a4c4f6ae4496", "score": "0.6955362", "text": "def get_sites\n site_records = Offcourse::DiscourseSite.all\n return render json: site_records.as_json, root: false\n end", "title": "" }, { "docid": "c68dc40b55c23d2f14e413b87edc12a5", "score": "0.6954077", "text": "def get_sites \n @sites = Site.where([\"city_id = ?\", params[:city_id]])\n\n logger.debug(\"city_id: #{params[:city_id]}\")\n\n respond_to do |format|\n format.json { render :json => @sites } \n end\n end", "title": "" }, { "docid": "bf7123363fdb54ac080688eeb056bcb7", "score": "0.69447035", "text": "def index\n respond_with @sites\n end", "title": "" }, { "docid": "a4338d4d073e86a40beeef87088b6c4d", "score": "0.6905735", "text": "def show\n @siteship = Siteship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @siteship }\n end\n end", "title": "" }, { "docid": "f1718b897ae544075668268d3b79f8da", "score": "0.6902591", "text": "def index\n \t@title = \"Sites List\"\n @navinner = \"1\"\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "5b2b4ce1da51fee3f283c7241cf7f66b", "score": "0.68949705", "text": "def default_site\n response = get 'sites.json'\n response.first\n end", "title": "" }, { "docid": "19536cb8de79d4f98e6bf1f6e6425ff8", "score": "0.68048245", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "e3c31c3420857f133a4b0195cbb7f6ae", "score": "0.6793824", "text": "def show\n @selected_site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "2793e774c1c05d9c4e1ef84bc742ca8d", "score": "0.6781461", "text": "def index\n if params[:type_id].nil? or params[:type_id].empty?\n @sites = Site.all # path: /types\n else\n @sites = Type.find(params[:type_id]).sites # path: /types/id/sites\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "b94d9343d386876803894c33cd62f91a", "score": "0.67549247", "text": "def show\n @slh_site = SlhSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_site }\n end\n end", "title": "" }, { "docid": "fb6e436337c3429836a40885528fdb01", "score": "0.675393", "text": "def show\n @site_info = SiteInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_info }\n end\n end", "title": "" }, { "docid": "500d9e847f5c79d14b8b27fead17b493", "score": "0.6739862", "text": "def index\n @user_sites = UserSite.where :user_id => session[:user_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_sites }\n end\n end", "title": "" }, { "docid": "235fc962767efa7b748df1dd23560f34", "score": "0.67354876", "text": "def index\n @siteships = Siteship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @siteships }\n end\n end", "title": "" }, { "docid": "403c6d05057f78df3fc2afc4b5147fd7", "score": "0.67273754", "text": "def index\n @table_sites = Table::Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @table_sites }\n end\n end", "title": "" }, { "docid": "04d37a74e9507f37af1aba0afba89830", "score": "0.6718404", "text": "def index\n @work_sites = WorkSite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_sites }\n end\n end", "title": "" }, { "docid": "1533e3e89b5c9e063d399c511e8e16e6", "score": "0.6713446", "text": "def index\n @sites = Site.find_all_by_get_comments(true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "3af064a27621aad7ff6e2f0442e28310", "score": "0.67033565", "text": "def show\n @user_site = UserSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_site }\n end\n end", "title": "" }, { "docid": "b7b8f0cae382b90810748bf60bcf038d", "score": "0.6665745", "text": "def index\n @demandsites = Demandsite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @demandsites }\n end\n end", "title": "" }, { "docid": "8905e596bd7ce8c7f786998ade392c39", "score": "0.66395843", "text": "def show\n @web_site = WebSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_site }\n end\n end", "title": "" }, { "docid": "58c7c32958b6c5e8984cf52cd798cf24", "score": "0.6638814", "text": "def sites\n response = conn.get(\"#{base_url}/site\", {}, query_headers) \n body = JSON.parse(response.body)\n\n body.map { |b| Site.new(b) } \n rescue JSON::ParserError\n fail QueryError, \"Query Failed! HTTPStatus: #{response.status} - Response: #{body}\"\n end", "title": "" }, { "docid": "86cedd086633fa00447df95d90bd88cc", "score": "0.6618588", "text": "def get_site_data(site_id)\n @conn.get(\"/api/v1/sites/#{site_id}\")\n end", "title": "" }, { "docid": "5a1b815f3ef1bd54d3d1a419ba2ac978", "score": "0.66063726", "text": "def show\n @site = Site.find_by_subdomain!(request.subdomain)\n @stylesheets = @site.site_resources.where(:resource_type => \"css\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "a4d2491335ecaffc2126926c5a101620", "score": "0.65998733", "text": "def index\n @sites = Site.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "d8c527150d59e6684215de036754abb8", "score": "0.6589714", "text": "def show\n @site = params[:id] =~ /^\\d+$/ ? Site.find_by_id(params[:id]) : Site.find_by_site_name(params[:id])\n return check_nil(@site)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "78b7bf99dc4028b64071ef4c8c768c47", "score": "0.6578201", "text": "def index\n if params[:client_id].blank?\n @sites = Site.all\n else\n @sites = Client.find(params[:client_id]).sites\n end\n end", "title": "" }, { "docid": "19b553c370c47babaeb28eeb5f7a2a9a", "score": "0.6575438", "text": "def show\n @slh_site_path = SlhSitePath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_site_path }\n end\n end", "title": "" }, { "docid": "3debc45b496b80a4d578c08043a53f73", "score": "0.6574206", "text": "def show\n @site_resource = SiteResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_resource }\n end\n end", "title": "" }, { "docid": "afa6f975fd6a255a48eee3b5eeb4a0e0", "score": "0.65598434", "text": "def show\n @worksite = Worksite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worksite }\n end\n end", "title": "" }, { "docid": "fe303bc81d02a44c1a90c944ace5b551", "score": "0.6554917", "text": "def index\n @user = current_user\n @site = @user.sites.find_by_subdomain!(request.subdomain)\n @pages = @site.pages.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n\n end", "title": "" }, { "docid": "0f0cb29c6e3fe3ca2216195b3a407992", "score": "0.65521234", "text": "def show\n @crawler_site = CrawlerSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crawler_site }\n end\n end", "title": "" }, { "docid": "4899e33d6c2093e0f418a13baee0c170", "score": "0.65454316", "text": "def show\n site = Site.includes(:business).find(params[:id])\n render json: { site: site.to_h }, status: 200\n end", "title": "" }, { "docid": "bb483f2b4fd0635a9277f89362d62b17", "score": "0.6533175", "text": "def index\n @websites = @website_user.websites\n render json: { websites: @websites }\n end", "title": "" }, { "docid": "c619cc4a7eee7e5e388e53efe998d76d", "score": "0.6510057", "text": "def first_site_id\n res = @conn.get('/api/v1/sites')\n res['sites'].first['id']\n end", "title": "" }, { "docid": "f9273fdc8949f64308988b07af07ea9e", "score": "0.64671236", "text": "def fetch_sites_data\n response = URI.open(DATA_URL).read\n JSON.load(response)[\"values\"]\n end", "title": "" }, { "docid": "9670e6dddf3e1782e2a1d4b2c21c45a4", "score": "0.6456409", "text": "def show\n @website = Website.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @website }\n end\n end", "title": "" }, { "docid": "819afd414aa0720c7fe0df0a6e9aa6d2", "score": "0.6442912", "text": "def index\n @sites = current_user.sites.all\n @site_posts = SitePost.where(:user_id => current_user.id).order(\"updated_at DESC\").paginate(:page => params[:page] || 1, :per_page => 20)\n @site_comments = SiteComment.where(:site_id => @sites.map(&:id)).order(\"updated_at DESC\").limit(20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "3db2d5a8694f336e78cc2c46125f9d09", "score": "0.6436524", "text": "def index\n respond_to do |format|\n format.json { render json: {data: current_user.web_sites.map(&:in_json)}}\n end\n end", "title": "" }, { "docid": "b47e8e426f956b143e414992d34e0781", "score": "0.64316016", "text": "def show\n @url = Url.find(params[:id])\n @site_url = request.protocol + request.host_with_port\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end", "title": "" }, { "docid": "25de7e1b7b2237cadff44e871f5aaea1", "score": "0.6423332", "text": "def index\n respond_with Site.all\n end", "title": "" }, { "docid": "ce6f2114e1a670d270e6927fe66f54b0", "score": "0.6416071", "text": "def show\n @table_site = Table::Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table_site }\n end\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "e1a5577b5c37c42c41cfaf327f7d294c", "score": "0.63996243", "text": "def index\n @site = Site.first\n end", "title": "" }, { "docid": "0c07626b903771017232928feaa70fc6", "score": "0.6390597", "text": "def show\n @site = Site.find(params[:site_id])\n @environment = @site.environments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @environment }\n end\n end", "title": "" }, { "docid": "e4b348f8151da5fb633fbfda601c9508", "score": "0.63820904", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_site }\n end\n end", "title": "" }, { "docid": "315968db7d70367c85293a6352b96a30", "score": "0.6376302", "text": "def index\n @sites = Site.all\n @sites.reject!{|s| s.hit.study.hidden == true} if !admin? and !lab_user?\n respond_to do |format|\n format.html # index.html.erb\n format.text {\n txt = [\"SPalmS ID\", \"Uniprot AC\", 'Isoform', \"Position\"].join(\"\\t\") + \"\\n\";\n txt += @sites.map{|s| [\"SPalmS#{s.id}\", s.hit.protein.up_ac, ((s.hit.isoform) ? s.hit.isoform.isoform : ((s.hit.protein.isoforms.select{|e| e.latest_version and e.main}.first) ? s.hit.protein.isoforms.select{|e| e.latest_version and e.main}.first.isoform : 'NA' )), s.pos].join(\"\\t\")}.join(\"\\n\")\n render text: txt\n }\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "ebe928aa5e65a1bcc8ab6cc88ac95503", "score": "0.6374303", "text": "def new\n @site = current_user.sites.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": "ebe928aa5e65a1bcc8ab6cc88ac95503", "score": "0.6374303", "text": "def new\n @site = current_user.sites.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": "74665b13b221977d7e1d40ae350ab608", "score": "0.63676", "text": "def index\n if params[:site_id]\n @site = current_user.sites.find params[:site_id]\n respond_with @site.versions\n else\n respond_with @versions\n end\n end", "title": "" }, { "docid": "8d3218f6eacc882146339c46d37d43c0", "score": "0.6363283", "text": "def site(options = {})\n @site.get(\"/1.1/site.json\", options) do |chunk|\n yield(chunk)\n end\n end", "title": "" }, { "docid": "a56a3c4bb04e48fe192194c281862544", "score": "0.6353535", "text": "def show\n @history_site = HistorySite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @history_site }\n end\n end", "title": "" }, { "docid": "f12890dbcb9fa52cb7780f8501ea9cc0", "score": "0.63334984", "text": "def show\n @site_environment = SiteEnvironment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_environment }\n end\n end", "title": "" }, { "docid": "dcc004e9e992266071ed79522ce5eff2", "score": "0.6331807", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "1e67fffe306c45c0eefdd645e76a7ada", "score": "0.63101715", "text": "def sites\n @sites ||= SitesApi.new config\n end", "title": "" }, { "docid": "365287aefcd6414283ba2e3f96ad4842", "score": "0.63086647", "text": "def show\n @demandsite = Demandsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @demandsite }\n end\n end", "title": "" }, { "docid": "371891c26b3a83d835f51b88d0ee628f", "score": "0.6304052", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "add72ce560de0253a2a74e25a0f57de7", "score": "0.6294437", "text": "def index\n @sites = current_user.sites.all\n @site = current_user.sites.new\n \n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites, :only => [:_id, :name, :url, :description, :supporters, :tags, :count], :methods => ['votes_count'] }\n #format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "052e3b7ebc53f6024defb58dbe37a6ff", "score": "0.6287044", "text": "def show\n @reference_site = ReferenceSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference_site }\n end\n end", "title": "" }, { "docid": "b0ce3bf9c9fbb6ead022443b3cb693e9", "score": "0.6271283", "text": "def show\n @site = current_site\n @page = @site.pages.first\n\n respond_to do |format|\n format.html { render collection: @page }\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "22a72c1d9f12a421f415790d08fcff23", "score": "0.62708944", "text": "def get_site_by_id(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "f88fddad58c048359c0034ac044cccc0", "score": "0.62016046", "text": "def index\n @sites = @current_user.sites.all\n end", "title": "" }, { "docid": "25215e37205b2497374ba3130dd12588", "score": "0.61998487", "text": "def show\n\n @site = Site.find_by_subdomain!(request.subdomain)\n if user_signed_in?\n @role = @site.memberships.find_by_user_id(current_user.id).role\n end\n @posts = @site.posts.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "5c6f109a17f30bd14f6165e3fcc03833", "score": "0.6181815", "text": "def index\n @sites = current_user.sites.all\n end", "title": "" }, { "docid": "b457fcc465aec83c4f9180fd459c7a03", "score": "0.6179793", "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": "4e44f647d3a1f64b343dc9d03ebb68a0", "score": "0.61790544", "text": "def show\n @site_setting = ::SiteSettings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_setting }\n end\n end", "title": "" }, { "docid": "ec2051c63b6d2f53c55285331d93dadb", "score": "0.61776614", "text": "def show\n @site_configuration = SiteConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_configuration }\n end\n end", "title": "" }, { "docid": "96cb1835a5911cdabd744f27572996a5", "score": "0.61602724", "text": "def index\n @sites = Site.find(:all, :order => \"name\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "title": "" }, { "docid": "c993cf9e95a717d47d7e2f5e6a51edeb", "score": "0.61573464", "text": "def show\n @citable_site = CitableSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citable_site }\n end\n end", "title": "" }, { "docid": "e46f67c868c2137da908e19cc6888bad", "score": "0.61542314", "text": "def show\n \tunless params[:id] != nil\n\t\t\t@site = Site.find_by_domain(request.domain)\n\t\telse\n\t\t\t@site = Site.find(params[:id])\n\t\tend\n\t\t@classifieds = Classified.all\n\t @subscriber = Subscriber.new\n\t @meta_title = @site.meta_title\n\t @meta_keywords = @site.meta_keywords\n\t @meta_description = @site.meta_description\n\t @site_results = FeedEntry.where(site_id: @site.id).order(\"created_at DESC\")\n\t @web_results = @site_results.page(params[:page]).per_page(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" } ]
36a6f6cc1a700f29bff831e5fbcb6f31
Autenticado como operador con grupo Analista de Casos
[ { "docid": "41910a3737ef0c783c9e304ab4223472", "score": "0.6270263", "text": "def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end", "title": "" } ]
[ { "docid": "547c2e5f5f6924f2c8198e503e52fc7a", "score": "0.6435314", "text": "def set_comosupo\n @basica = Sivel2Sjr::Comosupo.find(params[:id])\n end", "title": "" }, { "docid": "695a6f8aaf52dd00f6d00153de66986e", "score": "0.63263476", "text": "def inicia_observador\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [21]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "f465c7df96788a8983c6a630cc48f8d5", "score": "0.6273268", "text": "def index\n @grupos = Grupo.all\n #Requerir id y nombre de usuarios, id y nombre de misiones\n\n #condición para mostrar: que el usuario pertenezca al grupo\n\n\n end", "title": "" }, { "docid": "e641a5e3b528a7a7de6afce202dd9beb", "score": "0.62680066", "text": "def grupo_params\n params.require(:grupo).permit(:nombre, :horario, :idioma, :nivel, :user_id, :estado, :curso, :anio, :periodo, :lugar, :fecha, :centro, :tipo, :modalidad, :cupo, :duracion, :cuota,\n :clave, :proyecto, :institucion_bancaria, :cuenta, :titular, :instructor, :instructor_rfc, :instructor_correo, :jefe_ec, :registro, :referencia, :habilitar_constancias_grupo, :seccion)\n end", "title": "" }, { "docid": "1816c4d54085aa588bb55fab8a736c5c", "score": "0.61951554", "text": "def grupo_params\n params.require(:grupo).permit(:nombre, :descripcion, :user_id, :clave, :tipo, :cp)\n end", "title": "" }, { "docid": "4e4e1def3733368fc65691f0b6545086", "score": "0.6169414", "text": "def set_grupo_comunitario\n @grupo_comunitario = GrupoComunitario.find(params[:id])\n end", "title": "" }, { "docid": "4e3d4595923c20c90af1347e144606f7", "score": "0.6133665", "text": "def initialize(usuario = nil)\n # Sin autenticación puede consultarse información geográfica \n can :read, [Sip::Pais, Sip::Departamento, Sip::Municipio, Sip::Clase]\n if !usuario || usuario.fechadeshabilitacion\n return\n end\n lgrupos = ApplicationHelper.supergrupos_usuario(usuario) #nombres\n if !usuario.nil? && !usuario.rol.nil? \n if usuario.rol == Ability::ROLOPERADOR &&\n (lgrupos.count == 0 || lgrupos == ['Usuarios'])\n return\n end\n \n case usuario.rol \n when Ability::ROLOPERADOR\n\n if lgrupos.include?('STCIV') # CERAC o STCIV_CINEP\n can :read, [::Csivinivelgeo, ::Csivitema, \n ::Csivinivelresp, ::Regiongrupo, \n Sip::Grupo, Sip::Sectororgsocial]\n can :read, ::Regiongrupo\n can :read, Sip::Grupo\n can :read, Heb412Gen::Doc\n # Pueden manejar contactos STCIV (y no los de CINEP)\n can :stciv, Sip::OrgsocialPersona\n can [:create, :read, :index, :update], Sip::Orgsocial\n if (lgrupos - ['Usuarios']) == ['STCIV'] # Externo, CERAC\n return # Nada más\n end\n end\n can :read, ::Nivelrelacion\n can :descarga_anexo, Sip::Anexo\n can :nuevo, Cor1440Gen::Actividad\n can :new, Cor1440Gen::Actividad\n\n can :manage, Cor1440Gen::Actividad#, grupo.map(&:nombre).to_set <= grupos.to_set\n #can :manage, Cor1440Gen::Informe # limitar a oficina?\n can :listado, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :fichaimp, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :fichapdf, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :objetivospf, Cor1440Gen::Proyectofinanciero\n #can :actividadespf, Cor1440Gen::Proyectofinanciero\n\n can :read, Heb412Gen::Doc\n can :read, Heb412Gen::Plantilladoc\n can :read, Heb412Gen::Plantillahcm\n can :read, Heb412Gen::Plantillahcr\n\n can :read, Mr519Gen::Formulario\n can :read, [Mr519Gen::Encuestausuario, \n Mr519Gen::Encuestapersona,\n ::Planencuesta ]\n can [:edit, :update], \n Mr519Gen::Encuestausuario.where(usuario_id: usuario.id)\n\n can [:read, :index], Sip::Persona # Contactos\n can [:read, :index], Sip::Orgsocial# Directorio institucional\n can :read, Sip::Grupo # Directorio institucional\n #can [:read, :update, :create, :destroy], Cor1440Gen::Actividad, oficina_id: { id: usuario.oficina_id}\n\n can :read, ::Busqunif\n can :read, ::Tasacambio\n can :read, ::Usuario # Directorio institucional\n\n lineas = lgrupos.select {|g| g.start_with?(GRUPO_LINEA)}\n coords = lgrupos.select {|g| g.start_with?(GRUPO_RESPONSABLE)}\n # Coordinadores también están en su línea\n if coords.length > 0\n lineas |= coords.map { |gc| GRUPO_LINEA + ' ' + gc[15..-1] }\n # Detección de problemas en nombres de líneas\n lineasm = lineas.select { |nl| Sip::Grupo.where(nombre: nl).count == 0 }\n if lineasm.count > 0\n puts \"OJO problemas en nombres #{lineasm}\"\n return\n end\n end\n\n # Dejar en lineas solo nombres validos y en idlineas sus ids\n lineas = lineas.select { |nl| Sip::Grupo.where(nombre: nl).count > 0 }\n idlineas = lineas.map { |nl| Sip::Grupo.where(nombre: nl).take.id }\n\n # Si hace fata agregar lineas a grupos\n lgrupos |= lineas\n lgrupos = lgrupos.select { |nl| Sip::Grupo.where(nombre: nl).count > 0 }\n idlgrupos = lgrupos.map { |nl| Sip::Grupo.where(nombre: nl).take.id }\n\n\n # Puede ver resumen de proyectos no exclusivos (i.e sin grupos),\n # los que cubran sus grupos y aquellos en los que esté en\n # el equipo de trabajo\n pc1 = Cor1440Gen::Proyectofinanciero.\n where(\n 'id NOT IN (SELECT proyectofinanciero_id \n FROM grupo_proyectofinanciero)'\n ).pluck(:id)\n pc2 = Cor1440Gen::Proyectofinanciero.\n where('id IN (SELECT proyectofinanciero_id FROM \n grupo_proyectofinanciero WHERE grupo_id IN (?))', idlineas).\n pluck(:id)\n pc3 = Cor1440Gen::Proyectofinanciero.\n where('id IN (SELECT proyectofinanciero_id FROM \n cor1440_gen_proyectofinanciero_usuario WHERE usuario_id=?)', \n usuario.id).pluck(:id)\n\n can [:read], Cor1440Gen::Proyectofinanciero, {id: pc1 | pc2 | pc3}\n\n # Convención de control de acceso a actividadespf\n # Las que no tengan control de acceso pueden usarlas todos los\n # investigadores\n # Las que tengan control de acceso son exclusivas para los grupos\n # que indiquen\n apf1 = Cor1440Gen::Actividadpf.\n where(proyectofinanciero_id: pc1 | pc2).\n where(\n 'id NOT IN (SELECT actividadpf_id \n FROM cor1440_gen_actividadpf_grupoexclusivo)'\n ).pluck(:id)\n apf2 = Cor1440Gen::Actividadpf.\n where(proyectofinanciero_id: pc1 | pc2).\n joins('JOIN cor1440_gen_actividadpf_grupoexclusivo ON\n cor1440_gen_actividadpf_grupoexclusivo.actividadpf_id=\n cor1440_gen_actividadpf.id ').\n where('cor1440_gen_actividadpf_grupoexclusivo.grupo_id IN (?)', \n idlgrupos).\n pluck(:id)\n apfper = apf1 | apf2\n apfper.uniq!\n can [:read], Cor1440Gen::Actividadpf, id: apfper\n\n # Puede editar encuestas que ha respondido\n encper = Mr519Gen::Encuestapersona.joins(:persona).\n joins('JOIN sip_orgsocial_persona ON \n sip_persona.id = sip_orgsocial_persona.persona_id').\n joins( 'JOIN grupo_orgsocial ON grupo_orgsocial.orgsocial_id\n =sip_orgsocial_persona.orgsocial_id').\n where('grupo_id IN (?)', idlgrupos)\n puts \"encper.ids=#{encper.map(&:id)}\"\n can [:edit, :update], encper\n\n # Investigadores y coordinadores\n if lineas.length > 0\n can [:create, :read, :update], Sip::Orgsocial\n can [:create, :read, :update], ::Publicacion\n can :manage, :tablasbasicas\n can :manage, Cor1440Gen::Efecto\n #can :index, Cor1440Gen::Mindicadorpf\n can :read, Cor1440Gen::Mindicadorpf\n\n can :read, ::Acp\n #can :index, :exploradordatosrel\n end\n\n # Coordinadores de línea\n if coords.length > 0\n # Posibilidad de editar Marco Lógico de proyectos exclusivos de su línea\n pc = Cor1440Gen::Proyectofinanciero.\n where('cor1440_gen_proyectofinanciero.id IN\n (SELECT proyectofinanciero_id FROM \n (SELECT proyectofinanciero_id, COUNT(grupo_id) FROM \n grupo_proyectofinanciero WHERE proyectofinanciero_id \n IN (SELECT proyectofinanciero_id FROM \n grupo_proyectofinanciero WHERE grupo_id IN (?)) GROUP BY 1) \n AS sub WHERE sub.count=1)', idlineas)\n can [:read, :edit, :update], Cor1440Gen::Proyectofinanciero,\n {id: pc.pluck(:id)}\n can [:edit, :update], Cor1440Gen::Actividadpf,\n {proyectofinanciero_id: pc.pluck(:id)}\n can [:edit], Cor1440Gen::Indicadorpf\n can [:read], Mr519Gen::Encuestapersona\n end\n \n # Si un usuario es coordinador o responsable de un proyecto\n # puede editar su marco lógico.\n pc1 = Cor1440Gen::Proyectofinanciero.where(\n 'cor1440_gen_proyectofinanciero.id IN\n (SELECT proyectofinanciero_id FROM proyectofinanciero_uresponsable\n WHERE uresponsable_id=?)', usuario.id).pluck(:id)\n pc2 = Cor1440Gen::Proyectofinanciero.where(\n 'cor1440_gen_proyectofinanciero.id IN\n (SELECT proyectofinanciero_id FROM coordinador_proyectofinanciero\n WHERE coordinador_id=?)', usuario.id).pluck(:id)\n pc = Cor1440Gen::Proyectofinanciero.where(id: pc1 | pc2)\n\n if pc.count > 0\n can [:read, :edit, :update], Cor1440Gen::Proyectofinanciero,\n {id: pc.pluck(:id)}\n can [:edit], Cor1440Gen::Indicadorpf\n can [:edit], Cor1440Gen::Actividadpf\n end\n\n # Control de acceso por grupo\n ###############################\n\n if lgrupos.include?(GRUPO_ARCHIVOYCORRESPONDENCIA)\n can [:edit, :update], ::Usuario\n end\n\n if lgrupos.include?(GRUPO_COMPROMISOS) || \n lgrupos.include?(GRUPO_COORDINADORGP)\n # Oficina Gerencia de Proyectos\n can :objetivospf, Cor1440Gen::Proyectofinanciero\n can :actividadespf, Cor1440Gen::Proyectofinanciero\n can :manage, Cor1440Gen::Actividad\n can :manage, Cor1440Gen::Actividadpf\n can [:index, :read], Cor1440Gen::Efecto\n can :manage, Cor1440Gen::Financiador\n can :manage, Cor1440Gen::Mindicadorpf\n can [:creacomogp, :read, :index, :show, :create, :validar], \n Cor1440Gen::Proyectofinanciero\n can [:manage, :validar], Cor1440Gen::Proyectofinanciero,\n {id: Cor1440Gen::Proyectofinanciero.where(\n 'respgp_id IS NOT NULL').pluck(:id)}\n can :manage, Cor1440Gen::Sectorapc\n\n can [:create, :read, :update], ::Publicacion\n\n can :manage, :tablasbasicas\n can :manage, ::Convenio\n can :manage, ::Tasacambio\n can :manage, ::Tipoanexo\n can :manage, ::Tipoconvenio\n can :manage, ::Tipomoneda\n can :manage, ::Tipoproductopf\n end\n\n if lgrupos.include?(GRUPO_COMUNICACIONES)\n can :manage, ::Publicacion\n can :manage, :tablasbasicas\n end\n\n\n # Contexto es para equipo derechos humanos \n if lgrupos.include?(GRUPO_DERECHOSHUMANOS)\n can :edit, :contextoac\n end\n\n if lgrupos.include?(GRUPO_GESTIONDECALIDAD)\n can :manage, Heb412Gen::Doc\n can :manage, Heb412Gen::Plantilladoc\n can :manage, Heb412Gen::Plantillahcm\n can :manage, Heb412Gen::Plantillahcr\n end\n\n if lgrupos.include?(GRUPO_GESTIONHUMANA)\n can [:edit, :update, :create], ::Usuario\n can :manage, ::Areaestudios\n can :manage, ::Cargo\n can :manage, ::Cajacompensacion\n can :manage, ::Empresaps\n can :manage, ::Fondopensiones\n can :manage, ::Niveleducacion\n can :manage, ::Perfilprofesional\n can :manage, ::Procesogh\n can :manage, ::Profesion\n can :read, Sip::Grupo\n can :manage, ::Tipocontrato\n can :manage, ::Tiponomina\n can :manage, :tablasbasicas\n end\n\n if lgrupos.include?(GRUPO_CONFLICTOYPAZ)\n can :index, :confytransf\n can :read, ::Ls\n can :read, ::Lscobertura\n can :index, :exploradordatosrel\n can :index, :dinamicas # Dinámicas del conflicto\n #Acciones colectivas por la paz\n can :manage, ::Acp\n can :manage, ::Acpactor1\n can :manage, ::Acpactor2\n can :manage, ::Acpcataccion\n can :manage, ::Acpcatmotivo\n can :manage, ::Acpestrategia\n can :manage, ::Acpformap\n can :manage, ::Acpmotivo\n can :manage, ::Acppapel\n end\n\n if lgrupos.include?(GRUPO_SIG)\n can :index, :confytransf\n can :read, ::Ls\n can :read, ::Lscobertura\n can :read, ::Acp\n end\n\n if lgrupos.include?(GRUPO_MOVIMIENTOSSOCIALESTIERRA)\n can :manage, ::Ls\n can :manage, ::Lscobertura\n end\n\n if lgrupos.include?(GRUPO_OFICINATI)\n can :manage, Mr519Gen::Formulario\n end\n\n if lgrupos.include?(GRUPO_STCIV)\n can :read, ::Csivinivelgeo\n can :read, ::Csivinivelresp\n can :read, ::Csivitema\n end\n\n\n when Ability::ROLADMIN, Ability::ROLDIR\n can :descarga_anexo, Sip::Anexo\n can :dir, :aprobadoefecto\n can :index, :exploradordatosrel\n can :index, :confytransf\n can :edit, :contextoac\n can :manage, ::Acp\n can :manage, ::Ls\n can :index, :dinamicas\n can :manage, :lineabase\n can :dir, :vistobuenoactividad\n\n can :read, ::Busqunif\n can :manage, ::Convenio\n can :manage, ::Tasacambio\n can :manage, ::Usuario\n\n can :manage, Cor1440Gen::Actividad\n can :manage, Cor1440Gen::Efecto\n can :manage, Cor1440Gen::Indicadorpf\n #can :manage, Cor1440Gen::Informe\n can :manage, Cor1440Gen::Mindicadorpf\n can :manage, Cor1440Gen::Proyectofinanciero\n can :manage, Cor1440Gen::Tipoindicador\n can :manage, Cor1440Gen::Actividadpf\n\n can :manage, Heb412Gen::Doc\n can :manage, Heb412Gen::Plantilladoc\n can :manage, Heb412Gen::Plantillahcm\n can :manage, Heb412Gen::Plantillahcr\n\n can :manage, Mr519Gen::Formulario\n can :manage, Mr519Gen::Encuestausuario\n can :manage, Mr519Gen::Encuestapersona\n can :manage, ::Planencuesta\n\n can :manage, ::Publicacion\n can :manage, Sip::Orgsocial\n can :manage, Sip::Persona\n can :manage, :tablasbasicas\n tablasbasicas.each do |t|\n c = Ability.tb_clase(t)\n can :manage, c\n end\n end\n end\n end", "title": "" }, { "docid": "3f0177960f4ca64eb4d7752b7d2f00da", "score": "0.6082898", "text": "def create\n precisa_ser_super_admin\n return if performed?\n\n adicionar_breadcrumb \"Criar novo grupo\", new_grupo_path, \"criar\"\n\n @grupo = Grupo.new(grupo_params)\n\n respond_to do |format|\n if @grupo.valid?\n if @grupo.tem_encontros\n encontro_padrao = Encontro.new({\n padrao: 1, \n nome: 'Padrão', \n denominacao_conjuntos_permanentes: 'Círculo'})\n @grupo.encontro_padrao = encontro_padrao\n end\n\n @grupo.save\n\n format.html { redirect_to grupos_url, notice: 'Grupo criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @grupo }\n else\n format.html { render action: 'new' }\n format.json { render json: @grupo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77811bed1cd91d69b0d6e8f7a6ca4f61", "score": "0.6074908", "text": "def initialize(usuario = nil)\n # Sin autenticación puede consultarse información geográfica \n can :read, [Sip::Pais, Sip::Departamento, Sip::Municipio, Sip::Clase]\n if !usuario || usuario.fechadeshabilitacion\n return\n end\n lgrupos = ApplicationHelper.supergrupos_usuario(usuario) #nombres\n if !usuario.nil? && !usuario.rol.nil? \n if usuario.rol == Ability::ROLOPERADOR &&\n (lgrupos.count == 0 || lgrupos == ['Usuarios'])\n return\n end\n can :descarga_anexo, Sip::Anexo\n can :nuevo, Cor1440Gen::Actividad\n can :new, Cor1440Gen::Actividad\n case usuario.rol \n when Ability::ROLOPERADOR\n can :manage, Cor1440Gen::Actividad#, grupo.map(&:nombre).to_set <= grupos.to_set\n #can :manage, Cor1440Gen::Informe # limitar a oficina?\n can :read, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :fichaimp, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :fichapdf, Cor1440Gen::Proyectofinanciero # Los de su grupo\n can :objetivospf, Cor1440Gen::Proyectofinanciero\n can :actividadespf, Cor1440Gen::Proyectofinanciero\n\n can :read, Heb412Gen::Doc\n can :read, Heb412Gen::Plantilladoc\n can :read, Heb412Gen::Plantillahcm\n can :read, Heb412Gen::Plantillahcr\n\n can :read, Mr519Gen::Formulario\n can :read, [Mr519Gen::Encuestausuario, \n Mr519Gen::Encuestapersona,\n ::Planencuesta ]\n can [:edit, :update], \n Mr519Gen::Encuestausuario.where(usuario_id: usuario.id)\n\n can [:read, :index], Sip::Actorsocial# Directorio institucional\n can :read, Sip::Grupo # Directorio institucional\n #can [:read, :update, :create, :destroy], Cor1440Gen::Actividad, oficina_id: { id: usuario.oficina_id}\n \n can :read, ::Tasacambio\n can :read, ::Usuario # Directorio institucional\n\n lineas = lgrupos.select {|g| g.start_with?(GRUPO_LINEA)}\n # Sólo investigadores\n if lineas.length > 0\n can [:create, :read, :update], Sip::Actorsocial\n can :manage, :tablasbasicas\n can :manage, Cor1440Gen::Efecto\n can :index, Cor1440Gen::Mindicadorpf\n can :index, :busquedaunificada\n can :index, :exploradordatosrel\n end\n\n coords = lgrupos.select {|g| g.start_with?(GRUPO_COORDINADOR)}\n # Posibilidad de editar Marco Logico para coordinadores\n if coords.length > 0\n lineas = coords.map { |gc| GRUPO_LINEA + ' ' + gc[15..-1] }\n lineasm = lineas.select { |nl| Sip::Grupo.where(nombre: nl).count == 0 }\n if lineasm.count > 0\n puts \"OJO problemas en nombres #{lineasm}\"\n return\n end\n lineasb = lineas.select { |nl| Sip::Grupo.where(nombre: nl).count > 0 }\n idlineas = lineasb.map { |nl| Sip::Grupo.where(nombre: nl).take.id }\n pc = ::Cor1440Gen::Proyectofinanciero.\n where('cor1440_gen_proyectofinanciero.id IN\n (SELECT proyectofinanciero_id FROM \n (SELECT proyectofinanciero_id, COUNT(grupo_id) FROM \n grupo_proyectofinanciero WHERE proyectofinanciero_id \n IN (select proyectofinanciero_id from \n grupo_proyectofinanciero where grupo_id IN (?)) GROUP BY 1) \n AS sub WHERE sub.count=1)', idlineas)\n can [:edit, :update], pc\n can [:edit], Cor1440Gen::Indicadorpf\n can :manage, ::Publicacion\n can [:read], Mr519Gen::Encuestapersona\n else\n # Investigador\n lineasb = lineas.select { |nl| Sip::Grupo.where(nombre: nl).count > 0 }\n idlineas = lineasb.map { |nl| Sip::Grupo.where(nombre: nl).take.id }\n\n encper = Mr519Gen::Encuestapersona.joins(:persona).\n joins('JOIN sip_actorsocial_persona ON \n sip_persona.id = sip_actorsocial_persona.persona_id').\n joins( 'JOIN actorsocial_grupo ON actorsocial_grupo.actorsocial_id\n =sip_actorsocial_persona.actorsocial_id').\n where('grupo_id IN (?)', idlineas)\n puts \"encper.ids=#{encper.map(&:id)}\"\n can [:edit, :update], encper\n \n end\n \n # Responsables de un proyecto también pueden editar marco lógico\n pc = ::Cor1440Gen::Proyectofinanciero.where('id IN\n (SELECT proyectofinanciero_id FROM proyectofinanciero_uresponsable\n WHERE uresponsable_id=?)', usuario.id)\n if pc.count > 0\n can [:edit, :update], pc\n can [:edit], Cor1440Gen::Indicadorpf\n can :manage, ::Publicacion\n end\n\n # Contexto es para equipo derechos humanos \n if lgrupos.include?(GRUPO_DERECHOSHUMANOS)\n can :edit, :contextoac\n end\n\n if lgrupos.include?(GRUPO_MEDIACION)\n can :index, :conflictividades\n end\n\n if lgrupos.include?(GRUPO_MOVIMIENTOSSOCIALES)\n can :index, :movilizacion\n can :manage, ::Lscobertura\n end\n\n if lgrupos.include?(GRUPO_INICIATIVASPAZ)\n can :manage, ::Acp\n can :manage, ::Acpcataccion\n can :manage, ::Acpestrategia\n can :manage, ::Acpcobertura\n can :manage, ::Acpmotivo\n can :manage, ::Acpcatmotivo\n end\n\n if lgrupos.include?(GRUPO_CONFLICTOYESTADO)\n can :index, :dinamicas\n end\n\n if lgrupos.include?(GRUPO_OFICINATI)\n can :manage, Mr519Gen::Formulario\n end\n\n if lgrupos.include?(GRUPO_COMPROMISOS) || \n lgrupos.include?(GRUPO_COORDINADORGP)\n # Oficina Gerencia de Proyectos\n can :objetivospf, Cor1440Gen::Proyectofinanciero\n can :actividadespf, Cor1440Gen::Proyectofinanciero\n can :manage, Cor1440Gen::Actividad\n can [:index, :read], Cor1440Gen::Efecto\n can :manage, Cor1440Gen::Financiador\n can :manage, Cor1440Gen::Mindicadorpf\n can [:creacomogp, :read, :index, :show, :create, :validar], \n Cor1440Gen::Proyectofinanciero\n can [:manage, :validar], Cor1440Gen::Proyectofinanciero.where(\n 'respgp_id IS NOT NULL')\n\n can [:create, :read, :update], Sip::Actorsocial\n\n can :manage, :tablasbasicas\n can :manage, ::Convenio\n can :manage, ::Sectorapc\n can :manage, ::Tasacambio\n can :manage, ::Tipoanexo\n can :manage, ::Tipoconvenio\n can :manage, ::Tipomoneda\n can :manage, ::Tipoproductopf\n\n end\n if lgrupos.include?(GRUPO_GESTIONDECALIDAD)\n can :manage, Heb412Gen::Doc\n can :manage, Heb412Gen::Plantilladoc\n can :manage, Heb412Gen::Plantillahcm\n can :manage, Heb412Gen::Plantillahcr\n end\n if lgrupos.include?(GRUPO_ARCHIVOYCORRESPONDENCIA)\n can [:edit, :update], ::Usuario\n end\n if lgrupos.include?(GRUPO_GESTIONHUMANA)\n can [:edit, :update, :create], ::Usuario\n can :manage, ::Areaestudios\n can :manage, ::Cargo\n can :manage, ::Cajacompensacion\n can :manage, ::Empresaps\n can :manage, ::Fondopensiones\n can :manage, ::Niveleducacion\n can :manage, ::Perfilprofesional\n can :manage, ::Procesogh\n can :manage, ::Profesion\n can :read, Sip::Grupo\n can :manage, ::Tipocontrato\n can :manage, ::Tiponomina\n can :manage, :tablasbasicas\n end\n if lgrupos.include?(GRUPO_COMUNICACIONES)\n can :manage, Sal7711Gen::Articulo\n can :manage, ::Publicacion\n can :manage, :tablasbasicas\n end\n when Ability::ROLADMIN, Ability::ROLDIR\n can :dir, :aprobadoefecto\n can :index, :busquedaunificada\n can :index, :exploradordatosrel\n can :index, :conflictividades\n can :edit, :contextoac\n can :manage, ::Acp\n can :index, :dinamicas\n can :manage, :lineabase20182020\n can :index, :movilizacion\n can :dir, :vistobuenoactividad\n\n can :manage, ::Convenio\n can :manage, ::Tasacambio\n can :manage, ::Usuario\n\n can :manage, Cor1440Gen::Actividad\n can :manage, Cor1440Gen::Efecto\n can :manage, Cor1440Gen::Indicadorpf\n #can :manage, Cor1440Gen::Informe\n can :manage, Cor1440Gen::Mindicadorpf\n can :manage, Cor1440Gen::Proyectofinanciero\n can :manage, Cor1440Gen::Tipoindicador\n\n can :manage, Heb412Gen::Doc\n can :manage, Heb412Gen::Plantilladoc\n can :manage, Heb412Gen::Plantillahcm\n can :manage, Heb412Gen::Plantillahcr\n\n can :manage, Mr519Gen::Formulario\n can :manage, Mr519Gen::Encuestausuario\n can :manage, Mr519Gen::Encuestapersona\n can :manage, ::Planencuesta\n\n can :manage, Sip::Actorsocial\n can :manage, :tablasbasicas\n tablasbasicas.each do |t|\n c = Ability.tb_clase(t)\n can :manage, c\n end\n end\n end\n end", "title": "" }, { "docid": "5dd585666621f0a4042d4f95c2d82917", "score": "0.6065674", "text": "def create\n @grupo = Grupo.find(params[:grupo_id])\n @caso = @grupo.casos.build(params[:caso])\n\n respond_to do |format|\n if @caso.save\n current_user.add_role :relator, @caso\n format.html { redirect_to [@grupo,@caso], notice: 'Caso foi criado com sucesso.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "title": "" }, { "docid": "a82a79992335b54d5551b712018714ba", "score": "0.6062133", "text": "def grupo_params\n params.require(:grupo).permit(:id, :name, :horario)\n end", "title": "" }, { "docid": "e5573c149aa365cc201a2335658f07ac", "score": "0.6055857", "text": "def inicia_analista\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.sip_grupo_ids = [20]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "39fbad0b7a60dab4e67389fe1ed92294", "score": "0.60484844", "text": "def grupo_params\n params.require(:grupo).permit(:nombre, :facultad_id, :programa_id)\n end", "title": "" }, { "docid": "fec1f7b921f1321802c0a33259a060bb", "score": "0.6046161", "text": "def grupo_params\n params.require(:grupo).permit(:famil, :dir, :tel, :tipcasa, :estrato, :serv, :tipserv, :habit, :picasa, :murcasa, :basura, :eqcoc, :eqsal, :eqhabi, :eqcom,:locate_id)\n end", "title": "" }, { "docid": "4f570d761ac0079433fca6c818b275c6", "score": "0.60401744", "text": "def seguir(otro_usuaria)\n\t\tsiguiendo << otro_usuaria\n\tend", "title": "" }, { "docid": "09b8dca05d6365595f33c328e6b5d552", "score": "0.5990295", "text": "def grupo_params\n params.require(:grupo).permit(:codgrupo, :codsubgrupo, :codseccion, :descripcion)\n end", "title": "" }, { "docid": "c961219d0f6f70bbfc21d7d20d3f3479", "score": "0.5986504", "text": "def sacar\n\tusuario = User.find(params[:miembro])\n\tgrupo = Group.find(params[:group_id])\n\n\tputs \"///////////////////////////////////\"\n\tputs usuario.nombre\n\tputs usuario.matricula\n\tputs usuario.group.clave\n\tputs usuario.group_id\n\tputs \"//////////////////////////////////\"\n\n\tusuario.group_id = nil\n\tif usuario.save\n\t\t @exito = true;\n\t\t respond_to do |format|\n format.html { redirect_to grupo, :notice => \"Se dio de baja al alumno del grupo.\"}\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n \t\t @exito = false;\n\n format.html { redirect_to grupo, :notice => \"Ha ocurrido un error intentar dar de baja el alumno\"}\n format.xml { head :ok }\n end\n end\n end", "title": "" }, { "docid": "becf117ecf5f123f96e100b219fcbd7a", "score": "0.5985062", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "becf117ecf5f123f96e100b219fcbd7a", "score": "0.5985062", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "6333fc5bc5316a1482530a121b475fa2", "score": "0.59770125", "text": "def edit\n @usuarios = User.where(grupo: @grupo).all.map(&:nombre_completo)\n @otros_usuarios = User.where.not(grupo: @grupo).or(User.where(grupo: [nil, '']))\n end", "title": "" }, { "docid": "0d3031d794badfb61b7af2447d3d315e", "score": "0.594774", "text": "def create\n @grupo = Grupo.find(current_utilizador.grupo_id)\n @orcamento = @grupo.orcamentos.build(params[:orcamento])\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to @orcamento, notice: 'Orcamento was successfully created.' }\n format.json { render json: @orcamento, status: :created, location: @orcamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "38cb1e7bd2ac8add167dcee398b52879", "score": "0.59315103", "text": "def set_grupopermissaouser\n @grupopermissaouser = Grupopermissaouser.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "ab71a4da1f125a43627ed6bf83308067", "score": "0.5931389", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "66a4c8bbf486a9c19bdea32ca8b947e5", "score": "0.59094775", "text": "def create\n @condominio = Condominio.new(condominio_params)\n\n respond_to do |format|\n if @condominio.save\n\n if current_user.id == 1\n Grupopermissaouser.create(:user_id => 1, :grupopermissao_id => 1, :condominio_id => @condominio.id)\n end\n\n format.html { redirect_to @condominio, notice: 'Condominio was successfully created.' }\n format.json { render :show, status: :created, location: @condominio }\n else\n format.html { render :new }\n format.json { render json: @condominio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5af3f9b425035b93839feac630240b62", "score": "0.5872662", "text": "def set_grupo\n @grupo = Grupo.find(params[:id])\n end", "title": "" }, { "docid": "50befa414c6f47be0265836325e0b587", "score": "0.58688825", "text": "def grupocont_params\n params.require(:grupocont).permit(:nome, :tipo,:user_id, :ativo).merge(user_id: current_user.id)\n end", "title": "" }, { "docid": "a7eb437bfbf562f4794868ca5208c827", "score": "0.58667415", "text": "def asignarrol\n @user = User.find(params[:usuario])\n Group.find(params[:grupo]).add @user\n\n redirect_to administrador_editusers_path\n end", "title": "" }, { "docid": "b2ea58fea2edb41f69366dad2aa44a80", "score": "0.58572614", "text": "def grupo_params\n params.require(:grupo).permit(:nombre, :descripcion, :integrantes, :misiones, :administradores, :abierto, :image, :revision)\n end", "title": "" }, { "docid": "e5a11042fbc2216bd5c0889a250e9151", "score": "0.58496946", "text": "def consultar\n @credito = Credito.find(:first, :conditions =>[\"grupo_id = ?\", params[:grupo][:id] ])\n if @credito\n redirect_to :action => \"vencimiento\", :controller=>\"creditos\", :id => @credito\n else\n flash[:notice] = \"El grupo aun no tiene creditos asignados\"\n redirect_to :action => \"estado_cuenta\", :controller => \"grupos\"\n end\n end", "title": "" }, { "docid": "e5a11042fbc2216bd5c0889a250e9151", "score": "0.58496946", "text": "def consultar\n @credito = Credito.find(:first, :conditions =>[\"grupo_id = ?\", params[:grupo][:id] ])\n if @credito\n redirect_to :action => \"vencimiento\", :controller=>\"creditos\", :id => @credito\n else\n flash[:notice] = \"El grupo aun no tiene creditos asignados\"\n redirect_to :action => \"estado_cuenta\", :controller => \"grupos\"\n end\n end", "title": "" }, { "docid": "cb7e424a4de3fefcf7bb474d98d4b08b", "score": "0.58487344", "text": "def set_grupo_curso\n @grupo_curso = GrupoCurso.find(params[:id])\n end", "title": "" }, { "docid": "4555373525856a6e83fe54d3a7a16a1b", "score": "0.584411", "text": "def grupo_params\n params[:grupo][:outros_grupos_que_pode_ver_equipes] = []\n\n if params[:outros_grupos_que_pode_ver_equipes].present? && params[:grupo][:tem_encontros].present? && params[:grupo][:tem_encontros] == \"1\"\n params[:outros_grupos_que_pode_ver_equipes].each do |outro_grupo_id|\n params[:grupo][:outros_grupos_que_pode_ver_equipes] << Grupo.find(outro_grupo_id)\n end\n end\n\n params_grupo = params[:grupo]\n\n hash = ActionController::Parameters.new(nome: params_grupo[:nome],\n tem_encontros: params_grupo[:tem_encontros],\n outros_grupos_que_pode_ver_equipes: params_grupo[:outros_grupos_que_pode_ver_equipes],\n slug: nil)\n hash.permit!\n return hash\n end", "title": "" }, { "docid": "f71e9c3410ec6bf07343a28b1220294b", "score": "0.5837821", "text": "def set_grupo\n @grupo = Grupo.friendly.find(params[:id])\n end", "title": "" }, { "docid": "254eaca28827994d564cf360defde5bd", "score": "0.5793111", "text": "def oper_params\n params.require(:oper).permit(:nombre, :apellido, :telefono, :group_id)\n end", "title": "" }, { "docid": "a149e1716192018a697ca866cc6966e6", "score": "0.5768601", "text": "def asignar_condiciones(estado = @estado)\n conditions = {}\n case estado[:estado]\n when Solicitud.estado_inicial[0]\n conditions = {:usuario_id => current_user.id}\n when (Solicitud.estado_inicial[0] - 1)\n conditions = {:usuario_id => [current_user.id] + current_user.subordinado_ids}\n params[:estados] = [estado[:estado] + 1] unless params[:estados]\n else\n if params[:usuarios]\n conditions.merge({:usuario_id => params[:usuarios]})\n end\n params[:estados] = [estado[:estado] + 1] unless params[:estados]\n end\n if params[:estados]\n conditions[:estado] = params[:estados]\n end\n conditions\n\n end", "title": "" }, { "docid": "8db6d0543c18e213cd2ca18327e815b4", "score": "0.5730637", "text": "def grupo_params\n params.require(:grupo).permit(:nome, :descricao)\n end", "title": "" }, { "docid": "02940e1425a91dd295724f58002eefef", "score": "0.5728985", "text": "def catgrupo_params\n params.require(:catgrupo).permit(:Clave, :Descripcion, :Status, :TipoGrupo, :IdEmpresa)\n end", "title": "" }, { "docid": "5a26e593d9c0dd0aab302d345049e6d9", "score": "0.56909823", "text": "def add_to_omni_group\n groups << Group.find_by_name('_omni')\n end", "title": "" }, { "docid": "a90ce03fbcdfbd1d9baa84221a452683", "score": "0.5672315", "text": "def create\n @aprova = Aprova.new(params[:aprova])\n\n respond_to do |format|\n if @aprova.save\n format.html { redirect_to @aprova, notice: 'Aprova was successfully created.' }\n format.json { render json: @aprova, status: :created, location: @aprova }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aprova.errors, status: :unprocessable_entity }\n end\n end\n if current_usuario.centro == 'CMCC'\n if @aprova.tipo == 'Sim'\n @teste=Usuario.find(:first,:conditions=>{:tipo=>'Servidor (CMCC)',:id=>@aprova.aluno_id})\n @teste.update_attributes(:tipo=>'Administrador',:centro=>'CMCC')\n else\n @teste=Usuario.find(:first,:conditions=>{:tipo=>'Servidor (CMCC)',:id=>@aprova.aluno_id})\n @teste.update_attributes(:tipo=>'Aluno')\n end\n else\n if @aprova.tipo == 'Sim'\n @teste=Usuario.find(:first,:conditions=>{:tipo=>'Servidor (CCNH)',:id=>@aprova.aluno_id})\n @teste.update_attributes(:tipo=>'Administrador',:centro=>'CCNH')\n else\n @teste=Usuario.find(:first,:conditions=>{:tipo=>'Servidor(CCNH)',:id=>@aprova.aluno_id})\n @teste.update_attributes(:tipo=>'Aluno')\n end\n end\n \n \n end", "title": "" }, { "docid": "0b3248ce72148dc0feb2c384cd9f4bd0", "score": "0.5670358", "text": "def grupo_curso_params\n params.require(:grupo_curso).permit(:grupo_id, :curso_id, :nome_curso)\n end", "title": "" }, { "docid": "15c7143a4bd21f1dc927829569034c26", "score": "0.5664548", "text": "def salva_enti_associati\n @utente_selezionato = User.find(params[:id])\n #arrivano gli enti params['enti_da_associare'] => [\"5\", \"6\", \"7\"]\n enti_da_associare = params['enti_da_associare']\n if enti_da_associare.blank?\n redirect_to({ action: 'associa_enti'}, notice: 'Selezionare almeno un ente')\n else\n #associo gli enti\n enti_da_associare.each{ |id_ente|\n ente_da_associare = ClientiCliente.find(id_ente)\n EnteGestito.create(user: @utente_selezionato, clienti_cliente: ente_da_associare)\n }\n redirect_to({ action: 'associa_enti'}, :flash => { :esito => \"Enti associati con successo.\" })\n end\n end", "title": "" }, { "docid": "8ffa4298632f671425362629328f3a54", "score": "0.5662435", "text": "def solicitarMinhaParticipacao\n\n\t\tgrupo = getGrupo(params[:idGrupo])\n\t\tuser = getUser(current_user.id)\n\n\t\tif (user.nil? or grupo.nil?)\n\t\t\tnoticiar(\"Grupo ou Usuario nao existe\")\n\t\t\tredirect_to grupos_path\n\t\t\treturn\n\t\tend\n\n\n\t\tif essa_solicitacao_existe(user, grupo)\n\t\t\tnoticiar(\"Já existe solicitacao pendente\")\n\t\t\tredirect_to grupos_path\n\t\t\treturn\n\t\tend\n\t\tif eh_mebro_do_grupo(user, grupo)\n\t\t\tnoticiar(\"Voce já é membro do grupo\")\n\t\t\tredirect_to grupos_path\n\t\t\treturn\n\t\tend\n\n\t\tnoticiar(\"Solicitacao pendente\")\n\t\tgrupo.addSolicitacao(user)\n\t\tredirect_to grupos_path\n\n\tend", "title": "" }, { "docid": "485d8c2497f6f9395384d1a01553d930", "score": "0.56616825", "text": "def set_opcione \n @opcione = Opcione.find(params[:id])\n @operaciones=[\"Nada\"]\n end", "title": "" }, { "docid": "6eb2435b9f7ec1db1550ed06a7571c71", "score": "0.56583315", "text": "def set_grupo_user\n @grupo_user = GrupoUser.find(params[:id])\n end", "title": "" }, { "docid": "4661bd4588ada01e47cc5853d209d586", "score": "0.565721", "text": "def create\n @grupo = Grupo.find(params[:grupo_id])\n @proposta = @grupo.propostas.build(params[:proposta])\n @proposta.propositor = current_user\n \n \n respond_to do |format|\n if @proposta.save\n format.html { redirect_to [@grupo, @proposta], notice: 'Proposta was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "title": "" }, { "docid": "31ca3eb571a5e8d44a3d9b8827c4bb34", "score": "0.5655782", "text": "def asistencia_params\n params.permit(:utf8, :authenticity_token, :commit, :group_id, asistencia: {})\n end", "title": "" }, { "docid": "a892ef2809413edd54580138ab91db9f", "score": "0.56440586", "text": "def grupo_unico?\n @grupo = Grupo.find(self.grupo_id) if self.grupo_id\n sum=0\n\n if @grupo\n @grupo.creditos.each do |credito|\n sum+=1 if credito.status == 1\n end\n if sum > 0\n return false\n else\n return true\n end\n end\n return true\n end", "title": "" }, { "docid": "bb3407ef65c77ef5db3ce4a4434fac12", "score": "0.56230164", "text": "def grupopermissaouser_params\n params.require(:grupopermissaouser).permit(:user_id, :grupopermissao_id)\n end", "title": "" }, { "docid": "adc760d6db9686bd90d4793a6e5e068d", "score": "0.561455", "text": "def constr_copia(otro)\n @nombre = otro.nombre\n @encarcelado = otro.encarcelado\n @num_casilla_actual = otro.num_casilla_actual\n @puede_comprar = otro.puede_comprar\n @saldo = otro.saldo\n @propiedades = otro.propiedades\n @salvoconducto = otro.salvoconducto\n \n end", "title": "" }, { "docid": "fcdc9df0b541261f27ef25f760b4cd3c", "score": "0.5611816", "text": "def ciclo_params\n params.permit(:utf8, :authenticity_token, :commit, :group_id, notas: {})\n end", "title": "" }, { "docid": "6e415b5d60f42658a630ae96d17c6b1d", "score": "0.56116736", "text": "def auth_user\n @gruppo = Gruppo.find(params[:gruppo_id])\n if @gruppo.utenti.exists?(current_user)\n flash[:notice] = 'gruppo a cui sei gia aggiunto'\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "0187021736ac5116e8f1d1f6cab66654", "score": "0.56053805", "text": "def set_grupa\n @grupa = Grupa.find(params[:id])\n end", "title": "" }, { "docid": "78344b145b2f0759fcef16bb42c37d8d", "score": "0.5599163", "text": "def set_principal_groupe\n @principal_groupe = PrincipalGroupe.find(params[:id])\n end", "title": "" }, { "docid": "8512e4156e27719b86a5c055ad41c617", "score": "0.55906355", "text": "def define_estado_pedido\n #obtenemos el objeto pedido del que se quiere cambiar su estado\n @pedido = Pedido.find(params[:id])\n # obtenemos el id del estado al que se cambiara\n # consultamos si el parametro pasado es A entonces el estado del pedido\n # es ACEPTADO caso contrario RECHAZADO\n @id_estado = params[:estado] == \"A\"? EstadoPedido.find_by_descripcionEstado(\"ACEPTADO\").id : EstadoPedido.find_by_descripcionEstado(\"RECHAZADO\").id\n # coloca a FALSE el campo :estadoaut todas los registros correspondientes\n # al pedido\n Autorizacion.cambia_estado_autorizaciones(@pedido.id)\n @autorizacion = @pedido.autorizacions.new(:fecha => Time.now.strftime(\"%Y-%m-%d\"),\n :estado_pedido_id => @id_estado,\n :usuario_id => 2,\n :estadoaut => TRUE)\n if @autorizacion.save\n # consulta el tipo de cambio de estado para mostrar un mensj. personalizado\n flash[:notice] = params[:estado] == \"A\" ? \"PEDIDO AUTORIZADO SATISFACTORIAMENTE\" : \"CAMBIO DE ESTADO DE PEDIDO REGISTRADO SATISFACTORIAMENTE\"\n else\n flash[:notice] = \"NO SE PUDO AUTORIZAR EL PEDIDO, INTENTE NUEVAMENTE POR FAVOR\"\n end\n redirect_to :controller => \"autorizacions\"\n end", "title": "" }, { "docid": "970860671e4f3d755547089077b9c587", "score": "0.55877686", "text": "def set_group\n @group = Group.last\n # $grou = @group.id\n # check if company has permission to view the group\n # if !(@group.company_id == @company.id)\n # redirect_to company_path(@company.slug)\n # end\n end", "title": "" }, { "docid": "ab85aa41cfca7f91ca7c9164b462ac6c", "score": "0.55873555", "text": "def create\n curriculo_seed = params[:aluno].delete(:curriculo)\n curriculo = Curriculo.gerar(curriculo_seed)\n params[:aluno][:curriculo] = curriculo\n @aluno = Aluno.new(params[:aluno])\n @aluno.password = \"12345678\"\n @aluno.password_confirmation = \"12345678\"\n grupo_aluno = Grupo.where(internal_id: Grupo::ALUNO).first\n @aluno.grupo = grupo_aluno\n respond_to do |format|\n if @aluno.save\n format.html { redirect_success(\"Aluno adicionado com sucesso!\",:alunos, :index)}\n format.json { render json: @aluno, status: :created, location: @aluno }\n else\n puts \"--------- #{@aluno.errors.full_messages}\"\n format.html { render action: \"new\" }\n format.json { render json: @aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df3de286abd5f2816c5312357ad67bac", "score": "0.5586172", "text": "def initialize(usuario)\n # Sin autenticación puede consultarse información geográfica \n can :read, [Sip::Pais, Sip::Departamento, Sip::Municipio, Sip::Clase]\n if !usuario || usuario.fechadeshabilitacion\n return\n end\n can :contar, Sivel2Gen::Caso\n can :contar, Sip::Ubicacion\n can :buscar, Sivel2Gen::Caso\n can :lista, Sivel2Gen::Caso\n can :descarga_anexo, Sip::Anexo\n can :nuevo, Sivel2Sjr::Desplazamiento\n can :nuevo, Sivel2Sjr::Respuesta\n can :nuevo, Sip::Ubicacion\n can :nuevo, Sivel2Gen::Presponsable\n can :nuevo, Sivel2Gen::Victima\n if !usuario.nil? && !usuario.rol.nil? then\n case usuario.rol \n when Ability::ROLSIST\n can :read, Sivel2Gen::Caso, casosjr: { oficina_id: usuario.oficina_id }\n can [:update, :create, :destroy], Sivel2Gen::Caso, \n casosjr: { asesor: usuario.id, oficina_id:usuario.oficina_id }\n can [:read, :new], Cor1440Gen::Actividad\n can :new, Sivel2Gen::Caso \n can [:update, :create, :destroy], Cor1440Gen::Actividad, \n oficina: { id: usuario.oficina_id}\n can :manage, Sivel2Gen::Acto\n can :manage, Sip::Persona\n when Ability::ROLANALI\n can :read, Sivel2Gen::Caso\n can :new, Sivel2Gen::Caso\n can [:update, :create, :destroy], Sivel2Gen::Caso, \n casosjr: { oficina_id: usuario.oficina_id }\n can :read, Cor1440Gen::Informe\n can :read, Cor1440Gen::Actividad\n can :new, Cor1440Gen::Actividad\n can [:update, :create, :destroy], Cor1440Gen::Actividad, \n oficina: { id: usuario.oficina_id}\n can :manage, Sivel2Gen::Acto\n can :manage, Sip::Persona\n when Ability::ROLCOOR\n can :read, Sivel2Gen::Caso\n can :new, Sivel2Gen::Caso\n can [:update, :create, :destroy, :poneretcomp], Sivel2Gen::Caso, \n casosjr: { oficina_id: usuario.oficina_id }\n can :manage, Cor1440Gen::Informe\n can :read, Cor1440Gen::Actividad\n can :new, Cor1440Gen::Actividad\n can [:update, :create, :destroy], Cor1440Gen::Actividad, \n oficina: { id: usuario.oficina_id}\n can :manage, Sivel2Gen::Acto\n can :manage, Sip::Persona\n can :new, Usuario\n can [:read, :manage], Usuario, oficina: { id: usuario.oficina_id}\n when Ability::ROLINV\n cannot :buscar, Sivel2Gen::Caso\n can :read, Sivel2Gen::Caso \n when Ability::ROLADMIN, Ability::ROLDIR\n can :manage, Sivel2Gen::Caso\n can :manage, Cor1440Gen::Actividad\n can :manage, Cor1440Gen::Informe\n can :manage, Sivel2Gen::Acto\n can :manage, Sip::Persona\n can :manage, Usuario\n can :manage, :tablasbasicas\n @@tablasbasicas.each do |t|\n c = Ability.tb_clase(t)\n can :manage, c\n end\n end\n end\n end", "title": "" }, { "docid": "935b768cbbe0c2673ec1abe0e41cd28a", "score": "0.55733097", "text": "def set_comprobante\n @comprobante = current_user.comprobantes.find(params[:id])\n end", "title": "" }, { "docid": "799bc469a58b6a0aaa4d078dd1c78114", "score": "0.5571456", "text": "def remplazar\n @grupoper = Msip::Grupoper.find(params[:grupoper_id].to_i)\n @victimacolectiva = Sivel2Gen::Victimacolectiva.find(\n params[:victima_idcolectiva].to_i)\n grupoperant = @victimacolectiva.grupoper\n @caso = @victimacolectiva.caso\n @caso.current_usuario = current_usuario\n @victimacolectiva.grupoper = @grupoper\n remplazar_antes_salvar_vc\n @victimacolectiva.save!\n if (grupoperant.nombre == 'N') ||\n (grupoperant.nombre == '')\n remplazar_antes_destruir_gp\n grupoperant.destroy\n end\n respond_to do |format|\n format.html { render('remplazar', layout: false) }\n end\n end", "title": "" }, { "docid": "6fce1a3d69d7496109c4eeb929a6399c", "score": "0.5569002", "text": "def set_organocolegiado\n @organocolegiado = Organocolegiado.find(params[:id])\n end", "title": "" }, { "docid": "1bfcae6b281518fde8b69e99f9f266f6", "score": "0.5565117", "text": "def create\n @grupo_de_despesa = GrupoDeDespesa.new()\n\t@grupo_de_despesa[:descricao] = params[:grupo_de_despesa][:descricao]\n\t@grupo_de_despesa[:data_das_despesas] = params[:grupo_de_despesa][:data_das_despesas]\n\t@grupo_de_despesa[:usuario] = Usuario.find(params[:grupo_de_despesa][:usuario].to_i)\n\n respond_to do |format|\n if @grupo_de_despesa.save\n format.html { redirect_to @grupo_de_despesa, notice: 'Grupo de despesa was successfully created.' }\n format.json { render json: @grupo_de_despesa, status: :created, location: @grupo_de_despesa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grupo_de_despesa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5541a2c49ca6e6e628c9807bba9c6fe7", "score": "0.5560786", "text": "def create\n @grupa = Grupa.new(params[:grupa])\n @grupa.set_editors_stamp get_editors_stamp\n @grupa.set_current_user current_user\n #@grupa.klasa = true\n\n respond_to do |format|\n if @grupa.save\n if @grupa.klasa\n g = Grupa.new :nazwa => \"Dziewczęta\", :grupa_id => @grupa.id, :klasa => false\n g.save\n g = Grupa.new :nazwa => \"Chłopcy\", :grupa_id => @grupa.id, :klasa => false\n g.save\n @grupa.zarzadzaj_grupa params[:new_czlonek], params[:existing_czlonek], get_editors_stamp, current_user\n end \n flash[:notice] = 'Grupa was successfully created.'\n format.html { redirect_to(@grupa) }\n format.xml { render :xml => @grupa, :status => :created, :location => @grupa }\n else\n format.html { render :action => \"nowa_klasa\", :layout => 'application' }\n format.xml { render :xml => @grupa.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15ea4531712699fc77a2dc8d7b89d4d3", "score": "0.5560454", "text": "def create\n @grupo_horario = GrupoHorario.new(params[:grupo_horario])\n \n respond_to do |format|\n if @grupo_horario.save\n flash[:notice] = 'GrupoHorario creada correctamente.'\n format.html { params[:oper].nil? ? redirect_to(@grupo_horario) : render(:text => \"Ok\")}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @grupo_horario.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "25c073337c2decd37add2edd2f78c50c", "score": "0.5545612", "text": "def associa_enti\n \n @nome_pagina = \"Associa Enti ad Amministratore\"\n @esito = flash['esito'] unless flash.blank?\n @utente_selezionato = User.find(params[:id])\n enti_associati = @utente_selezionato.enti_gestiti.pluck(:clienti_cliente_id) if @utente_selezionato.enti_gestiti.length > 0\n if enti_associati.blank?\n @enti = ClientiCliente.all.order(\"CLIENTE asc\")\n else\n @enti = ClientiCliente.where( \"clienti__cliente.ID not IN (?)\", enti_associati).order(\"CLIENTE asc\")\n end\n \n end", "title": "" }, { "docid": "a9825d438c239959e4f4c44b19194cd0", "score": "0.55445784", "text": "def grupo_params\n params.require(:grupo).permit(:name)\n end", "title": "" }, { "docid": "8218878b91729a53d06df838db9dbd46", "score": "0.5540759", "text": "def update\n authorize! :edit, Msip::Grupo\n @grupo.no_modificar_ldap = \n request.params[:grupo][:no_modificar_ldap] == '1'\n @grupo.cnini = @grupo.cn\n @grupo.usuariosini = @grupo.usuario.map(&:id).sort\n @registro = @grupo\n respond_to do |format|\n if @grupo.update(grupo_params)\n format.html { redirect_to modelo_path(@grupo), \n notice: 'Grupo actualizado con éxito.' }\n format.json { head :no_content }\n else\n format.html {\n if !@grupo.valid?\n render action: \"edit\", layout: 'application' \n else\n redirect_back fallback_location: root_path,\n flash: {error: \"No pudo actualizar grupo\"}\n end\n }\n format.json { \n render json: @grupo.errors, status: :unprocessable_entity \n }\n end\n end\n end", "title": "" }, { "docid": "d0ea8a9e28347e6f265d386dbc9dd2d0", "score": "0.553788", "text": "def index\n @grupo_id = params[:grupo_id]\n \n @sub_grupos = SubGrupo.where(\"grupo_id = ?\",@grupo_id)\n end", "title": "" }, { "docid": "56739a9298ce39b9538fbc9387f944c3", "score": "0.5526391", "text": "def initialize (grupo,nombre,proteinas,glucidos,grasas)\n super(nombre,proteinas,glucidos,grasas,[])\n @grupo = grupo\n end", "title": "" }, { "docid": "82c1e6693f1b1f91aeb16634a757fc47", "score": "0.5523884", "text": "def create\n @acceso = Acceso.new({\n :user_id => params[:usuario],\n :group_id=> params[:group_id],\n :app_id_s=> params[:servicio],\n :app_id_h=> params[:hyp],\n :asesor => params[:asesor],\n :garantias => params[:garantias],\n :usuario=> current_sistema.id\n })\n respond_to do |format|\n if @acceso.save\n format.html { redirect_to '/panel', notice: 'Acceso was successfully created.' }\n format.json { render :show, status: :created, location: @acceso }\n else\n format.html { render :new }\n format.json { render json: @acceso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe7a48b995f7b2856826f8cef4932c0b", "score": "0.5521519", "text": "def create\n @grupo_curso = GrupoCurso.new(grupo_curso_params)\n\n respond_to do |format|\n if @grupo_curso.save\n format.html { redirect_to @grupo_curso, notice: 'Equipe cadastrada com sucesso!' }\n format.json { render :show, status: :created, location: @grupo_curso }\n else\n format.html { render :new, @current_usuario => current_usuario }\n format.json { render json: @grupo_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f4eedeb1c52102b2e08ea644647b854", "score": "0.55192995", "text": "def abrir_recrutamento\n\n tipo = params[:tipo].to_i #tipo=1 é pra membros e tipo=2 é pra estagios\n @comite = Comite.find_by_id(params[:id]) #seleciona o comite pelo o id que esta no request\n @formulario = @comite.formularios.formulario_activo(tipo) #vai buscar o formulario que esta activo de membros\n \n if tipo == 1\n @formulario_membro_novo = @comite.formularios.build(:nome=>\"Formulario Membros\",:comite_id=> @comite.id,:tipo=>1)\n else\n @formulario_membro_novo = @comite.formularios.build(:nome=>\"Formulario Estagios\",:comite_id=> @comite.id,:tipo=>2)\n end\n\n if !@formulario.nil?\n @formulario.estado = 0 #altera o estado do formulario antigo outro para 0\n @formulario.save \n end #salva o formulario antigo\n \n @formulario_membro_novo.save #guarda o formulario novo\n\n\n @formulario.pergunta_forms.each do |p| # copia todas as perguntas do formulario antigo para o novo\n p = @formulario_membro_novo.pergunta_forms.build(pergunta_id:p.pergunta_id,ordem:p.ordem,obrigatoria:p.obrigatoria)\n p.save\n end\n \n @formulario_membro_novo.save #guarda o formulario novo\n\n \n\n respond_to do |format|\n format.html { redirect_to path }\n format.json { head :no_content }\n end\n\n end", "title": "" }, { "docid": "7093cf31d15554c3ac88a37d85a83e98", "score": "0.5511962", "text": "def update\n precisa_ser_super_admin\n return if performed?\n\n adicionar_breadcrumb @grupo.nome, @grupo, \"editar\"\n\n @pessoa = Pessoa.new if @pessoa.nil?\n\n respond_to do |format|\n if @grupo.update(grupo_params)\n if @grupo.tem_encontros\n encontro_padrao = Encontro.new({\n padrao: 1, \n nome: 'Padrão', \n denominacao_conjuntos_permanentes: 'Círculo'})\n @grupo.encontro_padrao = encontro_padrao\n @grupo.save\n end\n\n format.html { redirect_to grupos_url, notice: 'Grupo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'show' }\n format.json { render json: @grupo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f8b2aa96c84aeda64fab359098c639c6", "score": "0.5510371", "text": "def groupe_params\n params.require(:groupe).permit(:nom, :code, :description, :is_active)\n end", "title": "" }, { "docid": "fe8ccbcd327627c7167c36c1b4897e55", "score": "0.55096513", "text": "def comosupo_params\n params.require(:comosupo).permit( *(atributos_index - [\"id\"]))\n end", "title": "" }, { "docid": "e986bc744fd910d110ad79d9f6a6abe3", "score": "0.5503051", "text": "def new\n @grupo = Grupo.find(params[:grupo_id])\n @caso = @grupo.casos.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caso }\n end\n end", "title": "" }, { "docid": "a6812edcdfd3e5e224773358c6a13ea2", "score": "0.550185", "text": "def asociarfacturaodetalle\n #errors.add(:pagocontado,\"Debe asociar alguna Factura o Detalle en el Recibo.\") if !self.id.nil? and self.renglon_recibos.empty? and self.renglon_recdetalles.empty?\n end", "title": "" }, { "docid": "e2fa15dcc99efda8d1c54dc8a3b0d9cb", "score": "0.5500019", "text": "def index\n @grupo_comunitarios = GrupoComunitario.all\n end", "title": "" }, { "docid": "5141247a3fe34f008e20a390317e672e", "score": "0.5499307", "text": "def create\n @user = Utente.find(current_user.id)\n @gruppo = Gruppo.new(params[:gruppo])\n respond_to do |format|\n if @gruppo.save\n @gruppo.utenti << @user \n @calendario = Calendario.create(:descrizione => \"calendario del gruppo #{@gruppo.nome}\", :gruppo_id => @gruppo.id)\n format.html { redirect_to @gruppo, notice: 'Gruppo creato correttamente' }\n format.json { render json: @gruppo, status: :created, location: @gruppo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gruppo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a2dd2271d5214078e28d97a92b194822", "score": "0.54943377", "text": "def inicia_ope(rol_id)\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [rol_id]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "a2dd2271d5214078e28d97a92b194822", "score": "0.54943377", "text": "def inicia_ope(rol_id)\n current_usuario = Usuario.create!(PRUEBA_USUARIO_AN)\n current_usuario.grupo_ids = [rol_id]\n current_usuario.save\n return current_usuario\n end", "title": "" }, { "docid": "b8f648f247b0d3f4ec7c0f05f4d4f957", "score": "0.5493913", "text": "def set_agregado\n @objeto = Agregado.find(params[:id])\n end", "title": "" }, { "docid": "21a28d7c085e145e6f5c3d72f52dd684", "score": "0.5491462", "text": "def set_orgao_sistema\n @orgao_sistema = OrgaoSistema.find(params[:id])\n end", "title": "" }, { "docid": "acc7dbee7fd174ca607bda78febf6f10", "score": "0.54911184", "text": "def seleciona_ocupacao_orgao(orgao_ocupacao)\n ocupacao_orgao_select.select(orgao_ocupacao)\n end", "title": "" }, { "docid": "4b59aa5e2b7cea7120bc57316ecc43ea", "score": "0.5490612", "text": "def validate_opciones\n opciones = []\n for rol in @usuario.roles\n opciones = opciones | rol.opciones\n end\n ruta = self.class.controller_path\n opcion = nil\n if ruta == 'prestamos/consulta_prestamo' && (self.action_name == 'view' || self.action_name == 'tasa_historico_list_view' || self.action_name == 'tasa_historico_list')\n ruta = ruta + \"/#{self.action_name}\"\n end\n if session[:menu_string].nil?\n if ruta == 'basico/ayuda' || ruta=='inicio' || opciones.find {|opcion| opcion.ruta == ruta }\n @valid_menu, valid = fill_menu(Menu.find(:all, :conditions=>['parent_id isnull'], :order=>'orden'), opciones)\n logger.debug \"Valid Menu ========> #{@valid_menu.inspect}\"\n logger.debug \"Opcion ========> #{opcion.inspect}\"\n return [true, opcion]\n logger.debug \"(no quitar este logger debug) deja de funcionar el validate_opciones en basico/instancia_comite_nacional\" \n else\n return [false, nil]\n logger.debug \"(no quitar este logger debug) deja de funcionar el validate_opciones en basico/instancia_comite_nacional\" \n end\n else\n logger.debug \"Paso por el else\"\n @valid_menu = session[:menu_string]\n if ruta == 'basico/ayuda' || ruta=='inicio' || opciones.find {|opcion| opcion.ruta == ruta }\n return [true, opcion]\n logger.debug \"(no quitar este logger debug) deja de funcionar el validate_opciones en basico/instancia_comite_nacional\" \n end \n end\n end", "title": "" }, { "docid": "f3f7f4f11ed1d88549ce754def7ca0e3", "score": "0.54829377", "text": "def set_orcamentorealizado\n @orcamentorealizado = Orcamentorealizado.find(params[:id])\n end", "title": "" }, { "docid": "baa619cef2bacfe3a33197c038ceda91", "score": "0.54689157", "text": "def create\n @user = Usuario.new(params[:usuario])\n @orgaos=Orgao.order(:sigla).collect{|o|[o.sigla,o.id]}\n respond_to do |format|\n if @user.save\n format.html { redirect_to(usuarios_url, :notice => 'Usuario criado com sucesso.') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "1ff43bc1e625009a7744072fb63b7777", "score": "0.5468416", "text": "def set_utilizador\n @utilizador = Utilizador.find(params[:id])\n # @utilizador = @current_utilizador\n @noticias = @utilizador.noticium\n @competencias = @utilizador.competencium\n @cursos = @utilizador.curso\n @empregos = @utilizador.emprego\n @contactos = @utilizador.contacto\n @contactos_aceites = Array.new\n @contactos.each do |c|\n if c.estado == \"Aceite\"\n @contactos_aceites.push(c)\n end\n end\n if !(@empregos.size)==0\n @colegas = Empresa.find(@empregos.last.empresa_id).emprego\n end\n# @contactos_colegas = Array.new\n# @contactos_aceites.each do |c|\n# if @empregos.last == Utilizador.find(c.utilizador2_id).emprego.last\n# @contactos_colegas.push(c)\n# end\n# end\n\n end", "title": "" }, { "docid": "ff6fc7de67599c7f303b26617e1a38f9", "score": "0.54672486", "text": "def permisos_usuario\n authorize! :permisos_usuario,Administracion::Usuario\n @controladores = Administracion::Controlador.all\n end", "title": "" }, { "docid": "2493f2a8ab0f91ed8d05d7bfb39ea0d5", "score": "0.54629385", "text": "def index\n @grupopermissaousers = Grupopermissaouser.all\n end", "title": "" } ]
8242c9122a5759e4a61fa8b107414a52
update Updates all editable attributes of the billing_group with the given id.
[ { "docid": "5cdf4580326093f66d1f0ff280c3f339", "score": "0.71274424", "text": "def update(bg_id, billing_group_editable, opts = {})\n data, _status_code, _headers = billing_group_update_with_http_info(bg_id, billing_group_editable, opts)\n data\n end", "title": "" } ]
[ { "docid": "7cdff7b9e860ff627ac528398a9b7e56", "score": "0.6874498", "text": "def update_group(group_or_id, attributes)\n instantize_group(group_or_id).update(attributes)\n end", "title": "" }, { "docid": "38e3e3c8466f5d44863a74f63cf7e546", "score": "0.6728169", "text": "def billing_group_update_with_http_info(bg_id, billing_group_editable, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BillingGroupsApi.billing_group_update ...'\n end\n # verify the required parameter 'bg_id' is set\n if @api_client.config.client_side_validation && bg_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bg_id' when calling BillingGroupsApi.billing_group_update\"\n end\n pattern = Regexp.new(/^bg_[a-zA-Z0-9]+$/)\n if @api_client.config.client_side_validation && bg_id !~ pattern\n fail ArgumentError, \"invalid value for 'bg_id' when calling BillingGroupsApi.billing_group_update, must conform to the pattern #{pattern}.\"\n end\n\n # verify the required parameter 'billing_group_editable' is set\n if @api_client.config.client_side_validation && billing_group_editable.nil?\n fail ArgumentError, \"Missing the required parameter 'billing_group_editable' when calling BillingGroupsApi.billing_group_update\"\n end\n # resource path\n local_var_path = '/billing_groups/{bg_id}'.sub('{' + 'bg_id' + '}', CGI.escape(bg_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/json', 'application/x-www-form-urlencoded', '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\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(billing_group_editable)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BillingGroup'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"BillingGroupsApi.billing_group_update\",\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: BillingGroupsApi#billing_group_update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "b3f26b891f38ad83bf6dbe706ef488d8", "score": "0.6703557", "text": "def update_group(id, params = {})\n put(\"/groups/#{id}\", params)\n end", "title": "" }, { "docid": "296c9b24e1dc384e1b0c6d377df364a1", "score": "0.670186", "text": "def update_group(group_id, attributes)\n put(\"/v1/groups/#{group_id}\", attributes)\n end", "title": "" }, { "docid": "681c5cbf6c1e5038fc3bc5eca460995b", "score": "0.6485576", "text": "def update_group(group, attributes)\n group.update(attributes)\n end", "title": "" }, { "docid": "5cf5c736c50a7b376fb40566d0527bb8", "score": "0.6480836", "text": "def update\n @group = Group.find(by_id)\n if @group.update_attributes(group_params)\n flash[:success] = \"Group updated\"\n redirect_to @group\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "95adda7d604e47373692bb25b39d8136", "score": "0.6419842", "text": "def update_group(id, params)\n put(\"groups/#{id}\", group: params)\n end", "title": "" }, { "docid": "def55b136ebc767ba96741e02b5ac763", "score": "0.6374591", "text": "def update\n @group = Group.find(params[:group_id])\n if @purchase.update(purchase_params)\n redirect_to group_purchase_path(@group,@purchase), notice: 'purchase was successfully updated!'\n else\n render action: 'edit'\n end\n end", "title": "" }, { "docid": "4cd0cf12c30c1941e1f8a66943e5da9b", "score": "0.6349143", "text": "def update\n @record_group = RecordGroup.find(params[:id])\n @record_group.accessible = :all if admin?\n respond_to do |format|\n if @record_group.update_attributes(params[:record_group])\n flash[:notice] = 'RecordGroup was successfully updated.'\n format.html { redirect_to(@record_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @record_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d475daf0897fde7012389e2b11fa7c91", "score": "0.6315471", "text": "def update\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9c8de2078908a6ff810abe52a191928", "score": "0.6219516", "text": "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "60b04d5d4df83dce33084670605546a0", "score": "0.6195341", "text": "def update!(**args)\n @group_id = args[:group_id] if args.key?(:group_id)\n end", "title": "" }, { "docid": "60b04d5d4df83dce33084670605546a0", "score": "0.6195341", "text": "def update!(**args)\n @group_id = args[:group_id] if args.key?(:group_id)\n end", "title": "" }, { "docid": "9a334853f55e82644fe4be5be92f1c33", "score": "0.6158896", "text": "def update\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n if @attribute_group.update_attributes(params[:attribute_group])\n format.html { redirect_to(@attribute_group, :notice => 'Attribute group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attribute_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab83680aca672d145959a116d2fe4e77", "score": "0.6146431", "text": "def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c27c47b079ab040c8d75580e9b3a9970", "score": "0.61170506", "text": "def update #:nodoc:\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = I18n.t(\"{{value}} was successfully updated.\", :default => \"{{value}} was successfully updated.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n format.html { redirect_to groups_url }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bf70069c125404a37376707fc2ecc00", "score": "0.6116993", "text": "def update_asset_group(id, opts = {})\n data, _status_code, _headers = update_asset_group_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "2c327b93eae51534584ad606bc9e76a5", "score": "0.61132103", "text": "def update(id:, mode: 'on')\n id_check('id', id)\n valid_value_check(:mode, mode, VALID_MODES)\n\n cf_patch(path: \"/zones/#{zone_id}/firewall/waf/packages/#{package_id}/groups/#{id}\", data: {mode: mode})\n end", "title": "" }, { "docid": "0eb3c3b0f7f0d60969d4dbe1e7de283f", "score": "0.60955346", "text": "def update_customer_group(group_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/groups/{group_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'group_id' => { 'value' => group_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "title": "" }, { "docid": "cef1eba26dbd83e47f19654db7b34ec8", "score": "0.6080631", "text": "def update\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n flash[:notice] = t('flash_msg47')\n @groups = Group.all\n # format.html { redirect_to(@group) }\n # format.xml { head :ok }\n else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "403ef09a0c93f4e7b9a9ded2cbd785ab", "score": "0.60792357", "text": "def update\n @field_group = FieldGroup.find(params[:id])\n @field_group.update_attributes(field_group_params)\n\n respond_with(@field_group)\n end", "title": "" }, { "docid": "c9823ae0a86d2d932bf882249308ea1c", "score": "0.60744745", "text": "def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4dbb1c0ed9c16d3792c0f48f282f919d", "score": "0.60457027", "text": "def update\n @breadcrumb = 'update'\n @ratio_group = RatioGroup.find(params[:id])\n @ratio_group.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @ratio_group.update_attributes(params[:ratio_group])\n format.html { redirect_to @ratio_group,\n notice: (crud_notice('updated', @ratio_group) + \"#{undo_link(@ratio_group)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ratio_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57860f5e04b7446aa3989e481bdd4e30", "score": "0.60432833", "text": "def update\n @group_banner = GroupBanner.find(params[:id])\n\n respond_to do |format|\n if @group_banner.update_attributes(params[:group_banner])\n format.html { redirect_to(@group_banner, :notice => l(:notice_successful_update)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_banner.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1b826f5ea886d11219fa4b5ea109d723", "score": "0.6032831", "text": "def update\n\t\t@group = Group.find(params[:id])\n\t\t@group.update_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e7b707ff7327ce3fe0cb1a3f0c1a92a8", "score": "0.6017661", "text": "def update\n @group = Group.find(params[:id])\n if @group.update_attributes(params[:group])\n flash[:notice] = \"Grupo actualizado.\"\n redirect_to groups_path\n else\n render :action => 'edit'\n end\n end", "title": "" }, { "docid": "bc07532f1f27eb69006d34b15668626a", "score": "0.60000044", "text": "def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end", "title": "" }, { "docid": "ed8cf73d4dd7097e794758adea162c88", "score": "0.5993225", "text": "def update\n @ail_group = AilGroup.find(params[:id])\n\n respond_to do |format|\n if @ail_group.update_attributes(params[:ail_group])\n flash[:notice] = 'AilGroup was successfully updated.'\n format.html { redirect_to(@ail_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ail_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16ccd86e567104a2f19c7c5f664bfeb9", "score": "0.59930676", "text": "def update\n\t\t@group = Group.find(params[:id])\n\t\t@group.update_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name, :error => @group.errors.full_messages)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "36e931e845f8a6bea7a019d69c7912a2", "score": "0.5990504", "text": "def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eaf1f18c3ffe1416b2a634038b0fb28d", "score": "0.5989189", "text": "def update\n @group = Group.find(params[:id])\n authorize @group, :update?\n respond_to do |format|\n if @group.update_attributes(permitted_params)\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4e41766d2c601b5ad23c7e5eae451bf", "score": "0.59533966", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4e41766d2c601b5ad23c7e5eae451bf", "score": "0.59533966", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41159dde9b1ee18636e2d4bdc2ab7ef4", "score": "0.59515274", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to( view_group_path(@group.label), :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6af817eeb64ce563c0448971bb779cf4", "score": "0.5947891", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6af817eeb64ce563c0448971bb779cf4", "score": "0.5947891", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6af817eeb64ce563c0448971bb779cf4", "score": "0.5947891", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cef4d0da8a669a411b2ff6b17bcf2c12", "score": "0.5939698", "text": "def update\n @group = Group.find_by_param(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20d8c291ca9a1ccfc3e42ab1623153d2", "score": "0.5937702", "text": "def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end", "title": "" }, { "docid": "ce93cc8d3ef1dd028fb0716de43e2daa", "score": "0.5935433", "text": "def update\n @group = load_group\n @group_form = group_form\n\n if @group_form.valid? && @group_form.save\n redirect_to(admin_group_path(@group_form.id))\n else\n render :edit\n end\n end", "title": "" }, { "docid": "7e75922d761a5fd4d77085a7b5f70f4e", "score": "0.5933903", "text": "def update\n @groupaddrobj = Groupaddrobj.find(params[:id])\n\n respond_to do |format|\n if @groupaddrobj.update_attributes(params[:groupaddrobj])\n format.html { redirect_to @groupaddrobj, notice: 'Groupaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @groupaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abf052fc13f8d7014f4a4fcbb8ba2922", "score": "0.59317744", "text": "def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "abf052fc13f8d7014f4a4fcbb8ba2922", "score": "0.59317744", "text": "def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e454534589658a72f7422f962591a374", "score": "0.5930872", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efd6acfa2cc5b8e9667130778bbab76b", "score": "0.59267026", "text": "def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e3f5ad61048cc777e8aa17d2898b8df1", "score": "0.59245026", "text": "def update\n @giving_group = GivingGroup.find(params[:id])\n\n respond_to do |format|\n if @giving_group.update_attributes(params[:giving_group])\n flash[:notice] = 'GivingGroup was successfully updated.'\n format.html { redirect_to(@giving_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @giving_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa48549b5ae0bd9b5a73c44ae5ae34ae", "score": "0.5923849", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dfb23f74024c23b2d9ba3bf6856790e5", "score": "0.59211767", "text": "def update\n @objectgrouptoobjectgroup = Objectgrouptoobjectgroup.find(params[:id])\n\n respond_to do |format|\n if @objectgrouptoobjectgroup.update_attributes(params[:objectgrouptoobjectgroup])\n flash[:notice] = 'Objectgrouptoobjectgroup was successfully updated.'\n format.html { redirect_to(@objectgrouptoobjectgroup) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @objectgrouptoobjectgroup.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af9697b361d0c9d26709ff34fc4f93fa", "score": "0.5920899", "text": "def update_group_with_http_info(group_id, group_body_update, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GroupsApi.update_group ...\"\n end\n # verify the required parameter 'group_id' is set\n fail ArgumentError, \"Missing the required parameter 'group_id' when calling GroupsApi.update_group\" if group_id.nil?\n # verify the required parameter 'group_body_update' is set\n fail ArgumentError, \"Missing the required parameter 'group_body_update' when calling GroupsApi.update_group\" if group_body_update.nil?\n # resource path\n local_var_path = \"/groups/{groupId}\".sub('{format}','json').sub('{' + 'groupId' + '}', group_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(group_body_update)\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GroupEntry')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: GroupsApi#update_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "92029dd12965edb5bbe7cf3d44644f24", "score": "0.5916652", "text": "def update\n\t\tparams[:group][:member_ids] = (params[:group][:member_ids] << @group.member_ids).flatten\n\t\t#special method update_attribute only updates explicitly stated attribute\n\t\tif @group.update_attributes(params[:group])\n\t\t\tredirect_to @group\n\t\t\tflash[:success] = \"group updated\"\n\t\tend\n\tend", "title": "" }, { "docid": "b5390bac95cc58d256a955bd88797767", "score": "0.5914007", "text": "def update\n unless @group.update(group_params)\n render :edit and return\n end\n msg = [\"Updated group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end", "title": "" }, { "docid": "528f64b802fbd941a0ad1c6df53d758e", "score": "0.5909857", "text": "def update(billing_key, options = {})\n raise MethodNotImplemented\n end", "title": "" }, { "docid": "236379e47847229a1a4e78d399f87eff", "score": "0.59070987", "text": "def update\n @target_group = TargetGroup.find(params[:id])\n\n respond_to do |format|\n if @target_group.update_attributes(params[:target_group])\n flash[:notice] = 'TargetGroup was successfully updated.'\n format.html { redirect_to([:admin, @target_group]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @target_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc20af0bfc0c3ef724f40f35c0fc6add", "score": "0.5901488", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:success] = \"Группа успешно отредактирована.\"\n format.html { redirect_to @group }\n format.json { head :no_content }\n else\n flash.now[:error] = \"Введены некорректные данные!\"\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9a810a8294b0c46f5085031cad3d1103", "score": "0.5882284", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e28eee9344237abcfca972e2f3db6369", "score": "0.5860707", "text": "def update\n @group = Group.find(params[:id])\n if !@group.admin.empty?\n @user=User.find(@group.admin)\n puts \"///////group controller update//////////\"+ @user.to_json\n @user.update_attributes(role: '1')\n @user.update_attributes(group_id: @group._id)\n end\n @group.update_attributes(params[:group])\n #format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n #format.json { render json: @group, status: :accepted, location: @group }\n render 'show'\n #format.html { render action: \"edit\" }\n #format.json { render json: @group.errors, status: :unprocessable_entity } \n end", "title": "" }, { "docid": "cd85e947490f8db18eed83a80b5a69a2", "score": "0.58533126", "text": "def update\n if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\n end\n end", "title": "" }, { "docid": "3a4f7c99f0d260872f438a86644be13b", "score": "0.58402103", "text": "def update\n @group.update(group_params)\n respond_with(@group)\n end", "title": "" }, { "docid": "9b84c40fb16096c772869c858ab9340d", "score": "0.583507", "text": "def update_asset_group_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetGroupApi.update_asset_group ...'\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 AssetGroupApi.update_asset_group\"\n end\n # resource path\n local_var_path = '/api/3/asset_groups/{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;charset=UTF-8'])\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[:'asset_group'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetGroupApi#update_asset_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a149b3ca05268b50d37e1de81b4cce05", "score": "0.5832497", "text": "def edit_group(id, options)\n params = get_group(id)\n params.update(options)\n post(EDIT_GROUP_URI, params)\n end", "title": "" }, { "docid": "a149b3ca05268b50d37e1de81b4cce05", "score": "0.5832497", "text": "def edit_group(id, options)\n params = get_group(id)\n params.update(options)\n post(EDIT_GROUP_URI, params)\n end", "title": "" }, { "docid": "4cf21abd39c41a1ea557e64183c57a2d", "score": "0.58223575", "text": "def update\n @expensegroup = Expensegroup.find(params[:id])\n\n respond_to do |format|\n if @expensegroup.update_attributes(params[:expensegroup])\n flash[:notice] = 'Expensegroup was successfully updated.'\n format.html { redirect_to(@expensegroup) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expensegroup.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71834b41f269387868efa38af16d58f4", "score": "0.5822208", "text": "def update\n @group_member = GroupMember.find(params[:id])\n\n respond_to do |format|\n if @group_member.update_attributes(params[:group_member])\n format.html { redirect_to @group_member, notice: 'Group member was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: { errors: @group_member.errors, status: :unprocessable_entity }}\n end\n end\n end", "title": "" }, { "docid": "98e415731dadb4ad9e5dbdaec9c0ef89", "score": "0.5817202", "text": "def update\n @targetgroup = Targetgroup.find(params[:id])\n\n respond_to do |format|\n if @targetgroup.update_attributes(params[:targetgroup])\n flash[:notice] = 'Targetgroup was successfully updated.'\n format.html { redirect_to(@targetgroup) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @targetgroup.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e96e8dde3cfc4bdc99938af43fc93261", "score": "0.5810236", "text": "def update\n if @contact_group.update(contact_group_params)\n render json: @contact_group, status: :ok\n else\n render json: @contact_group.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8b0189402875951a39e9ec08b914ace3", "score": "0.58069146", "text": "def update\n if @group.update(group_params)\n redirect_to @group, notice: 'Group was successfully updated.'\n else\n render :edit\n end\n end", "title": "" }, { "docid": "78edb7f471f1f57d63005692f1fb1b46", "score": "0.5806185", "text": "def update\n @add_to_group = AddToGroup.find(params[:id])\n\n respond_to do |format|\n if @add_to_group.update_attributes(params[:add_to_group])\n format.html { redirect_to(@add_to_group, :notice => 'Add to group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @add_to_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ed5543d75574d2d8ab238231b085bb38", "score": "0.5800984", "text": "def update\n @access_group = AccessGroup.find(params[:id])\n\n respond_to do |format|\n if @access_group.update_attributes(params[:access_group])\n format.html { redirect_to @access_group, notice: 'Access group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "10e8d5bd900caf8a0cc8470213567f7c", "score": "0.5784493", "text": "def update\n @rebalancegroup = Rebalancegroup.find(params[:id])\n\n @g_name = params[:g_name]\n @modify_at = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n if @rebalancegroup.update_attributes(:group_name=>@g_name, :lst_modify_at=> @modify_at)\n render :text => @g_name+\"--update success\"\n end\n\n end", "title": "" }, { "docid": "0e1c12d07d9a985a2bc2ca5c076f48c6", "score": "0.57792807", "text": "def update!(**args)\n @group_ids = args[:group_ids] if args.key?(:group_ids)\n @id = args[:id] if args.key?(:id)\n end", "title": "" }, { "docid": "c96e9fcafdcf5b6e6b5721d1aec08802", "score": "0.5769354", "text": "def update\n @billing_option.update(billing_option_params)\n @billing_options = BillingOption.all\n @billing_option = BillingOption.new\n end", "title": "" }, { "docid": "a7940931c5d013698bb5e1be3b343cd4", "score": "0.57651925", "text": "def update\n @group = Group.find(params[:id])\n @group.name = params[:group][:name]\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'edit'\n end\n end", "title": "" }, { "docid": "2f1c0174a6727ff317b60ca1e199700e", "score": "0.5764062", "text": "def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d363f2c7158c427ad8ae30a817c98a5", "score": "0.5754618", "text": "def update\n @group_record = GroupRecord.find(params[:id])\n\n respond_to do |format|\n if @group_record.update_attributes(params[:group_record])\n format.html { redirect_to @group_record, notice: 'Group record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_record.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "af57f0517487349f0490678b99eda9d7", "score": "0.5745149", "text": "def update\n respond_to do |format|\n #確定編輯後的id一定是編輯者本人\n @group.user = @user\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc4f5c5475126ce6529c8a9d5b89fb3e", "score": "0.5744833", "text": "def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\n end", "title": "" }, { "docid": "6c3c55381579edac5533fdabdecef142", "score": "0.574275", "text": "def update\n begin\n group = Group.find(params[:id])\n if params[:name] and group.update_attributes(name: params[:name])\n render json: { \"notice\"=>\"group name updated to #{params[:name]}\" }\n else\n render json: { \"alert\"=>\"record not updated. check your params.\" }\n end\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record updated.\" }\n end\n end", "title": "" }, { "docid": "03c26761fc361e42f4af0ffc2d44ec5b", "score": "0.5731053", "text": "def update\n @subscription_group = SubscriptionGroup.find(params[:id])\n\n respond_to do |format|\n if @subscription_group.update_attributes(params[:subscription_group])\n format.html { redirect_to @subscription_group, notice: 'Subscription group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "970f7ef90746d803769c2391dc9fafac", "score": "0.57306576", "text": "def update\n @contact_group = ContactGroup.find(params[:id])\n\n respond_to do |format|\n if @contact_group.update_attributes(params[:contact_group])\n format.html { redirect_to(@contact_group, :notice => 'Contact group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a0ef58d039c3319046af9c6fc798a6e4", "score": "0.57293123", "text": "def update\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Group\"[], \"updated\"[]]\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64c6664c12fb77620f230cd8d3b10b00", "score": "0.57267964", "text": "def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5de927cec9341c607c432592dc3c038f", "score": "0.5718412", "text": "def update\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n if @user_group.update_attributes(params[:user_group])\n format.html { redirect_to @user_group, notice: 'User group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0d5978c0647c4d05c10ef5ca967ded3d", "score": "0.57149756", "text": "def update\n respond_to do |format|\n if @member_group.update(member_group_params)\n format.html { redirect_to @member_group, notice: 'Member group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @member_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0ce326b91fbaaafb31cd219fe490a6c5", "score": "0.5711725", "text": "def update\n @group = Group.find(params[:id])\n if @group.update(post_params)\n redirect_to @group\n else\n render :edit, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b0bc21e8f6633a244f145df3e54405c0", "score": "0.5692353", "text": "def update(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params[:id] and !params[:id].is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: name must be an String\") if params[:name] and !params[:name].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: notes must be an String\") if params[:notes] and !params[:notes].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: user_ids must be an String\") if params[:user_ids] and !params[:user_ids].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: admin_ids must be an String\") if params[:admin_ids] and !params[:admin_ids].is_a?(String)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params[:id]\n\n Api.send_request(\"/groups/#{@attributes[:id]}\", :patch, params, @options)\n end", "title": "" }, { "docid": "5df7caf410d2ffb5db6eae7280724e04", "score": "0.5685517", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to params[:back_to], notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04d59e916195c5d8fde742296805dcbf", "score": "0.56852186", "text": "def update\n if @group.update_attributes(params[:group])\n flash[:notice] = t(\"group.updated\")\n redirect_to list_groups_path(:page => params[:page])\n return\n end\n\n render :action => :edit\n end", "title": "" }, { "docid": "11cb96ff15cd60a89cfa9802e99e5bea", "score": "0.5684241", "text": "def update\n respond_to do |format|\n if @group.update(group_params)\n audit(@group, \"update\", @group.name)\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "687f82aecff29c643dec2fbac8e7b6d3", "score": "0.5680005", "text": "def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "4bc1ae4a1cd5518118a0a2cc42f9d733", "score": "0.5678596", "text": "def edit\n @group = Group.find_by_id params[:id]\n end", "title": "" }, { "docid": "745ef6aac5cccb4241e1d4a8605f053f", "score": "0.56784755", "text": "def update\n\n respond_to do |format|\n if @expense_group.update_attributes(expense_group_params)\n format.html { redirect_to @expense_group, notice: 'Expense group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_group.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67d821057992fd5fe0c106b8ac541539", "score": "0.5672849", "text": "def update\n @city = City.find(params[:city_id])\n @group = @city.groups.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n gflash :notice => \"Your group was successfully updated.\"\n format.html { redirect_to [@city, @group] }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: (@group).errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e31c419e55f65fbfd3716c7f82a2c3d4", "score": "0.5667171", "text": "def update\n @assign_group_place.update(assign_group_place_params)\n end", "title": "" }, { "docid": "392d0649820873260f775988d790b48d", "score": "0.5657451", "text": "def update\n if @auth_ip_address_group.update_attributes(auth_ip_address_group_params)\n render json: @auth_ip_address_group, status: :ok\n else\n render_error(@auth_ip_address_group, :unprocessable_entity)\n end\n end", "title": "" }, { "docid": "17db706e1584d441e67dbd98981a34c9", "score": "0.5657096", "text": "def update\n # @client = Client.find(params[:client_id])\n # @group_member = GroupMember.where(:id => params[:id]).where(:client_id => params[:client_id])\n \n respond_to do |format|\n if @group_member.update(group_member_params)\n format.html { redirect_to client_group_member_path(@client,@group_member), notice: 'Group member was successfully updated.' }\n format.json { render :show, status: :ok, location: @group_member }\n else\n format.html { render :edit }\n format.json { render json: @group_member.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
b6c54801cec8210748fba1b43ff6a3a1
Convert to code from name of item.
[ { "docid": "0a829d8a3e45fe5b128d6a09d053d9a6", "score": "0.7042254", "text": "def code_from_name!(name)\n from_name(name)[:code]\n end", "title": "" } ]
[ { "docid": "fb9f5f74aa8b0810636ffa607045bdd0", "score": "0.6610623", "text": "def to_code\n \"#{@name}\"\n end", "title": "" }, { "docid": "3b8a87c7c2fe0ad397a505795d6737e9", "score": "0.6521164", "text": "def get_code(name)\n return @codes[name]\n end", "title": "" }, { "docid": "f6f0c211ab37d96d0a1dce3809b577a0", "score": "0.65202564", "text": "def name_to_code(name)\n code = Types.to_code(name)\n if code.nil?\n matches = /^TYPE(\\d+)$/.match(name)\n code = matches[1].to_i if matches\n end\n code\n end", "title": "" }, { "docid": "9e776d650b82afaf65ce022749a4f16f", "score": "0.63961124", "text": "def get_code(name)\n if COUNTRIES.value?(name)\n COUNTRIES.each_pair do |k,v|\n if v.eql?(name)\n return k.to_s\n end\n end\n end\n end", "title": "" }, { "docid": "57fb82e583d08db265aa09dfb09be8da", "score": "0.62779164", "text": "def name\n item.to_s\n end", "title": "" }, { "docid": "cfeff236c3ce2abc7ece1074baa476e8", "score": "0.62073106", "text": "def code\n name\n end", "title": "" }, { "docid": "1c03f70c30c3e0434dc7d23d00fee8d1", "score": "0.6199961", "text": "def language_name_of(item)\n language_name_for_code(language_code_of(item))\nend", "title": "" }, { "docid": "7f936435750941b8e446d38f0b65acd6", "score": "0.617561", "text": "def for_name name\n\t\tCoder.for_name name\n\tend", "title": "" }, { "docid": "c0895c979d459739407ac6d5f031e61d", "score": "0.61323625", "text": "def character_name_for_item\n \"#{name}\"\n end", "title": "" }, { "docid": "ce88df5d86d6a044ef57958378acbafb", "score": "0.610077", "text": "def name_code\n \"#{self.code} - #{self.name} \"\n end", "title": "" }, { "docid": "ff1043457b367d256ecd4a66533dd522", "score": "0.6064681", "text": "def name_code\n \t \n \tself.block_name = self.block_name.upcase\n \t\n \tself.code = self.block_name[0..2]\n end", "title": "" }, { "docid": "3d4e00b89f4235c4a2f24537fe5941dd", "score": "0.60303706", "text": "def item_name\n name\n end", "title": "" }, { "docid": "6eba7b94595ab5f22bae49896d95c843", "score": "0.6020115", "text": "def tolocalname(item, itemkey)\n item[itemkey]\n end", "title": "" }, { "docid": "09ca3f27395904972dfc29ec87e5be94", "score": "0.5995244", "text": "def name\n return \"#{@item[:name]}\"\n end", "title": "" }, { "docid": "ff3cd7b1ecf9ec6c82602d9b9c1f5870", "score": "0.59899884", "text": "def get_item name\n raise \"Invalid SiteMap::Item name. Names must not contain dots '#{name}'\" if name.to_s.include?(\".\")\n self.menu_items[name] ||= SiteMap::Item.new(name, self)\n self.menu_items[name]\n end", "title": "" }, { "docid": "7c205e6fcb37e2f4d370bc917e79c7be", "score": "0.59381944", "text": "def language_name_of(item)\n language_name_for_code item[:language]\nend", "title": "" }, { "docid": "c2ae2b40c3f4e00e19ba01eb18a4022b", "score": "0.5909538", "text": "def get_item_ui_name_from_id(item_id)\n return catalog[item_id]\n end", "title": "" }, { "docid": "5004e879a9ab48fc6f8aede33a9d7811", "score": "0.5880764", "text": "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "title": "" }, { "docid": "5004e879a9ab48fc6f8aede33a9d7811", "score": "0.5880764", "text": "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "title": "" }, { "docid": "5004e879a9ab48fc6f8aede33a9d7811", "score": "0.5880764", "text": "def convert_name\n self.name = I18n.transliterate(self.name).upcase\n end", "title": "" }, { "docid": "eb7483554fe46fe0b817b7c506a881f5", "score": "0.5877263", "text": "def encode(name)\n\tcode_name = last_first(letter_shifter(name))\nend", "title": "" }, { "docid": "4d3517e51f9200f29cc501d9993382e1", "score": "0.5871446", "text": "def generate_code\n self.name.downcase.gsub(/[^\\w]/, '')\n end", "title": "" }, { "docid": "c93798c3ec7df9f8b0063aed419a103f", "score": "0.5870187", "text": "def tolocalname(item, itemkey)\n item[itemkey].to_s\n end", "title": "" }, { "docid": "633121a7b7b09d5dbbe300a5e27de205", "score": "0.5865683", "text": "def convert_to_code(module_name, name)\n return \"\" if (!name.is_a?(Symbol) || name == :nil)\n\n begin\n cname = name.to_s.swapcase\n\n # specified color index\n if cname.index(\"INDEX\")\n num = cname.sub(\"INDEX\", \"\").to_i - 1\n return eval(%{#{module_name}::INDEX}) + num.to_s + \"m\"\n end\n\n code = eval(%{#{module_name}::#{cname}})\n rescue NameError\n raise(NameError ,%{:#{name} is not defined! Please check reference.})\n end\n return code\n end", "title": "" }, { "docid": "35f3f0f1018e6d58a66c231cfe9a2fb5", "score": "0.58646095", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "35f3f0f1018e6d58a66c231cfe9a2fb5", "score": "0.58646095", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "35f3f0f1018e6d58a66c231cfe9a2fb5", "score": "0.58646095", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "35f3f0f1018e6d58a66c231cfe9a2fb5", "score": "0.58646095", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "35f3f0f1018e6d58a66c231cfe9a2fb5", "score": "0.58646095", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "040276908089cbd8b317ef563a54fec3", "score": "0.58589244", "text": "def get_code(name)\n country_code_by_name_lookup[name]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "5274c658c137a57e33b2c5c16b7f92ed", "score": "0.58512366", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "f5fe9d27ff09d6ce2ccca3a192b748bd", "score": "0.5837795", "text": "def the_code\n object.slug.to_s.upcase\n end", "title": "" }, { "docid": "f5fe9d27ff09d6ce2ccca3a192b748bd", "score": "0.5837795", "text": "def the_code\n object.slug.to_s.upcase\n end", "title": "" }, { "docid": "921e155ff9fee8c4b3146c8af1c5dd2a", "score": "0.57867265", "text": "def generate_code\n self.code ||= self.name.mb_chars.normalize(:kd).gsub(/[^\\x00-\\x7F]/n,'').to_s.gsub(/\\W+/,\"_\").downcase\n end", "title": "" }, { "docid": "0ff83884681538da30bab378afd817b3", "score": "0.57798475", "text": "def transmogrify(name)\n name\n end", "title": "" }, { "docid": "4371417f4c8236478348135ed19dc882", "score": "0.5764126", "text": "def purchase_item_name(item)\n Item.find_by(id: item.item_id).name\n end", "title": "" }, { "docid": "b3000acf786ce37c06bd28e4e7f31cc4", "score": "0.574816", "text": "def code_with_name\n\t\t\"#{self.code} - #{self.name}\"\n\tend", "title": "" }, { "docid": "d48cb1015870156759f04870fe838bc0", "score": "0.57435787", "text": "def unique_name_for(item); end", "title": "" }, { "docid": "39e3f2f18b3a33fdd2d0ea0c91d224f9", "score": "0.5737453", "text": "def name\n return \"#{@code}\"\n end", "title": "" }, { "docid": "6155f9eadd6eb7144bd7c7d68f9484bb", "score": "0.5712596", "text": "def parse_code(property, hash_name)\n item_from_hash = \"#{hash_name}['#{property.api_name}']\"\n return \"parse_time_string(#{item_from_hash})\" if time?(property)\n\n if primitive?(property)\n return \"name_from_self_link(#{item_from_hash})\" \\\n if property.name_from_self_link\n\n return item_from_hash.to_s\n elsif typed_array?(property)\n class_name = modularized_property_class(property.item_type)\n return \"#{class_name}Array.parse(#{item_from_hash}, to_s)\"\n end\n \"#{modularized_property_class(property)}.new(#{item_from_hash}, to_s)\"\n end", "title": "" }, { "docid": "fb04a999d068af122d29b05bef02175c", "score": "0.57061744", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "fb04a999d068af122d29b05bef02175c", "score": "0.57061744", "text": "def name\n return @@codes[@val]\n end", "title": "" }, { "docid": "b722379eecc0ff134db1eed7da804187", "score": "0.5705191", "text": "def storable(item)\n return item if item.respond_to?(:name)\n\n titlecase(item)\n end", "title": "" }, { "docid": "a9922400e8ac8c170d78a86b4ad56b81", "score": "0.56963444", "text": "def item_code( seqno )\n \"#{ code }-#{ seqno }#{ '-' if code.nil? }\" unless seqno.nil?\n end", "title": "" }, { "docid": "3ef930ef5ae956d51df4c7f0e138e1dd", "score": "0.5672631", "text": "def name\n \"#{number}-#{code}\"\n end", "title": "" }, { "docid": "2c65c4ea95679a477fd8c9b6cbf88daa", "score": "0.5665935", "text": "def sym_to_code(sym)\n static_list_codes.find {|el| el[0] == sym }[1]\n end", "title": "" }, { "docid": "aca19de2dde7072d9733fb5a09335c44", "score": "0.56164134", "text": "def name\n\t\t@codes.to_a.sort!.join('-')\n\tend", "title": "" }, { "docid": "b6ed5b2edef9f5e75c1d66e8f4605f19", "score": "0.56083924", "text": "def get_item_type_ui_name(item_type)\n return catalog[item_type] \n end", "title": "" }, { "docid": "368e7ac4b6a88d052dac11285514ff3c", "score": "0.5576514", "text": "def code(name, identifier={:index => 0}, &block)\n element(name, :code, identifier, &block)\n end", "title": "" }, { "docid": "8b9dd2ea81190c1e36ce1829813235c9", "score": "0.5557018", "text": "def after_item(item)\n item.upcase\n end", "title": "" }, { "docid": "25333300b652e06d9402e57e6b06bb1b", "score": "0.5545767", "text": "def clean_item_name item, _context\n strip_item item\nend", "title": "" }, { "docid": "57f8fc20975b3297393c2dbf809fed37", "score": "0.55448115", "text": "def get_item_type(item_name)\n item_id = get_item_id(item_name)\n return get_item_type_from_id(item_id)\n end", "title": "" }, { "docid": "3538ec8b16788888a64299d025364684", "score": "0.553833", "text": "def formatted_item_name(name = nil)\n name = item_name(name)\n name.present? ? \"« #{@item.name} » \" : \"\"\n end", "title": "" }, { "docid": "02b5dcc827503ed8e119ecc29b2a3d8a", "score": "0.55368006", "text": "def toVarName; @items.join('_') end", "title": "" }, { "docid": "2f3c622c0daf4ddc2b5675942306d44d", "score": "0.5534746", "text": "def translate_name(name)\r\n name.to_s.gsub('_', '-')\r\n end", "title": "" }, { "docid": "3924e98a392ab18ca93f4aab72d7a060", "score": "0.55309105", "text": "def set_code_name\n _code_name = self.name.gsub(/'/, '').gsub(/ /, '_').downcase\n if self.code_name != _code_name\n self.code_name = _code_name\n self.save\n end\n end", "title": "" }, { "docid": "a581db949e444c868bdbd3fe49f82930", "score": "0.5529629", "text": "def symbol ()\n # prefer a code display value since the state name may not be unique between modules\n if ! @codes.nil? && ! @codes.empty?\n @codes.first['display'].gsub(/\\s+/,\"_\").downcase.to_sym\n else\n @name.gsub(/\\s+/,\"_\").downcase.to_sym\n end\n end", "title": "" }, { "docid": "f188700e17784ed98dd871c46db46f43", "score": "0.55289143", "text": "def to_ruby\n @name.to_s.to_sym\n end", "title": "" }, { "docid": "b4186aa69ebc777065a55acbffae1438", "score": "0.5527861", "text": "def name\n\t\tself.item.name\n\tend", "title": "" }, { "docid": "f92cf9c8c5ec1c726580bf9319cafdfb", "score": "0.5526995", "text": "def label_item(items, item_name, label)\n item = find_item(items, item_name)\n item[:name] = [item[:name], label]\n item\n end", "title": "" }, { "docid": "f3ba154f55194554d7e122a41486c6a9", "score": "0.5526739", "text": "def item_code\n params['ap_itemcode']\n end", "title": "" }, { "docid": "de47e7faff4b83d770f0d996abf2db67", "score": "0.5526482", "text": "def name\n @item[\"name\"]\n end", "title": "" }, { "docid": "7f00dae0e46b689e49459c157c5390f6", "score": "0.551597", "text": "def get_item_id(item_name)\n item_id_name = item_name + \"_id\"\n return catalog[item_id_name]\n end", "title": "" }, { "docid": "e5c815dd7cdb419c458d73819ceea501", "score": "0.5513122", "text": "def item_class_item_lookup_code\n self.item_class_component.item_class.ItemLookupCode\nend", "title": "" }, { "docid": "047af36011b5f7b9c8b3040c1652c1bd", "score": "0.549272", "text": "def item_code\n params['ap_itemcode']\n end", "title": "" }, { "docid": "047af36011b5f7b9c8b3040c1652c1bd", "score": "0.549272", "text": "def item_code\n params['ap_itemcode']\n end", "title": "" }, { "docid": "3f34b7dea44ff3dc9156bbc6c32e7890", "score": "0.5467094", "text": "def language_code_of(item)\n # \"/en/foo/\" becomes \"en\"\n (item.identifier.without_ext.match(/^\\/items\\/([a-z]{2})\\//) || [])[1]\nend", "title": "" }, { "docid": "45c79fae53516981f7eadd09085b1f42", "score": "0.54656535", "text": "def item_title\n case @ctype\n when Item::TYPES[0]\n \"Items\"\n when Item::TYPES[1]\n \"Items de gasto\"\n when Item::TYPES[2]\n \"Productos\"\n when Item::TYPES[3]\n \"Servicios\"\n end\n end", "title": "" }, { "docid": "9f7ac09d478c4fd6e080caf1818af0e2", "score": "0.54448766", "text": "def names_to_codes(names)\n names.map { |s| name_to_code(s) }\n end", "title": "" }, { "docid": "1b6c9acd3188b335f8948ac21f7cdbba", "score": "0.5444399", "text": "def identifier_from_name(name)\n identifier_mappings[name]\n end", "title": "" }, { "docid": "1b6c9acd3188b335f8948ac21f7cdbba", "score": "0.5444399", "text": "def identifier_from_name(name)\n identifier_mappings[name]\n end", "title": "" }, { "docid": "b941fb989c22f2985a408c8dbeacd238", "score": "0.54416114", "text": "def item_type\n name.singularize.ns_underscore\n end", "title": "" }, { "docid": "2173a6a06c3b18615721dc9069191fb7", "score": "0.54369575", "text": "def product_name=(name)\n\t item = Item.find_by_code(name.split(':')[0])\n\t if !item\n\t self.item_id = nil\n\t else\n\t self.item_id = item.id\n\t end\n\tend", "title": "" }, { "docid": "2d031f27f2a8db8ca4be86bb3dd289f2", "score": "0.5435223", "text": "def names_string_to_codes(name_string)\n names_to_codes(name_string.split(' '))\n end", "title": "" }, { "docid": "5837afe95535479b79accb2e5443decd", "score": "0.54267424", "text": "def language_code_of(item)\n (item.identifier.match(/^\\/([a-z]{2})\\//) || ['','en'])[1]\nend", "title": "" }, { "docid": "b85fb4ce63efdc5a08ebd760925a9eff", "score": "0.5419671", "text": "def canonical_identifier_of(item)\n \t\tlanguage_code = language_code_of(item)\n \t\tpure_identifier = item.identifier[/^\\/[a-z]{2}(\\/.*)/, 1]\n (CANONICAL_IDENTIFIER_MAPPING[language_code] || {}).invert[pure_identifier]\n end", "title": "" }, { "docid": "39034f0ea5728d567ac7703362b8edaf", "score": "0.541639", "text": "def item_name\n params['item_name']\n end", "title": "" }, { "docid": "5e9c4d7f21f1366401fdababec35aa10", "score": "0.5414765", "text": "def name(code = nil)\n @names[code&.to_sym || @code] || @names[@code]\n end", "title": "" }, { "docid": "4819cf3182c152f9eac843c20cd46822", "score": "0.54065585", "text": "def venue_name(item)\n\tif !item.key?(:event_venue)\n\t\treturn\n\tend\n\n\tname = item[:event_venue]\n\n\tcase name\n\t\twhen 'cpn-old'\n\t\t\treturn 'Centar za Promociju Nauke'\n\t\twhen 'impacthub'\n\t\t\treturn 'Impact HUB'\n\t\twhen 'parobrod'\n\t\t\treturn 'Parobrod'\n\t\twhen 'skc'\n\t\t\treturn 'Studentski kulturni centar'\n\t\twhen 'dom-omladine'\n\t\t\treturn 'Dom omladine'\n\tend\n\n\treturn name\nend", "title": "" }, { "docid": "71296ebafd467d2d2c6d4dff8930ded8", "score": "0.54024357", "text": "def codename\n @codename\n end", "title": "" }, { "docid": "8aa3108a694910819511ee380e91798e", "score": "0.54016733", "text": "def loop_item_name_with the_name, default_language, loop_source\n #l_item_name = item_types[row_as_a[i][0].to_s].loop_item_names.find_by_item_name(row_as_a[i][1].to_s)\n the_name_db_safe = the_name\n begin\n the_l_item_name_field = self.loop_item_name_fields.find_by_item_name(the_name)\n rescue\n the_name_db_safe = the_name.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\").to_s\n the_l_item_name_field = self.loop_item_name_fields.find_by_item_name(the_name_db_safe)\n end\n\n l_item_name = the_l_item_name_field.present? ? the_l_item_name_field.loop_item_name : nil\n\n return l_item_name if l_item_name\n\n l_item_name = LoopItemName.new()\n l_item_name.loop_item_type_id = self.id\n l_item_name.loop_source_id = loop_source.id\n\n l_item_name.transaction do\n l_item_name.save!\n\n l_item_name_field = l_item_name.loop_item_name_fields.build(\n item_name: the_name_db_safe,\n language: default_language,\n is_default_language: true\n )\n\n l_item_name_field.save!\n end\n\n l_item_name\n end", "title": "" }, { "docid": "80c948be8ac1adcb450e9659f9123c39", "score": "0.53998905", "text": "def irb_name\n @name.to_s.upcase.to_sym\n end", "title": "" }, { "docid": "05bdc4034c9c4803016fa5789ed640b4", "score": "0.53886425", "text": "def item_name\n params['item_name']\n end", "title": "" }, { "docid": "16ccf06c686027472a0c8451c231261b", "score": "0.5381517", "text": "def country_name_to_code(name: 'united_states')\n fetch(\"address.country_by_name.#{name}\")\n end", "title": "" }, { "docid": "bde083e1689172960adac54541388c17", "score": "0.5378807", "text": "def get_catalog_item_by_name(catalog_id, catalog_item_name)\n end", "title": "" }, { "docid": "65c7268ca1ca839271baabeb1a89278e", "score": "0.5368578", "text": "def rubyize(name)\n name.underscore\n end", "title": "" }, { "docid": "7cceff004c60025b4275eef92db7573c", "score": "0.5366941", "text": "def name_coder(str)\n\tstr = vowel_adv(str)\n\tstr = consonant_change(str)\n\tstr = name_reverse(str)\nend", "title": "" }, { "docid": "c55b5f2ece05a48211bf7725c3c86504", "score": "0.536668", "text": "def radio_id_for(_name, _item)\n \"#{@object_name}_#{_name}_#{_item}\"\n end", "title": "" }, { "docid": "efa865a149882fe7eb465d372e59a533", "score": "0.5353632", "text": "def canonical_identifier_of(item)\n language_code = language_code_of(item)\n pure_identifier = item.identifier[/^\\/[a-z]{2}(\\/.*)/, 1]\n\n (CANONICAL_IDENTIFIER_MAPPING[language_code] || {}).invert[pure_identifier]\n end", "title": "" }, { "docid": "be39797736ad1ccb43ebf5c4e6c2e301", "score": "0.5331321", "text": "def agentcode(name)\n name.downcase!\t\n name.tr!('bcdfghjklmnpqrstvwxyzb','cdfghjklmnpqrstvwxyzbc')\n name.tr!('aeiou','eioua')\n name.split(\" \").reverse.map(&:capitalize).join(\" \")\nend", "title": "" }, { "docid": "12c202f26a5a6a3feeb2ce85523100b8", "score": "0.53306955", "text": "def map_item(item)\n context = Context.new(source_item: item, settings: settings, mappings: name_id_maps)\n map_to_context context\n return context.omeka_item\n end", "title": "" }, { "docid": "dcbdbee2fb3074f93ac7e5290156cb08", "score": "0.5329663", "text": "def convert_name(name, _class)\n name_index = get_name_index(name)\n\n # The ptg value depends on the class of the ptg.\n if _class == 0\n ptgName = @ptg['ptgName']\n elsif _class == 1\n ptgName = @ptg['ptgNameV']\n elsif _class == 2\n ptgName = @ptg['ptgNameA']\n end\n\n [ptgName, name_index].pack('CV')\n end", "title": "" }, { "docid": "a8eee1012794dfcc0a1db6657c07e895", "score": "0.5325395", "text": "def get_item(item)\n\t\t\tItem.find_by_name(item)\n\t\tend", "title": "" } ]